@lokascript/hyperscript-adapter 2.0.0 → 2.2.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 (34) hide show
  1. package/README.md +46 -3
  2. package/dist/hyperscript-i18n-ar.global.js +4 -4
  3. package/dist/hyperscript-i18n-bn.global.js +4 -4
  4. package/dist/hyperscript-i18n-de.global.js +4 -4
  5. package/dist/hyperscript-i18n-east-asian.global.js +4 -4
  6. package/dist/hyperscript-i18n-en.global.js +6 -6
  7. package/dist/hyperscript-i18n-es.global.js +4 -4
  8. package/dist/hyperscript-i18n-fr.global.js +4 -4
  9. package/dist/hyperscript-i18n-he.global.js +4 -4
  10. package/dist/hyperscript-i18n-hi.global.js +4 -4
  11. package/dist/hyperscript-i18n-id.global.js +4 -4
  12. package/dist/hyperscript-i18n-it.global.js +4 -4
  13. package/dist/hyperscript-i18n-ja.global.js +4 -4
  14. package/dist/hyperscript-i18n-ko.global.js +4 -4
  15. package/dist/hyperscript-i18n-ms.global.js +4 -4
  16. package/dist/hyperscript-i18n-pl.global.js +4 -4
  17. package/dist/hyperscript-i18n-pt.global.js +4 -4
  18. package/dist/hyperscript-i18n-qu.global.js +4 -4
  19. package/dist/hyperscript-i18n-ru.global.js +4 -4
  20. package/dist/hyperscript-i18n-slavic.global.js +4 -4
  21. package/dist/hyperscript-i18n-south-asian.global.js +4 -4
  22. package/dist/hyperscript-i18n-southeast-asian.global.js +4 -4
  23. package/dist/hyperscript-i18n-sw.global.js +4 -4
  24. package/dist/hyperscript-i18n-th.global.js +4 -4
  25. package/dist/hyperscript-i18n-tl.global.js +4 -4
  26. package/dist/hyperscript-i18n-tr.global.js +4 -4
  27. package/dist/hyperscript-i18n-uk.global.js +4 -4
  28. package/dist/hyperscript-i18n-vi.global.js +4 -4
  29. package/dist/hyperscript-i18n-western.global.js +4 -4
  30. package/dist/hyperscript-i18n-zh.global.js +4 -4
  31. package/dist/hyperscript-i18n.global.js +73 -7
  32. package/dist/hyperscript-i18n.global.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/hyperscript-renderer.ts +3 -0
@@ -1,4 +1,4 @@
1
- var HyperscriptI18n=(function(exports){'use strict';var gt=new Map,Et=new Map,At=new Map;function Ct(r,t,e){gt.set(r,t),Et.set(r,e),At.delete(r);}var wt=class{constructor(r,t){this.pos=0,this.tokens=r,this.language=t;}peek(r=0){let t=this.pos+r;return t<0||t>=this.tokens.length?null:this.tokens[t]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let t=[];for(;!this.isAtEnd()&&r(this.peek());)t.push(this.advance());return t}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function y(r,t){return {start:r,end:t}}function g(r,t,e,n){if(typeof n=="string")return {value:r,kind:t,position:e,normalized:n};if(n){let{normalized:i,stem:o,stemConfidence:s}=n;return {value:r,kind:t,position:e,...i!==void 0&&{normalized:i},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s}}}return {value:r,kind:t,position:e}}function G(r){return /\s/.test(r)}function Se(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function Be(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function x(r){return /\d/.test(r)}function kt(r){return /[a-zA-Z]/.test(r)}function k(r){return /[a-zA-Z0-9_-]/.test(r)}function Tt(r){return t=>{let e=t.charCodeAt(0);return r.some(([n,i])=>e>=n&&e<=i)}}function bt(r,t){if(t>=r.length)return null;let e=r[t];if(!Se(e))return null;let n=t,i="";if(e==="#"||e==="."){for(i+=r[n++];n<r.length&&k(r[n]);)i+=r[n++];if(i.length<=1)return null;if(n<r.length&&r[n]==="."&&e==="#"){let s=n+1;for(;s<r.length&&k(r[s]);)s++;if(s<r.length&&r[s]==="(")return i}}else if(e==="["){let o=1,s=false,a=null,u=false;for(i+=r[n++];n<r.length&&o>0;){let c=r[n];i+=c,u?u=false:c==="\\"?u=true:s?c===a&&(s=false,a=null):c==='"'||c==="'"||c==="`"?(s=true,a=c):c==="["?o++:c==="]"&&o--,n++;}if(o!==0)return null}else if(e==="@"){for(i+=r[n++];n<r.length&&k(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(e==="*"){for(i+=r[n++];n<r.length&&k(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(e==="<"){if(i+=r[n++],n>=r.length||!kt(r[n]))return null;for(;n<r.length&&k(r[n]);)i+=r[n++];for(;n<r.length;){let o=r[n];if(o==="."){if(i+=r[n++],n>=r.length||!k(r[n]))return null;for(;n<r.length&&k(r[n]);)i+=r[n++];}else if(o==="#"){if(i+=r[n++],n>=r.length||!k(r[n]))return null;for(;n<r.length&&k(r[n]);)i+=r[n++];}else if(o==="["){let s=1,a=false,u=null,c=false;for(i+=r[n++];n<r.length&&s>0;){let l=r[n];i+=l,c?c=false:l==="\\"?c=true:a?l===u&&(a=false,u=null):l==='"'||l==="'"||l==="`"?(a=true,u=l):l==="["?s++:l==="]"&&s--,n++;}if(s!==0)return null}else break}for(;n<r.length&&G(r[n]);)i+=r[n++];if(n<r.length&&r[n]==="/")for(i+=r[n++];n<r.length&&G(r[n]);)i+=r[n++];if(n>=r.length||r[n]!==">")return null;i+=r[n++];}return i||null}function St(r,t){if(t>=r.length||r[t]!=="'"||t+1>=r.length||r[t+1].toLowerCase()!=="s")return false;if(t+2>=r.length)return true;let n=r[t+2];return G(n)||n==="*"||!k(n)}function Bt(r,t){if(t>=r.length)return null;let e=r[t];if(!Be(e)||e==="'"&&St(r,t))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[e];if(!i)return null;let o=t+1,s=e,a=false;for(;o<r.length;){let u=r[o];if(s+=u,a)a=false;else if(u==="\\")a=true;else if(u===i)return s;o++;}return s}function Pe(r,t){if(t>=r.length)return false;let e=r[t],n=r[t+1]||"",i=r[t+2]||"";if(e==="/"&&n!=="/"&&/[a-zA-Z0-9._-]/.test(n)||e==="/"&&n==="/"&&/[a-zA-Z]/.test(i)||e==="."&&(n==="/"||n==="."&&i==="/"))return true;let o=r.slice(t,t+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function Pt(r,t){if(!Pe(r,t))return null;let e=t,n="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;e<r.length;){let o=r[e];if(o==="#"){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=o,e++;e<r.length&&/[a-zA-Z0-9_-]/.test(r[e]);)n+=r[e++];break}if(i.test(o))n+=o,e++;else break}return n.length<2?null:n}function xt(r,t){if(t>=r.length)return null;let e=r[t];if(!x(e)&&e!=="-"&&e!=="+")return null;let n=t,i="";if((r[n]==="-"||r[n]==="+")&&(i+=r[n++]),n>=r.length||!x(r[n]))return null;for(;n<r.length&&x(r[n]);)i+=r[n++];if(n<r.length&&r[n]===".")for(i+=r[n++];n<r.length&&x(r[n]);)i+=r[n++];return n<r.length&&(r.slice(n,n+2)==="ms"?i+="ms":(r[n]==="s"||r[n]==="m"||r[n]==="h")&&(i+=r[n])),i}var xe=class Re{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(t,e,n){if(t[e]!==".")return false;let i=n[n.length-1],o=i&&i.position.end<e;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return n.push(g(".","operator",y(e,e+1))),true;let u=e+1;for(;u<t.length&&k(t[u]);)u++;return u<t.length&&t[u]==="("?(n.push(g(".","operator",y(e,e+1))),true):false}initializeKeywordsFromProfile(t,e=[]){let n=new Map;if(t.keywords){for(let[i,o]of Object.entries(t.keywords))if(n.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:o.normalized||i});}if(t.references){for(let[i,o]of Object.entries(t.references))n.set(o,{native:o,normalized:i});for(let i of Object.keys(t.references))n.has(i)||n.set(i,{native:i,normalized:i});}if(t.roleMarkers){for(let[i,o]of Object.entries(t.roleMarkers))if(o.primary&&n.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:i});}for(let i of e)n.set(i.native,i);this.profileKeywords=Array.from(n.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(t){return t.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(t,e){for(let n of this.profileKeywords)if(t.slice(e).startsWith(n.native))return g(n.native,"keyword",y(e,e+n.native.length),n.normalized);return null}isKeywordStart(t,e){let n=t.slice(e);return this.profileKeywords.some(i=>n.startsWith(i.native))}lookupKeyword(t){return this.profileKeywordMap.get(t.toLowerCase())}isKeyword(t){return this.profileKeywordMap.has(t.toLowerCase())}setNormalizer(t){this.normalizer=t;}tryNormalize(t){if(!this.normalizer)return null;let e=this.normalizer.normalize(t);return e.stem!==t&&e.confidence>=.7?e:null}tryMorphKeywordMatch(t,e,n){let i=this.tryNormalize(t);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return g(t,"keyword",y(e,n),s)}trySelector(t,e){let n=bt(t,e);return n?g(n,"selector",y(e,e+n.length)):null}tryEventModifier(t,e){if(t[e]!==".")return null;let n=t.slice(e).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!n)return null;let i=n[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=n[1];return {...g(i,"event-modifier",y(e,e+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(t,e){let n=Bt(t,e);return n?g(n,"literal",y(e,e+n.length)):null}tryNumber(t,e){let n=xt(t,e);return n?g(n,"literal",y(e,e+n.length)):null}tryMatchTimeUnit(t,e,n,i=false){let o=e;if(i)for(;o<t.length&&G(t[o]);)o++;let s=t.slice(o);for(let a of n){let u=s.slice(0,a.length);if(a.caseInsensitive?u.toLowerCase()===a.pattern.toLowerCase():u===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let l=s[a.length]||"";if(k(l))continue}return {suffix:a.suffix,endPos:o+a.length}}}return null}parseBaseNumber(t,e,n=true){let i=e,o="";if(n&&(t[i]==="-"||t[i]==="+")&&(o+=t[i++]),i>=t.length||!x(t[i]))return null;for(;i<t.length&&x(t[i]);)o+=t[i++];if(i<t.length&&t[i]===".")for(o+=t[i++];i<t.length&&x(t[i]);)o+=t[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(t,e,n,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(t,e,o);if(!a)return null;let{number:u,endPos:c}=a,l=[...n,...Re.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(t,c,l,s);return d&&(u+=d.suffix,c=d.endPos),g(u,"literal",y(e,c))}tryUrl(t,e){let n=Pt(t,e);return n?g(n,"url",y(e,e+n.length)):null}tryVariableRef(t,e){if(t[e]!==":"||e+1>=t.length||!k(t[e+1]))return null;let n=e+1;for(;n<t.length&&k(t[n]);)n++;let i=t.slice(e,n);return g(i,"identifier",y(e,n))}tryOperator(t,e){let n=t.slice(e,e+2);if(["==","!=","<=",">=","&&","||","->"].includes(n))return g(n,"operator",y(e,e+2));let i=t[e];return ["<",">","!","+","-","*","/","="].includes(i)?g(i,"operator",y(e,e+1)):["(",")","{","}",",",";",":"].includes(i)?g(i,"punctuation",y(e,e+1)):null}tryMultiCharParticle(t,e,n){for(let i of n)if(t.slice(e,e+i.length)===i)return g(i,"particle",y(e,e+i.length));return null}};xe.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 Rt=xe,_e={code:"hi",name:"Hindi",nativeName:"\u0939\u093F\u0928\u094D\u0926\u0940",direction:"ltr",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:true,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["\u0947\u0902","\u093E","\u0940","\u0947","\u094B"],subjectDrop:true},references:{me:"\u092E\u0948\u0902",it:"\u092F\u0939",you:"\u0906\u092A",result:"\u092A\u0930\u093F\u0923\u093E\u092E",event:"\u0918\u091F\u0928\u093E",target:"\u0932\u0915\u094D\u0937\u094D\u092F",body:"\u092C\u0949\u0921\u0940"},possessive:{marker:"\u0915\u093E",markerPosition:"between",keywords:{\u092E\u0947\u0930\u093E:"me",\u092E\u0947\u0930\u0940:"me",\u092E\u0947\u0930\u0947:"me",\u0924\u0947\u0930\u093E:"you",\u0924\u0947\u0930\u0940:"you",\u0924\u0947\u0930\u0947:"you",\u0906\u092A\u0915\u093E:"you",\u0906\u092A\u0915\u0940:"you",\u0906\u092A\u0915\u0947:"you",\u0909\u0938\u0915\u093E:"it",\u0909\u0938\u0915\u0940:"it",\u0909\u0938\u0915\u0947:"it",\u0907\u0938\u0915\u093E:"it",\u0907\u0938\u0915\u0940:"it",\u0907\u0938\u0915\u0947:"it"}},roleMarkers:{patient:{primary:"\u0915\u094B",position:"after"},destination:{primary:"\u092E\u0947\u0902",alternatives:["\u0915\u094B","\u092A\u0930"],position:"after"},source:{primary:"\u0938\u0947",position:"after"},style:{primary:"\u0938\u0947",position:"after"},event:{primary:"\u092A\u0930",position:"after"}},keywords:{toggle:{primary:"\u091F\u0949\u0917\u0932",alternatives:["\u092C\u0926\u0932\u0947\u0902","\u092C\u0926\u0932"],normalized:"toggle"},add:{primary:"\u091C\u094B\u0921\u093C\u0947\u0902",alternatives:["\u091C\u094B\u0921\u093C"],normalized:"add"},remove:{primary:"\u0939\u091F\u093E\u090F\u0902",alternatives:["\u0939\u091F\u093E","\u092E\u093F\u091F\u093E\u090F\u0902"],normalized:"remove"},put:{primary:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"],normalized:"put"},append:{primary:"\u091C\u094B\u0921\u093C\u0947\u0902_\u0905\u0902\u0924",alternatives:[],normalized:"append"},prepend:{primary:"\u091C\u094B\u0921\u093C\u0947\u0902_\u0936\u0941\u0930\u0942",alternatives:[],normalized:"prepend"},take:{primary:"\u0932\u0947\u0902",alternatives:["\u0932\u0947"],normalized:"take"},make:{primary:"\u092C\u0928\u093E\u090F\u0902",alternatives:["\u092C\u0928\u093E"],normalized:"make"},clone:{primary:"\u0915\u0949\u092A\u0940",alternatives:["\u092A\u094D\u0930\u0924\u093F\u0932\u093F\u092A\u093F"],normalized:"clone"},swap:{primary:"\u092C\u0926\u0932\u0947\u0902_\u0938\u094D\u0925\u093E\u0928",alternatives:[],normalized:"swap"},morph:{primary:"\u0930\u0942\u092A\u093E\u0902\u0924\u0930",alternatives:[],normalized:"morph"},set:{primary:"\u0938\u0947\u091F",alternatives:["\u0928\u093F\u0930\u094D\u0927\u093E\u0930\u093F\u0924"],normalized:"set"},get:{primary:"\u092A\u094D\u0930\u093E\u092A\u094D\u0924",alternatives:["\u092A\u093E\u090F\u0902"],normalized:"get"},increment:{primary:"\u092C\u0922\u093C\u093E\u090F\u0902",alternatives:["\u092C\u0922\u093C\u093E"],normalized:"increment"},decrement:{primary:"\u0918\u091F\u093E\u090F\u0902",alternatives:["\u0918\u091F\u093E"],normalized:"decrement"},log:{primary:"\u0932\u0949\u0917",alternatives:["\u0926\u0930\u094D\u091C"],normalized:"log"},show:{primary:"\u0926\u093F\u0916\u093E\u090F\u0902",alternatives:["\u0926\u093F\u0916\u093E"],normalized:"show"},hide:{primary:"\u091B\u093F\u092A\u093E\u090F\u0902",alternatives:["\u091B\u093F\u092A\u093E"],normalized:"hide"},transition:{primary:"\u0938\u0902\u0915\u094D\u0930\u092E\u0923",alternatives:[],normalized:"transition"},on:{primary:"\u092A\u0930",alternatives:["\u092E\u0947\u0902","\u091C\u092C"],normalized:"on"},trigger:{primary:"\u091F\u094D\u0930\u093F\u0917\u0930",alternatives:[],normalized:"trigger"},send:{primary:"\u092D\u0947\u091C\u0947\u0902",alternatives:["\u092D\u0947\u091C"],normalized:"send"},focus:{primary:"\u092B\u094B\u0915\u0938",alternatives:["\u0915\u0947\u0902\u0926\u094D\u0930\u093F\u0924"],normalized:"focus"},blur:{primary:"\u0927\u0941\u0902\u0927\u0932\u093E",alternatives:["\u092B\u094B\u0915\u0938_\u0939\u091F\u093E\u090F\u0902"],normalized:"blur"},click:{primary:"\u0915\u094D\u0932\u093F\u0915",normalized:"click"},hover:{primary:"\u0939\u094B\u0935\u0930",alternatives:["\u090A\u092A\u0930_\u0930\u0916\u0947\u0902"],normalized:"hover"},submit:{primary:"\u0938\u092C\u092E\u093F\u091F",alternatives:["\u091C\u092E\u093E"],normalized:"submit"},input:{primary:"\u0907\u0928\u092A\u0941\u091F",alternatives:["\u0926\u0930\u094D\u091C"],normalized:"input"},change:{primary:"\u092C\u0926\u0932\u093E\u0935",alternatives:["\u092A\u0930\u093F\u0935\u0930\u094D\u0924\u0928"],normalized:"change"},go:{primary:"\u091C\u093E\u090F\u0902",alternatives:["\u091C\u093E"],normalized:"go"},wait:{primary:"\u092A\u094D\u0930\u0924\u0940\u0915\u094D\u0937\u093E",alternatives:["\u0930\u0941\u0915\u0947\u0902"],normalized:"wait"},fetch:{primary:"\u0932\u093E\u090F\u0902",alternatives:[],normalized:"fetch"},settle:{primary:"\u0938\u094D\u0925\u093F\u0930",alternatives:[],normalized:"settle"},if:{primary:"\u0905\u0917\u0930",alternatives:["\u092F\u0926\u093F"],normalized:"if"},when:{primary:"\u091C\u092C",normalized:"when"},where:{primary:"\u0915\u0939\u093E\u0901",normalized:"where"},else:{primary:"\u0935\u0930\u0928\u093E",alternatives:["\u0928\u0939\u0940\u0902 \u0924\u094B"],normalized:"else"},repeat:{primary:"\u0926\u094B\u0939\u0930\u093E\u090F\u0902",alternatives:["\u0926\u094B\u0939\u0930\u093E"],normalized:"repeat"},for:{primary:"\u0915\u0947 \u0932\u093F\u090F",alternatives:[],normalized:"for"},while:{primary:"\u091C\u092C \u0924\u0915",alternatives:[],normalized:"while"},continue:{primary:"\u091C\u093E\u0930\u0940",alternatives:[],normalized:"continue"},halt:{primary:"\u0930\u094B\u0915\u0947\u0902",alternatives:["\u0930\u094B\u0915"],normalized:"halt"},throw:{primary:"\u092B\u0947\u0902\u0915\u0947\u0902",alternatives:["\u092B\u0947\u0902\u0915"],normalized:"throw"},call:{primary:"\u0915\u0949\u0932",alternatives:["\u092C\u0941\u0932\u093E\u090F\u0902"],normalized:"call"},return:{primary:"\u0932\u094C\u091F\u093E\u090F\u0902",alternatives:["\u0932\u094C\u091F\u093E"],normalized:"return"},then:{primary:"\u092B\u093F\u0930",alternatives:["\u0924\u092C"],normalized:"then"},and:{primary:"\u0914\u0930",alternatives:[],normalized:"and"},end:{primary:"\u0938\u092E\u093E\u092A\u094D\u0924",alternatives:["\u0905\u0902\u0924"],normalized:"end"},js:{primary:"\u091C\u0947\u090F\u0938",alternatives:["js"],normalized:"js"},async:{primary:"\u0905\u0938\u093F\u0902\u0915",alternatives:[],normalized:"async"},tell:{primary:"\u092C\u0924\u093E\u090F\u0902",alternatives:["\u092C\u0924\u093E"],normalized:"tell"},default:{primary:"\u0921\u093F\u092B\u093C\u0949\u0932\u094D\u091F",alternatives:[],normalized:"default"},init:{primary:"\u092A\u094D\u0930\u093E\u0930\u0902\u092D",alternatives:[],normalized:"init"},behavior:{primary:"\u0935\u094D\u092F\u0935\u0939\u093E\u0930",alternatives:[],normalized:"behavior"},install:{primary:"\u0907\u0902\u0938\u094D\u091F\u0949\u0932",alternatives:[],normalized:"install"},measure:{primary:"\u092E\u093E\u092A\u0947\u0902",alternatives:[],normalized:"measure"},beep:{primary:"\u092C\u0940\u092A",alternatives:[],normalized:"beep"},break:{primary:"\u0930\u094B\u0915\u0947\u0902",alternatives:[],normalized:"break"},copy:{primary:"\u0915\u0949\u092A\u0940",alternatives:[],normalized:"copy"},exit:{primary:"\u092C\u093E\u0939\u0930",alternatives:[],normalized:"exit"},pick:{primary:"\u091A\u0941\u0928\u0947\u0902",alternatives:[],normalized:"pick"},render:{primary:"\u0930\u0947\u0902\u0921\u0930",alternatives:[],normalized:"render"},into:{primary:"\u092E\u0947\u0902",alternatives:["\u0915\u094B"],normalized:"into"},before:{primary:"\u0938\u0947 \u092A\u0939\u0932\u0947",alternatives:["\u092A\u0939\u0932\u0947"],normalized:"before"},after:{primary:"\u0915\u0947 \u092C\u093E\u0926",alternatives:["\u092C\u093E\u0926"],normalized:"after"},until:{primary:"\u0924\u0915",alternatives:[],normalized:"until"},event:{primary:"\u0918\u091F\u0928\u093E",alternatives:[],normalized:"event"},from:{primary:"\u0938\u0947",normalized:"from"}},tokenization:{particles:["\u0915\u094B","\u092E\u0947\u0902","\u092A\u0930","\u0938\u0947","\u0915\u093E","\u0915\u0940","\u0915\u0947","\u0924\u0915","\u0928\u0947"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"\u092A\u0930",alternatives:["\u092E\u0947\u0902","\u091C\u092C"],normalized:"on"},sourceMarker:{primary:"\u0938\u0947",position:"after"},eventMarker:{primary:"\u092A\u0930",alternatives:["\u092E\u0947\u0902"],position:"after"},temporalMarkers:["\u091C\u092C","\u091C\u092C \u092D\u0940"]}},_t=Tt([[2304,2431],[43232,43263]]),te=_t,be=new Set(["\u0915\u094B","\u092E\u0947\u0902","\u092A\u0930","\u0938\u0947","\u0915\u093E","\u0915\u0940","\u0915\u0947","\u0924\u0915","\u0928\u0947"]),Nt=[{native:"\u0938\u091A",normalized:"true"},{native:"\u0938\u0924\u094D\u092F",normalized:"true"},{native:"\u091D\u0942\u0920",normalized:"false"},{native:"\u0905\u0938\u0924\u094D\u092F",normalized:"false"},{native:"\u0916\u093E\u0932\u0940",normalized:"null"},{native:"\u0905\u092A\u0930\u093F\u092D\u093E\u0937\u093F\u0924",normalized:"undefined"},{native:"\u092A\u0939\u0932\u093E",normalized:"first"},{native:"\u0905\u0902\u0924\u093F\u092E",normalized:"last"},{native:"\u0905\u0917\u0932\u093E",normalized:"next"},{native:"\u092A\u093F\u091B\u0932\u093E",normalized:"previous"},{native:"\u0928\u093F\u0915\u091F\u0924\u092E",normalized:"closest"},{native:"\u092E\u0942\u0932",normalized:"parent"},{native:"\u0915\u094D\u0932\u093F\u0915",normalized:"click"},{native:"\u092A\u0930\u093F\u0935\u0930\u094D\u0924\u0928",normalized:"change"},{native:"\u091C\u092E\u093E",normalized:"submit"},{native:"\u0907\u0928\u092A\u0941\u091F",normalized:"input"},{native:"\u0932\u094B\u0921",normalized:"load"},{native:"\u0938\u094D\u0915\u094D\u0930\u0949\u0932",normalized:"scroll"},{native:"\u0915\u094B",normalized:"to"},{native:"\u0915\u0947 \u0938\u093E\u0925",normalized:"with"}],Ot=class extends Rt{constructor(){super(),this.language="hi",this.direction="ltr",this.initializeKeywordsFromProfile(_e,Nt);}tokenize(r){let t=[],e=0;for(;e<r.length;){if(G(r[e])){e++;continue}if(Se(r[e])){let i=this.tryEventModifier(r,e);if(i){t.push(i),e=i.position.end;continue}if(this.tryPropertyAccess(r,e,t)){e++;continue}let o=this.trySelector(r,e);if(o){t.push(o),e=o.position.end;continue}}if(Be(r[e])){let i=this.tryString(r,e);if(i){t.push(i),e=i.position.end;continue}}if(Pe(r,e)){let i=this.tryUrl(r,e);if(i){t.push(i),e=i.position.end;continue}}if(x(r[e])||r[e]==="-"&&e+1<r.length&&x(r[e+1])){let i=this.extractNumber(r,e);if(i){t.push(i),e=i.position.end;continue}}if(r[e]===":"){let i=e;e++;let o="";for(;e<r.length&&(k(r[e])||te(r[e]));)o+=r[e],e++;if(o){t.push(g(":"+o,"identifier",y(i,e),":"+o));continue}e=i;}if(te(r[e])){let i=e,o="";for(;e<r.length&&(te(r[e])||r[e]===" ");){if(r[e]===" "){if(e+1<r.length&&te(r[e+1])){let a=r.slice(e),u=[" \u0915\u0947 \u0932\u093F\u090F"," \u0915\u0947 \u0938\u093E\u0925"," \u0915\u0947 \u092C\u093E\u0926"," \u0938\u0947 \u092A\u0939\u0932\u0947"," \u0928\u0939\u0940\u0902 \u0924\u094B"," \u091C\u092C \u0924\u0915"," \u0915\u0947 \u092C\u093E\u0930\u0947 \u092E\u0947\u0902"].find(c=>a.startsWith(c));if(u){o+=u,e+=u.length;continue}}break}o+=r[e],e++;}let s=this.lookupKeyword(o);s?t.push(g(o,"keyword",y(i,e),s.normalized)):be.has(o)?t.push(g(o,"particle",y(i,e))):t.push(g(o,"identifier",y(i,e)));continue}if(k(r[e])){let i=e,o="";for(;e<r.length&&k(r[e]);)o+=r[e],e++;let s=this.lookupKeyword(o),a=s?"keyword":"identifier";t.push(g(o,a,y(i,e),s?.normalized||o.toLowerCase()));continue}let n=e;t.push(g(r[e],"operator",y(n,e+1))),e++;}return new wt(t,this.language)}classifyToken(r){return this.isKeyword(r)?"keyword":be.has(r)?"particle":r.startsWith(".")||r.startsWith("#")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith(":")?"identifier":r.startsWith('"')||r.startsWith("'")||/^-?\d/.test(r)?"literal":"identifier"}extractNumber(r,t){let e=t,n="";for(r[e]==="-"&&(n+="-",e++);e<r.length&&x(r[e]);)n+=r[e],e++;if(e<r.length&&r[e]===".")for(n+=".",e++;e<r.length&&x(r[e]);)n+=r[e],e++;return n==="-"?null:g(n,"literal",y(t,e))}},It=new Ot;Ct("hi",It,_e);var Mt=new Map,zt=new Map,Ft=new Map;function Dt(r,t,e){Mt.set(r,t),zt.set(r,e),Ft.delete(r);}var Lt=class{constructor(r,t){this.pos=0,this.tokens=r,this.language=t;}peek(r=0){let t=this.pos+r;return t<0||t>=this.tokens.length?null:this.tokens[t]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let t=[];for(;!this.isAtEnd()&&r(this.peek());)t.push(this.advance());return t}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function E(r,t){return {start:r,end:t}}function A(r,t,e,n){if(typeof n=="string")return {value:r,kind:t,position:e,normalized:n};if(n){let{normalized:i,stem:o,stemConfidence:s}=n;return {value:r,kind:t,position:e,...i!==void 0&&{normalized:i},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s}}}return {value:r,kind:t,position:e}}function H(r){return /\s/.test(r)}function Oe(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function Ie(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function R(r){return /\d/.test(r)}function $t(r){return /[a-zA-Z]/.test(r)}function T(r){return /[a-zA-Z0-9_-]/.test(r)}function qt(r){return t=>{let e=t.charCodeAt(0);return r.some(([n,i])=>e>=n&&e<=i)}}function Vt(r,t){if(t>=r.length)return null;let e=r[t];if(!Oe(e))return null;let n=t,i="";if(e==="#"||e==="."){for(i+=r[n++];n<r.length&&T(r[n]);)i+=r[n++];if(i.length<=1)return null;if(n<r.length&&r[n]==="."&&e==="#"){let s=n+1;for(;s<r.length&&T(r[s]);)s++;if(s<r.length&&r[s]==="(")return i}}else if(e==="["){let o=1,s=false,a=null,u=false;for(i+=r[n++];n<r.length&&o>0;){let c=r[n];i+=c,u?u=false:c==="\\"?u=true:s?c===a&&(s=false,a=null):c==='"'||c==="'"||c==="`"?(s=true,a=c):c==="["?o++:c==="]"&&o--,n++;}if(o!==0)return null}else if(e==="@"){for(i+=r[n++];n<r.length&&T(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(e==="*"){for(i+=r[n++];n<r.length&&T(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(e==="<"){if(i+=r[n++],n>=r.length||!$t(r[n]))return null;for(;n<r.length&&T(r[n]);)i+=r[n++];for(;n<r.length;){let o=r[n];if(o==="."){if(i+=r[n++],n>=r.length||!T(r[n]))return null;for(;n<r.length&&T(r[n]);)i+=r[n++];}else if(o==="#"){if(i+=r[n++],n>=r.length||!T(r[n]))return null;for(;n<r.length&&T(r[n]);)i+=r[n++];}else if(o==="["){let s=1,a=false,u=null,c=false;for(i+=r[n++];n<r.length&&s>0;){let l=r[n];i+=l,c?c=false:l==="\\"?c=true:a?l===u&&(a=false,u=null):l==='"'||l==="'"||l==="`"?(a=true,u=l):l==="["?s++:l==="]"&&s--,n++;}if(s!==0)return null}else break}for(;n<r.length&&H(r[n]);)i+=r[n++];if(n<r.length&&r[n]==="/")for(i+=r[n++];n<r.length&&H(r[n]);)i+=r[n++];if(n>=r.length||r[n]!==">")return null;i+=r[n++];}return i||null}function Wt(r,t){if(t>=r.length||r[t]!=="'"||t+1>=r.length||r[t+1].toLowerCase()!=="s")return false;if(t+2>=r.length)return true;let n=r[t+2];return H(n)||n==="*"||!T(n)}function jt(r,t){if(t>=r.length)return null;let e=r[t];if(!Ie(e)||e==="'"&&Wt(r,t))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[e];if(!i)return null;let o=t+1,s=e,a=false;for(;o<r.length;){let u=r[o];if(s+=u,a)a=false;else if(u==="\\")a=true;else if(u===i)return s;o++;}return s}function Me(r,t){if(t>=r.length)return false;let e=r[t],n=r[t+1]||"",i=r[t+2]||"";if(e==="/"&&n!=="/"&&/[a-zA-Z0-9._-]/.test(n)||e==="/"&&n==="/"&&/[a-zA-Z]/.test(i)||e==="."&&(n==="/"||n==="."&&i==="/"))return true;let o=r.slice(t,t+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function Ut(r,t){if(!Me(r,t))return null;let e=t,n="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;e<r.length;){let o=r[e];if(o==="#"){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=o,e++;e<r.length&&/[a-zA-Z0-9_-]/.test(r[e]);)n+=r[e++];break}if(i.test(o))n+=o,e++;else break}return n.length<2?null:n}function Gt(r,t){if(t>=r.length)return null;let e=r[t];if(!R(e)&&e!=="-"&&e!=="+")return null;let n=t,i="";if((r[n]==="-"||r[n]==="+")&&(i+=r[n++]),n>=r.length||!R(r[n]))return null;for(;n<r.length&&R(r[n]);)i+=r[n++];if(n<r.length&&r[n]===".")for(i+=r[n++];n<r.length&&R(r[n]);)i+=r[n++];return n<r.length&&(r.slice(n,n+2)==="ms"?i+="ms":(r[n]==="s"||r[n]==="m"||r[n]==="h")&&(i+=r[n])),i}var ze=class Fe{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(t,e,n){if(t[e]!==".")return false;let i=n[n.length-1],o=i&&i.position.end<e;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return n.push(A(".","operator",E(e,e+1))),true;let u=e+1;for(;u<t.length&&T(t[u]);)u++;return u<t.length&&t[u]==="("?(n.push(A(".","operator",E(e,e+1))),true):false}initializeKeywordsFromProfile(t,e=[]){let n=new Map;if(t.keywords){for(let[i,o]of Object.entries(t.keywords))if(n.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:o.normalized||i});}if(t.references){for(let[i,o]of Object.entries(t.references))n.set(o,{native:o,normalized:i});for(let i of Object.keys(t.references))n.has(i)||n.set(i,{native:i,normalized:i});}if(t.roleMarkers){for(let[i,o]of Object.entries(t.roleMarkers))if(o.primary&&n.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:i});}for(let i of e)n.set(i.native,i);this.profileKeywords=Array.from(n.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(t){return t.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(t,e){for(let n of this.profileKeywords)if(t.slice(e).startsWith(n.native))return A(n.native,"keyword",E(e,e+n.native.length),n.normalized);return null}isKeywordStart(t,e){let n=t.slice(e);return this.profileKeywords.some(i=>n.startsWith(i.native))}lookupKeyword(t){return this.profileKeywordMap.get(t.toLowerCase())}isKeyword(t){return this.profileKeywordMap.has(t.toLowerCase())}setNormalizer(t){this.normalizer=t;}tryNormalize(t){if(!this.normalizer)return null;let e=this.normalizer.normalize(t);return e.stem!==t&&e.confidence>=.7?e:null}tryMorphKeywordMatch(t,e,n){let i=this.tryNormalize(t);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return A(t,"keyword",E(e,n),s)}trySelector(t,e){let n=Vt(t,e);return n?A(n,"selector",E(e,e+n.length)):null}tryEventModifier(t,e){if(t[e]!==".")return null;let n=t.slice(e).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!n)return null;let i=n[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=n[1];return {...A(i,"event-modifier",E(e,e+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(t,e){let n=jt(t,e);return n?A(n,"literal",E(e,e+n.length)):null}tryNumber(t,e){let n=Gt(t,e);return n?A(n,"literal",E(e,e+n.length)):null}tryMatchTimeUnit(t,e,n,i=false){let o=e;if(i)for(;o<t.length&&H(t[o]);)o++;let s=t.slice(o);for(let a of n){let u=s.slice(0,a.length);if(a.caseInsensitive?u.toLowerCase()===a.pattern.toLowerCase():u===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let l=s[a.length]||"";if(T(l))continue}return {suffix:a.suffix,endPos:o+a.length}}}return null}parseBaseNumber(t,e,n=true){let i=e,o="";if(n&&(t[i]==="-"||t[i]==="+")&&(o+=t[i++]),i>=t.length||!R(t[i]))return null;for(;i<t.length&&R(t[i]);)o+=t[i++];if(i<t.length&&t[i]===".")for(o+=t[i++];i<t.length&&R(t[i]);)o+=t[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(t,e,n,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(t,e,o);if(!a)return null;let{number:u,endPos:c}=a,l=[...n,...Fe.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(t,c,l,s);return d&&(u+=d.suffix,c=d.endPos),A(u,"literal",E(e,c))}tryUrl(t,e){let n=Ut(t,e);return n?A(n,"url",E(e,e+n.length)):null}tryVariableRef(t,e){if(t[e]!==":"||e+1>=t.length||!T(t[e+1]))return null;let n=e+1;for(;n<t.length&&T(t[n]);)n++;let i=t.slice(e,n);return A(i,"identifier",E(e,n))}tryOperator(t,e){let n=t.slice(e,e+2);if(["==","!=","<=",">=","&&","||","->"].includes(n))return A(n,"operator",E(e,e+2));let i=t[e];return ["<",">","!","+","-","*","/","="].includes(i)?A(i,"operator",E(e,e+1)):["(",")","{","}",",",";",":"].includes(i)?A(i,"punctuation",E(e,e+1)):null}tryMultiCharParticle(t,e,n){for(let i of n)if(t.slice(e,e+i.length)===i)return A(i,"particle",E(e,e+i.length));return null}};ze.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 Ht=ze,De={code:"bn",name:"Bengali",nativeName:"\u09AC\u09BE\u0982\u09B2\u09BE",direction:"ltr",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:true,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["\u09C1\u09A8","\u09CB","\u09BE","\u09C7","\u09BF"],subjectDrop:true},references:{me:"\u0986\u09AE\u09BF",it:"\u098F\u099F\u09BF",you:"\u0986\u09AA\u09A8\u09BF",result:"\u09AB\u09B2\u09BE\u09AB\u09B2",event:"\u0998\u099F\u09A8\u09BE",target:"\u09B2\u0995\u09CD\u09B7\u09CD\u09AF",body:"\u09AC\u09A1\u09BF"},possessive:{marker:"\u09B0",markerPosition:"between",keywords:{\u0986\u09AE\u09BE\u09B0:"me",\u09A4\u09CB\u09AE\u09BE\u09B0:"you",\u0986\u09AA\u09A8\u09BE\u09B0:"you",\u09A4\u09BE\u09B0:"it",\u098F\u09B0:"it"}},roleMarkers:{patient:{primary:"\u0995\u09C7",position:"after"},destination:{primary:"\u09A4\u09C7",alternatives:["\u098F"],position:"after"},source:{primary:"\u09A5\u09C7\u0995\u09C7",position:"after"},style:{primary:"\u09A6\u09BF\u09AF\u09BC\u09C7",position:"after"},event:{primary:"\u09A4\u09C7",position:"after"}},keywords:{toggle:{primary:"\u099F\u0997\u09B2",alternatives:["\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8"],normalized:"toggle"},add:{primary:"\u09AF\u09CB\u0997",alternatives:["\u09AF\u09CB\u0997 \u0995\u09B0\u09C1\u09A8"],normalized:"add"},remove:{primary:"\u09B8\u09B0\u09BE\u09A8",alternatives:["\u09B8\u09B0\u09BF\u09AF\u09BC\u09C7 \u09AB\u09C7\u09B2\u09C1\u09A8","\u09AE\u09C1\u099B\u09C1\u09A8"],normalized:"remove"},put:{primary:"\u09B0\u09BE\u0996\u09C1\u09A8",alternatives:["\u09B0\u09BE\u0996"],normalized:"put"},append:{primary:"\u09B6\u09C7\u09B7\u09C7 \u09AF\u09CB\u0997",alternatives:[],normalized:"append"},prepend:{primary:"\u09B6\u09C1\u09B0\u09C1\u09A4\u09C7 \u09AF\u09CB\u0997",alternatives:[],normalized:"prepend"},take:{primary:"\u09A8\u09BF\u09A8",alternatives:["\u09A8\u09C7"],normalized:"take"},make:{primary:"\u09A4\u09C8\u09B0\u09BF \u0995\u09B0\u09C1\u09A8",alternatives:["\u09AC\u09BE\u09A8\u09BE\u09A8"],normalized:"make"},clone:{primary:"\u0995\u09AA\u09BF",alternatives:["\u09AA\u09CD\u09B0\u09A4\u09BF\u09B2\u09BF\u09AA\u09BF"],normalized:"clone"},swap:{primary:"\u09AC\u09A6\u09B2",alternatives:[],normalized:"swap"},morph:{primary:"\u09B0\u09C2\u09AA\u09BE\u09A8\u09CD\u09A4\u09B0",alternatives:[],normalized:"morph"},set:{primary:"\u09B8\u09C7\u099F",alternatives:["\u09A8\u09BF\u09B0\u09CD\u09A7\u09BE\u09B0\u09A3"],normalized:"set"},get:{primary:"\u09AA\u09BE\u09A8",alternatives:["\u09A8\u09BF\u09A8"],normalized:"get"},increment:{primary:"\u09AC\u09C3\u09A6\u09CD\u09A7\u09BF",alternatives:["\u09AC\u09BE\u09A1\u09BC\u09BE\u09A8"],normalized:"increment"},decrement:{primary:"\u09B9\u09CD\u09B0\u09BE\u09B8",alternatives:["\u0995\u09AE\u09BE\u09A8"],normalized:"decrement"},log:{primary:"\u09B2\u0997",alternatives:["\u09B0\u09C7\u0995\u09B0\u09CD\u09A1"],normalized:"log"},show:{primary:"\u09A6\u09C7\u0996\u09BE\u09A8",alternatives:["\u09A6\u09C7\u0996\u09BE\u0993"],normalized:"show"},hide:{primary:"\u09B2\u09C1\u0995\u09BE\u09A8",alternatives:["\u09B2\u09C1\u0995\u09BE\u0993"],normalized:"hide"},transition:{primary:"\u09B8\u0982\u0995\u09CD\u09B0\u09AE\u09A3",alternatives:[],normalized:"transition"},on:{primary:"\u09A4\u09C7",alternatives:["\u098F","\u09AF\u0996\u09A8"],normalized:"on"},trigger:{primary:"\u099F\u09CD\u09B0\u09BF\u0997\u09BE\u09B0",alternatives:[],normalized:"trigger"},send:{primary:"\u09AA\u09BE\u09A0\u09BE\u09A8",alternatives:["\u09AA\u09BE\u09A0\u09BE\u0993"],normalized:"send"},focus:{primary:"\u09AB\u09CB\u0995\u09BE\u09B8",alternatives:["\u09AE\u09A8\u09CB\u09AF\u09CB\u0997"],normalized:"focus"},blur:{primary:"\u099D\u09BE\u09AA\u09B8\u09BE",alternatives:["\u09AB\u09CB\u0995\u09BE\u09B8_\u09B8\u09B0\u09BE\u09A8"],normalized:"blur"},click:{primary:"\u0995\u09CD\u09B2\u09BF\u0995",normalized:"click"},hover:{primary:"\u09B9\u09CB\u09AD\u09BE\u09B0",alternatives:["\u0989\u09AA\u09B0\u09C7_\u09B0\u09BE\u0996\u09C1\u09A8"],normalized:"hover"},submit:{primary:"\u09B8\u09BE\u09AC\u09AE\u09BF\u099F",alternatives:["\u099C\u09AE\u09BE"],normalized:"submit"},input:{primary:"\u0987\u09A8\u09AA\u09C1\u099F",alternatives:["\u09AA\u09CD\u09B0\u09AC\u09C7\u09B6"],normalized:"input"},change:{primary:"\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8",normalized:"change"},go:{primary:"\u09AF\u09BE\u09A8",alternatives:["\u09AF\u09BE\u0993"],normalized:"go"},wait:{primary:"\u0985\u09AA\u09C7\u0995\u09CD\u09B7\u09BE",alternatives:["\u09A5\u09BE\u09AE\u09C1\u09A8"],normalized:"wait"},fetch:{primary:"\u0986\u09A8\u09C1\u09A8",alternatives:[],normalized:"fetch"},settle:{primary:"\u09B8\u09CD\u09A5\u09BF\u09B0",alternatives:[],normalized:"settle"},if:{primary:"\u09AF\u09A6\u09BF",alternatives:[],normalized:"if"},when:{primary:"\u09AF\u0996\u09A8",normalized:"when"},where:{primary:"\u0995\u09CB\u09A5\u09BE\u09AF\u09BC",normalized:"where"},else:{primary:"\u09A8\u09A4\u09C1\u09AC\u09BE",alternatives:["\u09A8\u09BE \u09B9\u09B2\u09C7"],normalized:"else"},repeat:{primary:"\u09AA\u09C1\u09A8\u09B0\u09BE\u09AC\u09C3\u09A4\u09CD\u09A4\u09BF",alternatives:["\u09AC\u09BE\u09B0 \u09AC\u09BE\u09B0"],normalized:"repeat"},for:{primary:"\u099C\u09A8\u09CD\u09AF",alternatives:[],normalized:"for"},while:{primary:"\u09AF\u09A4\u0995\u09CD\u09B7\u09A3",alternatives:[],normalized:"while"},continue:{primary:"\u099A\u09BE\u09B2\u09BF\u09AF\u09BC\u09C7 \u09AF\u09BE\u09A8",alternatives:[],normalized:"continue"},halt:{primary:"\u09A5\u09BE\u09AE\u09C1\u09A8",alternatives:["\u09A5\u09BE\u09AE\u09BE\u0993"],normalized:"halt"},throw:{primary:"\u09A8\u09BF\u0995\u09CD\u09B7\u09C7\u09AA",alternatives:["\u099B\u09C1\u0981\u09A1\u09BC\u09C7 \u09A6\u09BF\u09A8"],normalized:"throw"},call:{primary:"\u0995\u09B2",alternatives:["\u09A1\u09BE\u0995\u09C1\u09A8"],normalized:"call"},return:{primary:"\u09AB\u09BF\u09B0\u09C1\u09A8",alternatives:["\u09AB\u09C7\u09B0\u09A4 \u09A6\u09BF\u09A8"],normalized:"return"},then:{primary:"\u09A4\u09BE\u09B0\u09AA\u09B0",alternatives:["\u09A4\u0996\u09A8"],normalized:"then"},and:{primary:"\u098F\u09AC\u0982",alternatives:[],normalized:"and"},end:{primary:"\u09B6\u09C7\u09B7",alternatives:["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"],normalized:"end"},js:{primary:"\u099C\u09C7\u098F\u09B8",alternatives:["js"],normalized:"js"},async:{primary:"\u0985\u09CD\u09AF\u09BE\u09B8\u09BF\u0999\u09CD\u0995",alternatives:[],normalized:"async"},tell:{primary:"\u09AC\u09B2\u09C1\u09A8",alternatives:["\u09AC\u09B2"],normalized:"tell"},default:{primary:"\u09A1\u09BF\u09AB\u09B2\u09CD\u099F",alternatives:[],normalized:"default"},init:{primary:"\u09B6\u09C1\u09B0\u09C1",alternatives:[],normalized:"init"},behavior:{primary:"\u0986\u099A\u09B0\u09A3",alternatives:[],normalized:"behavior"},install:{primary:"\u0987\u09A8\u09B8\u09CD\u099F\u09B2",alternatives:[],normalized:"install"},measure:{primary:"\u09AE\u09BE\u09AA\u09C1\u09A8",alternatives:[],normalized:"measure"},beep:{primary:"\u09AC\u09C0\u09AA",alternatives:[],normalized:"beep"},break:{primary:"\u09A5\u09BE\u09AE\u09C1\u09A8",alternatives:[],normalized:"break"},copy:{primary:"\u0995\u09AA\u09BF",alternatives:[],normalized:"copy"},exit:{primary:"\u09AC\u09C7\u09B0",alternatives:[],normalized:"exit"},pick:{primary:"\u09AC\u09BE\u099B\u09C1\u09A8",alternatives:[],normalized:"pick"},render:{primary:"\u09B0\u09C7\u09A8\u09CD\u09A1\u09BE\u09B0",alternatives:[],normalized:"render"},into:{primary:"\u09A4\u09C7",alternatives:["\u098F"],normalized:"into"},before:{primary:"\u0986\u0997\u09C7",alternatives:[],normalized:"before"},after:{primary:"\u09AA\u09B0\u09C7",alternatives:[],normalized:"after"},until:{primary:"\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4",alternatives:[],normalized:"until"},event:{primary:"\u0998\u099F\u09A8\u09BE",alternatives:[],normalized:"event"},from:{primary:"\u09A5\u09C7\u0995\u09C7",normalized:"from"}},tokenization:{particles:["\u0995\u09C7","\u09A4\u09C7","\u09A5\u09C7\u0995\u09C7","\u09B0","\u098F\u09B0","\u09A6\u09BF\u09AF\u09BC\u09C7","\u099C\u09A8\u09CD\u09AF","\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"\u09A4\u09C7",alternatives:["\u098F","\u09AF\u0996\u09A8"],normalized:"on"},sourceMarker:{primary:"\u09A5\u09C7\u0995\u09C7",position:"after"},eventMarker:{primary:"\u09A4\u09C7",alternatives:["\u098F"],position:"after"},temporalMarkers:["\u09AF\u0996\u09A8","\u09AF\u0996\u09A8\u0987"]}},le=qt([[2432,2559]]),Ne=new Set(["\u0995\u09C7","\u09A4\u09C7","\u09A5\u09C7\u0995\u09C7","\u09B0","\u098F\u09B0","\u09A6\u09BF\u09AF\u09BC\u09C7","\u099C\u09A8\u09CD\u09AF","\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4","\u098F","\u09AE\u09A7\u09CD\u09AF\u09C7"]),Kt=[{native:"\u09B8\u09A4\u09CD\u09AF",normalized:"true"},{native:"\u09AE\u09BF\u09A5\u09CD\u09AF\u09BE",normalized:"false"},{native:"\u09B6\u09C2\u09A8\u09CD\u09AF",normalized:"null"},{native:"\u0985\u09A8\u09BF\u09B0\u09CD\u09A7\u09BE\u09B0\u09BF\u09A4",normalized:"undefined"},{native:"\u09AA\u09CD\u09B0\u09A5\u09AE",normalized:"first"},{native:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",normalized:"next"},{native:"\u0986\u0997\u09C7\u09B0",normalized:"previous"},{native:"\u09A8\u09BF\u0995\u099F\u09A4\u09AE",normalized:"closest"},{native:"\u09AE\u09C2\u09B2",normalized:"parent"},{native:"\u0995\u09CD\u09B2\u09BF\u0995",normalized:"click"},{native:"\u099C\u09AE\u09BE",normalized:"submit"},{native:"\u0987\u09A8\u09AA\u09C1\u099F",normalized:"input"},{native:"\u09B2\u09CB\u09A1",normalized:"load"},{native:"\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2",normalized:"scroll"},{native:"\u0995\u09C7",normalized:"to"},{native:"\u09B8\u09BE\u09A5\u09C7",normalized:"with"}],Qt=class extends Ht{constructor(){super(),this.language="bn",this.direction="ltr",this.initializeKeywordsFromProfile(De,Kt);}tokenize(r){let t=[],e=0;for(;e<r.length;){if(H(r[e])){e++;continue}if(Oe(r[e])){let i=this.tryEventModifier(r,e);if(i){t.push(i),e=i.position.end;continue}if(this.tryPropertyAccess(r,e,t)){e++;continue}let o=this.trySelector(r,e);if(o){t.push(o),e=o.position.end;continue}}if(Ie(r[e])){let i=this.tryString(r,e);if(i){t.push(i),e=i.position.end;continue}}if(Me(r,e)){let i=this.tryUrl(r,e);if(i){t.push(i),e=i.position.end;continue}}if(R(r[e])||r[e]==="-"&&e+1<r.length&&R(r[e+1])){let i=this.extractNumber(r,e);if(i){t.push(i),e=i.position.end;continue}}if(r[e]===":"){let i=e;e++;let o="";for(;e<r.length&&(T(r[e])||le(r[e]));)o+=r[e],e++;if(o){t.push(A(":"+o,"identifier",E(i,e),":"+o));continue}e=i;}if(le(r[e])){let i=e,o="";for(;e<r.length&&le(r[e]);)o+=r[e],e++;if(Ne.has(o))t.push(A(o,"particle",E(i,e)));else {let s=this.lookupKeyword(o);s?t.push(A(o,"keyword",E(i,e),s.normalized)):t.push(A(o,"identifier",E(i,e)));}continue}if(T(r[e])){let i=e,o="";for(;e<r.length&&T(r[e]);)o+=r[e],e++;let s=this.lookupKeyword(o),a=s?"keyword":"identifier";t.push(A(o,a,E(i,e),s?.normalized||o.toLowerCase()));continue}let n=e;t.push(A(r[e],"operator",E(n,e+1))),e++;}return new Lt(t,this.language)}classifyToken(r){return this.isKeyword(r)?"keyword":Ne.has(r)?"particle":r.startsWith(".")||r.startsWith("#")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith(":")?"identifier":r.startsWith('"')||r.startsWith("'")||/^-?\d/.test(r)?"literal":"identifier"}extractNumber(r,t){let e=t,n="";for(r[e]==="-"&&(n+="-",e++);e<r.length&&R(r[e]);)n+=r[e],e++;if(e<r.length&&r[e]===".")for(n+=".",e++;e<r.length&&R(r[e]);)n+=r[e],e++;return n==="-"?null:A(n,"literal",E(t,e))}},Yt=new Qt;Dt("bn",Yt,De);var Xt=Object.defineProperty,Zt=Object.getOwnPropertyNames,He=(r,t)=>function(){return r&&(t=(0, r[Zt(r)[0]])(r=0)),t},Jt=(r,t)=>{for(var e in t)Xt(r,e,{get:t[e],enumerable:true});};function Le(r,t){return r.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??`{${n}}`))}function P(r,t,e={},n){let i=Ke[r],o=Le(i,e),s=Qe[r],a=s?Le(s,e):void 0;return {code:r,message:o,severity:t,...n&&{role:n},...a&&{suggestion:a}}}var h,Ke,Qe,er=He({"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"},Ke={[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."},Qe={[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."};}}),Ye={};Jt(Ye,{SchemaErrorCodes:()=>h,formatValidationResults:()=>ar,getValidationStats:()=>ur,validateAllSchemas:()=>sr,validateCommandSchema:()=>Xe});function tr(r,t){return {action:r,items:t,get notes(){return t.filter(e=>e.severity==="note").map(e=>e.message)},get warnings(){return t.filter(e=>e.severity==="warning").map(e=>e.message)},get errors(){return t.filter(e=>e.severity==="error").map(e=>e.message)}}}function Xe(r){let t=[];for(let n of r.roles)n.expectedTypes.includes("literal")&&n.expectedTypes.includes("selector")&&(n.role==="patient"&&fe.has(r.action)?t.push(P(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:n.role,command:r.action},n.role)):t.push(P(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:n.role},n.role))),n.expectedTypes.length>3&&!fe.has(r.action)&&t.push(P(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:n.role,count:n.expectedTypes.length},n.role));switch(r.action){case "transition":rr(r,t);break;case "on":nr(r,t);break;case "if":case "unless":ir(r,t);break;case "repeat":case "for":case "while":or(r,t);break}return r.roles.filter(n=>n.required).length===0&&(Ze.has(r.action)?t.push(P(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):t.push(P(h.NO_REQUIRED_ROLES,"warning",{}))),tr(r.action,t)}function rr(r,t){let e=r.roles.find(i=>i.role==="patient"),n=r.roles.find(i=>i.role==="goal");e&&e.expectedTypes.includes("selector")&&t.push(P(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),e&&!n&&t.push(P(h.TRANSITION_MISSING_GOAL,"error",{}));}function nr(r,t){let e=r.roles.find(n=>n.role==="event");e||t.push(P(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),e&&!e.required&&t.push(P(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function ir(r,t){let e=r.roles.find(n=>n.role==="condition");e||t.push(P(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),e&&!e.required&&t.push(P(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function or(r,t){r.action==="for"?r.roles.find(n=>n.role==="source")||t.push(P(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(n=>n.role==="condition")||t.push(P(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function sr(r,t={}){let e=new Map,{includeNotes:n=false}=t;for(let[i,o]of Object.entries(r)){let s=Xe(o),a=s.items.some(c=>c.severity==="warning"||c.severity==="error"),u=n&&s.items.some(c=>c.severity==="note");(a||u)&&e.set(i,s);}return e}function ar(r,t={}){let e=[],{showNotes:n=false,showCodes:i=true}=t;for(let[o,s]of r){let a=s.items.filter(l=>l.severity==="error"),u=s.items.filter(l=>l.severity==="warning"),c=s.items.filter(l=>l.severity==="note");if(a.length>0){e.push(` \u274C ${o}:`);for(let l of a){let d=i?` [${l.code}]`:"";e.push(` ERROR${d}: ${l.message}`),l.suggestion&&e.push(` \u{1F4A1} Suggestion: ${l.suggestion}`);}}if(u.length>0){e.push(` \u26A0\uFE0F ${o}:`);for(let l of u){let d=i?` [${l.code}]`:"";e.push(` ${d?`${l.code}: `:""}${l.message}`),l.suggestion&&e.push(` \u{1F4A1} ${l.suggestion}`);}}if(n&&c.length>0){e.push(` \u2139\uFE0F ${o}:`);for(let l of c){let d=i?` [${l.code}]`:"";e.push(` ${d?`${l.code}: `:""}${l.message}`);}}}return e.join(`
2
- `)}function ur(r){let t=0,e=0,n=0,i={};for(let o of r.values())for(let s of o.items)s.severity==="error"?t++:s.severity==="warning"?e++:s.severity==="note"&&n++,i[s.code]=(i[s.code]||0)+1;return {totalCommands:r.size,errors:t,warnings:e,notes:n,byCode:i}}var fe,Ze,lr=He({"src/generators/schema-validator.ts"(){er(),fe=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Ze=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function Q(r){let t="complex";return r.startsWith("#")&&!r.includes(" ")?t="id":r.startsWith(".")&&!r.includes(" ")?t="class":r.startsWith("[")&&r.endsWith("]")?t="attribute":/^[a-z][a-z0-9]*$/i.test(r)&&(t="element"),{type:"selector",value:r,selectorKind:t}}function b(r,t){let e={type:"literal",value:r};return t!==void 0?{type:"literal",value:r,dataType:t}:e}var cr=new Set(["me","you","it","result","event","target","body"]);function $e(r){return cr.has(r)}function M(r){return {type:"reference",value:r}}function ce(r,t){return {type:"property-path",object:r,property:t}}function re(r,t,e){let n={kind:"command",action:r,roles:new Map(Object.entries(t))};return e!==void 0?{...n,metadata:e}:n}function qe(r,t,e,n,i,o){let s=new Map;s.set("event",r);let a={kind:"event-handler",action:"on",roles:s,body:t};return e!==void 0&&(a.eventModifiers=e),n!==void 0&&(a.metadata=n),a}function Ve(r,t="then",e){let n={kind:"compound",action:"compound",roles:new Map,statements:r,chainType:t};return e!==void 0&&(n.metadata=e),n}function We(r,t){return !t||t.length===0||t.includes(r)||t.includes("expression")?true:r==="property-path"?t.some(e=>["selector","reference","expression"].includes(e)):false}function dr(r,t){return r.possessive?.keywords?.[t]}var $=new Map,q=new Map,ne=new Map,me=null;function Je(r,t){let e={...r};for(let n of Object.keys(t)){let i=t[n],o=r[n];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof o=="object"&&o!==null&&!Array.isArray(o)?e[n]=Je(o,i):e[n]=i);}return e}function pr(r,t){return Je(r,t)}function ve(r){if(!r.extends)return r;let t=q.get(r.extends);if(!t)return console.warn(`[Registry] Profile '${r.code}' extends '${r.extends}' but base is not registered. Make sure to import the base language before the variant.`),r;let e=ve(t);return pr(e,r)}function et(r){me=r;}var je=new Map;function V(r){return r.split("-")[0]}function W(r){return r.includes("-")}function fr(r){let t=$.get(r);if(!t&&W(r)){let e=V(r);t=$.get(e);}if(!t){let e=Array.from($.keys()).join(", ");throw new Error(`Language '${r}' is not registered. Registered languages: ${e||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return t}function mr(r){let t=q.get(r);if(!t&&W(r)){let e=V(r);t=q.get(e);}if(!t){let e=Array.from(q.keys()).join(", ");throw new Error(`Language profile '${r}' is not registered. Registered languages: ${e||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return ve(t)}function hr(r){let t=$.get(r);return !t&&W(r)&&(t=$.get(V(r))),t}function z(r){let t=q.get(r);return !t&&W(r)&&(t=q.get(V(r))),t?ve(t):void 0}function tt(){return Array.from($.keys())}function vr(r,t){return fr(t).tokenize(r)}function L(r){let t=ne.get(r);if(!t&&W(r)&&(t=ne.get(V(r))),t)return t;let e=je.get(r);if(!e&&W(r)&&(e=je.get(V(r))),e)return ne.set(r,e),e;if(!me)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let n=mr(r),i=me(n);return ne.set(r,i),i}var ie=class K{constructor(){this.stemMatchCount=0,this.totalKeywordMatches=0;}matchPattern(t,e){let n=t.mark(),i=new Map;if(this.currentProfile=z(e.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(t,e.template.tokens,i))return t.reset(n),null;let s=this.calculateConfidence(e,i);return this.applyExtractionRules(e,i),{pattern:e,captured:i,consumedTokens:t.position()-n.position,confidence:s}}matchBest(t,e){let n=[];for(let o of e){let s=t.mark(),a=this.matchPattern(t,o);a&&n.push(a),t.reset(s);}if(n.length===0)return null;n.sort((o,s)=>{let a=s.pattern.priority-o.pattern.priority;return a!==0?a:s.confidence-o.confidence});let i=n[0];return this.matchPattern(t,i.pattern),i}matchTokenSequence(t,e,n){let i=e[0],o=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;t.peek()?.kind==="conjunction";)t.advance();for(let s of e)if(!this.matchPatternToken(t,s,n)){if(this.isOptional(s))continue;return false}return true}matchPatternToken(t,e,n){switch(e.type){case "literal":return this.matchLiteralToken(t,e);case "role":return this.matchRoleToken(t,e,n);case "group":return this.matchGroupToken(t,e,n);default:return false}}matchLiteralToken(t,e){let n=t.peek();if(!n)return false;let i=this.getMatchType(n,e.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,t.advance(),true;if(e.alternatives)for(let o of e.alternatives){let s=this.getMatchType(n,o);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,t.advance(),true}return false}matchRoleToken(t,e,n){this.skipNoiseWords(t);let i=t.peek();if(!i)return e.optional||false;let o=this.tryMatchPossessiveExpression(t);if(o)return e.expectedTypes&&e.expectedTypes.length>0&&!e.expectedTypes.includes(o.type)&&!e.expectedTypes.includes("expression")?e.optional||false:(n.set(e.role,o),true);let s=this.tryMatchMethodCallExpression(t);if(s)return e.expectedTypes&&e.expectedTypes.length>0&&!e.expectedTypes.includes(s.type)&&!e.expectedTypes.includes("expression")?e.optional||false:(n.set(e.role,s),true);let a=this.tryMatchPossessiveSelectorExpression(t);if(a)return e.expectedTypes&&e.expectedTypes.length>0&&!We(a.type,e.expectedTypes)?e.optional||false:(n.set(e.role,a),true);let u=this.tryMatchPropertyAccessExpression(t);if(u)return e.expectedTypes&&e.expectedTypes.length>0&&!e.expectedTypes.includes(u.type)&&!e.expectedTypes.includes("expression")?e.optional||false:(n.set(e.role,u),true);let c=this.tryMatchSelectorPropertyExpression(t);if(c)return e.expectedTypes&&e.expectedTypes.length>0&&!We(c.type,e.expectedTypes)?e.optional||false:(n.set(e.role,c),true);let l=this.tokenToSemanticValue(i);return !l||e.expectedTypes&&e.expectedTypes.length>0&&!e.expectedTypes.includes(l.type)?e.optional||false:(n.set(e.role,l),t.advance(),true)}tryMatchPossessiveExpression(t){let e=t.peek();if(!e||!this.currentProfile)return null;let n=(e.normalized||e.value).toLowerCase(),i=dr(this.currentProfile,n);if(!i)return null;let o=t.mark();t.advance();let s=t.peek();if(!s)return t.reset(o),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){t.advance();let a=s.value;s.kind==="selector"&&a.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a)&&(a=a.substring(1));let u=a;for(;t.peek()?.kind==="selector"&&t.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(t.peek().value);)u+=t.peek().value,t.advance();let c=t.peek();return c?.kind==="literal"&&c.value.startsWith("(")&&(u+=c.value,t.advance()),ce(M(i),u)}return t.reset(o),null}isStructuralKeyword(t){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(t.toLowerCase())}tryMatchMethodCallExpression(t){let e=t.peek();if(!e||e.kind!=="selector")return null;let n=t.mark();t.advance();let i=t.peek();if(!i||i.kind!=="operator"||i.value!==".")return t.reset(n),null;t.advance();let o=t.peek();if(!o||o.kind!=="identifier")return t.reset(n),null;t.advance();let s=t.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return t.reset(n),null;t.advance();let a=[];for(;!t.isAtEnd()&&a.length<K.MAX_METHOD_ARGS;){let c=t.peek();if(!c)break;if(c.kind==="punctuation"&&c.value===")"){t.advance();break}if(c.kind==="punctuation"&&c.value===","){t.advance();continue}a.push(c.value),t.advance();}return {type:"expression",raw:`${e.value}.${o.value}(${a.join(", ")})`}}tryMatchPropertyAccessExpression(t){let e=t.peek();if(!e||e.kind!=="identifier"&&e.kind!=="keyword")return null;let n=t.mark();t.advance();let i=t.peek();if(!i||i.kind!=="operator"||i.value!==".")return t.reset(n),null;t.advance();let o=t.peek();if(!o||o.kind!=="identifier")return t.reset(n),null;t.advance();let s=`${e.value}.${o.value}`,a=1;for(;!t.isAtEnd()&&a<K.MAX_PROPERTY_DEPTH;){let c=t.peek();if(!c||c.kind!=="operator"||c.value!==".")break;t.advance();let l=t.peek();if(!l||l.kind!=="identifier")break;t.advance(),s+=`.${l.value}`,a++;}let u=t.peek();if(u&&u.kind==="punctuation"&&u.value==="("){t.advance();let c=[],l=0;for(;!t.isAtEnd()&&c.length<K.MAX_METHOD_ARGS;){let p=t.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(l===0){t.advance();break}l--;}if(p.kind==="punctuation"&&p.value==="("&&l++,p.kind==="punctuation"&&p.value===","){t.advance();continue}c.push(p.value),t.advance();}return {type:"expression",raw:`${s}(${c.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(t){let e=t.peek();if(!e||e.kind!=="selector")return null;let n=t.mark();t.advance();let i=t.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return t.reset(n),null;t.advance();let o=t.peek();return !o||o.kind!=="selector"&&o.kind!=="identifier"?(t.reset(n),null):(t.advance(),ce(Q(e.value),o.value))}tryMatchSelectorPropertyExpression(t){let e=t.peek();if(!e||e.kind!=="selector"||!e.value.startsWith("#"))return null;let n=t.mark();t.advance();let i=t.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return t.reset(n),null;let o=t.peek(1);o&&o.kind,t.advance();let s=i.value.slice(1);return ce(Q(e.value),s)}matchGroupToken(t,e,n){let i=t.mark(),o=new Set(n.keys());if(!this.matchTokenSequence(t,e.tokens,n)){t.reset(i);for(let a of n.keys())o.has(a)||n.delete(a);return e.optional||false}return true}getMatchType(t,e){return t.value===e?"exact":t.normalized===e?"normalized":t.stem===e&&t.stemConfidence!==void 0&&t.stemConfidence>=.7?"stem":t.kind==="keyword"&&t.value.toLowerCase()===e.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(t){switch(t.kind){case "selector":return Q(t.value);case "literal":return this.parseLiteralValue(t.value);case "keyword":let e=(t.normalized||t.value).toLowerCase();return $e(e)?M(e):b(t.normalized||t.value);case "identifier":if(t.value.startsWith(":"))return M(t.value);let n=t.value.toLowerCase();return $e(n)?M(n):{type:"expression",raw:t.value};case "url":return b(t.value,"string");default:return null}}parseLiteralValue(t){if(t.startsWith('"')||t.startsWith("'")||t.startsWith("`")||t.startsWith("\u300C")){let i=t.slice(1,-1);return b(i,"string")}if(t==="true")return b(true,"boolean");if(t==="false")return b(false,"boolean");let e=t.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(e){let i=parseFloat(e[1]);return e[2]?b(t,"duration"):b(i,"number")}let n=parseFloat(t);return isNaN(n)?b(t,"string"):b(n,"number")}applyExtractionRules(t,e){for(let[n,i]of Object.entries(t.extraction))e.has(n)||(i.value!==void 0?e.set(n,{type:"literal",value:i.value}):i.default&&e.set(n,i.default));}isOptional(t){return t.type!=="literal"&&t.optional===true}calculateConfidence(t,e){let n=0,i=0,o=c=>t.extraction?.[c]?.default!==void 0;for(let c of t.template.tokens)if(c.type==="role")i+=1,e.has(c.role)&&(n+=1);else if(c.type==="group"){for(let l of c.tokens)if(l.type==="role"){let d=o(l.role),p=.8;i+=p,e.has(l.role)?n+=p:d&&(n+=p*.6);}}let s=i>0?n/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let c=this.stemMatchCount/this.totalKeywordMatches*.15;s=Math.max(.5,s-c);}let a=this.calculateVSOConfidenceBoost(t);s=Math.min(1,s+a);let u=this.arabicPrepositionDisambiguation(t,e);return s=Math.max(0,Math.min(1,s+u)),s}calculateVSOConfidenceBoost(t){if(t.language!=="ar")return 0;let e=t.template.tokens[0];if(!e||e.type!=="literal")return 0;let n=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(n.has(e.value))return .15;if(e.alternatives){for(let i of e.alternatives)if(n.has(i))return .15}return 0}arabicPrepositionDisambiguation(t,e){if(t.language!=="ar")return 0;let n=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[o,s]of e.entries()){let a=i[o];if(!a||a.length===0)continue;let u="metadata"in s?s.metadata:void 0;if(u&&typeof u.prepositionValue=="string"){let c=u.prepositionValue;a.includes(c)?n+=.1:n-=.1;}}return Math.max(-0.1,Math.min(.1,n))}skipNoiseWords(t){let e=t.peek();if(!e)return;let n=e.value.toLowerCase();if(K.ENGLISH_NOISE_WORDS.has(n)){let i=t.mark();t.advance();let o=t.peek();if(o&&o.kind==="selector")return;t.reset(i);}n==="class"&&t.advance();}extractEventModifiers(t){let e={},n=false;for(;!t.isAtEnd();){let i=t.peek();if(!i||i.kind!=="event-modifier")break;let o=i.metadata;if(!o)break;switch(n=true,o.modifierName){case "once":e.once=true;break;case "debounce":typeof o.value=="number"&&(e.debounce=o.value);break;case "throttle":typeof o.value=="number"&&(e.throttle=o.value);break;case "queue":(o.value==="first"||o.value==="last"||o.value==="all"||o.value==="none")&&(e.queue=o.value);break}t.advance();}return n?e:void 0}};ie.MAX_PROPERTY_DEPTH=10;ie.MAX_METHOD_ARGS=20;ie.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var rt=ie,D=new rt,de=class{constructor(r,t){this.pos=0,this.tokens=r,this.language=t;}peek(r=0){let t=this.pos+r;return t<0||t>=this.tokens.length?null:this.tokens[t]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let t=[];for(;!this.isAtEnd()&&r(this.peek());)t.push(this.advance());return t}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function gr(r){return hr(r)}function pe(r,t){return vr(r,t)}function nt(){return tt()}var Er={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 j=class N{parse(t,e){let{modifiers:n,remainingInput:i}=this.extractStandaloneModifiers(t,e),o=i||t,s=pe(o,e),a=L(e);if(a.length===0)throw new Error(`No patterns available for language: ${e}`);let u=[...a].sort((v,S)=>S.priority-v.priority),c=u.filter(v=>v.command==="on"),l=D.matchBest(s,c);if(l){let v=this.buildEventHandler(l,s,e);return n?this.applyModifiers(v,n):v}let d=u.filter(v=>v.command!=="on"),p=D.matchBest(s,d);if(p)return this.buildCommand(p,e);let f=this.trySOVEventExtraction(o,e,u);if(f)return n?this.applyModifiers(f,n):f;let m=this.tryCompoundCommandParsing(s,d,e);if(m)return m;throw new Error(`Could not parse input in ${e}: ${o}`)}canParse(t,e){try{return this.parse(t,e),!0}catch{return false}}supportedLanguages(){return nt()}buildCommand(t,e){if(!t)throw new Error("No match to build command from");let n={};for(let[i,o]of t.captured)n[i]=o;return re(t.pattern.command,n,{sourceLanguage:e,patternId:t.pattern.id,confidence:t.confidence})}buildEventHandler(t,e,n){if(!t)throw new Error("No match to build event handler from");let i=t.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");let o=D.extractEventModifiers(e),s=this.extractOrConjunctionEvents(e,n),a=i;s.length>0&&i.type==="literal"&&(a={type:"literal",value:[String(i.value),...s.map(d=>String("value"in d?d.value:""))].join(" or ")});let u,c=t.captured.get("action");if(c&&c.type==="literal"){let l=c.value,d={};for(let[m,v]of t.captured)m!=="event"&&m!=="action"&&m!=="continues"&&(d[m]=v);let p=re(l,d,{sourceLanguage:n,patternId:t.pattern.id,confidence:t.confidence}),f=t.captured.get("continues");if(f&&f.type==="literal"&&f.value==="then"){let m=L(n).filter(w=>w.command!=="on").sort((w,_)=>_.priority-w.priority),v=L(n).filter(w=>w.id.startsWith("grammar-")&&w.id.includes("-continuation")).sort((w,_)=>_.priority-w.priority),S=this.parseBodyWithGrammarPatterns(e,m,v,n);S.length>0?u=[p,...S]:u=[p];}else u=[p];}else {let l=L(n).filter(d=>d.command!=="on").sort((d,p)=>p.priority-d.priority);u=this.parseBodyWithClauses(e,l,n);}return qe(a,u,o,{sourceLanguage:n,patternId:t.pattern.id,confidence:t.confidence})}parseBodyWithClauses(t,e,n){let i=[],o=[];for(;!t.isAtEnd();){let s=t.peek();if(!s)break;let a=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,n),u=s.kind==="keyword"&&this.isEndKeyword(s.value,n);if(a){if(o.length>0){let c=this.parseClause(o,e,n);i.push(...c),o.length=0;}t.advance();continue}if(u){if(o.length>0){let c=this.parseClause(o,e,n);i.push(...c);}t.advance();break}o.push(s),t.advance();}if(o.length>0){let s=this.parseClause(o,e,n);i.push(...s);}return i.length>1?[Ve(i,"then",{sourceLanguage:n})]:i}parseClause(t,e,n){if(t.length===0)return [];let i=new de(t,n),o=[];for(;!i.isAtEnd();){let s=D.matchBest(i,e);s?o.push(this.buildCommand(s,n)):i.advance();}if(o.length===0){let s=this.parseSOVClauseByVerbAnchoring(t,n);if(s.length>0)return s}return o}static buildVerbLookup(t){let e=new Map;for(let[n,i]of Object.entries(t.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(n)&&(e.set(i.primary.toLowerCase(),n),i.alternatives))for(let o of i.alternatives)e.set(o.toLowerCase(),n);return e}static buildMarkerToRoleLookup(t){let e=new Map;for(let[n,i]of Object.entries(t.roleMarkers))if(i&&(e.set(i.primary,n),i.alternatives))for(let o of i.alternatives)e.has(o)||e.set(o,n);return e}parseSOVClauseByVerbAnchoring(t,e){let n=z(e);if(!n||n.wordOrder!=="SOV")return [];let i=N.buildVerbLookup(n),o=N.buildMarkerToRoleLookup(n),s=[],a=0;for(;a<t.length;){let u=-1,c="";for(let m=a;m<t.length;m++){let v=t[m],S=i.get(v.value.toLowerCase()),w=v.normalized?i.get(v.normalized.toLowerCase()):void 0,_=S||w;if(_){u=m,c=_;break}}if(u===-1)break;let l=t.slice(a,u),d=t.length;for(let m=u+1;m<t.length;m++){let v=t[m];if(v.kind==="conjunction"||this.isThenKeyword(v.value,e)){d=m;break}if(m>u+1&&(i.get(v.value.toLowerCase())||(v.normalized?i.get(v.normalized.toLowerCase()):void 0))){d=m;break}}let p=t.slice(u+1,d),f=this.extractRolesFromMarkedTokens(l,p,o,c,e);if(s.push(re(c,f,{sourceLanguage:e,confidence:.7})),a=d,a<t.length){let m=t[a];(m.kind==="conjunction"||this.isThenKeyword(m.value,e))&&a++;}}return s}extractRolesFromMarkedTokens(t,e,n,i,o){let s={},a=u=>{let c=[];for(let l of u){let d=n.get(l.value);if(d&&l.kind==="particle"&&c.length>0){let p=this.tokensToSemanticValue(c);if(p){let f=this.mapRoleForCommand(d,i,s);f&&(s[f]=p);}c=[];}else c.push(l);}if(c.length>0){let l=this.tokensToSemanticValue(c);l&&(s.patient?s.destination||(s.destination=l):s.patient=l);}};return a(t),a(e),s}mapRoleForCommand(t,e,n){return n[t]?t==="patient"&&!n.destination?"destination":t==="destination"&&!n.patient?"patient":t==="source"&&!n.source?"source":null:t}tokensToSemanticValue(t){if(t.length===0)return null;let e=t.filter(o=>o.kind!=="whitespace");if(e.length===0)return null;if(e.length===1)return this.tokenToSemanticValue(e[0]);let n=e.map(o=>o.value).join(""),i=e[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?Q(n):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?b(n):i.kind==="reference"?M(n):b(n)}tokenToSemanticValue(t){let e=t.value;if(t.kind==="selector"||e.startsWith("#")||e.startsWith(".")||e.startsWith("@")||e.startsWith("*"))return Q(e);if(e.startsWith('"')||e.startsWith("'"))return b(e);if(/^-?\d+(\.\d+)?$/.test(e))return b(parseFloat(e));if(e==="true"||e==="\u771F"||e==="\uCC38"||e==="do\u011Fru")return b(true);if(e==="false"||e==="\u507D"||e==="\uAC70\uC9D3"||e==="yanl\u0131\u015F")return b(false);let n=t.normalized?.toLowerCase();return n==="me"||n==="it"||n==="you"||n==="result"||n==="body"?M(n):t.kind==="reference"?M(t.normalized||"me"):b(e)}parseBodyWithGrammarPatterns(t,e,n,i){let o=[];for(;!t.isAtEnd();){let s=t.peek();if(s&&this.isThenKeyword(s.value,i)){t.advance();continue}if(s&&this.isEndKeyword(s.value,i)){t.advance();break}let a=false;if(n.length>0){let u=D.matchBest(t,n);if(u){let c=u.pattern.command,l={};for(let[f,m]of u.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(l[f]=m);let d=re(c,l,{sourceLanguage:i,patternId:u.pattern.id});o.push(d),a=true;let p=u.captured.get("continues");if(p&&p.type==="literal"&&p.value==="then")continue}}if(!a){let u=D.matchBest(t,e);u&&(o.push(this.buildCommand(u,i)),a=true);}a||t.advance();}return o}tryCompoundCommandParsing(t,e,n){let i=t.tokens;if(!i.some(u=>u.kind==="conjunction"||u.kind==="keyword"&&this.isThenKeyword(u.value,n)))return null;let s=new de(i,n),a=this.parseBodyWithClauses(s,e,n);return a.length===0?null:a.length===1?a[0]:Ve(a,"then",{sourceLanguage:n,confidence:.65})}trySOVEventExtraction(t,e,n){let i=N.SOV_EVENT_MARKERS[e];if(!i)return null;let s=pe(t,e).tokens,a=Er[e],u=new Set;if(a)for(let C of Object.keys(a))u.add(C.toLowerCase());let c=N.SOV_SOURCE_MARKERS[e],l=-1,d="",p="",f=1;for(let C=0;C<s.length;C++){let B=s[C],O=B.value.toLowerCase(),I=O,F="",se=O.indexOf("[");se>0&&(I=O.slice(0,se),F=B.value.slice(se));let ae=B.normalized?.toLowerCase(),ke=ae&&N.KNOWN_EVENTS.has(ae),Te=u.has(O)||u.has(I),yt=N.KNOWN_EVENTS.has(I);if(ke||Te||yt){let U;if(ke?U=ae:Te?U=a?.[O]??a?.[I]??I:U=I,i.size>0){let J=1,ue=s[C+1];ue&&ue.kind==="selector"&&ue.value.startsWith("[")&&(J=2);let ee=s[C+J];if(ee&&(ee.kind==="particle"||ee.kind==="keyword")&&i.has(ee.value)){l=C,d=U,p=F||(J===2?s[C+1].value:""),f=J+1;break}}else {l=C,d=U,p=F,f=1;break}}}if(l===-1)return null;let m=new Set;for(let C=l;C<l+f;C++)m.add(C);if(c){let C=l+f;if(C<s.length){let B=s[C];(B.kind==="particle"||B.kind==="keyword")&&c.markers.has(B.value)&&m.add(C);}for(let B=0;B<l;B++){let O=s[B],I=O.value.toLowerCase(),F=O.normalized?.toLowerCase();if(c.windowTokens.has(I)||F&&c.windowTokens.has(F)){m.add(B);break}}}let v=s.filter((C,B)=>!m.has(B));if(v.length===0)return null;let S=n.filter(C=>C.command!=="on"),w=new de(v,e),_=this.parseBodyWithClauses(w,S,e);if(_.length===0)return null;let we={sourceLanguage:e,confidence:.75};return p&&(we.keyFilter=p),qe({type:"literal",value:d},_,void 0,we)}isThenKeyword(t,e){let n={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 (n[e]||n.en).has(t.toLowerCase())}isEndKeyword(t,e){let n={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 (n[e]||n.en).has(t.toLowerCase())}extractStandaloneModifiers(t,e){let i=pe(t,e).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let s=i[0].value.toLowerCase(),a=N.STANDALONE_MODIFIERS[s];if(!a)return {modifiers:null,remainingInput:null};let u={},c=1;if(a==="once")u.once=true;else {let f=1;if(f<i.length){let m=i[f];(m.kind==="keyword"||m.kind==="particle")&&(f++,c++);}if(f<i.length){let m=i[f];if(m.kind==="literal"){let v=m.value.match(/^(\d+)(ms|s|m)?$/);if(v){let S=parseInt(v[1],10),w=v[2]||"ms";w==="s"?S*=1e3:w==="m"&&(S*=6e4),u[a]=S,c=f+1;}}}u[a]||(u[a]=a==="debounce"?300:100);}let l=i.slice(c);if(l.length===0)return {modifiers:null,remainingInput:null};let d=l[0].position.start,p=t.slice(d);return {modifiers:u,remainingInput:p}}applyModifiers(t,e){return {...t,eventModifiers:{...t.eventModifiers,...e}}}extractOrConjunctionEvents(t,e){let n=[];for(;;){let i=t.mark(),o=t.peek();if(!o)break;let s=(o.normalized||o.value).toLowerCase();if(!N.OR_KEYWORDS.has(s)){t.reset(i);break}t.advance();let a=t.peek();if(!a){t.reset(i);break}let u=(a.normalized||a.value).toLowerCase();t.advance(),n.push({type:"literal",value:u});}return n}};j.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);j.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"])};j.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"])}};j.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};j.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 Cr=j,wr=new Cr;function ye(r,t){return wr.parse(r,t)}var he=class{constructor(r={}){this.cache=new Map,this.config={maxSize:r.maxSize??1e3,ttlMs:r.ttlMs??0,enabled:r.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(r,t){return `${t}:${r}`}isExpired(r){return this.config.ttlMs===0?false:Date.now()-r.createdAt>this.config.ttlMs}evictLRU(){let r=this.cache.keys().next().value;r!==void 0&&(this.cache.delete(r),this.stats.evictions++);}get(r,t){if(!this.config.enabled){this.stats.misses++;return}let e=this.makeKey(r,t),n=this.cache.get(e);if(!n){this.stats.misses++;return}if(this.isExpired(n)){this.cache.delete(e),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(e),n.lastAccessed=Date.now(),this.cache.set(e,n),this.stats.hits++,n.result}set(r,t,e){if(!this.config.enabled||e.confidence===0)return;let n=this.makeKey(r,t),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(n,{result:e,createdAt:i,lastAccessed:i});}has(r,t){if(!this.config.enabled)return false;let e=this.makeKey(r,t),n=this.cache.get(e);return n?this.isExpired(n)?(this.cache.delete(e),this.stats.expirations++,false):true:false}delete(r,t){let e=this.makeKey(r,t);return this.cache.delete(e)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let r=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:r>0?this.stats.hits/r:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(r){if(r.maxSize!==void 0)for(this.config.maxSize=r.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();r.ttlMs!==void 0&&(this.config.ttlMs=r.ttlMs),r.enabled!==void 0&&(this.config.enabled=r.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},kr=new he;var Tr=class{constructor(r={}){this.patternMatcher=new rt,this.languages=new Set(tt()),r.cache===false?this.cache=new he({enabled:false}):this.cache=r.cache?new he(r.cache):kr;}analyze(r,t){if(!this.supportsLanguage(t))return {confidence:0,errors:[`Language '${t}' is not supported for semantic parsing`]};let e=this.cache.get(r,t);if(e)return e;let n=this.analyzeUncached(r,t);return this.cache.set(r,t,n),n}analyzeUncached(r,t){try{try{let s=ye(r,t),a={confidence:s.metadata?.confidence??.8,node:s};return s.kind==="command"?{...a,command:{name:s.action,roles:s.roles}}:a}catch{}let e=gr(t);if(!e)return {confidence:0,errors:[`No tokenizer available for language '${t}'`]};let n=e.tokenize(r),i=L(t);if(i.length===0)return {confidence:0,errors:[`No patterns available for language '${t}'`]};let o=this.patternMatcher.matchBest(n,i);if(o){let s=this.buildSemanticNode(o);return {confidence:o.confidence,command:{name:o.pattern.command,roles:o.captured},node:s,tokensConsumed:o.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(e){return {confidence:0,errors:[e instanceof Error?e.message:String(e)]}}}supportsLanguage(r){return this.languages.has(r)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(r){this.cache.configure(r);}buildSemanticNode(r){return {kind:"command",action:r.pattern.command,roles:r.captured,metadata:{patternId:r.pattern.id}}}};function it(r){return new Tr(r)}var br=.5;function ot(r,t=br){return r.confidence>=t&&r.command!==void 0}var Sr={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"],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)"}},Br={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"}},Pr={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"}},xr={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"}},Rr={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>"}},_r={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}]},Nr={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}]},Or={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}]},Ir={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}]},Mr={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}]},zr={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}]},Fr={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"}}]},Dr={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"}}]},Lr={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"}}]},$r={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"}}]},qr={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}]},Vr={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}]},Wr={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}]},jr={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}]},Ur={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}]},Gr={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}]},Hr={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}]},Kr={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"}}]},Qr={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}]},Yr={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}]},Xr={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Zr={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"'},Jr={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"}}]},en={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}]},tn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},rn={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:""}}]},nn={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}]},on={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"}}]},sn={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}]},an={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}]},un={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}]},ln={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}]},cn={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}]},dn={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:""}}]},fn={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"}}]},mn={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},hn={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}]},vn={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}]},yn={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"}}]},gn={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"}}]},En={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"}}]},An={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}]},Cn={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},wn={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}]},kn={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Tn={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}]},bn={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}]},st={toggle:Sr,add:Br,remove:Pr,put:xr,set:Rr,show:_r,hide:Nr,on:Or,trigger:Ir,wait:Mr,fetch:zr,increment:Fr,decrement:Dr,append:Lr,prepend:$r,log:qr,get:Vr,take:Wr,make:jr,halt:Ur,settle:Gr,throw:Hr,send:Kr,if:Qr,unless:Yr,else:Xr,repeat:Zr,for:Jr,while:en,continue:tn,go:rn,transition:nn,clone:on,focus:sn,blur:an,call:un,return:ln,js:cn,async:dn,tell:pn,default:fn,init:mn,behavior:hn,install:vn,measure:yn,swap:gn,morph:En,beep:An,break:Cn,copy:wn,exit:kn,pick:Tn,render:bn,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Sn(){return Object.values(st).filter(r=>r.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(lr(),Ye)).then(({validateAllSchemas:r,formatValidationResults:t})=>{let e=r(st);e.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(t(e)),console.warn(`
3
- These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(r=>{console.debug("Schema validation skipped:",r);});function at(r,t){let e=t==="SOV"?"sovPosition":"svoPosition";return [...r].sort((n,i)=>{let o=n[e]??99,s=i[e]??99;return o-s})}function Bn(r,t){let e=r.markerOverride?.[t.code],n=t.roleMarkers[r.role];if(e!==void 0)return {primary:e,position:n?.position??"before",isOverride:true};if(n&&n.primary){let i={primary:n.primary,position:n.position,isOverride:false};return n.alternatives&&(i.alternatives=n.alternatives),i}return null}function Pn(r,t,e,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let c=n.primary.split(/\s+/);if(c.length>1)for(let l of c)o.push({type:"literal",value:l});else {let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}}let s=t.roleMarkers.destination;s&&o.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}]}),o.push({type:"role",role:"patient",optional:false});let a=t.roleMarkers.patient;if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};o.push(c);}let u=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};return o.push(u),{id:`${r.action}-event-${t.code}-sov`,language:t.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${n.primary} {destination?} {patient} ${a?.primary||""} ${e.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function xn(r,t,e,n,i){let o=[];o.push({type:"role",role:"patient",optional:false});let s=t.roleMarkers.patient;if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(u);}if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let u=n.primary.split(/\s+/);if(u.length>1)for(let c of u)o.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}}let a=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};return o.push(a),{id:`${r.action}-event-${t.code}-sov-patient-first`,language:t.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${n.primary} ${e.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Rn(r,t,e,n,i){let o=[];o.push({type:"role",role:"patient",optional:false});let s=t.roleMarkers.patient;if(s){let c=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(c);}let a=t.roleMarkers.destination;if(a&&(o.push({type:"role",role:"destination",optional:false}),o.push(a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary})),o.push({type:"role",role:"event",optional:false}),n.position==="after"){let c=n.primary.split(/\s+/);if(c.length>1)for(let l of c)o.push({type:"literal",value:l});else {let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}}let u=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};return o.push(u),{id:`${r.action}-event-${t.code}-sov-patient-first-dest`,language:t.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${s?.primary||""} {destination} ${a?.primary||""} {event} ${n.primary} ${e.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function _n(r,t,e,n,i){let o=[];o.push({type:"role",role:"event",optional:false});let s=n.alternatives?.filter(l=>!l.includes(" ")&&l.length>1)||[];s.length>0&&o.push({type:"literal",value:s[0],alternatives:s.slice(1)});let a=t.roleMarkers.destination;a&&o.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}]}),o.push({type:"role",role:"patient",optional:false});let u=t.roleMarkers.patient;if(u){let l=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};o.push(l);}let c=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};return o.push(c),{id:`${r.action}-event-${t.code}-sov-compact`,language:t.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${s[0]||""} {patient} ${e.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Nn(r,t,e,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let a=n.primary.split(/\s+/);if(a.length>1)for(let u of a)o.push({type:"literal",value:u});else {let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}}let s=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};return o.push(s),{id:`${r.action}-event-${t.code}-sov-simple`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${n.primary} ${e.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function On(r,t,e,n){let i=t.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let o=[];o.push({type:"role",role:"event",optional:false}),t.possessive?.marker&&o.push({type:"group",optional:true,tokens:[{type:"literal",value:t.possessive.marker}]}),o.push({type:"literal",value:i[0],alternatives:i.slice(1)}),o.push({type:"role",role:"patient",optional:false});let s=t.roleMarkers.patient;if(s?.primary){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(u);}let a=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};return o.push(a),{id:`${r.action}-event-${t.code}-sov-temporal`,language:t.code,command:"on",priority:(n.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${e.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function In(r,t,e,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let d of l)o.push({type:"literal",value:d});else {let d=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(d);}}let a=[...r.roles.filter(l=>l.required)].sort((l,d)=>{let p=l.sovPosition??999,f=d.sovPosition??999;return p-f});for(let l of a){o.push({type:"role",role:l.role,optional:false});let d,p;if(l.markerOverride&&l.markerOverride[t.code]!==void 0)d=l.markerOverride[t.code];else {let f=t.roleMarkers[l.role];f&&(d=f.primary,p=f.alternatives);}if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(f);}}let u=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};o.push(u);let c=a.map(l=>`{${l.role}}`).join(" ");return {id:`${r.action}-event-${t.code}-sov-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${n.primary} ${c} ${e.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(a.map(l=>[l.role,{fromRole:l.role}]))}}}function Mn(r,t,e,n,i){let o=[],a=[...r.roles.filter(m=>m.required)].sort((m,v)=>{let S=m.sovPosition??999,w=v.sovPosition??999;return S-w}),u=a[0];o.push({type:"role",role:u.role,optional:false});let c;if(u.markerOverride&&u.markerOverride[t.code]!==void 0)c=u.markerOverride[t.code];else {let m=t.roleMarkers[u.role];m&&(c=m.primary);}if(c&&o.push({type:"literal",value:c}),o.push({type:"role",role:"event",optional:false}),n.position==="after"){let m=n.primary.split(/\s+/);if(m.length>1)for(let v of m)o.push({type:"literal",value:v});else {let v=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(v);}}let l=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};o.push(l);let d=a[1];o.push({type:"role",role:d.role,optional:false});let p,f;if(d.markerOverride&&d.markerOverride[t.code]!==void 0)p=d.markerOverride[t.code];else {let m=t.roleMarkers[d.role];m&&(p=m.primary,f=m.alternatives);}if(p){let m=f?{type:"literal",value:p,alternatives:f}:{type:"literal",value:p};o.push(m);}return {id:`${r.action}-event-${t.code}-sov-2role-dest-first`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${u.role}} {event} ${n.primary} ${e.primary} {${d.role}}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},[u.role]:{fromRole:u.role},[d.role]:{fromRole:d.role}}}}function Ue(r,t,e,n,i){let o=[];if(n.position==="before"){let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}o.push({type:"role",role:"event",optional:false});let s=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let a=t.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:`${r.action}-event-${t.code}-vso`,language:t.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${n.primary} {event} ${e.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function zn(r,t,e,n,i){let o=[],s=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let a=t.roleMarkers.destination;if(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}]}),n.position==="before"){let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}return o.push({type:"role",role:"event",optional:false}),{id:`${r.action}-event-${t.code}-vso-verb-first`,language:t.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${e.primary} {patient} ${a?.primary||""} {destination?} ${n.primary} {event}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Fn(r,t,e,n,i){let o=[],s=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};o.push(s);let u=[...r.roles.filter(l=>l.required)].sort((l,d)=>{let p=l.svoPosition??999,f=d.svoPosition??999;return p-f});for(let l of u){let d,p;if(l.markerOverride&&l.markerOverride[t.code]!==void 0)d=l.markerOverride[t.code];else {let f=t.roleMarkers[l.role];f&&(d=f.primary,p=f.alternatives);}if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(f);}o.push({type:"role",role:l.role,optional:false});}if(n.position==="before"){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}o.push({type:"role",role:"event",optional:false});let c=u.map(l=>`{${l.role}}`).join(" ");return {id:`${r.action}-event-${t.code}-vso-verb-first-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${e.primary} ${c} ${n.primary} {event}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(u.map(l=>[l.role,{fromRole:l.role}]))}}}function Ge(r,t,e,n,i){let o=[];if(n.position==="before"){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}o.push({type:"role",role:"event",optional:false});let s=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};o.push(s);let u=[...r.roles.filter(l=>l.required)].sort((l,d)=>{let p=l.svoPosition??999,f=d.svoPosition??999;return p-f});for(let l of u){let d,p;if(l.markerOverride&&l.markerOverride[t.code]!==void 0)d=l.markerOverride[t.code];else {let f=t.roleMarkers[l.role];f&&(d=f.primary,p=f.alternatives);}if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(f);}o.push({type:"role",role:l.role,optional:false});}let c=u.map(l=>`{${l.role}}`).join(" ");return {id:`${r.action}-event-${t.code}-vso-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${n.primary} {event} ${e.primary} ${c}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(u.map(l=>[l.role,{fromRole:l.role}]))}}}function Dn(r,t,e,n,i){let o=[],s=t.eventHandler?.negationMarker;if(n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}if(s){let c=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(c);}o.push({type:"role",role:"event",optional:false});let a=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};o.push(a),o.push({type:"role",role:"patient",optional:false});let u=t.roleMarkers.destination;return u&&o.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:`${r.action}-event-${t.code}-vso-negated`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${s?.primary||""} {event} ${e.primary} {patient} ${u?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ln(r,t,e,n){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let o=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary};i.push(o),i.push({type:"role",role:"patient",optional:false});let s=t.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:`${r.action}-event-${t.code}-vso-proclitic`,language:t.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`[proclitic?] {event} ${e.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var Y={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function ut(r,t,e=Y){let n=`${r.action}-${t.code}-generated`,i=e.basePriority??100,o=t.keywords[r.action];if(!o)throw new Error(`No keyword translation for '${r.action}' in ${t.code}`);let s=Wn(r,t,o),a=ct(r,t),u=Hn(r,t,o);return {id:n,language:t.code,command:r.action,priority:i,template:{format:u,tokens:s},extraction:a}}function $n(r,t,e=Y){if(r.roles.filter(a=>!a.required).length===0)return null;let i=r.roles.filter(a=>a.required),o={...r,roles:i};return {...ut(o,t,e),id:`${r.action}-${t.code}-simple`,priority:(e.basePriority??100)-5,extraction:ct(r,t)}}function qn(r,t,e=Y){let n=[];if(n.push(ut(r,t,e)),e.generateSimpleVariants){let i=$n(r,t,e);i&&n.push(i);}return n}function lt(r,t=Y){let e=[],n=Sn();for(let i of n){if(!r.keywords[i.action])continue;let o=qn(i,r,t);if(e.push(...o),r.eventHandler?.eventMarker){let s=Vn(i,r,t);e.push(...s);}}return e}function Vn(r,t,e=Y){if(!t.eventHandler||!t.eventHandler.eventMarker)return [];let n=[],i=t.eventHandler.eventMarker,o=t.keywords[r.action];if(!o)return [];let a=r.roles.filter(u=>u.required).length===2;if(t.wordOrder==="SOV")if(a)n.push(In(r,t,o,i,e)),n.push(Mn(r,t,o,i,e));else {n.push(Pn(r,t,o,i,e)),n.push(xn(r,t,o,i,e));let u=t.roleMarkers.destination;u&&u.primary!==i.primary&&n.push(Rn(r,t,o,i,e));let c=i.primary.split(/\s+/),l=i.alternatives?.some(p=>!p.includes(" ")&&p.length>1);c.length>1&&l&&n.push(_n(r,t,o,i,e)),n.push(Nn(r,t,o,i,e));let d=On(r,t,o,e);d&&n.push(d);}else t.wordOrder==="VSO"?a?(n.push(Ge(r,t,o,i,e)),n.push(Fn(r,t,o,i,e))):(n.push(Ue(r,t,o,i,e)),n.push(zn(r,t,o,i,e)),t.eventHandler?.negationMarker&&n.push(Dn(r,t,o,i,e)),t.tokenization?.prefixes&&n.push(Ln(r,t,o,e))):a?n.push(Ge(r,t,o,i,e)):n.push(Ue(r,t,o,i,e));return n}function Wn(r,t,e){let n=[],i=e.alternatives?{type:"literal",value:e.primary,alternatives:e.alternatives}:{type:"literal",value:e.primary},o=jn(r,t);switch(t.wordOrder){case "SVO":n.push(i),n.push(...o);break;case "SOV":n.push(...o),n.push(i);break;case "VSO":n.push(i),n.push(...o);break;default:n.push(i),n.push(...o);}return n}function jn(r,t){let e=[],n=at(r.roles,t.wordOrder);for(let i of n){let o=Un(i,t);i.required?e.push(...o):e.push({type:"group",optional:true,tokens:o});}return e}function Un(r,t){let e=[],n=r.markerOverride?.[t.code],i=t.roleMarkers[r.role],o={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes};if(n!==void 0)(i?.position??"before")==="before"?(n&&e.push({type:"literal",value:n}),e.push(o)):(e.push(o),n&&e.push({type:"literal",value:n}));else if(i)if(i.position==="before"){if(i.primary){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};e.push(s);}e.push(o);}else {e.push(o);let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};e.push(s);}else e.push(o);return e}function Gn(r,t){let e={};for(let n of r.roles){let i=n.markerOverride?.[t.code],o=t.roleMarkers[n.role];i!==void 0?e[n.role]=i?{marker:i}:{}:o&&o.primary?e[n.role]=o.alternatives?{marker:o.primary,markerAlternatives:o.alternatives}:{marker:o.primary}:e[n.role]={};}return e}function ct(r,t){let e=Gn(r,t),n={};for(let i of r.roles){let o=e[i.role]||{};!i.required&&i.default?n[i.role]={...o,default:i.default}:n[i.role]=o;}return n}function Hn(r,t,e){let n=[],o=at(r.roles,t.wordOrder).map(s=>{let a=Bn(s,t),u="";return a&&a.primary?a.position==="before"?u=`${a.primary} {${s.role}}`:u=`{${s.role}} ${a.primary}`:u=`{${s.role}}`,s.required?u:`[${u}]`});switch(t.wordOrder){case "SVO":case "VSO":n.push(e.primary,...o);break;case "SOV":n.push(...o,e.primary);break;default:n.push(e.primary,...o);}return n.join(" ")}function oe(r){let t=r.getAttribute("data-lang");if(t)return ge(t);let e=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(e)return ge(e);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?ge(n):null}function ge(r){return r.split("-")[0].toLowerCase()}var dt={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 Z(r){switch(r.kind){case "event-handler":return Kn(r);case "compound":return Qn(r);default:return Yn(r)}}function Kn(r){let t=["on"],e=r.roles.get("event");e&&t.push(X(e));let n=r.roles.get("source");if(n&&t.push("from",X(n)),r.body&&r.body.length>0){let i=r.body.map(Z);t.push(i.join(" then "));}return t.join(" ")}function Qn(r){let t=r.chainType==="async"?"async":r.chainType;return r.statements.map(Z).join(` ${t} `)}function Yn(r){let t=dt[r.action];if(t){let n=[r.action];for(let[i,o]of t){let s=r.roles.get(i);s&&(i==="destination"&&s.type==="reference"&&s.value==="me"||(o&&n.push(o),n.push(X(s))));}return n.join(" ")}let e=[r.action];for(let[,n]of r.roles)e.push(X(n));return e.join(" ")}function X(r){switch(r.type){case "literal":return typeof r.value=="string"&&r.dataType==="string"?`"${r.value}"`:String(r.value);case "selector":return r.value;case "reference":return r.value;case "property-path":return Xn(r);case "expression":return r.raw}}function Xn(r){let t=X(r.object),e=r.property;if(r.object.type==="reference")switch(r.object.value){case "me":return `my ${e}`;case "it":return `its ${e}`;case "you":return `your ${e}`}return `${t}'s ${e}`}var ft=.5,Zn={confidenceThreshold:ft,strategy:"semantic",fallbackToOriginal:true};function Jn(r,t){return typeof r=="number"?r:r[t]??r["*"]??ft}var Ee=null;function ei(){return Ee||(Ee=it()),Ee}function Ae(r,t,e={}){let n={...Zn,...e},i=pt(r,t,n);if(i!==null)return i;let o=ri(r);if(o){let s=pt(o.commands,t,n);if(s!==null)return o.prefix+s}return r}function pt(r,t,e){if(e.strategy==="semantic"||e.strategy==="auto"){let n=Jn(e.confidenceThreshold,t),i=mt(r,t,n);if(i!==null)return i}if((e.strategy==="auto"||e.strategy==="i18n")&&e.i18nToEnglish){let n=ni(r,t,e.i18nToEnglish);if(n!==null)return n}return null}var ti=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function ri(r){let t=r.match(ti);if(!t)return null;let e=t[1],n=r.slice(e.length);return n?{prefix:e,commands:n}:null}function mt(r,t,e){try{let n=oi(r,t);if(n.length>1)return si(n,t,e);let i=ei();if(!i.supportsLanguage(t))return null;let o=i.analyze(r,t);if(!ot(o,e))return null;if(o.node)return Z(o.node);let s=ye(r,t);return Z(s)}catch{return null}}function ni(r,t,e){try{let n=e(r,t);return n!==r?n:null}catch{return null}}function ii(r){let t=["then"],e=z(r);if(e?.keywords?.then){let n=e.keywords.then;if(n.primary&&n.primary!=="then"&&t.push(n.primary),n.alternatives)for(let i of n.alternatives)t.includes(i)||t.push(i);}return t}function oi(r,t){let n=ii(t).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${n.join("|")})\\s+`,"i"),o=r.split(`
4
- `).map(a=>a.trim()).filter(a=>a.length>0),s=[];for(let a of o){let u=a.split(i);s.push(...u);}return s}function si(r,t,e){let n=[];for(let i of r){let o=mt(i.trim(),t,e);if(o===null)return null;n.push(o);}return n.join(" then ")}function Ce(r={}){return function(e){let{internals:n}=e,i=n.runtime,o=i.getScript.bind(i);i.getScript=function(s){let a=o(s);if(!a)return null;let u=ai(s,r);if(!u||u==="en")return a;let c=Ae(a,u,r);return r.debug&&c!==a&&console.log(`[hyperscript-i18n] ${u}: "${a}" \u2192 "${c}"`),c};}}function ai(r,t){if(t.languageAttribute){let n=r.getAttribute(t.languageAttribute);if(n)return n.split("-")[0].toLowerCase()}let e=oe(r);return e||(t.defaultLanguage??null)}function ht(r,t,e={}){return t==="en"?r:Ae(r,t,e)}et(r=>lt(r));function vt(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Ce()),ui());}function ui(){if(typeof document>"u")return;let t=_hyperscript?.internals?.runtime;if(!t?.processNode||!t?.getInternalData)return;let e=t.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(e).forEach(n=>{let i=t.getInternalData(n);i.initialized&&(i.initialized=false);}),t.processNode(document.body);}var Fi=["hi","bn"];vt();exports.plugin=Ce;exports.preprocess=ht;exports.resolveLanguage=oe;exports.supportedLanguages=Fi;return exports;})({});
1
+ var HyperscriptI18n=(function(exports){'use strict';function B(r,e){return e?{type:"literal",value:r,dataType:e}:{type:"literal",value:r}}function ve(r,e){return e?{type:"selector",value:r,selectorKind:e}:{type:"selector",value:r}}function ne(r){return {type:"reference",value:r}}function ge(r,e){return {type:"property-path",object:r,property:e}}var _t=class{constructor(r){this.namespace=r,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let r=process.env.DEBUG||"";return r==="*"||r.includes("framework:*")||r.includes(`framework:${this.namespace}`)}return false}log(r,e,...t){if(!this.enabled)return;let n=`[framework:${this.namespace}]`,i=new Date().toISOString();switch(r){case "debug":console.debug(`${i} ${n} DEBUG:`,e,...t);break;case "info":console.info(`${i} ${n} INFO:`,e,...t);break;case "warn":console.warn(`${i} ${n} WARN:`,e,...t);break;case "error":console.error(`${i} ${n} ERROR:`,e,...t);break}}debug(r,...e){this.log("debug",r,...e);}info(r,...e){this.log("info",r,...e);}warn(r,...e){this.log("warn",r,...e);}error(r,...e){this.log("error",r,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function Lt(r){return new _t(r)}function D(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function It(r,e){return r?.possessive?.keywords?.[e]}var H=class ${constructor(){this.logger=Lt("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,n){let i=e.mark(),o=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",t.id),this.logger.debug("Pattern command:",t.command),this.logger.debug("Pattern language:",t.language),this.logger.debug("Pattern template:",JSON.stringify(t.template,null,2)),this.logger.isEnabled()){let u=[];for(let l=0;l<10;l++){let c=e.peek(l);if(c)u.push({type:c.type,value:c.value,kind:c.kind});else break}this.logger.debug("Input tokens (first 10):",u),this.logger.debug("Profile code:",n?.code);}this.currentProfile=n,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(t.template.tokens,null,2));let s=this.matchTokenSequence(e,t.template.tokens,o);if(this.logger.debug("matchTokenSequence returned:",s),this.logger.debug("Captured roles:",Array.from(o.entries()).map(([u,l])=>[u,JSON.stringify(l)])),!s)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(i),null;let a=this.calculateConfidence(t,o);return this.applyExtractionRules(t,o),{pattern:t,captured:o,consumedTokens:e.position()-i.position,confidence:a}}matchBest(e,t,n){let i=[];for(let s of t){let a=e.mark(),u=this.matchPattern(e,s,n);u&&i.push(u),e.reset(a);}if(i.length===0)return null;i.sort((s,a)=>{let u=a.pattern.priority-s.pattern.priority;if(u!==0)return u;let l=a.confidence-s.confidence;return Math.abs(l)>.001?l:a.consumedTokens-s.consumedTokens});let o=i[0];return this.matchPattern(e,o.pattern),o}matchTokenSequence(e,t,n,i){let o=t[0],s=o?.type==="literal"&&(o.value==="and"||o.value==="then"||o.alternatives?.includes("and")||o.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!s)for(;e.peek()?.kind==="conjunction";)e.advance();let a=null,u=null;for(let l=0;l<t.length;l++){let c=t[l];this.logger.debug(" >> Matching pattern token:",JSON.stringify(c,null,2));let d=e.peek();if(this.logger.debug(" >> Current input token:",d?JSON.stringify({type:d.type,value:d.value,kind:d.kind}):"EOF"),c.type==="role"&&c.greedy){let y=this.collectStopMarkers(t,l+1);if(i)for(let b of i)y.add(b);let g=[];for(;!e.isAtEnd();){let b=e.peek();if(!b||this.isStopMarker(b,y))break;g.push(b.value),e.advance();}if(g.length>0){n.set(c.role,{type:"expression",raw:g.join(" ")}),a=null,u=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let y=this.collectStopMarkers(t,l+1);if(i)for(let b of i)y.add(b);if(this.matchGroupToken(e,c,n,y)){a=null,u=null;continue}if(this.isOptional(c))continue;return false}let p=c.type==="role"&&c.optional===true,f=p?e.mark():null;if(c.type==="role"&&!p){let y=l+1<t.length?t[l+1]:null;if(y?.type==="literal"){let g=e.peek();if(g&&this.getMatchType(g,y.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(c))continue;if(a&&u){this.logger.debug(" >> BACKTRACKING: undoing optional role",u),e.reset(a),n.delete(u),a=null,u=null;let b=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Backtrack retry result:",b),b)continue}return false}}}let v=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Match result:",v),v){p?(a=f,u=c.role):(a=null,u=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(c)){if(a&&u){this.logger.debug(" >> BACKTRACKING: undoing optional role",u),e.reset(a),n.delete(u),a=null,u=null;let y=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Backtrack retry result:",y),y)continue}return false}}return true}matchPatternToken(e,t,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,n);case "group":return this.matchGroupToken(e,t,n);default:return false}}matchLiteralToken(e,t){let n=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",n?JSON.stringify({type:n.type,value:n.value,kind:n.kind}):"null"),!n)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let i=this.getMatchType(n,t.value);if(this.logger.debug(" >>> matchType for",n.value,"vs",t.value,":",i),i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let o of t.alternatives){let s=this.getMatchType(n,o);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,n){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",t.role),this.logger.debug(" >>> matchRoleToken: expected types",t.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",t.optional),this.skipNoiseWords(e);let i=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null"),!i)return t.optional||false;let o=this.tryMatchPossessiveExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!D(o.type,t.expectedTypes)?t.optional||false:(n.set(t.role,o),true);let s=this.tryMatchMethodCallExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!D(s.type,t.expectedTypes)?t.optional||false:(n.set(t.role,s),true);let a=this.tryMatchPossessiveSelectorExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!D(a.type,t.expectedTypes)?t.optional||false:(n.set(t.role,a),true);let u=this.tryMatchPropertyAccessExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!D(u.type,t.expectedTypes)?t.optional||false:(n.set(t.role,u),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!D(l.type,t.expectedTypes)?t.optional||false:(n.set(t.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null");let c=this.tokenToSemanticValue(i);return this.logger.debug(" >>> tokenToSemanticValue returned:",c?JSON.stringify(c):"null"),c?(this.logger.debug(" >>> Validating type:",c.type,"against expected:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!D(c.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),n.set(t.role,c),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let n=t.normalized||t.value,i=this.safeToLowerCase(n),o=It(this.currentProfile,i);if(!o)return null;let s=e.mark();e.advance();let a=e.peek();if(!a)return e.reset(s),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 u=a.value;a.kind==="selector"&&u.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u)&&(u=u.substring(1));let l=u;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let c=e.peek();return c?.kind==="literal"&&c.value.startsWith("(")&&(l+=c.value,e.advance()),ge(ne(o),l)}return e.reset(s),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=e.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return e.reset(n),null;e.advance();let a=[];for(;!e.isAtEnd()&&a.length<$.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}a.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${o.value}(${a.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=`${t.value}.${o.value}`,a=1;for(;!e.isAtEnd()&&a<$.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),s+=`.${c.value}`,a++;}let u=e.peek();if(u&&u.kind==="punctuation"&&u.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<$.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(c===0){e.advance();break}c--;}if(p.kind==="punctuation"&&p.value==="("&&c++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${s}(${l.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let o=e.peek();return !o||o.kind!=="selector"&&o.kind!=="identifier"?(e.reset(n),null):(e.advance(),ge(ve(t.value),o.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||typeof t.value!="string"||!t.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let o=e.peek(1);o&&o.kind,e.advance();let s=i.value.slice(1);return ge(ve(t.value),s)}matchGroupToken(e,t,n,i){let o=e.mark(),s=new Set(n.keys());if(this.matchTokenSequence(e,t.tokens,n,i))return true;e.reset(o);for(let l of n.keys())s.has(l)||n.delete(l);if(!t.optional)return false;let u=this.getGroupLeadingMarker(t);if(u)for(let l=1;l<=$.MAX_MARKER_SCAN;l++){let c=e.peek(l);if(!c)break;if((c.normalized||c.value).toLowerCase()===u){this.logger.debug(" >> MARKER SCAN: found",u,"at offset",l,"- skipping intervening tokens");for(let f=0;f<l;f++)e.advance();if(this.matchTokenSequence(e,t.tokens,n,i))return true;e.reset(o);for(let f of n.keys())s.has(f)||n.delete(f);break}}return true}getGroupLeadingMarker(e){let t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let n=new Set;for(let i=t;i<e.length;i++){let o=e[i];if(o.type==="literal"){if(n.add(o.value.toLowerCase()),o.alternatives)for(let s of o.alternatives)n.add(s.toLowerCase());break}if(o.type==="group"){for(let s of o.tokens)if(s.type==="literal"){if(n.add(s.value.toLowerCase()),s.alternatives)for(let a of s.alternatives)n.add(a.toLowerCase());break}if(!o.optional)break}}return n}isStopMarker(e,t){return t.size===0?false:!!(t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return ve(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return B(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return ne(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 t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let i=parseFloat(t[1]);return t[2]?B(e,"duration"):B(i,"number")}let n=parseFloat(e);return isNaN(n)?B(e,"string"):B(n,"number")}applyExtractionRules(e,t){for(let[n,i]of Object.entries(e.extraction))t.has(n)||(i.value!==void 0?t.set(n,{type:"literal",value:i.value}):i.default&&t.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let n=0,i=0,o=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")i+=1,t.has(l.role)&&(n+=1);else if(l.type==="group"){for(let c of l.tokens)if(c.type==="role"){let d=o(c.role),p=.8;i+=p,t.has(c.role)?n+=p:d&&(n+=p*.6);}}let s=i>0?n/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;s=Math.max(.5,s-l);}let a=this.calculateVSOConfidenceBoost(e);s=Math.min(1,s+a);let u=this.arabicPrepositionDisambiguation(e,t);return s=Math.max(0,Math.min(1,s+u)),s}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let n=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(n.has(t.value))return .15;if(t.alternatives){for(let i of t.alternatives)if(n.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let n=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[o,s]of t.entries()){let a=i[o];if(!a||a.length===0)continue;let u="metadata"in s?s.metadata:void 0;if(u&&typeof u.prepositionValue=="string"){let l=u.prepositionValue;a.includes(l)?n+=.1:n-=.1;}}return Math.max(-0.1,Math.min(.1,n))}skipNoiseWords(e){let t=e.peek();if(!t)return;let n=this.safeToLowerCase(t.value);if($.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let o=e.peek();if(o&&o.kind==="selector")return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let t={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let o=i.metadata;if(!o)break;switch(n=true,o.modifierName){case "once":t.once=true;break;case "debounce":typeof o.value=="number"&&(t.debounce=o.value);break;case "throttle":typeof o.value=="number"&&(t.throttle=o.value);break;case "queue":(o.value==="first"||o.value==="last"||o.value==="all"||o.value==="none")&&(t.queue=o.value);break}e.advance();}return n?t:void 0}};H.MAX_MARKER_SCAN=3;H.MAX_PROPERTY_DEPTH=10;H.MAX_METHOD_ARGS=20;H.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Mt=H;new Mt;var ie=class{constructor(){this.name="string-literal";}canExtract(r,e){let t=r[e];return t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(r,e){let t=r[e];if(t==="\u201C"){let o=1;for(;e+o<r.length;){if(r[e+o]==="\u201D")return o++,{value:r.substring(e,e+o),length:o};o++;}return null}if(t==="\u2018"){let o=1;for(;e+o<r.length;){if(r[e+o]==="\u2019")return o++,{value:r.substring(e,e+o),length:o};o++;}return null}let n=1,i=false;for(;e+n<r.length;){let o=r[e+n];if(i){i=false,n++;continue}if(o==="\\"){i=true,n++;continue}if(o===t)return n++,{value:r.substring(e,e+n),length:n};n++;}return null}},oe=class{constructor(){this.name="number";}canExtract(r,e){return /\d/.test(r[e])}extract(r,e){let t=0,n=false;for(;e+t<r.length;){let s=r[e+t];if(/\d/.test(s))t++;else if(s==="."&&!n)n=true,t++;else break}if(t===0)return null;let i=r.substring(e,e+t),o=e+t;if(o<r.length){let s=r.slice(o),a=[{pattern:"\u6BEB\u79D2",suffix:"ms"},{pattern:"\u5206\u949F",suffix:"m"},{pattern:"\u5C0F\u65F6",suffix:"h"},{pattern:"\u30DF\u30EA\u79D2",suffix:"ms"},{pattern:"\u6642\u9593",suffix:"h"}];for(let l of a)if(s.startsWith(l.pattern))return {value:i+l.suffix,length:t+l.pattern.length,metadata:{hasTimeUnit:true}};if(s.startsWith("ms"))return {value:i+"ms",length:t+2,metadata:{hasTimeUnit:true}};let u=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of u)if(s.startsWith(l.pattern))return {value:i+l.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(s))return {value:i+s[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:i,length:t}}};function Dt(r){return "setContext"in r&&typeof r.setContext=="function"}function $t(r){let e={language:r.language,direction:r.direction,lookupKeyword:r.lookupKeyword.bind(r),isKeyword:r.isKeyword.bind(r),isKeywordStart:r.isKeywordStart.bind(r)};return r.normalizer?{...e,normalizer:r.normalizer}:e}var zt=new Set(["me","you","it","result","event","target","body"]);function Me(r,e=zt){return e.has(r)}var Y=class{constructor(r,e){this.pos=0,this.tokens=r,this.language=e;}peek(r=0){let e=this.pos+r;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let e=[];for(;!this.isAtEnd()&&r(this.peek());)e.push(this.advance());return e}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function S(r,e){return {start:r,end:e}}function A(r,e,t,n){if(typeof r=="object"){let{value:o,kind:s,position:a,normalized:u,stem:l,stemConfidence:c,metadata:d}=r;return {value:o,kind:s,position:a,...u!==void 0&&{normalized:u},...l!==void 0&&{stem:l},...c!==void 0&&{stemConfidence:c},...d!==void 0&&{metadata:d}}}let i=r;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof n=="string")return {value:i,kind:e,position:t,normalized:n};if(n){let{normalized:o,stem:s,stemConfidence:a,metadata:u}=n;return {value:i,kind:e,position:t,...o!==void 0&&{normalized:o},...s!==void 0&&{stem:s},...a!==void 0&&{stemConfidence:a},...u!==void 0&&{metadata:u}}}return {value:i,kind:e,position:t}}function G(r){return /\s/.test(r)}function Vt(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function qt(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function _(r){return /\d/.test(r)}function Wt(r){return /[a-zA-Z]/.test(r)}function k(r){return /[a-zA-Z0-9_-]/.test(r)}function jt(r,e){if(e>=r.length)return null;let t=r[e];if(!Vt(t))return null;let n=e,i="";if(t==="#"||t==="."){for(i+=r[n++];n<r.length&&k(r[n]);)i+=r[n++];if(i.length<=1)return null;if(n<r.length&&r[n]==="."&&t==="#"){let s=n+1;for(;s<r.length&&k(r[s]);)s++;if(s<r.length&&r[s]==="(")return i}}else if(t==="["){let o=1,s=false,a=null,u=false;for(i+=r[n++];n<r.length&&o>0;){let l=r[n];i+=l,u?u=false:l==="\\"?u=true:s?l===a&&(s=false,a=null):l==='"'||l==="'"||l==="`"?(s=true,a=l):l==="["?o++:l==="]"&&o--,n++;}if(o!==0)return null}else if(t==="@"){for(i+=r[n++];n<r.length&&k(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(t==="*"){for(i+=r[n++];n<r.length&&k(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(t==="<"){if(i+=r[n++],n>=r.length||!Wt(r[n]))return null;for(;n<r.length&&k(r[n]);)i+=r[n++];for(;n<r.length;){let o=r[n];if(o==="."){if(i+=r[n++],n>=r.length||!k(r[n]))return null;for(;n<r.length&&k(r[n]);)i+=r[n++];}else if(o==="#"){if(i+=r[n++],n>=r.length||!k(r[n]))return null;for(;n<r.length&&k(r[n]);)i+=r[n++];}else if(o==="["){let s=1,a=false,u=null,l=false;for(i+=r[n++];n<r.length&&s>0;){let c=r[n];i+=c,l?l=false:c==="\\"?l=true:a?c===u&&(a=false,u=null):c==='"'||c==="'"||c==="`"?(a=true,u=c):c==="["?s++:c==="]"&&s--,n++;}if(s!==0)return null}else break}for(;n<r.length&&G(r[n]);)i+=r[n++];if(n<r.length&&r[n]==="/")for(i+=r[n++];n<r.length&&G(r[n]);)i+=r[n++];if(n>=r.length||r[n]!==">")return null;i+=r[n++];}return i||null}function Ut(r,e){if(e>=r.length||r[e]!=="'"||e+1>=r.length||r[e+1].toLowerCase()!=="s")return false;if(e+2>=r.length)return true;let n=r[e+2];return G(n)||n==="*"||!k(n)}function Kt(r,e){if(e>=r.length)return null;let t=r[e];if(!qt(t)||t==="'"&&Ut(r,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!i)return null;let o=e+1,s=t,a=false;for(;o<r.length;){let u=r[o];if(s+=u,a)a=false;else if(u==="\\")a=true;else if(u===i)return s;o++;}return s}function Gt(r,e){if(e>=r.length)return false;let t=r[e],n=r[e+1]||"",i=r[e+2]||"";if(t==="/"&&n!=="/"&&/[a-zA-Z0-9._-]/.test(n)||t==="/"&&n==="/"&&/[a-zA-Z]/.test(i)||t==="."&&(n==="/"||n==="."&&i==="/"))return true;let o=r.slice(e,e+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function Ht(r,e){if(!Gt(r,e))return null;let t=e,n="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<r.length;){let o=r[t];if(o==="#"){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=o,t++;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)n+=r[t++];break}if(i.test(o))n+=o,t++;else break}return n.length<2?null:n}function Yt(r,e){if(e>=r.length)return null;let t=r[e];if(!_(t)&&t!=="-"&&t!=="+")return null;let n=e,i="";if((r[n]==="-"||r[n]==="+")&&(i+=r[n++]),n>=r.length||!_(r[n]))return null;for(;n<r.length&&_(r[n]);)i+=r[n++];if(n<r.length&&r[n]===".")for(i+=r[n++];n<r.length&&_(r[n]);)i+=r[n++];return n<r.length&&(r.slice(n,n+2)==="ms"?i+="ms":(r[n]==="s"||r[n]==="m"||r[n]==="h")&&(i+=r[n])),i}var Xt=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Xt);var $e=class ze{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){Dt(e)&&e.setContext($t(this)),this.extractors.push(e);}registerExtractors(e){for(let t of e)this.registerExtractor(t);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&G(e[n]);)n++;if(n>=e.length)break;let i=false;for(let o of this.extractors)if(o.canExtract(e,n)){let s=o.extract(e,n);if(s){let a=s.metadata?.normalized,u=s.metadata?.stem,l=s.metadata?.stemConfidence,c={};if(s.metadata)for(let[p,f]of Object.entries(s.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(c[p]=f);let d={};a&&(d.normalized=a),u&&(d.stem=u),l!==void 0&&(d.stemConfidence=l),Object.keys(c).length>0&&(d.metadata=c),t.push(A(s.value,this.classifyToken(s.value),S(n,n+s.length),Object.keys(d).length>0?d:void 0)),n+=s.length,i=true;break}}if(!i){let o=e[n],s=this.classifyUnknownChar(o);t.push(A(o,s,S(n,n+1))),n++;}}return new Y(t,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,n){if(e[t]!==".")return false;let i=n[n.length-1],o=i&&i.position.end<t;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return n.push(A(".","operator",S(t,t+1))),true;let u=t+1;for(;u<e.length&&k(e[u]);)u++;return u<e.length&&e[u]==="("?(n.push(A(".","operator",S(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let n=new Map;if(e.keywords){for(let[i,o]of Object.entries(e.keywords))if(n.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:o.normalized||i});}if(e.references){for(let[i,o]of Object.entries(e.references))n.set(o,{native:o,normalized:i});for(let i of Object.keys(e.references))n.has(i)||n.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,o]of Object.entries(e.roleMarkers))if(o.primary&&n.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:i});}if(e.possessive?.keywords)for(let[i,o]of Object.entries(e.possessive.keywords))n.set(i,{native:i,normalized:o});for(let i of t)n.set(i.native,i);this.profileKeywords=Array.from(n.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(let n of this.profileKeywords)if(e.slice(t).startsWith(n.native))return A(n.native,"keyword",S(t,t+n.native.length),n.normalized);return null}isKeywordStart(e,t){let n=e.slice(t);return this.profileKeywords.some(i=>n.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 t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,n){let i=this.tryNormalize(e);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return A(e,"keyword",S(t,n),s)}trySelector(e,t){let n=jt(e,t);return n?A(n,"selector",S(t,t+n.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let n=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!n)return null;let i=n[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=n[1];return {...A(i,"event-modifier",S(t,t+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(e,t){let n=Kt(e,t);return n?A(n,"literal",S(t,t+n.length)):null}tryNumber(e,t){let n=Yt(e,t);return n?A(n,"literal",S(t,t+n.length)):null}tryMatchTimeUnit(e,t,n,i=false){let o=t;if(i)for(;o<e.length&&G(e[o]);)o++;let s=e.slice(o);for(let a of n){let u=s.slice(0,a.length);if(a.caseInsensitive?u.toLowerCase()===a.pattern.toLowerCase():u===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let c=s[a.length]||"";if(k(c))continue}return {suffix:a.suffix,endPos:o+a.length}}}return null}parseBaseNumber(e,t,n=true){let i=t,o="";if(n&&(e[i]==="-"||e[i]==="+")&&(o+=e[i++]),i>=e.length||!_(e[i]))return null;for(;i<e.length&&_(e[i]);)o+=e[i++];if(i<e.length&&e[i]===".")for(o+=e[i++];i<e.length&&_(e[i]);)o+=e[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(e,t,n,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(e,t,o);if(!a)return null;let{number:u,endPos:l}=a,c=[...n,...ze.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,l,c,s);return d&&(u+=d.suffix,l=d.endPos),A(u,"literal",S(t,l))}tryUrl(e,t){let n=Ht(e,t);return n?A(n,"url",S(t,t+n.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!k(e[t+1]))return null;let n=t+1;for(;n<e.length&&k(e[n]);)n++;let i=e.slice(t,n);return A(i,"identifier",S(t,n))}tryOperator(e,t){let n=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(n))return A(n,"operator",S(t,t+2));let i=e[t];return ["<",">","!","+","-","*","/","="].includes(i)?A(i,"operator",S(t,t+1)):["(",")","{","}",",",";",":"].includes(i)?A(i,"punctuation",S(t,t+1)):null}tryMultiCharParticle(e,t,n){for(let i of n)if(e.slice(t,t+i.length)===i)return A(i,"particle",S(t,t+i.length));return null}};$e.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 se=$e;function ae(r){return {stem:r,confidence:1}}function ue(r,e,t){return t?{stem:r,confidence:e,metadata:t}:{stem:r,confidence:e}}var Jt=new Map,Qt=new Map,Zt=new Map;function er(r,e,t){Jt.set(r,e),Qt.set(r,t),Zt.delete(r);}function Fe(r){return /[\u0900-\u097F\u0A8E-\u0A8F]/u.test(r)}var tr=[{suffix:" \u0930\u0939\u093E \u0939\u0948",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:" \u0930\u0939\u0940 \u0939\u0948",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:" \u0930\u0939\u0947 \u0939\u0948\u0902",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u0930\u0939\u093E",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u0930\u0939\u0940",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u0930\u0939\u0947",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u0942\u0902\u0917\u093E",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"\u0942\u0902\u0917\u0940",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"\u0947\u0917\u093E",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"\u0947\u0917\u0940",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"\u0947\u0902\u0917\u0947",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"\u0924\u093E \u0939\u0948",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u0924\u0940 \u0939\u0948",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u0924\u0947 \u0939\u0948\u0902",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u0924\u093E",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u0924\u0940",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u0924\u0947",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u0928\u093E",replacement:"",confidence:.9,type:"dictionary",minStemLength:1},{suffix:"\u093E\u092F\u093E",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"\u093E\u092F\u0940",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"\u093E\u092F\u0947",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"\u092F\u093E",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"\u093F\u092F\u0947",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"\u093F\u090F",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"\u0908",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"\u090F",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"\u0947\u0902",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"\u094B",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"\u093E",replacement:"",confidence:.82,type:"past",minStemLength:2},{suffix:"\u0940",replacement:"",confidence:.82,type:"past",minStemLength:2},{suffix:"\u0947",replacement:"",confidence:.82,type:"past",minStemLength:2}],We=class{constructor(){this.language="hi";}isNormalizable(r){return r.length<2?false:Fe(r)}normalize(r){let e=this.tryConjugationNormalization(r);return e||ae(r)}tryConjugationNormalization(r){for(let e of tr)if(r.endsWith(e.suffix)){let t=Array.from(r),n=Array.from(e.suffix),i=t.slice(0,t.length-n.length),o=i.join("")+e.replacement,s=e.minStemLength??1;if(i.length<s||o.length>0&&!Fe(o))continue;return ue(o,e.confidence,{removedSuffixes:[e.suffix],conjugationType:e.type})}return null}},je={code:"hi",name:"Hindi",nativeName:"\u0939\u093F\u0928\u094D\u0926\u0940",direction:"ltr",script:"devanagari",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:true,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["\u0947\u0902","\u093E","\u0940","\u0947","\u094B"],subjectDrop:true},references:{me:"\u092E\u0948\u0902",it:"\u092F\u0939",you:"\u0906\u092A",result:"\u092A\u0930\u093F\u0923\u093E\u092E",event:"\u0918\u091F\u0928\u093E",target:"\u0932\u0915\u094D\u0937\u094D\u092F",body:"\u092C\u0949\u0921\u0940"},possessive:{marker:"\u0915\u093E",markerPosition:"between",keywords:{\u092E\u0947\u0930\u093E:"me",\u092E\u0947\u0930\u0940:"me",\u092E\u0947\u0930\u0947:"me",\u0924\u0947\u0930\u093E:"you",\u0924\u0947\u0930\u0940:"you",\u0924\u0947\u0930\u0947:"you",\u0906\u092A\u0915\u093E:"you",\u0906\u092A\u0915\u0940:"you",\u0906\u092A\u0915\u0947:"you",\u0909\u0938\u0915\u093E:"it",\u0909\u0938\u0915\u0940:"it",\u0909\u0938\u0915\u0947:"it",\u0907\u0938\u0915\u093E:"it",\u0907\u0938\u0915\u0940:"it",\u0907\u0938\u0915\u0947:"it"}},roleMarkers:{patient:{primary:"\u0915\u094B",position:"after"},destination:{primary:"\u092E\u0947\u0902",alternatives:["\u0915\u094B","\u092A\u0930"],position:"after"},source:{primary:"\u0938\u0947",position:"after"},style:{primary:"\u0938\u0947",position:"after"},event:{primary:"\u092A\u0930",position:"after"}},keywords:{toggle:{primary:"\u091F\u0949\u0917\u0932",alternatives:["\u092C\u0926\u0932\u0947\u0902","\u092C\u0926\u0932"],normalized:"toggle"},add:{primary:"\u091C\u094B\u0921\u093C\u0947\u0902",alternatives:["\u091C\u094B\u0921\u093C"],normalized:"add"},remove:{primary:"\u0939\u091F\u093E\u090F\u0902",alternatives:["\u0939\u091F\u093E","\u092E\u093F\u091F\u093E\u090F\u0902"],normalized:"remove"},put:{primary:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"],normalized:"put"},append:{primary:"\u091C\u094B\u0921\u093C\u0947\u0902_\u0905\u0902\u0924",alternatives:[],normalized:"append"},prepend:{primary:"\u091C\u094B\u0921\u093C\u0947\u0902_\u0936\u0941\u0930\u0942",alternatives:[],normalized:"prepend"},take:{primary:"\u0932\u0947\u0902",alternatives:["\u0932\u0947"],normalized:"take"},make:{primary:"\u092C\u0928\u093E\u090F\u0902",alternatives:["\u092C\u0928\u093E"],normalized:"make"},clone:{primary:"\u0915\u094D\u0932\u094B\u0928",alternatives:["\u092A\u094D\u0930\u0924\u093F\u0932\u093F\u092A\u093F"],normalized:"clone"},swap:{primary:"\u092C\u0926\u0932\u0947\u0902_\u0938\u094D\u0925\u093E\u0928",alternatives:[],normalized:"swap"},morph:{primary:"\u0930\u0942\u092A\u093E\u0902\u0924\u0930",alternatives:[],normalized:"morph"},set:{primary:"\u0938\u0947\u091F",alternatives:["\u0928\u093F\u0930\u094D\u0927\u093E\u0930\u093F\u0924"],normalized:"set"},get:{primary:"\u092A\u094D\u0930\u093E\u092A\u094D\u0924",alternatives:["\u092A\u093E\u090F\u0902"],normalized:"get"},increment:{primary:"\u092C\u0922\u093C\u093E\u090F\u0902",alternatives:["\u092C\u0922\u093C\u093E"],normalized:"increment"},decrement:{primary:"\u0918\u091F\u093E\u090F\u0902",alternatives:["\u0918\u091F\u093E"],normalized:"decrement"},log:{primary:"\u0932\u0949\u0917",alternatives:["\u0926\u0930\u094D\u091C"],normalized:"log"},show:{primary:"\u0926\u093F\u0916\u093E\u090F\u0902",alternatives:["\u0926\u093F\u0916\u093E"],normalized:"show"},hide:{primary:"\u091B\u093F\u092A\u093E\u090F\u0902",alternatives:["\u091B\u093F\u092A\u093E"],normalized:"hide"},transition:{primary:"\u0938\u0902\u0915\u094D\u0930\u092E\u0923",alternatives:[],normalized:"transition"},on:{primary:"\u092A\u0930",alternatives:[],normalized:"on"},trigger:{primary:"\u091F\u094D\u0930\u093F\u0917\u0930",alternatives:[],normalized:"trigger"},send:{primary:"\u092D\u0947\u091C\u0947\u0902",alternatives:["\u092D\u0947\u091C"],normalized:"send"},focus:{primary:"\u092B\u094B\u0915\u0938",alternatives:["\u0915\u0947\u0902\u0926\u094D\u0930\u093F\u0924"],normalized:"focus"},blur:{primary:"\u0927\u0941\u0902\u0927\u0932\u093E",alternatives:["\u092B\u094B\u0915\u0938_\u0939\u091F\u093E\u090F\u0902"],normalized:"blur"},click:{primary:"\u0915\u094D\u0932\u093F\u0915",normalized:"click"},hover:{primary:"\u0939\u094B\u0935\u0930",alternatives:["\u090A\u092A\u0930_\u0930\u0916\u0947\u0902"],normalized:"hover"},submit:{primary:"\u0938\u092C\u092E\u093F\u091F",alternatives:["\u091C\u092E\u093E"],normalized:"submit"},input:{primary:"\u0907\u0928\u092A\u0941\u091F",alternatives:[],normalized:"input"},change:{primary:"\u092C\u0926\u0932\u093E\u0935",alternatives:["\u092A\u0930\u093F\u0935\u0930\u094D\u0924\u0928"],normalized:"change"},go:{primary:"\u091C\u093E\u090F\u0902",alternatives:["\u091C\u093E"],normalized:"go"},wait:{primary:"\u092A\u094D\u0930\u0924\u0940\u0915\u094D\u0937\u093E",alternatives:["\u0930\u0941\u0915\u0947\u0902"],normalized:"wait"},fetch:{primary:"\u0932\u093E\u090F\u0902",alternatives:[],normalized:"fetch"},settle:{primary:"\u0938\u094D\u0925\u093F\u0930",alternatives:[],normalized:"settle"},if:{primary:"\u0905\u0917\u0930",alternatives:["\u092F\u0926\u093F"],normalized:"if"},when:{primary:"\u091C\u092C",normalized:"when"},where:{primary:"\u0915\u0939\u093E\u0901",normalized:"where"},else:{primary:"\u0935\u0930\u0928\u093E",alternatives:["\u0928\u0939\u0940\u0902 \u0924\u094B"],normalized:"else"},repeat:{primary:"\u0926\u094B\u0939\u0930\u093E\u090F\u0902",alternatives:["\u0926\u094B\u0939\u0930\u093E"],normalized:"repeat"},for:{primary:"\u0915\u0947 \u0932\u093F\u090F",alternatives:[],normalized:"for"},while:{primary:"\u091C\u092C \u0924\u0915",alternatives:[],normalized:"while"},continue:{primary:"\u091C\u093E\u0930\u0940",alternatives:[],normalized:"continue"},halt:{primary:"\u0930\u094B\u0915\u0947\u0902",alternatives:["\u0930\u094B\u0915"],normalized:"halt"},throw:{primary:"\u092B\u0947\u0902\u0915\u0947\u0902",alternatives:["\u092B\u0947\u0902\u0915"],normalized:"throw"},call:{primary:"\u0915\u0949\u0932",alternatives:["\u092C\u0941\u0932\u093E\u090F\u0902"],normalized:"call"},return:{primary:"\u0932\u094C\u091F\u093E\u090F\u0902",alternatives:["\u0932\u094C\u091F\u093E"],normalized:"return"},then:{primary:"\u092B\u093F\u0930",alternatives:["\u0924\u092C"],normalized:"then"},and:{primary:"\u0914\u0930",alternatives:[],normalized:"and"},end:{primary:"\u0938\u092E\u093E\u092A\u094D\u0924",alternatives:["\u0905\u0902\u0924"],normalized:"end"},js:{primary:"\u091C\u0947\u090F\u0938",alternatives:["js"],normalized:"js"},async:{primary:"\u0905\u0938\u093F\u0902\u0915",alternatives:[],normalized:"async"},tell:{primary:"\u092C\u0924\u093E\u090F\u0902",alternatives:["\u092C\u0924\u093E"],normalized:"tell"},default:{primary:"\u0921\u093F\u092B\u093C\u0949\u0932\u094D\u091F",alternatives:[],normalized:"default"},init:{primary:"\u092A\u094D\u0930\u093E\u0930\u0902\u092D",alternatives:[],normalized:"init"},behavior:{primary:"\u0935\u094D\u092F\u0935\u0939\u093E\u0930",alternatives:[],normalized:"behavior"},install:{primary:"\u0907\u0902\u0938\u094D\u091F\u0949\u0932",alternatives:[],normalized:"install"},measure:{primary:"\u092E\u093E\u092A\u0947\u0902",alternatives:[],normalized:"measure"},beep:{primary:"\u092C\u0940\u092A",alternatives:[],normalized:"beep"},break:{primary:"\u0924\u094B\u0921\u093C\u0947\u0902",alternatives:[],normalized:"break"},copy:{primary:"\u0915\u0949\u092A\u0940",alternatives:[],normalized:"copy"},exit:{primary:"\u092C\u093E\u0939\u0930",alternatives:[],normalized:"exit"},pick:{primary:"\u091A\u0941\u0928\u0947\u0902",alternatives:[],normalized:"pick"},render:{primary:"\u0930\u0947\u0902\u0921\u0930",alternatives:[],normalized:"render"},into:{primary:"\u092E\u0947\u0902",alternatives:["\u0915\u094B"],normalized:"into"},before:{primary:"\u0938\u0947 \u092A\u0939\u0932\u0947",alternatives:["\u092A\u0939\u0932\u0947"],normalized:"before"},after:{primary:"\u0915\u0947 \u092C\u093E\u0926",alternatives:["\u092C\u093E\u0926"],normalized:"after"},until:{primary:"\u0924\u0915",alternatives:[],normalized:"until"},event:{primary:"\u0918\u091F\u0928\u093E",alternatives:[],normalized:"event"},from:{primary:"\u0938\u0947",normalized:"from"}},tokenization:{particles:["\u0915\u094B","\u092E\u0947\u0902","\u092A\u0930","\u0938\u0947","\u0915\u093E","\u0915\u0940","\u0915\u0947","\u0924\u0915","\u0928\u0947"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"\u092A\u0930",alternatives:[],normalized:"on"},sourceMarker:{primary:"\u0938\u0947",position:"after"},eventMarker:{primary:"\u092A\u0930",alternatives:["\u092E\u0947\u0902"],position:"after"},temporalMarkers:["\u091C\u092C","\u091C\u092C \u092D\u0940"]}},rr=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],nr=class{constructor(r=rr){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},ir="()[]{},:;",or=class{constructor(r=ir){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function sr(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var ar=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=sr(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},ur=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],o=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function lr(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var cr=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=lr(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},dr=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Ee(r){let e=r.charCodeAt(0);return e>=2304&&e<=2431||e>=43232&&e<=43263}var pr=class{constructor(){this.name="hindi-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Ee(r[e])}extract(r,e){if(!this.context)throw new Error("HindiKeywordExtractor: context not set");let t=e,n="",i=e;for(;i<r.length&&(Ee(r[i])||r[i]===" ");){if(r[i]===" "){if(i+1<r.length&&Ee(r[i+1])){let u=r.slice(i),l=[" \u0915\u0947 \u0932\u093F\u090F"," \u0915\u0947 \u0938\u093E\u0925"," \u0915\u0947 \u092C\u093E\u0926"," \u0938\u0947 \u092A\u0939\u0932\u0947"," \u0928\u0939\u0940\u0902 \u0924\u094B"," \u091C\u092C \u0924\u0915"," \u0915\u0947 \u092C\u093E\u0930\u0947 \u092E\u0947\u0902"].find(c=>u.startsWith(c));if(l){n+=l,i+=l.length;continue}}break}n+=r[i],i++;}if(!n)return null;let o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0,a;if(!o&&this.context.normalizer){let u=this.context.normalizer.normalize(n);if(u.stem!==n&&u.confidence>=.7){let l=this.context.lookupKeyword(u.stem);l&&(a=l.normalized);}}return {value:n,length:i-t,metadata:{normalized:s||a}}}},Ve=new Map([["\u0915\u094B",{role:"patient",confidence:.95}],["\u092E\u0947\u0902",{role:"destination",confidence:.9}],["\u092A\u0930",{role:"event",confidence:.85}],["\u0938\u0947",{role:"source",confidence:.9}],["\u0915\u093E",{role:"possessive",confidence:.95}],["\u0915\u0940",{role:"possessive",confidence:.95}],["\u0915\u0947",{role:"possessive",confidence:.95}],["\u0924\u0915",{role:"until",confidence:.9}],["\u0928\u0947",{role:"agent",confidence:.85}]]),qe=new Map([["\u0915\u0947 \u0932\u093F\u090F",{role:"purpose",confidence:.95}],["\u0915\u0947 \u0938\u093E\u0925",{role:"instrument",confidence:.95}],["\u0915\u0947 \u092C\u093E\u0926",{role:"temporal-after",confidence:.9}],["\u0938\u0947 \u092A\u0939\u0932\u0947",{role:"temporal-before",confidence:.9}],["\u0928\u0939\u0940\u0902 \u0924\u094B",{role:"conditional",confidence:.85}],["\u091C\u092C \u0924\u0915",{role:"temporal-until",confidence:.9}],["\u0915\u0947 \u092C\u093E\u0930\u0947 \u092E\u0947\u0902",{role:"about",confidence:.9}]]),fr=class{constructor(){this.name="hindi-particle";}setContext(r){this._context=r,this._context;}canExtract(r,e){for(let[i]of qe)if(r.startsWith(i,e))return true;let t="",n=e;for(;n<r.length&&this.isDevanagari(r[n]);)t+=r[n],n++;return Ve.has(t)}extract(r,e){for(let[o,s]of qe)if(r.startsWith(o,e))return {value:o,length:o.length,metadata:{role:s.role,confidence:s.confidence,variant:o}};let t="",n=e;for(;n<r.length&&this.isDevanagari(r[n]);)t+=r[n],n++;let i=Ve.get(t);return i?{value:t,length:t.length,metadata:{role:i.role,confidence:i.confidence,variant:t}}:null}isDevanagari(r){let e=r.charCodeAt(0);return e>=2304&&e<=2431||e>=43232&&e<=43263}};function mr(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function hr(r){let e=r.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var yr=class{constructor(){this.name="ascii-identifier";}setContext(r){this.context=r;}canExtract(r,e){return mr(r[e])}extract(r,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let t=e,n="",i=e;for(;i<r.length&&hr(r[i]);)n+=r[i],i++;if(!n)return null;let o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0;return {value:n,length:i-t,metadata:{normalized:s}}}};function vr(){return [new cr,new ur,new dr,new ar]}var gr=new Set(["\u0915\u094B","\u092E\u0947\u0902","\u092A\u0930","\u0938\u0947","\u0915\u093E","\u0915\u0940","\u0915\u0947","\u0924\u0915","\u0928\u0947"]),Er=[{native:"\u0938\u091A",normalized:"true"},{native:"\u0938\u0924\u094D\u092F",normalized:"true"},{native:"\u091D\u0942\u0920",normalized:"false"},{native:"\u0905\u0938\u0924\u094D\u092F",normalized:"false"},{native:"\u0916\u093E\u0932\u0940",normalized:"null"},{native:"\u0905\u092A\u0930\u093F\u092D\u093E\u0937\u093F\u0924",normalized:"undefined"},{native:"\u092A\u0939\u0932\u093E",normalized:"first"},{native:"\u0905\u0902\u0924\u093F\u092E",normalized:"last"},{native:"\u0905\u0917\u0932\u093E",normalized:"next"},{native:"\u092A\u093F\u091B\u0932\u093E",normalized:"previous"},{native:"\u0928\u093F\u0915\u091F\u0924\u092E",normalized:"closest"},{native:"\u092E\u0942\u0932",normalized:"parent"},{native:"\u0915\u094D\u0932\u093F\u0915",normalized:"click"},{native:"\u092A\u0930\u093F\u0935\u0930\u094D\u0924\u0928",normalized:"change"},{native:"\u091C\u092E\u093E",normalized:"submit"},{native:"\u0907\u0928\u092A\u0941\u091F",normalized:"input"},{native:"\u0932\u094B\u0921",normalized:"load"},{native:"\u0938\u094D\u0915\u094D\u0930\u0949\u0932",normalized:"scroll"},{native:"\u0915\u094B",normalized:"to"},{native:"\u0915\u0947 \u0938\u093E\u0925",normalized:"with"}],br=class extends se{constructor(){super(),this.language="hi",this.direction="ltr",this.initializeKeywordsFromProfile(je,Er),this.normalizer=new We,this.registerExtractors(vr()),this.registerExtractor(new ie),this.registerExtractor(new oe),this.registerExtractor(new fr),this.registerExtractor(new pr),this.registerExtractor(new yr),this.registerExtractor(new nr),this.registerExtractor(new or);}classifyToken(r){return gr.has(r)?"particle":this.isKeyword(r)?"keyword":r.startsWith("/")||r.startsWith("./")||r.startsWith("../")||r.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":(r.startsWith(":"),"identifier")}},Sr=new br;er("hi",Sr,je);var Ar=new Map,wr=new Map,Cr=new Map;function kr(r,e,t){Ar.set(r,e),wr.set(r,t),Cr.delete(r);}function Ue(r){return /[\u0980-\u09FF]/u.test(r)}var Tr=[{suffix:"\u099A\u09CD\u099B\u09C7 \u0986\u099B\u09C7",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u099A\u09CD\u099B \u0986\u099B\u09BF",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u099A\u09CD\u099B\u09C7\u09A8 \u0986\u099B\u09C7\u09A8",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u09C7\u099B\u09C7\u09A8",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u09C7\u099B\u09C7",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u09C7\u099B",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"\u09AC\u09C7\u09A8",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"\u09AC\u09C7",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"\u09AC\u09CB",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"\u09B2\u09C7\u09A8",replacement:"",confidence:.85,type:"past",minStemLength:1},{suffix:"\u09B2\u09CB",replacement:"",confidence:.85,type:"past",minStemLength:1},{suffix:"\u09B2",replacement:"",confidence:.85,type:"past",minStemLength:2},{suffix:"\u09C1\u09A8",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"\u09CB",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"\u099A\u09CD\u099B\u09C7",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u099A\u09CD\u099B",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u099A\u09CD\u099B\u09BF",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"\u09BE",replacement:"",confidence:.9,type:"dictionary",minStemLength:1},{suffix:"\u09C7",replacement:"",confidence:.85,type:"present",minStemLength:2},{suffix:"\u09BF",replacement:"",confidence:.85,type:"present",minStemLength:2},{suffix:"\u09CB",replacement:"",confidence:.85,type:"present",minStemLength:2}],xr=class{constructor(){this.language="bn";}isNormalizable(r){return r.length<2?false:Ue(r)}normalize(r){let e=this.tryConjugationNormalization(r);return e||ae(r)}tryConjugationNormalization(r){for(let e of Tr)if(r.endsWith(e.suffix)){let t=Array.from(r),n=Array.from(e.suffix),i=t.slice(0,t.length-n.length),o=i.join("")+e.replacement,s=e.minStemLength??1;if(i.length<s||o.length>0&&!Ue(o))continue;return ue(o,e.confidence,{removedSuffixes:[e.suffix],conjugationType:e.type})}return null}},Rr=new xr,He={code:"bn",name:"Bengali",nativeName:"\u09AC\u09BE\u0982\u09B2\u09BE",direction:"ltr",script:"bengali",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:true,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["\u09C1\u09A8","\u09CB","\u09BE","\u09C7","\u09BF"],subjectDrop:true},references:{me:"\u0986\u09AE\u09BF",it:"\u098F\u099F\u09BF",you:"\u0986\u09AA\u09A8\u09BF",result:"\u09AB\u09B2\u09BE\u09AB\u09B2",event:"\u0998\u099F\u09A8\u09BE",target:"\u09B2\u0995\u09CD\u09B7\u09CD\u09AF",body:"\u09AC\u09A1\u09BF"},possessive:{marker:"\u09B0",markerPosition:"between",keywords:{\u0986\u09AE\u09BE\u09B0:"me",\u09A4\u09CB\u09AE\u09BE\u09B0:"you",\u0986\u09AA\u09A8\u09BE\u09B0:"you",\u09A4\u09BE\u09B0:"it",\u098F\u09B0:"it"}},roleMarkers:{patient:{primary:"\u0995\u09C7",position:"after"},destination:{primary:"\u09A4\u09C7",alternatives:["\u098F"],position:"after"},source:{primary:"\u09A5\u09C7\u0995\u09C7",position:"after"},style:{primary:"\u09A6\u09BF\u09AF\u09BC\u09C7",position:"after"},event:{primary:"\u09A4\u09C7",position:"after"}},keywords:{toggle:{primary:"\u099F\u0997\u09B2",normalized:"toggle"},add:{primary:"\u09AF\u09CB\u0997",alternatives:["\u09AF\u09CB\u0997 \u0995\u09B0\u09C1\u09A8"],normalized:"add"},remove:{primary:"\u09B8\u09B0\u09BE\u09A8",alternatives:["\u09B8\u09B0\u09BF\u09AF\u09BC\u09C7 \u09AB\u09C7\u09B2\u09C1\u09A8","\u09AE\u09C1\u099B\u09C1\u09A8"],normalized:"remove"},put:{primary:"\u09B0\u09BE\u0996\u09C1\u09A8",alternatives:["\u09B0\u09BE\u0996"],normalized:"put"},append:{primary:"\u09B6\u09C7\u09B7\u09C7 \u09AF\u09CB\u0997",alternatives:[],normalized:"append"},prepend:{primary:"\u09B6\u09C1\u09B0\u09C1\u09A4\u09C7 \u09AF\u09CB\u0997",alternatives:[],normalized:"prepend"},take:{primary:"\u09A8\u09BF\u09A8",alternatives:["\u09A8\u09C7"],normalized:"take"},make:{primary:"\u09A4\u09C8\u09B0\u09BF \u0995\u09B0\u09C1\u09A8",alternatives:["\u09AC\u09BE\u09A8\u09BE\u09A8"],normalized:"make"},clone:{primary:"\u0995\u09CD\u09B2\u09CB\u09A8",alternatives:["\u09AA\u09CD\u09B0\u09A4\u09BF\u09B2\u09BF\u09AA\u09BF"],normalized:"clone"},swap:{primary:"\u09AC\u09A6\u09B2",alternatives:[],normalized:"swap"},morph:{primary:"\u09B0\u09C2\u09AA\u09BE\u09A8\u09CD\u09A4\u09B0",alternatives:[],normalized:"morph"},set:{primary:"\u09B8\u09C7\u099F",alternatives:["\u09A8\u09BF\u09B0\u09CD\u09A7\u09BE\u09B0\u09A3"],normalized:"set"},get:{primary:"\u09AA\u09BE\u09A8",normalized:"get"},increment:{primary:"\u09AC\u09C3\u09A6\u09CD\u09A7\u09BF",alternatives:["\u09AC\u09BE\u09A1\u09BC\u09BE\u09A8"],normalized:"increment"},decrement:{primary:"\u09B9\u09CD\u09B0\u09BE\u09B8",alternatives:["\u0995\u09AE\u09BE\u09A8"],normalized:"decrement"},log:{primary:"\u09B2\u0997",alternatives:["\u09B0\u09C7\u0995\u09B0\u09CD\u09A1"],normalized:"log"},show:{primary:"\u09A6\u09C7\u0996\u09BE\u09A8",alternatives:["\u09A6\u09C7\u0996\u09BE\u0993"],normalized:"show"},hide:{primary:"\u09B2\u09C1\u0995\u09BE\u09A8",alternatives:["\u09B2\u09C1\u0995\u09BE\u0993"],normalized:"hide"},transition:{primary:"\u09B8\u0982\u0995\u09CD\u09B0\u09AE\u09A3",alternatives:[],normalized:"transition"},on:{primary:"\u09A4\u09C7",alternatives:["\u098F"],normalized:"on"},trigger:{primary:"\u099F\u09CD\u09B0\u09BF\u0997\u09BE\u09B0",alternatives:[],normalized:"trigger"},send:{primary:"\u09AA\u09BE\u09A0\u09BE\u09A8",alternatives:["\u09AA\u09BE\u09A0\u09BE\u0993"],normalized:"send"},focus:{primary:"\u09AB\u09CB\u0995\u09BE\u09B8",alternatives:["\u09AE\u09A8\u09CB\u09AF\u09CB\u0997"],normalized:"focus"},blur:{primary:"\u099D\u09BE\u09AA\u09B8\u09BE",alternatives:["\u09AB\u09CB\u0995\u09BE\u09B8_\u09B8\u09B0\u09BE\u09A8"],normalized:"blur"},click:{primary:"\u0995\u09CD\u09B2\u09BF\u0995",normalized:"click"},hover:{primary:"\u09B9\u09CB\u09AD\u09BE\u09B0",alternatives:["\u0989\u09AA\u09B0\u09C7_\u09B0\u09BE\u0996\u09C1\u09A8"],normalized:"hover"},submit:{primary:"\u09B8\u09BE\u09AC\u09AE\u09BF\u099F",alternatives:["\u099C\u09AE\u09BE"],normalized:"submit"},input:{primary:"\u0987\u09A8\u09AA\u09C1\u099F",alternatives:["\u09AA\u09CD\u09B0\u09AC\u09C7\u09B6"],normalized:"input"},change:{primary:"\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8",normalized:"change"},go:{primary:"\u09AF\u09BE\u09A8",alternatives:["\u09AF\u09BE\u0993"],normalized:"go"},wait:{primary:"\u0985\u09AA\u09C7\u0995\u09CD\u09B7\u09BE",normalized:"wait"},fetch:{primary:"\u0986\u09A8\u09C1\u09A8",alternatives:[],normalized:"fetch"},settle:{primary:"\u09B8\u09CD\u09A5\u09BF\u09B0",alternatives:[],normalized:"settle"},if:{primary:"\u09AF\u09A6\u09BF",alternatives:[],normalized:"if"},when:{primary:"\u09AF\u0996\u09A8",normalized:"when"},where:{primary:"\u0995\u09CB\u09A5\u09BE\u09AF\u09BC",normalized:"where"},else:{primary:"\u09A8\u09A4\u09C1\u09AC\u09BE",alternatives:["\u09A8\u09BE \u09B9\u09B2\u09C7"],normalized:"else"},repeat:{primary:"\u09AA\u09C1\u09A8\u09B0\u09BE\u09AC\u09C3\u09A4\u09CD\u09A4\u09BF",alternatives:["\u09AC\u09BE\u09B0 \u09AC\u09BE\u09B0"],normalized:"repeat"},for:{primary:"\u099C\u09A8\u09CD\u09AF",alternatives:[],normalized:"for"},while:{primary:"\u09AF\u09A4\u0995\u09CD\u09B7\u09A3",alternatives:[],normalized:"while"},continue:{primary:"\u099A\u09BE\u09B2\u09BF\u09AF\u09BC\u09C7 \u09AF\u09BE\u09A8",alternatives:[],normalized:"continue"},halt:{primary:"\u09A5\u09BE\u09AE\u09C1\u09A8",alternatives:["\u09A5\u09BE\u09AE\u09BE\u0993"],normalized:"halt"},throw:{primary:"\u09A8\u09BF\u0995\u09CD\u09B7\u09C7\u09AA",alternatives:["\u099B\u09C1\u0981\u09A1\u09BC\u09C7 \u09A6\u09BF\u09A8"],normalized:"throw"},call:{primary:"\u0995\u09B2",alternatives:["\u09A1\u09BE\u0995\u09C1\u09A8"],normalized:"call"},return:{primary:"\u09AB\u09BF\u09B0\u09C1\u09A8",alternatives:["\u09AB\u09C7\u09B0\u09A4 \u09A6\u09BF\u09A8"],normalized:"return"},then:{primary:"\u09A4\u09BE\u09B0\u09AA\u09B0",alternatives:["\u09A4\u0996\u09A8"],normalized:"then"},and:{primary:"\u098F\u09AC\u0982",alternatives:[],normalized:"and"},end:{primary:"\u09B6\u09C7\u09B7",alternatives:["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"],normalized:"end"},js:{primary:"\u099C\u09C7\u098F\u09B8",alternatives:["js"],normalized:"js"},async:{primary:"\u0985\u09CD\u09AF\u09BE\u09B8\u09BF\u0999\u09CD\u0995",alternatives:[],normalized:"async"},tell:{primary:"\u09AC\u09B2\u09C1\u09A8",alternatives:["\u09AC\u09B2"],normalized:"tell"},default:{primary:"\u09A1\u09BF\u09AB\u09B2\u09CD\u099F",alternatives:[],normalized:"default"},init:{primary:"\u09B6\u09C1\u09B0\u09C1",alternatives:[],normalized:"init"},behavior:{primary:"\u0986\u099A\u09B0\u09A3",alternatives:[],normalized:"behavior"},install:{primary:"\u0987\u09A8\u09B8\u09CD\u099F\u09B2",alternatives:[],normalized:"install"},measure:{primary:"\u09AE\u09BE\u09AA\u09C1\u09A8",alternatives:[],normalized:"measure"},beep:{primary:"\u09AC\u09C0\u09AA",alternatives:[],normalized:"beep"},break:{primary:"\u09AD\u09BE\u0999\u09C1\u09A8",alternatives:[],normalized:"break"},copy:{primary:"\u0995\u09AA\u09BF",alternatives:[],normalized:"copy"},exit:{primary:"\u09AC\u09C7\u09B0",alternatives:[],normalized:"exit"},pick:{primary:"\u09AC\u09BE\u099B\u09C1\u09A8",alternatives:[],normalized:"pick"},render:{primary:"\u09B0\u09C7\u09A8\u09CD\u09A1\u09BE\u09B0",alternatives:[],normalized:"render"},into:{primary:"\u09AD\u09BF\u09A4\u09B0\u09C7",normalized:"into"},before:{primary:"\u0986\u0997\u09C7",alternatives:[],normalized:"before"},after:{primary:"\u09AA\u09B0\u09C7",alternatives:[],normalized:"after"},until:{primary:"\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4",alternatives:[],normalized:"until"},event:{primary:"\u0998\u099F\u09A8\u09BE",alternatives:[],normalized:"event"},from:{primary:"\u09A5\u09C7\u0995\u09C7",normalized:"from"}},tokenization:{particles:["\u0995\u09C7","\u09A4\u09C7","\u09A5\u09C7\u0995\u09C7","\u09B0","\u098F\u09B0","\u09A6\u09BF\u09AF\u09BC\u09C7","\u099C\u09A8\u09CD\u09AF","\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"\u09A4\u09C7",alternatives:["\u098F","\u09AF\u0996\u09A8"],normalized:"on"},sourceMarker:{primary:"\u09A5\u09C7\u0995\u09C7",position:"after"},eventMarker:{primary:"\u09A4\u09C7",alternatives:["\u098F"],position:"after"},temporalMarkers:["\u09AF\u0996\u09A8","\u09AF\u0996\u09A8\u0987"]}},Br=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Pr=class{constructor(r=Br){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Nr="()[]{},:;",Or=class{constructor(r=Nr){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function _r(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var Lr=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=_r(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Ir=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],o=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function Mr(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var Dr=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=Mr(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},$r=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Ke(r){let e=r.charCodeAt(0);return e>=2432&&e<=2559}var zr=class{constructor(){this.name="bengali-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Ke(r[e])}extract(r,e){if(!this.context)throw new Error("BengaliKeywordExtractor: context not set");let t=e,n="",i=e;for(;i<r.length&&Ke(r[i]);)n+=r[i],i++;if(!n)return null;let o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0,a;if(!o&&this.context.normalizer){let u=this.context.normalizer.normalize(n);if(u.stem!==n&&u.confidence>=.7){let l=this.context.lookupKeyword(u.stem);l&&(a=l.normalized);}}return {value:n,length:i-t,metadata:{normalized:s||a}}}},Ge=new Map([["\u0995\u09C7",{role:"patient",confidence:.95}],["\u09A4\u09C7",{role:"destination",confidence:.9}],["\u098F",{role:"event",confidence:.85}],["\u09A5\u09C7\u0995\u09C7",{role:"source",confidence:.95}],["\u09B0",{role:"possessive",confidence:.95}],["\u098F\u09B0",{role:"possessive",confidence:.95}],["\u09A6\u09BF\u09AF\u09BC\u09C7",{role:"instrument",confidence:.9}],["\u099C\u09A8\u09CD\u09AF",{role:"purpose",confidence:.9}],["\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4",{role:"until",confidence:.9}],["\u09AE\u09A7\u09CD\u09AF\u09C7",{role:"location",confidence:.85}]]),Fr=class{constructor(){this.name="bengali-particle";}setContext(r){this._context=r,this._context;}canExtract(r,e){let t="",n=e;for(;n<r.length&&this.isBengali(r[n]);)t+=r[n],n++;return Ge.has(t)}extract(r,e){let t="",n=e;for(;n<r.length&&this.isBengali(r[n]);)t+=r[n],n++;let i=Ge.get(t);return i?{value:t,length:t.length,metadata:{role:i.role,confidence:i.confidence,variant:t}}:null}isBengali(r){let e=r.charCodeAt(0);return e>=2432&&e<=2559}};function Vr(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function qr(r){let e=r.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Wr=class{constructor(){this.name="ascii-identifier";}setContext(r){this.context=r;}canExtract(r,e){return Vr(r[e])}extract(r,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let t=e,n="",i=e;for(;i<r.length&&qr(r[i]);)n+=r[i],i++;if(!n)return null;let o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0;return {value:n,length:i-t,metadata:{normalized:s}}}};function jr(){return [new Dr,new Ir,new $r,new Lr]}var Ur=new Set(["\u0995\u09C7","\u09A4\u09C7","\u09A5\u09C7\u0995\u09C7","\u09B0","\u098F\u09B0","\u09A6\u09BF\u09AF\u09BC\u09C7","\u099C\u09A8\u09CD\u09AF","\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4","\u098F","\u09AE\u09A7\u09CD\u09AF\u09C7"]),Kr=[{native:"\u09B8\u09A4\u09CD\u09AF",normalized:"true"},{native:"\u09AE\u09BF\u09A5\u09CD\u09AF\u09BE",normalized:"false"},{native:"\u09B6\u09C2\u09A8\u09CD\u09AF",normalized:"null"},{native:"\u0985\u09A8\u09BF\u09B0\u09CD\u09A7\u09BE\u09B0\u09BF\u09A4",normalized:"undefined"},{native:"\u09AA\u09CD\u09B0\u09A5\u09AE",normalized:"first"},{native:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",normalized:"next"},{native:"\u0986\u0997\u09C7\u09B0",normalized:"previous"},{native:"\u09A8\u09BF\u0995\u099F\u09A4\u09AE",normalized:"closest"},{native:"\u09AE\u09C2\u09B2",normalized:"parent"},{native:"\u0995\u09CD\u09B2\u09BF\u0995",normalized:"click"},{native:"\u099C\u09AE\u09BE",normalized:"submit"},{native:"\u0987\u09A8\u09AA\u09C1\u099F",normalized:"input"},{native:"\u09B2\u09CB\u09A1",normalized:"load"},{native:"\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2",normalized:"scroll"},{native:"\u0995\u09C7",normalized:"to"},{native:"\u09B8\u09BE\u09A5\u09C7",normalized:"with"}],Gr=class extends se{constructor(){super(),this.language="bn",this.direction="ltr",this.initializeKeywordsFromProfile(He,Kr),this.setNormalizer(Rr),this.registerExtractors(jr()),this.registerExtractor(new ie),this.registerExtractor(new oe),this.registerExtractor(new Fr),this.registerExtractor(new zr),this.registerExtractor(new Wr),this.registerExtractor(new Pr),this.registerExtractor(new Or);}classifyToken(r){return Ur.has(r)?"particle":this.isKeyword(r)?"keyword":r.startsWith("/")||r.startsWith("./")||r.startsWith("../")||r.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":(r.startsWith(":"),"identifier")}},Hr=new Gr;kr("bn",Hr,He);var Yr=Object.defineProperty,Xr=Object.getOwnPropertyNames,at=(r,e)=>function(){return r&&(e=(0, r[Xr(r)[0]])(r=0)),e},Jr=(r,e)=>{for(var t in e)Yr(r,t,{get:e[t],enumerable:true});};function Ye(r,e){return r.replace(/\{(\w+)\}/g,(t,n)=>String(e[n]??`{${n}}`))}function T(r,e,t={},n){let i=ut[r],o=Ye(i,t),s=lt[r],a=s?Ye(s,t):void 0;return {code:r,message:o,severity:e,...n&&{role:n},...a&&{suggestion:a}}}var h,ut,lt,Qr=at({"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"},ut={[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."},lt={[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."};}}),ct={};Jr(ct,{SchemaErrorCodes:()=>h,formatValidationResults:()=>sn,getValidationStats:()=>an,validateAllKeywordCollisions:()=>ln,validateAllSchemas:()=>on,validateCommandSchema:()=>dt,validateKeywordCollisions:()=>pt,validateRoleValues:()=>un});function Zr(r,e){return {action:r,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 dt(r){let e=[];for(let n of r.roles)n.expectedTypes.includes("literal")&&n.expectedTypes.includes("selector")&&(n.role==="patient"&&we.has(r.action)?e.push(T(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:n.role,command:r.action},n.role)):e.push(T(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:n.role},n.role))),n.expectedTypes.length>3&&!we.has(r.action)&&e.push(T(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:n.role,count:n.expectedTypes.length},n.role));for(let n of r.roles)n.selectorKinds&&n.selectorKinds.length>0&&(n.expectedTypes.includes("selector")||e.push(T(h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:n.role},n.role)));switch(r.action){case "transition":en(r,e);break;case "on":tn(r,e);break;case "if":case "unless":rn(r,e);break;case "repeat":case "for":case "while":nn(r,e);break}return r.roles.filter(n=>n.required).length===0&&(ft.has(r.action)?e.push(T(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):e.push(T(h.NO_REQUIRED_ROLES,"warning",{}))),Zr(r.action,e)}function en(r,e){let t=r.roles.find(i=>i.role==="patient"),n=r.roles.find(i=>i.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(T(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!n&&e.push(T(h.TRANSITION_MISSING_GOAL,"error",{}));}function tn(r,e){let t=r.roles.find(n=>n.role==="event");t||e.push(T(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(T(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function rn(r,e){let t=r.roles.find(n=>n.role==="condition");t||e.push(T(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(T(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function nn(r,e){r.action==="for"?r.roles.find(n=>n.role==="source")||e.push(T(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(n=>n.role==="condition")||e.push(T(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function on(r,e={}){let t=new Map,{includeNotes:n=false}=e;for(let[i,o]of Object.entries(r)){let s=dt(o),a=s.items.some(l=>l.severity==="warning"||l.severity==="error"),u=n&&s.items.some(l=>l.severity==="note");(a||u)&&t.set(i,s);}return t}function sn(r,e={}){let t=[],{showNotes:n=false,showCodes:i=true}=e;for(let[o,s]of r){let a=s.items.filter(c=>c.severity==="error"),u=s.items.filter(c=>c.severity==="warning"),l=s.items.filter(c=>c.severity==="note");if(a.length>0){t.push(` \u274C ${o}:`);for(let c of a){let d=i?` [${c.code}]`:"";t.push(` ERROR${d}: ${c.message}`),c.suggestion&&t.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(u.length>0){t.push(` \u26A0\uFE0F ${o}:`);for(let c of u){let d=i?` [${c.code}]`:"";t.push(` ${d?`${c.code}: `:""}${c.message}`),c.suggestion&&t.push(` \u{1F4A1} ${c.suggestion}`);}}if(n&&l.length>0){t.push(` \u2139\uFE0F ${o}:`);for(let c of l){let d=i?` [${c.code}]`:"";t.push(` ${d?`${c.code}: `:""}${c.message}`);}}}return t.join(`
2
+ `)}function an(r){let e=0,t=0,n=0,i={};for(let o of r.values())for(let s of o.items)s.severity==="error"?e++:s.severity==="warning"?t++:s.severity==="note"&&n++,i[s.code]=(i[s.code]||0)+1;return {totalCommands:r.size,errors:e,warnings:t,notes:n,byCode:i}}function un(r,e){let t=[];for(let n of e){let i=r.roles.find(o=>o.role===n.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(n.type)&&(i.expectedTypes.includes("expression")||t.push({level:"error",role:n.role,message:`${r.action}.${n.role} expects type [${i.expectedTypes.join(", ")}], got '${n.type}'`,code:h.VALUE_TYPE_MISMATCH})),n.type==="selector"&&n.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(n.selectorKind)||t.push({level:"error",role:n.role,message:`${r.action}.${n.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${n.selectorKind}'`,code:h.SELECTOR_KIND_MISMATCH})));}return t}function pt(r){let e=[];if(!r.keywords)return {language:r.code,collisions:e};let t=new Map;for(let[i,o]of Object.entries(r.keywords)){if(!o||!o.primary)continue;let s=t.get(o.primary)||[];if(s.push({command:i,isPrimary:true}),t.set(o.primary,s),o.alternatives)for(let a of o.alternatives){let u=t.get(a)||[];u.push({command:i,isPrimary:false}),t.set(a,u);}}for(let[i,o]of t){let s=[...new Set(o.map(l=>l.command))];if(s.length<=1)continue;let a=o.filter(l=>l.isPrimary).length,u;a>=2?u="primary-primary":a===1?u="primary-alternative":u="alternative-alternative",e.push({keyword:i,commands:s.sort(),type:u});}let n={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,o)=>n[i.type]-n[o.type]),{language:r.code,collisions:e}}function ln(r){let e=[];for(let[,t]of Object.entries(r)){let n=pt(t);n.collisions.length>0&&e.push(n);}return e.sort((t,n)=>t.language.localeCompare(n.language))}var we,ft,cn=at({"src/generators/schema-validator.ts"(){Qr(),we=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),ft=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function J(r){let e="complex";return r.startsWith("#")&&!r.includes(" ")?e="id":r.startsWith(".")&&!r.includes(" ")?e="class":r.startsWith("[")&&r.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(r)&&(e="element"),{type:"selector",value:r,selectorKind:e}}function w(r,e){let t={type:"literal",value:r};return e!==void 0?{type:"literal",value:r,dataType:e}:t}function Xe(r){return Me(r)}function L(r){return {type:"reference",value:r}}function be(r,e){return {type:"property-path",object:r,property:e}}function le(r,e,t){let n={kind:"command",action:r,roles:new Map(Object.entries(e))};return t!==void 0?{...n,metadata:t}:n}function Je(r,e,t,n,i,o){let s=new Map;s.set("event",r);let a={kind:"event-handler",action:"on",roles:s,body:e};return t!==void 0&&(a.eventModifiers=t),n!==void 0&&(a.metadata=n),a}function Qe(r,e="then",t){let n={kind:"compound",action:"compound",roles:new Map,statements:r,chainType:e};return t!==void 0&&(n.metadata=t),n}function Ze(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function dn(r,e){return r.possessive?.keywords?.[e]}var V=new Map,q=new Map,ce=new Map,Ce=null;function mt(r,e){let t={...r};for(let n of Object.keys(e)){let i=e[n],o=r[n];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof o=="object"&&o!==null&&!Array.isArray(o)?t[n]=mt(o,i):t[n]=i);}return t}function pn(r,e){return mt(r,e)}function Te(r){if(!r.extends)return r;let e=q.get(r.extends);if(!e)return console.warn(`[Registry] Profile '${r.code}' extends '${r.extends}' but base is not registered. Make sure to import the base language before the variant.`),r;let t=Te(e);return pn(t,r)}function ht(r){Ce=r;}var et=new Map;function W(r){return r.split("-")[0]}function j(r){return r.includes("-")}function fn(r){let e=V.get(r);if(!e&&j(r)){let t=W(r);e=V.get(t);}if(!e){let t=Array.from(V.keys()).join(", ");throw new Error(`Language '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return e}function mn(r){let e=q.get(r);if(!e&&j(r)){let t=W(r);e=q.get(t);}if(!e){let t=Array.from(q.keys()).join(", ");throw new Error(`Language profile '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return Te(e)}function hn(r){let e=V.get(r);return !e&&j(r)&&(e=V.get(W(r))),e}function I(r){let e=q.get(r);return !e&&j(r)&&(e=q.get(W(r))),e?Te(e):void 0}function yt(){return Array.from(V.keys())}function yn(r,e){return fn(e).tokenize(r)}function F(r){let e=ce.get(r);if(!e&&j(r)&&(e=ce.get(W(r))),e)return e;let t=et.get(r);if(!t&&j(r)&&(t=et.get(W(r))),t)return ce.set(r,t),t;if(!Ce)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let n=mn(r),i=Ce(n);return ce.set(r,i),i}var Se=.8,gn=.6,En=.15,bn=.5,tt=.15,rt=.1,nt=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"]),Sn={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"]},An=class{calculate(r){return this.calculateWithBreakdown(r).final}calculateWithBreakdown(r){let e=this.scoreRoleCoverage(r),t=this.scoreStemPenalty(r),n=this.scoreLanguageBoost(r),i=this.scoreLanguageAdjustment(r),o=e;return o=Math.max(bn,o+t),o=Math.min(1,o+n),o=Math.max(0,Math.min(1,o+i)),{roleCoverage:e,stemPenalty:t,languageBoost:n,languageAdjustment:i,final:o}}scoreRoleCoverage(r){let{pattern:e,captured:t}=r,n=0,i=0,o=s=>e.extraction?.[s]?.default!==void 0;for(let s of e.template.tokens)if(s.type==="role")i+=1,t.has(s.role)&&(n+=1);else if(s.type==="group")for(let a of s.tokens)a.type==="role"&&(i+=Se,t.has(a.role)?n+=Se:o(a.role)&&(n+=Se*gn));return i>0?n/i:1}scoreStemPenalty(r){let{stemMatchCount:e,totalKeywordMatches:t}=r;return e<=0||t<=0?0:-(e/t)*En}scoreLanguageBoost(r){let{pattern:e}=r;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:nt.has(t.value)||t.alternatives?.some(n=>nt.has(n))?tt:0}scoreLanguageAdjustment(r){let{pattern:e,captured:t}=r;if(e.language!=="ar")return 0;let n=0;for(let[i,o]of t.entries()){let s=Sn[i];if(!s||s.length===0)continue;let a="metadata"in o?o.metadata:void 0;a&&typeof a.prepositionValue=="string"&&(s.includes(a.prepositionValue)?n+=.1:n-=.1);}return Math.max(-rt,Math.min(rt,n))}},wn=new An,pe=class X{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??wn;}matchPattern(e,t){let n=e.mark(),i=new Map;if(this.currentProfile=I(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,i))return e.reset(n),null;let s=this.confidenceModel.calculate({pattern:t,captured:i,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-n.position,confidence:s}}matchBest(e,t){this.matchCache.clear();let n=[],i=e.position();for(let s of t){let a=e.mark(),u=`${i}:${s.id}`,l;this.matchCache.has(u)?l=this.matchCache.get(u):(l=this.matchPattern(e,s),this.matchCache.set(u,l)),l&&n.push(l),e.reset(a);}if(n.length===0)return null;n.sort((s,a)=>{let u=a.pattern.priority-s.pattern.priority;return u!==0?u:a.confidence-s.confidence});let o=n[0];return this.matchPattern(e,o.pattern),o}matchTokenSequence(e,t,n){let i=t[0],o=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();for(let s of t)if(!this.matchPatternToken(e,s,n)){if(this.isOptional(s))continue;return false}return true}matchPatternToken(e,t,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,n);case "group":return this.matchGroupToken(e,t,n);default:return false}}matchLiteralToken(e,t){let n=e.peek();if(!n)return false;let i=this.getMatchType(n,t.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let o of t.alternatives){let s=this.getMatchType(n,o);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,n){this.skipNoiseWords(e);let i=e.peek();if(!i)return t.optional||false;let o=this.tryMatchPossessiveExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(o.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,o),true);let s=this.tryMatchMethodCallExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(s.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,s),true);let a=this.tryMatchPossessiveSelectorExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(a.type,t.expectedTypes)?t.optional||false:(n.set(t.role,a),true);let u=this.tryMatchPropertyAccessExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(u.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,u),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(l.type,t.expectedTypes)?t.optional||false:(n.set(t.role,l),true);let c=this.tokenToSemanticValue(i);return !c||t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(c.type)?t.optional||false:(n.set(t.role,c),e.advance(),true)}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let n=(t.normalized||t.value).toLowerCase(),i=dn(this.currentProfile,n);if(!i)return null;let o=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(o),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let a=s.value;s.kind==="selector"&&a.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a)&&(a=a.substring(1));let u=a;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)u+=e.peek().value,e.advance();let l=e.peek();return l?.kind==="literal"&&l.value.startsWith("(")&&(u+=l.value,e.advance()),be(L(i),u)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=e.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return e.reset(n),null;e.advance();let a=[];for(;!e.isAtEnd()&&a.length<X.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}a.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${o.value}(${a.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=`${t.value}.${o.value}`,a=1;for(;!e.isAtEnd()&&a<X.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),s+=`.${c.value}`,a++;}let u=e.peek();if(u&&u.kind==="punctuation"&&u.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<X.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(c===0){e.advance();break}c--;}if(p.kind==="punctuation"&&p.value==="("&&c++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${s}(${l.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let o=e.peek();return !o||o.kind!=="selector"&&o.kind!=="identifier"?(e.reset(n),null):(e.advance(),be(J(t.value),o.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let o=e.peek(1);o&&o.kind,e.advance();let s=i.value.slice(1);return be(J(t.value),s)}matchGroupToken(e,t,n){let i=e.mark(),o=new Set(n.keys());if(!this.matchTokenSequence(e,t.tokens,n)){e.reset(i);for(let a of n.keys())o.has(a)||n.delete(a);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 J(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return Xe(t)?L(t):w(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return L(e.value);let n=e.value.toLowerCase();return Xe(n)?L(n):{type:"expression",raw:e.value};case "url":return w(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 w(i,"string")}if(e==="true")return w(true,"boolean");if(e==="false")return w(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let i=parseFloat(t[1]);return t[2]?w(e,"duration"):w(i,"number")}let n=parseFloat(e);return isNaN(n)?w(e,"string"):w(n,"number")}applyExtractionRules(e,t){for(let[n,i]of Object.entries(e.extraction))t.has(n)||(i.value!==void 0?t.set(n,{type:"literal",value:i.value}):i.default&&t.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let n=t.value.toLowerCase();if(X.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let o=e.peek();if(o&&(o.kind==="selector"||o.kind==="identifier"))return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let t={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let o=i.metadata;if(!o)break;switch(n=true,o.modifierName){case "once":t.once=true;break;case "debounce":typeof o.value=="number"&&(t.debounce=o.value);break;case "throttle":typeof o.value=="number"&&(t.throttle=o.value);break;case "queue":(o.value==="first"||o.value==="last"||o.value==="all"||o.value==="none")&&(t.queue=o.value);break}e.advance();}return n?t:void 0}};pe.MAX_PROPERTY_DEPTH=10;pe.MAX_METHOD_ARGS=20;pe.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var vt=pe,z=new vt;function Cn(r){return hn(r)}function Ae(r,e){return yn(r,e)}function gt(){return yt()}var kn={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 xn={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)"}},Rn={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"}},Bn={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"}},Pn={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"}},Nn={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>"}},On={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}]},_n={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}]},Ln={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}]},In={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}]},Mn={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}]},Dn={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}]},$n={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"}}]},zn={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"}}]},Fn={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"}}]},Vn={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"}}]},qn={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}]},Wn={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}]},jn={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}]},Un={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}]},Kn={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}]},Gn={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}]},Hn={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}]},Yn={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"}}]},Xn={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}]},Jn={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}]},Qn={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Zn={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"'},ei={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"}}]},ti={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}]},ri={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},ni={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:""}}]},ii={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}]},oi={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"}}]},si={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}]},ai={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}]},ui={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}]},li={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}]},ci={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}]},di={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},pi={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:""}}]},fi={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"}}]},mi={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},hi={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}]},yi={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}]},vi={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"}}]},gi={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"}}]},Ei={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"}}]},bi={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}]},Si={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ai={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}]},wi={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Ci={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}]},ki={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:xn,add:Rn,remove:Bn,put:Pn,set:Nn,show:On,hide:_n,on:Ln,trigger:In,wait:Mn,fetch:Dn,increment:$n,decrement:zn,append:Fn,prepend:Vn,log:qn,get:Wn,take:jn,make:Un,halt:Kn,settle:Gn,throw:Hn,send:Yn,if:Xn,unless:Jn,else:Qn,repeat:Zn,for:ei,while:ti,continue:ri,go:ni,transition:ii,clone:oi,focus:si,blur:ai,call:ui,return:li,js:ci,async:di,tell:pi,default:fi,init:mi,behavior:hi,install:yi,measure:vi,swap:gi,morph:Ei,beep:bi,break:Si,copy:Ai,exit:wi,pick:Ci,render:ki,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Ti(){return Object.values(Et).filter(r=>r.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(cn(),ct)).then(({validateAllSchemas:r,formatValidationResults:e})=>{let t=r(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(r=>{console.debug("Schema validation skipped:",r);});var it=class extends Error{constructor(r,e,t,n){super(r),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=n;}};function R(r,e,t){return {message:r,severity:e,source:"semantic-parser",...t&&{code:t}}}function de(r,e){return e.length===0?r:{...r,diagnostics:e}}var U=class P{parse(e,t){let{modifiers:n,remainingInput:i}=this.extractStandaloneModifiers(e,t),o=i||e,s=[],a=Ae(o,t),u=F(t);if(u.length===0)throw new it(`No patterns available for language: ${t}`,t,o,[R(`No patterns registered for language '${t}'`,"error","no-patterns")]);let l=[...u].sort((y,g)=>g.priority-y.priority),c=l.filter(y=>y.command==="on"),d=z.matchBest(a,c);if(d){s.push(R(`event pattern matched: ${d.pattern.id} (confidence: ${d.confidence.toFixed(2)})`,"info","pattern-match"));let y=this.buildEventHandler(d,a,t),g=n?this.applyModifiers(y,n):y;return de(g,s)}s.push(R(`event patterns: ${c.length} tried, no match`,"info","stage-event"));let p=l.filter(y=>y.command!=="on"),f=z.matchBest(a,p);if(f)return s.push(R(`command pattern matched: ${f.pattern.id} (confidence: ${f.confidence.toFixed(2)})`,"info","pattern-match")),de(this.buildCommand(f,t),s);s.push(R(`command patterns: ${p.length} tried, no match`,"info","stage-command"));let m=this.trySOVEventExtraction(o,t,l);if(m){s.push(R("SOV event extraction succeeded","info","stage-sov"));let y=n?this.applyModifiers(m,n):m;return de(y,s)}s.push(R("SOV event extraction: no event keyword found","info","stage-sov"));let v=this.tryCompoundCommandParsing(a,p,t);if(v)return s.push(R("compound command parsing succeeded","info","stage-compound")),de(v,s);throw s.push(R("compound parsing: no then-keywords or no command matches","info","stage-compound")),s.push(R(`all parse stages exhausted for "${o}"`,"error","parse-failed")),new it(`Could not parse input in ${t}: ${o}`,t,o,s)}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return gt()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let n={};for(let[i,o]of e.captured)n[i]=o;return le(e.pattern.command,n,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,n){if(!e)throw new Error("No match to build event handler from");let i=e.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");let o=z.extractEventModifiers(t),s=this.extractOrConjunctionEvents(t,n),a=i;s.length>0&&i.type==="literal"&&(a={type:"literal",value:[String(i.value),...s.map(d=>String("value"in d?d.value:""))].join(" or ")});let u,l=e.captured.get("action");if(l&&l.type==="literal"){let c=l.value,d={};for(let[m,v]of e.captured)m!=="event"&&m!=="action"&&m!=="continues"&&(d[m]=v);let p=le(c,d,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence}),f=e.captured.get("continues");if(f&&f.type==="literal"&&f.value==="then"){let m=F(n).filter(g=>g.command!=="on").sort((g,b)=>b.priority-g.priority),v=F(n).filter(g=>g.id.startsWith("grammar-")&&g.id.includes("-continuation")).sort((g,b)=>b.priority-g.priority),y=this.parseBodyWithGrammarPatterns(t,m,v,n);y.length>0?u=[p,...y]:u=[p];}else u=[p];}else {let c=F(n).filter(d=>d.command!=="on").sort((d,p)=>p.priority-d.priority);u=this.parseBodyWithClauses(t,c,n);}return Je(a,u,o,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,n){let i=[],o=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;let a=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,n),u=s.kind==="keyword"&&this.isEndKeyword(s.value,n);if(a){if(o.length>0){let l=this.parseClause(o,t,n);i.push(...l),o.length=0;}e.advance();continue}if(u){if(o.length>0){let l=this.parseClause(o,t,n);i.push(...l);}e.advance();break}o.push(s),e.advance();}if(o.length>0){let s=this.parseClause(o,t,n);i.push(...s);}return i.length>1?[Qe(i,"then",{sourceLanguage:n})]:i}parseClause(e,t,n){if(e.length===0)return [];let i=new Y(e,n),o=[];for(;!i.isAtEnd();){let s=z.matchBest(i,t);s?o.push(this.buildCommand(s,n)):i.advance();}if(o.length===0){let s=this.parseSOVClauseByVerbAnchoring(e,n);if(s.length>0)return s}return o}static buildVerbLookup(e){let t=new Map;for(let[n,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(n)&&(t.set(i.primary.toLowerCase(),n),i.alternatives))for(let o of i.alternatives)t.set(o.toLowerCase(),n);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[n,i]of Object.entries(e.roleMarkers))if(i&&(t.set(i.primary,n),i.alternatives))for(let o of i.alternatives)t.has(o)||t.set(o,n);return t}parseSOVClauseByVerbAnchoring(e,t){let n=I(t);if(!n||n.wordOrder!=="SOV")return [];let i=P.buildVerbLookup(n),o=P.buildMarkerToRoleLookup(n),s=[],a=0;for(;a<e.length;){let u=-1,l="";for(let m=a;m<e.length;m++){let v=e[m],y=i.get(v.value.toLowerCase()),g=v.normalized?i.get(v.normalized.toLowerCase()):void 0,b=y||g;if(b){u=m,l=b;break}}if(u===-1)break;let c=e.slice(a,u),d=e.length;for(let m=u+1;m<e.length;m++){let v=e[m];if(v.kind==="conjunction"||this.isThenKeyword(v.value,t)){d=m;break}if(m>u+1&&(i.get(v.value.toLowerCase())||(v.normalized?i.get(v.normalized.toLowerCase()):void 0))){d=m;break}}let p=e.slice(u+1,d),f=this.extractRolesFromMarkedTokens(c,p,o,l,t);if(s.push(le(l,f,{sourceLanguage:t,confidence:.7})),a=d,a<e.length){let m=e[a];(m.kind==="conjunction"||this.isThenKeyword(m.value,t))&&a++;}}return s}extractRolesFromMarkedTokens(e,t,n,i,o){let s={},a=u=>{let l=[];for(let c of u){let d=n.get(c.value);if(d&&c.kind==="particle"&&l.length>0){let p=this.tokensToSemanticValue(l);if(p){let f=this.mapRoleForCommand(d,i,s);f&&(s[f]=p);}l=[];}else l.push(c);}if(l.length>0){let c=this.tokensToSemanticValue(l);c&&(s.patient?s.destination||(s.destination=c):s.patient=c);}};return a(e),a(t),s}mapRoleForCommand(e,t,n){return n[e]?e==="patient"&&!n.destination?"destination":e==="destination"&&!n.patient?"patient":e==="source"&&!n.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let t=e.filter(o=>o.kind!=="whitespace");if(t.length===0)return null;if(t.length===1)return this.tokenToSemanticValue(t[0]);let n=t.map(o=>o.value).join(""),i=t[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?J(n):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?w(n):i.kind==="reference"?L(n):w(n)}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return J(t);if(t.startsWith('"')||t.startsWith("'"))return w(t);if(/^-?\d+(\.\d+)?$/.test(t))return w(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return w(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return w(false);let n=e.normalized?.toLowerCase();return n==="me"||n==="it"||n==="you"||n==="result"||n==="body"?L(n):e.kind==="reference"?L(e.normalized||"me"):w(t)}parseBodyWithGrammarPatterns(e,t,n,i){let o=[];for(;!e.isAtEnd();){let s=e.peek();if(s&&this.isThenKeyword(s.value,i)){e.advance();continue}if(s&&this.isEndKeyword(s.value,i)){e.advance();break}let a=false;if(n.length>0){let u=z.matchBest(e,n);if(u){let l=u.pattern.command,c={};for(let[f,m]of u.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(c[f]=m);let d=le(l,c,{sourceLanguage:i,patternId:u.pattern.id});o.push(d),a=true;let p=u.captured.get("continues");if(p&&p.type==="literal"&&p.value==="then")continue}}if(!a){let u=z.matchBest(e,t);u&&(o.push(this.buildCommand(u,i)),a=true);}a||e.advance();}return o}tryCompoundCommandParsing(e,t,n){let i=e.tokens;if(!i.some(u=>u.kind==="conjunction"||u.kind==="keyword"&&this.isThenKeyword(u.value,n)))return null;let s=new Y(i,n),a=this.parseBodyWithClauses(s,t,n);return a.length===0?null:a.length===1?a[0]:Qe(a,"then",{sourceLanguage:n,confidence:.65})}trySOVEventExtraction(e,t,n){let i=P.SOV_EVENT_MARKERS[t];if(!i)return null;let s=Ae(e,t).tokens,a=kn[t],u=new Set;if(a)for(let E of Object.keys(a))u.add(E.toLowerCase());let l=P.SOV_SOURCE_MARKERS[t],c=-1,d="",p="",f=1;for(let E=0;E<s.length;E++){let C=s[E],N=C.value.toLowerCase(),O=N,M="",me=N.indexOf("[");me>0&&(O=N.slice(0,me),M=C.value.slice(me));let he=C.normalized?.toLowerCase(),_e=he&&P.KNOWN_EVENTS.has(he),Le=u.has(N)||u.has(O),Ot=P.KNOWN_EVENTS.has(O);if(_e||Le||Ot){let K;if(_e?K=he:Le?K=a?.[N]??a?.[O]??O:K=O,i.size>0){let te=1,ye=s[E+1];ye&&ye.kind==="selector"&&ye.value.startsWith("[")&&(te=2);let re=s[E+te];if(re&&(re.kind==="particle"||re.kind==="keyword")&&i.has(re.value)){c=E,d=K,p=M||(te===2?s[E+1].value:""),f=te+1;break}}else {c=E,d=K,p=M,f=1;break}}}if(c===-1)return null;let m=new Set;for(let E=c;E<c+f;E++)m.add(E);if(l){let E=c+f;if(E<s.length){let C=s[E];(C.kind==="particle"||C.kind==="keyword")&&l.markers.has(C.value)&&m.add(E);}for(let C=0;C<c;C++){let N=s[C],O=N.value.toLowerCase(),M=N.normalized?.toLowerCase();if(l.windowTokens.has(O)||M&&l.windowTokens.has(M)){m.add(C);break}}}let v=s.filter((E,C)=>!m.has(C));if(v.length===0)return null;let y=n.filter(E=>E.command!=="on"),g=new Y(v,t),b=this.parseBodyWithClauses(g,y,t);if(b.length===0)return null;let Oe={sourceLanguage:t,confidence:.75};return p&&(Oe.keyFilter=p),Je({type:"literal",value:d},b,void 0,Oe)}isThenKeyword(e,t){let n={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 (n[t]||n.en).has(e.toLowerCase())}isEndKeyword(e,t){let n={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 (n[t]||n.en).has(e.toLowerCase())}extractStandaloneModifiers(e,t){let i=Ae(e,t).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let s=i[0].value.toLowerCase(),a=P.STANDALONE_MODIFIERS[s];if(!a)return {modifiers:null,remainingInput:null};let u={},l=1;if(a==="once")u.once=true;else {let f=1;if(f<i.length){let m=i[f];(m.kind==="keyword"||m.kind==="particle")&&(f++,l++);}if(f<i.length){let m=i[f];if(m.kind==="literal"){let v=m.value.match(/^(\d+)(ms|s|m)?$/);if(v){let y=parseInt(v[1],10),g=v[2]||"ms";g==="s"?y*=1e3:g==="m"&&(y*=6e4),u[a]=y,l=f+1;}}}u[a]||(u[a]=a==="debounce"?300:100);}let c=i.slice(l);if(c.length===0)return {modifiers:null,remainingInput:null};let d=c[0].position.start,p=e.slice(d);return {modifiers:u,remainingInput:p}}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let n=[];for(;;){let i=e.mark(),o=e.peek();if(!o)break;let s=(o.normalized||o.value).toLowerCase();if(!P.OR_KEYWORDS.has(s)){e.reset(i);break}e.advance();let a=e.peek();if(!a){e.reset(i);break}let u=(a.normalized||a.value).toLowerCase();e.advance(),n.push({type:"literal",value:u});}return n}};U.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);U.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"])};U.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"])}};U.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};U.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 xi=U,Ri=new xi;function xe(r,e){return Ri.parse(r,e)}var ke=class{constructor(r={}){this.cache=new Map,this.config={maxSize:r.maxSize??1e3,ttlMs:r.ttlMs??0,enabled:r.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(r,e){return `${e}:${r}`}isExpired(r){return this.config.ttlMs===0?false:Date.now()-r.createdAt>this.config.ttlMs}evictLRU(){let r=this.cache.keys().next().value;r!==void 0&&(this.cache.delete(r),this.stats.evictions++);}get(r,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(r,e),n=this.cache.get(t);if(!n){this.stats.misses++;return}if(this.isExpired(n)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),n.lastAccessed=Date.now(),this.cache.set(t,n),this.stats.hits++,n.result}set(r,e,t){if(!this.config.enabled||t.confidence===0)return;let n=this.makeKey(r,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(n,{result:t,createdAt:i,lastAccessed:i});}has(r,e){if(!this.config.enabled)return false;let t=this.makeKey(r,e),n=this.cache.get(t);return n?this.isExpired(n)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(r,e){let t=this.makeKey(r,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let r=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:r>0?this.stats.hits/r:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(r){if(r.maxSize!==void 0)for(this.config.maxSize=r.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();r.ttlMs!==void 0&&(this.config.ttlMs=r.ttlMs),r.enabled!==void 0&&(this.config.enabled=r.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},Bi=new ke;var Pi=class{constructor(r={}){this.patternMatcher=new vt,this.languages=new Set(yt()),r.cache===false?this.cache=new ke({enabled:false}):this.cache=r.cache?new ke(r.cache):Bi;}analyze(r,e){if(!this.supportsLanguage(e))return {confidence:0,errors:[`Language '${e}' is not supported for semantic parsing`]};let t=this.cache.get(r,e);if(t)return t;let n=this.analyzeUncached(r,e);return this.cache.set(r,e,n),n}analyzeUncached(r,e){try{try{let s=xe(r,e),a={confidence:s.metadata?.confidence??.8,node:s};return s.kind==="command"?{...a,command:{name:s.action,roles:s.roles}}:a}catch{}let t=Cn(e);if(!t)return {confidence:0,errors:[`No tokenizer available for language '${e}'`]};let n=t.tokenize(r),i=F(e);if(i.length===0)return {confidence:0,errors:[`No patterns available for language '${e}'`]};let o=this.patternMatcher.matchBest(n,i);if(o){let s=this.buildSemanticNode(o);return {confidence:o.confidence,command:{name:o.pattern.command,roles:o.captured},node:s,tokensConsumed:o.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(t){return {confidence:0,errors:[t instanceof Error?t.message:String(t)]}}}supportsLanguage(r){return this.languages.has(r)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(r){this.cache.configure(r);}buildSemanticNode(r){return {kind:"command",action:r.pattern.command,roles:r.captured,metadata:{patternId:r.pattern.id}}}};function bt(r){return new Pi(r)}var Ni=.5;function St(r,e=Ni){return r.confidence>=e&&r.command!==void 0}function At(r,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...r].sort((n,i)=>{let o=n[t]??99,s=i[t]??99;return o-s})}function Oi(r,e){let t=r.markerOverride?.[e.code],n=e.roleMarkers[r.role];if(t!==void 0)return {primary:t,position:n?.position??"before",isOverride:true};if(n&&n.primary){let i={primary:n.primary,position:n.position,isOverride:false};return n.alternatives&&(i.alternatives=n.alternatives),i}return null}function _i(r,e,t,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let c of l)o.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}}let s=e.roleMarkers.destination;s&&o.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}]}),o.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};o.push(l);}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(u),{id:`${r.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${n.primary} {destination?} {patient} ${a?.primary||""} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Li(r,e,t,n,i){let o=[];o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(u);}if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let u=n.primary.split(/\s+/);if(u.length>1)for(let l of u)o.push({type:"literal",value:l});else {let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(a),{id:`${r.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${n.primary} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ii(r,e,t,n,i){let o=[];o.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};o.push(l);}let a=e.roleMarkers.destination;if(a&&(o.push({type:"role",role:"destination",optional:false}),o.push(a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary})),o.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let c of l)o.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(u),{id:`${r.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${s?.primary||""} {destination} ${a?.primary||""} {event} ${n.primary} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Mi(r,e,t,n,i){let o=[];o.push({type:"role",role:"event",optional:false});let s=n.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];s.length>0&&o.push({type:"literal",value:s[0],alternatives:s.slice(1)});let a=e.roleMarkers.destination;a&&o.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}]}),o.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let c=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};o.push(c);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(l),{id:`${r.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${s[0]||""} {patient} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Di(r,e,t,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let a=n.primary.split(/\s+/);if(a.length>1)for(let u of a)o.push({type:"literal",value:u});else {let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(s),{id:`${r.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${n.primary} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function $i(r,e,t,n){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let o=[];o.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&o.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),o.push({type:"literal",value:i[0],alternatives:i.slice(1)}),o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s?.primary){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(u);}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(a),{id:`${r.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(n.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function zi(r,e,t,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let c=n.primary.split(/\s+/);if(c.length>1)for(let d of c)o.push({type:"literal",value:d});else {let d=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(d);}}let a=[...r.roles.filter(c=>c.required)].sort((c,d)=>{let p=c.sovPosition??999,f=d.sovPosition??999;return p-f});for(let c of a){o.push({type:"role",role:c.role,optional:false});let d,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(d=f.primary,p=f.alternatives);}if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(f);}}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(u);let l=a.map(c=>`{${c.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${n.primary} ${l} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(a.map(c=>[c.role,{fromRole:c.role}]))}}}function Fi(r,e,t,n,i){let o=[],a=[...r.roles.filter(m=>m.required)].sort((m,v)=>{let y=m.sovPosition??999,g=v.sovPosition??999;return y-g}),u=a[0];o.push({type:"role",role:u.role,optional:false});let l;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)l=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(l=m.primary);}if(l&&o.push({type:"literal",value:l}),o.push({type:"role",role:"event",optional:false}),n.position==="after"){let m=n.primary.split(/\s+/);if(m.length>1)for(let v of m)o.push({type:"literal",value:v});else {let v=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(v);}}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(c);let d=a[1];o.push({type:"role",role:d.role,optional:false});let p,f;if(d.markerOverride&&d.markerOverride[e.code]!==void 0)p=d.markerOverride[e.code];else {let m=e.roleMarkers[d.role];m&&(p=m.primary,f=m.alternatives);}if(p){let m=f?{type:"literal",value:p,alternatives:f}:{type:"literal",value:p};o.push(m);}return {id:`${r.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${u.role}} {event} ${n.primary} ${t.primary} {${d.role}}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},[u.role]:{fromRole:u.role},[d.role]:{fromRole:d.role}}}}function ot(r,e,t,n,i){let o=[];if(n.position==="before"){let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}o.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(s),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:`${r.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${n.primary} {event} ${t.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Vi(r,e,t,n,i){let o=[],s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;if(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}]}),n.position==="before"){let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}return o.push({type:"role",role:"event",optional:false}),{id:`${r.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${t.primary} {patient} ${a?.primary||""} {destination?} ${n.primary} {event}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function qi(r,e,t,n,i){let o=[],s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(s);let u=[...r.roles.filter(c=>c.required)].sort((c,d)=>{let p=c.svoPosition??999,f=d.svoPosition??999;return p-f});for(let c of u){let d,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(d=f.primary,p=f.alternatives);}if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(f);}o.push({type:"role",role:c.role,optional:false});}if(n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}o.push({type:"role",role:"event",optional:false});let l=u.map(c=>`{${c.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${l} ${n.primary} {event}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(u.map(c=>[c.role,{fromRole:c.role}]))}}}function st(r,e,t,n,i){let o=[];if(n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}o.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(s);let u=[...r.roles.filter(c=>c.required)].sort((c,d)=>{let p=c.svoPosition??999,f=d.svoPosition??999;return p-f});for(let c of u){let d,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(d=f.primary,p=f.alternatives);}if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(f);}o.push({type:"role",role:c.role,optional:false});}let l=u.map(c=>`{${c.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${n.primary} {event} ${t.primary} ${l}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(u.map(c=>[c.role,{fromRole:c.role}]))}}}function Wi(r,e,t,n,i){let o=[],s=e.eventHandler?.negationMarker;if(n.position==="before"){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(l);}o.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(a),o.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&o.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:`${r.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${s?.primary||""} {event} ${t.primary} {patient} ${u?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ji(r,e,t,n){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(o),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:`${r.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var Q={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function wt(r,e,t=Q){let n=`${r.action}-${e.code}-generated`,i=t.basePriority??100,o=e.keywords[r.action];if(!o)throw new Error(`No keyword translation for '${r.action}' in ${e.code}`);let s=Hi(r,e,o),a=kt(r,e),u=Qi(r,e,o);return {id:n,language:e.code,command:r.action,priority:i,template:{format:u,tokens:s},extraction:a}}function Ui(r,e,t=Q){if(r.roles.filter(a=>!a.required).length===0)return null;let i=r.roles.filter(a=>a.required),o={...r,roles:i};return {...wt(o,e,t),id:`${r.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:kt(r,e)}}function Ki(r,e,t=Q){let n=[];if(n.push(wt(r,e,t)),t.generateSimpleVariants){let i=Ui(r,e,t);i&&n.push(i);}return n}function Ct(r,e=Q){let t=[],n=Ti();for(let i of n){if(!r.keywords[i.action])continue;let o=Ki(i,r,e);if(t.push(...o),r.eventHandler?.eventMarker){let s=Gi(i,r,e);t.push(...s);}}return t}function Gi(r,e,t=Q){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let n=[],i=e.eventHandler.eventMarker,o=e.keywords[r.action];if(!o)return [];let a=r.roles.filter(u=>u.required).length===2;if(e.wordOrder==="SOV")if(a)n.push(zi(r,e,o,i,t)),n.push(Fi(r,e,o,i,t));else {n.push(_i(r,e,o,i,t)),n.push(Li(r,e,o,i,t));let u=e.roleMarkers.destination;u&&u.primary!==i.primary&&n.push(Ii(r,e,o,i,t));let l=i.primary.split(/\s+/),c=i.alternatives?.some(p=>!p.includes(" ")&&p.length>1);l.length>1&&c&&n.push(Mi(r,e,o,i,t)),n.push(Di(r,e,o,i,t));let d=$i(r,e,o,t);d&&n.push(d);}else e.wordOrder==="VSO"?a?(n.push(st(r,e,o,i,t)),n.push(qi(r,e,o,i,t))):(n.push(ot(r,e,o,i,t)),n.push(Vi(r,e,o,i,t)),e.eventHandler?.negationMarker&&n.push(Wi(r,e,o,i,t)),e.tokenization?.prefixes&&n.push(ji(r,e,o,t))):a?n.push(st(r,e,o,i,t)):n.push(ot(r,e,o,i,t));return n}function Hi(r,e,t){let n=[],i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},o=Yi(r,e);switch(e.wordOrder){case "SVO":n.push(i),n.push(...o);break;case "SOV":n.push(...o),n.push(i);break;case "VSO":n.push(i),n.push(...o);break;default:n.push(i),n.push(...o);}return n}function Yi(r,e){let t=[],n=At(r.roles,e.wordOrder);for(let i of n){let o=Xi(i,e);i.required?t.push(...o):t.push({type:"group",optional:true,tokens:o});}return t}function Xi(r,e){let t=[],n=r.markerOverride?.[e.code],i=e.roleMarkers[r.role],o={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes};if(n!==void 0)(i?.position??"before")==="before"?(n&&t.push({type:"literal",value:n}),t.push(o)):(t.push(o),n&&t.push({type:"literal",value:n}));else if(i)if(i.position==="before"){if(i.primary){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(s);}t.push(o);}else {t.push(o);let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(s);}else t.push(o);return t}function Ji(r,e){let t={};for(let n of r.roles){let i=n.markerOverride?.[e.code],o=e.roleMarkers[n.role];i!==void 0?t[n.role]=i?{marker:i}:{}:o&&o.primary?t[n.role]=o.alternatives?{marker:o.primary,markerAlternatives:o.alternatives}:{marker:o.primary}:t[n.role]={};}return t}function kt(r,e){let t=Ji(r,e),n={};for(let i of r.roles){let o=t[i.role]||{};!i.required&&i.default?n[i.role]={...o,default:i.default}:n[i.role]=o;}return n}function Qi(r,e,t){let n=[],o=At(r.roles,e.wordOrder).map(s=>{let a=Oi(s,e),u="";return a&&a.primary?a.position==="before"?u=`${a.primary} {${s.role}}`:u=`{${s.role}} ${a.primary}`:u=`{${s.role}}`,s.required?u:`[${u}]`});switch(e.wordOrder){case "SVO":case "VSO":n.push(t.primary,...o);break;case "SOV":n.push(...o,t.primary);break;default:n.push(t.primary,...o);}return n.join(" ")}function fe(r){let e=r.getAttribute("data-lang");if(e)return Re(e);let t=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return Re(t);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?Re(n):null}function Re(r){return r.split("-")[0].toLowerCase()}var Tt={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 ee(r){switch(r.kind){case "event-handler":return Zi(r);case "compound":return eo(r);default:return to(r)}}function Zi(r){let e=["on"],t=r.roles.get("event");t&&e.push(Z(t));let n=r.roles.get("source");if(n&&e.push("from",Z(n)),r.body&&r.body.length>0){let i=r.body.map(ee);e.push(i.join(" then "));}return e.join(" ")}function eo(r){let e=r.chainType==="async"?"async":r.chainType;return r.statements.map(ee).join(` ${e} `)}function to(r){let e=Tt[r.action];if(e){let n=[r.action];for(let[i,o]of e){let s=r.roles.get(i);s&&(i==="destination"&&s.type==="reference"&&s.value==="me"||(o&&n.push(o),n.push(Z(s))));}return n.join(" ")}let t=[r.action];for(let[,n]of r.roles)t.push(Z(n));return t.join(" ")}function Z(r){switch(r.type){case "literal":return typeof r.value=="string"&&r.dataType==="string"?`"${r.value}"`:String(r.value);case "selector":return r.value;case "reference":return r.value;case "property-path":return ro(r);case "expression":return r.raw;case "flag":return r.enabled?`+${r.name}`:`~${r.name}`}}function ro(r){let e=Z(r.object),t=r.property;if(r.object.type==="reference")switch(r.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var Rt=.5,no={confidenceThreshold:Rt,strategy:"semantic",fallbackToOriginal:true};function io(r,e){return typeof r=="number"?r:r[e]??r["*"]??Rt}var Be=null;function oo(){return Be||(Be=bt()),Be}function Pe(r,e,t={}){let n={...no,...t},i=xt(r,e,n);if(i!==null)return i;let o=ao(r);if(o){let s=xt(o.commands,e,n);if(s!==null)return o.prefix+s}return r}function xt(r,e,t){if(t.strategy==="semantic"||t.strategy==="auto"){let n=io(t.confidenceThreshold,e),i=Bt(r,e,n);if(i!==null)return i}if((t.strategy==="auto"||t.strategy==="i18n")&&t.i18nToEnglish){let n=uo(r,e,t.i18nToEnglish);if(n!==null)return n}return null}var so=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function ao(r){let e=r.match(so);if(!e)return null;let t=e[1],n=r.slice(t.length);return n?{prefix:t,commands:n}:null}function Bt(r,e,t){try{let n=co(r,e);if(n.length>1)return po(n,e,t);let i=oo();if(!i.supportsLanguage(e))return null;let o=i.analyze(r,e);if(!St(o,t))return null;if(o.node)return ee(o.node);let s=xe(r,e);return ee(s)}catch{return null}}function uo(r,e,t){try{let n=t(r,e);return n!==r?n:null}catch{return null}}function lo(r){let e=["then"],t=I(r);if(t?.keywords?.then){let n=t.keywords.then;if(n.primary&&n.primary!=="then"&&e.push(n.primary),n.alternatives)for(let i of n.alternatives)e.includes(i)||e.push(i);}return e}function co(r,e){let n=lo(e).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${n.join("|")})\\s+`,"i"),o=r.split(`
4
+ `).map(a=>a.trim()).filter(a=>a.length>0),s=[];for(let a of o){let u=a.split(i);s.push(...u);}return s}function po(r,e,t){let n=[];for(let i of r){let o=Bt(i.trim(),e,t);if(o===null)return null;n.push(o);}return n.join(" then ")}function Ne(r={}){return function(t){let{internals:n}=t,i=n.runtime,o=i.getScript.bind(i);i.getScript=function(s){let a=o(s);if(!a)return null;let u=fo(s,r);if(!u||u==="en")return a;let l=Pe(a,u,r);return r.debug&&l!==a&&console.log(`[hyperscript-i18n] ${u}: "${a}" \u2192 "${l}"`),l};}}function fo(r,e){if(e.languageAttribute){let n=r.getAttribute(e.languageAttribute);if(n)return n.split("-")[0].toLowerCase()}let t=fe(r);return t||(e.defaultLanguage??null)}function Pt(r,e,t={}){return e==="en"?r:Pe(r,e,t)}ht(r=>Ct(r));function Nt(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Ne()),mo());}function mo(){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(n=>{let i=e.getInternalData(n);i.initialized&&(i.initialized=false);}),e.processNode(document.body);}var Ds=["hi","bn"];Nt();exports.plugin=Ne;exports.preprocess=Pt;exports.resolveLanguage=fe;exports.supportedLanguages=Ds;return exports;})({});