@lokascript/core 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/bridge-qXDe7P1g.js +2 -0
- package/dist/chunks/bridge-qXDe7P1g.js.map +1 -0
- package/dist/chunks/browser-modular-DfWTWK1K.js +2 -0
- package/dist/chunks/browser-modular-DfWTWK1K.js.map +1 -0
- package/dist/chunks/feature-eventsource-VXpBMoKs.js +2 -0
- package/dist/chunks/feature-eventsource-VXpBMoKs.js.map +1 -0
- package/dist/chunks/feature-sockets-CFuglALU.js +2 -0
- package/dist/chunks/feature-sockets-CFuglALU.js.map +1 -0
- package/dist/chunks/feature-webworker-JSaX8ZKW.js +2 -0
- package/dist/chunks/feature-webworker-JSaX8ZKW.js.map +1 -0
- package/dist/hyperfixi-browser-classic-i18n.js +2 -0
- package/dist/hyperfixi-browser-classic-i18n.js.map +1 -0
- package/dist/hyperfixi-browser-minimal.js +1 -0
- package/dist/hyperfixi-browser-standard.js +2 -0
- package/dist/hyperfixi-browser-standard.js.map +1 -0
- package/dist/hyperfixi-browser.js +2 -0
- package/dist/hyperfixi-browser.js.map +1 -0
- package/dist/hyperfixi-hybrid-complete.js +1 -0
- package/dist/hyperfixi-hybrid-hx.js +1 -0
- package/dist/hyperfixi-lite-plus.js +1 -0
- package/dist/hyperfixi-lite.js +1 -0
- package/dist/hyperfixi.mjs +2 -0
- package/dist/hyperfixi.mjs.map +1 -0
- package/dist/lokascript-browser-classic-i18n.js +2 -0
- package/dist/lokascript-browser-classic-i18n.js.map +1 -0
- package/dist/lokascript-browser-minimal.js +1 -0
- package/dist/lokascript-browser-standard.js +2 -0
- package/dist/lokascript-browser-standard.js.map +1 -0
- package/dist/lokascript-browser.js +2 -0
- package/dist/lokascript-browser.js.map +1 -0
- package/dist/lokascript-hybrid-complete.js +1 -0
- package/dist/lokascript-hybrid-hx.js +1 -0
- package/dist/lokascript-lite-plus.js +1 -0
- package/dist/lokascript-lite.js +1 -0
- package/dist/lokascript-multilingual.js +2 -0
- package/dist/lokascript-multilingual.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var lokascript=function(){"use strict";const e=function(){if("undefined"!=typeof localStorage)try{const e=localStorage.getItem("lokascript:debug");if("*"===e||"true"===e)return!0}catch{}return!("undefined"==typeof window||!window.__HYPERFIXI_DEBUG__)||"undefined"!=typeof process&&"true"===process.env?.HYPERFIXI_DEBUG}(),t={command:(...e)=>{},event:(...e)=>{},parse:(...e)=>{},expr:(...e)=>{},expressions:(...e)=>{},style:(...e)=>{},runtime:(...e)=>{},loop:(...e)=>{},async:(...e)=>{}},r={enable(){if("undefined"!=typeof localStorage)try{localStorage.setItem("lokascript:debug","*")}catch(e){}},disable(){if("undefined"!=typeof localStorage)try{localStorage.removeItem("lokascript:debug")}catch(e){}},isEnabled:()=>e,status(){if("undefined"!=typeof localStorage)try{if(localStorage.getItem("lokascript:debug"))return{enabled:!0,source:"localStorage"}}catch{}return"undefined"!=typeof window&&window.__HYPERFIXI_DEBUG__?{enabled:!0,source:"window.__HYPERFIXI_DEBUG__"}:"undefined"!=typeof process&&"true"===process.env?.HYPERFIXI_DEBUG?{enabled:!0,source:"process.env.HYPERFIXI_DEBUG"}:{enabled:!1,source:"none"}}},n="then",i="else",a="end",o="and",s="if",l="for",c="while",u="until",p="forever",m="times",d="each",h="index",f="in",y="to",v="from",g="with",k="of",w="by",b="between",z="on",x="event",E="def",S="behavior",T="global",C="local",A="the",L="start",j=[n,o,i,a,z],P=new Set(["add","append","async","beep","break","call","continue","copy","decrement","default","exit","fetch","for","get","go","halt","hide","if","increment","install","js","log","make","measure","morph","pick","process","push","put","remove","render","repeat","replace","return","send","set","settle","show","swap","take","tell","throw","toggle","transition","trigger","unless","wait"]),N=new Set(["put","trigger","send","remove","take","toggle","set","show","hide","add","halt","measure","js","tell","swap","morph","push","replace","process"]),O=new Set(["if","unless","repeat","wait","for","while"]),I="at",R="at start of",M="at end of",q=["into","before","after",I,R,M,"at the start of","at the end of"],_=new Set(["if","else","unless","for","while","until","end","and","or","not","in","to","from","into","with","without","as","matches","contains","then","on","when","every","init","def","behavior","the","of","first","last"]),$={isCommand:e=>P.has(e.toLowerCase()),isCompoundCommand:e=>N.has(e.toLowerCase()),isControlFlowCommand:e=>O.has(e.toLowerCase()),isKeyword:e=>_.has(e.toLowerCase()),isTerminator:e=>j.includes(e),isPutOperation:e=>q.includes(e),isCSSFunction:e=>W.has(e.toLowerCase())},W=new Set(["hsl","hsla","rgb","rgba","hwb","lab","lch","oklch","oklab","color","color-mix","calc","min","max","clamp","var","url","linear-gradient","radial-gradient","conic-gradient","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient"]),V=new Set(["me","it","you","result","my","its","your"]),D=new Set(["and","or","not","no"]),B=new Set(["==","!=","===","!==","<",">","<=",">=","is","is not","is a","is an","is not a","is not an","contains","has","have","does not contain","include","includes","does not include","match","matches","exists","does not exist","is empty","is not empty","is in","is not in","equals","in","is equal to","is really equal to","is not equal to","is not really equal to","is greater than","is less than","is greater than or equal to","is less than or equal to","really equals"]),H=new Set(["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","focus","blur","change","input","submit","reset","select","load","unload","resize","scroll","keydown","keyup","keypress","touchstart","touchend","touchmove","touchcancel","drag","drop","dragover","dragenter","dragleave","cut","copy","paste"]),F=new Set(["on","init","behavior","def","if","else","unless","for","while","until","end","and","or","not","in","to","from","into","with","as","then","when","where","after","before","by","at","between","async","no","start","of","the","new","global","local","equal","equals","greater","less","than","really","catch","finally","throw","return"]);var U,K;function G(e){switch(e){case K.KEYWORD:case K.COMMAND:case K.EXPRESSION:case K.CONTEXT_VAR:case K.GLOBAL_VAR:case K.EVENT:case K.IDENTIFIER:return U.IDENTIFIER;case K.STRING:return U.STRING;case K.NUMBER:return U.NUMBER;case K.BOOLEAN:return U.IDENTIFIER;case K.TEMPLATE_LITERAL:return U.TEMPLATE;case K.CSS_SELECTOR:case K.ID_SELECTOR:case K.CLASS_SELECTOR:case K.QUERY_REFERENCE:return U.SELECTOR;case K.OPERATOR:case K.LOGICAL_OPERATOR:case K.COMPARISON_OPERATOR:return U.OPERATOR;case K.TIME_EXPRESSION:return U.TIME;case K.COMMENT:return U.COMMENT;case K.SYMBOL:return U.SYMBOL;default:return U.UNKNOWN}}!function(e){e.IDENTIFIER="identifier",e.STRING="string",e.NUMBER="number",e.SELECTOR="selector",e.OPERATOR="operator",e.TIME="time",e.TEMPLATE="template",e.COMMENT="comment",e.SYMBOL="symbol",e.UNKNOWN="unknown"}(U||(U={})),function(e){e.KEYWORD="keyword",e.COMMAND="command",e.EXPRESSION="expression",e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.TEMPLATE_LITERAL="template_literal",e.CSS_SELECTOR="css_selector",e.ID_SELECTOR="id_selector",e.CLASS_SELECTOR="class_selector",e.QUERY_REFERENCE="query_reference",e.CONTEXT_VAR="context_var",e.GLOBAL_VAR="global_var",e.EVENT="event",e.OPERATOR="operator",e.LOGICAL_OPERATOR="logical_operator",e.COMPARISON_OPERATOR="comparison_operator",e.TIME_EXPRESSION="time_expression",e.OBJECT_LITERAL="object_literal",e.ARRAY_LITERAL="array_literal",e.SYMBOL="symbol",e.COMMENT="comment",e.IDENTIFIER="identifier",e.UNKNOWN="unknown"}(K||(K={}));const Y=F,X=new Set(["+","-","*","/","mod"]),Z=new Set(["ms","s","seconds","minutes","hours","days"]);function J(e){const t={input:"",position:0,line:1,column:1,tokens:[]};t.input=e;const r=e.length;for(;t.position<r&&(te(t),!(t.position>=r));){const r=e[t.position];if("-"!==r||"-"!==Q(t,1))if('"'!==r){if("'"===r||"'"===r){const e=Q(t,1),r=t.tokens[t.tokens.length-1];if("s"===e&&r&&(r.kind===U.IDENTIFIER||r.kind===U.SELECTOR||"]"===r.value||")"===r.value||"}"===r.value)){const e=t.position;ee(t),ee(t),re(t,K.OPERATOR,"'s",e)}else ae(t);continue}if("`"!==r)if("<"!==r)if("#"!==r){if("."===r){if("."===Q(t,1)){const e=t.position;ee(t),ee(t),re(t,K.OPERATOR,"..",e);continue}const e=t.tokens[t.tokens.length-1],r=new Set(["from","to","into","on","in","at"]),n=e&&e.kind===U.IDENTIFIER&&P.has(e.value.toLowerCase()),i=e&&e.kind===U.IDENTIFIER&&r.has(e.value.toLowerCase());if((!e||e.kind===U.OPERATOR&&")"!==e.value&&"]"!==e.value||n||i||"("===e.value||"["===e.value||"{"===e.value||","===e.value||";"===e.value)&&he(Q(t))){se(t);continue}}if("@"!==r)if("{"!==r)if("}"!==r){if("["===r){const e=t.tokens[t.tokens.length-1],r=e&&(e.kind===K.EVENT||e.kind===K.IDENTIFIER&&H.has(e.value))&&t.tokens.length>=2&&"on"===t.tokens[t.tokens.length-2]?.value;e&&(e.kind===K.IDENTIFIER||e.kind===K.CONTEXT_VAR||")"===e.value||"]"===e.value)&&!r?(re(t,K.OPERATOR,"["),ee(t)):r?(re(t,K.SYMBOL,"["),ee(t)):(re(t,K.OPERATOR,"["),ee(t));continue}if("]"!==r){if("$"===r){const e=Q(t,1);if(e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e){de(t);continue}}ve(r)?ue(t):r>="0"&&r<="9"?pe(t):r>="a"&&r<="z"||r>="A"&&r<="Z"||"_"===r?me(t):(re(t,K.UNKNOWN,r),ee(t))}else re(t,K.OPERATOR,"]"),ee(t)}else re(t,K.OPERATOR,"}"),ee(t);else re(t,K.OPERATOR,"{"),ee(t);else ce(t)}else se(t);else ye(t)?le(t):ue(t);else oe(t)}else ae(t);else ie(t)}return t.tokens}function Q(e,t=1){const r=e.position+t;return r<e.input.length?e.input[r]:""}function ee(e){const t=e.input[e.position];if(e.position++,"\n"===t)e.line++,e.column=1;else if("\r"===t){"\n"===(e.position<e.input.length?e.input[e.position]:"")&&e.position++,e.line++,e.column=1}else e.column++;return t}function te(e){const t=e.input,r=t.length;for(;e.position<r;){const r=t[e.position];if(" "!==r&&"\t"!==r&&"\r"!==r&&"\n"!==r)break;ee(e)}}function re(e,t,r,n,i){const a=n??e.position-r.length,o=e.position;let s=e.column-r.length;if(void 0!==n){s=1;let t=-1;for(let r=0;r<n;r++)"\n"!==e.input[r]&&"\r"!==e.input[r]||(t=r);s=n-t}const l={kind:G(t),value:r,start:a,end:o,line:ne(e,a),column:s};e.tokens.push(l)}function ne(e,t){let r=1;for(let n=0;n<t&&n<e.input.length;n++){const t=e.input[n];"\n"===t?r++:"\r"===t&&(r++,n+1<e.input.length&&"\n"===e.input[n+1]&&n++)}return r}function ie(e){const t=e.position;let r="";for(ee(e),ee(e);e.position<e.input.length;){if("\n"===e.input[e.position])break;r+=ee(e)}re(e,K.COMMENT,"--"+r,t)}function ae(e){const t=e.position,r=ee(e);let n=r;for(;e.position<e.input.length;){const t=ee(e);if(n+=t,t===r)break;"\\"===t&&e.position<e.input.length&&(n+=ee(e))}re(e,K.STRING,n,t)}function oe(e){const t=e.position;ee(e);let r="";for(;e.position<e.input.length;){const t=e.input[e.position];if("`"===t){ee(e);break}if("\\"===t){if(ee(e),e.position<e.input.length){const t=ee(e);switch(t){case"n":r+="\n";break;case"t":r+="\t";break;case"r":r+="\r";break;case"\\":r+="\\";break;case"`":r+="`";break;default:r+=t}}}else r+=ee(e)}if(e.position>=e.input.length&&!e.input.endsWith("`"))throw new Error(`Unterminated template literal at line ${e.line}, column ${e.column-r.length}`);re(e,K.TEMPLATE_LITERAL,r,t)}function se(e){const t=e.position,r=ee(e);let n=r;for(;e.position<e.input.length;){const t=e.input[e.position];if(!fe(t)&&"-"!==t&&"_"!==t&&":"!==t)break;n+=ee(e)}re(e,"#"===r?K.ID_SELECTOR:K.CLASS_SELECTOR,n,t)}function le(e){const t=e.position;let r="";for(r+=ee(e);e.position<e.input.length-1;){const t=e.input[e.position],n=e.input[e.position+1];if(r+=ee(e),"/"===t&&">"===n){r+=ee(e);break}}re(e,K.QUERY_REFERENCE,r,t)}function ce(e){const t=e.position;let r=ee(e);for(;e.position<e.input.length;){const t=e.input[e.position];if(!fe(t)&&"_"!==t&&"-"!==t)break;r+=ee(e)}re(e,K.SYMBOL,r,t)}function ue(e){const t=e.position;let r="";const n=e.input[e.position];if(("'"===n||"'"===n)&&"s"===Q(e,1))return r="'s",ee(e),ee(e),void re(e,K.OPERATOR,r,t);const i=e.input.substring(e.position,e.position+2),a=e.input.substring(e.position,e.position+3);["===","!=="].includes(a)?(r=a,ee(e),ee(e),ee(e)):["==","!=","<=",">=","&&","||","**","~=","|=","^=","$=","*=","?."].includes(i)?(r=i,ee(e),ee(e)):r=ee(e);let o=K.OPERATOR;B.has(r)?o=K.COMPARISON_OPERATOR:["&&","||"].includes(r)?o=K.LOGICAL_OPERATOR:X.has(r)&&(o=K.OPERATOR),re(e,o,r,t)}function pe(e){const t=e.position,r=e.input,n=r.length;let i="";for(;e.position<n;){const t=r[e.position];if(!(t>="0"&&t<="9"))break;i+=ee(e)}if(e.position<n&&"."===r[e.position]&&!(e.position+1<n&&"."===r[e.position+1]))for(i+=ee(e);e.position<n;){const t=r[e.position];if(!(t>="0"&&t<="9"))break;i+=ee(e)}if(e.position<n){const t=r[e.position];if("e"===t||"E"===t){const t=e.position+1<n?r[e.position+1]:"",a=e.position+2<n?r[e.position+2]:"";if(t>="0"&&t<="9"||("+"===t||"-"===t)&&a>="0"&&a<="9")for(i+=ee(e),"+"!==r[e.position]&&"-"!==r[e.position]||(i+=ee(e));e.position<n;){const t=r[e.position];if(!(t>="0"&&t<="9"))break;i+=ee(e)}}}const a=e.position;let o="";for(;e.position<n;){const t=r[e.position];if(!(t>="a"&&t<="z"||t>="A"&&t<="Z"))break;o+=ee(e)}Z.has(o)?re(e,K.TIME_EXPRESSION,i+o,t):(e.position=a,re(e,K.NUMBER,i,t))}function me(e){const t=e.position,r=e.input,n=r.length;let i="";for(;e.position<n;){const t=r[e.position];if(!(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t||"-"===t))break;i+=ee(e)}const a=function(e,t,r){const n=t.toLowerCase(),i=e.position;if("'s"===t||"'s"===t)return!1;const a=e.tokens[e.tokens.length-1];if(a&&("identifier"===a.kind||"id_selector"===a.kind||"class_selector"===a.kind||"context_var"===a.kind)){const t=e.position<e.input.length?e.input[e.position]:"";if("'"===t||"'"===t)return!1}te(e);let o="";for(;e.position<e.input.length;){const t=e.input[e.position];if(!(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t||"-"===t))break;o+=ee(e)}if(o){const t=o.toLowerCase(),i=`${n} ${t}`,a=function(e,t,r,n){const i=t.toLowerCase(),a=r.toLowerCase();if("at"===i){const t=e.position;if("the"===a){te(e);let r="";for(;e.position<e.input.length;){const t=e.input[e.position];if(!(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t||"-"===t))break;r+=ee(e)}const i=r.toLowerCase();if("start"===i||"end"===i){te(e);let t="";for(;e.position<e.input.length;){const r=e.input[e.position];if(!(r>="a"&&r<="z"||r>="A"&&r<="Z"||r>="0"&&r<="9"||"_"===r||"-"===r))break;t+=ee(e)}if("of"===t.toLowerCase()){return re(e,K.KEYWORD,`at the ${i} of`,n),!0}}return e.position=t,!1}if("start"===a||"end"===a){te(e);let r="";for(;e.position<e.input.length;){const t=e.input[e.position];if(!(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t||"-"===t))break;r+=ee(e)}if("of"===r.toLowerCase()){return re(e,K.KEYWORD,`at ${a} of`,n),!0}return e.position=t,!1}}return!1}(e,n,t,r);if(a)return!0;const s=function(e,t,r){const n=e.position;let i=`${t} ${r}`,a=e.position;const o=[t,r],s=8;for(;o.length<s&&(te(e),!(e.position>=e.input.length));){let t="";for(;e.position<e.input.length;){const r=e.input[e.position];if(!(r>="a"&&r<="z"||r>="A"&&r<="Z"))break;t+=ee(e)}if(!t)break;o.push(t.toLowerCase());const r=o.join(" ");B.has(r)&&(i=r,a=e.position)}if(B.has(i)&&i!==`${t} ${r}`)return e.position=a,i;return e.position=n,null}(e,n,t);if(s)return re(e,K.COMPARISON_OPERATOR,s,r),!0;if(B.has(i))return re(e,K.COMPARISON_OPERATOR,i,r),!0}if(B.has(n))return e.position=i,re(e,K.COMPARISON_OPERATOR,t,r),!0;return e.position=i,!1}(e,i,t);if(a)return;const o=function(e){const t=e.toLowerCase();if("include"===t||"includes"===t)return K.COMPARISON_OPERATOR;if(D.has(t))return K.LOGICAL_OPERATOR;if(X.has(e)||X.has(t))return K.OPERATOR;if(B.has(t))return K.COMPARISON_OPERATOR;if("I"===e)return K.CONTEXT_VAR;if(V.has(t))return K.CONTEXT_VAR;if(P.has(t))return K.COMMAND;if(H.has(t))return K.EVENT;if(["true","false","null","undefined"].includes(t))return K.BOOLEAN;if(Y.has(t))return K.KEYWORD;return K.IDENTIFIER}(i);re(e,o,i,t)}function de(e){const t=e.position,r=e.input,n=r.length;ee(e);let i="$";for(;e.position<n;){const t=r[e.position];if(!(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t))break;i+=ee(e)}re(e,K.GLOBAL_VAR,i,t)}function he(e){return/[a-zA-Z]/.test(e)}function fe(e){return/[a-zA-Z0-9]/.test(e)}function ye(e){let t=e.position+1,r=!1;for(;t<e.input.length;){const n=e.input[t];if("/"===n&&t+1<e.input.length&&">"===e.input[t+1])return r;if(fe(n)||"."===n||"#"===n||"["===n||"]"===n||":"===n||"-"===n||"_"===n||" "===n||"="===n||'"'===n||"'"===n||"("===n||")"===n||"*"===n||"^"===n||"$"===n||"~"===n||"|"===n||">"===n||"+"===n||","===n)r=!0,t++;else{if(" "!==n&&"\t"!==n)return!1;t++}if(t-e.position>50)return!1}return!1}function ve(e){return"+-*/^%=!<>&|(){}[],.;:?''~$".includes(e)}function ge(e){return e.kind===U.IDENTIFIER&&P.has(e.value.toLowerCase())}function ke(e){return e.kind===U.IDENTIFIER&&F.has(e.value.toLowerCase())}function we(e){return e.kind===U.IDENTIFIER&&H.has(e.value.toLowerCase())}function be(e){return e.kind===U.IDENTIFIER&&V.has(e.value.toLowerCase())}function ze(e){return(e.kind===U.OPERATOR||e.kind===U.IDENTIFIER)&&D.has(e.value.toLowerCase())}function xe(e){return B.has(e.value.toLowerCase())}function Ee(e){return e.kind===U.IDENTIFIER}function Se(e){return e.kind===U.SELECTOR}function Te(e){return e.kind===U.SELECTOR&&!e.value.startsWith("<")}function Ce(e){return e.kind===U.STRING||e.kind===U.NUMBER||e.kind===U.TEMPLATE}function Ae(e){return e.kind===U.IDENTIFIER}function Le(e){return e.kind===U.TIME}function je(e){return e.kind===U.COMMENT}function Pe(e){if(e.kind!==U.IDENTIFIER)return!1;const t=e.value.toLowerCase();return!(P.has(t)||F.has(t)||H.has(t)||V.has(t))}function Ne(e){return e.kind===U.STRING}function Oe(e){return e.kind===U.NUMBER}function Ie(e){if(e.kind===U.IDENTIFIER){const t=e.value;return"true"===t||"false"===t||"null"===t||"undefined"===t}return!1}function Re(e){return e.kind===U.TEMPLATE}function Me(e){return e.kind===U.SELECTOR&&e.value.startsWith("<")}function qe(e){return e.kind===U.SELECTOR&&e.value.startsWith("#")}function _e(e){return e.kind===U.SELECTOR&&e.value.startsWith(".")}function $e(e){return e.kind===U.SELECTOR&&(!e.value.startsWith("#")&&!e.value.startsWith("."))}function We(e){if(e.kind!==U.OPERATOR)return!1;const t=e.value.toLowerCase();return!D.has(t)&&!B.has(t)}function Ve(e){return e.kind===U.OPERATOR&&"'s"===e.value}function De(e){return e.kind===U.OPERATOR&&"."===e.value}function Be(e){return e.kind===U.OPERATOR&&"?."===e.value}function He(e){return e.kind===U.OPERATOR&&"["===e.value}function Fe(e){return e.kind===U.OPERATOR&&"("===e.value}function Ue(e){const t=e.value.toLowerCase();return"then"===t||"and"===t||"else"===t||"end"===t||"on"===t}function Ke(e,t){if("number"==typeof e){if(!Number.isFinite(e))throw new Error(`${t} must be a finite number, got ${e}`);return e}if("string"==typeof e){const r=e.trim();if(""===r)return 0;const n=parseFloat(r);if(isNaN(n))throw new Error(`${t} cannot be converted to number: "${e}"`);return n}if("boolean"==typeof e)return e?1:0;if(null==e)return 0;if("object"==typeof e&&null!==e){const t=e.valueOf();if("number"==typeof t&&Number.isFinite(t))return t}throw new Error(`${t} cannot be converted to number: ${typeof e}`)}function Ge(e,t){if(!Number.isFinite(e)){if(Number.isNaN(e))throw new Error(`${t} resulted in non-finite value: NaN`);throw new Error(`${t} resulted in non-finite value: ${e>0?"Infinity":"-Infinity"}`)}return e}function Ye(e){if("number"==typeof e)return Number.isFinite(e);if("string"==typeof e){const t=e.trim();return""!==t&&!isNaN(parseFloat(t))}return!1}function Xe(e,t=[]){return{isValid:!1,errors:e,suggestions:t}}function Ze(e,t,r=[],n="error"){return{type:e,message:t,suggestions:r,severity:n}}const Je=new class{constructor(e={}){this.types=new Map,this.coercionCache=new Map,this.config={strictMode:!1,cacheCoercions:!0,...e},this.registerBuiltinTypes()}register(e){this.types.has(e.name),this.types.set(e.name,e)}get(e){return this.types.get(e)}has(e){return this.types.has(e)}getTypeNames(){return Array.from(this.types.keys())}inferType(e){for(const[t,r]of this.types)if(r.isType(e))return t;return"Unknown"}getHyperScriptType(e){const t=this.inferType(e),r=this.types.get(t);return r?.hyperscriptType??"unknown"}coerce(e,t,r){const n=this.types.get(t);if(!n){if(this.config.strictMode)throw new Error(`Unknown target type: ${t}`);return null}if(n.isType(e))return e;if(this.config.cacheCoercions){const r=`${this.inferType(e)}:${t}:${JSON.stringify(e)}`;if(this.coercionCache.has(r))return this.coercionCache.get(r)}const i=this.inferType(e),a=n.coerceFrom?.[i];if(a){const n=a(e,r);if(this.config.cacheCoercions&&null!==n){const r=`${i}:${t}:${JSON.stringify(e)}`;this.coercionCache.set(r,n)}return n}return n.defaultValue}canCoerce(e,t){const r=this.types.get(t);if(!r)return!1;if(r.isType(e))return!0;const n=this.inferType(e);return void 0!==r.coerceFrom?.[n]}getCoercionInfo(e,t){const r=this.types.get(t);return r&&(e===t||r.coerceFrom?.[e])?{possible:!0,direct:!0}:{possible:!1,direct:!1}}clearCache(){this.coercionCache.clear()}getStats(){return{typeCount:this.types.size,cacheSize:this.coercionCache.size,typeNames:this.getTypeNames()}}registerBuiltinTypes(){this.register({name:"String",hyperscriptType:"string",tsType:"string",isType:e=>"string"==typeof e,defaultValue:"",description:"Text string value",examples:["hello","world",""],coerceFrom:{Number:e=>String(e),Boolean:e=>String(e),Null:()=>"",Undefined:()=>"",Array:e=>Array.isArray(e)?e.join(", "):null,Object:e=>{try{return JSON.stringify(e)}catch{return String(e)}},Element:e=>e instanceof Element?e.textContent??e.outerHTML:null}}),this.register({name:"Number",hyperscriptType:"number",tsType:"number",isType:e=>"number"==typeof e&&!isNaN(e),defaultValue:0,description:"Numeric value (integer or float)",examples:[0,1,3.14,-42],coerceFrom:{String:e=>{const t=parseFloat(e);return isNaN(t)?null:t},Boolean:e=>e?1:0,Null:()=>0,Undefined:()=>null}}),this.register({name:"Boolean",hyperscriptType:"boolean",tsType:"boolean",isType:e=>"boolean"==typeof e,defaultValue:!1,description:"True or false value",examples:[!0,!1],coerceFrom:{String:e=>{const t=e.toLowerCase().trim();return"true"===t||"yes"===t||"1"===t||"false"!==t&&"no"!==t&&"0"!==t&&""!==t&&t.length>0},Number:e=>0!==e,Null:()=>!1,Undefined:()=>!1,Array:e=>!!Array.isArray(e)&&e.length>0,Element:e=>e instanceof Element,ElementList:e=>Array.isArray(e)&&e.length>0}}),this.register({name:"Element",hyperscriptType:"element",tsType:"Element | HTMLElement",isType:e=>e instanceof Element,defaultValue:null,description:"DOM Element",coerceFrom:{String:(e,t)=>{const r=e;if(r.startsWith("#")||r.startsWith(".")||r.match(/^[\w-]+$/))try{return document.querySelector(r)}catch{return null}return null},ElementList:e=>Array.isArray(e)&&e.length>0?e[0]:null,NodeList:e=>e.length>0?e[0]:null}}),this.register({name:"ElementList",hyperscriptType:"element-list",tsType:"Element[]",isType:e=>Array.isArray(e)&&e.length>0&&e.every(e=>e instanceof Element),defaultValue:[],description:"Array of DOM Elements",coerceFrom:{Element:e=>e instanceof Element?[e]:[],NodeList:e=>Array.from(e),String:e=>{try{return Array.from(document.querySelectorAll(e))}catch{return[]}},Array:e=>{const t=e;return t.every(e=>e instanceof Element)?t:[]}}}),this.register({name:"Array",hyperscriptType:"array",tsType:"unknown[]",isType:e=>Array.isArray(e),defaultValue:[],description:"Array of values",coerceFrom:{String:e=>{const t=e;try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t.split(",").map(e=>e.trim())},ElementList:e=>e,NodeList:e=>Array.from(e),Object:e=>Object.values(e)}}),this.register({name:"Object",hyperscriptType:"object",tsType:"Record<string, unknown>",isType:e=>!("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Element),defaultValue:{},description:"Plain JavaScript object",coerceFrom:{String:e=>{try{const t=JSON.parse(e);if("object"==typeof t&&null!==t&&!Array.isArray(t))return t}catch{}return null},Array:e=>{const t={};return e.forEach((e,r)=>{t[String(r)]=e}),t}}}),this.register({name:"Null",hyperscriptType:"null",tsType:"null",isType:e=>null===e,defaultValue:null,description:"Null value"}),this.register({name:"Undefined",hyperscriptType:"undefined",tsType:"undefined",isType:e=>void 0===e,defaultValue:void 0,description:"Undefined value"}),this.register({name:"Function",hyperscriptType:"function",tsType:"Function",isType:e=>"function"==typeof e,defaultValue:null,description:"JavaScript function"}),this.register({name:"Event",hyperscriptType:"event",tsType:"Event",isType:e=>e instanceof Event,defaultValue:null,description:"DOM Event"}),this.register({name:"NodeList",hyperscriptType:"element-list",tsType:"NodeList",isType:e=>e instanceof NodeList,defaultValue:null,description:"DOM NodeList (typically from querySelectorAll)",coerceFrom:{Array:e=>null}}),this.register({name:"Unknown",hyperscriptType:"unknown",tsType:"unknown",isType:e=>!0,defaultValue:null,description:"Unknown/any value type"})}};function Qe(e){const t=Je.get("String");return t?t.isType(e):"string"==typeof e}function et(e){const t=Je.get("Number");return t?t.isType(e):"number"==typeof e}function tt(e){const t=Je.get("Boolean");return t?t.isType(e):"boolean"==typeof e}function rt(e){const t=Je.get("Object");return t?t.isType(e):"object"==typeof e&&null!==e}function nt(e){const t=Je.get("Function");return t?t.isType(e):"function"==typeof e}function it(e,t,r,n,i,a=!0,o){return t&&"object"==typeof t&&"evaluationHistory"in t&&Array.isArray(t.evaluationHistory)&&t.evaluationHistory.push({expressionName:e.name,category:e.category,input:r,output:n,timestamp:i,duration:Date.now()-i,success:a,...void 0!==o&&{error:o}}),n}let at=class{constructor(){this.name="addition",this.category="Special",this.syntax="left + right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Ke(e,"left operand"),i=Ke(r,"right operand");return{success:!0,value:Ge(n+i,"addition"),type:"number"}}catch(e){return{success:!1,errors:[Ze("runtime-error",`Addition failed: ${e instanceof Error?e.message:String(e)}`)],suggestions:["Ensure both operands are numeric"]}}}validate(e){const t=function(e){if(null==e)return Xe([Ze("missing-argument","Input is null or undefined")],["Provide an object with left and right operands"]);if("object"!=typeof e)return Xe([Ze("type-mismatch","Expected object, got "+typeof e)],["Provide an object with left and right operands"]);const t=e;if(!("left"in t)||!("right"in t)){const e=[];return"left"in t||e.push("left"),"right"in t||e.push("right"),Xe([Ze("missing-argument",`Missing ${e.join(" and ")} operand${e.length>1?"s":""}`)],["Provide { left: value, right: value }"])}return{isValid:!0,errors:[],suggestions:[]}}(e);if(!t.isValid)return t;const{left:r,right:n}=e;return Ye(r)||"boolean"==typeof r||null==r?Ye(n)||"boolean"==typeof n||null==n?{isValid:!0,errors:[],suggestions:[]}:{isValid:!1,errors:[Ze("type-mismatch",`Right operand cannot be converted to number: ${String(n)}`)],suggestions:["Provide a numeric value for right operand"]}:{isValid:!1,errors:[Ze("type-mismatch",`Left operand cannot be converted to number: ${String(r)}`)],suggestions:["Provide a numeric value for left operand"]}}};class ot{constructor(){this.name="subtraction",this.category="Special",this.syntax="left - right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Ke(e,"left operand"),i=Ke(r,"right operand");return{success:!0,value:Ge(n-i,"subtraction"),type:"number"}}catch(e){return{success:!1,errors:[Ze("runtime-error",`Subtraction failed: ${e instanceof Error?e.message:String(e)}`)],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new at).validate(e)}}let st=class{constructor(){this.name="multiplication",this.category="Special",this.syntax="left * right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Ke(e,"left operand"),i=Ke(r,"right operand");return{success:!0,value:Ge(n*i,"multiplication"),type:"number"}}catch(e){return{success:!1,errors:[Ze("runtime-error",`Multiplication failed: ${e instanceof Error?e.message:String(e)}`)],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new at).validate(e)}};class lt{constructor(){this.name="division",this.category="Special",this.syntax="left / right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Ke(e,"left operand"),i=function(e,t,r=!0){if(0===t){if(r)return 0===e?NaN:e>0?1/0:-1/0;throw new Error("Division by zero")}return e/t}(n,Ke(r,"right operand"),!0);return{success:!0,value:i,type:"number"}}catch(e){return{success:!1,errors:[Ze("runtime-error",`Division failed: ${e instanceof Error?e.message:String(e)}`)],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new at).validate(e)}}class ct{constructor(){this.name="modulo",this.category="Special",this.syntax="left mod right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Ke(e,"left operand"),i=function(e,t){if(0===t)throw new Error("Modulo by zero");return e%t}(n,Ke(r,"right operand"));return{success:!0,value:i,type:"number"}}catch(e){return{success:!1,errors:[Ze("runtime-error",`Modulo failed: ${e instanceof Error?e.message:String(e)}`)],suggestions:["Ensure both operands are numeric and divisor is not zero"]}}}validate(e){return(new at).validate(e)}}const ut={subtraction:new ot,multiplication:new st,division:new lt,modulo:new ct};function pt(e,t,r,n=[]){return{type:e,message:t,suggestions:n,...r&&{path:r}}}const mt="undefined"!=typeof process&&"production"===process.env.NODE_ENV||"undefined"!=typeof process&&"true"===process.env.HYPERFIXI_SKIP_VALIDATION||"undefined"!=typeof globalThis&&"true"===globalThis.HYPERFIXI_SKIP_VALIDATION;let dt;function ht(){return dt({validate:e=>({success:!0,data:e})})}function ft(e,t){if(mt)return ht();const r=dt({validate:r=>{if("object"!=typeof r||null===r||Array.isArray(r))return{success:!1,error:pt("type-mismatch","Expected object, received "+typeof r)};const n=r,i={};if(t?.strict){const t=Object.keys(e),r=Object.keys(n).filter(e=>!t.includes(e));if(r.length>0)return{success:!1,error:pt("runtime-error",`Unexpected properties: ${r.join(", ")}`)}}for(const[t,r]of Object.entries(e)){const e=t in n,a=r.validate(n[t]);if(!a.success){return{success:!1,error:pt("validation-error",a.error.message||`Field "${t}" validation failed`,a.error.path?`${t}.${a.error.path}`:t)}}if(!e&&void 0===a.data&&!r._isOptional)return{success:!1,error:pt("missing-argument",`Required field "${t}" is missing`,t)};void 0!==a.data&&(i[t]=a.data)}return{success:!0,data:i}}});return r.strict=()=>ft(e,{strict:!0}),r}function yt(e,t="Custom validation failed"){return mt?ht():dt({validate:r=>e(r)?{success:!0,data:r}:{success:!1,error:pt("runtime-error",t)}})}dt=function(e){return e.describe||(e.describe=function(e){return this.description=e,this}),e.safeParse||(e.safeParse=function(e){const t=this.validate(e);return t.success?{success:!0,data:t.data}:{success:!1,error:{errors:t.error?[t.error]:[]}}}),e.parse||(e.parse=function(e){const t=this.validate(e);if(t.success&&void 0!==t.data)return t.data;throw new Error(t.error?.message||"Validation failed")}),e.optional||(e.optional=function(){const e=this.validate.bind(this),t={...this,_isOptional:!0,validate:t=>null==t?{success:!0,data:void 0}:e(t)};return dt(t)}),e.min||(e.min=function(e){const t=this.validate.bind(this),r={...this,validate:r=>{const n=t(r);return n.success&&"string"==typeof n.data&&n.data.length<e?{success:!1,error:pt("runtime-error",`String must be at least ${e} characters long`)}:n}};return dt(r)}),e.max||(e.max=function(e){const t=this.validate.bind(this),r={...this,validate:r=>{const n=t(r);return n.success&&"string"==typeof n.data&&n.data.length>e?{success:!1,error:pt("runtime-error",`String must be at most ${e} characters long`)}:n}};return dt(r)}),e.default||(e.default=function(e){const t=this.validate.bind(this),r={...this,_defaultValue:e,_hasDefault:!0,validate:r=>void 0===r?{success:!0,data:e}:t(r)};return dt(r)}),e.rest||(e.rest=function(e){return this}),e.refine||(e.refine=function(e,t){return this}),new Proxy(e,{get:(e,t,r)=>t in e||"string"!=typeof t||t.startsWith("_")||"constructor"===t||"validate"===t||"then"===t?Reflect.get(e,t,r):function(...e){return r}})};const vt=e=>dt(function(e={}){return mt?ht():dt({validate:t=>e.optional&&null==t?{success:!0,data:void 0}:"string"!=typeof t?{success:!1,error:pt("type-mismatch","Expected string, received "+typeof t)}:void 0!==e.minLength&&t.length<e.minLength?{success:!1,error:pt("runtime-error",`String must be at least ${e.minLength} characters long`)}:void 0!==e.maxLength&&t.length>e.maxLength?{success:!1,error:pt("runtime-error",`String must be at most ${e.maxLength} characters long`)}:e.pattern&&!e.pattern.test(t)?e.pattern.source.startsWith("^")&&e.pattern.source.endsWith("$")?{success:!1,error:pt("runtime-error",`Expected "${e.pattern.source.slice(1,-1)}", received "${t}"`)}:{success:!1,error:pt("missing-argument","String does not match required pattern")}:{success:!0,data:t},...e.description&&{description:e.description}})}(e||{})),gt=e=>dt(function(e={}){return mt?ht():dt({validate:t=>{const r=Number(t);return isNaN(r)?{success:!1,error:pt("type-mismatch","Expected number, received "+typeof t)}:void 0!==e.min&&r<e.min?{success:!1,error:pt("runtime-error",`Number must be at least ${e.min}`)}:void 0!==e.max&&r>e.max?{success:!1,error:pt("runtime-error",`Number must be at most ${e.max}`)}:{success:!0,data:r}}})}(e||{})),kt=()=>dt(mt?ht():dt({validate:e=>"boolean"!=typeof e?{success:!1,error:pt("type-mismatch","Expected boolean, received "+typeof e)}:{success:!0,data:e}})),wt=e=>dt(ft(e)),bt=e=>dt(function(e){return mt?ht():dt({validate:t=>{if(!Array.isArray(t))return{success:!1,error:pt("type-mismatch","Expected array, received "+typeof t)};if(t.length!==e.length)return{success:!1,error:pt("runtime-error",`Expected tuple of length ${e.length}, received length ${t.length}`)};const r=[];for(let n=0;n<e.length;n++){const i=e[n].validate(t[n]);if(!i.success)return{success:!1,error:pt("runtime-error",i.error.message,i.error.path?`${n}.${i.error.path}`:`${n}`)};r.push(i.data)}return{success:!0,data:r}}})}(e)),zt=()=>dt(ht()),xt=()=>dt(ht()),Et=()=>dt(yt(e=>void 0===e,"Expected undefined"));class St{trackPerformance(e,t,r,n){e.evaluationHistory&&e.evaluationHistory.push({expressionName:this.name,category:this.category,input:t,output:r.success?r.value:r.error,timestamp:n,duration:Date.now()-n,success:r.success})}trackSimple(e,t,r,n=(r?"success":"error")){e.evaluationHistory&&e.evaluationHistory.push({expressionName:this.name,category:this.category,input:"operation",output:n,timestamp:t,duration:Date.now()-t,success:r})}toBoolean(e){return!1!==e&&0!==e&&0n!==e&&""!==e&&null!=e&&(!et(e)||!isNaN(e))}success(e,t){return{success:!0,value:e,type:t}}failure(e,t,r,n,i=[]){return{success:!1,error:{name:e,type:t,message:r,code:n,suggestions:i}}}validationSuccess(){return{isValid:!0,errors:[],suggestions:[]}}validationFailure(e,t,r=[]){return{isValid:!1,errors:[{type:e,message:t,suggestions:r}],suggestions:r}}isElement(e){return null!=e&&rt(e)&&1===e.nodeType}inferType(e){return null===e?"null":void 0===e?"undefined":this.isElement(e)?"element":Array.isArray(e)?"array":rt(e)?"object":typeof e}normalizeCollection(e){return Array.isArray(e)?e:e instanceof NodeList?Array.from(e):Qe(e)?e.split(""):null==e?[]:rt(e)&&Symbol.iterator in e?Array.from(e):[]}toNumber(e){if(et(e)&&Number.isFinite(e))return e;if(Qe(e)){const t=Number(e);return Number.isFinite(t)?t:null}return tt(e)?e?1:0:null}}function Tt(e){if(null===e||"object"!=typeof e||!("tagName"in e))return!1;const t=e.tagName;return"INPUT"===t||"SELECT"===t||"TEXTAREA"===t}function Ct(e){return e instanceof Element}const At={id:e=>e.id,classname:e=>e.className,class:e=>e.className,tagname:e=>e.tagName.toLowerCase(),innertext:e=>e.textContent?.trim(),innerHTML:e=>e.innerHTML,outerhtml:e=>e.outerHTML,value:e=>Tt(e)?e.value:void 0,checked:e=>function(e){return null!==e&&"object"==typeof e&&"tagName"in e&&"INPUT"===e.tagName}(e)?e.checked:void 0,disabled:e=>Tt(e)?e.disabled:void 0,selected:e=>function(e){return null!=e&&"object"==typeof e&&"tagName"in e&&"OPTION"===e.tagName}(e)?e.selected:void 0,hidden:e=>function(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType&&"style"in e}(e)?e.hidden:void 0,style:e=>getComputedStyle(e),children:e=>Array.from(e.children),parent:e=>e.parentElement,firstchild:e=>e.firstElementChild,lastchild:e=>e.lastElementChild,nextsibling:e=>e.nextElementSibling,previoussibling:e=>e.previousElementSibling};function Lt(e,t){if(t.startsWith("computed-")){const r=t.slice(9);if(function(e){return e instanceof HTMLElement}(e)){return getComputedStyle(e).getPropertyValue(r)}return}const r=At[t.toLowerCase()];if(r)return r(e);if(function(e,t){return e.hasAttribute(t)}(e,t))return function(e,t){return e.getAttribute(t)}(e,t);const n=e[t];return nt(n)?n.bind(e):n}const jt=wt({property:vt().describe("Property name to access")}).strict(),Pt=wt({target:zt().describe("Target object to access property from"),property:vt().describe("Property name to access")}).strict(),Nt=wt({element:zt().describe("DOM element to access attribute from"),attribute:vt().describe("Attribute name to access")}).strict();function Ot(e,t){if(null==e)return;if(!t.includes("."))return Ct(e)?Lt(e,t):e[t];const r=t.split(".");let n=e;for(const e of r){if(null==n)return;n=Ct(n)?Lt(n,e):n[e]}return n}class It extends St{constructor(){super(...arguments),this.name="my",this.category="Property",this.syntax="my property",this.description="Accesses properties of the current context element (me) with validation",this.inputSchema=jt,this.outputType="Any",this.metadata={category:"Property",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};if(!e.me)return{success:!1,error:{type:"context-error",message:"No current element (me) available in context for property access",suggestions:["Ensure this expression is used within an element context","Check that the element reference is properly set"]}};const i=Ot(e.me,t.property);this.trackSimple(e,r,!0,i);return{success:!0,value:i,type:void 0===i?"unknown":this.inferType(i)}}catch(t){return this.trackSimple(e,r,!1),{success:!1,error:{type:"runtime-error",message:`Property access failed: ${t instanceof Error?t.message:String(t)}`,suggestions:["Check that the property name is valid","Ensure the current element supports the requested property"]}}}}validate(e){try{const t=this.inputSchema.safeParse(e);if(!t.success)return this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid property access input",["Provide a valid property name as a string","Ensure the property name is not empty"]);const{property:r}=t.data;return""===r.trim()?this.validationFailure("validation-error","Property name cannot be empty",["Provide a non-empty property name"]):this.validationSuccess()}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}class Rt extends St{constructor(){super(...arguments),this.name="its",this.category="Property",this.syntax="target its property",this.description="Generic possessive property access with comprehensive validation",this.inputSchema=Pt,this.outputType="Any",this.metadata={category:"Property",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=Ot(t.target,t.property);this.trackSimple(e,r,!0,i);return{success:!0,value:i,type:void 0===i?"unknown":this.inferType(i)}}catch(t){return this.trackSimple(e,r,!1),{success:!1,error:{type:"runtime-error",message:`Property access failed: ${t instanceof Error?t.message:String(t)}`,suggestions:["Check that the target object is not null or undefined","Ensure the property name is valid"]}}}}validate(e){try{const t=this.inputSchema.safeParse(e);if(!t.success)return this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid possessive access input",["Provide both target and property parameters","Ensure property name is a string"]);const{property:r}=t.data;return""===r.trim()?this.validationFailure("validation-error","Property name cannot be empty",["Provide a non-empty property name"]):this.validationSuccess()}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}class Mt extends St{constructor(){super(...arguments),this.name="attribute",this.category="Property",this.syntax="@attribute or element@attribute",this.description="Accesses HTML attributes with comprehensive DOM validation",this.inputSchema=Nt,this.outputType="String",this.metadata={category:"Property",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};if(!this.isElement(t.element))return{success:!1,error:{type:"type-mismatch",message:"Target must be a DOM element for attribute access",suggestions:["Ensure the target is a valid DOM element","Check that the element reference is correct"]}};const i=t.element.getAttribute(t.attribute);return this.trackSimple(e,r,!0,i),{success:!0,value:i,type:null===i?"null":"string"}}catch(t){return this.trackSimple(e,r,!1),{success:!1,error:{type:"runtime-error",message:`Attribute access failed: ${t instanceof Error?t.message:String(t)}`,suggestions:["Check that the element supports getAttribute","Ensure the attribute name is valid"]}}}}validate(e){try{const t=this.inputSchema.safeParse(e);if(!t.success)return this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid attribute access input",["Provide both element and attribute parameters","Ensure attribute name is a string"]);const{attribute:r}=t.data;return""===r.trim()?this.validationFailure("validation-error","Attribute name cannot be empty",["Provide a non-empty attribute name"]):this.validationSuccess()}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}const qt={my:new It,its:new Rt,attribute:new Mt},_t={1:"one",2:"two",3:"three",4:"four",5:"five"};function $t(e,t,r,n){if(e.length!==t){const e=n?` (${n})`:"";return`${r} requires exactly ${i=t,_t[i]??String(i)} argument${1===t?"":"s"}${e}`}var i;return null}function Wt(e,t,r,n){if("string"!=typeof e[t]){return`${r} ${n||`argument ${t+1}`} must be a string`}return null}function Vt(e,t,r){return $t(e,1,t,r)??Wt(e,0,t,r)}function Dt(e,t){return $t(e,2,t,"left, right")}function Bt(){return null}function Ht(e,t,r,n){if(e.length>t){const e=n?` (${n})`:"";return`${r} expression takes at most ${1===t?"one":String(t)} argument${1===t?"":"s"}${e}`}return null}function Ft(e,t,r,n,i){if(e.length<t||e.length>r){return`${n} requires ${t}-${r} arguments${i?` (${i})`:""}`}return null}const Ut={String:"string",Number:"number",Boolean:"boolean",Element:"element",ElementList:"element-list",Array:"array",Object:"object",Promise:"promise",Context:"object",Null:"null",Undefined:"undefined",Any:"object"},Kt=wt({collection:zt().describe("Collection to operate on (array, NodeList, or string)")}).strict(),Gt=wt({collection:zt().describe("Collection to access"),index:gt().describe("Index position to access")}).strict(),Yt=wt({collection:zt().describe("Collection to select random item from")}).strict();class Xt extends St{constructor(){super(...arguments),this.name="first",this.category="Positional",this.syntax="first in collection",this.description="Gets the first element from a collection",this.inputSchema=Kt,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.normalizeCollection(t.collection),a=i.length>0?i[0]:void 0,o={success:!0,value:a,type:Ut[this.inferResultTypeLocal(a)]};return this.trackPerformance(e,t,o,r),o}catch(n){const i=this.failure("FirstExpressionError","runtime-error",`First operation failed: ${n instanceof Error?n.message:String(n)}`,"FIRST_OPERATION_FAILED");return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:`Invalid first input: ${e.message}`,suggestions:[]}))??[],suggestions:["Provide a collection parameter","Ensure collection is array, NodeList, or string"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}inferResultTypeLocal(e){return void 0===e?"Undefined":null===e?"Null":Qe(e)?"String":et(e)?"Number":tt(e)?"Boolean":Array.isArray(e)?"Array":e instanceof HTMLElement?"Element":"Object"}}class Zt extends St{constructor(){super(...arguments),this.name="last",this.category="Positional",this.syntax="last in collection",this.description="Gets the last element from a collection",this.inputSchema=Kt,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.normalizeCollection(t.collection),a=i.length>0?i[i.length-1]:void 0,o={success:!0,value:a,type:Ut[this.inferResultTypeLocal(a)]};return this.trackPerformance(e,t,o,r),o}catch(n){const i=this.failure("LastExpressionError","runtime-error",`Last operation failed: ${n instanceof Error?n.message:String(n)}`,"LAST_OPERATION_FAILED");return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:`Invalid last input: ${e.message}`,suggestions:[]}))??[],suggestions:["Provide a collection parameter","Ensure collection is array, NodeList, or string"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}inferResultTypeLocal(e){return void 0===e?"Undefined":null===e?"Null":Qe(e)?"String":et(e)?"Number":tt(e)?"Boolean":Array.isArray(e)?"Array":e instanceof HTMLElement?"Element":"Object"}}class Jt extends St{constructor(){super(...arguments),this.name="at",this.category="Positional",this.syntax="collection[index] or collection at index",this.description="Gets element at specific index from a collection",this.inputSchema=Gt,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.normalizeCollection(t.collection),a=this.normalizeIndex(t.index,i.length),o=a>=0&&a<i.length?i[a]:void 0,s={success:!0,value:o,type:Ut[this.inferResultTypeLocal(o)]};return this.trackPerformance(e,t,s,r),s}catch(n){const i=this.failure("AtExpressionError","runtime-error",`At operation failed: ${n instanceof Error?n.message:String(n)}`,"AT_OPERATION_FAILED");return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:`Invalid at input: ${e.message}`,suggestions:[]}))??[],suggestions:["Provide collection and index parameters","Ensure index is a number"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}normalizeIndex(e,t){return e<0?t+e:e}inferResultTypeLocal(e){return void 0===e?"Undefined":null===e?"Null":Qe(e)?"String":et(e)?"Number":tt(e)?"Boolean":Array.isArray(e)?"Array":e instanceof HTMLElement?"Element":"Object"}}class Qt extends St{constructor(){super(...arguments),this.name="random",this.category="Positional",this.syntax="random in collection",this.description="Gets a random element from a collection",this.inputSchema=Yt,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.normalizeCollection(t.collection);if(0===i.length){const n={success:!0,value:void 0,type:"undefined"};return this.trackPerformance(e,t,n,r),n}const a=i[this.getSecureRandomIndex(i.length)],o={success:!0,value:a,type:Ut[this.inferResultTypeLocal(a)]};return this.trackPerformance(e,t,o,r),o}catch(n){const i=this.failure("RandomExpressionError","runtime-error",`Random operation failed: ${n instanceof Error?n.message:String(n)}`,"RANDOM_OPERATION_FAILED");return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:`Invalid random input: ${e.message}`,suggestions:[]}))??[],suggestions:["Provide a collection parameter","Ensure collection is array, NodeList, or string"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}getSecureRandomIndex(e){if("undefined"!=typeof crypto&&crypto.getRandomValues){const t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]%e}return Math.floor(Math.random()*e)}inferResultTypeLocal(e){return void 0===e?"Undefined":null===e?"Null":Qe(e)?"String":et(e)?"Number":tt(e)?"Boolean":Array.isArray(e)?"Array":e instanceof HTMLElement?"Element":"Object"}}new Xt,new Zt,new Jt,new Qt;const er={name:"first",category:"Reference",evaluatesTo:"Any",operators:["first"],async evaluate(e,t){const r=void 0!==t?t:e.it;if(null==r)return null;if(Array.isArray(r))return r.length>0?r[0]:null;if(r instanceof NodeList||r instanceof HTMLCollection)return r.length>0?r[0]:null;if(r instanceof Element)return r.children.length>0?r.children[0]:null;if(Qe(r)){return r.length>0?r[0]:null}if(rt(r)&&"length"in r&&et(r.length)){return r.length>0?r[0]:null}return null},validate:e=>Ht(e,1,"first","collection")},tr={name:"last",category:"Reference",evaluatesTo:"Any",operators:["last"],async evaluate(e,t){const r=void 0!==t?t:e.it;if(null==r)return null;if(Array.isArray(r))return r.length>0?r[r.length-1]:null;if(r instanceof NodeList||r instanceof HTMLCollection)return r.length>0?r[r.length-1]:null;if(r instanceof Element){const e=r.children;return e.length>0?e[e.length-1]:null}if(Qe(r)){return r.length>0?r[r.length-1]:null}if(rt(r)&&"length"in r&&et(r.length)){return r.length>0?r[r.length-1]:null}return null},validate:e=>Ht(e,1,"last","collection")},rr={name:"at",category:"Reference",evaluatesTo:"Any",operators:["at"],async evaluate(e,...t){const[r,n]=t;if(!et(r))throw new Error("Index must be a number");const i=r,a=void 0!==n?n:e.it;if(null==a)return null;if(Array.isArray(a)){const e=i<0?a.length+i:i;return e>=0&&e<a.length?a[e]:null}if(a instanceof NodeList||a instanceof HTMLCollection){const e=i<0?a.length+i:i;return e>=0&&e<a.length?a[e]:null}if(a instanceof Element){const e=a.children,t=i<0?e.length+i:i;return t>=0&&t<e.length?e[t]:null}if(Qe(a)){const e=i<0?a.length+i:i;return e>=0&&e<a.length?a[e]:null}if(rt(a)&&"length"in a&&et(a.length)){const e=i<0?a.length+i:i;return e>=0&&e<a.length?a[e]:null}return null},validate:e=>Ft(e,1,2,"at","index, optional collection")??function(e,t,r,n){if("number"!=typeof e[t])return`${r} ${n} must be a number`;return null}(e,0,"at","index")};function nr(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;const e=r.querySelector(t);if(e)return e;r=r.nextElementSibling}const n=e.parentElement;return n&&n!==document.documentElement?nr(n,t):null}function ir(e,t){let r=e.previousElementSibling;for(;r;){const e=Array.from(r.querySelectorAll(t)).reverse();if(e.length>0)return e[0];if(r.matches(t))return r;r=r.previousElementSibling}const n=e.parentElement;return n&&n!==document.documentElement?ir(n,t):null}function ar(e){let t=0,r=e;for(;r&&r.parentElement;){t+=Array.from(r.parentElement.children).indexOf(r),r=r.parentElement,t+=1e3}return t}const or={first:er,last:tr,at:rr,next:{name:"next",category:"Reference",evaluatesTo:"Element",operators:["next"],async evaluate(e,...t){const[r,n]=t,i=n||e.me;return i&&i instanceof Element?r?nr(i,r):i.nextElementSibling:null},validate(e){const t=Ht(e,2,"next","optional selector, optional fromElement");return t||(e.length>=1&&null!=e[0]&&"string"!=typeof e[0]?"selector must be a string":e.length>=2&&null!=e[1]&&!(e[1]instanceof Element)?"fromElement must be an Element":null)}},previous:{name:"previous",category:"Reference",evaluatesTo:"Element",operators:["previous","prev"],async evaluate(e,...t){const[r,n]=t,i=n||e.me;return i&&i instanceof Element?r?ir(i,r):i.previousElementSibling:null},validate(e){const t=Ht(e,2,"previous","optional selector, optional fromElement");return t||(e.length>=1&&null!=e[0]&&"string"!=typeof e[0]?"selector must be a string":e.length>=2&&null!=e[1]&&!(e[1]instanceof Element)?"fromElement must be an Element":null)}},nextWithin:{name:"nextWithin",category:"Reference",evaluatesTo:"Element",operators:["next within"],async evaluate(e,...t){const[r,n,i]=t,a=i||e.me;if(!(a&&a instanceof Element))return null;const o=a.closest(n);return o?function(e,t,r){const n=Array.from(r.querySelectorAll(t)),i=ar(e);for(const e of n){if(ar(e)>i)return e}return null}(a,r,o):null},validate(e){const t=Ft(e,2,3,"nextWithin","selector, withinSelector, optional fromElement");return t||("string"!=typeof e[0]?"selector must be a string":"string"!=typeof e[1]?"withinSelector must be a string":e.length>=3&&null!=e[2]&&!(e[2]instanceof Element)?"fromElement must be an Element":null)}},previousWithin:{name:"previousWithin",category:"Reference",evaluatesTo:"Element",operators:["previous within"],async evaluate(e,...t){const[r,n,i]=t,a=i||e.me;if(!(a&&a instanceof Element))return null;const o=a.closest(n);return o?function(e,t,r){const n=Array.from(r.querySelectorAll(t)),i=ar(e);for(let e=n.length-1;e>=0;e--){const t=n[e];if(ar(t)<i)return t}return null}(a,r,o):null},validate(e){const t=Ft(e,2,3,"previousWithin","selector, withinSelector, optional fromElement");return t||("string"!=typeof e[0]?"selector must be a string":"string"!=typeof e[1]?"withinSelector must be a string":e.length>=3&&null!=e[2]&&!(e[2]instanceof Element)?"fromElement must be an Element":null)}}};class sr{constructor(e=100,t=5e3){this.maxSize=e,this.ttl=t,this.cache=new Map,this.accessOrder=new Map,this.accessCounter=0}get(e){const t=this.cache.get(e);if(t){if(!(Date.now()-t.timestamp>this.ttl))return t.accessCount++,this.accessOrder.set(e,++this.accessCounter),t.result;this.delete(e)}}set(e,t){this.cache.size>=this.maxSize&&!this.cache.has(e)&&this.evictLRU();const r={result:t,timestamp:Date.now(),accessCount:1};this.cache.set(e,r),this.accessOrder.set(e,++this.accessCounter)}delete(e){return this.accessOrder.delete(e),this.cache.delete(e)}clear(){this.cache.clear(),this.accessOrder.clear(),this.accessCounter=0}size(){return this.cache.size}evictLRU(){let e,t=1/0;for(const[r,n]of this.accessOrder)n<t&&(t=n,e=r);void 0!==e&&this.delete(e)}getStats(){const e=Array.from(this.cache.values()),t=Date.now();return{size:this.cache.size,maxSize:this.maxSize,hitRate:e.length>0?e.filter(e=>e.accessCount>1).length/e.length:0,avgAge:e.length>0?e.reduce((e,r)=>e+(t-r.timestamp),0)/e.length:0,totalAccesses:e.reduce((e,t)=>e+t.accessCount,0)}}}const lr=new class{constructor(){this.domQueryCache=new sr(200,3e3),this.exprResultCache=new sr(500,2e3),this.cssMatchCache=new sr(100,5e3),this.formValueCache=new sr(50,1e3),this.hits=0,this.misses=0}querySelector(e){const t=`querySelector:${e}`,r=this.domQueryCache.get(t);if(void 0!==r)return this.hits++,r;this.misses++;const n=document.querySelector(e);return this.domQueryCache.set(t,n),n}querySelectorAll(e){const t=`querySelectorAll:${e}`,r=this.domQueryCache.get(t);if(void 0!==r)return this.hits++,r;this.misses++;const n=Array.from(document.querySelectorAll(e));return this.domQueryCache.set(t,n),n}getElementById(e){const t=`getElementById:${e}`,r=this.domQueryCache.get(t);if(void 0!==r)return this.hits++,r;this.misses++;const n=document.getElementById(e);return this.domQueryCache.set(t,n),n}getElementsByClassName(e){const t=`getElementsByClassName:${e}`,r=this.domQueryCache.get(t);if(void 0!==r)return this.hits++,r;this.misses++;const n=Array.from(document.getElementsByClassName(e));return this.domQueryCache.set(t,n),n}matches(e,t){const r=`matches:${this.getElementCacheKey(e)}:${t}`,n=this.cssMatchCache.get(r);if(void 0!==n)return this.hits++,n;this.misses++;const i=e.matches(t);return this.cssMatchCache.set(r,i),i}getExpressionResult(e){const t=this.exprResultCache.get(e);if(void 0!==t)return this.hits++,t;this.misses++}setExpressionResult(e,t){this.exprResultCache.set(e,t)}getFormValue(e){const t=this.getElementCacheKey(e),r=this.formValueCache.get(`formValue:${t}`);if(void 0!==r)return this.hits++,r;this.misses++}setFormValue(e,t){const r=this.getElementCacheKey(e);this.formValueCache.set(`formValue:${r}`,t)}invalidateElementCache(e){const t=this.getElementCacheKey(e);for(const e of[this.domQueryCache,this.cssMatchCache,this.formValueCache])for(const r of Array.from(e.cache.keys()))"string"==typeof r&&r.includes(t)&&e.delete(r)}invalidateAll(){this.domQueryCache.clear(),this.exprResultCache.clear(),this.cssMatchCache.clear(),this.formValueCache.clear(),this.hits=0,this.misses=0}getElementCacheKey(e){if(e.id)return`#${e.id}`;const t=Array.from(e.classList).sort().join("."),r=this.getElementPosition(e);return`${e.tagName.toLowerCase()}${t?"."+t:""}@${r}`}getElementPosition(e){return`${Array.from(e.parentElement?.children||[]).indexOf(e)}`}getPerformanceStats(){const e=this.hits+this.misses;return{hits:this.hits,misses:this.misses,hitRate:Math.round(100*(e>0?this.hits/e*100:0))/100,domQueryCache:this.domQueryCache.getStats(),exprResultCache:this.exprResultCache.getStats(),cssMatchCache:this.cssMatchCache.getStats(),formValueCache:this.formValueCache.getStats()}}cleanup(){const e=Date.now();[this.domQueryCache,this.exprResultCache,this.cssMatchCache,this.formValueCache].forEach(t=>{Array.from(t.cache.entries()).forEach(([r,n])=>{e-n.timestamp>t.ttl&&t.delete(r)})})}};"undefined"!=typeof window&&setInterval(()=>{lr.cleanup()},1e4);const cr=new class{constructor(){this.metrics={tokenizationTime:0,evaluationTime:0,cacheHitRate:0,memoryUsage:0,domOperations:0},this.startTimes=new Map}startTimer(e){this.startTimes.set(e,performance.now())}endTimer(e){const t=this.startTimes.get(e);if(t){const r=performance.now()-t;return this.startTimes.delete(e),r}return 0}recordTokenization(e){this.metrics.tokenizationTime+=e}recordEvaluation(e){this.metrics.evaluationTime+=e}updateCacheMetrics(){const e=lr.getPerformanceStats();this.metrics.cacheHitRate=e.hitRate}getMetrics(){return this.updateCacheMetrics(),{...this.metrics}}reset(){this.metrics={tokenizationTime:0,evaluationTime:0,cacheHitRate:0,memoryUsage:0,domOperations:0}}};function ur(){lr.cleanup();cr.getMetrics().memoryUsage>52428800&&cr.reset()}let pr=null;"undefined"!=typeof window&&function(e=3e4){pr&&clearInterval(pr),pr=setInterval(ur,e)}();const mr=wt({left:zt().describe("Left operand value"),right:zt().describe("Right operand value")}).strict(),dr=wt({operand:zt().describe("Operand value to negate")}).strict();class hr extends St{constructor(){super(...arguments),this.name="and",this.category="Logical",this.syntax="left and right",this.description="Logical AND operation with comprehensive boolean type coercion",this.inputSchema=mr,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.toBoolean(t.left);if(!i)return this.trackSimple(e,r,!0,"boolean"),this.success(!1,"boolean");const a=this.toBoolean(t.right),o=i&&a;return this.trackSimple(e,r,!0,"boolean"),this.success(o,"boolean")}catch(t){return this.trackSimple(e,r,!1),this.failure("AndExpressionError","runtime-error",`Logical AND operation failed: ${t instanceof Error?t.message:String(t)}`,"AND_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:`Invalid AND operation input: ${e.message}`,suggestions:[]}))??[],suggestions:["Provide both left and right operands","Ensure operands are valid values"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}class fr extends St{constructor(){super(...arguments),this.name="or",this.category="Logical",this.syntax="left or right",this.description="Logical OR operation with comprehensive boolean type coercion",this.inputSchema=mr,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.toBoolean(t.left);if(i)return this.trackSimple(e,r,!0,"boolean"),this.success(!0,"boolean");const a=this.toBoolean(t.right),o=i||a;return this.trackSimple(e,r,!0,"boolean"),this.success(o,"boolean")}catch(t){return this.trackSimple(e,r,!1),this.failure("OrExpressionError","runtime-error",`Logical OR operation failed: ${t instanceof Error?t.message:String(t)}`,"OR_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:`Invalid OR operation input: ${e.message}`,suggestions:[]}))??[],suggestions:["Provide both left and right operands","Ensure operands are valid values"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}class yr extends St{constructor(){super(...arguments),this.name="not",this.category="Logical",this.syntax="not operand",this.description="Logical NOT operation with comprehensive boolean type coercion",this.inputSchema=dr,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=!this.toBoolean(t.operand);return this.trackSimple(e,r,!0,"boolean"),this.success(i,"boolean")}catch(t){return this.trackSimple(e,r,!1),this.failure("NotExpressionError","runtime-error",`Logical NOT operation failed: ${t instanceof Error?t.message:String(t)}`,"NOT_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:`Invalid NOT operation input: ${e.message}`,suggestions:[]}))??[],suggestions:["Provide a single operand","Ensure operand is a valid value"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}new hr,new fr,new yr;const vr=bt([zt(),zt()]),gr=bt([zt(),vt()]),kr={name:"equals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["is","==","equals"],async evaluate(e,t,r){const n=Date.now();try{return it(this,e,[t,r],t==r,n)}catch(i){throw it(this,e,[t,r],!1,n,!1,i instanceof Error?i:new Error(String(i))),i}},validate:e=>Dt(e,"equals"),inputSchema:vr,metadata:{category:"Logical",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"value is 5",description:"Check if value equals 5 using loose equality",expectedOutput:!0,context:{result:5}},{input:'"5" == 5',description:'String "5" equals number 5 with type coercion',expectedOutput:!0}],relatedExpressions:["strictEquals","notEquals"],performance:{averageTime:.001,complexity:"O(1)"}},documentation:{summary:"Compares two values for loose equality, allowing type coercion",parameters:[{name:"left",type:"unknown",description:"Left operand for comparison",optional:!1,examples:["5",'"hello"',"true","null"]},{name:"right",type:"unknown",description:"Right operand for comparison",optional:!1,examples:["5",'"hello"',"true","null"]}],returns:{type:"Boolean",description:"True if values are loosely equal, false otherwise",examples:["true","false"]},examples:[{title:"Basic equality check",code:"if my.value is 10",explanation:"Check if element value equals 10",output:"Boolean result"},{title:"Type coercion",code:'if "5" == 5',explanation:'String "5" equals number 5 with automatic type conversion',output:"true"},{title:"Null checks",code:"if value is null",explanation:"Check if value is null or undefined",output:"Boolean result"}],seeAlso:["strictEquals","notEquals","matches"],tags:["comparison","equality","logic","type-coercion"]}},wr={name:"strictEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["==="],evaluate:async(e,t,r)=>t===r,validate:e=>Dt(e,"strictEquals")},br={name:"notEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["!=","is not","does not equal"],evaluate:async(e,t,r)=>t!=r,validate:e=>Dt(e,"notEquals")},zr={name:"strictNotEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["!=="],evaluate:async(e,t,r)=>t!==r,validate:e=>Dt(e,"strictNotEquals")},xr={name:"lessThan",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:["<","is less than"],evaluate:async(e,t,r)=>t<r,validate:e=>Dt(e,"lessThan")},Er={name:"lessThanOrEqual",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:["<=","is less than or equal to"],evaluate:async(e,t,r)=>t<=r,validate:e=>Dt(e,"lessThanOrEqual")},Sr={name:"greaterThan",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:[">","is greater than"],evaluate:async(e,t,r)=>t>r,validate:e=>Dt(e,"greaterThan")},Tr={name:"greaterThanOrEqual",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:[">=","is greater than or equal to"],evaluate:async(e,t,r)=>t>=r,validate:e=>Dt(e,"greaterThanOrEqual")},Cr={name:"and",category:"Logical",evaluatesTo:"Boolean",precedence:6,associativity:"Left",operators:["and","&&"],async evaluate(e,t,r){const n=Date.now();try{return it(this,e,[t,r],t&&r,n)}catch(i){throw it(this,e,[t,r],!1,n,!1,i instanceof Error?i:new Error(String(i))),i}},validate:e=>Dt(e,"and"),inputSchema:vr,metadata:{category:"Logical",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"true and false",description:"Logical AND of boolean values",expectedOutput:!1},{input:"name and age",description:"Both name and age must be truthy",expectedOutput:!0,context:{variables:new Map([["name","John"],["age",25]])}}],relatedExpressions:["or","not"],performance:{averageTime:.001,complexity:"O(1)"}},documentation:{summary:"Logical AND operation that returns true only if both operands are truthy",parameters:[{name:"left",type:"unknown",description:"Left operand (evaluated for truthiness)",optional:!1,examples:["true","name","5",'"hello"']},{name:"right",type:"unknown",description:"Right operand (evaluated for truthiness)",optional:!1,examples:["false","age","0",'""']}],returns:{type:"Boolean",description:"True if both operands are truthy, false otherwise",examples:["true","false"]},examples:[{title:"Form validation",code:"if name and email",explanation:"Check if both name and email have values",output:"Boolean result"},{title:"Multiple conditions",code:"if age > 18 and hasLicense",explanation:"Combine multiple conditions",output:"Boolean result"},{title:"Short-circuit evaluation",code:"if element and element.value",explanation:"Check element exists before accessing properties",output:"Boolean result"}],seeAlso:["or","not","exists"],tags:["logic","boolean","conditions","validation"]}},Ar={name:"or",category:"Logical",evaluatesTo:"Boolean",precedence:5,associativity:"Left",operators:["or","||"],evaluate:async(e,t,r)=>t||r,validate:e=>Dt(e,"or")},Lr={name:"not",category:"Logical",evaluatesTo:"Boolean",precedence:15,associativity:"Right",operators:["not","!"],evaluate:async(e,t)=>!t,validate:e=>$t(e,1,"not","operand")},jr={name:"isEmpty",category:"Logical",evaluatesTo:"Boolean",operators:["is empty","isEmpty"],evaluate:async(e,t)=>null==t||(Qe(t)||Array.isArray(t)||t instanceof NodeList?0===t.length:!(t instanceof Node||t instanceof Element)&&(!!rt(t)&&0===Object.keys(t).length)),validate:e=>$t(e,1,"isEmpty","value")},Pr={name:"no",category:"Logical",evaluatesTo:"Boolean",operators:["no"],evaluate:async(e,t)=>null==t||(!1===t||(Array.isArray(t)||t instanceof NodeList?0===t.length:!Qe(t)&&(!(t instanceof Node||t instanceof Element)&&(!!rt(t)&&0===Object.keys(t).length)))),validate:e=>$t(e,1,"no","value")},Nr={name:"isNotEmpty",category:"Logical",evaluatesTo:"Boolean",operators:["is not empty","isNotEmpty"],evaluate:async(e,t)=>!await jr.evaluate(e,t),validate:e=>$t(e,1,"isNotEmpty","value")},Or={name:"exists",category:"Logical",evaluatesTo:"Boolean",operators:["exists"],evaluate:async(e,t)=>null!=t,validate:e=>$t(e,1,"exists","value")},Ir={name:"doesNotExist",category:"Logical",evaluatesTo:"Boolean",operators:["does not exist","doesNotExist"],evaluate:async(e,t)=>null==t,validate:e=>$t(e,1,"doesNotExist","value")},Rr={name:"contains",category:"Logical",evaluatesTo:"Boolean",operators:["contains","includes","include"],async evaluate(e,t,r){if(t&&r){if(1===t.nodeType&&1===r.nodeType)return t.contains(r);if(Qe(t)&&t.match(/^[.#][\w-]+$/)){const e=document.querySelector(t);if(e&&1===r.nodeType)return e.contains(r);if(e&&Qe(r)&&r.match(/^[.#][\w-]+$/)){const t=document.querySelector(r);return!!t&&e.contains(t)}}if(Qe(r)&&r.match(/^[.#][\w-]+$/)&&1===t.nodeType){const e=document.querySelector(r);return!!e&&t.contains(e)}}return Qe(t)&&Qe(r)||Array.isArray(t)?t.includes(r):"undefined"!=typeof NodeList&&t instanceof NodeList?Array.from(t).includes(r):!(!rt(t)||!Qe(r))&&r in t},validate:e=>$t(e,2,"contains","container, value")},Mr={name:"doesNotContain",category:"Logical",evaluatesTo:"Boolean",operators:["does not contain","doesNotContain","does not include","doesNotInclude"],evaluate:async(e,t,r)=>!await Rr.evaluate(e,t,r),validate:e=>$t(e,2,"doesNotContain","container, value")},qr={name:"startsWith",category:"Logical",evaluatesTo:"Boolean",operators:["starts with","startsWith"],evaluate:async(e,t,r)=>!(!Qe(t)||!Qe(r))&&t.startsWith(r),validate:e=>$t(e,2,"startsWith","str, prefix")},_r={name:"endsWith",category:"Logical",evaluatesTo:"Boolean",operators:["ends with","endsWith"],evaluate:async(e,t,r)=>!(!Qe(t)||!Qe(r))&&t.endsWith(r),validate:e=>$t(e,2,"endsWith","str, suffix")},$r={name:"matches",category:"Logical",evaluatesTo:"Boolean",operators:["matches"],async evaluate(e,t,r){const n=Date.now();try{let i;if(t instanceof Element&&Qe(r)){const e=r;if(e.startsWith(".")||e.startsWith("#")||e.startsWith(":")||e.startsWith("[")||/^[a-zA-Z][\w-]*$/.test(e))try{i=function(e,t){return lr.matches(e,t)}(t,e)}catch(e){i=!1}else i=!1}else if(Qe(t)&&Qe(r)){const e=t,n=r;try{i=(n.startsWith("/")&&n.endsWith("/")?new RegExp(n.slice(1,-1)):new RegExp(n)).test(e)}catch(t){i=e.includes(n)}}else i=!1;return it(this,e,[t,r],i,n)}catch(i){throw it(this,e,[t,r],!1,n,!1,i instanceof Error?i:new Error(String(i))),i}},validate:e=>$t(e,2,"matches","element, selector"),inputSchema:gr,metadata:{category:"Logical",complexity:"medium",sideEffects:["dom-query"],dependencies:[],returnTypes:["Boolean"],examples:[{input:'element matches ".active"',description:"Check if element has active class",expectedOutput:!0},{input:'text matches "/^hello/"',description:'Check if text starts with "hello" using regex',expectedOutput:!0,context:{variables:new Map([["text","hello world"]])}}],relatedExpressions:["contains","startsWith","endsWith"],performance:{averageTime:.5,complexity:"O(n)"}},documentation:{summary:"Tests if element matches CSS selector or string matches regex pattern",parameters:[{name:"element",type:"Element | string",description:"DOM element or string to test",optional:!1,examples:["<div>",'"hello world"',"me","target"]},{name:"selector",type:"string",description:"CSS selector or regex pattern to match against",optional:!1,examples:['".active"','"#navbar"','"/^hello/"','"\\\\d+"']}],returns:{type:"Boolean",description:"True if element matches selector/pattern",examples:["true","false"]},examples:[{title:"CSS class matching",code:'if me matches ".active"',explanation:'Check if current element has "active" class',output:"Boolean result"},{title:"Attribute matching",code:'if target matches "[data-role=\\"button\\"]"',explanation:"Check if element has specific data attribute",output:"Boolean result"},{title:"Regex pattern matching",code:'if email matches "/^[^@]+@[^@]+\\\\.[^@]+$/"',explanation:"Validate email format with regex",output:"Boolean result"},{title:"Complex CSS selector",code:'if element matches ".card:hover .button"',explanation:"Match complex CSS selector with pseudo-classes",output:"Boolean result"}],seeAlso:["contains","startsWith","endsWith","querySelector"],tags:["pattern","css","regex","validation","dom"]}},Wr={equals:kr,strictEquals:wr,notEquals:br,strictNotEquals:zr,lessThan:xr,lessThanOrEqual:Er,greaterThan:Sr,greaterThanOrEqual:Tr,and:Cr,or:Ar,not:Lr,no:Pr,isEmpty:jr,isNotEmpty:Nr,exists:Or,doesNotExist:Ir,contains:Rr,doesNotContain:Mr,startsWith:qr,endsWith:_r,matches:$r};const Vr=wt({selector:vt().min(1),single:kt().optional().default(!1)});new class extends St{constructor(){super(...arguments),this.name="me",this.category="Reference",this.syntax="me",this.description="References the current element in the execution context",this.inputSchema=Et(),this.outputType="Element",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=e.me,i=this.isElement(n)?n:null,a=this.success(i,"element");return this.trackPerformance(e,t,a,r),a}catch(n){const i=this.failure("MeExpressionError","runtime-error",n instanceof Error?n.message:'Failed to evaluate "me"',"ME_EVALUATION_FAILED",["Ensure element context is properly set",'Check if "me" is available in current scope']);return this.trackPerformance(e,t,i,r),i}}validate(e){return void 0!==e?this.validationFailure("type-mismatch",'"me" expression takes no arguments',['Use "me" without any parameters']):this.validationSuccess()}},new class extends St{constructor(){super(...arguments),this.name="you",this.category="Reference",this.syntax="you",this.description="References the target element (usually event target or command target)",this.inputSchema=Et(),this.outputType="Element",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=e.you,i=this.isElement(n)?n:null,a=this.success(i,"element");return this.trackPerformance(e,t,a,r),a}catch(n){const i=this.failure("YouExpressionError","runtime-error",n instanceof Error?n.message:'Failed to evaluate "you"',"YOU_EVALUATION_FAILED",["Ensure target element is available in context",'Check if "you" is set by event or command']);return this.trackPerformance(e,t,i,r),i}}validate(e){return void 0!==e?this.validationFailure("type-mismatch",'"you" expression takes no arguments',['Use "you" without any parameters']):this.validationSuccess()}},new class extends St{constructor(){super(...arguments),this.name="it",this.category="Reference",this.syntax="it",this.description="References the current context variable (result of previous operation or loop item)",this.inputSchema=Et(),this.outputType="Any",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=e.it,i={success:!0,value:n,type:this.inferType(n)};return this.trackPerformance(e,t,i,r),i}catch(n){const i=this.failure("ItExpressionError","runtime-error",n instanceof Error?n.message:'Failed to evaluate "it"',"IT_EVALUATION_FAILED",['Ensure "it" is set by previous operation',"Check if context variable is available"]);return this.trackPerformance(e,t,i,r),i}}validate(e){return void 0!==e?this.validationFailure("type-mismatch",'"it" expression takes no arguments',['Use "it" without any parameters']):this.validationSuccess()}},new class extends St{constructor(){super(...arguments),this.name="css-selector",this.category="Reference",this.syntax="<selector/> or <selector/> (single)",this.description="Queries DOM elements using CSS selectors with validation",this.inputSchema=Vr,this.outputType="ElementList",this.metadata={category:"Reference",complexity:"medium"}}async evaluate(e,t){const r=Date.now();try{if(!this.isValidCSSSelector(t.selector)){const n=this.failure("CSSSelectorError","invalid-argument",`Invalid CSS selector: "${t.selector}"`,"INVALID_CSS_SELECTOR",["Check selector syntax","Use valid CSS selector patterns like .class, #id, tag[attr]","Avoid special characters that need escaping"]);return this.trackPerformance(e,t,n,r),n}let n;if(t.single){n=document.querySelector(t.selector)}else{const e=Array.from(document.querySelectorAll(t.selector));n=e.length>0?e:null}const i={success:!0,value:n,type:Array.isArray(n)?"element-list":"element"};return this.trackPerformance(e,t,i,r),i}catch(n){const i=this.failure("CSSSelectorError","runtime-error",n instanceof Error?n.message:"CSS selector evaluation failed","CSS_SELECTOR_EVALUATION_FAILED",["Check if selector is valid CSS","Ensure DOM is ready when query executes","Verify elements exist in document"]);return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);if(!t.success)return{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:`Invalid input: ${e.message}`,suggestions:this.getValidationSuggestion(e.code??"unknown")}))??[],suggestions:["Provide valid CSS selector string","Check selector syntax"]};const{selector:r}=t.data;return this.isValidCSSSelector(r)?this.validationSuccess():this.validationFailure("syntax-error",`Invalid CSS selector syntax: "${r}"`,["Use .class for class selectors","Use #id for ID selectors","Use tag for element selectors","Use [attr] for attribute selectors"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Ensure input matches expected format"])}}isValidCSSSelector(e){try{return document.querySelector(e),!0}catch{return!1}}getValidationSuggestion(e){return[{too_small:"CSS selector cannot be empty",invalid_type:"Selector must be a string",required:"CSS selector is required"}[e]||"Check input format and types"]}};const Dr={me:{name:"me",category:"Reference",evaluatesTo:"Element",evaluate:async e=>e.me instanceof HTMLElement?e.me:null,validate:Bt},you:{name:"you",category:"Reference",evaluatesTo:"Element",evaluate:async e=>e.you instanceof HTMLElement?e.you:null,validate:Bt},it:{name:"it",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.it,validate:Bt},its:{name:"its",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.it,validate:Bt},result:{name:"result",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.result,validate:Bt},querySelector:{name:"querySelector",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){const[r]=t;if("string"!=typeof r)throw new Error("querySelector requires a string selector");return document.querySelector(r)},validate:e=>Vt(e,"querySelector","selector")},querySelectorAll:{name:"querySelectorAll",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const r=t[0];if("string"!=typeof r)throw new Error("querySelectorAll requires a string selector");const n=document.querySelectorAll(r);return Array.from(n)},validate:e=>Vt(e,"querySelectorAll","selector")},getElementById:{name:"getElementById",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){const r=t[0];if("string"!=typeof r)throw new Error("getElementById requires a string ID");return document.getElementById(r)},validate:e=>Vt(e,"getElementById","ID")},getElementsByClassName:{name:"getElementsByClassName",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const r=t[0];if("string"!=typeof r)throw new Error("getElementsByClassName requires a string class name");const n=document.getElementsByClassName(r);return Array.from(n)},validate:e=>Vt(e,"getElementsByClassName","className")},closest:{name:"closest",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){let r=t[0];if(r&&"object"==typeof r&&"type"in r){const e=r;"identifier"===e.type&&e.name?r=e.name:"literal"===e.type&&"string"==typeof e.value&&(r=e.value)}if("string"!=typeof r)throw new Error("closest requires a string selector");return e.me?e.me.closest(r):null},validate(e){if(1!==e.length)return"closest requires exactly 1 argument (selector)";const t=e[0];if("string"==typeof t)return null;if(t&&"object"==typeof t&&"type"in t){if("identifier"===t.type||"literal"===t.type)return null}return"closest selector must be a string or identifier"}},parent:{name:"parent",category:"Reference",evaluatesTo:"Element",evaluate:async e=>e.me?e.me.parentElement:null,validate:Bt},window:{name:"window",category:"Reference",evaluatesTo:"Object",evaluate:async e=>window,validate:Bt},document:{name:"document",category:"Reference",evaluatesTo:"Object",evaluate:async e=>document,validate:Bt},elementWithSelector:{name:"elementWithSelector",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const r=t[0];if("string"!=typeof r)throw new Error("Selector must be a string");const n=document.querySelectorAll(r);return Array.from(n)},validate:e=>Vt(e,"elementWithSelector","selector")},styleRef:{name:"styleRef",category:"Reference",evaluatesTo:"String",async evaluate(e,...t){const r=t[0],n=t[1];if("string"!=typeof r)throw new Error("StyleRef requires a string property name");const i=n||e.me;if(!(i&&i instanceof HTMLElement))return;if(r.startsWith("computed-")){const e=r.substring(9);return getComputedStyle(i).getPropertyValue(e)||""}return i.style.getPropertyValue(r)||void 0},validate:e=>Ft(e,1,2,"styleRef","property, optional element")??Wt(e,0,"styleRef","property")??(2===e.length&&e[1]&&"object"!=typeof e[1]?"styleRef element must be an HTMLElement":null)},possessiveStyleRef:{name:"possessiveStyleRef",category:"Reference",evaluatesTo:"String",async evaluate(e,...t){const r=t[0],n=t[1];if("string"!=typeof r||"string"!=typeof n)throw new Error("Possessive styleRef requires possessor and property strings");let i=null;if("my"===r&&e.me?i=e.me instanceof HTMLElement?e.me:null:"its"===r&&e.result&&(i=e.result),!i)return;if(n.startsWith("computed-")){const e=n.substring(9);return getComputedStyle(i).getPropertyValue(e)||""}return i.style.getPropertyValue(n)||void 0},validate:e=>$t(e,2,"possessiveStyleRef","possessor, property")??Wt(e,0,"possessiveStyleRef","possessor")??Wt(e,1,"possessiveStyleRef","property")},ofStyleRef:{name:"ofStyleRef",category:"Reference",evaluatesTo:"String",async evaluate(e,...t){const r=t[0],n=t[1];if("string"!=typeof r||"string"!=typeof n)throw new Error("Of styleRef requires property and reference strings");let i=null;if("me"===n&&e.me?i=e.me instanceof HTMLElement?e.me:null:"it"===n&&e.result&&(i=e.result),!i)return;if(r.startsWith("computed-")){const e=r.substring(9);return getComputedStyle(i).getPropertyValue(e)||""}return i.style.getPropertyValue(r)||void 0},validate:e=>$t(e,2,"ofStyleRef","property, reference")??Wt(e,0,"ofStyleRef","property")??Wt(e,1,"ofStyleRef","reference")}};function Br(e,t,r,n,i="runtime-error"){return{success:!1,error:{name:`${e}ConversionError`,type:i,message:r,code:t,suggestions:n}}}function Hr(e,t){return{success:!0,value:e,type:t}}function Fr(e,t){return`${e}: ${t instanceof Error?t.message:String(t)}`}const Ur={Array:(e,t)=>{try{return Array.isArray(e)?Hr(e,"array"):e instanceof NodeList?Hr(Array.from(e),"array"):Hr(null==e?[]:[e],"array")}catch(e){return Br("Array","ARRAY_CONVERSION_FAILED",Fr("Failed to convert value to Array",e),["Check if value is iterable","Ensure value is not circular reference"])}},String:(e,t)=>{try{return null==e?Hr("","string"):Qe(e)?Hr(e,"string"):rt(e)?Hr(JSON.stringify(e),"string"):Hr(String(e),"string")}catch(e){return Br("String","STRING_CONVERSION_FAILED",Fr("Failed to convert value to String",e),["Check if object has circular references","Ensure value is serializable"])}},Boolean:(e,t)=>{try{if(tt(e))return Hr(e,"boolean");if(null==e)return Hr(!1,"boolean");if(Qe(e)){const t=e.toLowerCase().trim();return Hr("false"!==t&&"0"!==t&&""!==t,"boolean")}return et(e)?Hr(0!==e&&!isNaN(e),"boolean"):Hr(Boolean(e),"boolean")}catch(e){return Br("Boolean","BOOLEAN_CONVERSION_FAILED",Fr("Failed to convert value to Boolean",e),["Use explicit true/false values","Check for unexpected data types"])}},Number:(e,t)=>{try{if(et(e))return Hr(e,"number");if(null==e)return Hr(0,"number");const t=Number(e);return isNaN(t)?Br("Number","INVALID_NUMBER",`Cannot convert "${e}" to a valid number`,["Check if value contains non-numeric characters","Use a valid numeric format"],"invalid-argument"):Hr(t,"number")}catch(e){return Br("Number","NUMBER_CONVERSION_FAILED",Fr("Failed to convert value to Number",e),["Ensure value is convertible to number","Check for special characters"])}},Int:(e,t)=>{const r=Ur.Number(e,t);return r.success?Hr(Math.trunc(r.value),"number"):r},Float:(e,t)=>{const r=Ur.Number(e,t);return r.success?Hr(parseFloat(r.value.toString()),"number"):r},Date:(e,t)=>{try{if(e instanceof Date)return Hr(e,"object");if(null==e)return Hr(new Date(""),"object");if(Qe(e)&&/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,r,n]=e.split("-").map(Number);return Hr(new Date(t,r-1,n),"object")}const t=new Date(e);return isNaN(t.getTime())?Br("Date","INVALID_DATE",`Cannot convert "${e}" to a valid date`,["Use ISO 8601 format (YYYY-MM-DD)","Check date string format","Ensure date values are valid"],"invalid-argument"):Hr(t,"object")}catch(e){return Br("Date","DATE_CONVERSION_FAILED",Fr("Failed to convert value to Date",e),["Check date format","Ensure value is a valid date string or timestamp"])}},JSON:(e,t)=>{try{return Hr(JSON.stringify(e),"string")}catch(e){return Br("JSON","JSON_STRINGIFY_FAILED",Fr("Failed to convert value to JSON",e),["Check for circular references","Ensure all properties are serializable","Remove functions and undefined values"])}},Object:(e,t)=>{try{if(rt(e))return Hr(e,"object");if(Qe(e))try{return Hr(JSON.parse(e),"object")}catch(e){return Br("Object","JSON_PARSE_FAILED",Fr("Cannot parse JSON string",e),["Check JSON syntax","Ensure proper escaping of quotes","Validate JSON format"],"syntax-error")}return Hr({},"object")}catch(e){return Br("Object","OBJECT_CONVERSION_FAILED",Fr("Failed to convert value to Object",e),["Ensure value is valid JSON string or object","Check for syntax errors"])}},Values:(e,t)=>{try{if(e instanceof HTMLFormElement)return Hr(function(e){const t={};return e.querySelectorAll("input, select, textarea").forEach(e=>{const r=e;if(r.name){const e=Yr(r);void 0!==e&&(void 0!==t[r.name]?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(e)):t[r.name]=e)}}),t}(e),"object");if(e instanceof HTMLElement){const t=e.querySelectorAll("input, select, textarea"),r={};return t.forEach(e=>{const t=e;if(t.name){const e=Yr(t);void 0!==e&&(r[t.name]=e)}}),Hr(r,"object")}return Hr({},"object")}catch(e){return Br("FormValues","FORM_VALUES_EXTRACTION_FAILED",Fr("Failed to extract form values",e),["Ensure element is a form or contains form inputs","Check form structure","Verify input names are set"])}}},Kr=wt({value:xt(),type:vt().min(1)});const Gr=wt({value:xt(),type:vt().min(1)});function Yr(e){if(e instanceof HTMLInputElement)switch(e.type){case"checkbox":return e.checked;case"radio":return e.checked?e.value:void 0;case"number":case"range":return e.valueAsNumber;case"date":case"datetime-local":return e.valueAsDate;case"file":return e.files;default:return e.value}return e instanceof HTMLSelectElement&&e.multiple?Array.from(e.selectedOptions).map(e=>e.value):e.value}new class extends St{constructor(){super(...arguments),this.name="as",this.category="Conversion",this.syntax="value as Type",this.description='Converts values between different types using the "as" keyword',this.outputType="Any",this.inputSchema=Kr,this.metadata={category:"Conversion",complexity:"medium",sideEffects:[],dependencies:[],returnTypes:["Any"],examples:[{input:'"123" as Int',description:"Convert string to integer",expectedOutput:123},{input:"form as Values",description:"Extract form values as object",expectedOutput:{name:"John",age:"25"}},{input:"[1,2,3] as JSON",description:"Convert array to JSON string",expectedOutput:"[1,2,3]"},{input:'"2023-12-25" as Date',description:"Parse date string",expectedOutput:new Date(2023,11,25)}],relatedExpressions:["is","Object","Array"],performance:{averageTime:1,complexity:"O(n)"}},this.documentation={summary:'Converts values between different types using the "as" keyword with comprehensive type safety',parameters:[{name:"value",type:"object",description:"The value to convert",optional:!1,examples:['"123"',"form","[1,2,3]","true","null"]},{name:"type",type:"string",description:"Target conversion type",optional:!1,examples:["Int","String","Boolean","Array","JSON","Object","Date","Values","HTML","Fragment"]}],returns:{type:"object",description:"Structured result with converted value or detailed error information",examples:['{ success: true, value: 123, type: "number" }',"{ success: false, error: { ... } }"]},examples:[{title:"String to number conversion",code:"if my.value as Int > 100",explanation:"Convert form input to integer for comparison",output:"Boolean result"},{title:"Form data extraction",code:"put closest <form /> as Values into result",explanation:"Extract all form values as structured object",output:'{ name: "John", age: "25", ... }'},{title:"Array to JSON serialization",code:"put items as JSON into storage",explanation:"Convert array to JSON string for storage",output:'"[1,2,3]"'},{title:"Date parsing with validation",code:"put my.dateInput as Date into event.detail.date",explanation:"Parse date input with automatic validation",output:"Date object or validation error"},{title:"Boolean conversion with smart parsing",code:'if "false" as Boolean then hide else show',explanation:"Parse string boolean values correctly",output:"false (not true like naive conversion)"}],seeAlso:["is","Values","JSON","Array","Object"],tags:["conversion","types","validation","forms","json","parsing"]}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:{name:"AsExpressionValidationError",type:"validation-error",message:n.errors[0]?.message||"Invalid input",code:"VALIDATION_FAILED",suggestions:n.suggestions}};const{value:i,type:a}=t;if(a.startsWith("Fixed")){const n=a.match(/^Fixed:(\d+)$/),o=n?parseInt(n[1],10):2,s=Ur.Number(i,e);if(!s.success)return s;const l={success:!0,value:s.value.toFixed(o),type:"string"};return this.trackPerformance(e,t,l,r),l}let o=Ur[a];if(o){const n=o(i,e);return this.trackPerformance(e,t,n,r),n}const s=a.toLowerCase(),l={boolean:"Boolean",bool:"Boolean",string:"String",str:"String",number:"Number",num:"Number",int:"Int",integer:"Int",float:"Float",array:"Array",object:"Object",obj:"Object",date:"Date",json:"JSON"}[s];if(l&&(o=Ur[l],o)){const n=o(i,e);return this.trackPerformance(e,t,n,r),n}const c={success:!1,error:{name:"UnknownConversionTypeError",type:"validation-error",message:`Unknown conversion type: ${a}`,code:"UNKNOWN_CONVERSION_TYPE",suggestions:["Use supported types: String, Number, Boolean, Array, Object, Date, JSON, Values","Check type spelling and capitalization","See documentation for complete list of conversion types"]}};return this.trackPerformance(e,t,c,r),c}catch(n){const i={success:!1,error:{name:"AsExpressionError",type:"runtime-error",message:`Conversion failed: ${n instanceof Error?n.message:String(n)}`,code:"CONVERSION_FAILED",suggestions:["Check value and type compatibility","Ensure value is convertible to target type"]}};return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?{isValid:!0,errors:[],suggestions:[]}:{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:e.message,suggestions:[`Expected valid input structure, got: ${e.code}`]}))??[],suggestions:["Provide both value and type parameters","Ensure type is a non-empty string","Check parameter structure: { value: any, type: string }"]}}catch(e){return this.validationFailure("runtime-error","Validation failed",["Check input structure"])}}},new class extends St{constructor(){super(...arguments),this.name="is",this.category="Conversion",this.syntax="value is Type",this.description="Checks if a value is of a specific type",this.outputType="Boolean",this.inputSchema=Gr,this.metadata={category:"Conversion",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"42 is number",description:"Check if value is a number",expectedOutput:!0},{input:"null is empty",description:"Check if value is empty/null",expectedOutput:!0},{input:"element is Element",description:"Check if value is DOM element",expectedOutput:!0,context:{element:"<div>...</div>"}}],relatedExpressions:["as","empty","exists"],performance:{averageTime:.1,complexity:"O(1)"}},this.documentation={summary:"Checks if a value is of a specific type with comprehensive type detection",parameters:[{name:"value",type:"object",description:"The value to check",optional:!1,examples:["42","null","element",'"text"',"[]"]},{name:"type",type:"string",description:"Type name to check against",optional:!1,examples:["number","string","boolean","array","object","element","empty","null"]}],returns:{type:"object",description:"Boolean result indicating type match",examples:['{ success: true, value: true, type: "boolean" }']},examples:[{title:"Number validation",code:"if my.age is number then proceed",explanation:"Check if form input is valid number",output:"Boolean result"},{title:"Empty check",code:"if result is empty then show message",explanation:"Check if result is null, undefined, or empty",output:"Boolean result"},{title:"Element validation",code:"if target is element then addClass",explanation:"Ensure target is valid DOM element before manipulation",output:"Boolean result"}],seeAlso:["as","empty","exists","null"],tags:["validation","types","checking","guards"]}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:{name:"IsExpressionValidationError",type:"validation-error",message:n.errors[0]?.message||"Invalid input",code:"VALIDATION_FAILED",suggestions:n.suggestions}};const{value:i,type:a}=t,o=a.toLowerCase();let s;switch(o){case"null":s=null===i;break;case"undefined":s=void 0===i;break;case"string":s=Qe(i);break;case"number":s=et(i)&&!isNaN(i);break;case"boolean":s=tt(i);break;case"object":s=rt(i);break;case"array":s=Array.isArray(i);break;case"function":s=nt(i);break;case"date":s=i instanceof Date;break;case"element":s=i instanceof Element;break;case"node":s=i instanceof Node;break;case"node-list":s=i instanceof NodeList;break;case"empty":s=null==i||""===i||Array.isArray(i)&&0===i.length||rt(i)&&0===Object.keys(i).length;break;default:s=i?.constructor?.name?.toLowerCase()===o}const l=this.success(s,"boolean");return this.trackPerformance(e,t,l,r),l}catch(n){const i=this.failure("IsExpressionError","type-mismatch",`Type check failed: ${n instanceof Error?n.message:String(n)}`,"TYPE_CHECK_FAILED",["Check type name spelling","Ensure value is accessible"]);return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:e.message,suggestions:[`Expected valid input structure, got: ${e.code}`]}))??[],suggestions:["Provide both value and type parameters","Ensure type is a non-empty string","Check parameter structure: { value: any, type: string }"]}}catch(e){return this.validationFailure("runtime-error","Validation failed",["Check input structure"])}}};const Xr={Array:e=>Array.isArray(e)?e:e instanceof NodeList?Array.from(e):null==e?[]:[e],String:e=>null==e?"":Qe(e)?e:rt(e)?JSON.stringify(e):String(e),Boolean:e=>{if(tt(e))return e;if(null==e)return!1;if(Qe(e)){const t=e.toLowerCase().trim();return"false"!==t&&"0"!==t&&""!==t}return et(e)?0!==e&&!isNaN(e):Boolean(e)},Number:e=>{if(et(e))return e;if(null==e)return 0;const t=Number(e);return isNaN(t)?0:t},Math:e=>{if(et(e))return e;if(null==e)return 0;const t=String(e).trim();if(!t)return 0;try{return function(e){if(e=e.replace(/\s/g,""),!/^[0-9+\-*/().]+$/.test(e))throw new Error("Invalid characters in math expression");try{const t=new Function(`"use strict"; return (${e})`)();if(!et(t)||!isFinite(t))throw new Error("Expression did not evaluate to a finite number");return t}catch(e){throw new Error(`Math expression evaluation failed: ${e instanceof Error?e.message:String(e)}`)}}(t)}catch(e){return 0}},Int:e=>{const t=Xr.Number(e);return Math.trunc(t)},Float:e=>{const t=Xr.Number(e);return parseFloat(t.toString())},Date:e=>{if(e instanceof Date)return e;if(null==e)return new Date(NaN);if(Qe(e)&&/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,r,n]=e.split("-").map(Number);return new Date(t,r-1,n)}return new Date(e)},JSON:e=>{try{return JSON.stringify(e)}catch(e){return"{}"}},Object:e=>{if(rt(e))return e;if(Qe(e))try{return JSON.parse(e)}catch(e){return{}}return{}},Fragment:e=>{Qe(e)||(e=Xr.String(e));const t=document.createElement("template");return t.innerHTML=String(e),t.content},HTML:e=>Qe(e)?e:e instanceof NodeList?Array.from(e).map(e=>e instanceof Element?e.outerHTML:e.textContent||"").join(""):Array.isArray(e)?e.map(e=>e instanceof Element?e.outerHTML:Xr.String(e)).join(""):e instanceof Element?e.outerHTML:Xr.String(e),Values:(e,t)=>{if(e instanceof HTMLFormElement)return function(e){const t={};return e.querySelectorAll("input, select, textarea").forEach(e=>{const r=e;if(r.name){const e=Zr(r);void 0!==e&&(void 0!==t[r.name]?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(e)):t[r.name]=e)}}),t}(e);if(e instanceof HTMLElement){const t=e.querySelectorAll("input, select, textarea"),r={};return t.forEach(e=>{e.name&&(r[e.name]=Zr(e))}),r}return{}},"Values:Form":(e,t)=>{const r=Xr.Values(e,t);return new URLSearchParams(r).toString()},"Values:JSON":(e,t)=>{const r=Xr.Values(e,t);return JSON.stringify(r)}};function Zr(e){if(e instanceof HTMLInputElement)switch(e.type){case"checkbox":return e.checked;case"radio":return e.checked?e.value:void 0;case"number":case"range":return e.valueAsNumber;case"date":case"datetime-local":return e.valueAsDate;case"file":return e.files;default:return e.value}return e instanceof HTMLSelectElement&&e.multiple?Array.from(e.selectedOptions).map(e=>e.value):e.value}const Jr={as:{name:"as",category:"Conversion",evaluatesTo:"Any",precedence:20,associativity:"Left",operators:["as"],async evaluate(e,...t){const[r,n]=t;if("string"!=typeof n)throw new Error("Conversion type must be a string");if(n.startsWith("Fixed")){const{precision:e}=function(e){const t=e.match(/^Fixed(?::(\d+))?$/);return t?{precision:t[1]?parseInt(t[1],10):2}:{}}(n);return Xr.Number(r).toFixed(e||2)}let i=Xr[n];if(i)return i(r,e);const a={boolean:"Boolean",bool:"Boolean",string:"String",str:"String",number:"Number",num:"Number",int:"Int",integer:"Int",float:"Float",array:"Array",object:"Object",obj:"Object",date:"Date",json:"JSON"}[n.toLowerCase()];return a&&(i=Xr[a],i)?i(r,e):r},validate:e=>$t(e,2,"as","value, type")??Wt(e,1,"as","conversion type")},is:{name:"is",category:"Conversion",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["is a","is an"],async evaluate(e,...t){const[r,n]=t;if(!Qe(n))throw new Error("Type check requires a string type");switch(n.toLowerCase()){case"null":return null===r;case"undefined":return void 0===r;case"string":return Qe(r);case"number":return et(r)&&!isNaN(r);case"boolean":return tt(r);case"object":return rt(r);case"array":return Array.isArray(r);case"function":return nt(r);case"date":return r instanceof Date;case"element":return r instanceof Element;case"node":return r instanceof Node;case"nodelist":return r instanceof NodeList;case"empty":return null==r||""===r||Array.isArray(r)&&0===r.length||rt(r)&&0===Object.keys(r).length;default:return r?.constructor?.name?.toLowerCase()===n.toLowerCase()}},validate:e=>$t(e,2,"is","value, type")??Wt(e,1,"is","type")},async:{name:"async",category:"Conversion",evaluatesTo:"Any",precedence:25,associativity:"Right",operators:["async"],evaluate:async(e,t)=>t,validate:e=>$t(e,1,"async","expression")}},Qr=ut,en=Jr;function tn(e){return{...e,evaluationHistory:e.evaluationHistory||[]}}async function rn(e){if("object"!=typeof e||null===e)return e;if(e&&"function"==typeof e.then&&(e=await e),e&&"object"==typeof e&&"success"in e&&"value"in e){if(e.success)return e.value;{const t=e.errors||[];throw new Error(t.length>0?t[0].message:"Expression evaluation failed")}}return e}function nn(e,t){return{type:"identifier",name:e,...void 0!==t.start&&{start:t.start},...void 0!==t.end&&{end:t.end}}}function an(e,t,r){return{type:"literal",value:e,valueType:t,...void 0!==r.start&&{start:r.start},...void 0!==r.end&&{end:r.end}}}function on(e){const t=[];let r=wn(e);for(;r&&")"!==r.value;){const n=un(e);if(t.push(n),r=wn(e),!r||","!==r.value)break;bn(e),r=wn(e)}return t}function sn(e){return null==e||("string"==typeof e||Array.isArray(e)||e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length?0===e.length:"object"==typeof e&&null!==e&&0===Object.keys(e).length)}class ln extends Error{constructor(e,t){super(void 0!==t?`${e} at position ${t}`:e),this.name="ExpressionParseError"}}async function cn(e,t){try{const r=function(e){const t={tokens:e,position:0};if(0===e.length)throw new ln("Empty expression");const r=un(t);if(t.position<e.length)throw new ln(`Unexpected token: ${e[t.position].value}`,t.position);return r}(J(e));return await zn(r,t)}catch(e){if(e instanceof ln)throw e;throw new ln(`Failed to parse expression: ${e}`)}}function un(e){return pn(e,3)}function pn(e,t){let r=function(e){let t=hn(e);for(;e.position<e.tokens.length;){const r=e.tokens[e.position];if(!(xe(r)||ke(r)&&["is","equals"].includes(r.value)))break;{const n=r.value;if(e.position++,["exists","does not exist","is empty","is not empty"].includes(n))t={type:"unaryExpression",operator:n,operand:t,...void 0!==t.start&&{start:t.start},end:r.end};else if("is"===n&&"not"===wn(e)?.value){e.position++;const r=hn(e);t={type:"binaryExpression",operator:"is not",left:t,right:r,...void 0!==t.start&&{start:t.start},...void 0!==r.end&&{end:r.end}}}else{const r=hn(e);t={type:"binaryExpression",operator:n,left:t,right:r,...void 0!==t.start&&{start:t.start},...void 0!==r.end&&{end:r.end}}}}}return t}(e);for(;e.position<e.tokens.length;){const n=e.tokens[e.position];if(!ze(n)||!mn(n.value))break;{const i=n.value,a=dn(i);if(a<t)break;e.position++;const o=pn(e,a+1);r={type:"binaryExpression",operator:i,left:r,right:o,...void 0!==r.start&&{start:r.start},...void 0!==o.end&&{end:o.end}}}}return r}function mn(e){return["and","or","&&","||"].includes(e)}function dn(e){switch(e){case"or":case"||":return 3;case"and":case"&&":return 4;default:return 0}}function hn(e){return fn(e,6)}function fn(e,t){let r=function(e){let t=function(e){let t=kn(e);for(;e.position<e.tokens.length;){const r=e.tokens[e.position];if(Ve(r)){let r;e.position++;const n=wn(e);if(n&&We(n)&&"*"===n.value){e.position++;const t=n.start,i=kn(e);r=nn("*"+(i.name||i.value),{start:t,end:i.end})}else r=kn(e);t={type:"possessiveExpression",object:t,property:r,...void 0!==t.start&&{start:t.start},...void 0!==r.end&&{end:r.end}};continue}if("identifier"===t.type&&["my","its","your"].includes(t.name)&&(Pe(r)||be(r))){const r=kn(e);t={type:"contextPossessive",contextType:t.name,property:r,...void 0!==t.start&&{start:t.start},...void 0!==r.end&&{end:r.end}};continue}if("identifier"!==t.type||"the"!==t.name||!Pe(r)){if(De(r)){e.position++;const r=bn(e);if(!r||!Pe(r))throw new ln('Expected property name after "."');let n=t;if("identifier"===t.type){const e=t.name;if("my"===e||"its"===e||"your"===e){n=nn("my"===e?"me":"its"===e?"it":"you",t)}}t={type:"propertyAccess",object:n,property:nn(r.value,r),...void 0!==t.start&&{start:t.start},end:r.end};continue}if(Be(r)){e.position++;const r=bn(e);if(!r||!Pe(r))throw new ln('Expected property name after "?."');let n=t;if("identifier"===t.type){const e=t.name;if("my"===e||"its"===e||"your"===e){n=nn("my"===e?"me":"its"===e?"it":"you",t)}}t={type:"optionalChain",object:n,property:nn(r.value,r),optional:!0,...void 0!==t.start&&{start:t.start},end:r.end};continue}if(He(r)){e.position++;const r=wn(e);if(r&&".."===r.value){bn(e);const r=wn(e);if(r&&"]"===r.value){bn(e),t={type:"arrayRangeAccess",object:t,startExpr:void 0,endExpr:void 0};continue}const n=un(e),i=bn(e);if(!i||"]"!==i.value)throw new ln("Expected closing bracket after range");t={type:"arrayRangeAccess",object:t,startExpr:void 0,endExpr:n};continue}const n=un(e),i=wn(e);if(i&&".."===i.value){bn(e);const r=wn(e);if(r&&"]"===r.value){bn(e),t={type:"arrayRangeAccess",object:t,startExpr:n,endExpr:void 0};continue}const i=un(e),a=bn(e);if(!a||"]"!==a.value)throw new ln("Expected closing bracket after range");t={type:"arrayRangeAccess",object:t,startExpr:n,endExpr:i};continue}const a=bn(e);if(!a||"]"!==a.value)throw new ln("Expected closing bracket after array index");t={type:"arrayAccess",object:t,index:n,...void 0!==t.start&&{start:t.start},end:a.end};continue}if(Fe(r)){e.position++;const r=on(e),n=bn(e);if(!n||")"!==n.value)throw new ln("Expected closing parenthesis");t={type:"callExpression",callee:t,arguments:r,...void 0!==t.start&&{start:t.start},end:n.end};continue}break}{const r=wn(e),n=e.position+1<e.tokens.length?e.tokens[e.position+1]:null;if(r&&n&&"of"===n.value){const r=kn(e),n=wn(e);if(!n||!ke(n)||"of"!==n.value)throw new ln('Expected "of" after property in "the X of Y" pattern');{e.position++;const n=kn(e);t={type:"propertyOfExpression",property:r,target:n,...void 0!==t.start&&{start:t.start},...void 0!==n.end&&{end:n.end}}}}}}return t}(e);for(;e.position<e.tokens.length;){const r=e.tokens[e.position];if(!ke(r)||"as"!==r.value)break;{e.position++;const r=bn(e);if(!r)throw new ln('Expected type after "as"');let n=r.value;if(":"===wn(e)?.value){e.position++;const t=bn(e);t&&(n+=":"+t.value)}t={type:"asExpression",expression:t,targetType:n,...void 0!==t.start&&{start:t.start},end:r.end}}}return t}(e);for(;e.position<e.tokens.length;){const n=e.tokens[e.position];if(!We(n)||!yn(n.value))break;{const i=n.value,a=vn(i);if(a<t)break;e.position++;const o=fn(e,gn(i)?a:a+1);r={type:"binaryExpression",operator:i,left:r,right:o,...void 0!==r.start&&{start:r.start},...void 0!==o.end&&{end:o.end}}}}return r}function yn(e){return["+","-","*","/","%","^","**","mod"].includes(e)}function vn(e){switch(e){case"+":case"-":return 6;case"*":case"/":case"%":case"mod":return 7;case"^":case"**":return 8;default:return 0}}function gn(e){return["^","**"].includes(e)}function kn(e){const t=wn(e);if(!t)throw new ln("Unexpected end of expression");if(ze(t)&&("not"===t.value||"no"===t.value)){bn(e);const r=kn(e);return{type:"unaryExpression",operator:t.value,operand:r,start:t.start,...void 0!==r.end&&{end:r.end}}}if(Pe(t)&&("first"===t.value||"last"===t.value)){const t=bn(e),r=wn(e);if(r&&(_e(r)||qe(r)||Me(r)||Pe(r)||We(r)&&"."===r.value)){if(!We(r)||"."!==r.value){const r=kn(e);return{type:"positionalExpression",operator:t.value,argument:r,start:t.start,...void 0!==r.end&&{end:r.end}}}{bn(e);const n=wn(e);if(n&&Pe(n)){bn(e);const i={type:"cssSelector",selectorType:"class",selector:"."+n.value,start:r.start,end:n.end};return{type:"positionalExpression",operator:t.value,argument:i,start:t.start,end:i.end}}}}return{type:"positionalExpression",operator:t.value,argument:null,start:t.start,end:t.end}}if(We(t)&&("-"===t.value||"+"===t.value||"!"===t.value)){bn(e);const r=kn(e);return{type:"unaryExpression",operator:t.value,operand:r,start:t.start,...void 0!==r.end&&{end:r.end}}}if("("===t.value){e.position++;const t=un(e),r=bn(e);if(!r||")"!==r.value)throw new ln("Expected closing parenthesis");return t}if(Ne(t)){bn(e);const r=t.value.slice(1,-1);return an(r.replace(/\\(.)/g,(e,t)=>{switch(t){case"n":return"\n";case"t":return"\t";case"r":return"\r";case"b":return"\b";case"f":return"\f";case"v":return"\v";case"0":return"\0";case"\\":return"\\";case'"':return'"';case"'":return"'";case"`":return"`";default:return t}}),"string",t)}if(Re(t))return bn(e),{type:"templateLiteral",value:t.value,start:t.start,end:t.end};if(Oe(t)){bn(e);const r=parseFloat(t.value);return an(Number.isInteger(r)&&!t.value.toLowerCase().includes("e")?parseInt(t.value,10):r,"number",t)}if(Ie(t)){let r,n;switch(bn(e),t.value){case"true":r=!0,n="boolean";break;case"false":r=!1,n="boolean";break;case"null":r=null,n="null";break;case"undefined":r=void 0,n="undefined";break;default:r="true"===t.value,n="boolean"}return an(r,n,t)}if(qe(t))return bn(e),{type:"cssSelector",selectorType:"id",selector:t.value,start:t.start,end:t.end};if(_e(t))return bn(e),{type:"cssSelector",selectorType:"class",selector:t.value,start:t.start,end:t.end};if(Me(t))return bn(e),{type:"queryReference",selector:t.value,start:t.start,end:t.end};if("{"===t.value){bn(e);const r=[];if("}"===wn(e)?.value)return bn(e),{type:"objectLiteral",properties:r,start:t.start,end:e.tokens[e.position-1].end};do{const t=wn(e);if(!t)throw new ln("Expected property key in object literal");let n;if(Pe(t))bn(e),n=nn(t.value,t);else{if(!Ne(t))throw new ln(`Expected property key, got: ${t.kind}`);bn(e),n=an(t.value.slice(1,-1),"string",t)}const i=bn(e);if(!i||":"!==i.value)throw new ln('Expected ":" after property key');const a=un(e);r.push({key:n,value:a});const o=wn(e);if(","!==o?.value){if("}"===o?.value)break;throw new ln('Expected "," or "}" in object literal')}bn(e)}while(wn(e)&&"}"!==wn(e).value);const n=bn(e);if(!n||"}"!==n.value)throw new ln('Expected closing brace "}" in object literal');return{type:"objectLiteral",properties:r,start:t.start,end:n.end}}if("["===t.value){bn(e);const r=wn(e);if("@"===r?.value){bn(e);const r=bn(e);if(!r||!Pe(r))throw new ln("Expected attribute name after @");const n=bn(e);if(!n||"]"!==n.value)throw new ln("Expected closing bracket after attribute name");return{type:"attributeAccess",attributeName:r.value,start:t.start,end:n.end}}{const n=e.position,i=function(e,t){let r=t;const n=e.tokens[r];if(!n||!Pe(n))return!1;r++;const i=e.tokens[r];if(!i)return!1;if("]"===i.value)return!0;if("="===i.value||"~="===i.value||"|="===i.value||"^="===i.value||"$="===i.value||"*="===i.value)return!0;return!1}(e,n);if(i)return function(e,t){const r=bn(e);if(!r||!Pe(r))throw new ln("Expected attribute name in selector");let n=null,i=null;const a=wn(e);if(a&&["=","~=","|=","^=","$=","*="].includes(a.value)){n=bn(e).value;const t=bn(e);if(!t)throw new ln("Expected value after attribute operator");if(Ne(t))i=t.value.slice(1,-1);else{if(!Pe(t)&&!Oe(t))throw new ln(`Unexpected token in attribute selector: ${t.value}`);i=t.value}}const o=bn(e);if(!o||"]"!==o.value)throw new ln("Expected closing bracket in attribute selector");return{type:"attributeSelector",attribute:r.value,operator:n,value:i,start:t.start,end:o.end}}(e,t);let a=!1;if("]"===r?.value)a=!0;else{let t=n,r=1,i=!1;for(;t<e.tokens.length&&r>0;){const n=e.tokens[t];if("["===n.value&&r++,"]"===n.value&&r--,","===n.value&&1===r){i=!0;break}t++}i&&(a=!0)}if(a){const r=[];if("]"===wn(e)?.value)return bn(e),{type:"arrayLiteral",elements:r,start:t.start,end:e.tokens[e.position-1].end};do{if(r.push(un(e)),","!==wn(e)?.value)break;bn(e)}while(wn(e)&&"]"!==wn(e).value);const n=bn(e);if(!n||"]"!==n.value)throw new ln("Expected closing bracket in array literal");return{type:"arrayLiteral",elements:r,start:t.start,end:n.end}}{const r=un(e),n=bn(e);if(!n||"]"!==n.value)throw new ln("Expected closing bracket");return{type:"bracketExpression",expression:r,start:t.start,end:n.end}}}}if(function(e){return e.kind===U.IDENTIFIER&&e.value.startsWith("$")}(t)){const t=bn(e);return{type:"globalVariable",name:t.value,start:t.start,end:t.end}}if(be(t)||Pe(t)||ke(t)&&"new"!==t.value&&"null"!==t.value&&"undefined"!==t.value){const t=bn(e),r=wn(e);if(r&&"("===r.value){bn(e);const r=on(e),n=wn(e);if(!n||")"!==n.value)throw new ln("Expected closing parenthesis");return bn(e),{type:"callExpression",callee:nn(t.value,t),arguments:r,start:t.start,end:n.end}}return"null"===t.value?an(null,"null",t):"undefined"===t.value?an(void 0,"undefined",t):nn(t.value,t)}if(ke(t)&&"new"===t.value){const t=bn(e),r=wn(e);if(!r||!Pe(r))throw new ln('Expected constructor name after "new"');bn(e);const n=wn(e);if(!n||"("!==n.value)throw new ln('Expected "(" after constructor name');bn(e);const i=[],a=wn(e);if(!a||")"!==a.value)throw new ln('Expected ")" after constructor arguments (argument parsing not yet implemented)');return bn(e),{type:"constructorCall",constructor:r.value,arguments:i,start:t.start,end:a.end}}if(Pe(t)&&"Date"===t.value&&e.tokens.slice(Math.max(0,e.position-3),e.position).map(e=>({kind:e.kind,value:e.value})),function(e){return e.kind===U.SYMBOL}(t)&&"string"==typeof t.value&&t.value.startsWith("@")){bn(e);return{type:"attributeAccess",attributeName:t.value.substring(1),start:t.start,end:t.end}}throw e.tokens.slice(Math.max(0,e.position-2),e.position+3).map(e=>({kind:e.kind,value:e.value})),new ln(`Unexpected token: ${t.value} (kind: ${t.kind}) at position ${e.position}`,e.position)}function wn(e){return e.tokens[e.position]}function bn(e){return e.tokens[e.position++]}async function zn(e,t){switch(e.type){case"literal":return e.value;case"templateLiteral":return async function(e,t){let r=e.value;return r=await En(r,/\$([a-zA-Z_$][a-zA-Z0-9_.$]*|\d+)/g,async(e,r)=>{try{if(/^\d+$/.test(r))return r;if(r.includes(".")){const e=r.split(".");let n=xn(e[0],t);for(let t=1;t<e.length&&null!=n;t++)n=n[e[t]];return String(n??"")}const e=xn(r,t);return String(e??"")}catch(e){return""}}),r=await En(r,/\$(?:\{([^}]+)\}|\(([^)]+)\))/g,async(e,r,n)=>{const i=r||n;try{const e=await cn(i,t);return String(e)}catch(e){return"undefined"}}),r}(e,t);case"identifier":return function(e,t){if(t.meta&&"object"==typeof t.meta&&t.meta.hasOwnProperty(e))return t.meta[e];if(t.locals&&t.locals.has(e))return t.locals.get(e);if("me"===e||"I"===e)return t.me;if("you"===e)return t.you;if("it"===e)return t.it;if("result"===e)return t.result;if(t.globals&&t.globals.has(e))return t.globals.get(e);if("undefined"!=typeof globalThis&&e in globalThis)return globalThis[e];return}(String(e.name),t);case"binaryExpression":return async function(e,t){const r=e.operator;if("has"===r||"have"===r){const r=await zn(e.left,t);if(r instanceof Element){if("cssSelector"===e.right.type&&"class"===e.right.selectorType){const t=e.right.selector?.startsWith(".")?e.right.selector.slice(1):e.right.selector||"";return r.classList.contains(t)}if("selector"===e.right.type&&"string"==typeof e.right.value&&e.right.value.startsWith("."))return r.classList.contains(e.right.value.slice(1))}return!1}if("in"===r&&"queryReference"===e.left?.type){let r=e.left.selector;r.startsWith("<")&&r.endsWith("/>")&&(r=r.slice(1,-2).trim());const n=await zn(e.right,t);if(!n||"function"!=typeof n.querySelectorAll)throw new ln(`'in' operator requires a DOM element as the right operand (got: ${typeof n})`);return Array.from(n.querySelectorAll(r))}const n=await zn(e.left,t),i=await zn(e.right,t);switch(r){case"and":case"&&":return n&&i;case"or":case"||":return n||i;case"is":case"equals":case"==":return await rn(Wr.equals.evaluate(tn(t),n,i));case"is not":case"!=":return await rn(Wr.notEquals.evaluate(tn(t),n,i));case"===":case"is really equal to":case"really equals":return n===i;case"!==":case"is not really equal to":return n!==i;case">":return await rn(Wr.greaterThan.evaluate(tn(t),n,i));case"<":return await rn(Wr.lessThan.evaluate(tn(t),n,i));case">=":return await rn(Wr.greaterThanOrEqual.evaluate(tn(t),n,i));case"<=":return await rn(Wr.lessThanOrEqual.evaluate(tn(t),n,i));case"+":return function(e,t){if("string"==typeof e||"string"==typeof t)return String(e)+String(t);const r="number"==typeof e?e:parseFloat(e),n="number"==typeof t?t:parseFloat(t);if(isNaN(r)||isNaN(n))return String(e)+String(t);return r+n}(n,i);case"-":return await rn(Qr.subtraction.evaluate(tn(t),{left:n,right:i}));case"*":return await rn(Qr.multiplication.evaluate(tn(t),{left:n,right:i}));case"/":return await rn(Qr.division.evaluate(tn(t),{left:n,right:i}));case"%":case"mod":return await rn(Qr.modulo.evaluate(tn(t),{left:n,right:i}));case"^":case"**":return Math.pow(Number(n),Number(i));case"match":case"matches":return Wr.matches.evaluate(t,n,i);case"contains":case"include":case"includes":return String(n).includes(String(i));case"in":return async function(e,t){if(Array.isArray(t))return t.includes(e);if("object"==typeof t&&null!==t){return String(e)in t}if("string"==typeof t)return t.includes(String(e));throw new ln("Cannot use 'in' operator with "+typeof t)}(n,i);case"does not contain":case"does not include":return!String(n).includes(String(i));case"exists":return null!=n;case"is empty":return sn(n);case"is not empty":return!sn(n);case"is in":return String(i).includes(String(n));case"is not in":return!String(i).includes(String(n));case"is equal to":return n==i;case"is not equal to":return n!=i;case"is greater than":return n>i;case"is less than":return n<i;case"is greater than or equal to":return n>=i;case"is less than or equal to":return n<=i;default:throw new ln(`Unknown binary operator: ${r}`)}}(e,t);case"possessiveExpression":return async function(e,t){const r=await zn(e.object,t),n=e.property;if("identifier"===n.type){const e=n.name;if("string"==typeof e&&e.startsWith("*")){const t=e.slice(1);let n=r;return r&&"object"==typeof r&&"length"in r&&void 0!==r[0]&&(n=r[0]),n&&"object"==typeof n&&"style"in n&&n.style?n.style[t]:null}return await rn(qt.its.evaluate(tn(t),{target:r,property:e}))}if("attributeAccess"===n.type){let e=r;return r&&"object"==typeof r&&"length"in r&&void 0!==r[0]&&(e=r[0]),e&&"object"==typeof e&&"function"==typeof e.getAttribute?e.getAttribute(n.attributeName):null}if("bracketExpression"===n.type){const e=await zn(n.expression,t);return await rn(qt.its.evaluate(tn(t),{target:r,property:String(e)}))}throw new ln(`Unsupported property access type: ${n.type}`)}(e,t);case"contextPossessive":return async function(e,t){const r=e.contextType,n=e.property;let i;if("identifier"!==n.type)throw new ln("Property name must be an identifier");i=n.name;switch(r){case"my":return await rn(qt.my.evaluate(tn(t),{property:i}));case"its":const e=t.result||t.it;return await rn(qt.its.evaluate(tn(t),{target:e,property:i}));case"your":return await rn(qt.its.evaluate(tn(t),{target:t.you,property:i}));default:throw new ln(`Unknown context type: ${r}`)}}(e,t);case"propertyOfExpression":return async function(e,t){const r=e.property;let n;if("identifier"!==r.type)throw new ln('Property name must be an identifier in "the X of Y" pattern');n=r.name;const i=await zn(e.target,t);if(null==i)throw new ln(`Cannot access property "${n}" of ${i}`);if(i&&"object"==typeof i&&i.nodeType===Node.ELEMENT_NODE)return await rn(qt.its.evaluate(tn(t),{target:i,property:n}));try{const e=i[n];return"function"==typeof e?e.bind(i):e}catch(e){throw new ln(`Failed to access property "${n}" on target: ${e}`)}}(e,t);case"constructorCall":return async function(e){const t=e.constructor;try{const e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:global)[t];if("function"==typeof e){return new e}throw new ln(`Constructor "${t}" not found or is not a function`)}catch(e){throw new ln(`Failed to call constructor "${t}": ${e instanceof Error?e.message:String(e)}`)}}(e);case"propertyAccess":return async function(e,t){const r=await zn(e.object,t),n=e.property;if(null==r)throw new ln(`Cannot access property "${n.name}" of ${r}`);if("identifier"!==n.type)throw new ln("Property name must be an identifier");const i=n.name;try{let e;return e=Ct(r)?Lt(r,i):r[i],"function"==typeof e?e.bind(r):e}catch(e){throw new ln(`Error accessing property "${i}": ${e}`)}}(e,t);case"optionalChain":return async function(e,t){const r=await zn(e.object,t);if(null==r)return;const n=e.property,i=n.name||n.value;try{const e=r[i];return"function"==typeof e?e.bind(r):e}catch{return}}(e,t);case"asExpression":return async function(e,t){const r=await zn(e.expression,t),n=e.targetType;return await en.as.evaluate(t,r,n)}(e,t);case"cssSelector":return async function(e){const t=e.selector;if("id"===e.selectorType){const e=t.startsWith("#")?t.slice(1):t;return document.getElementById(e)}if("class"===e.selectorType){const e=t.replace(/:/g,"\\:");return Array.from(document.querySelectorAll(e))}throw new ln(`Unknown CSS selector type: ${e.selectorType}`)}(e);case"queryReference":return async function(e){const t=e.selector;let r=t.slice(1,-2).trim();const n=new RegExp("(\\.[a-zA-Z0-9_-]+):(?!(hover|active|focus|visited|link|focus-within|focus-visible|first-child|last-child|only-child|nth-child|nth-last-child|nth-of-type|nth-last-of-type|first-of-type|last-of-type|only-of-type|empty|root|target|lang|dir|not|has|is|where|matches|before|after|first-letter|first-line|selection|placeholder|marker|backdrop|enabled|disabled|checked|indeterminate|required|optional|valid|invalid|in-range|out-of-range|read-only|read-write|default|defined|fullscreen|modal|picture-in-picture|autofill)(?![a-zA-Z0-9_-]))","g");r=r.replace(n,"$1\\:");try{return document.querySelectorAll(r)}catch(e){return document.createDocumentFragment().childNodes}}(e);case"attributeSelector":return async function(e){let t=`[${e.attribute}`;e.operator&&null!==e.value&&(t+=`${e.operator}"${e.value}"`);return t+="]","undefined"!=typeof document?document.querySelectorAll(t):[]}(e);case"unaryExpression":return async function(e,t){const r=await zn(e.operand,t),n=e.operator;switch(n){case"not":case"!":return!r;case"no":return null==r||(!1===r||(Array.isArray(r)||!(!r||"object"!=typeof r||!("length"in r)))&&0===r.length);case"exists":return null!=r;case"does not exist":return null==r;case"is empty":return sn(r);case"is not empty":return!sn(r);case"-":const e="number"==typeof r?r:parseFloat(r);return isNaN(e)?0:-e;case"+":const t="number"==typeof r?r:parseFloat(r);return isNaN(t)?0:t;default:throw new ln(`Unknown unary operator: ${n}`)}}(e,t);case"attributeAccess":return async function(e,t){const r=e.attributeName;if(t.me&&t.me instanceof Element)return t.me.getAttribute(r);return`@${r}`}(e,t);case"bracketExpression":return async function(e,t){return await zn(e.expression,t)}(e,t);case"callExpression":return async function(e,t){if("identifier"===e.callee?.type){const r=e.callee.name;if(["closest","previous","next"].includes(r)){const n=await Promise.all(e.arguments.map(async e=>{if("identifier"===e.type&&e.name)return e.name;if("selector"===e.type&&e.value)return e.value;if("queryReference"===e.type&&e.selector){let t=e.selector;return t.startsWith("<")&&t.endsWith("/>")&&(t=t.slice(1,-2).trim()),t}return zn(e,t)}));switch(r){case"closest":return Dr.closest.evaluate(t,...n);case"previous":return or.previous.evaluate(t,...n);case"next":return or.next.evaluate(t,...n)}}}const r=await zn(e.callee,t);if("function"!=typeof r)throw new ln("Cannot call non-function value: "+typeof r);const n=[];for(const r of e.arguments){const e=await zn(r,t);n.push(e)}const i=r(...n);if(i&&"function"==typeof i.then)return await i;return i}(e,t);case"arrayLiteral":return async function(e,t){const r=[];for(const n of e.elements){const e=await zn(n,t);r.push(e)}return r}(e,t);case"objectLiteral":return async function(e,t){const r={};for(const n of e.properties){let e;if("identifier"===n.key.type)e=n.key.name;else if("literal"===n.key.type&&"string"===n.key.valueType)e=n.key.value;else{const r=await zn(n.key,t);e=String(r)}const i=await zn(n.value,t);r[e]=i}return r}(e,t);case"arrayAccess":return async function(e,t){const r=await zn(e.object,t),n=await zn(e.index,t);if(null==r)throw new ln(`Cannot access index "${n}" of ${r}`);if(Array.isArray(r)){let e="number"==typeof n?n:parseInt(n,10);if(isNaN(e))throw new ln("Array index must be a number, got: "+typeof n);return e<0&&(e=r.length+e),r[e]}if("object"==typeof r)return r[String(n)];if("string"==typeof r){const e="number"==typeof n?n:parseInt(n,10);if(isNaN(e))throw new ln("String index must be a number, got: "+typeof n);return r[e]}throw new ln("Cannot access property of "+typeof r)}(e,t);case"arrayRangeAccess":return async function(e,t){const r=await zn(e.object,t);if(null==r)throw new ln(`Cannot access range of ${r}`);if(!Array.isArray(r)&&"string"!=typeof r)throw new ln("Range syntax only works on arrays and strings, got: "+typeof r);const n=e.start,i=e.end;let a,o;if(null==n)a=0;else{const e=await zn(n,t);if(a="number"==typeof e?e:parseInt(e,10),isNaN(a))throw new ln("Range start index must be a number, got: "+typeof e)}if(null==i)o=r.length;else{const e=await zn(i,t);if(o="number"==typeof e?e:parseInt(e,10),isNaN(o))throw new ln("Range end index must be a number, got: "+typeof e);o+=1}return r.slice(a,o)}(e,t);case"positionalExpression":return async function(e,t){const r=e.operator;let n;n=e.argument?await zn(e.argument,t):t.it;if("first"===r)return or.first.evaluate(t,n);if("last"===r)return or.last.evaluate(t,n);throw new ln(`Unknown positional operator: ${r}`)}(e,t);case"globalVariable":return function(e,t){const r=e.name,n=r.startsWith("$")?r.slice(1):r;if(t.globals)if(t.globals instanceof Map){if(t.globals.has(r))return t.globals.get(r);if(t.globals.has(n))return t.globals.get(n)}else if("object"==typeof t.globals){if(r in t.globals)return t.globals[r];if(n in t.globals)return t.globals[n]}if("undefined"!=typeof globalThis&&n in globalThis)return globalThis[n];return}(e,t);default:throw new ln(`Unknown AST node type: ${e.type}`)}}function xn(e,t){return t.locals?.has(e)?t.locals.get(e):"me"===e&&t.me?t.me:"you"===e&&t.you?t.you:"it"===e&&t.it?t.it:"result"===e&&t.result?t.result:"undefined"!=typeof window&&"window"===e?window:t.globals?.has(e)?t.globals.get(e):void 0}async function En(e,t,r){const n=[];let i;for(;null!==(i=t.exec(e));)n.push({match:i[0],index:i.index,length:i[0].length,replacement:await r(i[0],...i.slice(1))});let a=e;for(let e=n.length-1;e>=0;e--){const t=n[e];a=a.substring(0,t.index)+t.replacement+a.substring(t.index+t.length)}return a}let Sn=!1,Tn=null;if("undefined"!=typeof window&&"undefined"!=typeof URLSearchParams)try{"semantic"===new URLSearchParams(window.location.search).get("debug")&&(Sn=!0,Tn=window)}catch{}function Cn(){return Sn}let An={totalParses:0,semanticSuccesses:0,semanticFallbacks:0,traditionalParses:0,averageConfidence:0,confidenceHistory:[]};const Ln=50;let jn=[];class Pn{constructor(e){this.analyzer=e.analyzer,this.language=e.language,this.confidenceThreshold=e.confidenceThreshold??.5,this.debugEnabled=e.debug??!1}isAvailable(){return this.analyzer.supportsLanguage(this.language)}shouldSkipSemantic(e){const t=e.trim().split(/\s+/)[0]?.toLowerCase();if(Pn.SKIP_SEMANTIC_COMMANDS.has(t))return!0;const r=e.toLowerCase();return!!/\bjs\b/.test(r)||!!/\btell\b/.test(r)}trySemanticParse(e){const t=performance.now();if(this.shouldSkipSemantic(e))return{success:!1,confidence:0,errors:["Command skipped for semantic parsing - using traditional parser"]};if(!this.isAvailable())return{success:!1,confidence:0,errors:[`Semantic parsing not available for language '${this.language}'`]};try{const n=this.analyzer.analyze(e,this.language),i=performance.now()-t,a=n.confidence>=this.confidenceThreshold&&!!n.command,o=!a&&n.confidence>0;if(Cn()){const t={};if(n.command?.roles)for(const[e,r]of n.command.roles)t[e]=r.value;const s={input:e.substring(0,100),language:this.language,confidence:n.confidence,threshold:this.confidenceThreshold,semanticSuccess:a,fallbackTriggered:o,command:n.command?.name,roles:Object.keys(t).length>0?t:void 0,errors:n.errors,timestamp:Date.now(),duration:i};!function(e){if(!Sn)return;if(jn.push(e),jn.length>Ln&&jn.shift(),Math.round(100*e.confidence),Math.round(100*e.threshold),e.roles&&Object.keys(e.roles),Tn){const t=new CustomEvent("lokascript:semantic:parse",{detail:e,bubbles:!0});Tn.dispatchEvent(t)}}(s),r=s,An.totalParses++,r.semanticSuccess?An.semanticSuccesses++:r.fallbackTriggered?An.semanticFallbacks++:An.traditionalParses++,An.confidenceHistory.push(r.confidence),An.confidenceHistory.length>100&&An.confidenceHistory.shift(),An.averageConfidence=An.confidenceHistory.reduce((e,t)=>e+t,0)/An.confidenceHistory.length}if(!a)return{success:!1,confidence:n.confidence,tokensConsumed:n.tokensConsumed,errors:n.errors};return{success:!0,node:this.buildCommandNode(n),confidence:n.confidence,tokensConsumed:n.tokensConsumed}}catch(e){return{success:!1,confidence:0,errors:[e instanceof Error?e.message:String(e)]}}var r}buildCommandNode(e){const{command:t}=e;if(!t)throw new Error("Cannot build command node without command data");if("repeat"===t.name)return this.buildRepeatCommandNode(t);if("for"===t.name)return this.buildRepeatCommandNode(t);if("set"===t.name)return this.buildSetCommandNode(t);if("if"===t.name||"unless"===t.name)return this.buildIfCommandNode(t);const r=[],n={};for(const[e,i]of t.roles){const a=this.semanticValueToExpression(i);switch(e){case"patient":case"event":r.push(a);break;case"destination":"put"===t.name?n.into=a:"add"===t.name||"append"===t.name||"prepend"===t.name?n.to=a:n.on=a;break;case"source":"fetch"===t.name?r.push(a):n.from=a;break;case"quantity":n.by=a;break;case"duration":n.over=a;break;case"responseType":n.as=a;break;case"method":n.method=a;break;case"style":n.with=a;break;case"condition":n.when=a;break;default:n[e]=a}}return{type:"command",name:t.name,args:r,modifiers:Object.keys(n).length>0?n:void 0,isBlocking:!1,start:0,end:0,line:1,column:0}}buildRepeatCommandNode(e){const t=[],r={},n=e.roles.get("loopType");n&&t.push({type:"identifier",name:String(n.value),start:0,end:0,line:1,column:0});const i=e.roles.get("patient");"for"===(n?String(n.value):"")&&i&&t.push({type:"identifier",name:"expression"===i.type&&i.raw||String(i.value),start:0,end:0,line:1,column:0});const a=e.roles.get("event");a&&t.push({type:"string",value:String(a.value),start:0,end:0,line:1,column:0});const o=e.roles.get("source");o&&t.push(this.semanticValueToExpression(o));const s=e.roles.get("quantity");s&&t.push(this.semanticValueToExpression(s));const l=e.roles.get("condition");return l&&(r.condition=this.semanticValueToExpression(l)),{type:"command",name:"repeat",args:t,modifiers:Object.keys(r).length>0?r:void 0,isBlocking:!1,start:0,end:0,line:1,column:0}}buildSetCommandNode(e){const t=[],r=e.roles.get("destination");if(r)if("property-path"===r.type){const e=r;t.push({type:"possessiveExpression",object:this.semanticValueToExpression(e.object),property:this.createPropertyNode(e.property),start:0,end:0,line:1,column:0})}else t.push(this.semanticValueToExpression(r));t.push({type:"identifier",name:"to",start:0,end:0,line:1,column:0});const n=e.roles.get("patient");return n&&t.push(this.semanticValueToExpression(n)),{type:"command",name:"set",args:t,isBlocking:!1,start:0,end:0,line:1,column:0}}createPropertyNode(e){return e.startsWith("*")?{type:"cssProperty",name:e.substring(1),start:0,end:0,line:1,column:0}:{type:"identifier",name:e,start:0,end:0,line:1,column:0}}buildIfCommandNode(e){const t=[],r=e.roles.get("condition");return r&&t.push(this.semanticValueToExpression(r)),{type:"command",name:e.name,args:t,isBlocking:!1,start:0,end:0,line:1,column:0}}semanticValueToExpression(e){switch(e.type){case"selector":return{type:"selector",value:e.value,start:0,end:0,line:1,column:0};case"reference":return{type:"identifier",name:e.value,start:0,end:0,line:1,column:0};case"literal":return"string"==typeof e.value&&e.value.includes("${")&&e.value.includes("}")?{type:"templateLiteral",value:e.value,start:0,end:0,line:1,column:0}:{type:"literal",value:e.value,raw:e.raw??e.value,start:0,end:0,line:1,column:0};case"property-path":{const t=e;return{type:"memberExpression",object:this.semanticValueToExpression(t.object),property:{type:"identifier",name:t.property,start:0,end:0,line:1,column:0},computed:!1,start:0,end:0,line:1,column:0}}default:return this.parseExpressionString(e.raw||"")}}parseExpressionString(e){let t=0;const r=()=>{for(;t<e.length&&/\s/.test(e[t]);)t++},n=()=>{r();const n=t;for(;t<e.length&&/[a-zA-Z0-9_$]/.test(e[t]);)t++;return e.slice(n,t)},i=()=>{const n=[];if(t++,r(),")"!==e[t])for(n.push(a()),r();","===e[t];)t++,r(),n.push(a()),r();return")"===e[t]&&t++,n},a=()=>{r();const a=n();if(!a)return{type:"identifier",name:e.trim(),start:0,end:0,line:1,column:0};let o={type:"identifier",name:a,start:0,end:0,line:1,column:0};for(;t<e.length;){r();const a=e[t];if("."===a){t++;const e=n();e&&(o={type:"memberExpression",object:o,property:{type:"identifier",name:e,start:0,end:0,line:1,column:0},computed:!1,start:0,end:0,line:1,column:0})}else{if("("!==a)break;o={type:"callExpression",callee:o,arguments:i(),start:0,end:0,line:1,column:0}}}return o};return a()}getLanguage(){return this.language}getConfidenceThreshold(){return this.confidenceThreshold}}function Nn(e,t,r){return{type:"literal",value:e,raw:t,start:r.start,end:r.end,line:r.line,column:r.column}}function On(e,t){return{type:"identifier",name:e,start:t.start,end:t.end,line:t.line,column:t.column}}function In(e,t,r,n){return{type:"binaryExpression",operator:e,left:t,right:r,start:n.start,end:n.end,line:n.line,column:n.column}}Pn.SKIP_SEMANTIC_COMMANDS=new Set(["swap","morph","js","tell"]);const Rn=[{command:"append",keywords:["to"],syntax:"append <value> [to <target>]"},{command:"fetch",keywords:["as","with"],syntax:"fetch <url> [as <type>] [with <options>]"},{command:"make",keywords:["a","an"],syntax:"make (a|an) <type>"},{command:"send",keywords:["to"],syntax:"send <event> to <target>"},{command:"throw",keywords:[],syntax:"throw <error>"}];function Mn(e,t){return!!e&&t.some(t=>e.value===t||e.value.toLowerCase()===t)}const qn=[n,o,i,a];function _n(e,t=[]){if(e.isAtEnd())return!0;for(const t of qn)if(e.check(t))return!0;for(const r of t)if(e.check(r))return!0;return!!e.checkIsCommand()}function $n(e,t=[]){if(!_n(e,t))return e.parseExpression()}function Wn(e,t,r){return!!e.check(t)&&(e.advance(),r.push(e.createIdentifier(t)),!0)}function Vn(e,t,r){for(const n of t)if(e.check(n))return e.advance(),r.push(e.createIdentifier(n)),n;return null}class Dn{constructor(e){this.args=[],this.isBlocking=!1,this.name=e}static from(e){const t=new Dn(e.value);return t.startPos={start:e.start??0,end:e.end??0,line:e.line??1,column:e.column??1},t}static fromIdentifier(e){const t=new Dn(e.name);return void 0!==e.start&&(t.startPos={start:e.start,end:e.end??0,line:e.line??1,column:e.column??1}),t}static named(e){return new Dn(e)}withArgs(...e){return this.args.push(...e),this}withBody(e){return this.body=e,this}withImplicitTarget(e){return this.implicitTarget=e,this}withModifier(e,t){return this.modifiers||(this.modifiers={}),this.modifiers[e]=t,this}withModifiers(e){return this.modifiers={...this.modifiers,...e},this}blocking(e=!0){return this.isBlocking=e,this}startingAt(e){return this.startPos={start:e.start??0,end:e.end??0,line:e.line??1,column:e.column??1},this}endingAt(e){return this.endPos={start:e.start??this.startPos?.start??0,end:e.end,line:e.line??this.startPos?.line??1,column:e.column??this.startPos?.column??1},this}build(){const e={type:"command",name:this.name,args:this.args,isBlocking:this.isBlocking,start:this.startPos?.start??0,end:this.endPos?.end??this.startPos?.end??0,line:this.startPos?.line??1,column:this.startPos?.column??1};return this.body&&(e.body=this.body),this.implicitTarget&&(e.implicitTarget=this.implicitTarget),this.modifiers&&(e.modifiers=this.modifiers),e}clone(){const e=new Dn(this.name);return e.args=[...this.args],e.body=this.body?[...this.body]:void 0,e.implicitTarget=this.implicitTarget,e.isBlocking=this.isBlocking,e.modifiers=this.modifiers?{...this.modifiers}:void 0,e.startPos=this.startPos?{...this.startPos}:void 0,e.endPos=this.endPos?{...this.endPos}:void 0,e}}function Bn(e,t){const r=[];let n="";const i=e.peek().start||0,a=e.peek().line||1,o=e.peek().column||1;if(e.checkIdentifierLike()){for(n=e.advance().value;e.check(":")&&!e.isAtEnd();)e.advance(),n+=":",e.checkIdentifierLike()&&(n+=e.advance().value);r.push({type:"string",value:n,start:i,end:e.getPosition().end,line:a,column:o})}for(;!_n(e);)r.push(e.parsePrimary());let s=-1,l="on";for(let e=0;e<r.length;e++){const t=r[e],n=t.name||t.value;if(!("identifier"!==t.type&&"literal"!==t.type&&"keyword"!==t.type||"on"!==n&&"to"!==n)){s=e,l=n;break}}const c=[];if(-1===s)c.push(...r);else{const t=r.slice(0,s),n=r.slice(s+1);c.push(...t),c.push(e.createIdentifier(l)),c.push(...n)}return Dn.fromIdentifier(t).withArgs(...c).endingAt(e.getPosition()).build()}function Hn(e,t){const r=[];if(e.check(A)){const t=e.advance();if(r.push({type:"identifier",name:A,start:t.start,end:t.end,line:t.line,column:t.column}),e.check(x)){const t=e.advance();r.push({type:"identifier",name:x,start:t.start,end:t.end,line:t.line,column:t.column})}}return Dn.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}function Fn(e,t){const r=[];let o=!1;const l=e.current;for(let t=0;t<500&&!e.isAtEnd();t++){const t=e.peek();if(t.value===n){o=!0;break}if(t.value===a||t.value===S||t.value===E||t.value===z)break;e.advance()}e.current=l;let c=!1;if(!o){const r=e.current,n=t.line,o=100;for(;!e.isAtEnd()&&e.current-r<o;){const t=e.peek(),r=t.value?.toLowerCase();if(r===S||r===E||r===z)break;if(r===i||r===a){t.line===n&&(c=!0);break}if((e.checkIsCommand()||e.isCommand(r))&&void 0!==t.line&&t.line!==n){c=!0;break}e.advance()}e.current=r}const u=o||c;let p;if(u)p=e.parseExpression();else{const r=[],i=20;let a=0;for(;!e.isAtEnd()&&!e.checkIsCommand()&&!e.isCommand(e.peek().value)&&!e.check(n)&&a<i;){const t=e.current;r.push(e.parseLogicalAnd()),e.current===t&&e.advance(),a++}if(0===r.length)throw new Error("Expected condition after if/unless");p=1===r.length?r[0]:{type:"expression",tokens:r,start:r[0].start,end:r[r.length-1].end,line:t.line,column:t.column}}if(r.push(p),u){o&&e.advance();const n=[];for(;!e.isAtEnd()&&!e.check(i)&&!e.check(a)&&(e.checkIsCommand()||e.isCommand(e.peek().value));){e.advance();const t=e.parseCommand();t&&n.push(t)}if(0===n.length&&e.isAtEnd())throw new Error("Expected command after 'then' in if statement - incomplete conditional");r.push({type:"block",commands:n,start:t.start,end:e.getPosition().end,line:t.line,column:t.column});let l=!1;if(e.check(i))if(e.advance(),e.check(s)){const t=e.peek();e.advance();const n=Fn(e,t);r.push({type:"block",commands:[n],start:t.start,end:e.getPosition().end,line:t.line,column:t.column}),l=!0}else{const n=[];for(;!e.isAtEnd()&&!e.check(a)&&(e.checkIsCommand()||e.isCommand(e.peek().value));){e.advance();const t=e.parseCommand();t&&n.push(t)}r.push({type:"block",commands:n,start:t.start,end:e.getPosition().end,line:t.line,column:t.column})}l||e.consume(a,"Expected 'end' after if block")}else{if(!e.checkIsCommand()&&!e.isCommand(e.peek().value))throw new Error("Expected command after if condition in single-line form");{e.advance();const n=e.parseCommand();r.push({type:"block",commands:[n],start:t.start,end:e.getPosition().end,line:t.line,column:t.column})}}return Dn.from(t).withArgs(...r).endingAt(e.getPosition()).build()}function Un(e,t){const r=[],n={};if(e.checkAnySelector()||e.checkContextVar()||e.match("<")){const t=e.parsePrimary();if(r.push(t),e.match("*")){if(e.checkIdentifierLike()){const t=e.advance();r.push({type:"identifier",name:"*"+t.value,start:t.start-1,end:t.end,line:t.line,column:t.column})}}else if(e.checkIdentifierLike()){const t=e.parsePrimary();r.push(t)}}else if(e.checkIdentifierLike()){const t=e.parsePrimary();r.push(t)}if(e.match("and")&&e.match("set")&&e.checkIdentifierLike()){const t=e.advance();n.set={type:"identifier",name:t.value,start:t.start,end:t.end,line:t.line,column:t.column}}const i=Dn.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition());return Object.keys(n).length>0&&i.withModifiers(n),i.build()}function Kn(e,t){const r=[],n=$n(e,[v]);n&&r.push(n),Wn(e,v,r);const i=$n(e);return i&&r.push(i),Dn.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}function Gn(e,t){const r=[];if(e.check(b)){e.advance(),r.push(e.createIdentifier("between"));const n=$n(e,[o]);n&&r.push(n),Wn(e,o,r);const i=$n(e,[v,z,l]);i&&r.push(i);if(Vn(e,[v,z],r)){const t=$n(e);t&&r.push(t)}return Dn.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}const n=$n(e,[v,z]);n&&r.push(n);if(Vn(e,[v,z],r)){const t=$n(e);t&&r.push(t)}return Dn.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}function Yn(e,t){const r=e.parseExpression();if(!r)return e.addError("Put command requires content expression"),null;const n=e.peek();if(!n||!q.includes(n.value))return e.addError(`Expected operation keyword (${q.join(", ")}) after put expression, got: ${n?.value}`),null;let i=e.advance().value;const o=i.toLowerCase();"at start of"===o||"at the start of"===o?i=R:"at end of"===o||"at the end of"===o?i=M:i===I&&(e.check(L)||e.check(A)?(e.check(A)&&e.advance(),e.check(L)&&(e.advance(),e.check(k)&&(e.advance(),i=R))):e.check(a)&&(e.advance(),e.check(k)&&(e.advance(),i=M)));const s=e.parseExpression();return s?Dn.fromIdentifier(t).withArgs(r,e.createIdentifier(i),s).endingAt(e.getPosition()).build():(e.addError("Put command requires target expression after operation keyword"),null)}const Xn=["innerhtml","outerhtml","into","over","delete","morph","morphouter"];function Zn(e,t){const r=e.current;let s=null;try{if(e.check(":"))if(e.advance(),e.check(":")){e.advance();const t=e.advance();s={type:"identifier",name:t.value,scope:"global",start:t.start-2,end:t.end}}else{const t=e.advance();s={type:"identifier",name:t.value,scope:"local",start:t.start-1,end:t.end}}else if(e.check(T)||e.check(C)){const t=e.advance(),r=e.advance();s={type:"identifier",name:r.value,scope:t.value,start:t.start,end:r.end}}else if(e.check(A)){const t=e.current;e.advance();const n=e.peek(),i=e.current+1<e.tokens.length?e.tokens[e.current+1]:null;if(n&&i&&i.value===k){const t=e.advance();if(e.check(k)){e.advance();const n=e.advance(),i=n.value.startsWith("#");s={type:"propertyOfExpression",property:{type:"identifier",name:t.value,start:t.start,end:t.end},target:{type:i?"idSelector":"cssSelector",value:n.value,start:n.start,end:n.end},start:r,end:e.current}}else e.current=r,s=null}else if(n&&i&&i.value===y){const t=e.advance();s={type:"identifier",name:t.value,start:t.start,end:t.end}}else e.current=t,s=null}else s=e.parseExpression()}catch(t){e.current=r,s=null}const l=[];if(!s){if(e.match(":")){const t=e.advance();s={type:"identifier",name:t.value,scope:"local",start:t.start,end:t.end}}else for(;!(e.isAtEnd()||e.check(y)||e.check(n)||e.check(o)||e.check(i)||e.check(a));){const t=e.parsePrimary();l.push(t)}l.length>0&&(s=l.length>=4&&l[0].value===A&&l[2].value===k?{type:"propertyOfExpression",property:{type:"identifier",name:l[1].value||l[1].name,start:l[1].start,end:l[1].end},target:{type:"idSelector"===l[3].type?"idSelector":"cssSelector",value:l[3].value||l[3].name,start:l[3].start,end:l[3].end},start:l[0].start,end:l[3].end}:1===l.length?l[0]:null)}if(!e.check(y)){const t=e.isAtEnd()?"end of input":e.peek().value;throw new Error(`Expected 'to' in set command, found: ${t}`)}e.advance();const c=[],u=e.parseExpression();if(u)c.push(u);else{const t=e.parsePrimary();t&&c.push(t)}const p=[];s?p.push(s):l.length>0&&p.push(...l),p.push(e.createIdentifier(y)),c.length>0&&p.push(...c);return{type:"command",name:t.name,args:p,isBlocking:!1,start:t.start||0,end:e.getPosition().end,line:t.line||1,column:t.column||1}}function Jn(e,t){switch(t.name.toLowerCase()){case"put":return Yn(e,t);case"trigger":case"send":return Bn(e,t);case"remove":return Kn(e,t);case"toggle":return Gn(e,t);case"set":return Zn(e,t);case"halt":return Hn(e,t);case"measure":return Un(e,t);case"js":return function(e,t){const r=[];if(e.match("(")){for(;!e.check(")")&&!e.isAtEnd();)e.checkIdentifierLike()&&r.push(e.advance().value),e.match(",");e.consume(")","Expected ) after js parameters")}const n=e.peek().start;for(;!e.check(a)&&!e.isAtEnd();)e.advance();const i=e.peek(),o=i.start;e.consume(a,"Expected end after js code body");const s=e.getInputSlice(n,o),l={type:"literal",value:s.trim(),start:t.start,end:e.getPosition().end},c={type:"arrayLiteral",elements:r.map(e=>({type:"literal",value:e,start:t.start,end:t.end})),start:t.start,end:e.getPosition().end};return Dn.fromIdentifier(t).withArgs(l,c).endingAt(e.getPosition()).build()}(e,t);case"tell":return function(e,t){const r=e.parseExpression();if(!r)throw new Error("tell command requires a target expression");const s=[];for(;!e.isAtEnd();){if(e.checkIsCommand()){try{e.advance();const t=e.parseCommand();if(!t)break;s.push(t)}catch{break}if(e.match(o))continue;if(e.check(n)||e.check(i)||e.check(a))break;if(e.checkIsCommand())continue;break}break}if(0===s.length)throw new Error("tell command requires at least one command after the target");return Dn.fromIdentifier(t).withArgs(r,...s).endingAt(e.getPosition()).build()}(e,t);case"swap":case"morph":return function(e,t){const r=[];let n=null;if(!e.isAtEnd()){const t=e.peek();if(t&&t.value){const i=t.value.toLowerCase();Xn.includes(i)&&(n=i,e.advance(),r.push(e.createIdentifier(n)))}}if("delete"===n){const n=e.parseExpression();return n&&r.push(n),Dn.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}!e.isAtEnd()&&e.check(k)&&(e.advance(),r.push(e.createIdentifier("of")));const i=e.parseExpression();if(i&&r.push(i),!e.isAtEnd()&&e.check(g)){e.advance(),r.push(e.createIdentifier("with"));const t=e.parseExpression();t&&r.push(t)}return Dn.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}(e,t);default:return Qn(e,t)}}function Qn(e,t){const r=[];for(;!_n(e,["catch","finally"])&&(e.checkIdentifierLike()||e.checkSelector()||e.checkLiteral()||e.checkTimeExpression()||e.match("<"));)r.push(e.parsePrimary());return Dn.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}class ei{constructor(e,t,r){this.current=0,this.warnings=[],this.tokens=e,this.keywordResolver=t?.keywords,this.registryIntegration=t?.registryIntegration,t?.semanticAnalyzer&&t?.language&&(this.semanticAdapter=new Pn({analyzer:t.semanticAnalyzer,language:t.language,confidenceThreshold:t.semanticConfidenceThreshold??.5})),this.originalInput=r||e.map(e=>e.value).join(" ")}resolveKeyword(e){return this.keywordResolver?this.keywordResolver.resolve(e)??e:e}addWarning(e){this.warnings.push(e)}parse(){try{if(0===this.tokens.length)return this.addError("Cannot parse empty input"),{success:!1,node:this.createErrorNode(),tokens:this.tokens,error:this.error,warnings:this.warnings};if(this.check("behavior")){const e=[];for(;this.check("behavior");){this.advance();const t=this.parseBehaviorDefinition();if(t&&e.push(t),this.error)break}return this.error?{success:!1,node:1===e.length?e[0]:this.createProgramNode(e),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:!0,node:1===e.length?e[0]:this.createProgramNode(e),tokens:this.tokens,warnings:this.warnings}}if(this.check("init")||this.check("on")||this.check("def")||this.checkComment()){const e=[];for(;!this.isAtEnd();)if(this.checkComment())this.advance();else if(this.check("init")){this.advance();const t=this.parseTopLevelInitBlock();t&&e.push(t)}else if(this.check("on")){this.advance();const t=this.parseEventHandler();t&&e.push(t)}else{if(!this.check("def"))break;{this.advance();const t=this.parseDefFeature();t&&e.push(t)}}return this.isAtEnd()?this.error?{success:!1,node:this.createProgramNode(e),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:!0,node:this.createProgramNode(e),tokens:this.tokens,warnings:this.warnings}:(this.addError(`Unexpected token: ${this.peek().value}`),{success:!1,node:this.createProgramNode(e),tokens:this.tokens,error:this.error,warnings:this.warnings})}if(this.checkIsCommand()||this.isCommand(this.peek().value)&&!this.isKeyword(this.peek().value)){const e=this.parseCommandSequence();if(e){if(!this.isAtEnd()&&this.check("on")){const t=[e];let r=0;for(;!this.isAtEnd()&&this.check("on");){this.peek(),this.advance();const e=this.parseEventHandler();if(e&&(t.push(e),r++),this.isAtEnd()||this.peek(),this.isAtEnd(),this.check("on"),!this.isAtEnd()&&!this.check("on")){if(!this.isAtEnd())return this.peek(),this.addError(`Unexpected token after event handlers: ${this.peek().value}`),{success:!1,node:this.createProgramNode(t),tokens:this.tokens,error:this.error};break}}return this.error?{success:!1,node:this.createProgramNode(t),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:!0,node:this.createProgramNode(t),tokens:this.tokens,warnings:this.warnings}}return this.isAtEnd()?this.error?{success:!1,node:e,tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:!0,node:e,tokens:this.tokens,warnings:this.warnings}:(this.addError(`Unexpected token: ${this.peek().value}`),{success:!1,node:e||this.createErrorNode(),tokens:this.tokens,error:this.error})}}const e=this.parseExpression();return this.error?{success:!1,node:e||this.createErrorNode(),tokens:this.tokens,error:this.error}:this.isAtEnd()?{success:!0,node:e,tokens:this.tokens,warnings:this.warnings}:(this.addError(`Unexpected token: ${this.peek().value}`),{success:!1,node:e||this.createErrorNode(),tokens:this.tokens,error:this.error,warnings:this.warnings})}catch(e){return this.addError(e instanceof Error?e.message:"Unknown parsing error"),{success:!1,node:this.createErrorNode(),tokens:this.tokens,error:this.error,warnings:this.warnings}}}parseExpression(){return this.parseAssignment()}parseAssignment(){let e=this.parseLogicalOr();if(this.match("=")){const t=this.previous().value,r=this.parseAssignment();e=this.createBinaryExpression(t,e,r)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match("or");){const t=this.previous().value,r=this.parseLogicalAnd();e=this.createBinaryExpression(t,e,r)}return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match("and");){const t=this.previous().value,r=this.parseEquality();e=this.createBinaryExpression(t,e,r)}return e}parseEquality(){let e=this.parseComparison();for(;this.matchComparisonOperator()||this.match("is","match","matches","contains","include","includes","in","of","as","really");){const t=this.previous().value;if(ei.POSTFIX_UNARY_OPERATORS.has(t)){e=this.createUnaryExpression(t,e,!1);continue}const r=this.parseComparison();e=this.createBinaryExpression(t,e,r)}return e}parseComparison(){let e=this.parseAddition();for(;this.matchComparisonOperator();){const t=this.previous().value;if(ei.POSTFIX_UNARY_OPERATORS.has(t)){e=this.createUnaryExpression(t,e,!1);continue}const r=this.parseAddition();e=this.createBinaryExpression(t,e,r)}return e}parseAddition(){let e=this.parseMultiplication();for(;this.match("+","-")||this.matchOperator("+")||this.matchOperator("-");){const t=this.previous().value;if(this.check("+")||this.check("-"))return this.addError(`Invalid operator combination: ${t}${this.peek().value}`),e;if(this.isAtEnd())return this.addError(`Expected expression after '${t}' operator`),e;const r=this.parseMultiplication();e=this.createBinaryExpression(t,e,r)}return e}parseMultiplication(){let e=this.parseUnary();for(;this.match("*","/","%","mod");){const t=this.previous().value;if(this.check("*")||this.check("/")||this.check("%")||this.check("+")||this.check("-")){const r=this.peek().value;return this.addError("*"===t&&"*"===r?`Unexpected token: ${r}`:`Invalid operator combination: ${t}${r}`),e}if(this.isAtEnd())return this.addError(`Expected expression after '${t}' operator`),e;const r=this.parseUnary();e=this.createBinaryExpression(t,e,r)}return e}parseUnary(){if(this.match("not","no","exists","some","-","+")){const e=this.previous().value;if(this.isAtEnd())return this.addError(`Expected expression after '${e}' operator`),this.createErrorNode();const t=this.parseUnary();return this.createUnaryExpression(e,t,!0)}if(this.check("does")&&this.current+1<this.tokens.length&&"not"===this.tokens[this.current+1].value&&this.current+2<this.tokens.length&&"exist"===this.tokens[this.current+2].value){if(this.advance(),this.advance(),this.advance(),this.isAtEnd())return this.addError("Expected expression after 'does not exist' operator"),this.createErrorNode();const e=this.parseUnary();return this.createUnaryExpression("does not exist",e,!0)}return this.parseImplicitBinary()}parseImplicitBinary(){let e=this.parseCall();for(;!(this.isAtEnd()||this.checkBasicOperator()||this.check("then")||this.check("and")||this.check("else")||this.check(")")||this.check("]")||this.check(","));){if("identifier"!==e.type){if("literal"===e.type&&(this.checkNumber()||this.checkIdentifier())){const t=this.peek();return this.addError(`Missing operator between '${e.raw||e.value}' and '${t.value}'`),e}break}if(this.isCommand(e.name))if(this.isCompoundCommand(e.name.toLowerCase())){if(!(this.checkCssSelector()||this.checkIdSelector()||this.checkClassSelector()||this.checkTimeExpression()||this.checkString()||this.checkNumber()||this.checkContextVar()||this.checkIdentifier()||this.checkKeyword()))break;{const t=this.createCommandFromIdentifier(e);t&&(e=t)}}else{if("wait"===e.name.toLowerCase()&&this.checkTimeExpression()){const t=this.createCommandFromIdentifier(e);t&&(e=t)}else{if(!this.checkSelector())break;{const t=this.parseCall();e=this.createBinaryExpression(" ",e,t)}}}else{if(!this.checkSelector())break;{const t=this.parseCall();e=this.createBinaryExpression(" ",e,t)}}}return e}isCommand(e){return this.keywordResolver?this.keywordResolver.isCommand(e):$.isCommand(e)}isKeyword(e){return this.keywordResolver?this.keywordResolver.isKeyword(e):$.isKeyword(e)}createCommandFromIdentifier(e){const t=[],r=this.resolveKeyword(e.name.toLowerCase());if(this.isCompoundCommand(r))return this.parseCompoundCommand(e);for(;!(this.isAtEnd()||this.check("then")||this.check("and")||this.check("else")||this.checkIsCommand())&&(this.checkContextVar()||this.checkIdentifier()||this.checkKeyword()||this.checkEvent()||this.checkCssSelector()||this.checkIdSelector()||this.checkClassSelector()||this.checkString()||this.checkNumber()||this.checkTimeExpression()||this.match("<"));)t.push(this.parsePrimary());return{type:"command",name:e.name,args:t,isBlocking:!1,...void 0!==e.start&&{start:e.start},end:this.getPosition().end,...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}}}isCompoundCommand(e){return $.isCompoundCommand(e)}parseCompoundCommand(e){return Jn(this.getContext(),e)}parsePutCommand(e){return Yn(this.getContext(),e)}parseSetCommand(e){return Zn(this.getContext(),e)}parseHaltCommand(e){return Hn(this.getContext(),e)}parseMeasureCommand(e){return Un(this.getContext(),e)}parseTriggerCommand(e){return Bn(this.getContext(),e)}parseCommandListUntilEnd(){const e=[];for(;!this.isAtEnd()&&!this.check("end");){this.peek(),this.peek();let t=!1;if(this.checkIsCommand()){this.peek(),this.advance();const r=this.error;try{const n=this.parseCommand();this.error&&this.error!==r&&(this.error=r),n&&(e.push(n),t=!0)}catch(e){e instanceof Error||String(e),this.error=r}}else if(this.checkIdentifier()){const r=this.peek();if(this.isCommand(r.value)){this.advance();const r=this.error;try{const n=this.parseCommand();this.error&&this.error!==r&&(this.error=r),n&&(e.push(n),t=!0)}catch(e){e instanceof Error||String(e),this.error=r}}}if(!t){this.peek();break}for(this.peek();!(this.isAtEnd()||this.check("end")||this.checkIsCommand()||this.isCommand(this.peek().value)||this.check("then")||this.check("and")||this.check(","));)this.peek(),this.advance();if(!this.match("then","and",",")&&(!this.checkIsCommand()&&!this.isCommand(this.peek().value))){this.peek();break}}if(this.peek(),!this.check("end"))throw this.peek(),this.peek(),new Error('Expected "end" to close repeat block');return this.advance(),e}parseRepeatCommand(e){return function(e,t){const r=[];let n="forever",i=null,a=null,o=null,s=null,d=null,y=null;if(e.check(l)){e.advance(),n=l;const t=e.peek();Ee(t)&&(d=t.value,e.advance()),e.check(f)&&(e.advance(),s=e.parseExpression())}else if(e.check(f))e.advance(),n=l,d="it",s=e.parseExpression();else if(e.check(c))e.advance(),n=c,o=e.parseExpression();else if(e.check(u))if(e.advance(),n=u,e.check(x)){e.advance(),n="until-event";const t=e.peek();if(!Ee(t)&&!we(t))throw new Error('Expected event name after "event"');i=t.value,e.advance(),e.peek(),e.peek(),e.check(v)&&(e.advance(),e.peek(),e.check(A)&&e.advance(),e.peek(),a=e.parsePrimary())}else o=e.parseExpression();else e.check(p)?(e.advance(),n=p):(y=e.parseExpression(),e.check(m)&&(e.advance(),n=m));let k=null;if(e.check(g)){const t=e.current+1<e.tokens.length?e.tokens[e.current+1]:null;t&&t.value.toLowerCase()===h&&(e.advance(),e.advance(),k=h)}else if(e.check(h)){e.advance();const t=e.peek();Ee(t)?(k=t.value,e.advance()):k=h}const w=e.parseCommandListUntilEnd();return r.push({type:"identifier",name:n,start:t.start,end:t.end,line:t.line,column:t.column}),d&&r.push({type:"string",value:d,start:t.start,end:t.end,line:t.line,column:t.column}),s&&r.push(s),o&&r.push(o),y&&r.push(y),i&&r.push({type:"string",value:i,start:t.start,end:t.end,line:t.line,column:t.column}),a&&r.push(a),k&&r.push({type:"string",value:k,start:t.start,end:t.end,line:t.line,column:t.column}),r.push({type:"block",commands:w,start:t.start,end:t.end||0,line:t.line,column:t.column}),Dn.from(t).withArgs(...r).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseForCommand(e){return function(e,t){const r=[];let n=null,i=null;e.check(d)&&e.advance();const a=e.peek();if(!Ee(a))throw new Error('Expected variable name after "for"');if(n=a.value,e.advance(),!e.check(f))throw new Error('Expected "in" after variable name in for loop');if(e.advance(),i=e.parseExpression(),!i)throw new Error('Expected collection expression after "in"');let o=null;if(e.check(g)){const t=e.current+1<e.tokens.length?e.tokens[e.current+1]:null;t&&t.value.toLowerCase()===h&&(e.advance(),e.advance(),o=h)}else if(e.check(h)){e.advance();const t=e.peek();Ee(t)?(o=t.value,e.advance()):o=h}const s=e.parseCommandListUntilEnd();return r.push({type:"identifier",name:"for",start:t.start,end:t.end,line:t.line,column:t.column}),r.push({type:"string",value:n,start:t.start,end:t.end,line:t.line,column:t.column}),r.push(i),o&&r.push({type:"string",value:o,start:t.start,end:t.end,line:t.line,column:t.column}),r.push({type:"block",commands:s,start:t.start,end:t.end||0,line:t.line,column:t.column}),Dn.from({...t,value:"repeat"}).withArgs(...r).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseWaitCommand(e){return function(e,t){const r=[];if(e.checkTimeExpression()||e.checkLiteral()){const n=e.parsePrimary();return r.push(n),{type:"command",name:"wait",args:r,isBlocking:!0,start:t.start||0,end:e.getPosition().end,line:t.line||1,column:t.column||1}}if(e.check("for")){e.advance();const n=[];do{const t=e.peek();if(!Ee(t))throw new Error('Expected event name after "for"');const r=t.value;e.advance();const i=[];if(e.check("(")){for(e.advance();!e.isAtEnd()&&!e.check(")");){const t=e.peek();if(!Ee(t))break;i.push(t.value),e.advance(),e.check(",")&&e.advance()}if(!e.check(")"))throw new Error('Expected ")" after event parameters');e.advance()}if(n.push({name:r,params:i}),!e.check("or"))break;e.advance()}while(!e.isAtEnd());let i=null;e.check(v)&&(e.advance(),e.check(A)&&e.advance(),i=e.parsePrimary()),r.push({type:"arrayLiteral",elements:n.map(e=>({type:"objectLiteral",properties:[{key:{type:"identifier",name:"name"},value:{type:"literal",value:e.name,raw:`"${e.name}"`}},{key:{type:"identifier",name:"args"},value:{type:"arrayLiteral",elements:e.params.map(e=>({type:"literal",value:e,raw:`"${e}"`}))}}]})),start:t.start,end:e.getPosition().end,line:t.line,column:t.column}),i&&r.push(i)}return Dn.from(t).withArgs(...r).blocking().endingAt(e.getPosition()).build()}(this.getContext(),e)}parseInstallCommand(e){return function(e,t){const r=[];if(!e.checkIdentifierLike())throw new Error('Expected behavior name after "install"');const n=e.advance().value,i=e.previous();if(r.push({type:"identifier",name:n,start:i.start,end:i.end,line:i.line,column:i.column}),e.check("(")){e.advance();const n=[];for(;!e.isAtEnd()&&!e.check(")");){const t=e.current;let r;if(e.checkIdentifierLike()){const n=e.peek().value;e.advance(),e.check(":")?(e.advance(),r=n):e.current=t}const i=e.parseExpression();if(n.push(void 0!==r?{name:r,value:i}:{value:i}),e.check(","))e.advance();else if(!e.check(")"))break}if(!e.check(")"))throw new Error('Expected ")" after behavior parameters');e.advance(),n.length>0&&r.push({type:"objectLiteral",properties:n.map(e=>({key:e.name?{type:"identifier",name:e.name}:{type:"literal",value:"_positional"},value:e.value})),start:t.start,end:e.getPosition().end,line:t.line,column:t.column})}return Dn.from(t).withArgs(...r).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseTransitionCommand(e){return function(e,t){const r=[],n={};let i=null;const a=e.peek();if(Ee(a)||"*"===a.value){let t="";if(e.check("*")&&(t="*",e.advance()),e.checkIdentifierLike()){for(t+=e.peek().value,e.advance();e.check("-")&&!e.isAtEnd();)t+="-",e.advance(),e.checkIdentifierLike()&&(t+=e.peek().value,e.advance());i={type:"string",value:t,start:a.start||0,end:e.getPosition().end,line:a.line,column:a.column}}}if(!i)throw new Error("Transition command requires a CSS property");if(r.push(i),!e.check(y))throw new Error('Expected "to" keyword after property in transition command');e.advance();const o=e.parsePrimary();if(n.to=o,e.check("over")){e.advance();const t=e.parsePrimary();n.over=t}if(e.check(g)){e.advance();const t=e.parsePrimary();n.with=t}return Dn.from(t).withArgs(...r).withModifiers(n).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseAddCommand(e){return function(e,t){const r=[];if(e.match("{"))r.push(e.parseCSSObjectLiteral());else{const t=$n(e,[y]);t&&r.push(t)}if(e.check(y)){e.advance();const t=$n(e);t&&r.push(t)}return Dn.from(t).withArgs(...r).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseIfCommand(e){return Fn(this.getContext(),e)}parseRemoveCommand(e){return Kn(this.getContext(),e)}parseToggleCommand(e){return Gn(this.getContext(),e)}parseRegularCommand(e){return Qn(this.getContext(),e)}parseCall(){let e=this.parsePrimary();for(;;)if(this.match("("))e=this.finishCall(e);else if(this.match(".")){const t=this.consumeIdentifier("Expected property name after '.' - malformed member access");e=this.createMemberExpression(e,this.createIdentifier(t.value),!1)}else if(this.match("[")){const t=this.parseExpression();this.consume("]","Expected ']' after array index"),e=this.createMemberExpression(e,t,!0)}else{if(!this.check("'s"))break;{let t;if(this.advance(),this.check("*")){this.advance();t="*"+this.consumeIdentifier("Expected property name after * in CSS property syntax").value}else{t=this.consumeIdentifier("Expected property name after possessive").value}e=this.createPossessiveExpression(e,this.createIdentifier(t))}}return e}parsePrimary(){if(this.check("*")){const e=this.current;if(this.advance(),!this.isAtEnd()&&Ee(this.peek())){const e=this.advance().value;return this.createSelector("*"+e)}this.current=e}if(this.check("*")||this.check("/")||this.check("%")||this.check("mod")){const e=this.peek();return this.addError(`Binary operator '${e.value}' requires a left operand`),this.createErrorNode()}if(this.matchNumber()){const e=parseFloat(this.previous().value);return this.createLiteral(e,this.previous().value)}if(this.matchString()){const e=this.previous().value;if(e.length<2||e.startsWith('"')&&!e.endsWith('"')||e.startsWith("'")&&!e.endsWith("'"))return this.addError("Unclosed string literal - string not properly closed"),this.createErrorNode();const t=e.slice(1,-1),r=this.processEscapeSequences(t);return this.createLiteral(r,e)}if(this.matchTemplateLiteral()){const e=this.previous();return{type:"templateLiteral",value:e.value,start:e.start||0,end:e.end||0,line:e.line,column:e.column}}if(this.matchBoolean()){const e=this.previous().value;let t;switch(e){case"true":t=!0;break;case"false":t=!1;break;case"null":t=null;break;case"undefined":t=void 0;break;default:t="true"===e}return this.createLiteral(t,e)}if(this.matchTimeExpression()){const e=this.previous().value;return this.createLiteral(e,e)}if(this.matchQueryReference()){const e=this.previous().value.slice(1,-2).trim();return this.createSelector(e)}if(this.matchSelector())return this.createSelector(this.previous().value);if(this.match("<"))return this.parseHyperscriptSelector();if(this.match("(")){if(this.isAtEnd())return this.addError("Expected expression inside parentheses"),this.createErrorNode();const e=this.parseExpression();return this.consume(")","Expected closing parenthesis ')' after expression - unclosed parentheses"),e}if(this.match("{"))return this.parseObjectLiteral();if(this.match("["))return this.parseAttributeOrArrayLiteral();if(this.check(":")){if(this.advance(),this.check(":")){this.advance();const e=this.advance();return{type:"identifier",name:e.value,scope:"global",start:e.start-2,end:e.end,line:e.line,column:e.column}}{const e=this.advance();return{type:"identifier",name:e.value,scope:"local",start:e.start-1,end:e.end,line:e.line,column:e.column}}}if(this.matchBasicOperator()){const e=this.previous();return this.createIdentifier(e.value)}const e=this.peek();if(!(e&&("end"===e.value||"else"===e.value||"then"===e.value))&&(this.matchPredicate(Pe)||this.matchPredicate(ke)||this.matchPredicate(be)||this.matchPredicate(ge)||this.matchPredicate(we))){const e=this.previous();if("new"===e.value)return this.parseConstructorCall();if("on"===e.value)return this.parseEventHandler();if("if"===e.value)return this.parseConditional();if("closest"===e.value||"first"===e.value||"last"===e.value||"previous"===e.value||"next"===e.value){if(this.check("(")||this.checkCssSelector()||this.checkClassSelector()||this.checkIdSelector()||this.check("<")||this.checkQueryReference())return this.parseNavigationFunction(e.value);if(this.check(".")){const t=this.current;if(this.advance(),this.checkIdentifier()){const t=this.advance().value,r=this.createSelector("."+t);return this.createCallExpression(this.createIdentifier(e.value),[r])}this.current=t}if(this.check("#")){const t=this.current;if(this.advance(),this.checkIdentifier()){const t=this.advance().value,r=this.createSelector("#"+t);return this.createCallExpression(this.createIdentifier(e.value),[r])}this.current=t}return this.createIdentifier(e.value)}return"my"!==e.value||this.check(".")?"its"!==e.value||this.check(".")?"your"!==e.value||this.check(".")?"the"===e.value?this.parseTheXofY():this.createIdentifier(e.value):this.parseContextPropertyAccess("you"):this.parseContextPropertyAccess("it"):this.parseContextPropertyAccess("me")}if(this.match("$"))return this.parseDollarExpression();const t=this.peek();return this.addError(`Unexpected token: ${t.value} at line ${t.line}, column ${t.column}`),this.createErrorNode()}parseDollarExpression(){if(this.checkNumber()){const e=this.advance().value;return this.createLiteral(e,`$${e}`)}if(this.checkIdentifier()){const e=this.advance();let t=this.createIdentifier(e.value);for(;this.match(".");){if(!this.checkIdentifier())return this.addError("Expected property name after '.' in dollar expression"),this.createErrorNode();{const e=this.advance();t=this.createMemberExpression(t,this.createIdentifier(e.value),!1)}}return{type:"dollarExpression",expression:t,raw:`$${e.value}${this.previous().raw||this.previous().value||""}`,line:e.line,column:e.column-1}}return this.addError("Expected identifier or number after '$'"),this.createErrorNode()}parseHyperscriptSelector(){let e="";for(;!this.check("/")&&!this.isAtEnd();)e+=this.advance().value;return this.consume("/","Expected '/' in hyperscript selector"),this.consume(">","Expected '>' after '/' in hyperscript selector"),this.createSelector(e)}parseObjectLiteral(){const e=[],t=this.getPosition();if(this.check("}"))return this.advance(),{type:"objectLiteral",properties:e,start:t.start,end:this.getPosition().end,line:t.line,column:t.column};do{let t;if(this.matchPredicate(Pe))t=this.createIdentifier(this.previous().value);else{if(!this.matchString())return this.addError("Expected property name in object literal"),this.createErrorNode();{const e=this.previous().value,r=e.slice(1,-1);t=this.createLiteral(r,e)}}this.consume(":","Expected ':' after property name in object literal");const r=this.parseExpression();if(e.push({key:t,value:r}),!this.match(","))break;if(this.check("}"))break}while(!this.isAtEnd());return this.consume("}","Expected '}' after object literal properties"),{type:"objectLiteral",properties:e,start:t.start,end:this.getPosition().end,line:t.line,column:t.column}}parseCSSObjectLiteral(){const e=this.getPosition(),t=[];do{if(this.check("}"))break;let r;if(this.matchPredicate(Pe))r=this.createIdentifier(this.previous().value);else{if(!this.matchString())return this.addError("Expected CSS property name"),this.createErrorNode();{const e=this.previous().value,t=e.slice(1,-1);r=this.createLiteral(t,e)}}if(!this.consume(":","Expected ':' after CSS property name"))return this.createErrorNode();const n=[];let i=!1,a=0;for(;!this.isAtEnd()&&(0!==a||!this.check(";")&&!this.check("}"));){const e=this.advance();n.push(e.value),"$"===e.value&&this.check("{")&&(i=!0),"{"===e.value&&a++,"}"===e.value&&a--}const o=n.join(""),s=i?{type:"templateLiteral",value:o,start:e.start,end:this.getPosition().end,line:e.line,column:e.column}:this.createLiteral(o,o);if(t.push({key:r,value:s}),this.check(";")&&this.advance(),this.check("}"))break}while(!this.isAtEnd());return this.consume("}","Expected '}' after CSS object literal properties"),{type:"objectLiteral",properties:t,start:e.start,end:this.getPosition().end,line:e.line,column:e.column}}parseConstructorCall(){const e=this.previous();if(!this.checkIdentifier())return this.addError('Expected constructor name after "new"'),this.createErrorNode();const t=this.advance(),r=t.value;if(!this.check("("))return this.addError('Expected "(" after constructor name'),this.createErrorNode();this.advance();if(this.check(")"))this.advance();else{let e=1;for(;e>0&&!this.isAtEnd();){const t=this.advance();"("===t.value&&e++,")"===t.value&&e--}}return{type:"callExpression",callee:{type:"identifier",name:r,start:t.start,end:t.end,line:t.line,column:t.column},arguments:[],isConstructor:!0,start:e.start,end:this.previous().end,line:e.line,column:e.column}}parseTopLevelInitBlock(){const e=this.getPosition(),t=this.parseCommandBlock(["end"]);return this.consume("end","Expected 'end' after init block"),{type:"initBlock",commands:t,start:e.start,end:this.getPosition().end,line:e.line,column:e.column}}parseDefFeature(){const e=this.getPosition();let t="";if(!this.checkIdentifier())return this.addError("Expected function name after 'def'"),{type:"def",name:"",params:[],body:[],start:e.start,end:this.getPosition().end,line:e.line,column:e.column};for(t=this.advance().value;this.check(".");)this.advance(),this.checkIdentifier()&&(t+="."+this.advance().value);const r=[];if(this.check("(")){if(this.advance(),!this.check(")"))for(this.checkIdentifier()&&r.push(this.advance().value);this.check(",");)this.advance(),this.checkIdentifier()&&r.push(this.advance().value);this.consume(")","Expected ')' after parameter list")}const n=this.parseCommandBlock(["end","catch","finally"]);let i,a,o;return this.check("catch")&&(this.advance(),this.checkIdentifier()&&(i=this.advance().value),a=this.parseCommandBlock(["end","finally"])),this.check("finally")&&(this.advance(),o=this.parseCommandBlock(["end"])),this.consume("end","Expected 'end' after function definition"),{type:"def",name:t,params:r,body:n,...void 0!==i&&{errorSymbol:i},...void 0!==a&&{errorHandler:a},...void 0!==o&&{finallyHandler:o},start:e.start,end:this.getPosition().end,line:e.line,column:e.column}}parseEventNameWithNamespace(e){let t;t=this.checkEvent()||this.checkIdentifier()?this.advance():this.consumeEvent(e);let r=t.value;if(this.check(":")){this.advance();r=`${r}:${this.advance().value}`}return r}parseEventHandler(){const e=[],t=this.parseEventNameWithNamespace("Expected event name after 'on'");for(e.push(t);this.check("or");){this.advance();const t=this.parseEventNameWithNamespace("Expected event name after 'or'");e.push(t)}let r;if(e.join(", "),this.registryIntegration){const t=e[0];if(this.registryIntegration.hasEventSource(t)){const e=this.registryIntegration.getEventSource(t);r=e?.name}}const n=[];if(this.match("(")){if(!this.check(")"))do{const e=this.advance();n.push(e.value)}while(this.match(","));this.consume(")","Expected ')' after event parameters"),n.join(", ")}const i={};for(;this.check(".");){this.advance();const e=this.advance().value.toLowerCase();if("once"===e)i.once=!0;else if("prevent"===e)i.prevent=!0;else if("stop"===e)i.stop=!0;else if("debounce"===e||"throttle"===e){if(!this.check("("))throw new Error(`Expected '(' after '.${e}'`);{this.advance();const t=this.advance(),r=parseInt(t.value,10);if(isNaN(r))throw new Error(`Expected number for ${e} delay, got: ${t.value}`);"debounce"===e?i.debounce=r:i.throttle=r,this.consume(")",`Expected ')' after ${e} delay`)}}}let a,o,s,l;if(Object.keys(i),this.match("[")&&(a=this.parseExpression(),this.consume("]","Expected ']' after event condition")),this.match("from")){const e=this.advance();o=e.value}if(this.match("of")){const e=this.advance();s=e.value.startsWith("@")?e.value.substring(1):e.value}this.match("in")&&(l=this.parseExpression());const c=[];for(this.isAtEnd()||this.peek(),this.isAtEnd();!this.isAtEnd()&&(this.peek(),this.peek(),!this.check("on"));)if(this.checkComment())this.peek(),this.advance();else{if(this.check("end")){this.advance();break}if(this.checkIsCommand()){const e="("===this.tokens[this.current+1]?.value,t=this.peek().value.toLowerCase();if(e&&!("js"===t||"tell"===t)){let e;const t=this.error;try{e=this.parseExpression()}catch(e){this.error=t,this.advance();const r=this.parseCommand();c.push(r);continue}if(e&&"callExpression"===e.type){const t=e,r=t.callee.name,n=["from","on","with","into","at","to"],i=this.peek();if(n.includes(i.value.toLowerCase())||Pe(i)&&!this.isCommand(i.value)||be(i)){let i,a;this.isCommand(r)&&this.addWarning({type:"command-shadow",message:`Method '${r}' shadows hyperscript command`,suggestions:[`Rename method to avoid confusion (e.g., '${r}Fn', 'my${r.charAt(0).toUpperCase()+r.slice(1)}')`,`Use 'call' command instead: call ${r}(...)`,"This works but may cause ambiguity"],severity:"warning",code:"PSEUDO_CMD_SHADOW",...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}}),n.includes(this.peek().value.toLowerCase())&&(i=this.advance().value.toLowerCase());try{a=this.parseExpression()}catch(n){const i={type:"command",name:r,args:t.arguments,isBlocking:!1,...void 0!==e.start&&{start:e.start},...void 0!==e.end&&{end:e.end},...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}};c.push(i);continue}const o={type:"command",name:"pseudo-command",args:[{type:"objectLiteral",properties:[{key:{type:"identifier",name:"methodName"},value:{type:"literal",value:r,raw:`"${r}"`}},{key:{type:"identifier",name:"methodArgs"},value:{type:"literal",value:t.arguments,raw:JSON.stringify(t.arguments)}},...i?[{key:{type:"identifier",name:"preposition"},value:{type:"literal",value:i,raw:`"${i}"`}}]:[],{key:{type:"identifier",name:"targetExpression"},value:a}]}],isBlocking:!1,...void 0!==e.start&&{start:e.start},...void 0!==e.end&&{end:e.end},...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}};c.push(o);continue}}if(e&&"callExpression"===e.type){const t={type:"command",name:e.callee.name,args:e.arguments,isBlocking:!1,...void 0!==e.start&&{start:e.start},...void 0!==e.end&&{end:e.end},...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}};c.push(t)}}else{this.advance();const e=this.error;try{const t=this.parseCommand();this.error&&this.error!==e&&(this.error=e),c.push(t),this.isAtEnd()||this.peek()}catch(t){t instanceof Error||String(t),this.error=e}}}else{if(!this.checkIdentifier())break;{const e=this.peek();if(this.isCommand(e.value)){this.advance();const e=this.error;try{const t=this.parseCommand();this.error&&this.error!==e&&(this.error=e),c.push(t)}catch(t){t instanceof Error||String(t),this.error=e}}else{let e;const t=this.error;try{e=this.parseExpression()}catch(e){e instanceof Error||String(e),this.error=t;break}if(e&&"callExpression"===e.type){const t=e,r=t.callee.name,n=["from","on","with","into","at","to"],i=this.peek();if(n.includes(i.value.toLowerCase())||Pe(i)&&!this.isCommand(i.value)||be(i)){let i,a;this.isCommand(r)&&this.addWarning({type:"command-shadow",message:`Method '${r}' shadows hyperscript command`,suggestions:[`Rename method to avoid confusion (e.g., '${r}Fn', 'my${r.charAt(0).toUpperCase()+r.slice(1)}')`,`Use 'call' command instead: call ${r}(...)`,"This works but may cause ambiguity"],severity:"warning",code:"PSEUDO_CMD_SHADOW",...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}}),n.includes(this.peek().value.toLowerCase())&&(i=this.advance().value.toLowerCase());try{a=this.parseExpression()}catch(n){const i={type:"command",name:r,args:t.arguments,isBlocking:!1,...void 0!==e.start&&{start:e.start},...void 0!==e.end&&{end:e.end},...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}};c.push(i);continue}const o={type:"command",name:"pseudo-command",args:[{type:"objectLiteral",properties:[{key:{type:"identifier",name:"methodName"},value:{type:"literal",value:r,raw:`"${r}"`}},{key:{type:"identifier",name:"methodArgs"},value:{type:"literal",value:t.arguments,raw:JSON.stringify(t.arguments)}},...i?[{key:{type:"identifier",name:"preposition"},value:{type:"literal",value:i,raw:`"${i}"`}}]:[],{key:{type:"identifier",name:"targetExpression"},value:a}]}],isBlocking:!1,...void 0!==e.start&&{start:e.start},...void 0!==e.end&&{end:e.end},...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}};c.push(o)}else{const n={type:"command",name:r,args:t.arguments,isBlocking:!1,...void 0!==e.start&&{start:e.start},...void 0!==e.end&&{end:e.end},...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}};c.push(n)}}else{if(!e||"binaryExpression"!==e.type||" "!==e.operator)break;{const t=e;if(!t.left||"identifier"!==t.left.type||!this.isCommand(t.left.name))break;{const r={type:"command",name:t.left.name,args:[t.right],isBlocking:!1,...void 0!==e.start&&{start:e.start},...void 0!==e.end&&{end:e.end},...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}};c.push(r)}}}}}}for(;!(this.isAtEnd()||this.checkIsCommand()||this.isCommand(this.peek().value)||this.check("then")||this.check("and")||this.check(",")||this.check("on"));)this.advance();if(!this.match("then","and",",")&&!this.checkIsCommand()&&!this.isCommand(this.peek().value))break}const u=this.getPosition(),p={type:"eventHandler",event:1===e.length?e[0]:e.join("|"),events:e,commands:c,...n.length>0&&{params:n},...a&&{condition:a},...o&&{target:o},...s&&{attributeName:s},...l&&{watchTarget:l},...r&&{customEventSource:r},...Object.keys(i).length>0&&{modifiers:i},start:u.start,end:u.end,line:u.line,column:u.column};return e.join(", "),p}parseBehaviorDefinition(){const e=this.getPosition(),t=this.consumeIdentifier("Expected behavior name after 'behavior' keyword").value;/^[A-Z]/.test(t)||this.addError(`Behavior name must start with uppercase letter (got "${t}")`);const r=[];if(this.match("(")){if(!this.check(")"))do{const e=this.consumeIdentifierLike("Expected parameter name");r.push(e.value)}while(this.match(","));this.consume(")","Expected ')' after behavior parameters")}const n=new Set(r),i=[];let a;for(;!this.isAtEnd()&&!this.check("end");)if(this.match("on")){const e=this.getPosition(),t=this.peek().value;this.advance();const r=[];if(this.check("(")){for(this.advance();!this.isAtEnd()&&!this.check(")");){const e=this.peek();Pe(e)?(r.push(e.value),this.advance(),this.check(",")&&this.advance()):this.advance()}this.check(")")&&this.advance()}let a;if(this.check("from")){this.advance();const e=[];if(this.check("the")&&this.advance(),!this.isAtEnd()){const t=this.peek(),r=n.has(t.value);this.checkIsCommand()&&!r||(e.push(t.value),a=t.value,this.advance())}}const o=[];for(;!this.isAtEnd()&&!this.check("end");){if(!this.checkIsCommand()&&!this.isCommand(this.peek().value)){this.check("end")||this.addError(`Unexpected token in event handler: ${this.peek().value}`);break}{this.advance();const e=this.error;try{const t=this.parseCommand();for(this.error&&this.error!==e&&(this.error=e),o.push(t);!(this.isAtEnd()||this.check("end")||this.checkIsCommand()||this.isCommand(this.peek().value));)this.advance()}catch(t){this.error=e;break}}}const s={type:"eventHandler",event:t,commands:o,...void 0!==a&&{target:a},...r.length>0&&{args:r},start:e.start,end:this.getPosition().end,line:e.line,column:e.column};i.push(s),this.consume("end","Expected 'end' after event handler body")}else{if(!this.match("init")){this.addError(`Unexpected token in behavior body: ${this.peek().value}`);break}a={type:"initBlock",commands:this.parseCommandBlock(["end"]),start:e.start,end:this.getPosition().end,line:e.line,column:e.column},this.consume("end","Expected 'end' after init block")}this.consume("end","Expected 'end' to close behavior definition");return{type:"behavior",name:t,parameters:r,eventHandlers:i,...void 0!==a?{initBlock:a}:{},start:e.start,end:this.getPosition().end,line:e.line,column:e.column}}parseCommandSequence(){const e=[];for(;!this.isAtEnd();){if(this.checkIsCommand()||this.isCommand(this.peek().value)&&!this.isKeyword(this.peek().value)){this.advance();const t=this.error,r=this.parseCommand();if(this.error&&this.error!==t){this.error.message.includes("Expected closing parenthesis")||this.error.message.includes("Expected ')'")||this.error.message.includes("unclosed parenthes")||this.error.message.includes("Unclosed parenthes")||(this.error=t)}for(e.push(r);!(this.isAtEnd()||this.checkIsCommand()||this.isCommand(this.peek().value)||this.check("then")||this.check("on"));)this.peek(),this.advance();if(this.check("on"))break;if(this.match("then"))continue;if(this.checkIsCommand()||this.isCommand(this.peek().value)&&!this.isKeyword(this.peek().value))continue;break}this.addError(`Expected command, got: ${this.peek().value}`);break}return 1===e.length?e[0]:{type:"CommandSequence",commands:e,start:e[0]?.start||0,end:e[e.length-1]?.end||0,line:e[0]?.line||1,column:e[0]?.column||1}}getMultiWordPattern(e){return function(e){return Rn.find(t=>t.command===e.toLowerCase())||null}(e)}isTokenKeyword(e,t){return Mn(e,t)}parseMultiWordCommand(e,t){return function(e,t,r){const n=e.getMultiWordPattern(r);if(!n)return null;const i=[],a={};for(;!_n(e,["catch","finally",...n.keywords])&&!Mn(e.peek(),n.keywords);){const t=e.parsePrimary();if(!t)break;if(i.push(t),!e.match(",")&&Mn(e.peek(),n.keywords))break}for(;!e.isAtEnd()&&Mn(e.peek(),n.keywords);){const t=e.advance().value,r=e.parseExpression();if(r&&(a[t]=r),!Mn(e.peek(),n.keywords))break}const o=Dn.from(t).withArgs(...i).endingAt(e.getPosition());return Object.keys(a).length>0&&o.withModifiers(a),o.build()}(this.getContext(),e,t)}parseCommandBlock(e){const t=[];for(;!this.isAtEnd()&&!e.some(e=>this.check(e));)if(this.checkComment())this.advance();else{if(!this.checkIsCommand()&&!this.isCommand(this.peek().value))break;{this.advance();const e=this.parseCommand();t.push(e)}}return t}trySemanticParse(e){if(!this.semanticAdapter||!this.semanticAdapter.isAvailable())return null;try{const t=this.semanticAdapter.trySemanticParse(e);return t.success&&t.node?t.node:null}catch(e){return null}}getRemainingInput(){if(!this.originalInput)return this.tokens.slice(this.current>0?this.current-1:0).map(e=>e.value).join(" ");const e=this.current>0?this.tokens[this.current-1]:this.tokens[0];return e&&void 0!==e.start?this.originalInput.slice(e.start):this.originalInput}skipToCommandBoundary(){const e=["then","and","else","end"];for(;!this.isAtEnd();){const t=this.peek(),r=t.value.toLowerCase();if(e.includes(r))break;if(ge(t))break;this.advance()}}parseCommand(){const e=this.previous();let t=e.value;if(this.semanticAdapter&&!["install","wait","repeat","for","set","put","add","if","unless","make","measure","trigger","halt","remove","exit","return","closest","js","tell"].includes(t.toLowerCase())){const e=this.getRemainingInput(),t=this.trySemanticParse(e);if(t)return this.skipToCommandBoundary(),t}"beep"===t&&this.check("!")&&(this.advance(),t="beep!");const r=this.parseMultiWordCommand(e,t);if(r)return r;const n=t.toLowerCase();if("repeat"===n)return this.parseRepeatCommand(e);if("for"===n)return this.parseForCommand(e);if("if"===n||"unless"===n)return this.parseIfCommand(e);if("wait"===n)return this.parseWaitCommand(e);if("install"===n)return this.parseInstallCommand(e);if("transition"===n)return this.parseTransitionCommand(e);if("add"===n)return this.parseAddCommand(e);if(this.isCompoundCommand(n)){return this.parseCompoundCommand({type:"identifier",name:n,start:e.start||0,end:e.end||0,line:e.line,column:e.column})||this.createErrorNode()}const i=[];if(("increment"===t||"decrement"===t)&&!this.isAtEnd())return function(e,t){const r=t.value,n="increment"===r?"+":"-";let i=!1;e.check(T)&&(i=!0,e.advance());const a=e.parseExpression();if(!a)throw new Error(`Expected variable or expression after ${r}`);let o;if(e.check(w)){e.advance();const t=e.parseExpression();if(!t)throw new Error(`Expected amount after 'by' in ${r} command`);o=t}else o=Nn(1,"1",{start:t.start,end:e.previous().end,line:t.line,column:t.column});let s=a;i&&"identifier"===a.type&&(s={...a,scope:"global"});const l={start:t.start,end:e.previous().end,line:t.line,column:t.column},c=In(n,a,o,l);return{type:"command",name:"set",args:[s,On(y,l),c],isBlocking:!1,start:t.start,end:e.previous().end,line:t.line,column:t.column,originalCommand:r}}(this.getContext(),e);for(;!(this.isAtEnd()||this.check("then")||this.check("and")||this.check("else")||this.check("end")||this.checkIsCommand());){const e=this.parseExpression();if(i.push(e||this.parsePrimary()),this.match(","))continue;const t=["into","from","to","with","by","at","before","after","over"];if(t.some(e=>this.check(e)))continue;const r=i[i.length-1];if(!r||"identifier"!==r.type&&"keyword"!==r.type||!t.includes(r.name||r.value))break}const a=this.getPosition();return{type:"command",name:t,args:i,isBlocking:!1,start:a.start,end:a.end,line:a.line,column:a.column}}parseConditional(){const e=this.parseExpression();this.consume("then","Expected 'then' after if condition");const t=this.parseConditionalBranch();let r;this.match("else")&&(r=this.parseConditionalBranch());const n=this.getPosition();return{type:"conditionalExpression",test:e,consequent:t,alternate:r,start:n.start,end:n.end,line:n.line,column:n.column}}parseConditionalBranch(){if(this.checkIsCommand()){const e=this.advance(),t=this.createIdentifier(e.value);return this.createCommandFromIdentifier(t)||t}if(this.checkIdentifier()||this.checkKeyword()){const e=this.peek();if(this.isCommand(e.value)){const e=this.advance(),t=this.createIdentifier(e.value);return this.createCommandFromIdentifier(t)||t}}return this.parseExpression()}parseNavigationFunction(e){const t=[];if(this.match("of"))t.push(this.parseExpression());else{if(this.check("("))return this.finishCall(this.createIdentifier(e));this.isAtEnd()||this.checkBasicOperator()||this.check("then")||this.check("else")||t.push(this.parsePrimary())}return this.createCallExpression(this.createIdentifier(e),t)}parseTheXofY(){if(!this.checkIdentifier())return this.createIdentifier("the");const e=this.peek(),t=e.value;if(["first","last","next","previous","random","closest"].includes(t))return this.advance(),this.parseNavigationFunction(t);const r=this.current;if(this.advance(),!this.check("of"))return this.current=r,this.createIdentifier("the");this.advance();return{type:"propertyOfExpression",property:{type:"identifier",name:t},target:this.parsePrimary(),line:e.line,column:e.column}}parseContextPropertyAccess(e){if("me"===e&&this.match("*")){let t="";if(!this.checkIdentifier())return this.addError("Expected property name after 'my *'"),this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(""),!1);for(t=this.advance().value;this.check("-")&&!this.isAtEnd();){if(t+="-",this.advance(),!this.checkIdentifier()){this.addError("Expected identifier after hyphen in CSS property name");break}t+=this.advance().value}const r=`computed-${t}`;return this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(r),!1)}{const t=this.consumeIdentifier(`Expected property name after '${{me:"my",it:"its",you:"your"}[e]}'`);return this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(t.value),!1)}}parseMyPropertyAccess(){return this.parseContextPropertyAccess("me")}finishCall(e){const t=[];if(!this.check(")"))do{if(this.check(","))return this.addError("Unexpected token in function arguments"),this.createCallExpression(e,[this.createErrorNode()]);t.push(this.parseExpression())}while(this.match(","));if(!this.check(")")&&"identifier"===e.type){const t=e.name;$.isCSSFunction(t)}return this.consume(")","Expected ')' after arguments"),this.createCallExpression(e,t)}createLiteral(e,t){return Nn(e,t,this.getPosition())}createIdentifier(e){return On(e,this.getPosition())}createBinaryExpression(e,t,r){return In(e,t,r,this.getPosition())}createUnaryExpression(e,t,r){return function(e,t,r,n){return{type:"unaryExpression",operator:e,argument:t,prefix:r,start:n.start,end:n.end,line:n.line,column:n.column}}(e,t,r,this.getPosition())}createCallExpression(e,t){return function(e,t,r){return{type:"callExpression",callee:e,arguments:t,start:r.start,end:r.end,line:r.line,column:r.column}}(e,t,this.getPosition())}createMemberExpression(e,t,r){return function(e,t,r,n){return{type:"memberExpression",object:e,property:t,computed:r,start:n.start,end:n.end,line:n.line,column:n.column}}(e,t,r,this.getPosition())}createSelector(e){return function(e,t){return{type:"selector",value:e,start:t.start,end:t.end,line:t.line,column:t.column}}(e,this.getPosition())}createPossessiveExpression(e,t){return function(e,t,r){return{type:"possessiveExpression",object:e,property:t,start:r.start,end:r.end,line:r.line,column:r.column}}(e,t,this.getPosition())}createErrorNode(){return{type:"identifier",name:"__ERROR__",start:(e=this.getPosition()).start,end:e.end,line:e.line,column:e.column};var e}processEscapeSequences(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case"n":return"\n";case"t":return"\t";case"r":return"\r";case"b":return"\b";case"f":return"\f";case"v":return"\v";case"0":return"\0";case"\\":return"\\";case'"':return'"';case"'":return"'";default:return t}})}createProgramNode(e){return function(e){if(0===e.length)return{type:"identifier",name:"__ERROR__",start:0,end:0,line:1,column:1};if(1===e.length)return e[0];const t={type:"Program",statements:e,start:e[0]?.start||0,end:e[e.length-1]?.end||0,line:e[0]?.line||1,column:e[0]?.column||1};return t}(e)}match(...e){for(const t of e)if(this.check(t))return this.advance(),!0;return!1}matchOperator(e){if(this.isAtEnd())return!1;const t=this.peek();return!(!We(t)||t.value!==e)&&(this.advance(),!0)}check(e){if(this.isAtEnd())return!1;const t=this.peek().value;return this.resolveKeyword(t)===e}checkPredicate(e){return!this.isAtEnd()&&e(this.peek())}matchPredicate(e){return!!this.checkPredicate(e)&&(this.advance(),!0)}checkSelector(){return this.checkPredicate(Te)}matchSelector(){return this.matchPredicate(Te)}checkAnySelector(){return this.checkPredicate(Se)}checkLiteral(){return this.checkPredicate(Ce)}checkIdentifierLike(){return this.checkPredicate(Ee)}checkIsCommand(){return this.checkPredicate(ge)}checkCommandTerminator(){return this.checkPredicate(Ue)}checkReference(){return this.checkPredicate(Ae)}checkTimeExpression(){return this.checkPredicate(Le)}checkEvent(){return this.checkPredicate(we)}checkContextVar(){return this.checkPredicate(be)}checkComment(){return this.checkPredicate(je)}checkIdentifier(){return this.checkPredicate(Pe)}checkKeyword(){return this.checkPredicate(ke)}checkString(){return this.checkPredicate(Ne)}matchString(){return this.matchPredicate(Ne)}checkNumber(){return this.checkPredicate(Oe)}matchNumber(){return this.matchPredicate(Oe)}checkBoolean(){return this.checkPredicate(Ie)}matchBoolean(){return this.matchPredicate(Ie)}checkTemplateLiteral(){return this.checkPredicate(Re)}matchTemplateLiteral(){return this.matchPredicate(Re)}checkQueryReference(){return this.checkPredicate(Me)}matchQueryReference(){return this.matchPredicate(Me)}checkIdSelector(){return this.checkPredicate(qe)}checkClassSelector(){return this.checkPredicate(_e)}checkCssSelector(){return this.checkPredicate($e)}checkBasicOperator(){return this.checkPredicate(We)}matchBasicOperator(){return this.matchPredicate(We)}matchTimeExpression(){return this.matchPredicate(Le)}matchIdentifierLike(){return this.matchPredicate(Ee)}matchComparisonOperator(){return this.matchPredicate(xe)}consumePredicate(e,t){return this.checkPredicate(e)?this.advance():(this.addError(t),this.peek())}consumeIdentifier(e){return this.consumePredicate(Pe,e)}consumeIdentifierLike(e){return this.consumePredicate(Ee,e)}consumeEvent(e){return this.consumePredicate(we,e)}advance(){return this.isAtEnd()||this.current++,this.previous()}isAtEnd(){return this.current>=this.tokens.length}peek(){return this.isAtEnd()?{kind:"unknown",value:"",start:0,end:0,line:1,column:1}:this.tokens[this.current]}previous(){return this.tokens[this.current-1]}consume(e,t){return this.check(e)?this.advance():(this.addError(t),this.peek())}addError(e){const t=this.peek();let r=t.start||0,n=t.line||1,i=t.column||1;if(e.includes("property name after '.'")){const e=this.current>0?this.previous():t;r=e.end||e.start||0,n=e.line||1,i=e.column||1}if(e.includes("parenthes")){const e=this.current>0?this.previous():t;r=e.end||e.start||0,n=e.line||1,i=e.column||1,0===r&&this.current>0&&(r=this.current)}if(e.includes("Expected expression after")){const e=this.current>0?this.previous():t;r=e.start||0,n=e.line||1,i=e.column||1,0===r&&(r=Math.max(1,this.current-1))}if(e.includes("Missing operand")){let e=t;for(let t=this.current-1;t>=0;t--){const r=this.tokens[t];if(r&&("+"===r.value||"-"===r.value)){e=r;break}}r=e.start||0,n=e.line||1,i=e.column||1}this.error={message:e,line:Math.max(1,n),column:Math.max(1,i),position:Math.max(0,r)}}parseAttributeOrArrayLiteral(){const e=this.previous().start,t=this.previous().line,r=this.previous().column;if(!this.isAtEnd()&&this.peek().value.startsWith("@")){const n=[];for(;!this.check("]")&&!this.isAtEnd();){const e=this.advance();n.push(e.value)}this.consume("]","Expected ']' after attribute literal");const i="["+n.join("")+"]";return{type:"literal",value:i,raw:i,start:e,end:this.previous().end,line:t,column:r}}const n=[];if(!this.check("]"))do{if(this.check("]"))break;n.push(this.parseExpression())}while(this.match(","));return this.consume("]","Expected ']' after array elements"),{type:"arrayLiteral",elements:n,start:e,end:this.previous().end,line:t,column:r}}getPosition(){const e=this.current>0?this.previous():this.peek();return{start:e.start||0,end:e.end||0,line:e.line||1,column:e.column||1}}getContext(){const e=this,t={tokens:this.tokens,advance:this.advance.bind(this),peek:this.peek.bind(this),previous:this.previous.bind(this),consume:this.consume.bind(this),check:this.check.bind(this),checkIdentifierLike:this.checkIdentifierLike.bind(this),checkSelector:this.checkSelector.bind(this),checkAnySelector:this.checkAnySelector.bind(this),checkLiteral:this.checkLiteral.bind(this),checkReference:this.checkReference.bind(this),checkTimeExpression:this.checkTimeExpression.bind(this),checkEvent:this.checkEvent.bind(this),checkIsCommand:this.checkIsCommand.bind(this),checkContextVar:this.checkContextVar.bind(this),match:this.match.bind(this),matchOperator:this.matchOperator.bind(this),isAtEnd:this.isAtEnd.bind(this),createIdentifier:this.createIdentifier.bind(this),createLiteral:this.createLiteral.bind(this),createSelector:this.createSelector.bind(this),createBinaryExpression:this.createBinaryExpression.bind(this),createUnaryExpression:this.createUnaryExpression.bind(this),createMemberExpression:this.createMemberExpression.bind(this),createPossessiveExpression:this.createPossessiveExpression.bind(this),createCallExpression:this.createCallExpression.bind(this),createErrorNode:this.createErrorNode.bind(this),createProgramNode:this.createProgramNode.bind(this),createCommandFromIdentifier:this.createCommandFromIdentifier.bind(this),parseExpression:this.parseExpression.bind(this),parsePrimary:this.parsePrimary.bind(this),parseCall:this.parseCall.bind(this),parseAssignment:this.parseAssignment.bind(this),parseLogicalOr:this.parseLogicalOr.bind(this),parseLogicalAnd:this.parseLogicalAnd.bind(this),parseEquality:this.parseEquality.bind(this),parseComparison:this.parseComparison.bind(this),parseAddition:this.parseAddition.bind(this),parseMultiplication:this.parseMultiplication.bind(this),parseImplicitBinary:this.parseImplicitBinary.bind(this),parseConditional:this.parseConditional.bind(this),parseConditionalBranch:this.parseConditionalBranch.bind(this),parseEventHandler:this.parseEventHandler.bind(this),parseBehaviorDefinition:this.parseBehaviorDefinition.bind(this),parseNavigationFunction:this.parseNavigationFunction.bind(this),parseMyPropertyAccess:this.parseMyPropertyAccess.bind(this),parseDollarExpression:this.parseDollarExpression.bind(this),parseHyperscriptSelector:this.parseHyperscriptSelector.bind(this),parseAttributeOrArrayLiteral:this.parseAttributeOrArrayLiteral.bind(this),parseObjectLiteral:this.parseObjectLiteral.bind(this),parseCSSObjectLiteral:this.parseCSSObjectLiteral.bind(this),parseCommand:this.parseCommand.bind(this),parseCommandSequence:this.parseCommandSequence.bind(this),parseCommandListUntilEnd:this.parseCommandListUntilEnd.bind(this),getPosition:this.getPosition.bind(this),addError:this.addError.bind(this),addWarning:this.addWarning.bind(this),isCommand:this.isCommand.bind(this),isCompoundCommand:this.isCompoundCommand.bind(this),isKeyword:this.isKeyword.bind(this),getMultiWordPattern:this.getMultiWordPattern.bind(this),resolveKeyword:this.resolveKeyword.bind(this),getInputSlice:(e,t)=>this.originalInput?e<0||e>=this.originalInput.length?"":void 0!==t?this.originalInput.slice(e,t):this.originalInput.slice(e):""};return Object.defineProperty(t,"current",{get:()=>e.current,set:t=>{e.current=t},enumerable:!0,configurable:!0}),t}}ei.POSTFIX_UNARY_OPERATORS=new Set(["exists","does not exist","is empty","is not empty"]);class ti{constructor(){this.hooks=new Map,this.beforeExecuteHooks=[],this.afterExecuteHooks=[],this.onErrorHooks=[],this.interceptCommandHooks=[]}register(e,t){this.unregister(e),this.hooks.set(e,t),t.beforeExecute&&this.beforeExecuteHooks.push(t.beforeExecute),t.afterExecute&&this.afterExecuteHooks.push(t.afterExecute),t.onError&&this.onErrorHooks.push(t.onError),t.interceptCommand&&this.interceptCommandHooks.push(t.interceptCommand)}unregister(e){const t=this.hooks.get(e);if(!t)return!1;if(t.beforeExecute){const e=this.beforeExecuteHooks.indexOf(t.beforeExecute);e>-1&&this.beforeExecuteHooks.splice(e,1)}if(t.afterExecute){const e=this.afterExecuteHooks.indexOf(t.afterExecute);e>-1&&this.afterExecuteHooks.splice(e,1)}if(t.onError){const e=this.onErrorHooks.indexOf(t.onError);e>-1&&this.onErrorHooks.splice(e,1)}if(t.interceptCommand){const e=this.interceptCommandHooks.indexOf(t.interceptCommand);e>-1&&this.interceptCommandHooks.splice(e,1)}return this.hooks.delete(e)}has(e){return this.hooks.has(e)}async runBeforeExecute(e){for(const t of this.beforeExecuteHooks)await t(e)}async runAfterExecute(e,t){for(const r of this.afterExecuteHooks)await r(e,t)}async runOnError(e,t){let r=t;for(const t of this.onErrorHooks){const n=await t(e,r);n instanceof Error&&(r=n)}return r}shouldIntercept(e,t){for(const r of this.interceptCommandHooks)if(r(e,t))return!0;return!1}getRegisteredNames(){return Array.from(this.hooks.keys())}clear(){this.hooks.clear(),this.beforeExecuteHooks=[],this.afterExecuteHooks=[],this.onErrorHooks=[],this.interceptCommandHooks=[]}}function ri(e){return{ok:!0,value:e}}function ni(e){return{ok:!1,error:e}}function ii(e){return!0===e.ok}class ai{constructor(e){this.elementCleanups=new WeakMap,this.trackedElements=new Set,this.globalCleanups=[],this.debugMode=e?.debug??!1}registerListener(e,t,r,n,i){this.addCleanup(e,{type:"listener",target:t,eventName:r,cleanup:()=>{t.removeEventListener(r,n,i)},description:`${r} listener`})}registerObserver(e,t){this.addCleanup(e,{type:"observer",cleanup:()=>{t.disconnect()},description:"MutationObserver"})}registerInterval(e,t){this.addCleanup(e,{type:"interval",cleanup:()=>{clearInterval(t)},description:"Interval"})}registerTimeout(e,t){this.addCleanup(e,{type:"timeout",cleanup:()=>{clearTimeout(t)},description:"Timeout"})}registerCustom(e,t,r){this.addCleanup(e,{type:"custom",cleanup:t,description:r||"Custom cleanup"})}registerGlobal(e,t="custom",r){this.globalCleanups.push({type:t,cleanup:e,description:r||"Global cleanup"})}addCleanup(e,t){const r=this.elementCleanups.get(e)||[];r.push(t),this.elementCleanups.set(e,r),this.trackedElements.add(e)}cleanupElement(e){const t=this.elementCleanups.get(e);if(!t||0===t.length)return 0;let r=0;for(const e of t)try{e.cleanup(),r++}catch(e){}return this.elementCleanups.delete(e),this.trackedElements.delete(e),r}cleanupElementTree(e){let t=this.cleanupElement(e);const r=e.querySelectorAll("*");for(const e of r)t+=this.cleanupElement(e);return t}cleanupGlobal(){let e=0;for(const t of this.globalCleanups)try{t.cleanup(),e++}catch(e){}return this.globalCleanups=[],e}cleanupAll(){return this.cleanupGlobal()}hasCleanups(e){const t=this.elementCleanups.get(e);return void 0!==t&&t.length>0}getCleanupCount(e){const t=this.elementCleanups.get(e);return t?.length??0}getStats(){let e=0,t=0,r=0,n=0,i=0;for(const a of this.trackedElements){const o=this.elementCleanups.get(a);if(o)for(const a of o)switch(a.type){case"listener":e++;break;case"observer":t++;break;case"interval":r++;break;case"timeout":n++;break;case"custom":i++}}for(const a of this.globalCleanups)switch(a.type){case"listener":e++;break;case"observer":t++;break;case"interval":r++;break;case"timeout":n++;break;case"custom":i++}return{elementsTracked:this.trackedElements.size,listeners:e,observers:t,intervals:r,timeouts:n,custom:i,global:this.globalCleanups.length}}setDebugMode(e){this.debugMode=e}}const oi=new Map;function si(e,t){return{me:e||null,it:null,you:null,result:null,locals:new Map,globals:oi,flags:{halted:!1,breaking:!1,continuing:!1,returning:!1,async:!1}}}class li{constructor(){this.sources=new Map,this.subscriptions=new Map,this.nextId=1}register(e,t){const r=e.toLowerCase();this.sources.has(r),this.sources.set(r,t)}unregister(e){const t=e.toLowerCase(),r=this.sources.get(t);if(r){for(const[e,r]of this.subscriptions.entries())r.source===t&&(r.unsubscribe(),this.subscriptions.delete(e));return r.destroy?.(),this.sources.delete(t)}return!1}get(e){return this.sources.get(e.toLowerCase())}has(e){return this.sources.has(e.toLowerCase())}subscribe(e,t,r){const n=this.get(e);if(!n)return;n.initialize?.();const i=n.subscribe(t,r);return this.subscriptions.set(i.id,i),i}unsubscribe(e){const t=this.subscriptions.get(e);return!!t&&(t.unsubscribe(),this.subscriptions.delete(e))}getSourceNames(){return Array.from(this.sources.keys())}getSubscriptions(){return Array.from(this.subscriptions.values())}findSourceForEvent(e){for(const[t,r]of this.sources.entries())if(r.supports?.(e)??r.supportedEvents?.includes(e))return t}generateId(){return`sub_${this.nextId++}_${Date.now().toString(36)}`}destroy(){for(const e of this.subscriptions.values())e.unsubscribe();this.subscriptions.clear();for(const e of this.sources.values())e.destroy?.();this.sources.clear()}}class ci{constructor(){this.providers=new Map,this.globalProviders=new Map}register(e,t,r){const n=e.toLowerCase();this.providers.set(n,"function"==typeof t?{name:n,provide:t,cache:r?.cache??!0,description:r?.description,dependencies:r?.dependencies}:t)}registerGlobal(e,t,r){const n=e.toLowerCase();this.globalProviders.set(n,"function"==typeof t?{name:n,provide:t,cache:r?.cache??!0,description:r?.description,dependencies:r?.dependencies}:t)}unregister(e){return this.providers.delete(e.toLowerCase())}unregisterGlobal(e){return this.globalProviders.delete(e.toLowerCase())}get(e){const t=e.toLowerCase();return this.providers.get(t)??this.globalProviders.get(t)}has(e){const t=e.toLowerCase();return this.providers.has(t)||this.globalProviders.has(t)}async resolve(e,t,r){const n=this.get(e);if(!n)return;const i=`__provider_${n.name}`;if(n.cache&&r?.has(i))return r.get(i);if(n.dependencies)for(const e of n.dependencies)await this.resolve(e,t,r);const a=await n.provide(t);return n.cache&&r&&r.set(i,a),a}resolveSync(e,t,r){const n=this.get(e);if(!n)return;const i=`__provider_${n.name}`;if(n.cache&&r?.has(i))return r.get(i);const a=n.provide(t);if(a instanceof Promise)throw new Error(`Context provider '${e}' is async. Use resolve() instead of resolveSync().`);return n.cache&&r&&r.set(i,a),a}enhance(e){const t=this,r=new Map;return new Proxy(e,{get(e,n,i){if("string"==typeof n){if(t.get(n))try{return t.resolveSync(n,e,r)}catch{return t.resolve(n,e,r)}}return Reflect.get(e,n,i)},has:(e,r)=>!("string"!=typeof r||!t.has(r))||Reflect.has(e,r)})}async resolveAll(e){const t=new Map,r={},n=[...this.globalProviders.entries(),...this.providers.entries()];for(const[i,a]of n)try{r[i]=await this.resolve(i,e,t)}catch(e){r[i]=void 0}return r}getProviderNames(){return[...new Set([...this.globalProviders.keys(),...this.providers.keys()])]}clear(){this.providers.clear(),this.globalProviders.clear()}}class ui{constructor(){this.expressionRegistry=new Map}registerCategory(e){Object.entries(e).forEach(([e,t])=>{this.expressionRegistry.set(e,t)})}unwrapSelectorResult(e){if(e instanceof NodeList&&e.length>0)return e[0];if(Array.isArray(e)&&e.length>0){const t=e[0];return"index"in e&&"input"in e?e:t instanceof Element||t instanceof Node?t:e}return e}async evaluate(e,t){if(!e)return null;if(!e.type)throw new Error(`Node missing type property: ${JSON.stringify(e)}`);switch(e.type){case"identifier":return this.evaluateIdentifier(e,t);case"literal":return this.evaluateLiteral(e,t);case"string":return e.value||e.content||"";case"memberExpression":return this.evaluateMemberExpression(e,t);case"binaryExpression":return this.evaluateBinaryExpression(e,t);case"unaryExpression":return this.evaluateUnaryExpression(e,t);case"callExpression":return this.evaluateCallExpression(e,t);case"selector":return this.evaluateSelector(e,t);case"dollarExpression":return this.evaluateDollarExpression(e,t);case"possessiveExpression":return this.evaluatePossessiveExpression(e,t);case"templateLiteral":return this.evaluateTemplateLiteral(e,t);case"arrayLiteral":return this.evaluateArrayLiteral(e,t);case"objectLiteral":return this.evaluateObjectLiteral(e,t);case"conditionalExpression":return this.evaluateConditionalExpression(e,t);case"cssSelector":return this.evaluateCSSSelector(e,t);case"propertyAccess":return this.evaluatePropertyAccess(e,t);case"propertyOfExpression":return this.evaluatePropertyOfExpression(e,t);case"contextReference":return this.evaluateContextReference(e,t);case"queryReference":return this.evaluateQueryReference(e,t);case"idSelector":return this.evaluateIdSelector(e,t);default:throw new Error(`Unsupported AST node type for evaluation: ${e.type}`)}}async evaluateWithResult(e,t){try{return ri(await this.evaluate(e,t))}catch(e){if(e instanceof Error){const t=e;if(t.isHalt||"HALT_EXECUTION"===t.message)return ni({type:"halt"});if(t.isExit||"EXIT_COMMAND"===t.message)return ni({type:"exit",returnValue:t.returnValue});if(t.isBreak)return ni({type:"break"});if(t.isContinue)return ni({type:"continue"});if(t.isReturn)return ni({type:"return",returnValue:t.returnValue})}throw e}}async evaluateArrayLiteral(e,t){const r=e.elements||[],n=[];for(const e of r){const r=await this.evaluate(e,t);n.push(r)}return n}async evaluateObjectLiteral(e,t){const r=e.properties||[],n={};for(const e of r){let r;if("identifier"===e.key.type)r=e.key.name;else if("literal"===e.key.type)r=String(e.key.value);else{const n=await this.evaluate(e.key,t);r=String(n)}const i=await this.evaluate(e.value,t);n[r]=i}return n}async evaluateConditionalExpression(e,t){return await this.evaluate(e.test,t)?this.evaluate(e.consequent,t):e.alternate?this.evaluate(e.alternate,t):void 0}async evaluateTemplateLiteral(e,t){let r=e.value||"";const n=/\$([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)/g,i=[];let a;for(;null!==(a=n.exec(r));)"{"!==r[a.index+1]&&i.push({match:a[0],varName:a[1],index:a.index});for(let e=i.length-1;e>=0;e--){const{match:n,varName:a,index:o}=i[e],s=await this.resolveTemplateVariable(a,t);r=r.slice(0,o)+String(s??"")+r.slice(o+n.length)}let o="",s=0;for(;s<r.length;){const e=r.indexOf("${",s);if(-1===e){o+=r.slice(s);break}o+=r.slice(s,e);const n=r.indexOf("}",e);if(-1===n)throw new Error(`Unterminated template expression in: ${r}`);const i=r.slice(e+2,n);let a;const l=i.trim();a=t.locals.has(l)?t.locals.get(l):t.variables&&t.variables.has(l)?t.variables.get(l):t.globals&&t.globals.has(l)?t.globals.get(l):await this.evaluateSimpleExpression(i,t),o+=String(a),s=n+1}return o}async resolveTemplateVariable(e,t){if(e.includes(".")){const r=e.split(".");let n=this.lookupTemplateVariable(r[0],t);for(let e=1;e<r.length&&null!=n;e++)n=n[r[e]];return n}return this.lookupTemplateVariable(e,t)}lookupTemplateVariable(e,t){return t.locals?.has(e)?t.locals.get(e):t.variables?.has(e)?t.variables.get(e):t.globals?.has(e)?t.globals.get(e):"me"===e?t.me:"it"===e?t.it:"result"===e?t.result:void 0}async evaluateSimpleExpression(e,t){const r=e.match(/^(.+?)\s*\?\s*(.+?)\s*:\s*(.+)$/);if(r){const[,e,n,i]=r,a=await this.resolveValue(e.trim(),t);if(a){const e=await this.resolveValue(n.trim(),t);return e}{const e=await this.resolveValue(i.trim(),t);return e}}const n=e.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*|\d+(?:\.\d+)?)\s*([\+\-\*\/\%])\s*([a-zA-Z_$][a-zA-Z0-9_$]*|\d+(?:\.\d+)?)$/);if(n){const[,e,r,i]=n,a=await this.resolveValue(e.trim(),t),o=await this.resolveValue(i.trim(),t),s=Number(a),l=Number(o);if(!isNaN(s)&&!isNaN(l)){let e;switch(r){case"+":e=s+l;break;case"-":e=s-l;break;case"*":e=s*l;break;case"/":e=s/l;break;case"%":e=s%l;break;default:e=s}return e}}const i=await this.resolveValue(e.trim(),t);return i}async resolveValue(e,t){if(t.locals.has(e),Array.from(t.locals.keys()),t.locals.get(e),t.locals.has(e)){const r=t.locals.get(e);return r}if(t.variables&&t.variables.has(e)){const r=t.variables.get(e);return r}if(t.globals&&t.globals.has(e)){const r=t.globals.get(e);return r}const r=Number(e);if(!isNaN(r))return r;if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);if(e.includes(".")){const r=e.split("."),n=r[0];let i=null;if(t.locals.has(n)?i=t.locals.get(n):t.variables&&t.variables.has(n)?i=t.variables.get(n):t.globals&&t.globals.has(n)&&(i=t.globals.get(n)),null!=i){for(let e=1;e<r.length;e++){if(null==i)return;i=i[r[e]]}return i}}return e}async evaluateIdentifier(e,t){const{name:r,scope:n}=e;if("me"===r||"my"===r||"I"===r)return t.me;if("you"===r||"your"===r)return t.you;if("it"===r||"its"===r)return t.it;if("result"===r)return t.result;const i=this.expressionRegistry.get(r);return i?i.evaluate(t):"local"===n?t.locals?.has(r)?t.locals.get(r):void 0:"global"===n?t.globals?.has(r)?t.globals.get(r):"undefined"!=typeof window&&r in window?window[r]:void 0:t.locals?.has(r)?t.locals.get(r):t.globals?.has(r)?t.globals.get(r):t.variables?.has(r)?t.variables.get(r):"undefined"!=typeof globalThis&&r in globalThis?globalThis[r]:"undefined"!=typeof window&&r in window?window[r]:void 0}async evaluateLiteral(e,t){return e.value}async evaluateContextReference(e,t){const{contextType:r}=e;switch(r){case"me":return t.me;case"it":return t.result;case"you":return t.you;case"event":return t.event;case"body":return t.meta?.ownerDocument?.body||document?.body;case"detail":return t.event?.detail;case"target":return t.you||t.event?.target;case"sender":return t.event?.target;default:return t.locals&&t.locals.has(r)?t.locals.get(r):void 0}}async evaluateMemberExpression(e,t){const{object:r,property:n,computed:i}=e;if("identifier"===r.type&&["add","remove"].includes(r.name)){const e=r.name,i=n.name||n;if(!t.me)throw new Error('Context element "me" is null');return void("add"===e?t.me.classList.add(i):"remove"===e&&t.me.classList.remove(i))}let a=await this.evaluate(r,t);if(i){return a[await this.evaluate(n,t)]}{a=this.unwrapSelectorResult(a);const e=n.name||n;if("string"==typeof e){if(e.startsWith("computed-")){const t=e.substring(9);if(a&&"undefined"!=typeof window&&a instanceof Element){return window.getComputedStyle(a).getPropertyValue(t)}return}if(e.startsWith("@")){const t=e.substring(1);return a&&"function"==typeof a.getAttribute?a.getAttribute(t):void 0}if(a&&a instanceof Element){if("previous"===e||"prev"===e)return a.previousElementSibling;if("next"===e)return a.nextElementSibling}}const t=a?.[e];return"function"==typeof t?t.bind(a):t}}async evaluateBinaryExpression(e,t){const{operator:r,left:n,right:i}=e;if("in"===r&&"selector"===n.type){let e=n.value;e.startsWith("<")&&e.endsWith("/>")&&(e=e.slice(1,-2).trim());const r=this.unwrapSelectorResult(await this.evaluate(i,t));if(!r||"function"!=typeof r.querySelector)throw new Error(`'in' operator requires a DOM element as the right operand (got: ${typeof r})`);const a=r.querySelectorAll(e);return Array.from(a)}if("in"===r&&"queryReference"===n.type){let e=n.selector;e.startsWith("<")&&e.endsWith("/>")&&(e=e.slice(1,-2).trim());const r=this.unwrapSelectorResult(await this.evaluate(i,t));if(!r||"function"!=typeof r.querySelector)throw new Error(`'in' operator requires a DOM element as the right operand (got: ${typeof r})`);const a=r.querySelectorAll(e);return Array.from(a)}if("in"===r){let e=null,r=null;if("positionalExpression"===n.type){e=n.operator;const i=n.argument;"cssSelector"===i?.type?r=i.selector:"selector"===i?.type?r=i.value:"classSelector"===i?.type?r="."+i.className:"idSelector"===i?.type?r="#"+i.id:i&&(r=String(await this.evaluate(i,t)))}else if("memberExpression"!==n.type||"identifier"!==n.object?.type||"first"!==n.object.name&&"last"!==n.object.name){if("callExpression"===n.type&&"identifier"===n.callee?.type&&("first"===n.callee.name||"last"===n.callee.name)){e=n.callee.name;const i=n.arguments?.[0];"selector"===i?.type?r=i.value:"cssSelector"===i?.type?r=i.selector:"classSelector"===i?.type?r="."+i.className:"idSelector"===i?.type?r="#"+i.id:i&&(r=String(await this.evaluate(i,t)))}}else e=n.object.name,"identifier"===n.property?.type&&n.property.name&&(r="."+n.property.name);if(e&&r){const n=this.unwrapSelectorResult(await this.evaluate(i,t));if(!n||"function"!=typeof n.querySelectorAll)return;const a=n.querySelectorAll(r),o=Array.from(a);return"first"===e?o.length>0?o[0]:void 0:"last"===e?o.length>0?o[o.length-1]:void 0:o}}if("matches"===r&&("selector"===i.type||"cssSelector"===i.type||"classSelector"===i.type)){const e=await this.evaluate(n,t),r=i.value||i.selector;if(e&&"function"==typeof e.matches)try{return e.matches(r)}catch{return!1}return!1}const a=await this.evaluate(n,t),o=await this.evaluate(i,t);if("has"===r||"have"===r){if(a instanceof Element&&("cssSelector"===i.type&&"class"===i.selectorType||"selector"===i.type&&i.value?.startsWith("."))){const e=i.selector?.slice(1)||i.value?.slice(1)||"";return a.classList.contains(e)}return!1}switch(r){case">":case"is greater than":return a>o;case"<":case"is less than":return a<o;case">=":case"is greater than or equal to":return a>=o;case"<=":case"is less than or equal to":return a<=o;case"==":case"equals":case"is equal to":return a==o;case"===":case"is really equal to":case"really equals":return a===o;case"!=":case"is not equal to":return a!=o;case"!==":case"is not really equal to":return a!==o;case"+":if("string"==typeof a||"string"==typeof o){const e=this.expressionRegistry.get("stringConcatenation");if(e){const r=await e.evaluate(t,{left:a,right:o});return r.success?r.value:a+o}}else{const e=this.expressionRegistry.get("addition");if(e){const r=await e.evaluate(t,{left:a,right:o});return r.success?r.value:a+o}}return a+o;case"-":return a-o;case"*":return a*o;case"/":return a/o;case"%":case"mod":return a%o;case"as":const e="string"==typeof o?o:"identifier"===i.type?i.name:"literal"===i.type?i.value:String(o),s=this.expressionRegistry.get("as");return s?s.evaluate(t,a,e):a;case"&&":case"and":return a&&o;case"||":case"or":return a||o;case"is":return a===o;case"is not":return a!==o;case"is a":case"is an":switch("identifier"===i.type?i.name.toLowerCase():String(o).toLowerCase()){case"string":return"string"==typeof a;case"number":return"number"==typeof a;case"boolean":return"boolean"==typeof a;case"object":return"object"==typeof a&&null!==a;case"array":return Array.isArray(a);case"function":return"function"==typeof a;case"null":return null===a;case"undefined":return void 0===a;default:const e="identifier"===i.type?i.name:String(o);return null!=a&&a.constructor?.name===e}case"is not a":case"is not an":switch("identifier"===i.type?i.name.toLowerCase():String(o).toLowerCase()){case"string":return"string"!=typeof a;case"number":return"number"!=typeof a;case"boolean":return"boolean"!=typeof a;case"object":return!("object"==typeof a&&null!==a);case"array":return!Array.isArray(a);case"function":return"function"!=typeof a;case"null":return null!==a;case"undefined":return void 0!==a;default:const e="identifier"===i.type?i.name:String(o);return!(null!=a&&a.constructor?.name===e)}case"=":if("identifier"===n.type){const e=n.name;return"result"===e?Object.assign(t,{result:o}):"it"===e?Object.assign(t,{it:o}):"you"===e?t.you=o:(t.variables||Object.assign(t,{variables:new Map}),t.variables.set(e,o)),o}throw new Error("Left side of assignment must be an identifier");case"contains":case"include":case"includes":return Array.isArray(a)?a.includes(o):"string"==typeof a?a.includes(String(o)):!(!a||"function"!=typeof a.matches)&&a.matches(String(o));case"match":case"matches":if(a&&"function"==typeof a.matches){const e="string"==typeof o?o:String(o);try{return a.matches(e)}catch{return!1}}return!1;case"in":const l="string"==typeof a?a:String(a),c=o;if(!c||"function"!=typeof c.querySelector){if(Array.isArray(c))return c.includes(a);if("object"==typeof c&&null!==c)return l in c;throw new Error(`'in' operator requires a DOM element, array, or object as the right operand (got: ${typeof c})`)}return c.querySelector(l);case" ":return"string"==typeof a&&"string"==typeof o?{command:a,selector:o}:"identifier"===n.type&&"selector"===i.type?{command:n.name,selector:i.value}:o;default:throw new Error(`Unsupported binary operator: "${r}" (length: ${r.length})`)}}async evaluateUnaryExpression(e,t){const{operator:r,argument:n}=e,i=await this.evaluate(n,t);switch(r){case"not":case"!":const e=this.expressionRegistry.get("not");return e?e.evaluate(t,i):!i;case"no":const n=this.expressionRegistry.get("no");return!!n&&n.evaluate(t,i);case"some":return null!=i&&("string"==typeof i||Array.isArray(i)||i instanceof NodeList||i instanceof HTMLCollection?i.length>0:"object"!=typeof i||Object.keys(i).length>0);case"exists":const a=this.expressionRegistry.get("exists");return a?a.evaluate(t,i):null!=i;case"does not exist":const o=this.expressionRegistry.get("doesNotExist");return o?o.evaluate(t,i):null==i;case"-":return-i;case"+":return+i;default:throw new Error(`Unsupported unary operator: ${r}`)}}async evaluateCallExpression(e,t){const{callee:r,arguments:n,isConstructor:i}=e;if(i){const e=r.name,i=t.globals?.get(e)||window[e];if("function"==typeof i){return new i(...await Promise.all(n.map(e=>this.evaluate(e,t))))}throw new Error(`Unknown constructor: ${e}`)}if("memberExpression"===r.type||"propertyAccess"===r.type){return await this.evaluateMethodCall(r,n,t)}const a=r.name||r,o=this.expressionRegistry.get(a);if(o){const e=["first","last","random","at"],r=["closest","previous","next"].includes(a),i=e.includes(a),s=await Promise.all(n.map(e=>r&&e&&"selector"===e.type&&"string"==typeof e.value?e.value:r&&e&&"identifier"===e.type&&"string"==typeof e.name?e.name:i&&e&&"selector"===e.type&&"string"==typeof e.value?this.evaluateSelector(e,t):this.evaluate(e,t)));return o.evaluate(t,...s)}const s=t.globals?.get(a)||window[a];if("function"==typeof s){return s(...await Promise.all(n.map(e=>this.evaluate(e,t))))}throw new Error(`Unknown function: ${a}`)}async evaluateMethodCall(e,t,r){try{const n=await this.evaluate(e.object,r),i=this.unwrapSelectorResult(n);if(null==i)throw new Error("Cannot call method on null or undefined");const a=e.property?.name||e.property?.value||e.property;if(!a||"string"!=typeof a)throw new Error(`Invalid method name: ${a}`);const o=i[a];if("function"!=typeof o)throw new Error(`Property "${a}" is not a function on ${i.constructor?.name||typeof i}`);const s=await Promise.all(t.map(e=>this.evaluate(e,r)));return o.apply(i,s)}catch(e){if(e instanceof Error)throw e;throw new Error(`Failed to evaluate method call: ${e}`)}}async evaluateSelector(e,t){let r=e.value;r.startsWith("<")&&r.endsWith("/>")&&(r=r.slice(1,-2).trim());const n=t.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!n)return[];const i=n.querySelectorAll(r);return Array.from(i).filter(e=>e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.tagName)}getAvailableExpressions(){return Array.from(this.expressionRegistry.keys())}async evaluateDollarExpression(e,t){const r=await this.evaluate(e.expression,t);if("identifier"===e.expression.type){const r=e.expression.name;return/^\d+$/.test(r)?r:t.locals?.has(r)?t.locals.get(r):"me"===r&&t.me?t.me:"you"===r&&t.you?t.you:"it"===r&&t.it?t.it:"result"===r&&t.result?t.result:"undefined"!=typeof window&&"window"===r?window:t.globals?.has(r)?t.globals.get(r):""}return r}async evaluatePossessiveExpression(e,t){const{object:r,property:n}=e,i=this.unwrapSelectorResult(await this.evaluate(r,t));if(!i)return;const a=n.name||n.value||n;if("string"==typeof a){if(a.startsWith("@")){const e=a.substring(1);if(i&&"function"==typeof i.getAttribute)return i.getAttribute(e)}if(a.startsWith("computed-")){const e=a.substring(9);if(i&&"undefined"!=typeof window&&i instanceof Element){return window.getComputedStyle(i).getPropertyValue(e)}}if(a.startsWith("style.")){const e=a.substring(6);if(i&&i.style)return i.style[e]}return i[a]}return i[a]}hasExpression(e){return this.expressionRegistry.has(e)}async evaluateCSSSelector(e,t){let r=e.selector;if(r.startsWith("<")&&r.endsWith("/>")&&(r=r.slice(1,-2).trim()),"id"===e.selectorType){const e=r.startsWith("#")?r.slice(1):r;return document.getElementById(e)}if("class"===e.selectorType){const e=r.replace(/:/g,"\\:"),t=document.querySelectorAll(e);return Array.from(t).filter(e=>e instanceof HTMLElement)}const n=document.querySelectorAll(r);return Array.from(n).filter(e=>e instanceof HTMLElement)}async evaluateIdSelector(e,t){const r=e.value.startsWith("#")?e.value.slice(1):e.value;return document.getElementById(r)}async evaluateQueryReference(e,t){let r=e.selector;r.startsWith("<")&&r.endsWith("/>")&&(r=r.slice(1,-2).trim());try{return document.querySelectorAll(r)}catch{return document.createDocumentFragment().childNodes}}async evaluatePropertyAccess(e,t){const r=await this.evaluate(e.object,t),n=e.property;if(null==r)throw new Error(`Cannot access property "${n.name||n.value}" of ${r}`);const i=n.name||n.value;if(!i)throw new Error("Property name must be an identifier");try{let e;return e=Ct(r)?Lt(r,i):r[i],"function"==typeof e?e.bind(r):e}catch(e){throw new Error(`Error accessing property "${i}": ${e}`)}}async evaluatePropertyOfExpression(e,t){const r=e.property,n=r.name||r.value;if(!n)throw new Error('Property name must be an identifier in "the X of Y" pattern');const i=this.unwrapSelectorResult(await this.evaluate(e.target,t));if(null==i)throw new Error(`Cannot access property "${n}" of ${i}`);try{let e;return e=Ct(i)?Lt(i,n):i[n],"function"==typeof e?e.bind(i):e}catch(e){throw new Error(`Failed to access property "${n}" on target: ${e}`)}}}const pi={possessive:{name:"possessive",category:"Reference",evaluatesTo:"Any",operators:["'s","s"],async evaluate(e,...t){const[r,n]=t;if(null!=r){if("string"!=typeof n)throw new Error("Property name must be a string");return r instanceof Element?Lt(r,n):(rt(r),r[n])}},validate:e=>$t(e,2,"possessive","element, property")??Wt(e,1,"possessive","property name")},my:{name:"my",category:"Reference",evaluatesTo:"Any",operators:["my"],async evaluate(e,...t){const[r]=t;if(e.me){if("string"!=typeof r)throw new Error("Property name must be a string");return e.me instanceof Element?Lt(e.me,r):(rt(e.me),e.me[r])}},validate:e=>Vt(e,"my","property")},its:{name:"its",category:"Reference",evaluatesTo:"Any",operators:["its"],async evaluate(e,...t){const[r]=t;if(null==e.it)return;if("string"!=typeof r)throw new Error("Property name must be a string");const n=e.it;return n instanceof Element?Lt(n,r):(rt(n),n[r])},validate:e=>Vt(e,"its","property")},your:{name:"your",category:"Reference",evaluatesTo:"Any",operators:["your"],async evaluate(e,...t){const[r]=t;if(e.you){if("string"!=typeof r)throw new Error("Property name must be a string");return e.you instanceof Element?Lt(e.you,r):(rt(e.you),e.you[r])}},validate:e=>Vt(e,"your","property")},of:{name:"of",category:"Reference",evaluatesTo:"Any",operators:["of"],async evaluate(e,...t){const[r,n]=t;if(null!=n){if("string"!=typeof r)throw new Error("Property name must be a string");return n instanceof Element?Lt(n,r):(rt(n),n[r])}},validate:e=>$t(e,2,"of","property, object")??Wt(e,0,"of","property name")},attribute:{name:"attribute",category:"Reference",evaluatesTo:"String",operators:["@"],async evaluate(e,...t){const[r,n]=t;if("string"!=typeof r)throw new Error("Attribute name must be a string");const i=n||e.me;return i&&i instanceof Element?i.getAttribute(r):null},validate:e=>Ft(e,1,2,"attribute","attributeName, optional element")??Wt(e,0,"attribute","attribute name")??(e.length>=2&&null!=e[1]&&!(e[1]instanceof Element)?"attribute element must be an Element":null)},attributeWithValue:{name:"attributeWithValue",category:"Reference",evaluatesTo:"Boolean",operators:["@="],async evaluate(e,...t){const[r,n,i]=t;if("string"!=typeof r)throw new Error("Attribute name must be a string");if("string"!=typeof n)throw new Error("Expected value must be a string");const a=i||e.me;if(!(a&&a instanceof Element))return!1;return a.getAttribute(r)===n},validate:e=>Ft(e,2,3,"attributeWithValue","attributeName, expectedValue, optional element")??Wt(e,0,"attributeWithValue","attribute name")??Wt(e,1,"attributeWithValue","expected value")??(e.length>=3&&null!=e[2]&&!(e[2]instanceof Element)?"attributeWithValue element must be an Element":null)},classReference:{name:"classReference",category:"Reference",evaluatesTo:"Array",operators:["."],async evaluate(e,...t){const[r]=t;if("string"!=typeof r)throw new Error("Class name must be a string");const n=r.startsWith(".")?r.slice(1):r,i=document.getElementsByClassName(n);return Array.from(i)},validate:e=>Vt(e,"classReference","className")},idReference:{name:"idReference",category:"Reference",evaluatesTo:"Element",operators:["#"],async evaluate(e,...t){const[r]=t;if("string"!=typeof r)throw new Error("ID value must be a string");const n=r.startsWith("#")?r.slice(1):r;return document.getElementById(n)},validate:e=>Vt(e,"idReference","idValue")}},mi=wt({value:vt().describe("String literal value")}).strict(),di=wt({value:gt().describe("Number literal value")}).strict(),hi=wt({value:kt().describe("Boolean literal value")}).strict(),fi=wt({left:zt().describe("Left operand"),right:zt().describe("Right operand")}).strict();class yi extends St{constructor(){super(...arguments),this.name="stringLiteral",this.category="Special",this.syntax="\"string\" or 'string'",this.description="String literals with template interpolation support",this.outputType="String",this.inputSchema=mi,this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid){const t=this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions);return this.trackSimple(e,r,!1),t}let i=t.value;(i.includes("${")||i.includes("$"))&&(i=this.interpolateString(i,e));const a=this.success(i,"string");return this.trackSimple(e,r,!0,i),a}catch(t){return this.trackSimple(e,r,!1),this.failure("StringEvaluationError","runtime-error",`String literal evaluation failed: ${t instanceof Error?t.message:String(t)}`,"STRING_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid string literal input",["Provide a value parameter","Ensure value is a string"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}interpolateString(e,t){let r=e.replace(/\$\{([^}]+)\}/g,(e,r)=>{try{const e=this.resolveExpression(r.trim(),t);return void 0!==e?String(e):""}catch(e){return""}});return r=r.replace(/\$([a-zA-Z_$][a-zA-Z0-9_.$]*)/g,(e,r)=>{try{const e=this.resolveVariable(r,t);return void 0!==e?String(e):""}catch(e){return""}}),r}resolveExpression(e,t){if(e.includes(".")){const r=e.split(".");let n=this.resolveVariable(r[0],t);for(let e=1;e<r.length&&null!=n;e++)n=n[r[e]];return n}return this.resolveVariable(e,t)}resolveVariable(e,t){return"me"===e&&t.me?t.me:"you"===e&&t.you?t.you:"it"===e&&t.it?t.it:"result"===e&&t.result?t.result:t.locals?.has(e)?t.locals.get(e):t.globals?.has(e)?t.globals.get(e):void 0}}class vi extends St{constructor(){super(...arguments),this.name="numberLiteral",this.category="Special",this.syntax="123 or 3.14",this.description="Numeric literal with validation",this.inputSchema=di,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);return n.isValid?isFinite(t.value)?(this.trackSimple(e,r,!0,t.value),this.success(t.value,"number")):(this.trackSimple(e,r,!1),this.failure("NumberValidationError","invalid-argument","Number literal must be finite","NUMBER_NOT_FINITE")):(this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions))}catch(t){return this.trackSimple(e,r,!1),this.failure("NumberEvaluationError","runtime-error",`Number literal evaluation failed: ${t instanceof Error?t.message:String(t)}`,"NUMBER_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?isFinite(t.data.value)?this.validationSuccess():this.validationFailure("invalid-argument","Number literal value must be finite",["Use finite numbers only","Avoid Infinity and NaN values"]):this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid number literal input",["Provide a value parameter","Ensure value is a number"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}class gi extends St{constructor(){super(...arguments),this.name="booleanLiteral",this.category="Special",this.syntax="true or false",this.description="Boolean literal values",this.inputSchema=hi,this.outputType="Boolean",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);return n.isValid?(this.trackSimple(e,r,!0,t.value),this.success(t.value,"boolean")):(this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions))}catch(t){return this.trackSimple(e,r,!1),this.failure("BooleanEvaluationError","runtime-error",`Boolean literal evaluation failed: ${t instanceof Error?t.message:String(t)}`,"BOOLEAN_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid boolean literal input",["Provide a value parameter","Ensure value is a boolean"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}class ki extends St{constructor(){super(...arguments),this.name="addition",this.category="Special",this.syntax="left + right",this.description="Addition of two numeric values",this.inputSchema=fi,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions);const i=Ke(t.left,"left operand"),a=i+Ke(t.right,"right operand");return this.trackSimple(e,r,!0,a),this.success(a,"number")}catch(t){return this.trackSimple(e,r,!1),this.failure("AdditionError","runtime-error",`Addition failed: ${t instanceof Error?t.message:String(t)}`,"ADDITION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid addition input",["Provide left and right operands"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}class wi extends St{constructor(){super(...arguments),this.name="stringConcatenation",this.category="Special",this.syntax="left + right (string concatenation)",this.description="Concatenation of two values into a string",this.inputSchema=fi,this.outputType="String",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors[0]?.message||"Invalid input","STRING_CONCATENATION_VALIDATION_FAILED",n.suggestions);const i=this.convertToString(t.left),a=i+this.convertToString(t.right);return this.trackSimple(e,r,!0,a),this.success(a,"string")}catch(t){return this.trackSimple(e,r,!1),this.failure("StringConcatenationError","runtime-error",t instanceof Error?t.message:"String concatenation failed","STRING_CONCATENATION_ERROR",["Check that operands can be converted to strings"])}}validate(e){const t=fi.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid string concatenation input",["Provide left and right operands for concatenation"])}convertToString(e){if(null===e)return"null";if(void 0===e)return"undefined";if(Qe(e))return e;if(et(e))return e.toString();if(tt(e))return e.toString();if(e instanceof Date)return e.toString();try{return String(e)}catch{return"[object Object]"}}}class bi extends St{constructor(){super(...arguments),this.name="multiplication",this.category="Special",this.syntax="left * right",this.description="Multiplication of two numeric values",this.inputSchema=fi,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions);const i=Ke(t.left,"left operand"),a=i*Ke(t.right,"right operand");return this.trackSimple(e,r,!0,a),this.success(a,"number")}catch(t){return this.trackSimple(e,r,!1),this.failure("MultiplicationError","runtime-error",`Multiplication failed: ${t instanceof Error?t.message:String(t)}`,"MULTIPLICATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid multiplication input",["Provide left and right operands"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}const zi={stringLiteral:new yi,numberLiteral:new vi,booleanLiteral:new gi,addition:new ki,stringConcatenation:new wi,multiplication:new bi};class xi extends ui{constructor(){super(),this.registerExpressions()}registerExpressions(){this.registerCategory(Dr),this.registerCategory(Wr),this.registerCategory(Jr),this.registerCategory(or),Object.keys(pi),this.registerCategory(pi),this.expressionRegistry.has("possessive"),this.expressionRegistry.has("my"),this.registerCategory(zi)}}class Ei{static toTyped(e){return{me:e.me,it:e.it,you:e.you,result:e.result,...void 0!==e.event&&{event:e.event},variables:e.variables||new Map,locals:e.locals||new Map,globals:e.globals||new Map,...void 0!==e.events&&{events:e.events},meta:e.meta||{},expressionStack:[],evaluationDepth:0,validationMode:"strict",evaluationHistory:[]}}static fromTyped(e,t){return{...t,me:e.me,it:e.it,you:e.you,result:e.result,...void 0!==e.event&&{event:e.event},...void 0!==e.variables&&{variables:e.variables},locals:e.locals,globals:e.globals,...void 0!==e.events&&{events:e.events},...void 0!==e.meta&&{meta:e.meta}}}}class Si{constructor(e,t,r){this.impl=e,this.expressionEvaluator=t??new xi,this.hookRegistry=r??null}createHookContext(e,t,r={}){return{commandName:this.name,element:e.me instanceof Element?e.me:null,args:t,modifiers:r,event:e.event??void 0,executionContext:e}}get name(){return this.impl.name||this.impl.metadata?.name}get metadata(){return{description:this.impl.metadata?.description||"",examples:this.impl.metadata?.examples||[],syntax:this.impl.metadata?.syntax||""}}async execute(e,...t){const r=t[0],n=this.createHookContext(e,t,r&&"object"==typeof r&&"modifiers"in r&&r.modifiers||{});try{if(this.hookRegistry&&await this.hookRegistry.runBeforeExecute(n),this.hookRegistry?.shouldIntercept(this.name,n))return;e.locals||(e.locals=new Map),e.locals.set("__evaluator",this.expressionEvaluator);const i=Ei.toTyped(e);let a,o;if(this.impl.parseInput&&"function"==typeof this.impl.parseInput)if(r&&"object"==typeof r&&("args"in r||"modifiers"in r)){const t=r.modifiers?.when||r.modifiers?.where;if(t){if(!await this.expressionEvaluator.evaluate(t,e))return}a=await this.impl.parseInput({args:r.args||[],modifiers:r.modifiers||{},commandName:r.commandName},this.expressionEvaluator,e)}else a=t;else a=t;return o=2===this.impl.execute.length?await this.impl.execute(a,i):await this.impl.execute(i,...a),Object.assign(e,Ei.fromTyped(i,e)),this.hookRegistry&&await this.hookRegistry.runAfterExecute(n,o),o}catch(e){if(this.hookRegistry&&e instanceof Error){throw await this.hookRegistry.runOnError(n,e)}throw e}}validate(e){return this.impl.validate?this.impl.validate(e):{isValid:!0,errors:[],suggestions:[]}}}class Ti{constructor(e,t){this.adapters=new Map,this.implementations=new Map,this.sharedEvaluator=e,this.hookRegistry=t}setHookRegistry(e){this.hookRegistry=e}getHookRegistry(){return this.hookRegistry}register(e){const t=(e.name||e.metadata?.name).toLowerCase();this.implementations.set(t,e);const r=new Si(e,this.sharedEvaluator,this.hookRegistry);this.adapters.set(t,r);const n=e.metadata?.aliases;if(n&&Array.isArray(n))for(const t of n){const n=t.toLowerCase();this.implementations.set(n,e),this.adapters.set(n,r)}}getAdapter(e){return this.adapters.get(e.toLowerCase())}has(e){return this.adapters.has(e.toLowerCase())}getCommandNames(){return Array.from(this.adapters.keys())}getImplementation(e){return this.implementations.get(e.toLowerCase())}getAdapters(){return new Map(this.adapters)}validateCommand(e,t){const r=this.getAdapter(e);return r?r.validate(t):{isValid:!1,errors:[{type:"runtime-error",message:`Unknown command: ${e}`,suggestions:[`Available commands: ${this.getCommandNames().join(", ")}`]}],suggestions:[`Available commands: ${this.getCommandNames().join(", ")}`]}}}function Ci(e){const t=e?.commands??new Ti,r=e?.eventSources??new li,n=e?.context??new ci,i=new Set,a={commands:t,eventSources:r,context:n,use(e){if(!i.has(e.name)){if(e.commands)for(const r of e.commands)t.register(r);if(e.eventSources)for(const t of e.eventSources)r.register(t.name,t);if(e.contextProviders)for(const{name:t,provide:r,options:i}of e.contextProviders)n.register(t,r,i);e.setup?.(a),i.add(e.name)}},reset(){i.clear()}};return a}let Ai=null;function Li(){return Ai||(Ai=Ci()),Ai}class ji{constructor(e={}){this.contextCache=new WeakMap;const t=Li();this.options={enableContextProviders:e.enableContextProviders??!0,enableEventSources:e.enableEventSources??!0,registry:e.registry??{}},this.contextRegistry=this.options.registry.context??t.context,this.eventSourceRegistry=this.options.registry.eventSources??t.eventSources}enhanceContext(e){if(!this.options.enableContextProviders)return e;const t=this.contextCache.get(e);if(t)return t;try{const t=this.contextRegistry.enhance(e);return this.contextCache.set(e,t),this.contextRegistry.getProviderNames(),t}catch(t){return t instanceof Error||String(t),e}}getEventSource(e){if(!this.options.enableEventSources)return;const t=this.eventSourceRegistry.get(e);if(t)return t;const r=this.eventSourceRegistry.findSourceForEvent(e);if(r){return this.eventSourceRegistry.get(r)}}hasEventSource(e){return void 0!==this.getEventSource(e)}subscribeToEventSource(e,t,r){if(!this.options.enableEventSources)throw new Error("Event sources are disabled in this runtime");const n=this.eventSourceRegistry.subscribe(e,t,r);if(!n)throw new Error(`Failed to subscribe to event source '${e}'`);return n}getEventSourceNames(){return this.eventSourceRegistry.getSourceNames()}getContextProviderNames(){return this.contextRegistry.getProviderNames()}destroy(){this.eventSourceRegistry.destroy(),this.contextCache=new WeakMap}}class Pi{constructor(e){if(this.autoCleanupObserver=null,this.registryIntegration=null,this.options={commandTimeout:1e4,enableErrorReporting:!0,enableResultPattern:!0,enableAutoCleanup:!0,...e},this.registry=e.registry,this.expressionEvaluator=e.expressionEvaluator,this.behaviorRegistry=new Map,this.globalVariables=oi,this.hookRegistry=new ti,e.hooks&&this.hookRegistry.register("default",e.hooks),this.registry.setHookRegistry(this.hookRegistry),this.cleanupRegistry=new ai,this.options.enableAutoCleanup&&this.setupAutoCleanup(),!1!==e.registryIntegration){this.registryIntegration=new ji("object"==typeof e.registryIntegration?e.registryIntegration:{})}this.behaviorAPI={has:e=>this.behaviorRegistry.has(e),get:e=>this.behaviorRegistry.get(e),install:async(e,t,r)=>await this.installBehaviorOnElement(e,t,r)}}setupAutoCleanup(){"undefined"!=typeof MutationObserver&&"undefined"!=typeof document&&(this.autoCleanupObserver=new MutationObserver(e=>{for(const t of e)for(const e of t.removedNodes)if(e instanceof Element){this.cleanupRegistry.cleanupElementTree(e)}}),document.body?this.autoCleanupObserver.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{this.autoCleanupObserver?.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}registerHooks(e,t){this.hookRegistry.register(e,t)}unregisterHooks(e){return this.hookRegistry.unregister(e)}getRegisteredHooks(){return this.hookRegistry.getRegisteredNames()}cleanup(e){return this.cleanupRegistry.cleanupElement(e)}cleanupTree(e){return this.cleanupRegistry.cleanupElementTree(e)}getCleanupStats(){return this.cleanupRegistry.getStats()}destroy(){this.autoCleanupObserver&&(this.autoCleanupObserver.disconnect(),this.autoCleanupObserver=null),this.cleanupRegistry.cleanupAll(),this.hookRegistry.clear(),this.behaviorRegistry.clear()}async execute(e,t){t.locals.has("_behaviors")||t.locals.set("_behaviors",this.behaviorAPI),t.locals.has("_runtimeExecute")||t.locals.set("_runtimeExecute",(e,r)=>this.execute(e,r||t));try{switch(e.type){case"command":if(this.options.enableResultPattern)try{const r=await this.processCommandWithResult(e,t);if(!ii(r)){const e=r.error,t=new Error(e.type.toUpperCase()+"_EXECUTION");throw t["is"+e.type.charAt(0).toUpperCase()+e.type.slice(1)]=!0,"returnValue"in e&&(t.returnValue=e.returnValue),t}return r.value}catch(e){throw e}return await this.processCommand(e,t);case"eventHandler":return await this.executeEventHandler(e,t);case"event":{const r={type:"eventHandler",event:e.event,events:[e.event],commands:e.body||[],target:e.filter,modifiers:e.modifiers||{}};return await this.executeEventHandler(r,t)}case"behavior":return await this.executeBehaviorDefinition(e,t);case"Program":return await this.executeProgram(e,t);case"initBlock":case"block":return await this.executeBlock(e,t);case"sequence":case"CommandSequence":if(this.options.enableResultPattern){const r=e,n=await this.executeCommandSequenceWithResult(r.commands||[],t);if(!ii(n)){const e=n.error,t=new Error(e.type.toUpperCase()+"_EXECUTION");throw t["is"+e.type.charAt(0).toUpperCase()+e.type.slice(1)]=!0,"returnValue"in e&&(t.returnValue=e.returnValue),t}return n.value}return await this.executeCommandSequence(e,t);case"objectLiteral":return await this.executeObjectLiteral(e,t);default:if(this.options.enableResultPattern){const r=await this.evaluateExpressionWithResult(e,t);if(!ii(r)){const e=r.error,t=new Error(e.type.toUpperCase()+"_EXECUTION");throw t["is"+e.type.charAt(0).toUpperCase()+e.type.slice(1)]=!0,"returnValue"in e&&(t.returnValue=e.returnValue),t}return r.value}return await this.evaluateExpression(e,t)}}catch(e){throw e}}async processCommand(e,t){const{name:r,args:n,modifiers:i}=e,a=r.toLowerCase();if(this.registry.has(a)){const e=await this.registry.getAdapter(a);if(!e)throw new Error(`Command '${a}' is registered but failed to load adapter.`);try{return await e.execute(t,{args:n||[],modifiers:i||{},commandName:a,runtime:this})}catch(e){Error;throw e}}throw new Error(`Unknown command: ${r}. Ensure it is registered in the Runtime options.`)}toSignal(e){if(e instanceof Error){if(e.isHalt||"HALT_EXECUTION"===e.message)return{type:"halt"};if(e.isExit||"EXIT_COMMAND"===e.message)return{type:"exit",returnValue:e.returnValue};if(e.isBreak)return{type:"break"};if(e.isContinue)return{type:"continue"};if(e.isReturn)return{type:"return",returnValue:e.returnValue}}return null}async processCommandWithResult(e,t){const{name:r,args:n,modifiers:i}=e,a=r.toLowerCase();if(!this.registry.has(a)){throw new Error(`Unknown command: ${r}. Ensure it is registered in the Runtime options.`)}const o=await this.registry.getAdapter(a);if(!o)throw new Error(`Command '${a}' is registered but failed to load adapter.`);try{return ri(await o.execute(t,{args:n||[],modifiers:i||{},commandName:a,runtime:this}))}catch(e){const t=this.toSignal(e);if(t)return ni(t);throw e}}async executeCommandSequenceWithResult(e,t){let r;for(const n of e)if("command"===n.type){const e=await this.processCommandWithResult(n,t);if(!ii(e)){const r=e.error;switch(r.type){case"halt":case"exit":case"break":case"continue":return e;case"return":return void 0!==r.returnValue&&Object.assign(t,{it:r.returnValue,result:r.returnValue}),ri(r.returnValue)}}r=e.value}else{const e=await this.evaluateExpressionWithResult(n,t);if(!ii(e))return e;r=e.value}return ri(r)}async evaluateExpression(e,t){const r=await this.expressionEvaluator.evaluate(e,t);return r&&"object"==typeof r&&r.command&&r.selector?await this.executeCommandFromPattern(r.command,r.selector,t):r}async evaluateExpressionWithResult(e,t){const r=await this.expressionEvaluator.evaluateWithResult(e,t);if(!ii(r))return r;const n=r.value;if(n&&"object"==typeof n&&n.command&&n.selector){if(this.options.enableResultPattern){return this.processCommandWithResult({type:"command",name:n.command,args:[{type:"literal",value:n.selector}]},t)}try{return ri(await this.executeCommandFromPattern(n.command,n.selector,t))}catch(e){const t=this.toSignal(e);if(t)return ni(t);throw e}}return ri(n)}async executeCommandFromPattern(e,t,r){return this.processCommand({type:"command",name:e,args:[{type:"literal",value:t}]},r)}async executeProgram(e,t){if(!e.statements||!Array.isArray(e.statements))return;let r;const n=[],i=[],a=[];for(const t of e.statements)"eventHandler"===t.type?n.push(t):"initBlock"===t.type?i.push(t):a.push(t);for(const e of n)try{await this.execute(e,t)}catch(e){if(e instanceof Error&&(e.isHalt||e.isExit))break;throw e}for(const e of i)try{r=await this.execute(e,t)}catch(e){if(e instanceof Error&&(e.isHalt||e.isExit))break;throw e}for(const e of a)try{r=await this.execute(e,t)}catch(e){if(e instanceof Error&&(e.isHalt||e.isExit))break;throw e}return r}async executeBlock(e,t){if(e.commands&&Array.isArray(e.commands))for(const r of e.commands)try{await this.execute(r,t)}catch(e){if(e instanceof Error&&e.isHalt)break;throw e}}async executeCommandSequence(e,t){if(!e.commands||!Array.isArray(e.commands))return;let r;for(const n of e.commands)try{r=await this.execute(n,t)}catch(e){const r=e;if(r.isHalt||r.isExit)break;if(r.isReturn){if(void 0!==r.returnValue)return Object.assign(t,{it:r.returnValue,result:r.returnValue}),r.returnValue;break}if(r.isBreak)throw e;throw e}return r}async executeObjectLiteral(e,t){const r={};if(!e.properties)return r;for(const n of e.properties){let e;if("identifier"===n.key.type)e=n.key.name;else if("literal"===n.key.type)e=String(n.key.value);else{const r=await this.execute(n.key,t);e=String(r)}const i=await this.execute(n.value,t);r[e]=i}return r}enhanceContext(e){return this.registryIntegration?this.registryIntegration.enhanceContext(e):e}async executeBehaviorDefinition(e,t){const{name:r,parameters:n,eventHandlers:i,initBlock:a}=e;this.behaviorRegistry.set(r,{name:r,parameters:n,eventHandlers:i,initBlock:a})}async installBehaviorOnElement(e,t,r){const n=this.behaviorRegistry.get(e);if(!n)throw new Error(`Behavior "${e}" not found`);const i={me:t,you:null,it:null,result:null,locals:new Map,globals:this.globalVariables,halted:!1,returned:!1,broke:!1,continued:!1,async:!1},a=this.enhanceContext(i);if(n.parameters)for(const e of n.parameters){a.locals.set(e,e in r?r[e]:void 0)}for(const[e,t]of Object.entries(r))n.parameters?.includes(e)||a.locals.set(e,t);if(n.initBlock)try{await this.execute(n.initBlock,a)}catch(e){if(!(e instanceof Error&&e.isHalt))throw e}if(n.eventHandlers)for(const e of n.eventHandlers)await this.executeEventHandler(e,a)}async executeEventHandler(e,t){const{event:r,events:n,commands:i,target:a,args:o,selector:s,attributeName:l,watchTarget:c,modifiers:u}=e,p=n&&n.length>0?n:[r];let m=[],d=null;if(a){const e="string"==typeof a?a.toLowerCase():"";if("window"===e||"the window"===e)d=window;else if("document"===e||"the document"===e||"body"===e)d=document;else if("me"===e||"myself"===e)m=t.me?[t.me]:[];else if("string"==typeof a&&t.locals.has(a)){const e=t.locals.get(a);this.isElement(e),this.isElement(e)?m=[e]:Array.isArray(e)?m=e.filter(e=>this.isElement(e)):"string"==typeof e&&(m=this.queryElements(e,t))}else m=this.queryElements(a,t)}else m=t.me?[t.me]:[];if(0===m.length&&!d)return;if("mutation"===r&&l)return void this.setupMutationObserver(m,l,i,t);if("change"===r&&c)return void this.setupChangeObserver(c,i,t);const h=e.customEventSource;if(h&&this.registryIntegration){const e=async e=>{const r=new Map(t.locals),n={...t,locals:r,it:e,event:e},a=this.enhanceContext(n);try{await this.execute({type:"program",commands:i},a)}catch(e){}};try{const n=this.registryIntegration.subscribeToEventSource(h,{event:r,handler:e,target:a,selector:s},t);this.cleanupRegistry.registerGlobal(()=>n.unsubscribe(),"listener",`Custom event source '${h}' subscription ${n.id}`)}catch(e){}return}const f=async e=>{const r=e.__hyperfixi_recursion_depth||0;if(r>=100)return;if(e.__hyperfixi_recursion_depth=r+1,s&&e.target instanceof Element&&!e.target.matches(s)&&!e.target.closest(s))return;const n=new Map(t.locals),a={...t,locals:n,it:e,event:e};n.has("target")||a.locals.set("target",e.target);const l=this.enhanceContext(a);if(o&&o.length>0)for(const t of o){l.locals.set(t,e[t]||e.detail?.[t]||null)}for(const e of i)try{const t=await this.execute(e,l);if(void 0!==t){let e=t;if(e&&"object"==typeof e){const t=e;if("result"in t&&"wasAsync"in t)e=t.result;else if("result"in t&&"executed"in t){if(e=t.result,t.preserveArrayResult){void 0!==e&&Object.assign(l,{it:e,result:e});continue}}else if("lastResult"in t&&"type"in t)e=t.lastResult;else if("conditionResult"in t&&"executedBranch"in t){if(void 0===t.result)continue;e=t.result}else"value"in t&&1===Object.keys(t).length||"value"in t&&"target"in t&&"targetType"in t?e=t.value:"data"in t&&"status"in t&&"headers"in t&&(e=t.data)}Array.isArray(e)&&e.length>0&&(e=e[0]),Object.assign(l,{it:e,result:e})}}catch(e){const t=e;if(t.isHalt||t.isExit)break;if(t.isReturn){void 0!==t.returnValue&&Object.assign(l,{it:t.returnValue,result:t.returnValue});break}throw e}};let y;if(u){let e=f;if(u.prevent){const t=e;e=async e=>(e.preventDefault(),t(e))}if(u.stop){const t=e;e=async e=>(e.stopPropagation(),t(e))}if(u.debounce){const t=u.debounce;let r;y=n=>{r&&clearTimeout(r),r=setTimeout(()=>e(n),t)}}else if(u.throttle){const t=u.throttle;let r=0;y=n=>{const i=Date.now();i-r>=t&&(r=i,e(n))}}else y=e}else y=f;const v=u?.once?{once:!0}:void 0;if(d)for(const e of p)d.addEventListener(e,y,v),m.length>0?this.cleanupRegistry.registerListener(m[0],d,e,y):this.cleanupRegistry.registerGlobal(()=>d.removeEventListener(e,y),"listener",`Global ${e} listener`);else for(const e of m)for(const t of p)e.addEventListener(t,y,v),this.cleanupRegistry.registerListener(e,e,t,y)}setupMutationObserver(e,t,r,n){for(const i of e){const e=new MutationObserver(async e=>{for(const a of e)if("attributes"===a.type&&a.attributeName===t){const e={...n,me:i,it:a,locals:new Map(n.locals)},o=a.oldValue,s=i.getAttribute(t);e.locals.set("oldValue",o),e.locals.set("newValue",s);const l=this.enhanceContext(e);for(const e of r)try{await this.execute(e,l)}catch(e){}}});e.observe(i,{attributes:!0,attributeOldValue:!0,attributeFilter:[t]}),this.cleanupRegistry.registerObserver(i,e)}}async setupChangeObserver(e,t,r){const n=await this.execute(e,r);let i=[];this.isElement(n)?i=[n]:Array.isArray(n)&&(i=n.filter(e=>this.isElement(e)));for(const e of i){const n=new MutationObserver(async n=>{for(const i of n)if("childList"===i.type||"characterData"===i.type){const n={...r,me:r.me,it:i,locals:new Map(r.locals)};n.locals.set("target",e);const a=i.oldValue,o=e.textContent;null!==a&&n.locals.set("oldValue",a),n.locals.set("newValue",o);const s=this.enhanceContext(n);for(const e of t)try{await this.execute(e,s)}catch(e){}}});n.observe(e,{childList:!0,characterData:!0,subtree:!0,characterDataOldValue:!0}),this.cleanupRegistry.registerObserver(e,n)}}queryElements(e,t){const r=t.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!r)return[];let n=e;return n.startsWith("<")&&n.endsWith("/>")&&(n=n.slice(1,-2).trim()),Array.from(r.querySelectorAll(n))}isElement(e){if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return e&&"object"==typeof e&&e.style&&e.classList}}function Ni(e,t,r,n,i,a){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?n.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),m=!1,d=r.length-1;d>=0;d--){var h={};for(var f in n)h[f]="access"===f?{}:n[f];for(var f in n.access)h.access[f]=n.access[f];h.addInitializer=function(e){if(m)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(e||null))};var y=(0,r[d])("accessor"===l?{get:p.get,set:p.set}:p[c],h);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=o(y.get))&&(p.get=s),(s=o(y.set))&&(p.set=s),(s=o(y.init))&&i.unshift(s)}else(s=o(y))&&("field"===l?i.unshift(s):p[c]=s)}u&&Object.defineProperty(u,n.name,p),m=!0}function Oi(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}function Ii(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}"function"==typeof SuppressedError&&SuppressedError;const Ri=Symbol("command:name"),Mi=Symbol("command:category"),qi=Symbol("command:metadata");function _i(e){return function(t,r){const n=t;n[Ri]=e.name,n[Mi]=e.category,Object.defineProperty(t.prototype,"name",{value:e.name,writable:!1,enumerable:!0})}}function $i(e){return function(t,r){const n=t,i=n[Mi];if(!i)throw new Error(`@meta decorator requires @command decorator to be applied first on ${t.name}`);const a={description:e.description,syntax:e.syntax,examples:e.examples,category:i,sideEffects:e.sideEffects,deprecated:e.deprecated,deprecationMessage:e.deprecationMessage,aliases:e.aliases,relatedCommands:e.relatedCommands,isBlocking:e.isBlocking??!1,hasBody:e.hasBody??!1,version:"1.0.0"};n[qi]=a,Object.defineProperty(t,"metadata",{value:a,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(t.prototype,"metadata",{get:()=>a,enumerable:!0,configurable:!1})}}function Wi(e){return()=>new e}function Vi(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType&&"tagName"in e&&"string"==typeof e.tagName&&"classList"in e}function Di(e,t){if(Vi(e))return e;if(!e){const e=t.me;if(!e)throw new Error("No target element - provide explicit target or ensure context.me is set");return Hi(e)}if("string"==typeof e){const r=e.trim();if("me"===r){if(!t.me)throw new Error('Context reference "me" is not available');return Hi(t.me)}if("it"===r){if(!Vi(t.it))throw new Error('Context reference "it" is not an HTMLElement');return t.it}if("you"===r){if(!t.you)throw new Error('Context reference "you" is not available');return Hi(t.you)}const n=t.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!n)throw new Error("DOM not available - cannot resolve element selector");const i=n.querySelector(r);if(!i)throw new Error(`Element not found with selector: ${r}`);if(!Vi(i))throw new Error(`Element found but is not an HTMLElement: ${r}`);return i}throw new Error("Invalid target type: "+typeof e)}function Bi(e,t){if(Array.isArray(e))return e.filter(Vi);if(e instanceof NodeList)return Array.from(e).filter(Vi);if(Vi(e))return[e];if(!e){const e=t.me;return e&&Vi(e)?[e]:[]}if("string"==typeof e){const r=e.trim();if("me"===r)return t.me&&Vi(t.me)?[t.me]:[];if("it"===r)return Vi(t.it)?[t.it]:[];if("you"===r)return t.you&&Vi(t.you)?[t.you]:[];const n=t.me?.ownerDocument??("undefined"!=typeof document?document:null);if(n){let e=r;e.startsWith("<")&&e.endsWith("/>")&&(e=e.slice(1,-2).trim());const t=n.querySelectorAll(e);return Array.from(t).filter(Vi)}}return[]}function Hi(e){if(Vi(e))return e;throw new Error("Value is not an HTMLElement")}function Fi(e,t){switch(e.toLowerCase()){case"my":case"me":if(!t.me)throw new Error('No "me" element in context');if(!Vi(t.me))throw new Error("context.me is not an HTMLElement");return t.me;case"its":case"it":if(!t.it)throw new Error('No "it" value in context');if(!Vi(t.it))throw new Error("context.it is not an HTMLElement");return t.it;case"your":case"you":if(!t.you)throw new Error('No "you" element in context');if(!Vi(t.you))throw new Error("context.you is not an HTMLElement");return t.you;default:throw new Error(`Unknown possessive: ${e}`)}}const Ui=["on","from","to","in","with","at"];async function Ki(e,t,r,n,i={},a){let o=e;if(i.filterPrepositions&&e&&(o=e.filter(e=>{const t=e;return"identifier"!==t?.type||"string"!=typeof t.name||!Ui.includes(t.name.toLowerCase())})),(!o||0===o.length)&&i.fallbackModifierKey&&a){const e=a[i.fallbackModifierKey];e&&(o=[e])}if(!o||0===o.length){if(!r.me)throw new Error(`${n} command: no target specified and context.me is null`);if(!Vi(r.me))throw new Error(`${n} command: context.me must be an HTMLElement`);return[r.me]}const s=[];for(const e of o){const i=await t.evaluate(e,r);if(""!==i&&("string"!=typeof i||""!==i.trim()))if(Vi(i))s.push(i);else if(i instanceof NodeList){const e=Array.from(i).filter(Vi);s.push(...e)}else if(Array.isArray(i)){const e=i.filter(Vi);s.push(...e)}else{if("string"!=typeof i)throw new Error(`Invalid ${n} target: expected HTMLElement or CSS selector, got ${typeof i}`);try{let e=i;e.startsWith("<")&&e.endsWith("/>")&&(e=e.slice(1,-2).trim());const t=r.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!t)throw new Error("DOM not available - cannot resolve element selector");const n=t.querySelectorAll(e),a=Array.from(n).filter(Vi);s.push(...a)}catch(e){throw new Error(`Invalid CSS selector: "${i}" - ${e instanceof Error?e.message:String(e)}`)}}}if(0===s.length){if(!r.me)throw new Error(`${n} command: no target specified and context.me is null`);if(!Vi(r.me))throw new Error(`${n} command: context.me must be an HTMLElement`);return[r.me]}return s}class Gi{async parseInput(e,t,r){const{targets:n}=await async function(e,t,r,n){return{targets:await Ki(e.args,t,r,n)}}(e,t,r,this.mode);return{targets:n,mode:this.mode,defaultDisplay:"show"===this.mode?"block":void 0}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&(!!t.targets.every(e=>Vi(e))&&(("show"===t.mode||"hide"===t.mode)&&("show"!==t.mode||"string"==typeof t.defaultDisplay)))}showElement(e,t="block"){const r=e.dataset.originalDisplay;void 0!==r?(e.style.display=r||t,delete e.dataset.originalDisplay):"none"===e.style.display&&(e.style.display=t),e.classList.add("show")}hideElement(e){if(!e.dataset.originalDisplay){const t=e.style.display;e.dataset.originalDisplay="none"===t?"":t}e.style.display="none",e.classList.remove("show")}}let Yi=(()=>{let e,t,r=[$i({description:"Hide elements by setting display to none",syntax:"hide [<target>]",examples:["hide me","hide #modal","hide .warnings","hide <button/>"],sideEffects:["dom-mutation"]}),_i({name:"hide",category:"dom"})],n=[],i=Gi;return t=class extends i{constructor(){super(...arguments),this.mode="hide"}async execute(e,t){for(const t of e.targets)this.hideElement(t)}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&!!t.targets.every(e=>Vi(e))}},Ii(t,"HideCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),Oi(t,n)})(),t})();const Xi=Wi(Yi);let Zi=(()=>{let e,t,r=[$i({description:"Show elements by restoring display property",syntax:"show [<target>]",examples:["show me","show #modal","show .hidden","show <button/>"],sideEffects:["dom-mutation"]}),_i({name:"show",category:"dom"})],n=[],i=Gi;return t=class extends i{constructor(){super(...arguments),this.mode="show"}async execute(e,t){const r=e.defaultDisplay||"block";for(const t of e.targets)this.showElement(t,r)}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&(!!t.targets.every(e=>Vi(e))&&"string"==typeof t.defaultDisplay)}},Ii(t,"ShowCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),Oi(t,n)})(),t})();const Ji=Wi(Zi);function Qi(e){const t=e.trim();return!(!t.startsWith("[@")||!t.endsWith("]"))||!!t.startsWith("@")}function ea(e){const t=e.trim();if(t.startsWith("[@")&&t.endsWith("]")){const e=t.slice(2,-1),r=e.indexOf("=");if(-1===r)return{name:e.trim()};const n=e.slice(0,r).trim();let i=e.slice(r+1).trim();return(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),{name:n,value:i}}if(t.startsWith("@"))return{name:t.substring(1).trim()};throw new Error(`Invalid attribute syntax: ${e}`)}function ta(e,t){for(const r of e)t(r);return e}function ra(e,t,r){for(const n of e)for(const e of t)r(n,e);return e}function na(e,t,r){const n=e.hasAttribute(t);void 0!==r?n&&e.getAttribute(t)===r?e.removeAttribute(t):e.setAttribute(t,r):n?e.removeAttribute(t):e.setAttribute(t,"")}function ia(e){if(!e)return[];if("string"==typeof e)return e.trim().split(/[\s,]+/).map(e=>{const t=e.trim();return t.startsWith(".")?t.substring(1):t}).filter(e=>e.length>0&&oa(e));if(Array.isArray(e))return e.map(e=>{const t=String(e).trim();return t.startsWith(".")?t.substring(1):t}).filter(e=>e.length>0&&oa(e));const t=String(e).trim(),r=t.startsWith(".")?t.substring(1):t;return r.length>0&&oa(r)?[r]:[]}function aa(e){const t=e.trim();return/^\{[^}]+\}$/.test(t)}function oa(e){if(!e||0===e.trim().length)return!1;const t=e.trim();if(aa(t))return!0;return/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(t)}function sa(e,t){return e.map(e=>{if(aa(e)){const r=function(e){const t=e.trim(),r=t.match(/^\{(.+)\}$/);return r?r[1].trim():t}(e),n=t.locals.get(r)??t.globals.get(r);return null!=n?String(n):""}return e}).filter(e=>e.length>0)}function la(e){return"string"==typeof e&&e.trim().startsWith("*")}function ca(e,t,r){e.style.setProperty(t,r)}const ua=["dialog","details","summary","select"];function pa(e){if(!e||"object"!=typeof e)return null;return"string"==typeof e.selector?e.selector:"string"==typeof e.value?e.value:"string"==typeof e.name?e.name:null}function ma(e){if(!e||"object"!=typeof e)return!1;if("identifier"!==e.type)return!1;const t=e.name;return"string"==typeof t&&function(e){if("string"!=typeof e)return!1;const t=e.toLowerCase();return ua.includes(t)}(t)}async function da(e,t,r){return function(e){if(!e||"object"!=typeof e)return!1;const t=e.type;if("selector"!==t&&"cssSelector"!==t&&"classSelector"!==t)return!1;const r=pa(e);return"string"==typeof r&&r.startsWith(".")}(e)||function(e){if(!e||"object"!=typeof e)return!1;const t=e.type;if("selector"!==t&&"cssSelector"!==t&&"cssProperty"!==t)return!1;const r=pa(e);return"string"==typeof r&&r.startsWith("*")}(e)?{value:pa(e),extractedFromNode:!0}:{value:await t.evaluate(e,r),extractedFromNode:!1}}class ha{async resolveTargets(e,t,r,n){return Ki(e,t,r,this.mode,{filterPrepositions:!0,fallbackModifierKey:this.preposition},n)}async evaluateFirst(e,t,r){return da(e,t,r)}parseClassNames(e){return ia(e)}isAttribute(e){return Qi(e.trim())}isCSSProperty(e){return la(e.trim())}validateTargets(e){return Array.isArray(e)&&function(e){return Array.isArray(e)&&e.length>0&&e.every(e=>Vi(e))}(e)}validateType(e,t){return function(e,t){return"string"==typeof e&&t.includes(e)}(e,t)}validateStringArray(e,t=1){return Array.isArray(e)&&function(e,t=1){return Array.isArray(e)&&e.length>=t&&e.every(e=>"string"==typeof e&&e.length>0)}(e,t)}}let fa=(()=>{let e,t,r=[$i({description:"Add CSS classes, attributes, or styles to elements",syntax:"add <classes|@attr|{styles}> [to <target>]",examples:["add .active to me",'add "active selected" to <button/>',"add .highlighted to #modal",'add [@data-test="value"] to #element'],sideEffects:["dom-mutation"]}),_i({name:"add",category:"dom"})],n=[],i=ha;return t=class extends i{constructor(){super(...arguments),this.mode="add",this.preposition="to"}async parseInput(e,t,r){if(!e.args||0===e.args.length)throw new Error("add command requires an argument");const{value:n}=await this.evaluateFirst(e.args[0],t,r);if("object"==typeof n&&null!==n&&!Array.isArray(n)){return{type:"styles",styles:n,targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}if("string"==typeof n){const i=n.trim();if(this.isAttribute(i)){const{name:n,value:a}=function(e){const t=ea(e);return{name:t.name,value:t.value??""}}(i);return{type:"attribute",name:n,value:a,targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}if(this.isCSSProperty(i)){const n=i.substring(1).trim();if(e.args.length<2)throw new Error("add *property requires a value argument");const a=await t.evaluate(e.args[1],r);return{type:"styles",styles:{[n]:String(a)},targets:await this.resolveTargets(e.args.slice(2),t,r,e.modifiers)}}}const i=this.parseClassNames(n);if(0===i.length)throw new Error("add command: no valid class names found");return{type:"classes",classes:i,targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}async execute(e,t){switch(e.type){case"classes":{const r=sa(e.classes,t);r.length>0&&ra(e.targets,r,(e,t)=>{e.classList.contains(t)||e.classList.add(t)});break}case"attribute":!function(e,t,r){ta(e,e=>{e.setAttribute(t,r)})}(e.targets,e.name,e.value);break;case"styles":!function(e,t){ra(e,Object.entries(t),(e,[t,r])=>{e.style.setProperty(t,r)})}(e.targets,e.styles)}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;if(!this.validateType(t.type,["classes","attribute","styles"]))return!1;if(!this.validateTargets(t.targets))return!1;if("classes"===t.type){if(!this.validateStringArray(e.classes,1))return!1}else if("attribute"===t.type){if("string"!=typeof e.name||0===e.name.length)return!1;if("string"!=typeof e.value)return!1}else if("styles"===t.type){const t=e;if("object"!=typeof t.styles||null===t.styles)return!1;if(Array.isArray(t.styles))return!1;const r=t.styles;if(0===Object.keys(r).length)return!1;if(!Object.values(r).every(e=>"string"==typeof e))return!1}return!0}},Ii(t,"AddCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),Oi(t,n)})(),t})();const ya=Wi(fa);function va(e){return!!e.parentNode&&(e.remove(),!0)}let ga=(()=>{let e,t,r=[$i({description:"Remove CSS classes, attributes, styles, or elements from the DOM",syntax:"remove <classes|@attr|*prop|element> [from <target>]",examples:["remove .active from me",'remove "active selected" from <button/>',"remove .highlighted from #modal","remove me","remove closest .item"],sideEffects:["dom-mutation"]}),_i({name:"remove",category:"dom"})],n=[],i=ha;return t=class extends i{constructor(){super(...arguments),this.mode="remove",this.preposition="from"}async parseInput(e,t,r){if(!e.args||0===e.args.length)throw new Error("remove command requires an argument");const{value:n}=await this.evaluateFirst(e.args[0],t,r);if(Vi(n))return{type:"element",targets:[n]};if(Array.isArray(n)&&n.length>0&&Vi(n[0]))return{type:"element",targets:n.filter(e=>Vi(e))};if("string"==typeof n){const i=n.trim();if(this.isAttribute(i)){return{type:"attribute",name:ea(i).name,targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}if(this.isCSSProperty(i)){return{type:"styles",properties:[i.substring(1).trim()],targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}}const i=this.parseClassNames(n);if(0===i.length)throw new Error("remove command: no valid class names found");return{type:"classes",classes:i,targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}execute(e,t){switch(e.type){case"classes":{const r=sa(e.classes,t);r.length>0&&ra(e.targets,r,(e,t)=>{e.classList.remove(t)});break}case"attribute":!function(e,t){ta(e,e=>{e.removeAttribute(t)})}(e.targets,e.name);break;case"styles":!function(e,t){ra(e,t,(e,t)=>{e.style.removeProperty(t)})}(e.targets,e.properties);break;case"element":for(const t of e.targets)va(t)}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;if(!this.validateType(t.type,["classes","attribute","styles","element"]))return!1;if(!this.validateTargets(t.targets))return!1;if("classes"===t.type){if(!this.validateStringArray(e.classes,1))return!1}else if("attribute"===t.type){if("string"!=typeof e.name||0===e.name.length)return!1}else if("styles"===t.type){if(!this.validateStringArray(e.properties,1))return!1}return!0}},Ii(t,"RemoveCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),Oi(t,n)})(),t})();const ka=Wi(ga);function wa(e){const t=e.trim().match(/^(\d+(?:\.\d+)?)\s*(s|ms|sec|seconds?|milliseconds?)?$/i);if(!t)return null;const r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();return"ms"===n||"millisecond"===n||"milliseconds"===n?{number:r,milliseconds:Math.floor(r)}:"s"===n||"sec"===n||"second"===n||"seconds"===n?{number:r,milliseconds:Math.floor(1e3*r)}:null}function ba(e,t=300){if("number"==typeof e)return Math.max(0,Math.floor(e));if("string"==typeof e){const r=wa(e);return r?r.milliseconds:t}return t}function za(e){if("number"==typeof e){if(e<0)throw new Error("Duration must be >= 0");return Math.floor(e)}if("string"==typeof e){const t=wa(e);if(!t)throw new Error(`Invalid duration format: "${e}"`);return t.milliseconds}throw new Error("Invalid duration type: "+typeof e)}function xa(e){return e&&"none"!==e?e.split(",").map(e=>{const t=parseFloat(e.trim());return isNaN(t)?0:e.includes("s")&&!e.includes("ms")?1e3*t:t}):[0]}function Ea(e,t){let r=0;for(let n=0;n<e.length;n++){r=Math.max(r,(e[n]||0)+(t[n]||0))}return r}function Sa(e){if(0===e.length)return[];return"SUMMARY"===e[0].tagName?e.map(e=>e.closest("details")).filter(e=>null!==e):e}function Ta(e,t,r){return()=>{"class"===t?e.classList.toggle(r):"attribute"===t&&na(e,r)}}function Ca(e,t,r,n){const i=Ta(e,t,r),a=setTimeout(i,n);return()=>{clearTimeout(a)}}function Aa(e,t,r,n){const i=Ta(e,t,r),a=()=>{i(),e.removeEventListener(n,a)};return e.addEventListener(n,a,{once:!0}),()=>{e.removeEventListener(n,a)}}function La(e,t){if(t.startsWith("@"))return e.getAttribute(t.substring(1));switch(t){case"textContent":return e.textContent;case"innerHTML":return e.innerHTML;case"innerText":return e.innerText;case"id":return e.id;case"className":return e.className;case"value":return"value"in e?e.value:void 0;case"checked":return"checked"in e?e.checked:void 0}if(t.includes(".")){const r=t.split(".");let n=e;for(const e of r){if(null==n)break;n=n[e]}return n}return t.includes("-")||t in e.style?e.style.getPropertyValue(t)||e.style[t]:e[t]}function ja(e,t,r){if(t.startsWith("@"))return void e.setAttribute(t.substring(1),String(r));const n=String(r);switch(t){case"textContent":return void(e.textContent=n);case"innerHTML":return void(e.innerHTML=n);case"innerText":return void(e.innerText=n);case"id":return void(e.id=n);case"className":return void(e.className=n);case"value":return void("value"in e&&(e.value=n));case"checked":return void("checked"in e&&(e.checked=Boolean(r)))}if(t.includes(".")){const n=t.split(".");let i=e;for(let e=0;e<n.length-1;e++)if(i=i[n[e]],null==i)return;return void(i[n[n.length-1]]=r)}if(t.includes("-")||t in e.style)e.style.setProperty(t,n);else try{e[t]=r}catch(e){if(!(e instanceof TypeError&&(e.message.includes("only a getter")||e.message.includes("read only"))))throw new Error(`Cannot set property '${t}': ${e instanceof Error?e.message:"Unknown error"}`)}}function Pa(e){return null==e||""===e}const Na=/^the\s+(.+?)\s+of\s+(.+)$/i,Oa=new Set(["disabled","checked","hidden","readOnly","readonly","required","multiple","selected","autofocus","autoplay","controls","loop","muted","open","reversed","async","defer","noValidate","novalidate","formNoValidate","formnovalidate","draggable","spellcheck","contentEditable"]);function Ia(e){return"string"==typeof e&&Na.test(e)}function Ra(e,t){const r=e.match(Na);if(!r)return null;try{return{element:Di(r[2].trim(),t),property:r[1].trim()}}catch{return null}}async function Ma(e,t,r){if(function(e){return!(!e||"object"!=typeof e)&&("propertyOfExpression"===e.type&&"object"==typeof e.property&&null!==e.property)}(e))return async function(e,t,r){const n=e.property?.name;if(!n)return null;let i=await t.evaluate(e.target,r);return Array.isArray(i)&&(i=i[0]),Vi(i)?{element:i,property:n}:null}(e,t,r);if(function(e){return!(!e||"object"!=typeof e)&&("propertyAccess"===e.type&&"string"==typeof e.property)}(e))return async function(e,t,r){const n=e.property;if(!n)return null;let i=await t.evaluate(e.object,r);return Array.isArray(i)&&(i=i[0]),Vi(i)?{element:i,property:n}:null}(e,t,r);const n=e;if("possessiveExpression"===n?.type){const e=n.object,i=n.property;let a=await t.evaluate(e,r);if(Array.isArray(a)&&(a=a[0]),!Vi(a))return null;const o=i?.name||i?.value;return o?{element:a,property:o}:null}return null}function qa(e){const{element:t,property:r}=e;if(r.startsWith("*")){return function(e,t){return window.getComputedStyle(e).getPropertyValue(t)}(t,r.substring(1))}return La(t,r)}function _a(e,t){const{element:r,property:n}=e;if(n.startsWith("*")){return void ca(r,n.substring(1),String(t))}ja(r,n,t)}async function $a(e,t,r){let n,i;if(e?.for){const i=await t.evaluate(e.for,r);n="number"==typeof i?i:"string"==typeof i?ba(i):void 0}if(e?.until){const n=await t.evaluate(e.until,r);"string"==typeof n&&(i=n)}return{duration:n,untilEvent:i}}function Wa(e,t){const r=t?.name,n=ma(t);if(Vi(e)||Array.isArray(e)&&e.every(e=>Vi(e)))return{type:"element",expression:""};if(n&&r)return{type:"element",expression:r};if("string"==typeof e){const t=e.trim();return t.startsWith("@")||t.startsWith("[@")?{type:"attribute",expression:t}:t.startsWith("*")?{type:"css-property",expression:t}:t.startsWith(".")?{type:"class",expression:t}:t.startsWith("#")||function(e){if("string"!=typeof e)return!1;const t=e.toLowerCase();return ua.some(e=>t.includes(e))}(t)?{type:"element",expression:t}:{type:"class",expression:t}}return{type:"class",expression:""}}let Va=(()=>{let e,t,r=[$i({description:"Toggle classes, attributes, or interactive elements",syntax:["toggle <class> [on <target>]","toggle @attr","toggle <element> [as modal]","toggle <expr> for <duration>"],examples:["toggle .active on me","toggle @disabled","toggle #myDialog as modal","toggle .loading for 2s"],sideEffects:["dom-mutation"]}),_i({name:"toggle",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw new Error("toggle command requires an argument");const n=e.args[0],i=n?.name;if("between"===i&&e.args.length>=4){const{duration:n,untilEvent:i}=await $a(e.modifiers,t,r),a=await t.evaluate(e.args[1],r),o=await t.evaluate(e.args[3],r),s=[];for(let t=4;t<e.args.length;t++){const r=e.args[t]?.name;"on"!==r&&"from"!==r&&s.push(e.args[t])}const l={filterPrepositions:!0,fallbackModifierKey:"on"},c=await Ki(s,t,r,"toggle",l,e.modifiers);return{type:"classes-between",classA:String(a).replace(/^\./,""),classB:String(o).replace(/^\./,""),targets:c,duration:n,untilEvent:i}}const a=await Ma(n,t,r);if(a)return{type:"property",target:a};const{duration:o,untilEvent:s}=await $a(e.modifiers,t,r),{value:l}=await da(n,t,r);if(Ia(l)){const e=Ra(l,r);if(e)return{type:"property",target:e}}const{type:c,expression:u}=Wa(l,n),p={filterPrepositions:!0,fallbackModifierKey:"on"};switch(c){case"attribute":{const{name:n,value:i}=ea(u);return{type:"attribute",name:n,value:i,targets:await Ki(e.args.slice(1),t,r,"toggle",p,e.modifiers),duration:o,untilEvent:s}}case"css-property":{const n=function(e){const t=function(e){const t=e.trim();if(!t.startsWith("*"))return null;const r=t.substring(1).trim();return r?{property:r}:null}(e);if(!t)return null;const r=t.property.toLowerCase();return["display","visibility","opacity"].includes(r)?r:null}(u);if(!n)throw new Error(`Invalid CSS property: ${u}`);return{type:"css-property",property:n,targets:await Ki(e.args.slice(1),t,r,"toggle",p,e.modifiers)}}case"element":{let i;if(Vi(l))i=[l];else if(Array.isArray(l)&&l.every(e=>Vi(e)))i=l;else if(u){const e=document.querySelectorAll(u);i=Array.from(e).filter(e=>Vi(e))}else i=await Ki([n],t,r,"toggle",p,e.modifiers);const a=function(e){if(0===e.length)return null;const t=e[0].tagName;if(!e.every(e=>e.tagName===t))return null;switch(t){case"DIALOG":return"dialog";case"DETAILS":return"details";case"SELECT":return"select";case"SUMMARY":return e.map(e=>e.closest("details")).filter(e=>null!==e).length>0?"details":null;default:return null}}(i);if("dialog"===a){const n=await async function(e,t,r,n){if(t?.as){const e=await r.evaluate(t.as,n);if("string"==typeof e&&"modal"===e.toLowerCase())return"modal"}if(e.length>=2){const t=await r.evaluate(e[1],n);if("string"==typeof t){const i=t.toLowerCase();if("modal"===i||"as modal"===i)return"modal";if("as"===i&&e.length>=3){const t=await r.evaluate(e[2],n);if("string"==typeof t&&"modal"===t.toLowerCase())return"modal"}}}return"non-modal"}(e.args,e.modifiers,t,r);return{type:"dialog",mode:n,targets:i}}if("details"===a)return{type:"details",targets:Sa(i)};if("select"===a)return{type:"select",targets:i};return{type:"classes",classes:ia(u),targets:i,duration:o,untilEvent:s}}default:{const n=ia(u||l);if(!n.length)throw new Error("toggle command: no valid class names found");return{type:"classes",classes:n,targets:await Ki(e.args.slice(1),t,r,"toggle",p,e.modifiers),duration:o,untilEvent:s}}}}async execute(e,t){switch(e.type){case"classes":{const r=sa(e.classes,t);if(0===r.length)return[...e.targets];if(ra(e.targets,r,(e,t)=>{e.classList.toggle(t)}),(e.duration||e.untilEvent)&&r.length)for(const t of e.targets)e.duration&&Ca(t,"class",r[0],e.duration),e.untilEvent&&Aa(t,"class",r[0],e.untilEvent);return[...e.targets]}case"attribute":if(function(e,t,r){ta(e,e=>{na(e,t,r)})}(e.targets,e.name,e.value),e.duration||e.untilEvent)for(const t of e.targets)e.duration&&Ca(t,"attribute",e.name,e.duration),e.untilEvent&&Aa(t,"attribute",e.name,e.untilEvent);return[...e.targets];case"css-property":return ta(e.targets,t=>function(e,t){const r=window.getComputedStyle(e);switch(t){case"display":"none"===r.display?(e.style.display=e.dataset.previousDisplay||"block",delete e.dataset.previousDisplay):(e.dataset.previousDisplay=r.display,e.style.display="none");break;case"visibility":e.style.visibility="hidden"===r.visibility?"visible":"hidden";break;case"opacity":e.style.opacity=0===parseFloat(r.opacity)?"1":"0"}}(t,e.property));case"property":return function(e){const t=qa(e),r=e.property;if("boolean"==typeof t||Oa.has(r)||Oa.has(r.toLowerCase())){const r=!t;return _a(e,r),r}if("number"==typeof t){const r=0===t?1:0;return _a(e,r),r}if("string"==typeof t){const n=`__ht_${r}`,i=e.element[n];return""===t&&void 0!==i?(_a(e,i),i):(e.element[n]=t,_a(e,""),"")}const n=!t;_a(e,n)}(e.target),[e.target.element];case"dialog":return ta(e.targets,t=>{return n=e.mode,void((r=t).open?r.close():"modal"===n?r.showModal():r.show());var r,n});case"details":return ta(e.targets,e=>{var t;(t=e).open=!t.open});case"select":return ta(e.targets,e=>function(e){if(document.activeElement===e)e.blur();else{if(e.focus(),"showPicker"in e&&"function"==typeof e.showPicker)try{return void e.showPicker()}catch{}const t=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});e.dispatchEvent(t)}}(e));case"classes-between":for(const t of e.targets){const r=t.classList.contains(e.classA),n=t.classList.contains(e.classB);r?(t.classList.remove(e.classA),t.classList.add(e.classB)):n?(t.classList.remove(e.classB),t.classList.add(e.classA)):t.classList.add(e.classA)}if(e.duration||e.untilEvent)for(const t of e.targets)e.duration&&Ca(t,"class",e.classA,e.duration),e.untilEvent&&Aa(t,"class",e.classA,e.untilEvent);return[...e.targets]}}},Ii(t,"ToggleCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const Da=Wi(Va);let Ba=(()=>{let e,t,r=[$i({description:"Insert content into elements or properties",syntax:["put <value> into <target>","put <value> before <target>","put <value> after <target>"],examples:['put "Hello World" into me',"put <div>Content</div> before #target","put value into #elem's innerHTML"],sideEffects:["dom-mutation"]}),_i({name:"put",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw new Error("put requires arguments");const n=e=>e?.type||"unknown",i=["into","before","after","at","at start of","at end of"];let a=-1,o=null;for(let t=0;t<e.args.length;t++){const r=e.args[t],s=n(r),l="literal"===s?r.value:r.name;if(("literal"===s||"identifier"===s)&&i.includes(l)){a=t,o=l;break}}let s=null,l=null;if(-1===a)if(e.modifiers.into||e.modifiers.before||e.modifiers.after){const t=e.modifiers.into?"into":e.modifiers.before?"before":"after";s=e.args[0],o=t,l=e.modifiers[t]}else if(e.args.length>=3)s=e.args[0],o=e.args[1]?.value||e.args[1]?.name||null,l=e.args[2];else{if(!(e.args.length>=2))throw new Error("put requires content and position");s=e.args[0],o=e.args[1]?.value||e.args[1]?.name||"into"}else s=e.args.slice(0,a)[0]||null,l=e.args.slice(a+1)[0]||null;if(!s)throw new Error("put requires content");if(!o)throw new Error("put requires position keyword");const c=await t.evaluate(s,r),u=this.mapPosition(o);let p,m,d=null;if(l){const e=n(l),i=await Ma(l,t,r);if(i)return{value:c,targets:[i.element],position:"replace",memberPath:i.property};if("memberExpression"===e){const e=l.object,n=l.property;if("selector"===e?.type?d=e.value:"identifier"===e?.type&&(d=e.name),d&&n?.name)p=n.name;else{const e=await t.evaluate(l,r);"string"==typeof e&&(d=e)}}else if("identifier"===e&&"me"===l.name)d=null;else if("selector"===e||"cssSelector"===e)d=l.value||l.selector;else if("literal"===e){const e=l.value;if("string"==typeof e&&Ia(e)){const t=Ra(e,r);if(t)return{value:c,targets:[t.element],position:"replace",memberPath:t.property}}"string"==typeof e&&this.looksLikeCss(e)?d=e:m=String(e)}else if("identifier"===e){const e=l.name;this.looksLikeCss(e)?d=e:m=e}else{const e=await t.evaluate(l,r);"string"==typeof e&&(this.looksLikeCss(e)?d=e:m=e)}}if(m)return{value:c,targets:[],position:u,memberPath:p,variableName:m};return{value:c,targets:await this.resolveTargets(d,r),position:u,memberPath:p}}async execute(e,t){const{value:r,targets:n,position:i,memberPath:a,variableName:o}=e;if(o)return t.locals&&t.locals.set(o,r),t[o]=r,[];if(a)for(const e of n)this.setProperty(e,a,r);else for(const e of n){const t=this.parseValue(r);this.insertContent(e,t,i)}return n}mapPosition(e){switch(e){case"into":return"replace";case"before":return"beforebegin";case"after":return"afterend";case"at start of":return"afterbegin";case"at end of":return"beforeend";default:throw new Error(`Invalid position: ${e}`)}}async resolveTargets(e,t){if(!e||"me"===e){if(!t.me||!Vi(t.me))throw new Error("put: no target and context.me is null");return[t.me]}const r=Array.from(document.querySelectorAll(e)).filter(e=>Vi(e));if(!r.length)throw new Error(`No elements: "${e}"`);return r}parseValue(e){return Vi(e)?e:null==e?"":String(e)}insertContent(e,t,r){if("replace"!==r)if(Vi(t)){const n=t;switch(r){case"beforebegin":e.parentElement?.insertBefore(n,e);break;case"afterbegin":e.insertBefore(n,e.firstChild);break;case"beforeend":e.appendChild(n);break;case"afterend":e.parentElement?.insertBefore(n,e.nextSibling)}}else{t.includes("<")&&t.includes(">")?e.insertAdjacentHTML(r,t):e.insertAdjacentText(r,t)}else if(Vi(t))e.innerHTML="",e.appendChild(t);else{t.includes("<")&&t.includes(">")?e.innerHTML=t:e.textContent=t}}looksLikeCss(e){if(!e)return!1;if(/^[#.\[]/.test(e))return!0;if(/[>+~\s]/.test(e)&&e.length>1)return!0;return["div","span","p","a","button","input","form","ul","li","ol","table","tr","td","th","img","h1","h2","h3","h4","h5","h6","section","article","header","footer","nav","main","aside","dialog","label","select","option","textarea"].includes(e.toLowerCase())}setProperty(e,t,r){const n=t.split(".");let i=e;for(let e=0;e<n.length-1;e++){if(!i[n[e]])throw new Error(`Property path "${t}" does not exist`);i=i[n[e]]}i[n[n.length-1]]=r}},Ii(t,"PutCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const Ha=Wi(Ba);function Fa(e){if(null==e)return 0;if("number"==typeof e)return isFinite(e)?e:0;if("string"==typeof e){return parseFloat(e)}if("boolean"==typeof e)return e?1:0;if(Array.isArray(e))return e.length;if("object"==typeof e){if("length"in e&&"number"==typeof e.length)return e.length;if("function"==typeof e.valueOf){const t=e.valueOf();if("number"==typeof t)return t}return NaN}return 0}function Ua(e,t,r){return"global"===r&&t.globals&&t.globals.has(e)?t.globals.get(e):"global"!==r&&t.locals&&t.locals.has(e)?t.locals.get(e):t.globals&&t.globals.has(e)?t.globals.get(e):t.variables&&t.variables.has(e)?t.variables.get(e):"global"===r&&t.locals&&t.locals.has(e)?t.locals.get(e):"undefined"!=typeof window&&e in window?window[e]:"undefined"!=typeof globalThis&&e in globalThis?globalThis[e]:void 0}function Ka(e,t,r,n){if("global"===n)return r.globals.set(e,t),void("undefined"!=typeof window&&(window[e]=t));if(r.locals&&r.locals.has(e))r.locals.set(e,t);else{if(r.globals&&r.globals.has(e))return r.globals.set(e,t),void("undefined"!=typeof window&&e in window&&(window[e]=t));if(!r.variables||!r.variables.has(e))return"undefined"!=typeof window&&e in window?(window[e]=t,void r.globals.set(e,t)):void r.locals.set(e,t);r.variables.set(e,t)}}function Ga(e,t){return"me"===e?t.me:"it"===e?t.it:"you"===e?t.you:Ua(e,t)}function Ya(e,t,r,n){if("number"==typeof e)return e;if(Vi(e)){const r=e;if(t){if(t.startsWith("data-")||["id","class","title","alt","src","href"].includes(t)){return Fa(r.getAttribute(t))}return Fa(r[t])}return Fa(r.value||r.textContent)}if("string"==typeof e){if("global"===r){return Fa(Ua(e,n,"global"))}if(e.includes("."))return function(e,t){const r=e.split("."),n=r[1],i=Ga(r[0],t);return i?Fa(i[n]):0}(e,n);if("me"===e&&n.me)return Fa(n.me.value||0);if("it"===e)return Fa(n.it||0);if("you"===e&&n.you)return Fa(n.you.value||0);return Fa(Ua(e,n))}return Fa(e)}function Xa(e,t,r,n,i){if(Vi(e)){const r=e;return void(t?t.startsWith("data-")||["id","class","title","alt","src","href"].includes(t)?r.setAttribute(t,String(n)):r[t]=n:"value"in r&&void 0!==r.value?r.value=String(n):r.textContent=String(n))}if("string"==typeof e){if("global"===r)return void Ka(e,n,i,"global");if(e.includes("."))return void function(e,t,r){const n=e.split("."),i=n[1],a=Ga(n[0],r);a&&(a[i]=t)}(e,n,i);if("me"===e&&i.me)return void(i.me.value=n);if("it"===e)return void Object.assign(i,{it:n});if("you"===e&&i.you)return void(i.you.value=n);Ka(e,n,i)}}const Za=Wi((()=>{let e,t,r=[$i({description:"Create DOM elements or class instances",syntax:["make a <tag#id.class1.class2/>","make a <ClassName> from <args> called <identifier>"],examples:["make an <a.navlink/> called linkElement",'make a URL from "/path/", "https://origin.example.com"'],sideEffects:["dom-creation","data-mutation"]}),_i({name:"make",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args.length>0?await t.evaluate(e.args[0],r):void 0;if(!n)throw new Error("Make command requires class name or DOM element expression");const i=void 0!==e.modifiers.an?"an":"a",a=await async function(e,t,r){if(!e)return[];if("arrayLiteral"===e.type&&Array.isArray(e.args)){const n=[];for(const i of e.args)n.push(await t.evaluate(i,r));return n}const n=await t.evaluate(e,r);return Array.isArray(n)?n:[n]}(e.modifiers.from,t,r),o=await async function(e,t,r){if(!e)return;if("symbol"===e.type&&"string"==typeof e.name)return e.name;const n=await t.evaluate(e,r);return"string"==typeof n?n:String(n)}(e.modifiers.called,t,r);return{article:i,expression:n,constructorArgs:a,variableName:o}}async execute(e,t){const{expression:r,constructorArgs:n=[],variableName:i}=e,a="string"==typeof r&&r.startsWith("<")&&r.endsWith("/>")?function(e){const t=e.slice(1,-2);let r="div",n=t;const i=t.match(/^([a-zA-Z][a-zA-Z0-9]*)/);i&&(r=i[1],n=t.slice(i[0].length));const a=document.createElement(r),o=n.split(/(?=[.#])/);for(const e of o)if(e.startsWith("#")){const t=e.slice(1);t&&(a.id=t)}else if(e.startsWith(".")){const t=e.slice(1);t&&a.classList.add(t)}return a}(r):function(e,t,r){if(Vi(e))return e;const n=String(e);let i;if("undefined"!=typeof window&&(i=window[n]),i||"undefined"==typeof global||(i=global[n]),!i&&r.variables?.has(n)&&(i=r.variables.get(n)),!i||"function"!=typeof i)throw new Error(`Constructor '${n}' not found or is not a function`);return 0===t.length?new i:new i(...t)}(r,n,t);return Object.assign(t,{it:a}),i&&Ka(i,a,t),a}},Ii(t,"MakeCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());var Ja="moveBefore"in Element.prototype,Qa=[0,1,0,0,0,0,0,0,0,1,0,1,0],eo=0,to=1,ro=2,no=new Set,io=new Set,ao=new Set,oo=new Set,so=new Set;function lo(e){for(const t of e.querySelectorAll("input"))(t.name&&t.value!==t.defaultValue||t.checked!==t.defaultChecked)&&t.setAttribute("morphlex-dirty","");for(const t of e.querySelectorAll("option"))t.value&&t.selected!==t.defaultSelected&&t.setAttribute("morphlex-dirty","");for(const t of e.querySelectorAll("textarea"))t.value!==t.defaultValue&&t.setAttribute("morphlex-dirty","")}function co(e){const t=document.createElement("template");return t.innerHTML=e.trim(),t.content}function uo(e,t,r){if(t!==r){if(t.parentNode===e){if(t.nextSibling===r)return;if(Ja)return void e.moveBefore(t,r)}e.insertBefore(t,r)}}class po{#e=new WeakMap;#t=new WeakMap;#r;constructor(e={}){this.#r=e}morph(e,t){fo(e)&&this.#n(e),t instanceof NodeList?(this.#i(t),this.#a(e,t)):fo(t)&&(this.#o(t),this.#s(e,t))}#a(e,t){const r=t.length;if(0===r)this.#l(e);else if(1===r)this.#s(e,t[0]);else if(r>1){const r=[...t];this.#s(e,r.shift());const n=e.nextSibling,i=e.parentNode||document;for(let e=0;e<r.length;e++){const t=r[e];(this.#r.beforeNodeAdded?.(i,t,n)??1)&&(i.insertBefore(t,n),this.#r.afterNodeAdded?.(t))}}}#s(e,t){e!==t&&(e.isEqualNode(t)||(1===e.nodeType&&1===t.nodeType?e.localName===t.localName?this.#c(e,t):this.#u(e,t):this.#p(e,t)))}#c(e,t){(this.#r.beforeNodeVisited?.(e,t)??1)&&((e.hasAttributes()||t.hasAttributes())&&this.#m(e,t),"textarea"===e.localName&&"textarea"===t.localName?this.#d(e,t):(e.hasChildNodes()||t.hasChildNodes())&&this.visitChildNodes(e,t),this.#r.afterNodeVisited?.(e,t))}#u(e,t){(this.#r.beforeNodeVisited?.(e,t)??1)&&(this.#h(e,t),this.#r.afterNodeVisited?.(e,t))}#p(e,t){(this.#r.beforeNodeVisited?.(e,t)??1)&&(e.nodeType===t.nodeType&&null!==e.nodeValue&&null!==t.nodeValue?e.nodeValue=t.nodeValue:this.#h(e,t),this.#r.afterNodeVisited?.(e,t))}#m(e,t){e.hasAttribute("morphlex-dirty")&&e.removeAttribute("morphlex-dirty");for(const{name:r,value:n}of t.attributes){"value"===r&&mo(e)&&e.value!==n&&(this.#r.preserveChanges&&e.value!==e.defaultValue||(e.value=n)),"selected"===r&&ho(e)&&!e.selected&&(this.#r.preserveChanges&&e.selected!==e.defaultSelected||(e.selected=!0)),"checked"===r&&mo(e)&&!e.checked&&(this.#r.preserveChanges&&e.checked!==e.defaultChecked||(e.checked=!0));const t=e.getAttribute(r);t!==n&&(this.#r.beforeAttributeUpdated?.(e,r,n)??1)&&(e.setAttribute(r,n),this.#r.afterAttributeUpdated?.(e,r,t))}for(const{name:r,value:n}of e.attributes)t.hasAttribute(r)||("selected"===r&&ho(e)&&e.selected&&(this.#r.preserveChanges&&e.selected!==e.defaultSelected||(e.selected=!1)),"checked"===r&&mo(e)&&e.checked&&(this.#r.preserveChanges&&e.checked!==e.defaultChecked||(e.checked=!1)),(this.#r.beforeAttributeUpdated?.(e,r,null)??1)&&(e.removeAttribute(r),this.#r.afterAttributeUpdated?.(e,r,n)))}#d(e,t){const r=t.textContent||"",n=e.value!==e.defaultValue;e.textContent!==r&&(e.textContent=r),this.#r.preserveChanges&&n||(e.value=e.defaultValue)}visitChildNodes(e,t){if(!(this.#r.beforeChildrenVisited?.(e)??1))return;const r=e,n=[...e.childNodes],i=[...t.childNodes];no.clear(),io.clear(),ao.clear(),oo.clear(),so.clear();const a=[],o=[],s=[],l=[],c=[],u=[];for(let e=0;e<n.length;e++){const t=n[e],r=t.nodeType;l[e]=r,1===r?(u[e]=t.localName,io.add(e)):3===r&&""===t.textContent?.trim()?so.add(e):no.add(e)}for(let e=0;e<i.length;e++){const t=i[e],r=t.nodeType;if(s[e]=r,1===r)c[e]=t.localName,oo.add(e);else{if(3===r&&""===t.textContent?.trim())continue;ao.add(e)}}for(const e of oo){const t=c[e],r=i[e];for(const i of io){if(t!==u[i])continue;if(n[i].isEqualNode(r)){a[e]=i,o[e]=eo,io.delete(i),oo.delete(e);break}}}for(const e of oo){const t=i[e],r=t.id,s=this.#e.get(t);if(""!==r||s)e:for(const t of io){const i=n[t];if(c[e]===u[t]){if(""!==r&&r===i.id){a[e]=t,o[e]=to,io.delete(t),oo.delete(e);break e}if(s){const r=this.#t.get(i);if(r)for(let n=0;n<s.length;n++){if(r.has(s[n])){a[e]=t,o[e]=to,io.delete(t),oo.delete(e);break e}}}}}}for(const e of oo){const t=i[e],r=t.getAttribute("name"),s=t.getAttribute("href"),l=t.getAttribute("src");for(const t of io){const i=n[t];if(c[e]===u[t]&&(r&&r===i.getAttribute("name")||s&&s===i.getAttribute("href")||l&&l===i.getAttribute("src"))){a[e]=t,o[e]=to,io.delete(t),oo.delete(e);break}}}for(const e of oo){const t=i[e],r=c[e];for(const i of io){if(r===u[i]){if("input"===r&&n[i].type!==t.type)continue;a[e]=i,o[e]=to,io.delete(i),oo.delete(e);break}}}for(const e of ao){const t=i[e];for(const r of no){if(n[r].isEqualNode(t)){a[e]=r,o[e]=eo,no.delete(r),ao.delete(e);break}}}for(const e of ao){const t=s[e];for(const r of no)if(t===l[r]){a[e]=r,o[e]=ro,no.delete(r),ao.delete(e);break}}for(const e of no)this.#l(n[e]);for(const e of so)this.#l(n[e]);for(const e of io)this.#l(n[e]);const p=function(e){const t=e.length;if(0===t)return[];const r=[],n=[],i=new Array(t);for(let a=0;a<t;a++){const t=e[a];if(void 0===t)continue;let o=0,s=r.length;for(;o<s;){const e=Math.floor((o+s)/2);r[e]<t?o=e+1:s=e}i[a]=o>0?n[o-1]:-1,o===r.length?(r.push(t),n.push(a)):(r[o]=t,n[o]=a)}const a=[];if(0===n.length)return a;let o=n[n.length-1];for(;void 0!==o&&-1!==o;)a.unshift(o),o=i[o];return a}(a),m=new Array(n.length);for(let e=0;e<p.length;e++)m[a[p[e]]]=!0;let d=r.firstChild;for(let e=0;e<i.length;e++){const t=i[e],s=a[e];if(void 0!==s){const i=n[s],a=o[e];m[s]||uo(r,i,d),a===eo||(a===to?this.#c(i,t):this.#s(i,t)),d=i.nextSibling}else(this.#r.beforeNodeAdded?.(r,t,d)??1)&&(r.insertBefore(t,d),this.#r.afterNodeAdded?.(t),d=t.nextSibling)}this.#r.afterChildrenVisited?.(e)}#h(e,t){const r=e.parentNode||document,n=e;(this.#r.beforeNodeRemoved?.(e)??1)&&(this.#r.beforeNodeAdded?.(r,t,n)??1)&&(r.insertBefore(t,n),this.#r.afterNodeAdded?.(t),e.remove(),this.#r.afterNodeRemoved?.(e))}#l(e){(this.#r.beforeNodeRemoved?.(e)??1)&&(e.remove(),this.#r.afterNodeRemoved?.(e))}#i(e){for(const t of e)fo(t)&&this.#o(t)}#o(e){const t=this.#e;for(const r of e.querySelectorAll("[id]")){const n=r.id;if(""===n)continue;let i=r;for(;i;){const r=t.get(i);if(r?r.push(n):t.set(i,[n]),i===e)break;i=i.parentElement}}}#n(e){const t=this.#t;for(const r of e.querySelectorAll("[id]")){const n=r.id;if(""===n)continue;let i=r;for(;i;){const r=t.get(i);if(r?r.add(n):t.set(i,new Set([n])),i===e)break;i=i.parentElement}}}}function mo(e){return"input"===e.localName}function ho(e){return"option"===e.localName}function fo(e){return!!Qa[e.nodeType]}const yo=function(e,t,r={}){"string"==typeof t&&(t=co(t).childNodes),!r.preserveChanges&&fo(e)&&lo(e),new po(r).morph(e,t)},vo=function(e,t,r={}){if("string"==typeof t){const e=co(t);if(!e.firstChild||1!==e.childNodes.length||1!==e.firstChild.nodeType)throw new Error("[Morphlex] The string was not a valid HTML element.");t=e.firstChild}if(1!==e.nodeType||1!==t.nodeType||e.localName!==t.localName)throw new Error("[Morphlex] You can only do an inner morph with matching elements.");fo(e)&&lo(e),new po(r).visitChildNodes(e,t)};function go(e){return e?{preserveChanges:e.preserveChanges??!0,beforeNodeVisited:e.beforeNodeVisited,afterNodeVisited:e.afterNodeVisited,beforeNodeAdded:e.beforeNodeAdded?t=>e.beforeNodeAdded(t.parentNode,t,null):void 0,afterNodeAdded:e.afterNodeAdded,beforeNodeRemoved:e.beforeNodeRemoved,afterNodeRemoved:e.afterNodeRemoved}:{preserveChanges:!0}}let ko={morph(e,t,r){const n=go(r);yo(e,t,n)},morphInner(e,t,r){const n=go(r);let i;if("string"==typeof t){const r=document.createElement(e.tagName);r.innerHTML=t,i=r}else i=t;vo(e,i,n)}};const wo={morph(e,t,r){ko.morph(e,t,r)},morphInner(e,t,r){ko.morphInner(e,t,r)}};function bo(){return"undefined"!=typeof document&&"function"==typeof document.startViewTransition}let zo={enabled:bo(),defaultTimeout:5e3},xo=[],Eo=!1;async function So(e,t){const{skipTransition:r=!1,timeout:n=zo.defaultTimeout}=t;if(!zo.enabled||!bo()||r)return void await e();const i=document.startViewTransition(async()=>{await e()}),a=new Promise((e,t)=>{setTimeout(()=>t(new Error("View transition timed out")),n)});try{await Promise.race([i.finished,a])}catch(e){}}function To(e,t={}){return new Promise((r,n)=>{xo.push({callback:e,options:t,resolve:r,reject:n}),async function(){if(!Eo&&0!==xo.length){for(Eo=!0;xo.length>0;){const e=xo.shift();try{await So(e.callback,e.options),e.resolve()}catch(t){e.reject(t)}}Eo=!1}}().catch(n)})}const Co={html:{category:"document-root",message:"The <html> element is the document root and cannot be part of a partial",suggestion:"Remove the <html> element. Return only the content that should replace the target."},body:{category:"document-root",message:"The <body> element is the document body and cannot be part of a partial",suggestion:"Remove the <body> element. Return only the content for the target."},head:{category:"document-root",message:"The <head> element contains document metadata and cannot be part of a partial",suggestion:"Remove the <head> element. Styles/scripts should be loaded separately."}},Ao={header:{category:"semantic-landmark",message:"The <header> element is a semantic landmark. Swapping may create duplicate landmarks.",suggestion:"Consider if <header> is appropriate in this partial, or if the page already has this landmark."},footer:{category:"semantic-landmark",message:"The <footer> element is a semantic landmark. Swapping may create duplicate landmarks.",suggestion:"Consider if <footer> is appropriate in this partial, or if the page already has this landmark."},main:{category:"semantic-landmark",message:"The <main> element should be unique per page. Swapping may create duplicates.",suggestion:"Consider if <main> is appropriate. Pages should have exactly one <main> element."},nav:{category:"semantic-landmark",message:"The <nav> element is a semantic landmark. Consider if navigation should be in a partial.",suggestion:"Consider if <nav> is appropriate in this partial, or if navigation should be static."},aside:{category:"semantic-landmark",message:"The <aside> element is a semantic landmark. Swapping may affect accessibility.",suggestion:"Consider if <aside> is appropriate in this partial."}},Lo={title:{category:"metadata",message:"The <title> element should only appear in <head>. This may be ignored by browsers.",suggestion:"Move <title> to the document <head> or remove from partial."},meta:{category:"metadata",message:"The <meta> element should only appear in <head>. This may be ignored by browsers.",suggestion:"Move <meta> to the document <head> or remove from partial."},link:{category:"metadata",message:"The <link> element for stylesheets should typically be in <head>.",suggestion:"Consider if <link> should be in document <head> for proper loading order."},base:{category:"metadata",message:"The <base> element should only appear once in <head>.",suggestion:"Remove <base> from partial. It must be in document <head>."}};let jo={...{enabled:!("undefined"!=typeof window&&window.__HYPERFIXI_PROD__||"undefined"!=typeof process&&"production"===process.env?.NODE_ENV),showWarnings:!0,strictness:"standard",additionalCriticalElements:[],additionalStructuralElements:[],ignoredElements:[],ignoredTargets:[],targetOverrides:[]}};function Po(){return{...jo}}function No(e,t){if("*"===t)return!0;if(t.includes("*")){return new RegExp("^"+t.replace(/\*/g,".*")+"$").test(e)}return e===t}function Oo(e,t=""){const r=function(e){const t={...jo};if(jo.targetOverrides)for(const r of jo.targetOverrides)if(No(e,r.target))return{...t,...r.config};return t}(t);if(!r.enabled)return{valid:!0,issues:[],bySeverity:{critical:[],structural:[],warning:[]},totalIssues:0,shouldProceed:!0};if(r.ignoredTargets?.some(e=>No(t,e)))return{valid:!0,issues:[],bySeverity:{critical:[],structural:[],warning:[]},totalIssues:0,shouldProceed:!0};const n=[];if(e.match(/<!DOCTYPE[^>]*>/i)&&!r.ignoredElements?.includes("doctype")&&n.push({severity:"critical",category:"document-root",element:"DOCTYPE",message:"DOCTYPE declarations cannot be part of a partial",suggestion:"Remove DOCTYPE declaration. Partials should only contain content fragments.",targetSelector:t,count:1}),"undefined"==typeof document)return function(e,t,r){const n=[];for(const[i,a]of Object.entries(Co)){if(r.ignoredElements?.includes(i))continue;const o=new RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&n.push({severity:"critical",category:a.category,element:i,message:a.message,suggestion:a.suggestion||`Remove the <${i}> element from the partial.`,targetSelector:t,count:l})}if("relaxed"!==r.strictness)for(const[i,a]of Object.entries(Ao)){if(r.ignoredElements?.includes(i))continue;const o=new RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&n.push({severity:"strict"===r.strictness?"critical":"structural",category:a.category,element:i,message:a.message,suggestion:a.suggestion||`Consider if <${i}> is appropriate in this partial.`,targetSelector:t,count:l})}return Io(n)}(e,t,r);for(const[i,a]of Object.entries(Co)){if(r.ignoredElements?.includes(i))continue;const o=new RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&n.push({severity:"critical",category:a.category,element:i,message:a.message,suggestion:a.suggestion||`Remove the <${i}> element from the partial.`,targetSelector:t,count:l})}const i=document.createElement("div");if(i.innerHTML=e,"relaxed"!==r.strictness)for(const[e,a]of Object.entries(Ao)){if(r.ignoredElements?.includes(e))continue;const o=i.querySelectorAll(e).length;o>0&&n.push({severity:"strict"===r.strictness?"critical":"structural",category:a.category,element:e,message:a.message,suggestion:a.suggestion||`Consider if <${e}> is appropriate in this partial.`,targetSelector:t,count:o})}if("strict"===r.strictness)for(const[e,a]of Object.entries(Lo)){if(r.ignoredElements?.includes(e))continue;const o=i.querySelectorAll(e).length;o>0&&n.push({severity:"warning",category:a.category,element:e,message:a.message,suggestion:a.suggestion||`Move <${e}> to document <head> or remove from partial.`,targetSelector:t,count:o})}if(r.additionalCriticalElements)for(const e of r.additionalCriticalElements){if(r.ignoredElements?.includes(e))continue;const a=i.querySelectorAll(e).length;a>0&&n.push({severity:"critical",category:"document-root",element:e,message:`The <${e}> element is configured as a critical layout element.`,suggestion:`Remove <${e}> from the partial content.`,targetSelector:t,count:a})}if(r.additionalStructuralElements)for(const e of r.additionalStructuralElements){if(r.ignoredElements?.includes(e))continue;const a=i.querySelectorAll(e).length;a>0&&n.push({severity:"structural",category:"semantic-landmark",element:e,message:`The <${e}> element is configured as a structural element.`,suggestion:`Consider if <${e}> is appropriate in this partial.`,targetSelector:t,count:a})}if(r.customValidator){const i=r.customValidator(e,t);n.push(...i)}return Io(n)}function Io(e){const t={critical:e.filter(e=>"critical"===e.severity),structural:e.filter(e=>"structural"===e.severity),warning:e.filter(e=>"warning"===e.severity)};return{valid:0===t.critical.length,issues:e,bySeverity:t,totalIssues:e.length,shouldProceed:!0}}const Ro="color: #dc2626; font-weight: bold;",Mo="color: #ea580c; font-weight: bold;",qo="color: #ca8a04; font-weight: bold;",_o="color: inherit;",$o={critical:"🚨",structural:"⚠️",warning:"💡"},Wo={critical:"CRITICAL",structural:"STRUCTURAL",warning:"WARNING"};function Vo(e){0!==e.totalIssues&&("undefined"!=typeof window&&"undefined"!=typeof console?function(e){if(function(e){const t=[],r=[];e.bySeverity.critical.length>0&&(t.push(`%c${e.bySeverity.critical.length} critical%c`),r.push(Ro,_o));e.bySeverity.structural.length>0&&(t.length>0&&t.push(", "),t.push(`%c${e.bySeverity.structural.length} structural%c`),r.push(Mo,_o));e.bySeverity.warning.length>0&&(t.length>0&&t.push(", "),t.push(`%c${e.bySeverity.warning.length} warning(s)%c`),r.push(qo,_o))}(e),e.bySeverity.critical.length>0)for(const t of e.bySeverity.critical)Do(t);if(e.bySeverity.structural.length>0)for(const t of e.bySeverity.structural)Do(t);if(e.bySeverity.warning.length>0)for(const t of e.bySeverity.warning)Do(t)}(e):function(e){const t=[];e.bySeverity.critical.length>0&&t.push(`${e.bySeverity.critical.length} critical`);e.bySeverity.structural.length>0&&t.push(`${e.bySeverity.structural.length} structural`);e.bySeverity.warning.length>0&&t.push(`${e.bySeverity.warning.length} warning(s)`);for(const t of e.issues){}}(e))}function Do(e){}function Bo(e){return`${$o[e.severity]} [${Wo[e.severity]}] <${e.element}>${e.count>1?` (${e.count}x)`:""}${e.targetSelector?` [target: ${e.targetSelector}]`:""}: ${e.message}`}function Ho(e){return e.issues.map(Bo)}const Fo={into:"innerHTML",over:"outerHTML",innerhtml:"innerHTML",outerhtml:"outerHTML",beforebegin:"beforeBegin",afterbegin:"afterBegin",beforeend:"beforeEnd",afterend:"afterEnd",delete:"delete",none:"none",morph:"morph",innermorph:"morph",outermorph:"morphOuter"};function Uo(e,t,r,n){const i=null===t||Vi(t)?"":t,a=Vi(t)?t:null;switch(r){case"morph":if(null!==t)try{wo.morphInner(e,a||i,n)}catch(t){a?(e.innerHTML="",e.appendChild(a)):e.innerHTML=i}break;case"morphOuter":if(null!==t)try{wo.morph(e,a||i,n)}catch(t){a?e.replaceWith(a):e.outerHTML=i}break;case"innerHTML":a?(e.innerHTML="",e.appendChild(a)):e.innerHTML=i;break;case"outerHTML":a?e.replaceWith(a):e.outerHTML=i;break;case"beforeBegin":a?e.parentElement?.insertBefore(a,e):e.insertAdjacentHTML("beforebegin",i);break;case"afterBegin":a?e.insertBefore(a,e.firstChild):e.insertAdjacentHTML("afterbegin",i);break;case"beforeEnd":a?e.appendChild(a):e.insertAdjacentHTML("beforeend",i);break;case"afterEnd":a?e.parentElement?.insertBefore(a,e.nextSibling):e.insertAdjacentHTML("afterend",i);break;case"delete":e.remove();break;case"none":break;default:throw new Error(`[HyperFixi] swap: unknown strategy "${r}"`)}}async function Ko(e,t,r,n={}){const{morphOptions:i,useViewTransition:a=!1,validateContent:o=!1,targetSelector:s}=n;if(o&&"string"==typeof t){const r=Po();if(r.enabled){const n=s||function(e){if(!e)return"";if(e.id)return`#${e.id}`;if(e.className){const t=e.className.split(" ")[0];if(t)return`.${t}`}return e.tagName.toLowerCase()}(e[0]),i=Oo(t,n);i.totalIssues>0&&r.showWarnings&&Vo(i)}}const l=()=>{for(const n of e)Uo(n,t,r,i)};a&&bo()?await To(l):l()}function Go(e){if(null==e)return null;if(Vi(e))return e;if(function(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&11===e.nodeType&&"childNodes"in e}(e)){const t=e,r=document.createElement("div");return r.appendChild(t.cloneNode(!0)),r.innerHTML}return String(e)}async function Yo(e,t){const r=Bi(e||void 0,t);if(0===r.length){throw new Error(`[HyperFixi] swap: no elements found${e?` matching "${e}"`:""}`)}return r}let Xo=(()=>{let e,t,r=[$i({description:"Swap content into target elements with intelligent morphing support",syntax:["swap <target> with <content>","swap [strategy] of <target> with <content>","swap into <target> with <content>","swap over <target> with <content>","swap delete <target>","swap <target> with <content> using view transition"],examples:["swap #target with it","swap innerHTML of #target with it","swap over #modal with fetchedContent","swap delete #notification"],sideEffects:["dom-mutation"]}),_i({name:"swap",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args;if(!n||0===n.length)throw new Error("[HyperFixi] swap: command requires arguments");const i=n.map(e=>{if(!e||"object"!=typeof e)return null;const t=e,r=t.type;return"literal"===r&&"string"==typeof t.value?t.value.toLowerCase():"identifier"===r&&"string"==typeof t.name?t.name.toLowerCase():null}),a=i.findIndex(e=>"with"===e),o=i.findIndex(e=>"of"===e),s=i.findIndex(e=>"delete"===e),l=i.findIndex(e=>"using"===e);let c=!1;if(-1!==l){const e=i.slice(l+1);e.includes("view")&&e.includes("transition")&&(c=!0)}let u="morph",p=null,m=null;if(-1!==s)u="delete",p=n[s+1],m=null;else if(-1!==o&&-1!==a){const e=i[0];e&&Fo[e]&&(u=Fo[e]),p=n[o+1],m=n[a+1]}else if(-1!==a){const e=i.slice(0,a),t=e.findIndex(e=>"into"===e),r=e.findIndex(e=>"over"===e);if(-1!==t)u="innerHTML",p=n[t+1];else if(-1!==r)u="outerHTML",p=n[r+1];else{const e=i[0];e&&Fo[e]?(u=Fo[e],p=n[1]||n[a-1]):p=n[a-1]}m=n[a+1]}else{if(!(n.length>=2))throw new Error('[HyperFixi] swap: could not parse arguments. Expected "swap <target> with <content>"');{const e=i[0];e&&Fo[e]&&(u=Fo[e]),p=n[n.length-2],m=n[n.length-1]}}let d=null,h=null;if(p){const e=p.type,n=p.value;if("selector"===e&&"string"==typeof n)d=n;else if("binaryExpression"===e&&"of"===p.operator){const e=p.left,n=p.right;if(e&&"identifier"===e.type&&"string"==typeof e.name){const t=e.name.toLowerCase();Fo[t]&&(u=Fo[t])}n&&"selector"===n.type&&"string"==typeof n.value?d=n.value:n&&(d=await t.evaluate(n,r))}else d=await t.evaluate(p,r)}m&&(h=await t.evaluate(m,r));let f=null;if("string"==typeof d)f=d;else if(Vi(d))return{targets:[d],content:Go(h),strategy:u,morphOptions:{preserveChanges:!0},useViewTransition:c};return{targets:await Yo(f,r),content:Go(h),strategy:u,morphOptions:{preserveChanges:!0},useViewTransition:c}}async execute(e,t){const{targets:r,content:n,strategy:i,morphOptions:a,useViewTransition:o}=e;await Ko(r,n,i,{morphOptions:a,useViewTransition:o})}},Ii(t,"SwapCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})(),Zo=(()=>{let e,t,r=[$i({description:"Morph content into target elements (intelligent diffing, preserves state)",syntax:["morph <target> with <content>","morph over <target> with <content>"],examples:["morph #target with it","morph over #modal with fetchedContent"],sideEffects:["dom-mutation"]}),_i({name:"morph",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args;if(!n||0===n.length)throw new Error("[HyperFixi] morph: command requires arguments");const i=n.map(e=>"identifier"===e.type&&"string"==typeof e.name?e.name.toLowerCase():null),a=i.findIndex(e=>"with"===e),o=i.findIndex(e=>"over"===e),s=i.findIndex(e=>"using"===e);let l=!1;if(-1!==s){const e=i.slice(s+1);e.includes("view")&&e.includes("transition")&&(l=!0)}let c="morph",u=null,p=null;if(-1!==o&&o<(-1===a?1/0:a)?(c="morphOuter",u=n[o+1],-1!==a&&(p=n[a+1])):-1!==a?(u=n[a-1],p=n[a+1]):n.length>=2&&(u=n[0],p=n[1]),!u)throw new Error("[HyperFixi] morph: could not determine target");let m=null;m="selector"===u.type&&"string"==typeof u.value?u.value:await t.evaluate(u,r);let d,h=null;if(p&&(h=await t.evaluate(p,r)),!m)throw new Error("[HyperFixi] morph: could not determine target");if("string"==typeof m)d=await Yo(m,r);else{if(!Vi(m))throw new Error("[HyperFixi] morph: target must be a selector or element");d=[m]}return{targets:d,content:Go(h),strategy:c,morphOptions:{preserveChanges:!0},useViewTransition:l}}async execute(e,t){const{targets:r,content:n,strategy:i,morphOptions:a,useViewTransition:o}=e;if(o)await Ko(r,n,i,{morphOptions:a,useViewTransition:o});else for(const e of r)Uo(e,n,i,a)}},Ii(t,"MorphCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const Jo=Wi(Xo),Qo=Wi(Zo);function es(e,t,r={}){return new CustomEvent(e,{detail:void 0!==t?t:{},bubbles:void 0===r.bubbles||r.bubbles,cancelable:void 0===r.cancelable||r.cancelable,composed:void 0!==r.composed&&r.composed})}function ts(e){const t=e.trim();return/^\d+$/.test(t)?parseInt(t,10):/^\d*\.\d+$/.test(t)?parseFloat(t):"true"===t||"false"!==t&&("null"===t?null:"undefined"!==t?t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t:void 0)}function rs(e,t,r={},n={}){const i=es(t,r,n);return e.dispatchEvent(i),i}function ns(e,t,r={},n={}){return{lokascript:rs(e,`lokascript:${t}`,r,n),hyperfixi:rs(e,`hyperfixi:${t}`,r,n)}}Jo(),Qo();const is={morph:"morph",morphouter:"morphOuter",innerhtml:"innerHTML",outerhtml:"outerHTML",beforebegin:"beforeBegin",afterbegin:"afterBegin",beforeend:"beforeEnd",afterend:"afterEnd",delete:"delete",none:"none"};function as(e,t){const{target:r,strategy:n,content:i}=e,a=document.querySelector(r);if(!a||!Vi(a))return{success:!1,error:`Target "${r}" not found`};try{switch(n){case"morph":wo.morphInner(a,i,t);break;case"morphOuter":wo.morph(a,i,t);break;case"innerHTML":a.innerHTML=i;break;case"outerHTML":a.outerHTML=i;break;case"beforeBegin":a.insertAdjacentHTML("beforebegin",i);break;case"afterBegin":a.insertAdjacentHTML("afterbegin",i);break;case"beforeEnd":a.insertAdjacentHTML("beforeend",i);break;case"afterEnd":a.insertAdjacentHTML("afterend",i);break;case"delete":a.remove();break;case"none":break;default:return{success:!1,error:`Unknown strategy "${n}"`}}return{success:!0}}catch(e){return{success:!1,error:String(e)}}}function os(e,t){const r=function(e){const t=[],r=document.createElement("div");r.innerHTML=e;const n=r.querySelectorAll("hx-partial");for(const e of n){const r=e.getAttribute("target");if(!r)continue;const n=e.getAttribute("strategy")?.toLowerCase()||"morph";t.push({target:r,strategy:is[n]||"morph",content:e.innerHTML})}return t}(e),n=Po(),i={count:0,targets:[],errors:[],validationWarnings:[],validationDetails:{}};for(const e of r){if(n.enabled){const t=Oo(e.content,e.target);t.totalIssues>0&&(n.showWarnings&&Vo(t),i.validationWarnings.push(...Ho(t)),i.validationDetails[e.target]=t)}const r=as(e,t);r.success?(i.count++,i.targets.push(e.target)):r.error&&i.errors.push(`${e.target}: ${r.error}`)}return i}const ss=Wi((()=>{let e,t,r=[$i({description:"Process <hx-partial> elements for multi-target swaps",syntax:["process partials in <content>","process partials in <content> using view transition"],examples:["process partials in it","process partials in fetchedHtml","process partials in it using view transition"],sideEffects:["dom-mutation"]}),_i({name:"process",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args;if(!n||0===n.length)throw new Error("process partials command requires content argument");const i=[],a=[];for(const e of n){const n=await t.evaluate(e,r);i.push(n),"string"==typeof n&&a.push(n.toLowerCase())}const o=a.findIndex(e=>"partials"===e);if(-1===o)throw new Error('process command expects "partials" keyword: process partials in <content>');const s=a.findIndex(e=>"in"===e);if(-1===s||s<=o)throw new Error('process partials command expects "in" keyword: process partials in <content>');const l=i[s+1];let c;if("string"==typeof l)c=l;else if(Vi(l))c=l.outerHTML;else{if(!l||"function"!=typeof l.text)throw new Error("process partials: content must be an HTML string or element");c=await l.text()}const u=a.findIndex(e=>"using"===e);let p=!1;if(-1!==u){const e=a.slice(u+1).join(" ");e.includes("view")&&e.includes("transition")&&(p=!0)}return{html:c,useViewTransition:p,morphOptions:{preserveChanges:!0}}}async execute(e,t){const{html:r,useViewTransition:n,morphOptions:i}=e,a=()=>os(r,i);let o;return n&&bo()?await To(()=>{o=a()}):o=a(),t.it=o,ns(window,"partials",o),o}},Ii(t,"ProcessPartialsCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());function ls(e,t,r){return e?new Promise(r=>{const n=us(()=>{e.removeEventListener(t,i)},r),i=e=>{n({event:e,timedOut:!1,cancelled:!1})};e.addEventListener(t,i)}):Promise.reject(new Error("waitForEvent: no target provided"))}function cs(e){return new Promise(t=>setTimeout(t,e))}function us(e,t){let r=!1;return n=>{r||(r=!0,e(),t(n))}}ss();let ps=(()=>{let e,t,r=[$i({description:"Wait for time delay, event, or race condition",syntax:["wait <time>","wait for <event>","wait for <event> or <condition>"],examples:["wait 2s","wait for click","wait for click or 1s","wait for mousemove(clientX, clientY)"],sideEffects:["time","event-listening"]}),_i({name:"wait",category:"async"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw new Error("wait command requires an argument");if(e.modifiers.or)return this.parseRaceCondition(e,t,r);if(e.modifiers.for)return this.parseEventWait(e.modifiers.for,e.modifiers.from,t,r);const n=e.args[0];return"arrayLiteral"===n.type&&n.elements?this.parseEventArrayWait(n.elements,e.args[1],t,r):this.parseTimeWait(e.args[0],t,r)}async execute(e,t){const r=Date.now();if("time"===e.type)return await cs(e.milliseconds),{type:"time",result:e.milliseconds,duration:Date.now()-r};if("event"===e.type){const n=e.target??t.me??document,i=(await ls(n,e.eventName)).event;if(Object.assign(t,{it:i}),e.destructure)for(const r of e.destructure)r in i&&t.locals.set(r,i[r]);return{type:"event",result:i,duration:Date.now()-r}}const{result:n,winningCondition:i}=await this.executeRace(e.conditions,t);if(Object.assign(t,{it:n}),n instanceof Event&&"event"===i?.type&&i.destructure)for(const e of i.destructure)e in n&&t.locals.set(e,n[e]);return{type:n instanceof Event?"event":"time",result:n,duration:Date.now()-r}}async parseTimeWait(e,t,r){return{type:"time",milliseconds:za(await t.evaluate(e,r))}}async parseEventWait(e,t,r,n){const i=await r.evaluate(e,n);if("string"!=typeof i)throw new Error("wait for: event name must be a string");const a=i.match(/^(\w+)\(([^)]+)\)$/),o=a?a[1]:i,s=a?a[2].split(",").map(e=>e.trim()):void 0;let l;if(t){const e=await r.evaluate(t,n);if(!e||"object"!=typeof e||!("addEventListener"in e))throw new Error("wait for from: target must be an EventTarget");l=e}else l=n.me??void 0;return{type:"event",eventName:o,target:l,destructure:s}}async parseEventArrayWait(e,t,r,n){const i=[];for(const t of e){const e=t;if("objectLiteral"===e.type&&e.properties){let t="",r=[];for(const n of e.properties){const e=n.key?.name||n.key?.value;"name"===e&&n.value?t=n.value.value||"":"args"===e&&n.value?.elements&&(r=n.value.elements.map(e=>e.value||e.name||""))}t&&i.push({name:t,params:r})}}let a;if(t){const e=await r.evaluate(t,n);e&&"object"==typeof e&&"addEventListener"in e&&(a=e)}return a||(a=n.me??void 0),1===i.length?{type:"event",eventName:i[0].name,target:a,destructure:i[0].params.length>0?i[0].params:void 0}:{type:"race",conditions:i.map(e=>({type:"event",eventName:e.name,target:a,destructure:e.params.length>0?e.params:void 0}))}}async parseRaceCondition(e,t,r){const n=[];e.modifiers.for?n.push(await this.parseEventWait(e.modifiers.for,e.modifiers.from,t,r)):e.args[0]&&n.push(await this.parseTimeWait(e.args[0],t,r));const i=await t.evaluate(e.modifiers.or,r),a=Array.isArray(i)?i:[i];for(const e of a)try{n.push({type:"time",milliseconds:za(e)})}catch{if("string"==typeof e){const t=e.match(/^(\w+)\(([^)]+)\)$/);n.push(t?{type:"event",eventName:t[1],target:r.me??void 0,destructure:t[2].split(",").map(e=>e.trim())}:{type:"event",eventName:e,target:r.me??void 0})}}if(n.length<2)throw new Error("wait: race requires at least 2 conditions");return{type:"race",conditions:n}}async executeRace(e,t){const r=e.map(e=>{if("time"===e.type)return cs(e.milliseconds).then(()=>({result:e.milliseconds,winningCondition:e}));return ls(e.target??t.me??document,e.eventName).then(t=>({result:t.event,winningCondition:e}))});return Promise.race(r)}},Ii(t,"WaitCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const ms=Wi(ps);let ds=(()=>{let e,t,r=[$i({description:"Make HTTP requests with lifecycle event support",syntax:["fetch <url>","fetch <url> as <type>","fetch <url> with <options>"],examples:['fetch "/api/data"','fetch "/api/users" as json','fetch "/api/save" with { method:"POST" }'],sideEffects:["network","event-dispatching"]}),_i({name:"fetch",category:"async"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw new Error("fetch requires a URL");return{url:await this.parseURL(e.args[0],t,r),responseType:this.parseResponseType(e.modifiers.as),options:await this.parseRequestOptions(e.modifiers.with,t,r)}}async execute(e,t){const r=Date.now(),{url:n,responseType:i,options:a}=e,o=new AbortController;let s;t.me&&(s=()=>o.abort(),t.me.addEventListener("fetch:abort",s,{once:!0}));const l={...a,signal:o.signal};if(t.me){const e={...l,sender:t.me,headers:l.headers||{}};this.dispatchEvent(t.me,"fetch:beforeRequest",e),l.headers=e.headers}let c;a.timeout&&(c=setTimeout(()=>o.abort(),a.timeout));try{let e=await fetch(n,l);if(t.me){const r={response:e};this.dispatchEvent(t.me,"fetch:afterResponse",r),e=r.response}const a=await this.handleResponse(e,i);t.me&&this.dispatchEvent(t.me,"fetch:afterRequest",{result:a});const o={status:e.status,statusText:e.statusText,headers:e.headers,data:a,url:e.url,duration:Date.now()-r};return Object.assign(t,{it:a}),o}catch(e){if(t.me&&this.dispatchEvent(t.me,"fetch:error",{reason:e instanceof Error?e.message:String(e),error:e}),e instanceof Error&&"AbortError"===e.name)throw new Error(`Fetch aborted for ${n}`);throw new Error(`Fetch failed for ${n}: ${e instanceof Error?e.message:String(e)}`)}finally{c&&clearTimeout(c),t.me&&s&&t.me.removeEventListener("fetch:abort",s)}}async parseURL(e,t,r){const n=await t.evaluate(e,r);if("string"!=typeof n||!n)throw new Error("fetch: URL must be a non-empty string");return n}parseResponseType(e){if(!e)return"text";if(("identifier"===e.type||"expression"===e.type)&&e.name){const t=e.name.toLowerCase();if(["text","json","html","response","blob","arraybuffer"].includes(t))return"arraybuffer"===t?"arrayBuffer":t;throw new Error(`fetch: invalid response type "${t}"`)}return"text"}async parseRequestOptions(e,t,r){if(!e)return{};const n=await t.evaluate(e,r);if("object"!=typeof n||null===n)throw new Error('fetch: "with" options must be an object');const i={};return"method"in n&&(i.method=String(n.method).toUpperCase()),"headers"in n&&(i.headers=this.parseHeaders(n.headers)),"body"in n&&(i.body=this.parseBody(n.body)),"credentials"in n&&(i.credentials=n.credentials),"mode"in n&&(i.mode=n.mode),"cache"in n&&(i.cache=n.cache),i}parseHeaders(e){if(e instanceof Headers)return e;const t=new Headers;if("object"==typeof e&&null!==e)for(const[r,n]of Object.entries(e))t.set(r,String(n));return t}parseBody(e){return null==e?null:e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||"string"==typeof e?e:"object"==typeof e?JSON.stringify(e):String(e)}async handleResponse(e,t){switch(t){case"response":return e;case"json":return e.json();case"html":return this.parseHTML(await e.text());case"blob":return e.blob();case"arrayBuffer":return e.arrayBuffer();default:return e.text()}}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html"),r=document.createDocumentFragment();return Array.from(t.body.childNodes).forEach(e=>r.appendChild(e.cloneNode(!0))),1===r.childNodes.length&&Vi(r.firstChild)?r.firstChild:r}dispatchEvent(e,t,r){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}},Ii(t,"FetchCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const hs=Wi(ds);const fs=Wi((()=>{let e,t,r=[$i({description:"Set values to variables, attributes, or properties",syntax:["set <target> to <value>"],examples:['set myVar to "value"','set @data-theme to "dark"','set my innerHTML to "content"'],sideEffects:["state-mutation","dom-mutation"]}),_i({name:"set",category:"data"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw new Error("set command requires a target");const n=e.args[0],i=n?.name||n?.value,a=await Ma(n,t,r);if(a){const n=await this.extractValue(e,t,r);if(a.property.startsWith("*")){const e=a.property.substring(1);return{type:"style",element:a.element,property:e,value:String(n)}}return{type:"property",element:a.element,property:a.property,value:n}}if("memberExpression"===n?.type){const i=await this.tryParseMemberExpression(n,e,t,r);if(i)return i}let o;if(o="identifier"!==n?.type&&"variable"!==n?.type||"string"!=typeof i?await t.evaluate(n,r):i,function(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;if(Vi(e)||e instanceof Node)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(o)){return{type:"object-literal",properties:o,targets:await this.resolveTargets(e.modifiers.on,t,r)}}if(Ia(o)){const n=Ra(o,r);if(n){const i=await this.extractValue(e,t,r);return{type:"property",element:n.element,property:n.property,value:i}}return this.parseTheXofY(o,e,t,r)}if("string"==typeof o&&la(o)){const n=o.substring(1).trim(),i=await this.extractValue(e,t,r);return{type:"style",element:await this.resolveElement(e.modifiers.on,t,r),property:n,value:String(i)}}if("string"==typeof o&&Qi(o)){const n=o.substring(1).trim(),i=await this.extractValue(e,t,r);return{type:"attribute",element:await this.resolveElement(e.modifiers.on,t,r),name:n,value:i}}if("string"==typeof o){const n=o.match(/^(my|me|its?|your?)\s+(.+)$/i);if(n){const i=Fi(n[1],r),a=await this.extractValue(e,t,r);return{type:"property",element:i,property:n[2],value:a}}}if(Vi(o)){return{type:"property",element:o,property:"textContent",value:await this.extractValue(e,t,r)}}if(Array.isArray(o)&&o.length>0&&Vi(o[0])){const n=await this.extractValue(e,t,r);return{type:"property",element:o[0],property:"textContent",value:n}}if("string"!=typeof o)throw new Error("set command target must be a string or object literal");return{type:"variable",name:o,value:await this.extractValue(e,t,r)}}async execute(e,t){switch(e.type){case"variable":return t.locals.set(e.name,e.value),"result"!==e.name&&"it"!==e.name||Object.assign(t,{[e.name]:e.value}),Object.assign(t,{it:e.value}),{target:e.name,value:e.value,targetType:"variable"};case"attribute":return e.element.setAttribute(e.name,String(e.value)),Object.assign(t,{it:e.value}),{target:`@${e.name}`,value:e.value,targetType:"attribute"};case"property":return ja(e.element,e.property,e.value),Object.assign(t,{it:e.value}),{target:e.element,value:e.value,targetType:"property"};case"style":return ca(e.element,e.property,e.value),Object.assign(t,{it:e.value}),{target:e.element,value:e.value,targetType:"property"};case"object-literal":for(const t of e.targets)for(const[r,n]of Object.entries(e.properties))ja(t,r,n);return Object.assign(t,{it:e.properties}),{target:e.targets[0]||"unknown",value:e.properties,targetType:"property"};default:throw new Error(`Unknown input type: ${e.type}`)}}async tryParseMemberExpression(e,t,r,n){const i=e.object,a=e.property;if(i?.name&&a?.name){const e=i.name.toLowerCase();if(["me","my","it","its","you","your"].includes(e)){const i=Fi(e,n),o=await this.extractValue(t,r,n);return{type:"property",element:i,property:a.name,value:o}}}return null}async extractValue(e,t,r){if(e.modifiers.to)return t.evaluate(e.modifiers.to,r);const n=e.args.findIndex(e=>"identifier"===e.type&&"to"===e.name);if(n>=0&&e.args.length>n+1)return t.evaluate(e.args[n+1],r);if(e.args.length>=2)return t.evaluate(e.args[1],r);throw new Error('set command requires a value (use "to" keyword)')}async resolveElement(e,t,r){if(!e)return Di(void 0,r);return Di(await t.evaluate(e,r),r)}async resolveTargets(e,t,r){if(!e)return Bi(void 0,r);return Bi(await t.evaluate(e,r),r)}async parseTheXofY(e,t,r,n){const i=e.match(/^the\s+(.+?)\s+of\s+(.+)$/i);if(!i)throw new Error('Invalid "the X of Y" syntax');const[,a,o]=i,s=Di(o,n),l=await this.extractValue(t,r,n);return{type:"property",element:s,property:a.trim(),value:l}}validate(e){if(!e||"object"!=typeof e)return!1;const t=e;if(!t.type||"string"!=typeof t.type)return!1;if(!["variable","attribute","property","style","object-literal"].includes(t.type))return!1;switch(t.type){case"variable":return"string"==typeof t.name&&"value"in t;case"attribute":return"string"==typeof t.name&&Vi(t.element)&&"value"in t;case"property":return"string"==typeof t.property&&Vi(t.element)&&"value"in t;case"style":return"string"==typeof t.property&&""!==t.property&&Vi(t.element)&&"string"==typeof t.value;case"object-literal":return null!==t.properties&&"object"==typeof t.properties&&Array.isArray(t.targets)&&t.targets.length>0;default:return!1}}},Ii(t,"SetCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const ys=Wi((()=>{let e,t,r=[$i({description:"Evaluate an expression and store the result in it",syntax:"get <expression>",examples:["get #my-dialog","get <button/>","get me.parentElement"],sideEffects:["context-mutation"]}),_i({name:"get",category:"data"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||0===e.args.length)throw new Error("get command requires an expression argument");const n=e.args[0],i=await t.evaluate(n,r);return i instanceof NodeList&&1===i.length||Array.isArray(i)&&1===i.length?{value:i[0]}:{value:i}}execute(e,t){return t.it=e.value,Object.assign(t,{result:e.value}),{value:e.value}}validate(e){return"object"==typeof e&&null!==e&&"value"in e}},Ii(t,"GetCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());let vs=(()=>{let e,t,r=[$i({description:"Modify a variable or property by a specified amount (default: 1)",syntax:["increment <target> [by <number>]","decrement <target> [by <number>]"],examples:["increment counter","increment counter by 5","decrement counter","decrement counter by 5"],sideEffects:["data-mutation","context-modification"],aliases:["decrement"]}),_i({name:"increment",category:"data"})],n=[];return t=class{async parseInput(e,t,r){const n="decrement"===e.commandName?.toLowerCase()?"decrement":"increment",i=await async function(e,t,r,n){if(!e.args||0===e.args.length)throw new Error(`${n} command requires a target`);const i=e.args[0];let a,o;const s=(l=i)&&"object"==typeof l&&l.type||"unknown";var l;if("identifier"===s)a=i.name,i.scope&&(o=i.scope);else if("literal"===s)a=i.value;else{const e=await t.evaluate(i,r);a=Array.isArray(e)&&e.length>0?e[0]:e}let c=1,u=o;for(let n=1;n<e.args.length;n++){const i=e.args[n];if(i&&"literal"===i.type){const e=i.value;"global"===e?u="global":"number"==typeof e&&(c=e)}else if(i&&"literal"!==i.type){const e=await t.evaluate(i,r);"number"==typeof e&&(c=e)}}return{target:a,amount:c,...u&&{scope:u}}}(e,t,r,n);return{...i,operation:n}}async execute(e,t){const{target:r,property:n,scope:i,amount:a=1,operation:o="increment"}=e,s=Ya(r,n,i,t);let l;if(isNaN(s))l=NaN;else{const e=isFinite(a)?a:1;l="increment"===o?s+e:s-e}return Xa(r,n,i,l,t),Object.assign(t,{it:l}),l}},Ii(t,"NumericModifyCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const gs=Wi(vs),ks=Wi(vs);const ws=Wi((()=>{let e,t,r=[$i({description:"Log values to the console",syntax:"log [<values...>]",examples:['log "Hello World"',"log me.value","log x y z",'log "Result:" result'],sideEffects:["console-output"]}),_i({name:"log",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||0===e.args.length)return{values:[]};return{values:await Promise.all(e.args.map(e=>t.evaluate(e,r)))}}async execute(e,t){const r="undefined"!=typeof window?window.console:console;0===e.values.length?r.log():r.log(...e.values)}validate(e){if("object"!=typeof e||null===e)return!1;return Array.isArray(e.values)}},Ii(t,"LogCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());let bs=(()=>{let e,t,r=[$i({description:"Dispatch events on elements",syntax:["trigger <event> on <target>","trigger <event>(<detail>) on <target>","send <event> to <target>","send <event>(<detail>) to <target>"],examples:["trigger click on #button","trigger customEvent on me","send dataEvent to #target","send myEvent(count: 42) to me"],sideEffects:["event-dispatch"],aliases:["send"]}),_i({name:"trigger",category:"event"})],n=[];return t=class{async parseInput(e,t,r){const n="send"===e.commandName?.toLowerCase()?"send":"trigger",i=n;if(!e.args?.length)throw new Error(`${i} command requires an event name`);const a=e=>e?.type||"unknown",o=e.args[0];let s,l,c;if("functionCall"===a(o))s=o.name,o.args?.length&&(l=await this.parseEventDetail(o.args,t,r));else if("identifier"===a(o)||"keyword"===a(o))s=o.name;else{const e=await t.evaluate(o,r);s="string"==typeof e?e:String(e)}const u=e.modifiers?.on||e.modifiers?.to;if(u)c=await this.resolveTargets([u],t,r,i);else{const n=e.args.findIndex((e,t)=>{if(0===t)return!1;const r=e.name||e.value;return"on"===r||"to"===r});if(-1===n||n>=e.args.length-1){if(!r.me)throw new Error(`${i}: no target specified and context.me is null`);c=[r.me]}else{const a=e.args.slice(n+1),o=a.findIndex(e=>"with"===(e.name||e.value)),s=-1===o?a:a.slice(0,o);c=await this.resolveTargets(s,t,r,i)}}return{eventName:s,detail:l,targets:c,options:await this.parseEventOptions(e.args,t,r),mode:n}}async execute(e,t){const r=es(e.eventName,e.detail,e.options);for(const t of e.targets)t.dispatchEvent(r);t.it=r}async resolveTargets(e,t,r,n){const i=[];for(const n of e){const e=await t.evaluate(n,r);if("window"!==e&&e!==window)if("document"!==e&&e!==document)if("me"===e&&r.me)i.push(r.me);else if("you"===e&&r.you)i.push(r.you);else if("it"===e&&r.it)i.push(r.it);else if(Vi(e))i.push(e);else if(e instanceof NodeList)i.push(...Array.from(e).filter(Vi));else if(Array.isArray(e))i.push(...e.filter(Vi));else{if("string"==typeof e){const t=document.querySelectorAll(e);if(0===t.length)throw new Error(`No elements found: "${e}"`);i.push(...Array.from(t).filter(Vi));continue}if(!e||"object"!=typeof e||!("addEventListener"in e))throw new Error("Invalid target: "+typeof e);i.push(e)}else i.push(document);else i.push(window)}if(!i.length)throw new Error(`${n}: no valid targets`);return i}async parseEventDetail(e,t,r){if(!e?.length)return;if(1===e.length)return await t.evaluate(e[0],r);const n={};for(const i of e){const e=await t.evaluate(i,r);if("object"!=typeof e||null===e||Array.isArray(e)){if("string"==typeof e&&e.includes(":")){const[t,r]=e.split(":",2);n[t.trim()]=ts(r.trim())}}else Object.assign(n,e)}return Object.keys(n).length?n:void 0}async parseEventOptions(e,t,r){const n={bubbles:!0,cancelable:!0,composed:!1},i=e.findIndex(e=>"with"===(e.name||e.value));if(-1===i)return n;for(const a of e.slice(i+1)){const e=await t.evaluate(a,r);if("string"==typeof e){const t=e.toLowerCase();"bubbles"===t?n.bubbles=!0:"nobubbles"===t?n.bubbles=!1:"cancelable"===t?n.cancelable=!0:"nocancelable"===t?n.cancelable=!1:"composed"===t&&(n.composed=!0)}}return n}},Ii(t,"EventDispatchCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const zs=Wi(bs),xs=Wi(bs);const Es=Wi((()=>{let e,t,r=[$i({description:"Navigation functionality including URL navigation, element scrolling, and browser history",syntax:["go back","go to url <url> [in new window]","go to [position] [of] <element>"],examples:["go back",'go to url "https://example.com"',"go to top of #header"],sideEffects:["navigation","scrolling"]}),_i({name:"go",category:"navigation"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||0===e.args.length)return{args:[]};return{args:await Promise.all(e.args.map(e=>t.evaluate(e,r)))}}async execute(e,t){const{args:r}=e;if(0===r.length)throw new Error("Go command requires arguments");if("string"==typeof r[0]&&"back"===r[0].toLowerCase())return await this.goBack(),{result:"back",type:"back"};if(this.isUrlNavigation(r)){return{result:await this.navigateToUrl(r,t),type:"url"}}return{result:await this.scrollToElement(r,t),type:"scroll"}}isUrlNavigation(e){return-1!==e.findIndex(e=>"url"===e)}async goBack(){if("undefined"==typeof window||!window.history)throw new Error("Browser history API not available");window.history.back()}async navigateToUrl(e,t){const r=e.findIndex(e=>"url"===e),n=e[r+1];if(!n)throw new Error('URL is required after "url" keyword');const i="string"==typeof n?n:String(n),a=e.includes("new")&&e.includes("window");if(!this.isValidUrl(i))throw new Error(`Invalid URL: "${i}"`);if(a){if("undefined"!=typeof window&&window.open){const e=window.open(i,"_blank");e?.focus&&e.focus()}}else i.startsWith("#")?"undefined"!=typeof window&&(window.location.hash=i):"undefined"!=typeof window&&(window.location.assign?.(i)??(window.location.href=i));return i}isValidUrl(e){try{return e.startsWith("/")||e.startsWith("#")||new URL(e),!0}catch{return!1}}async scrollToElement(e,t){const r=this.parseScrollPosition(e),n=this.parseScrollTarget(e),i=this.parseScrollOffset(e),a=!e.includes("instantly"),o=this.resolveScrollTarget(n,t);if(!o)throw new Error(`Target element not found: ${n}`);if("undefined"!=typeof window){const e=a?"smooth":"instant",t=this.mapVerticalPosition(r.vertical),n=this.mapHorizontalPosition(r.horizontal);if(0!==i){o.scrollIntoView?.({behavior:e,block:t,inline:n});const{x:a,y:s}=this.calculateScrollPosition(o,r,i);window.scrollTo?.({left:a,top:s,behavior:e})}else o.scrollIntoView?.({behavior:e,block:t,inline:n})}return o}mapVerticalPosition(e){return{top:"start",middle:"center",bottom:"end",nearest:"nearest"}[e]||"start"}mapHorizontalPosition(e){return{left:"start",center:"center",right:"end",nearest:"nearest"}[e]||"nearest"}parseScrollPosition(e){const t={vertical:"top",horizontal:"nearest"},r=["top","middle","bottom"],n=["left","center","right"];let i=!1,a=!1;for(const o of e)"string"==typeof o&&(r.includes(o)?(t.vertical=o,i=!0):n.includes(o)&&(t.horizontal=o,a=!0));return a&&!i&&(t.vertical="nearest"),t}parseScrollTarget(e){const t=e.findIndex(e=>"of"===e);if(-1!==t&&t+1<e.length){let r=e[t+1];return"the"===r&&t+2<e.length&&(r=e[t+2]),r}for(const t of e)if("object"==typeof t&&t&&t.nodeType)return t;const r=["top","middle","bottom","left","center","right","of","the","to","smoothly","instantly"];for(const t of e)if("string"==typeof t&&!r.includes(t)&&(t.startsWith("#")||t.startsWith(".")||t.includes("[")||/^[a-zA-Z][a-zA-Z0-9-]*$/.test(t)))return t;return"body"}parseScrollOffset(e){for(let t=0;t<e.length;t++){const r=e[t];if("string"==typeof r){const e=r.match(/^([+-]?\d+)(px)?$/);if(e)return parseInt(e[1],10)}if(("+"===r||"-"===r)&&t+1<e.length){const n=e[t+1],i="number"==typeof n?n:parseInt(String(n).replace("px",""),10);if(!isNaN(i))return"-"===r?-i:i}}return 0}resolveScrollTarget(e,t){if("object"==typeof e&&e&&e.nodeType)return e;const r="string"==typeof e?e:String(e);if("body"===r&&"undefined"!=typeof document)return document.body;if("html"===r&&"undefined"!=typeof document)return document.documentElement;if("me"===r&&Vi(t.me))return t.me;if("it"===r&&Vi(t.it))return t.it;if("you"===r&&Vi(t.you))return t.you;const n=Ua(r,t);if(Vi(n))return n;if("undefined"!=typeof document)try{const e=document.querySelector(r);if(e)return e}catch{try{const e=document.getElementsByTagName(r);if(e.length>0)return e[0]}catch{}}return null}calculateScrollPosition(e,t,r){if("undefined"==typeof window||!e.getBoundingClientRect)return{x:0,y:0};const n=e.getBoundingClientRect(),i=window.pageXOffset||document.documentElement?.scrollLeft||0,a=window.pageYOffset||document.documentElement?.scrollTop||0,o=window.innerWidth||800,s=window.innerHeight||600;let l=i,c=a;switch(t.horizontal){case"left":l=n.left+i;break;case"center":l=n.left+i+n.width/2-o/2;break;case"right":l=n.right+i-o}switch(t.vertical){case"top":c=n.top+a+r;break;case"middle":c=n.top+a+n.height/2-s/2+r;break;case"bottom":c=n.bottom+a-s+r}return{x:Math.max(0,l),y:Math.max(0,c)}}},Ii(t,"GoCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const Ss=["url","with","title"];async function Ts(e,t,r,n){if(!e||0===e.length)throw new Error(`${n} command requires a URL argument`);const i=[],a=[];for(let n=0;n<e.length;n++){const o=e[n],s=o,l=s?.type||"unknown",c=s?.name;if("identifier"===l&&c&&Ss.includes(c.toLowerCase()))i.push(c.toLowerCase()),a.push(c.toLowerCase());else{const e=await t.evaluate(o,r);i.push(e),"string"==typeof e&&a.push(e.toLowerCase())}}const o=a.findIndex(e=>"url"===e),s=a.findIndex(e=>"with"===e),l=a.findIndex(e=>"title"===e),c=`urlKeywordIndex=${o}, argCount=${i.length}`;let u,p;if(-1!==o&&i.length>o+1)u=String(i[o+1]);else{if(!(i.length>=1))throw new Error(`${n} command: URL is required. Debug: ${c}`);u=String(i[0])}-1!==s&&-1!==l&&l>s&&i.length>l+1&&(p=String(i[l+1]));const m=function(e,t,r){const n=r?` Debug: ${r}`:"";if(null==e)throw new Error(`[HyperFixi] ${t}: URL is required.${n}`);if("string"!=typeof e)throw new Error(`[HyperFixi] ${t}: URL must be a string (got ${typeof e}: ${String(e)}).${n}`);if(""===e.trim())throw new Error(`[HyperFixi] ${t}: URL cannot be empty.${n}`);if("undefined"===e)throw new Error(`[HyperFixi] ${t}: URL evaluated to string 'undefined' - check your expression.${n}`);if("null"===e)throw new Error(`[HyperFixi] ${t}: URL evaluated to string 'null' - check your expression.${n}`);return e}(u,n,c);return{url:m,title:p}}let Cs=(()=>{let e,t,r=[$i({description:"Modify browser history URL without page reload",syntax:["push url <url>","push url <url> with title <title>","replace url <url>","replace url <url> with title <title>"],examples:['push url "/page/2"','push url "/search" with title "Search Results"','replace url "/search?q=test"','replace url "/page" with title "Updated Page"'],sideEffects:["navigation"],aliases:["replace"]}),_i({name:"push",category:"navigation"})],n=[];return t=class{async parseInput(e,t,r){const n=e.commandName?.toLowerCase().includes("replace")?"replace":"push";return{...await Ts(e.args,t,r,`${n} url`),mode:n}}async execute(e,t){const{url:r,title:n,state:i,mode:a}=e;"push"===a?window.history.pushState(i||null,"",r):window.history.replaceState(i||null,"",r),n&&(document.title=n);return ns(window,"push"===a?"pushurl":"replaceurl",{url:r,title:n,state:i}),{url:r,title:n,mode:a}}},Ii(t,"HistoryCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const As=Wi(Cs),Ls=Wi(Cs);function js(e,t){if("boolean"==typeof e)return e;if("function"==typeof e)return!0;if(e instanceof Promise)throw new Error("Condition must be awaited - use await in the condition expression");if("string"==typeof e){if("me"===e)return Boolean(t.me);if("it"===e)return Boolean(t.it);if("you"===e)return Boolean(t.you);const r=Ua(e,t);return void 0!==r?Boolean(r):Boolean(e)}return Boolean(e)}const Ps=Wi((()=>{let e,t,r=[$i({description:"Conditional execution based on boolean expressions",syntax:["if <condition> then <commands>","if <condition> then <commands> else <commands>","unless <condition> <commands>"],examples:["if x > 5 then add .active","if user.isAdmin then show #adminPanel else hide #adminPanel","unless user.isLoggedIn showLoginForm"],sideEffects:["conditional-execution"],aliases:["unless"]}),_i({name:"if",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){const n="unless"===e.commandName?.toLowerCase()?"unless":"if";if(!e.args||0===e.args.length)throw new Error(`${n} command requires a condition to evaluate`);let i,a;if("unless"===n){if(e.args.length<2)throw new Error("unless command requires a condition and at least one command");i=e.args.slice(1)}else if(e.args.length>=2&&e.args[1]?(i=e.args[1],a=e.args.length>=3?e.args[2]:void 0):e.modifiers?.then&&(i=e.modifiers.then,a=e.modifiers.else),!i)throw new Error('if command requires "then" branch with commands');return{mode:n,condition:await t.evaluate(e.args[0],r),thenCommands:i,elseCommands:a}}async execute(e,t){const{mode:r,condition:n,thenCommands:i,elseCommands:a}=e,o=js(n,t);let s,l;return("unless"===r?!o:o)?(s="then",l=await this.executeCommandsOrBlock(i,t),"unless"===r&&Object.assign(t,{it:l})):a&&"if"===r?(s="else",l=await this.executeCommandsOrBlock(a,t)):s="none",{mode:r,conditionResult:o,executedBranch:s,result:l}}async executeCommandsOrBlock(e,t){return"block"===e?.type?this.executeBlock(e,t):Array.isArray(e)?this.executeCommands(e,t):e}async executeBlock(e,t){const r=t.locals.get("_runtimeExecute");if(!r)throw new Error("Runtime execute function not available");let n;if(e.commands?.length)for(const i of e.commands)n=await r(i,t);return n}async executeCommands(e,t){let r;for(const n of e)r=n?.execute?await n.execute(t):"function"==typeof n?await n():n;return r}},Ii(t,"ConditionalCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})()),Ns=Ps,Os=Ps;let Is=(()=>{let e,t,r=[$i({description:"Iteration in hyperscript - for-in, counted, conditional, event-driven, and infinite loops",syntax:["repeat for <var> in <collection> { <commands> }","repeat <count> times { <commands> }","repeat while <condition> { <commands> }","repeat until <condition> { <commands> }","repeat forever { <commands> }"],examples:["repeat for item in items { log item }",'repeat 5 times { log "hello" }'],sideEffects:["iteration","conditional-execution"]}),_i({name:"repeat",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){let n;if(e.modifiers?.index){const i=await t.evaluate(e.modifiers.index,r);"string"==typeof i&&(n=i)}let i=e.modifiers?.block||e.modifiers?.commands;if(!i)for(let t=e.args.length-1;t>=0;t--){const r=e.args[t];if("block"===r?.type&&r.commands){i=r;break}}const a=e.args[0],o="identifier"===a?.type?a.name:null;if("for"===o||e.modifiers?.for){const a=e.args[1],o=a?.value||a?.name,s=e.args[2]?await t.evaluate(e.args[2],r):void 0;if(!o||void 0===s)throw new Error("for loops require variable and collection");return{type:"for",variable:o,collection:Array.isArray(s)?s:[s],indexVariable:n,commands:i}}if("times"===o||e.modifiers?.times){const a=e.args[1],o=a?await t.evaluate(a,r):void 0,s="number"==typeof o?o:parseInt(String(o),10);if(isNaN(s))throw new Error("times loops require a count number");return{type:"times",count:s,indexVariable:n,commands:i}}if("while"===o||e.modifiers?.while){const t=e.args[1]||e.modifiers?.while;if(!t)throw new Error("while loops require a condition");return{type:"while",condition:t,indexVariable:n,commands:i}}if("until"===o&&e.modifiers?.from||"until-event"===o){const a=e.args[1],o=a?.value||a?.name;if(!o)throw new Error("until-event loops require an event name");let s=r.me;if(e.args[2]){const n=await t.evaluate(e.args[2],r);n instanceof EventTarget?s=n:"document"===n&&(s=document)}return{type:"until-event",eventName:o,eventTarget:s,indexVariable:n,commands:i}}if("until"===o||e.modifiers?.until){const t=e.args[1]||e.modifiers?.until;if(!t)throw new Error("until loops require a condition");return{type:"until",condition:t,indexVariable:n,commands:i}}if("forever"===o||e.modifiers?.forever)return{type:"forever",indexVariable:n,commands:i};throw new Error("repeat command requires a loop type (for/times/while/until/forever)")}async execute(e,t){const{type:r,variable:n,collection:i,condition:a,count:o,indexVariable:s,commands:l,eventName:c,eventTarget:u}=e;let p,m;switch(r){case"for":({config:p,iterCtx:m}=function(e,t,r){return{config:{type:"for",shouldContinue:e=>e.index<(e.collection?.length??0),beforeIteration:(e,t)=>{e.item=e.collection?.[e.index],e.itemVariable&&t.locals&&t.locals.set(e.itemVariable,e.item)}},iterCtx:{index:0,collection:e,itemVariable:t,indexVariable:r}}}(i,n,s));break;case"times":({config:p,iterCtx:m}=function(e,t){return{config:{type:"times",shouldContinue:e=>e.index<(e.count??0),beforeIteration:(e,t)=>{Object.assign(t,{it:e.index+1})}},iterCtx:{index:0,count:e,indexVariable:t}}}(o,s));break;case"while":({config:p,iterCtx:m}=function(e,t,r,n){return{config:{type:"while",shouldContinue:()=>t(e,r)},iterCtx:{index:0,conditionExpr:e,indexVariable:n}}}(a,js,t,s));break;case"until":({config:p,iterCtx:m}=function(e,t,r,n){return{config:{type:"until",shouldContinue:()=>!t(e,r)},iterCtx:{index:0,conditionExpr:e,indexVariable:n}}}(a,js,t,s));break;case"until-event":({config:p,iterCtx:m}=function(e,t,r){const n={index:0,eventFired:!1,indexVariable:r};return{config:{type:"until-event",shouldContinue:e=>!e.eventFired,eventSetup:{eventName:e,target:t,onEvent:()=>{n.eventFired=!0}}},iterCtx:n}}(c,u,s));break;case"forever":({config:p,iterCtx:m}=function(e,t=1e4){return{config:{type:"forever",maxIterations:t,shouldContinue:()=>!0},iterCtx:{index:0,indexVariable:e}}}(s));break;default:throw new Error(`Unknown repeat type: ${r}`)}try{const e=await async function(e,t,r,n,i){const a=e.maxIterations??1e4;let o,s=0,l=!1;e.eventSetup&&e.eventSetup.target.addEventListener(e.eventSetup.eventName,e.eventSetup.onEvent,{once:!0});try{for(;s<a&&await e.shouldContinue(n);){e.beforeIteration&&await e.beforeIteration(n,r),n.indexVariable&&r.locals&&r.locals.set(n.indexVariable,s);try{o=await i(t,r)}catch(t){if(t instanceof Error){if(t.message.includes("BREAK")){l=!0;break}if(t.message.includes("CONTINUE")){s++,n.index=s,"until-event"===e.type&&await new Promise(e=>setTimeout(e,0));continue}}throw t}s++,n.index=s,"until-event"===e.type&&await new Promise(e=>setTimeout(e,0))}}finally{e.eventSetup&&!n.eventFired&&e.eventSetup.target.removeEventListener(e.eventSetup.eventName,e.eventSetup.onEvent)}return{iterations:s,lastResult:o,interrupted:l}}(p,l,t,m,this.executeCommands.bind(this));return Object.assign(t,{it:e.lastResult}),{type:r,iterations:e.iterations,completed:!e.interrupted,lastResult:e.lastResult,interrupted:e.interrupted}}catch(e){if(e instanceof Error&&(e.message.includes("BREAK")||e.message.includes("CONTINUE")))return{type:r,iterations:0,completed:!0,interrupted:e.message.includes("BREAK")};throw e}}async executeCommands(e,t){if(e&&"object"==typeof e&&"block"===e.type){const r=e,n=t.locals.get("_runtimeExecute");if(!n)throw new Error("Runtime execute function not available");let i;if(r.commands)for(const e of r.commands)i=await n(e,t);return i}if(Array.isArray(e)){let r;for(const n of e)r="function"==typeof n?await n(t):n&&"function"==typeof n.execute?await n.execute(t):n;return r}return"function"==typeof e?await e(t):e}},Ii(t,"RepeatCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const Rs=Wi(Is);class Ms{async parseInput(e,t,r){return{signalType:this.signalType}}async execute(e,t){const r=new Error(this.errorMessage);throw r[this.errorFlag]=!0,"exit"===this.signalType&&(r.returnValue=void 0,r.timestamp=Date.now()),r}}let qs=(()=>{let e,t,r=[$i({description:"Exit from the current loop (repeat, for, while, until)",syntax:["break"],examples:["break","if found then break","repeat for item in items { if item == target then break }"],sideEffects:["control-flow"]}),_i({name:"break",category:"control-flow"})],n=[],i=Ms;return t=class extends i{constructor(){super(...arguments),this.signalType="break",this.errorMessage="BREAK_LOOP",this.errorFlag="isBreak"}},Ii(t,"BreakCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),Oi(t,n)})(),t})();const _s=Wi(qs);let $s=(()=>{let e,t,r=[$i({description:"Skip to the next iteration of the current loop",syntax:["continue"],examples:["continue","if item.isInvalid then continue","repeat for item in items { if item.skip then continue; process item }"],sideEffects:["control-flow"]}),_i({name:"continue",category:"control-flow"})],n=[],i=Ms;return t=class extends i{constructor(){super(...arguments),this.signalType="continue",this.errorMessage="CONTINUE_LOOP",this.errorFlag="isContinue"}},Ii(t,"ContinueCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),Oi(t,n)})(),t})();const Ws=Wi($s);const Vs=Wi((()=>{let e,t,r=[$i({description:"Stop command execution or prevent event defaults",syntax:["halt","halt the event"],examples:["halt","halt the event","if error then halt",'on click halt the event then log "clicked"'],sideEffects:["control-flow","event-prevention"]}),_i({name:"halt",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){if(e.args&&e.args.length>0){const n=e.args[0],i=e.args.length>1?e.args[1]:null;if("identifier"===n.type&&"the"===n.name&&i&&"identifier"===i.type&&"event"===i.name)return{target:r.event};return{target:await t.evaluate(e.args[0],r)}}return{}}async execute(e,t){let r=e.target;if(("the"===r&&t.event||"object"==typeof r&&null!==r&&"the"===r.target&&t.event)&&(r=t.event),this.isEvent(r)){const e=r;return e.preventDefault(),e.stopPropagation(),{halted:!0,timestamp:Date.now(),eventHalted:!0}}"halted"in t&&(t.halted=!0);const n=new Error("HALT_EXECUTION");throw n.isHalt=!0,n}isEvent(e){return null!==e&&"object"==typeof e&&"preventDefault"in e&&"stopPropagation"in e}},Ii(t,"HaltCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const Ds=Wi((()=>{let e,t,r=[$i({description:"Return a value from a command sequence or function, terminating execution",syntax:["return","return <value>"],examples:["return","return 42","return user.name","if found then return result"],sideEffects:["control-flow","context-mutation"]}),_i({name:"return",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||0===e.args.length)return{value:void 0};return{value:await t.evaluate(e.args[0],r)}}async execute(e,t){const{value:r}=e;"returnValue"in t&&(t.returnValue=r),Object.assign(t,{it:r});const n=new Error("RETURN_VALUE");throw n.isReturn=!0,n.returnValue=r,n}},Ii(t,"ReturnCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());let Bs=(()=>{let e,t,r=[$i({description:"Immediately terminate execution of the current event handler or behavior",syntax:["exit"],examples:["exit","if no draggedItem exit","on click if disabled exit"],sideEffects:["control-flow"]}),_i({name:"exit",category:"control-flow"})],n=[],i=Ms;return t=class extends i{constructor(){super(...arguments),this.signalType="exit",this.errorMessage="EXIT_COMMAND",this.errorFlag="isExit"}},Ii(t,"ExitCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),Oi(t,n)})(),t})();const Hs=Wi(Bs),Fs=new Map;const Us=Wi((()=>{let e,t,r=[$i({description:"Create two-way data binding between variables and DOM elements",syntax:["bind :variable to <element>.<property>","bind :variable from <element>.<property>","bind :variable to <element>.<property> bidirectional"],examples:["bind :username to my.value","bind :count from #display.textContent","bind :message to #input.value bidirectional"],sideEffects:["data-binding","event-listeners","dom-observation"]}),_i({name:"bind",category:"data"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||e.args.length<1)throw new Error("bind command requires a variable name");const n=await t.evaluate(e.args[0],r),i="string"==typeof n&&n.startsWith(":")?n.substring(1):String(n);let a,o="to";e.modifiers?.bidirectional||e.bidirectional?o="bidirectional":e.modifiers?.to||"to"===e.direction?o="to":(e.modifiers?.from||"from"===e.direction)&&(o="from");let s="value";if(e.modifiers?.to||e.modifiers?.from){const n=e.modifiers.to||e.modifiers.from,i=await t.evaluate(n,r);if(Vi(i))a=i;else if("string"==typeof i){const e=i.split(".");e.length>1?(a=e[0],s=e.slice(1).join(".")):a=i}else a=i}else{if(!e.target)throw new Error("bind command requires a target element (to/from)");a=e.target,s=e.property||"value"}const l=await this.resolveElement(a,t,r);if(!l)throw new Error(`Cannot resolve target element: ${a}`);return{variable:i,target:l,property:s,direction:o}}async execute(e,t){const{variable:r,target:n,property:i,direction:a}=e,o=this.createBinding(r,n,i,a,t);return this.dispatchEvent(t,"bind:created",{variable:r,element:n,property:i,direction:a,bindingId:o}),{success:!0,variable:r,element:n,property:i,direction:a,bindingId:o}}createBinding(e,t,r,n,i){const a=`bind-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,o=[];if("to"===n||"bidirectional"===n){const a=()=>{const n=La(t,r);i.locals.set(e,n);const a=new CustomEvent(`variable:${e}:change`,{detail:{value:n,source:"variable",originElement:t},bubbles:!0});t.dispatchEvent(a)},s=this.getEventTypeForProperty(r);t.addEventListener(s,a),o.push(()=>t.removeEventListener(s,a)),"to"===n&&a()}if("from"===n||"bidirectional"===n){const n=n=>{const a=n,o=a.detail?.value??i.locals.get(e),s=a.detail?.originElement;s&&s===t||ja(t,r,o)};if(t.addEventListener(`variable:${e}:change`,n),o.push(()=>t.removeEventListener(`variable:${e}:change`,n)),r.startsWith("@")||"textContent"===r||"innerHTML"===r){const n=new MutationObserver(()=>{const n=i.locals.get(e);ja(t,r,n)});n.observe(t,{attributes:!0,childList:!0,characterData:!0}),o.push(()=>n.disconnect())}const a=i.locals.get(e);void 0!==a&&ja(t,r,a)}return Fs.set(a,{id:a,variable:e,element:t,property:r,direction:n,cleanup:()=>o.forEach(e=>e())}),a}async resolveElement(e,t,r){if(Vi(e))return e;if(e&&"object"==typeof e&&e.type&&(e=await t.evaluate(e,r)),"string"==typeof e){if(["me","my","it","its","you","your"].includes(e.toLowerCase()))try{return Fi(e,r)}catch{return null}if("undefined"!=typeof document)try{return document.querySelector(e)}catch{return null}}return null}getEventTypeForProperty(e){return{value:"input",checked:"change",textContent:"input",innerHTML:"input"}[e]||"change"}dispatchEvent(e,t,r){if(Vi(e.me)){const n=new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!1});e.me.dispatchEvent(n)}}},Ii(t,"BindCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());let Ks=(()=>{let e,t,r=[$i({description:"Evaluate an expression and store the result in the it variable",syntax:["call <expression>","get <expression>"],examples:["call myFunction()","get user.name",'call fetch("/api/data")'],sideEffects:["function-execution","context-mutation"]}),_i({name:"call",category:"execution"})],n=[];return t=class{parseInput(e,t,r){if(!e.args?.length)throw new Error("call command requires an expression");return Promise.resolve({expression:e.args[0],alias:e.alias||"call"})}async execute(e,t){const{expression:r}=e,n=t.locals?.get("__evaluator");if(!n)throw new Error("[CALL.execute] No evaluator available in context");const i=await n.evaluate(r,t);let a,o,s=!1;return"function"==typeof i?(o="function",a=i(),a instanceof Promise&&(s=!0,a=await a)):i instanceof Promise?(o="promise",s=!0,a=await i):(o="value",a=i),Object.assign(t,{it:a,result:a}),{result:a,wasAsync:s,expressionType:o}}},Ii(t,"CallCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();(()=>{let e,t,r=[$i({description:"Alias for call - evaluate an expression and store the result in the it variable",syntax:["get <expression>"],examples:["get user.profile","get document.title"],sideEffects:["function-execution","context-mutation"]}),_i({name:"get",category:"execution"})],n=[],i=Ks;t=class extends i{},Ii(t,"GetCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),Oi(t,n)})()})();const Gs=Wi(Ks);const Ys=Wi((()=>{let e,t,r=[$i({description:"Add content to the end of a string, array, or HTML element",syntax:["append <content>","append <content> to <target>"],examples:['append "Hello"','append "World" to greeting',"append item to myArray",'append "<p>New</p>" to #content'],sideEffects:["data-mutation","dom-mutation"]}),_i({name:"append",category:"content"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw new Error("append requires content");const n=await t.evaluate(e.args[0],r);let i;return e.modifiers?.to?i=await t.evaluate(e.modifiers.to,r):e.target&&(i=e.target),{content:n,target:i}}async execute(e,t){const{content:r,target:n}=e,i=String(r);if(!n)return Object.assign(t,void 0===t.it?{it:i}:{it:String(t.it)+i}),{result:t.it,targetType:"result"};if("string"==typeof n){if(n.startsWith("#")||n.startsWith(".")||n.includes("[")){const e=this.resolveDOMElement(n);return e.innerHTML+=i,{result:e,targetType:"element",target:e}}if("me"===n||"it"===n||"you"===n){const e=this.resolveContextRef(n,t);if(Vi(e))return e.innerHTML+=i,{result:e,targetType:"element",target:e}}const e=Ua(n,t);if(void 0!==e){if(Array.isArray(e))return e.push(r),{result:e,targetType:"array",target:n};const a=(null==e?"":String(e))+i;return Ka(n,a,t),{result:a,targetType:"variable",target:n}}return Ka(n,i,t),{result:i,targetType:"variable",target:n}}if(Array.isArray(n))return n.push(r),{result:n,targetType:"array"};if(Vi(n))return n.innerHTML+=i,{result:n,targetType:"element",target:n};{const e=String(n)+i;return Object.assign(t,{it:e}),{result:e,targetType:"string"}}}resolveDOMElement(e){if("undefined"==typeof document)throw new Error("DOM not available");const t=document.querySelector(e);if(!t)throw new Error(`Element not found: ${e}`);return t}resolveContextRef(e,t){switch(e){case"me":return t.me;case"it":return t.it;case"you":return t.you;default:throw new Error(`Unknown context ref: ${e}`)}}},Ii(t,"AppendCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const Xs=Wi((()=>{let e,t,r=[$i({description:"Animate CSS properties using CSS transitions",syntax:"transition <property> to <value> [over <duration>] [with <timing>]",examples:["transition opacity to 0.5","transition left to 100px over 500ms","transition background-color to red over 1s with ease-in-out"],sideEffects:["style-change","timing"]}),_i({name:"transition",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw new Error("transition requires property and value");let n,i;const a=await t.evaluate(e.args[0],r);if(Vi(a)||"string"==typeof a&&/^[#.]|^(?:me|it|you)$/.test(a)?(i=a,n=String(await t.evaluate(e.args[1],r))):n=String(a),!n)throw new Error("transition requires a CSS property");if(!e.modifiers?.to)throw new Error('transition requires "to <value>"');let o=await t.evaluate(e.modifiers.to,r);void 0===o&&"identifier"===e.modifiers.to.type&&(o=e.modifiers.to.name);const s={property:n,value:o};return void 0!==i&&(s.target=i),e.modifiers?.over&&(s.duration=await t.evaluate(e.modifiers.over,r)),e.modifiers?.with&&(s.timingFunction=String(await t.evaluate(e.modifiers.with,r))),s}async execute(e,t){let{property:r}=e;const{target:n,value:i,duration:a,timingFunction:o}=e;r.startsWith("*")&&(r=r.substring(1)),r=r.replace(/([A-Z])/g,"-$1").toLowerCase();const s=Di(n,t),l=ba(a,300),c=getComputedStyle(s).getPropertyValue(r),u=s.style.transition,p=`${r} ${l}ms ${o||"ease"}`;s.style.transition=u?`${u}, ${p}`:p;let m=String(i),d=!1;if("initial"===m||"inherit"===m||"unset"===m||"revert"===m){const e=s.style.getPropertyValue(r);s.style.removeProperty(r),m=getComputedStyle(s).getPropertyValue(r),e&&s.style.setProperty(r,e),d=!0}s.style.setProperty(r,m);const h=await function(e,t,r){return new Promise(n=>{const i=r=>{r.target===e&&r.propertyName===t&&o({completed:!0,cancelled:!1})},a=r=>{r.target===e&&r.propertyName===t&&o({completed:!1,cancelled:!0})},o=us(()=>{e.removeEventListener("transitionend",i),e.removeEventListener("transitioncancel",a),clearTimeout(s)},n);e.addEventListener("transitionend",i),e.addEventListener("transitioncancel",a);const s=setTimeout(()=>{o({completed:!0,cancelled:!1})},r+50)})}(s,r,l);return s.style.transition=u,d&&s.style.removeProperty(r),Object.assign(t,{it:s}),{element:s,property:r,fromValue:c,toValue:m,duration:l,completed:h.completed}}},Ii(t,"TransitionCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const Zs=Wi((()=>{let e,t,r=[$i({description:"Measure DOM element dimensions, positions, and properties",syntax:["measure","measure <property>","measure <target> <property>"],examples:["measure","measure width","measure #element height","measure x and set dragX"],sideEffects:["data-mutation"]}),_i({name:"measure",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){let n,i,a;if(e.args?.length){const a=e.args[0];if("identifier"===a.type&&a.name){const o=a.name.toLowerCase();if("me"===o||"it"===o||"you"===o){const o=await t.evaluate(a,r);if(Vi(o)&&(n=o,e.args.length>1)){const n=e.args[1];i="identifier"===n.type?n.name:String(await t.evaluate(n,r))}}else i=a.name}else{const o=await t.evaluate(a,r);if(Vi(o)||"string"==typeof o&&/^[#.]/.test(o)){if(n=o,e.args.length>1){const n=e.args[1];i="identifier"===n.type?n.name:String(await t.evaluate(n,r))}}else"string"==typeof o&&(i=o)}}e.modifiers?.set&&(a=String(await t.evaluate(e.modifiers.set,r)));const o={};return void 0!==n&&(o.target=n),void 0!==i&&(o.property=i),void 0!==a&&(o.variable=a),o}async execute(e,t){const r=Di(e.target,t),n=e.property||"width",i=this.getMeasurement(r,n);return e.variable&&t.locals&&t.locals.set(e.variable,i.value),Object.assign(t,{it:i.value}),{result:i.value,wasAsync:!1,element:r,property:n,value:i.value,unit:i.unit,stored:!!e.variable}}getMeasurement(e,t){const r=getComputedStyle(e);if(t.startsWith("*")){const e=r.getPropertyValue(t.substring(1)),n=parseFloat(e);if(!isNaN(n)){const t=e.match(/([a-zA-Z%]+)$/);return{value:n,unit:t?t[1]:""}}return{value:e,unit:""}}const n=t.toLowerCase(),i=e.getBoundingClientRect(),a={width:()=>i.width,height:()=>i.height,top:()=>i.top,left:()=>i.left,right:()=>i.right,bottom:()=>i.bottom,x:()=>e.offsetLeft,y:()=>e.offsetTop,clientwidth:()=>e.clientWidth,"client-width":()=>e.clientWidth,clientheight:()=>e.clientHeight,"client-height":()=>e.clientHeight,offsetwidth:()=>e.offsetWidth,"offset-width":()=>e.offsetWidth,offsetheight:()=>e.offsetHeight,"offset-height":()=>e.offsetHeight,scrollwidth:()=>e.scrollWidth,"scroll-width":()=>e.scrollWidth,scrollheight:()=>e.scrollHeight,"scroll-height":()=>e.scrollHeight,scrolltop:()=>e.scrollTop,"scroll-top":()=>e.scrollTop,scrollleft:()=>e.scrollLeft,"scroll-left":()=>e.scrollLeft,offsettop:()=>e.offsetTop,"offset-top":()=>e.offsetTop,offsetleft:()=>e.offsetLeft,"offset-left":()=>e.offsetLeft};if(a[n])return{value:a[n](),unit:"px"};const o=r.getPropertyValue(t),s=parseFloat(o);if(!isNaN(s)){const e=o.match(/([a-zA-Z%]+)$/);return{value:s,unit:e?e[1]:"px"}}return{value:0,unit:"px"}}},Ii(t,"MeasureCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const Js=Wi((()=>{let e,t,r=[$i({description:"Wait for CSS transitions and animations to complete",syntax:"settle [<target>] [for <timeout>]",examples:["settle","settle #animated-element","settle for 3000"],sideEffects:["timing"]}),_i({name:"settle",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){let n,i;if(e.args&&e.args.length>0){const i=await t.evaluate(e.args[0],r);(Vi(i)||"string"==typeof i&&(i.startsWith("#")||i.startsWith(".")||"me"===i||"it"===i||"you"===i))&&(n=i)}e.modifiers?.for&&(i=await t.evaluate(e.modifiers.for,r));const a={};return void 0!==n&&(a.target=n),void 0!==i&&(a.timeout=i),a}async execute(e,t){const{target:r,timeout:n}=e,i=Di(r,t),a=ba(n,5e3),o=Date.now(),s=getComputedStyle(i),l=xa(s.transitionDuration),c=xa(s.transitionDelay),u=xa(s.animationDuration),p=xa(s.animationDelay),m=Ea(l,c),d=Ea(u,p),h=Math.max(m,d),f=await(y=i,v=h,g=a,v<=0?Promise.resolve({completed:!0,type:"timeout"}):new Promise(e=>{const t=e=>{e.target===y&&n({completed:!0,type:"transition"})},r=e=>{e.target===y&&n({completed:!0,type:"animation"})},n=us(()=>{y.removeEventListener("transitionend",t),y.removeEventListener("animationend",r),clearTimeout(i),clearTimeout(a)},e);y.addEventListener("transitionend",t),y.addEventListener("animationend",r);const i=setTimeout(()=>{n({completed:!0,type:"timeout"})},v+50),a=setTimeout(()=>{n({completed:!1,type:"timeout"})},g)}));var y,v,g;const k=Date.now()-o;return Object.assign(t,{it:i}),{element:i,settled:f.completed,timeout:a,duration:k}}},Ii(t,"SettleCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const Qs=Wi((()=>{let e,t,r=[$i({description:"Save and restore values from browser storage with TTL support",syntax:["persist <value> to <storage> as <key>","restore <key> from <storage>","remove <key> from <storage>"],examples:['persist myValue to local as "username"','persist formData to session as "draft"','restore "username" from local'],sideEffects:["storage","data-mutation"]}),_i({name:"persist",category:"data"})],n=[];return t=class{async parseInput(e,t,r){let n,i,a,o,s="save";if(e.modifiers?.from)s="restore",n=String(await t.evaluate(e.args[0],r)),a=String(await t.evaluate(e.modifiers.from,r));else{if(s="save",i=await t.evaluate(e.args[0],r),e.modifiers?.to&&(a=String(await t.evaluate(e.modifiers.to,r))),!e.modifiers?.as)throw new Error('persist command requires "as <key>" modifier');n=String(await t.evaluate(e.modifiers.as,r)),e.modifiers?.ttl&&(o=Number(await t.evaluate(e.modifiers.ttl,r)))}return{key:n,value:i,storage:a||"local",ttl:o,operation:s}}async execute(e,t){const{key:r,value:n,storage:i="local",ttl:a,operation:o="save"}=e;if(!r||"string"!=typeof r||""===r.trim())throw new Error("persist command requires a valid storage key");const s=this.getStorage(i);if(!s)throw new Error(`Storage not available: ${i}Storage`);switch(o){case"save":return await this.saveValue(r,n,s,i,a,t);case"restore":return await this.restoreValue(r,s,i,t);case"remove":return await this.removeValue(r,s,i,t);default:throw new Error(`Unknown persist operation: ${o}`)}}getStorage(e){if("undefined"==typeof window)return null;try{return"local"===e?window.localStorage:window.sessionStorage}catch(e){return null}}async saveValue(e,t,r,n,i,a){const o=Date.now(),s={value:t,timestamp:o,...void 0!==i&&{ttl:i}};try{const l=JSON.stringify(s);return r.setItem(e,l),this.dispatchEvent(a,"persist:save",{key:e,value:t,storage:n,timestamp:o,ttl:i}),{success:!0,operation:"save",key:e,value:t,storage:n,timestamp:o}}catch(t){throw this.dispatchEvent(a,"persist:error",{key:e,operation:"save",error:t instanceof Error?t.message:"Unknown error"}),new Error(`Failed to persist value: ${t instanceof Error?t.message:"Unknown error"}`)}}async restoreValue(e,t,r,n){try{const i=t.getItem(e);if(null===i)return this.dispatchEvent(n,"persist:notfound",{key:e}),{success:!1,operation:"restore",key:e,value:null,storage:r};const a=JSON.parse(i),{value:o,timestamp:s,ttl:l}=a,c=Date.now();return void 0!==l&&c-s>l?(t.removeItem(e),this.dispatchEvent(n,"persist:expired",{key:e,timestamp:s,ttl:l}),{success:!1,operation:"restore",key:e,value:null,storage:r,expired:!0}):(this.dispatchEvent(n,"persist:restore",{key:e,value:o,storage:r}),Object.assign(n,{it:o}),{success:!0,operation:"restore",key:e,value:o,storage:r,timestamp:s})}catch(t){throw this.dispatchEvent(n,"persist:error",{key:e,operation:"restore",error:t instanceof Error?t.message:"Unknown error"}),new Error(`Failed to restore value: ${t instanceof Error?t.message:"Unknown error"}`)}}async removeValue(e,t,r,n){try{return t.removeItem(e),this.dispatchEvent(n,"persist:remove",{key:e,storage:r}),{success:!0,operation:"remove",key:e,storage:r}}catch(t){throw this.dispatchEvent(n,"persist:error",{key:e,operation:"remove",error:t instanceof Error?t.message:"Unknown error"}),new Error(`Failed to remove value: ${t instanceof Error?t.message:"Unknown error"}`)}}dispatchEvent(e,t,r){if(Vi(e.me)){const n=new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!1});e.me.dispatchEvent(n)}}},Ii(t,"PersistCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const el=Wi((()=>{let e,t,r=[$i({description:"Execute inline JavaScript code with access to hyperscript context",syntax:["js <code> end","js(param1, param2) <code> end"],examples:['js console.log("Hello") end',"js(x, y) return x + y end",'js me.style.color = "red" end'],sideEffects:["code-execution","data-mutation"]}),_i({name:"js",category:"advanced"})],n=[];return t=class{async parseInput(e,t,r){let n,i;if(0===e.args.length)throw new Error("js command requires JavaScript code");const a=e.args[0],o=e.args[1];if(a&&"literal"===a.type&&"string"==typeof a.value)n=a.value;else{if(!a||void 0===a.value)throw new Error("js command requires JavaScript code");n=String(a.value)}o&&"arrayLiteral"===o.type&&Array.isArray(o.elements)&&(i=o.elements.map(e=>"string"==typeof e.value?e.value:String(e.value)).filter(e=>e&&e.length>0));const s={code:n};return i&&i.length>0&&(s.parameters=i),s}async execute(e,t){const{code:r,parameters:n=[]}=e;if(!r.trim())return{result:void 0,executed:!1,codeLength:r.length,parameters:n,preserveArrayResult:!0};try{const e=this.createExecutionContext(t,n),i=new Function(...Object.keys(e),r),a=await i(...Object.values(e));return void 0!==a&&Object.assign(t,{it:a}),{result:a,executed:!0,codeLength:r.length,parameters:n,preserveArrayResult:!0}}catch(e){throw new Error(`JavaScript execution failed: ${e instanceof Error?e.message:"Unknown error"}`)}}createExecutionContext(e,t){return{me:e.me,it:e.it,you:e.you,locals:e.locals,globals:e.globals,variables:e.variables,console:console,document:"undefined"!=typeof document?document:void 0,window:"undefined"!=typeof window?window:void 0,...t.reduce((t,r)=>{let n=e.locals?.get(r);return void 0===n&&(n=e.variables?.get(r)),void 0===n&&(n=e[r]),t[r]=n,t},{})}}},Ii(t,"JsCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const tl=Wi((()=>{let e,t,r=[$i({description:"Execute commands asynchronously without blocking",syntax:["async <command> [<command> ...]"],examples:["async command1 command2","async fetchData processData","async animateIn showContent"],sideEffects:["async-execution"]}),_i({name:"async",category:"advanced"})],n=[];return t=class{async parseInput(e,t,r){if(e.args.length<1)throw new Error("async command requires at least one command to execute");return{commands:e.args}}async execute(e,t){const{commands:r}=e,n=Date.now();try{const e=await this.executeCommandsAsync(t,r),i=Date.now()-n;return e.length>0&&Object.assign(t,{it:e[e.length-1]}),{commandCount:r.length,results:e,executed:!0,duration:i}}catch(e){throw new Error(`Async command execution failed: ${e instanceof Error?e.message:"Unknown error"}`)}}async executeCommandsAsync(e,t){const r=[];for(let n=0;n<t.length;n++){const i=t[n];try{const t=await this.executeCommand(i,e);r.push(t),Object.assign(e,{it:t})}catch(e){const r=this.getCommandName(i);throw new Error(`Command '${r}' (${n+1}/${t.length}) failed: ${e instanceof Error?e.message:"Unknown error"}`)}}return r}async executeCommand(e,t){if("function"==typeof e)return await e(t);if(e&&"object"==typeof e&&"function"==typeof e.execute)return await e.execute(t);throw new Error("Invalid command: must be a function or object with execute method")}getCommandName(e){return"function"==typeof e?e.name||"anonymous function":e&&"object"==typeof e?e.name||"unnamed command":"unknown"}},Ii(t,"AsyncCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const rl=Wi((()=>{let e,t,r=[$i({description:"Set a value only if it doesn't already exist",syntax:["default <expression> to <expression>"],examples:['default myVar to "fallback"','default @data-theme to "light"','default my innerHTML to "No content"'],sideEffects:["data-mutation","dom-mutation"]}),_i({name:"default",category:"data"})],n=[];return t=class{async parseInput(e,t,r){if(e.args.length<1)throw new Error("default command requires a target");const n=await t.evaluate(e.args[0],r);let i;if(e.modifiers?.to)i=await t.evaluate(e.modifiers.to,r);else{if(!(e.args.length>=2))throw new Error('default command requires a value (use "to <value>")');i=await t.evaluate(e.args[1],r)}return{target:n,value:i}}async execute(e,t){const{target:r,value:n}=e;if("string"==typeof r){if(r.startsWith("@"))return this.defaultAttribute(t,r.substring(1),n);const e=r.match(/^(my|its?|your?)\s+(.+)$/);if(e){const[,r,i]=e;return this.defaultElementProperty(t,r,i,n)}return this.defaultVariable(t,r,n)}if(Vi(r))return this.defaultElementValue(t,r,n);throw new Error("Invalid target type: "+typeof r)}defaultVariable(e,t,r){const n=Ua(t,e);return void 0!==n?{target:t,value:r,wasSet:!1,existingValue:n,targetType:"variable"}:(Ka(t,r,e),Object.assign(e,{it:r}),{target:t,value:r,wasSet:!0,targetType:"variable"})}defaultAttribute(e,t,r){if(!e.me)throw new Error("No element context available for attribute default");const n=e.me.getAttribute(t);return null!==n?{target:`@${t}`,value:r,wasSet:!1,existingValue:n,targetType:"attribute"}:(e.me.setAttribute(t,String(r)),Object.assign(e,{it:r}),{target:`@${t}`,value:r,wasSet:!0,targetType:"attribute"})}defaultElementProperty(e,t,r,n){const i=Fi(t,e),a=La(i,r),o=`${t} ${r}`;return Pa(a)?(ja(i,r,n),Object.assign(e,{it:n}),{target:o,value:n,wasSet:!0,targetType:"property"}):{target:o,value:n,wasSet:!1,existingValue:a,targetType:"property"}}defaultElementValue(e,t,r){const n=function(e){return"value"in e?e.value:e.textContent}(t);return Pa(n)?(function(e,t){"value"in e?e.value=String(t):e.textContent=String(t)}(t,r),Object.assign(e,{it:r}),{target:"element",value:r,wasSet:!0,targetType:"element"}):{target:"element",value:r,wasSet:!1,existingValue:n,targetType:"element"}}},Ii(t,"DefaultCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());class nl{constructor(){this.name="pseudo-command"}get metadata(){return nl.metadata}async parseInput(e,t,r){if(1===e.args.length&&"objectLiteral"===e.args[0].type){const n=e.args[0].properties||[];let i,a,o="",s=[];for(const e of n){const n=e.value;switch(e.key?.name||e.key?.value){case"methodName":o=n?.value||String(await t.evaluate(n,r));break;case"methodArgs":"arrayLiteral"===n?.type&&n.elements?s=await Promise.all(n.elements.map(e=>t.evaluate(e,r))):"literal"===n?.type&&Array.isArray(n.value)&&(s=await Promise.all(n.value.map(e=>t.evaluate(e,r))));break;case"preposition":const e=n?.value;e&&"null"!==e&&(i=e);break;case"target":case"targetExpression":a=await t.evaluate(n,r)}}if(!o)throw new Error("pseudo-command requires method name");if(null==a)throw new Error("pseudo-command requires a target expression");return{methodName:o,methodArgs:s,preposition:i,targetExpression:a}}if(e.args.length<2)throw new Error("pseudo-command requires method name and target expression");const n=String(await t.evaluate(e.args[0],r)),i=Array.isArray(e.args[1])?await Promise.all(e.args[1].map(e=>t.evaluate(e,r))):[];let a,o;const s=["from","on","with","into","at","to"];for(const n of s)if(e.modifiers?.[n]){o=n,a=await t.evaluate(e.modifiers[n],r);break}if(!a&&e.args.length>=3&&(a=await t.evaluate(e.args[2],r)),!a)throw new Error("pseudo-command requires a target expression");return{methodName:n,methodArgs:i,preposition:o,targetExpression:a}}async execute(e,t){const{methodName:r,methodArgs:n,targetExpression:i}=e;try{const e=await this.resolveTarget(i,t);if(null==e)throw new Error(`Target expression resolved to ${e}`);const a=this.resolveMethod(e,r);if(!a)throw new Error(`Method "${r}" not found on target object`);if("function"!=typeof a)throw new Error(`"${r}" is not a function (it's a ${typeof a})`);const o=await this.executeMethod(a,e,n);return t.locals.set("result",o),Object.assign(t,{it:o}),{result:o,methodName:r,target:e}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Pseudo-command failed: ${t}`)}}async resolveTarget(e,t){return"object"==typeof e&&null!==e?e:"string"==typeof e?t.locals.has(e)?t.locals.get(e):t.variables?.has(e)?t.variables.get(e):t.globals.has(e)?t.globals.get(e):"me"===e&&t.me?t.me:"it"===e&&t.it?t.it:"document"===e?"undefined"!=typeof document?document:null:"window"===e?"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:null:this.resolvePropertyPath(e,t):e}resolvePropertyPath(e,t){const r=e.split(".");let n="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:null;t.locals.has(r[0])?(n=t.locals.get(r[0]),r.shift()):t.variables?.has(r[0])?(n=t.variables.get(r[0]),r.shift()):t.globals.has(r[0])&&(n=t.globals.get(r[0]),r.shift());for(const e of r){if(null==n)return null;n=n[e]}return n}resolveMethod(e,t){if(!e)return null;if(t in e)return e[t];const r=t.split(".");let n=e;for(let e=0;e<r.length;e++){const t=r[e];if(null==n)return null;if(!(t in n))return null;if(n=n[t],e===r.length-1&&"function"==typeof n)return n}return null}async executeMethod(e,t,r){try{const n=e.apply(t,r);return n&&"object"==typeof n&&"then"in n?await n:n}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Method execution failed: ${t}`)}}}nl.metadata={description:"Treat a method on an object as a top-level command",syntax:["<method>(<args>) [(to|on|with|into|from|at)] <expression>"],examples:['getElementById("d1") from the document',"reload() the location of the window",'setAttribute("foo", "bar") on me',"foo() on me"],category:"execution",sideEffects:["method-execution"]};const il=Wi((()=>{let e,t,r=[$i({description:"Execute commands in the context of target elements",syntax:["tell <target> <command> [<command> ...]"],examples:["tell #sidebar hide","tell .buttons add .disabled","tell closest <form/> submit"],sideEffects:["context-switching","command-execution"]}),_i({name:"tell",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){if(e.args.length<2)throw new Error("tell command requires a target and at least one command");return{target:await t.evaluate(e.args[0],r),commands:e.args.slice(1)}}async execute(e,t){const{target:r,commands:n}=e,i=Bi(r,t);if(0===i.length)throw new Error("tell command found no target elements");const a=t.locals.get("_runtimeExecute"),o=[];for(const e of i){const r={...t,me:e,you:e};for(const e of n)try{const t=await this.executeCommand(e,r,a);o.push(t),Object.assign(r,{it:t})}catch(e){throw new Error(`Command execution failed in tell block: ${e instanceof Error?e.message:"Unknown error"}`)}}return{targetElements:i,commandResults:o,executionCount:i.length*n.length}}async executeCommand(e,t,r){if(e&&"object"==typeof e&&"command"===e.type&&r)return await r(e,t);if("function"==typeof e)return await e(t);if(e&&"object"==typeof e&&"function"==typeof e.execute)return await e.execute(t);throw new Error("Invalid command: must be a function or object with execute method")}},Ii(t,"TellCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());let al=(()=>{let e,t,r=[$i({description:"Copy text or element content to the clipboard",syntax:["copy <source>","copy <source> to clipboard"],examples:['copy "Hello World"',"copy #code-snippet","copy my textContent"],sideEffects:["clipboard-write","custom-events"]}),_i({name:"copy",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){if(e.args.length<1)throw new Error("copy command requires a source (text or element)");const n=await t.evaluate(e.args[0],r);let i="text";if(e.modifiers?.format){const n=await t.evaluate(e.modifiers.format,r);"html"!==n&&"text"!==n||(i=n)}return{source:n,format:i}}async execute(e,t){const{source:r,format:n="text"}=e,i=this.extractText(r,n,t);if("undefined"!=typeof navigator&&navigator.clipboard)try{return await navigator.clipboard.writeText(i),this.dispatchCopyEvent(t,"copy:success",{text:i,method:"clipboard-api"}),{success:!0,text:i,format:n,method:"clipboard-api"}}catch{}try{if(this.copyUsingExecCommand(i))return this.dispatchCopyEvent(t,"copy:success",{text:i,method:"execCommand"}),{success:!0,text:i,format:n,method:"execCommand"}}catch{}return this.dispatchCopyEvent(t,"copy:error",{text:i,error:"All copy methods failed"}),{success:!1,text:i,format:n,method:"fallback"}}extractText(e,t,r){if("string"==typeof e)return e;if(Vi(e))return"html"===t?e.outerHTML:e.textContent||"";if(e===r.me&&Vi(r.me)){const e=r.me;return"html"===t?e.outerHTML:e.textContent||""}return String(e)}copyUsingExecCommand(e){if("undefined"==typeof document)return!1;const t=document.createElement("textarea");t.value=e,t.style.cssText="position:fixed;top:0;left:-9999px",t.setAttribute("readonly",""),document.body.appendChild(t);try{t.select(),t.setSelectionRange(0,e.length);const r=document.execCommand("copy");return document.body.removeChild(t),r}catch{return t.parentNode?.removeChild(t),!1}}dispatchCopyEvent(e,t,r){if(Vi(e.me)){const n=new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!1});e.me.dispatchEvent(n)}}},Ii(t,"CopyCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const ol=Wi(al);const sl=Wi((()=>{let e,t,r=[$i({description:"Select a random element from a collection",syntax:["pick <item1>, <item2>, ...","pick from <array>"],examples:['pick "red", "green", "blue"',"pick from colors","pick 1, 2, 3, 4, 5"],sideEffects:["random-selection"]}),_i({name:"pick",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){if(e.modifiers?.from){const n=await t.evaluate(e.modifiers.from,r);if(!Array.isArray(n))throw new Error("pick from requires an array");if(0===n.length)throw new Error("Cannot pick from empty array");return{array:n}}if(0===e.args.length)throw new Error("pick command requires items to choose from");return{items:await Promise.all(e.args.map(e=>t.evaluate(e,r)))}}async execute(e,t){const{items:r,array:n}=e,i=r||n,a=r?"items":"array",o=Math.floor(Math.random()*i.length),s=i[o];return Object.assign(t,{it:s}),{selectedItem:s,selectedIndex:o,sourceLength:i.length,sourceType:a}}},Ii(t,"PickCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());const ll=Wi((()=>{let e,t,r=[$i({description:"Throw an error with a specified message",syntax:["throw <message>"],examples:['throw "Invalid input"','if not valid then throw "Validation failed"'],sideEffects:["error-throwing","execution-termination"]}),_i({name:"throw",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){if(e.args.length<1)throw new Error("throw command requires a message or error object");return{message:await t.evaluate(e.args[0],r)}}async execute(e,t){const{message:r}=e;let n;throw n=r instanceof Error?r:"string"==typeof r?new Error(r):new Error(String(r)),n}},Ii(t,"ThrowCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})());let cl=(()=>{let e,t,r=[$i({description:"Debug output for expressions with type information",syntax:["beep!","beep! <expression>","beep! <expression>, <expression>, ..."],examples:["beep!","beep! myValue","beep! me.id, me.className"],sideEffects:["console-output","debugging"]}),_i({name:"beep",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){if(0===e.args.length)return{expressions:[]};return{expressions:await Promise.all(e.args.map(e=>t.evaluate(e,r)))}}async execute(e,t){const r=e.expressions||[];if(0===r.length)return this.debugContext(t),{expressionCount:0,debugged:!0,outputs:[]};const n=[];for(const e of r){const t=this.debugExpression(e);n.push(t)}return{expressionCount:r.length,debugged:!0,outputs:n}}debugContext(e){}debugExpression(e){return{value:e,type:this.getType(e),representation:this.getRepresentation(e)}}getType(e){return null===e?"null":void 0===e?"undefined":Array.isArray(e)?"array":Vi(e)?"HTMLElement":e instanceof Element?"Element":e instanceof Node?"Node":e instanceof Error?"Error":e instanceof Date?"Date":e instanceof RegExp?"RegExp":typeof e}getRepresentation(e){if(null===e)return"null";if(void 0===e)return"undefined";if(Array.isArray(e))return`Array(${e.length}) [${e.slice(0,3).map(e=>this.getRepresentation(e)).join(", ")}${e.length>3?"...":""}]`;if(Vi(e)){const t=e;return`<${t.tagName.toLowerCase()}${t.id?`#${t.id}`:""}${t.className?`.${t.className.split(" ").join(".")}`:""}/>`}if(e instanceof Error)return`Error: ${e.message}`;if("string"==typeof e)return e.length>50?`"${e.substring(0,47)}..."`:`"${e}"`;if("object"==typeof e)try{const t=Object.keys(e);return`Object {${t.slice(0,3).join(", ")}${t.length>3?"...":""}}`}catch{return"[Object]"}return String(e)}},Ii(t,"BeepCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const ul=Wi(cl);class pl{constructor(){this.name="install"}get metadata(){return pl.metadata}async parseInput(e,t,r){if(e.args.length<1)throw new Error("install command requires a behavior name");const n=e.args[0];let i,a,o;if(i="identifier"===n?.type&&"string"==typeof n.name?n.name:String(await t.evaluate(n,r)),!/^[A-Z][a-zA-Z0-9_]*$/.test(i))throw new Error(`Behavior name must be PascalCase (start with uppercase): "${i}"`);if(e.args.length>=2){const n=await t.evaluate(e.args[1],r);if(n&&"object"==typeof n&&!Array.isArray(n)){a=n;for(const e of Object.keys(a))if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e))throw new Error(`Invalid parameter name: "${e}"`)}}return e.modifiers?.on&&(o=await t.evaluate(e.modifiers.on,r)),{behaviorName:i,parameters:a,target:o}}async execute(e,t){const{behaviorName:r,parameters:n={},target:i}=e;try{const e=this.resolveTarget(i,t);if(0===e.length)throw new Error("No target elements found to install behavior on");if(!this.behaviorExists(r,t))throw new Error(`Behavior "${r}" is not defined. Define it using the 'behavior' keyword before installing.`);const a=[];for(const i of e){const e=await this.installBehavior(r,i,n,t);a.push(e)}return{success:!0,behaviorName:r,installedCount:a.length,instances:a}}catch(e){throw new Error(`Failed to install behavior "${r}": ${e instanceof Error?e.message:String(e)}`)}}resolveTarget(e,t){if(null==e){const e=t.me||t.locals.get("me");if(Vi(e))return[e];throw new Error('No target specified and "me" is not available in context')}if(Vi(e))return[e];if(Array.isArray(e)){const t=e.filter(e=>Vi(e));if(0===t.length)throw new Error("Target array contains no valid HTMLElements");return t}if("string"==typeof e){if("me"===e){const e=t.me||t.locals.get("me");if(Vi(e))return[e];throw new Error('"me" is not available in context')}if("undefined"!=typeof document){const t=document.querySelectorAll(e),r=Array.from(t).filter(e=>Vi(e));if(0===r.length)throw new Error(`No elements found matching selector: "${e}"`);return r}throw new Error("document is not available (not in browser environment)")}if(e&&"object"==typeof e&&"length"in e){const t=Array.from(e).filter(e=>Vi(e));if(0===t.length)throw new Error("Target collection contains no valid HTMLElements");return t}if("object"==typeof e&&"element"in e){const t=e.element;if(Vi(t))return[t]}throw new Error(`Cannot resolve target to HTMLElement(s): ${String(e)}`)}behaviorExists(e,t){const r=t.locals.get("_behaviors");if(r&&"object"==typeof r){return r.has(e)}if("undefined"!=typeof globalThis){const t=globalThis._hyperscript;if(t?.behaviors)return t.behaviors.has(e)}return!1}async installBehavior(e,t,r,n){const i=n.locals.get("_behaviors");if(i&&"object"==typeof i){const n=i;if(n.install&&"function"==typeof n.install)return await n.install(e,t,r)}if("undefined"!=typeof globalThis){const n=globalThis._hyperscript;if(n?.behaviors?.install)return await n.behaviors.install(e,t,r)}throw new Error("Behavior system not available in context")}}pl.metadata={description:"Install a behavior on an element with optional parameters",syntax:["install <BehaviorName>","install <BehaviorName> on <element>","install <BehaviorName>(param: value)","install <BehaviorName>(param: value) on <element>"],examples:["install Removable","install Draggable on #box",'install Tooltip(text: "Help", position: "top")','install Sortable(axis: "y") on .list',"install MyBehavior(foo: 42) on the first <div/>"],category:"behaviors",sideEffects:["behavior-installation","element-modification"]};let ml=(()=>{let e,t,r=[$i({description:"Move classes, attributes, and properties from one element to another",syntax:["take <property> from <source>","take <property> from <source> and put it on <target>"],examples:["take class from <#source/>","take @data-value from <.source/> and put it on <#target/>"],sideEffects:["dom-mutation","property-transfer"]}),_i({name:"take",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){if(e.args.length<3)throw new Error('take requires property, "from", and source');const n=String(await t.evaluate(e.args[0],r));if("from"!==await t.evaluate(e.args[1],r))throw new Error("take syntax: take <property> from <source>");const i=await t.evaluate(e.args[2],r);let a;if(e.args.length>=8){const n=await Promise.all([3,4,5,6].map(n=>t.evaluate(e.args[n],r)));"and"===n[0]&&"put"===n[1]&&"it"===n[2]&&"on"===n[3]&&e.args[7]&&(a=await t.evaluate(e.args[7],r))}else e.args.length>3&&(a=await t.evaluate(e.args[3],r));return!a&&e.modifiers?.on&&(a=await t.evaluate(e.modifiers.on,r)),{property:n,source:i,target:a}}async execute(e,t){const r=Di(e.source,t),n=Di(e.target?e.target:void 0,t),i=this.takeProperty(r,e.property);return this.putProperty(n,e.property,i),{targetElement:n,property:e.property,value:i}}takeProperty(e,t){const r=t.trim(),n=r.toLowerCase();if("class"===n||"classes"===n){const t=Array.from(e.classList);return e.className="",t}if(r.startsWith(".")){const t=r.substring(1);return e.classList.contains(t)?(e.classList.remove(t),t):null}if(r.startsWith("@")){const t=r.substring(1),n=e.getAttribute(t);return e.removeAttribute(t),n}if(r.startsWith("data-")){const t=e.getAttribute(r);return e.removeAttribute(r),t}if("id"===n){const t=e.id;return e.id="",t}if("title"===n){const t=e.title;return e.title="",t}if("value"===n&&"value"in e){const t=e.value;return e.value="",t}const i=r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());if(r.includes("-")||i in e.style||r in e.style){let t;return i in e.style?(t=e.style[i],e.style[i]=""):r in e.style?(t=e.style[r],e.style[r]=""):(t=e.style.getPropertyValue(r),e.style.removeProperty(r)),t}const a=e.getAttribute(t);return null!==a?(e.removeAttribute(t),a):null}putProperty(e,t,r){if(null==r)return;const n=t.trim(),i=n.toLowerCase();if("class"===i||"classes"===i)return void(Array.isArray(r)?r.forEach(t=>t&&"string"==typeof t&&e.classList.add(t)):"string"==typeof r&&(e.className=r));if(n.startsWith("."))return void(r&&e.classList.add(n.substring(1)));if(n.startsWith("@"))return void e.setAttribute(n.substring(1),String(r));if(n.startsWith("data-"))return void e.setAttribute(n,String(r));if("id"===i)return void(e.id=String(r));if("title"===i)return void(e.title=String(r));if("value"===i&&"value"in e)return void(e.value=String(r));const a=n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());n.includes("-")||a in e.style||n in e.style?a in e.style?e.style[a]=String(r):n in e.style?e.style[n]=String(r):e.style.setProperty(n,String(r)):e.setAttribute(t,String(r))}},Ii(t,"TakeCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;Ni(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),Oi(t,n)})(),t})();const dl=Wi(ml);class hl{constructor(){this.name="render"}get metadata(){return hl.metadata}async parseInput(e,t,r){if(e.args.length<1)throw new Error("render command requires a template");const n=await t.evaluate(e.args[0],r);let i;if(e.args.length>=3){if("with"===await t.evaluate(e.args[1],r)){const n=await t.evaluate(e.args[2],r);n&&"object"==typeof n&&(i=n)}}if(!i&&e.modifiers?.with){const n=await t.evaluate(e.modifiers.with,r);n&&"object"==typeof n&&(i=n)}return{template:n,variables:i}}async execute(e,t){const{template:r,variables:n={}}=e,i=this.extractTemplateContent(r,t),a=this.createTemplateContext(t,n),o=[],s=await this.processTemplate(i,a,o),l=this.createDOMElement(s);return Object.assign(t,{it:l}),{element:l,rendered:s,directivesProcessed:o}}extractTemplateContent(e,t){if(e instanceof HTMLTemplateElement)return e.innerHTML;if("string"==typeof e){let r=e;if(!r.includes("<")&&!r.includes("$")){const e=this.resolveVariable(r,t);if(e instanceof HTMLTemplateElement)return e.innerHTML;"string"==typeof e&&(r=e)}const n=r.match(/<template[^>]*>([\s\S]*?)<\/template>/i);return n?n[1]:r}if(e&&"object"==typeof e&&"innerHTML"in e)return e.innerHTML;throw new Error("Invalid template format")}createTemplateContext(e,t){return{...e,locals:new Map([...Array.from(e.locals.entries()),...Object.entries(t)])}}async processTemplate(e,t,r){const n=e.split("\n"),i=[];let a=0;for(;a<n.length;){const e=n[a].trim();if(e.startsWith("@repeat ")){const{nextIndex:e,rendered:o}=await this.processRepeatDirective(n,a,t);i.push(o),a=e,r.push("@repeat")}else if(e.startsWith("@if ")){const{nextIndex:e,rendered:o}=await this.processIfDirective(n,a,t,r);i.push(o),a=e,r.push("@if")}else if("@else"===e||"@end"===e)a++;else{const r=this.processVariableInterpolation(e,t);i.push(r),a++}}return i.join("\n")}async processRepeatDirective(e,t,r){const n=e[t].trim(),i=n.match(/^@repeat\s+in\s+(.+)$/);if(!i)throw new Error(`Invalid @repeat syntax: ${n}`);const a=this.evaluateExpression(i[1],r),{endIndex:o,blockContent:s}=this.extractDirectiveBlock(e,t+1),l=[];if(Array.isArray(a))for(const e of a){const t={...r,locals:new Map([...r.locals.entries(),["it",e]])},n=await this.processTemplate(s.join("\n"),t,[]);l.push(n)}return{nextIndex:o+1,rendered:l.join("\n")}}async processIfDirective(e,t,r,n){const i=e[t].trim(),a=i.match(/^@if\s+(.+)$/);if(!a)throw new Error(`Invalid @if syntax: ${i}`);const o=Boolean(this.evaluateExpression(a[1],r)),{endIndex:s,blockContent:l,elseContent:c}=this.extractIfElseBlock(e,t+1);let u="";return o?u=await this.processTemplate(l.join("\n"),r,[]):c.length>0&&(u=await this.processTemplate(c.join("\n"),r,[]),n.push("@else")),{nextIndex:s+1,rendered:u}}extractDirectiveBlock(e,t){const r=[];let n=1,i=t;for(;i<e.length&&n>0;){const t=e[i].trim();t.startsWith("@repeat ")||t.startsWith("@if ")?(n++,r.push(e[i])):"@end"===t?(n--,n>0&&r.push(e[i])):r.push(e[i]),i++}return{endIndex:i-1,blockContent:r}}extractIfElseBlock(e,t){const r=[],n=[];let i=1,a=t,o=!1;for(;a<e.length&&i>0;){const t=e[a].trim();if(t.startsWith("@if "))i++;else{if("@else"===t&&1===i){o=!0,a++;continue}if("@end"===t&&(i--,0===i))break}o?n.push(e[a]):r.push(e[a]),a++}return{endIndex:a,blockContent:r,elseContent:n}}processVariableInterpolation(e,t){return e.replace(/\$\{([^}]+)\}/g,(e,r)=>{try{const e=r.trim();if(e.startsWith("unescaped ")){const r=e.substring(10).trim(),n=this.evaluateExpression(r,t);return String(n||"")}const n=this.evaluateExpression(e,t);return this.escapeHtml(String(n||""))}catch(t){return e}})}evaluateExpression(e,t){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("undefined"===e)return;const r=Number(e);if(!isNaN(r)&&""!==e.trim())return r;if(e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch{}if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);if(e.includes(".")){const r=e.split(".");let n=this.resolveVariable(r[0],t);for(let e=1;e<r.length&&null!=n;e++){if("object"!=typeof n||null===n)return;n=n[r[e]]}return n}return this.resolveVariable(e,t)}resolveVariable(e,t){return t.locals?.has(e)?t.locals.get(e):"me"===e?t.me:"it"===e?t.it:"you"===e?t.you:"result"===e?t.result:t.globals?.has(e)?t.globals.get(e):void 0}escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}createDOMElement(e){if("undefined"==typeof document)return null;const t=document.createElement("div");return t.innerHTML=e,1===t.children.length?t.firstElementChild:t}}hl.metadata={description:"Render templates with @if, @else, and @repeat directives",syntax:["render <template>","render <template> with <variables>","render <template> with (key: value, ...)"],examples:["render myTemplate",'render myTemplate with (name: "Alice")','render "<template>Hello ${name}!</template>" with (name: "World")',"render template with (items: data)"],category:"templates",sideEffects:["dom-creation","template-execution"]};class fl extends Pi{constructor(e={}){const t=e.registry||new Ti;e.registry||(t.register(Xi()),t.register(Ji()),t.register(ya()),t.register(ka()),t.register(Da()),t.register(Ha()),t.register(Za()),t.register(Jo()),t.register(Qo()),t.register(ss()),t.register(ms()),t.register(hs()),t.register(fs()),t.register(ys()),t.register(gs()),t.register(ks()),t.register(ws()),t.register(zs()),t.register(xs()),t.register(Es()),t.register(As()),t.register(Ls()),t.register(Ns()),t.register(Rs()),t.register(_s()),t.register(Ws()),t.register(Vs()),t.register(Ds()),t.register(Hs()),t.register(Us()),t.register(Gs()),t.register(Ys()),t.register(Xs()),t.register(Zs()),t.register(Js()),t.register(Qs()),t.register(el()),t.register(tl()),t.register(Os()),t.register(rl()),t.register(new nl),t.register(il()),t.register(ol()),t.register(sl()),t.register(ll()),t.register(ul()),t.register(new pl),t.register(dl()),t.register(new hl));const r={registry:t,expressionEvaluator:new xi};void 0!==e.enableAsyncCommands&&(r.enableAsyncCommands=e.enableAsyncCommands),void 0!==e.commandTimeout&&(r.commandTimeout=e.commandTimeout),void 0!==e.enableErrorReporting&&(r.enableErrorReporting=e.enableErrorReporting),super(r)}getRegistry(){return this.registry}}var yl,vl,gl,kl,wl,bl=Object.defineProperty,zl=Object.getOwnPropertyDescriptor,xl=Object.getOwnPropertyNames,El=Object.prototype.hasOwnProperty,Sl=(e,t)=>function(){return e&&(t=(0,e[xl(e)[0]])(e=0)),t},Tl=(e,t)=>{for(var r in t)bl(e,r,{get:t[r],enumerable:!0})},Cl=e=>((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of xl(t))El.call(e,i)||i===r||bl(e,i,{get:()=>t[i],enumerable:!(n=zl(t,i))||n.enumerable});return e})(bl({},"__esModule",{value:!0}),e);function Al(e,t){const r={...e};for(const n of Object.keys(t)){const i=t[n],a=e[n];void 0!==i&&(r[n]="object"!=typeof i||null===i||Array.isArray(i)||"object"!=typeof a||null===a||Array.isArray(a)?i:Al(a,i))}return r}function Ll(e,t){return Al(e,t)}function jl(e){if(!e.extends)return e;const t=vl.get(e.extends);if(!t)return e;return Ll(jl(t),e)}function Pl(e,t,r){yl.set(e,t),vl.set(e,r),gl.delete(e)}function Nl(e,t){wl.set(e,t),gl.delete(e)}function Ol(e){return e.split("-")[0]}function Il(e){return e.includes("-")}function Rl(e){let t=vl.get(e);return!t&&Il(e)&&(t=vl.get(Ol(e))),t?jl(t):void 0}function Ml(){return Array.from(yl.keys())}function ql(e){if(yl.has(e)&&vl.has(e))return!0;if(Il(e)){const t=Ol(e);return yl.has(t)&&vl.has(t)}return!1}function _l(e,t){return function(e){let t=yl.get(e);if(!t&&Il(e)){const r=Ol(e);t=yl.get(r)}if(!t){const t=Array.from(yl.keys()).join(", ");throw new Error(`Language '${e}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${e}';`)}return t}(t).tokenize(e)}function $l(e){let t=gl.get(e);if(!t&&Il(e)&&(t=gl.get(Ol(e))),t)return t;let r=wl.get(e);if(!r&&Il(e)&&(r=wl.get(Ol(e))),r)return gl.set(e,r),r;if(!kl)throw new Error(`No patterns registered for language '${e}'. Either import the language module or set a pattern generator.`);const n=function(e){let t=vl.get(e);if(!t&&Il(e)){const r=Ol(e);t=vl.get(r)}if(!t){const t=Array.from(vl.keys()).join(", ");throw new Error(`Language profile '${e}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${e}';`)}return jl(t)}(e),i=kl(n);return gl.set(e,i),i}var Wl,Vl,Dl,Bl=Sl({"src/registry.ts"(){yl=new Map,vl=new Map,gl=new Map,kl=null,wl=new Map}});function Hl(e,t){return{start:e,end:t}}function Fl(e,t,r,n){if("string"==typeof n)return{value:e,kind:t,position:r,normalized:n};if(n){const{normalized:i,stem:a,stemConfidence:o}=n,s={value:e,kind:t,position:r};return void 0!==i&&(s.normalized=i),void 0!==a&&(s.stem=a,void 0!==o&&(s.stemConfidence=o)),s}return{value:e,kind:t,position:r}}function Ul(e){return/\s/.test(e)}function Kl(e){return"#"===e||"."===e||"["===e||"@"===e||"*"===e||"<"===e}function Gl(e){return'"'===e||"'"===e||"`"===e||"「"===e||"」"===e}function Yl(e){return/\d/.test(e)}function Xl(e){return/[a-zA-Z0-9_-]/.test(e)}function Zl(e){return t=>{const r=t.charCodeAt(0);return e.some(([e,t])=>r>=e&&r<=t)}}function Jl(...e){return t=>e.some(e=>e(t))}function Ql(e){const t=t=>e.test(t);return{isLetter:t,isIdentifierChar:e=>t(e)||/[0-9_-]/.test(e)}}function ec(e,t){if(t>=e.length||"'"!==e[t])return!1;if(t+1>=e.length)return!1;if("s"!==e[t+1].toLowerCase())return!1;if(t+2>=e.length)return!0;const r=e[t+2];return Ul(r)||"*"===r||!Xl(r)}function tc(e,t){if(t>=e.length)return!1;const r=e[t],n=e[t+1]||"",i=e[t+2]||"";if("/"===r&&"/"!==n&&/[a-zA-Z0-9._-]/.test(n))return!0;if("/"===r&&"/"===n&&/[a-zA-Z]/.test(i))return!0;if("."===r&&("/"===n||"."===n&&"/"===i))return!0;const a=e.slice(t,t+8).toLowerCase();return!(!a.startsWith("http://")&&!a.startsWith("https://"))}var rc=Sl({"src/tokenizers/base.ts"(){Wl=class{constructor(e,t){this.pos=0,this.tokens=e,this.language=t}peek(e=0){const t=this.pos+e;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(e){this.pos=e.position}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(e){const t=[];for(;!this.isAtEnd()&&e(this.peek());)t.push(this.advance());return t}skipWhile(e){for(;!this.isAtEnd()&&e(this.peek());)this.advance()}},Vl=class e{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map}initializeKeywordsFromProfile(e,t=[]){const r=new Map;if(e.keywords)for(const[t,n]of Object.entries(e.keywords))if(r.set(n.primary,{native:n.primary,normalized:n.normalized||t}),n.alternatives)for(const e of n.alternatives)r.set(e,{native:e,normalized:n.normalized||t});if(e.references)for(const[t,n]of Object.entries(e.references))r.set(n,{native:n,normalized:t});if(e.roleMarkers)for(const[t,n]of Object.entries(e.roleMarkers))if(n.primary&&r.set(n.primary,{native:n.primary,normalized:t}),n.alternatives)for(const e of n.alternatives)r.set(e,{native:e,normalized:t});for(const e of t)r.set(e.native,e);this.profileKeywords=Array.from(r.values()).sort((e,t)=>t.native.length-e.native.length),this.profileKeywordMap=new Map;for(const e of this.profileKeywords){this.profileKeywordMap.set(e.native.toLowerCase(),e);const t=this.removeDiacritics(e.native);t===e.native||this.profileKeywordMap.has(t.toLowerCase())||this.profileKeywordMap.set(t.toLowerCase(),e)}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(const r of this.profileKeywords)if(e.slice(t).startsWith(r.native))return Fl(r.native,"keyword",Hl(t,t+r.native.length),r.normalized);return null}isKeywordStart(e,t){const r=e.slice(t);return this.profileKeywords.some(e=>r.startsWith(e.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;const t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,r){const n=this.tryNormalize(e);if(!n)return null;const i=this.lookupKeyword(n.stem);if(!i)return null;const a={normalized:i.normalized,stem:n.stem,stemConfidence:n.confidence};return Fl(e,"keyword",Hl(t,r),a)}trySelector(e,t){const r=function(e,t){if(t>=e.length)return null;const r=e[t];if(!Kl(r))return null;let n=t,i="";if("#"===r||"."===r){for(i+=e[n++];n<e.length&&Xl(e[n]);)i+=e[n++];if(i.length<=1)return null;if(n<e.length&&"."===e[n]&&"#"===r){let t=n+1;for(;t<e.length&&Xl(e[t]);)t++;if(t<e.length&&"("===e[t])return i}}else if("["===r){let t=1,r=!1,a=null,o=!1;for(i+=e[n++];n<e.length&&t>0;){const s=e[n];i+=s,o?o=!1:"\\"===s?o=!0:r?s===a&&(r=!1,a=null):'"'===s||"'"===s||"`"===s?(r=!0,a=s):"["===s?t++:"]"===s&&t--,n++}if(0!==t)return null}else if("@"===r){for(i+=e[n++];n<e.length&&Xl(e[n]);)i+=e[n++];if(i.length<=1)return null}else if("*"===r){for(i+=e[n++];n<e.length&&Xl(e[n]);)i+=e[n++];if(i.length<=1)return null}else if("<"===r){if(i+=e[n++],n>=e.length||!function(e){return/[a-zA-Z]/.test(e)}(e[n]))return null;for(;n<e.length&&Xl(e[n]);)i+=e[n++];for(;n<e.length;){const t=e[n];if("."===t){if(i+=e[n++],n>=e.length||!Xl(e[n]))return null;for(;n<e.length&&Xl(e[n]);)i+=e[n++]}else if("#"===t){if(i+=e[n++],n>=e.length||!Xl(e[n]))return null;for(;n<e.length&&Xl(e[n]);)i+=e[n++]}else{if("["!==t)break;{let t=1,r=!1,a=null,o=!1;for(i+=e[n++];n<e.length&&t>0;){const s=e[n];i+=s,o?o=!1:"\\"===s?o=!0:r?s===a&&(r=!1,a=null):'"'===s||"'"===s||"`"===s?(r=!0,a=s):"["===s?t++:"]"===s&&t--,n++}if(0!==t)return null}}}for(;n<e.length&&Ul(e[n]);)i+=e[n++];if(n<e.length&&"/"===e[n])for(i+=e[n++];n<e.length&&Ul(e[n]);)i+=e[n++];if(n>=e.length||">"!==e[n])return null;i+=e[n++]}return i||null}(e,t);return r?Fl(r,"selector",Hl(t,t+r.length)):null}tryEventModifier(e,t){if("."!==e[t])return null;const r=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;const n=r[0].replace(/(\s|\.)$/,""),i=n.slice(1).split("(")[0],a=r[1];return{...Fl(n,"event-modifier",Hl(t,t+n.length)),metadata:{modifierName:i,value:a?"queue"===i?a:parseInt(a,10):void 0}}}tryString(e,t){const r=function(e,t){if(t>=e.length)return null;const r=e[t];if(!Gl(r))return null;if("'"===r&&ec(e,t))return null;const n={'"':'"',"'":"'","`":"`","「":"」"}[r];if(!n)return null;let i=t+1,a=r,o=!1;for(;i<e.length;){const t=e[i];if(a+=t,o)o=!1;else if("\\"===t)o=!0;else if(t===n)return a;i++}return a}(e,t);return r?Fl(r,"literal",Hl(t,t+r.length)):null}tryNumber(e,t){const r=function(e,t){if(t>=e.length)return null;const r=e[t];if(!Yl(r)&&"-"!==r&&"+"!==r)return null;let n=t,i="";if("-"!==e[n]&&"+"!==e[n]||(i+=e[n++]),n>=e.length||!Yl(e[n]))return null;for(;n<e.length&&Yl(e[n]);)i+=e[n++];if(n<e.length&&"."===e[n])for(i+=e[n++];n<e.length&&Yl(e[n]);)i+=e[n++];n<e.length&&("ms"===e.slice(n,n+2)?i+="ms":"s"!==e[n]&&"m"!==e[n]&&"h"!==e[n]||(i+=e[n]));return i}(e,t);return r?Fl(r,"literal",Hl(t,t+r.length)):null}tryMatchTimeUnit(e,t,r,n=!1){let i=t;if(n)for(;i<e.length&&Ul(e[i]);)i++;const a=e.slice(i);for(const e of r){const t=a.slice(0,e.length);if(e.caseInsensitive?t.toLowerCase()===e.pattern.toLowerCase():t===e.pattern){if(e.notFollowedBy){if((a[e.length]||"")===e.notFollowedBy)continue}if(e.checkBoundary){if(Xl(a[e.length]||""))continue}return{suffix:e.suffix,endPos:i+e.length}}}return null}parseBaseNumber(e,t,r=!0){let n=t,i="";if(!r||"-"!==e[n]&&"+"!==e[n]||(i+=e[n++]),n>=e.length||!Yl(e[n]))return null;for(;n<e.length&&Yl(e[n]);)i+=e[n++];if(n<e.length&&"."===e[n])for(i+=e[n++];n<e.length&&Yl(e[n]);)i+=e[n++];return i&&"-"!==i&&"+"!==i?{number:i,endPos:n}:null}tryNumberWithTimeUnits(t,r,n,i={}){const{allowSign:a=!0,skipWhitespace:o=!1}=i,s=this.parseBaseNumber(t,r,a);if(!s)return null;let{number:l,endPos:c}=s;const u=[...n,...e.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(t,c,u,o);return p&&(l+=p.suffix,c=p.endPos),Fl(l,"literal",Hl(r,c))}tryUrl(e,t){const r=function(e,t){if(!tc(e,t))return null;let r=t,n="";const i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<e.length;){const t=e[r];if("#"===t){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=t,r++;r<e.length&&/[a-zA-Z0-9_-]/.test(e[r]);)n+=e[r++];break}if(!i.test(t))break;n+=t,r++}return n.length<2?null:n}(e,t);return r?Fl(r,"url",Hl(t,t+r.length)):null}tryVariableRef(e,t){if(":"!==e[t])return null;if(t+1>=e.length)return null;if(!Xl(e[t+1]))return null;let r=t+1;for(;r<e.length&&Xl(e[r]);)r++;return Fl(e.slice(t,r),"identifier",Hl(t,r))}tryOperator(e,t){const r=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return Fl(r,"operator",Hl(t,t+2));const n=e[t];return["<",">","!","+","-","*","/","="].includes(n)?Fl(n,"operator",Hl(t,t+1)):["(",")","{","}",",",";",":"].includes(n)?Fl(n,"punctuation",Hl(t,t+1)):null}tryMultiCharParticle(e,t,r){for(const n of r)if(e.slice(t,t+n.length)===n)return Fl(n,"particle",Hl(t,t+n.length));return null}},Vl.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:!0},{pattern:"m",suffix:"m",length:1,checkBoundary:!0,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:!0}],Dl=Vl}});function nc(e){return{stem:e,confidence:1}}function ic(e,t,r){return r?{stem:e,confidence:t,metadata:r}:{stem:e,confidence:t}}var ac,oc,sc,lc,cc,uc=Sl({"src/tokenizers/morphology/types.ts"(){}});function pc(e){const t=e.charCodeAt(0);return t>=1536&&t<=1791||t>=1872&&t<=1919||t>=2208&&t<=2303||t>=64336&&t<=65023||t>=65136&&t<=65279}var mc,dc=Sl({"src/tokenizers/morphology/arabic-normalizer.ts"(){uc(),ac=[{pattern:"وال",confidencePenalty:.15,prefixType:"conjunction"},{pattern:"فال",confidencePenalty:.15,prefixType:"conjunction"},{pattern:"بال",confidencePenalty:.15,prefixType:"preposition"},{pattern:"كال",confidencePenalty:.15,prefixType:"preposition"},{pattern:"لل",confidencePenalty:.12,prefixType:"preposition"}],oc=[{pattern:"ال",confidencePenalty:.08,prefixType:"article",minRemaining:2},{pattern:"و",confidencePenalty:.08,prefixType:"conjunction",minRemaining:3},{pattern:"ف",confidencePenalty:.08,prefixType:"conjunction",minRemaining:3},{pattern:"ب",confidencePenalty:.1,prefixType:"preposition",minRemaining:3},{pattern:"ل",confidencePenalty:.1,prefixType:"preposition",minRemaining:3},{pattern:"ك",confidencePenalty:.1,prefixType:"preposition",minRemaining:3}],sc=[{pattern:"ي",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"ت",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"ن",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"أ",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"ا",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3}],lc=[{pattern:"ون",confidencePenalty:.1,type:"masculine-plural"},{pattern:"ين",confidencePenalty:.1,type:"masculine-plural-accusative"},{pattern:"ات",confidencePenalty:.1,type:"feminine-plural"},{pattern:"ان",confidencePenalty:.1,type:"dual-nominative"},{pattern:"ين",confidencePenalty:.1,type:"dual-accusative"},{pattern:"ها",confidencePenalty:.1,type:"pronoun-her"},{pattern:"هم",confidencePenalty:.1,type:"pronoun-them"},{pattern:"هن",confidencePenalty:.1,type:"pronoun-them-f"},{pattern:"نا",confidencePenalty:.1,type:"pronoun-us"},{pattern:"كم",confidencePenalty:.1,type:"pronoun-you-pl"},{pattern:"ك",confidencePenalty:.08,type:"pronoun-you"},{pattern:"ه",confidencePenalty:.08,type:"pronoun-him"},{pattern:"ي",confidencePenalty:.08,type:"pronoun-me"},{pattern:"ة",confidencePenalty:.08,type:"feminine"}],new(cc=class{constructor(){this.language="ar"}isNormalizable(e){return!!function(e){for(const t of e)if(pc(t))return!0;return!1}(e)&&!(e.length<2)}normalize(e){let t=function(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}(e),r=1;const n=[],i=[];for(const e of ac)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=2){t=i,r-=e.confidencePenalty,n.push(e.pattern);break}}if(0===n.length)for(const e of oc)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??2)){t=i,r-=e.confidencePenalty,n.push(e.pattern);break}}if(!(t.endsWith("ات")||t.endsWith("ة")||t.endsWith("ون")||t.endsWith("ين")||t.endsWith("ها")||t.endsWith("هم")||t.endsWith("هن")||t.endsWith("نا")||t.endsWith("كم"))&&(0===n.length||"و"===n[0]||"ف"===n[0]))for(const e of sc)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??3)){t=i,r-=e.confidencePenalty,n.push(e.pattern);break}}for(const e of lc)if(t.endsWith(e.pattern)){const n=t.slice(0,-e.pattern.length);n.length>=2&&(t=n,r-=e.confidencePenalty,i.push(e.pattern))}return r=Math.max(.5,r),0===n.length&&0===i.length?nc(e):ic(t,r,{removedPrefixes:n,removedSuffixes:i})}})}}),hc={};Tl(hc,{arabicProfile:()=>mc});var fc,yc,vc,gc,kc,wc,bc,zc,xc,Ec=Sl({"src/generators/profiles/arabic.ts"(){mc={code:"ar",name:"Arabic",nativeName:"العربية",direction:"rtl",wordOrder:"VSO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"start",subjectDrop:!0},references:{me:"أنا",it:"هو",you:"أنت",result:"النتيجة",event:"الحدث",target:"الهدف",body:"الجسم"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,specialForms:{me:"لي",it:"له",you:"لك"},keywords:{"لي":"me","لك":"you","له":"it","لها":"it"}},roleMarkers:{destination:{primary:"على",alternatives:["في","إلى","ب"],position:"before"},source:{primary:"من",position:"before"},patient:{primary:"",position:"before"},style:{primary:"بـ",alternatives:["باستخدام"],position:"before"}},keywords:{toggle:{primary:"بدّل",alternatives:["بدل","غيّر","غير"],normalized:"toggle"},add:{primary:"أضف",alternatives:["اضف","زِد"],normalized:"add"},remove:{primary:"احذف",alternatives:["أزل","امسح"],normalized:"remove"},put:{primary:"ضع",alternatives:["اجعل"],normalized:"put"},append:{primary:"ألحق",normalized:"append"},prepend:{primary:"سبق",normalized:"prepend"},take:{primary:"خذ",normalized:"take"},make:{primary:"اصنع",alternatives:["أنشئ"],normalized:"make"},clone:{primary:"استنسخ",alternatives:["انسخ"],normalized:"clone"},swap:{primary:"استبدل",alternatives:["تبادل"],normalized:"swap"},morph:{primary:"حوّل",alternatives:["غيّر"],normalized:"morph"},set:{primary:"اضبط",alternatives:["عيّن","حدد"],normalized:"set"},get:{primary:"احصل",normalized:"get"},increment:{primary:"زِد",alternatives:["زد","ارفع"],normalized:"increment"},decrement:{primary:"أنقص",alternatives:["انقص","قلل"],normalized:"decrement"},log:{primary:"سجل",normalized:"log"},show:{primary:"اظهر",alternatives:["أظهر","اعرض"],normalized:"show"},hide:{primary:"اخف",alternatives:["أخفِ","اخفي","أخف"],normalized:"hide"},transition:{primary:"انتقال",alternatives:["انتقل"],normalized:"transition"},on:{primary:"على",alternatives:["عند","لدى","حين"],normalized:"on"},trigger:{primary:"تشغيل",alternatives:["أطلق","فعّل"],normalized:"trigger"},send:{primary:"أرسل",normalized:"send"},focus:{primary:"تركيز",alternatives:["ركز"],normalized:"focus"},blur:{primary:"ضبابية",alternatives:["شوش"],normalized:"blur"},go:{primary:"اذهب",alternatives:["انتقل"],normalized:"go"},wait:{primary:"انتظر",normalized:"wait"},fetch:{primary:"احضر",alternatives:["جلب"],normalized:"fetch"},settle:{primary:"استقر",normalized:"settle"},if:{primary:"إذا",normalized:"if"},when:{primary:"عندما",normalized:"when"},where:{primary:"أين",normalized:"where"},else:{primary:"وإلا",alternatives:["خلاف ذلك"],normalized:"else"},repeat:{primary:"كرر",normalized:"repeat"},for:{primary:"لكل",normalized:"for"},while:{primary:"بينما",normalized:"while"},continue:{primary:"واصل",normalized:"continue"},halt:{primary:"أوقف",alternatives:["توقف"],normalized:"halt"},throw:{primary:"ارم",alternatives:["ارمِ"],normalized:"throw"},call:{primary:"استدع",alternatives:["نادِ"],normalized:"call"},return:{primary:"ارجع",alternatives:["عُد"],normalized:"return"},then:{primary:"ثم",alternatives:["بعدها","ثمّ"],normalized:"then"},and:{primary:"وأيضاً",alternatives:["أيضاً"],normalized:"and"},end:{primary:"نهاية",alternatives:["انتهى","آخر"],normalized:"end"},js:{primary:"جافاسكربت",alternatives:["js"],normalized:"js"},async:{primary:"متزامن",normalized:"async"},tell:{primary:"أخبر",normalized:"tell"},default:{primary:"افتراضي",normalized:"default"},init:{primary:"تهيئة",alternatives:["بدء"],normalized:"init"},behavior:{primary:"سلوك",normalized:"behavior"},install:{primary:"تثبيت",alternatives:["ثبّت"],normalized:"install"},measure:{primary:"قياس",alternatives:["قِس"],normalized:"measure"},into:{primary:"في",alternatives:["إلى"],normalized:"into"},before:{primary:"قبل",normalized:"before"},after:{primary:"بعد",normalized:"after"},until:{primary:"حتى",normalized:"until"},event:{primary:"حدث",normalized:"event"},from:{primary:"من",normalized:"from"}},tokenization:{prefixes:["ال","و","ف","ب","ك","ل"]},eventHandler:{eventMarker:{primary:"عند",alternatives:["في","لدى","عندما","حين","حينما","لمّا","لما"],position:"before"},temporalMarkers:["عندما","حين","لمّا"],negationMarker:{primary:"عدم",alternatives:["عدم"],position:"before"}}}}}),Sc={};Tl(Sc,{ArabicTokenizer:()=>zc,arabicTokenizer:()=>xc});var Tc,Cc=Sl({"src/tokenizers/arabic.ts"(){rc(),dc(),Ec(),fc=Zl([[1536,1791],[1872,1919],[2208,2303],[64336,65023],[65136,65279]]),yc=new Set(["بـ","لـ","كـ","وـ"]),vc=new Map([["و",{normalized:"and",type:"conjunction"}],["ف",{normalized:"then",type:"conjunction"}],["ب",{normalized:"with",type:"preposition"}],["ل",{normalized:"to",type:"preposition"}],["ك",{normalized:"like",type:"preposition"}],["ول",{normalized:"and-to",type:"conjunction"}],["وب",{normalized:"and-with",type:"conjunction"}],["وك",{normalized:"and-like",type:"conjunction"}],["فل",{normalized:"then-to",type:"conjunction"}],["فب",{normalized:"then-with",type:"conjunction"}],["فك",{normalized:"then-like",type:"conjunction"}]]),gc=new Map([["عندما",{normalized:"on",formality:"formal",confidence:.95,description:"when (formal MSA)"}],["حينما",{normalized:"on",formality:"formal",confidence:.93,description:"when/whenever (formal)"}],["عند",{normalized:"on",formality:"neutral",confidence:.88,description:"at/when (neutral)"}],["حين",{normalized:"on",formality:"neutral",confidence:.85,description:"when/time (neutral)"}],["لمّا",{normalized:"on",formality:"dialectal",confidence:.7,description:"when (dialectal, with shadda)"}],["لما",{normalized:"on",formality:"dialectal",confidence:.68,description:"when (dialectal, no diacritic)"}],["لدى",{normalized:"on",formality:"neutral",confidence:.82,description:"at/with (temporal)"}]]),kc=new Set(["في","على","من","إلى","الى","مع","عن","قبل","بعد","بين"]),wc=[{native:"صحيح",normalized:"true"},{native:"خطأ",normalized:"false"},{native:"null",normalized:"null"},{native:"فارغ",normalized:"null"},{native:"غير معرف",normalized:"undefined"},{native:"الأول",normalized:"first"},{native:"أول",normalized:"first"},{native:"الأخير",normalized:"last"},{native:"آخر",normalized:"last"},{native:"التالي",normalized:"next"},{native:"السابق",normalized:"previous"},{native:"الأقرب",normalized:"closest"},{native:"الأب",normalized:"parent"},{native:"النقر",normalized:"click"},{native:"نقر",normalized:"click"},{native:"الإدخال",normalized:"input"},{native:"إدخال",normalized:"input"},{native:"التغيير",normalized:"change"},{native:"تغيير",normalized:"change"},{native:"الإرسال",normalized:"submit"},{native:"إرسال",normalized:"submit"},{native:"التركيز",normalized:"focus"},{native:"فقدان التركيز",normalized:"blur"},{native:"ضغط",normalized:"keydown"},{native:"رفع",normalized:"keyup"},{native:"تمرير الفأرة",normalized:"mouseover"},{native:"مغادرة الفأرة",normalized:"mouseout"},{native:"تحميل",normalized:"load"},{native:"تمرير",normalized:"scroll"},{native:"هي",normalized:"it"},{native:"ثانية",normalized:"s"},{native:"ثواني",normalized:"s"},{native:"ملي ثانية",normalized:"ms"},{native:"دقيقة",normalized:"m"},{native:"دقائق",normalized:"m"},{native:"ساعة",normalized:"h"},{native:"ساعات",normalized:"h"}],bc=[{pattern:"ملي ثانية",suffix:"ms",length:9,caseInsensitive:!1},{pattern:"ملي_ثانية",suffix:"ms",length:8,caseInsensitive:!1},{pattern:"دقائق",suffix:"m",length:5,caseInsensitive:!1},{pattern:"دقيقة",suffix:"m",length:5,caseInsensitive:!1},{pattern:"ثواني",suffix:"s",length:5,caseInsensitive:!1},{pattern:"ثانية",suffix:"s",length:5,caseInsensitive:!1},{pattern:"ساعات",suffix:"h",length:5,caseInsensitive:!1},{pattern:"ساعة",suffix:"h",length:4,caseInsensitive:!1}],xc=new(zc=class extends Dl{constructor(){super(),this.language="ar",this.direction="rtl",this.initializeKeywordsFromProfile(mc,wc),this.normalizer=new cc}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])){const n=this.extractArabicNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.tryPreposition(e,r);if(i)t.push(i),r=i.position.end;else{if(fc(e[r])){const n=this.tryProclitic(e,r);if(n){t.push(n.conjunction),r=n.conjunction.position.end;continue}const i=this.extractArabicWord(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Xl(e[r])){const n=this.extractAsciiWord(e,r);if(n){t.push(n),r=n.position.end;continue}}r++}}return new Wl(t,"ar")}classifyToken(e){return kc.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}tryPreposition(e,t){const r=Array.from(kc).sort((e,t)=>t.length-e.length);for(const n of r)if(e.slice(t,t+n.length)===n){const r=t+n.length;if(r>=e.length||Ul(e[r])||!fc(e[r])){return{...Fl(n,"particle",Hl(t,r)),metadata:{prepositionValue:n}}}}return null}tryProclitic(e,t){let r=t;for(;r<e.length&&(fc(e[r])||"ـ"===e[r]);)r++;const n=e.slice(t,r);if(this.lookupKeyword(n))return null;if(gc.has(n))return null;if(kc.has(n))return null;if(t+2<=e.length){const n=e.slice(t,t+2),i=vc.get(n);if(i){const a=t+2;if(a<e.length&&fc(e[a])){let o=0,s=a;for(;s<e.length&&fc(e[s]);)o++,s++;if(o>=2){if(!vc.get(e[t])){return{conjunction:Fl(n,"conjunction"===i.type?"conjunction":"particle",Hl(t,a),i.normalized)}}{const o=e.slice(t+1,r);if(!this.lookupKeyword(o)){return{conjunction:Fl(n,"conjunction"===i.type?"conjunction":"particle",Hl(t,a),i.normalized)}}}}}}}const i=e[t],a=vc.get(i);if(!a)return null;const o=t+1;if(o>=e.length||!fc(e[o]))return null;let s=0,l=o;for(;l<e.length&&fc(e[l]);)s++,l++;if(s<2)return null;return{conjunction:Fl(i,"conjunction"===a.type?"conjunction":"particle",Hl(t,o),a.normalized)}}extractArabicWord(e,t){let r=t,n="";for(const t of yc){const n=t.replace("ـ","");e.slice(r,r+n.length)}for(;r<e.length&&(fc(e[r])||"ـ"===e[r]);)n+=e[r++];if(!n)return null;const i=gc.get(n);if(i){return{...Fl(n,"keyword",Hl(t,r),i.normalized),metadata:{temporalFormality:i.formality,temporalConfidence:i.confidence}}}const a=this.lookupKeyword(n);if(a)return Fl(n,"keyword",Hl(t,r),a.normalized);if(kc.has(n)){return{...Fl(n,"particle",Hl(t,r)),metadata:{prepositionValue:n}}}const o=this.tryMorphKeywordMatch(n,t,r);return o||Fl(n,"identifier",Hl(t,r))}extractAsciiWord(e,t){let r=t,n="";for(;r<e.length&&Xl(e[r]);)n+=e[r++];return n?Fl(n,"identifier",Hl(t,r)):null}extractArabicNumber(e,t){return this.tryNumberWithTimeUnits(e,t,bc,{allowSign:!1,skipWhitespace:!0})}})}}),Ac={};Tl(Ac,{bengaliProfile:()=>Tc});var Lc,jc,Pc,Nc,Oc,Ic=Sl({"src/generators/profiles/bengali.ts"(){Tc={code:"bn",name:"Bengali",nativeName:"বাংলা",direction:"ltr",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:!0,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["ুন","ো","া","ে","ি"],subjectDrop:!0},references:{me:"আমি",it:"এটি",you:"আপনি",result:"ফলাফল",event:"ঘটনা",target:"লক্ষ্য",body:"বডি"},possessive:{marker:"র",markerPosition:"between",keywords:{"আমার":"me","তোমার":"you","আপনার":"you","তার":"it","এর":"it"}},roleMarkers:{patient:{primary:"কে",position:"after"},destination:{primary:"তে",alternatives:["এ"],position:"after"},source:{primary:"থেকে",position:"after"},style:{primary:"দিয়ে",position:"after"},event:{primary:"তে",position:"after"}},keywords:{toggle:{primary:"টগল",alternatives:["পরিবর্তন"],normalized:"toggle"},add:{primary:"যোগ",alternatives:["যোগ করুন"],normalized:"add"},remove:{primary:"সরান",alternatives:["সরিয়ে ফেলুন","মুছুন"],normalized:"remove"},put:{primary:"রাখুন",alternatives:["রাখ"],normalized:"put"},append:{primary:"শেষে যোগ",alternatives:[],normalized:"append"},prepend:{primary:"শুরুতে যোগ",alternatives:[],normalized:"prepend"},take:{primary:"নিন",alternatives:["নে"],normalized:"take"},make:{primary:"তৈরি করুন",alternatives:["বানান"],normalized:"make"},clone:{primary:"কপি",alternatives:["প্রতিলিপি"],normalized:"clone"},swap:{primary:"বদল",alternatives:[],normalized:"swap"},morph:{primary:"রূপান্তর",alternatives:[],normalized:"morph"},set:{primary:"সেট",alternatives:["নির্ধারণ"],normalized:"set"},get:{primary:"পান",alternatives:["নিন"],normalized:"get"},increment:{primary:"বৃদ্ধি",alternatives:["বাড়ান"],normalized:"increment"},decrement:{primary:"হ্রাস",alternatives:["কমান"],normalized:"decrement"},log:{primary:"লগ",alternatives:["রেকর্ড"],normalized:"log"},show:{primary:"দেখান",alternatives:["দেখাও"],normalized:"show"},hide:{primary:"লুকান",alternatives:["লুকাও"],normalized:"hide"},transition:{primary:"সংক্রমণ",alternatives:[],normalized:"transition"},on:{primary:"তে",alternatives:["এ","যখন"],normalized:"on"},trigger:{primary:"ট্রিগার",alternatives:[],normalized:"trigger"},send:{primary:"পাঠান",alternatives:["পাঠাও"],normalized:"send"},focus:{primary:"ফোকাস",alternatives:["মনোযোগ"],normalized:"focus"},blur:{primary:"ঝাপসা",alternatives:["ফোকাস_সরান"],normalized:"blur"},click:{primary:"ক্লিক",normalized:"click"},hover:{primary:"হোভার",alternatives:["উপরে_রাখুন"],normalized:"hover"},submit:{primary:"সাবমিট",alternatives:["জমা"],normalized:"submit"},input:{primary:"ইনপুট",alternatives:["প্রবেশ"],normalized:"input"},change:{primary:"পরিবর্তন",normalized:"change"},go:{primary:"যান",alternatives:["যাও"],normalized:"go"},wait:{primary:"অপেক্ষা",alternatives:["থামুন"],normalized:"wait"},fetch:{primary:"আনুন",alternatives:[],normalized:"fetch"},settle:{primary:"স্থির",alternatives:[],normalized:"settle"},if:{primary:"যদি",alternatives:[],normalized:"if"},when:{primary:"যখন",normalized:"when"},where:{primary:"কোথায়",normalized:"where"},else:{primary:"নতুবা",alternatives:["না হলে"],normalized:"else"},repeat:{primary:"পুনরাবৃত্তি",alternatives:["বার বার"],normalized:"repeat"},for:{primary:"জন্য",alternatives:[],normalized:"for"},while:{primary:"যতক্ষণ",alternatives:[],normalized:"while"},continue:{primary:"চালিয়ে যান",alternatives:[],normalized:"continue"},halt:{primary:"থামুন",alternatives:["থামাও"],normalized:"halt"},throw:{primary:"নিক্ষেপ",alternatives:["ছুঁড়ে দিন"],normalized:"throw"},call:{primary:"কল",alternatives:["ডাকুন"],normalized:"call"},return:{primary:"ফিরুন",alternatives:["ফেরত দিন"],normalized:"return"},then:{primary:"তারপর",alternatives:["তখন"],normalized:"then"},and:{primary:"এবং",alternatives:[],normalized:"and"},end:{primary:"শেষ",alternatives:["সমাপ্ত"],normalized:"end"},js:{primary:"জেএস",alternatives:["js"],normalized:"js"},async:{primary:"অ্যাসিঙ্ক",alternatives:[],normalized:"async"},tell:{primary:"বলুন",alternatives:["বল"],normalized:"tell"},default:{primary:"ডিফল্ট",alternatives:[],normalized:"default"},init:{primary:"শুরু",alternatives:[],normalized:"init"},behavior:{primary:"আচরণ",alternatives:[],normalized:"behavior"},install:{primary:"ইনস্টল",alternatives:[],normalized:"install"},measure:{primary:"মাপুন",alternatives:[],normalized:"measure"},into:{primary:"তে",alternatives:["এ"],normalized:"into"},before:{primary:"আগে",alternatives:[],normalized:"before"},after:{primary:"পরে",alternatives:[],normalized:"after"},until:{primary:"পর্যন্ত",alternatives:[],normalized:"until"},event:{primary:"ঘটনা",alternatives:[],normalized:"event"},from:{primary:"থেকে",normalized:"from"}},tokenization:{particles:["কে","তে","থেকে","র","এর","দিয়ে","জন্য","পর্যন্ত"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"তে",alternatives:["এ","যখন"],normalized:"on"},sourceMarker:{primary:"থেকে",position:"after"},eventMarker:{primary:"তে",alternatives:["এ"],position:"after"},temporalMarkers:["যখন","যখনই"]}}}}),Rc={};Tl(Rc,{BengaliTokenizer:()=>Nc,bengaliTokenizer:()=>Oc});var Mc,qc=Sl({"src/tokenizers/bengali.ts"(){rc(),Ic(),Lc=Zl([[2432,2559]]),jc=new Set(["কে","তে","থেকে","র","এর","দিয়ে","জন্য","পর্যন্ত"]),Pc=[{native:"সত্য",normalized:"true"},{native:"মিথ্যা",normalized:"false"},{native:"শূন্য",normalized:"null"},{native:"অনির্ধারিত",normalized:"undefined"},{native:"প্রথম",normalized:"first"},{native:"পরবর্তী",normalized:"next"},{native:"আগের",normalized:"previous"},{native:"নিকটতম",normalized:"closest"},{native:"মূল",normalized:"parent"},{native:"ক্লিক",normalized:"click"},{native:"জমা",normalized:"submit"},{native:"ইনপুট",normalized:"input"},{native:"লোড",normalized:"load"},{native:"স্ক্রোল",normalized:"scroll"},{native:"কে",normalized:"to"},{native:"সাথে",normalized:"with"}],Oc=new(Nc=class extends Dl{constructor(){super(),this.language="bn",this.direction="ltr",this.initializeKeywordsFromProfile(Tc,Pc)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}if(":"===e[r]){const n=r;r++;let i="";for(;r<e.length&&(Xl(e[r])||Lc(e[r]));)i+=e[r],r++;if(i){t.push(Fl(":"+i,"identifier",Hl(n,r),":"+i));continue}r=n}if(Lc(e[r])){const n=r;let i="";for(;r<e.length&&Lc(e[r]);)i+=e[r],r++;const a=this.lookupKeyword(i);a?t.push(Fl(i,"keyword",Hl(n,r),a.normalized)):jc.has(i)?t.push(Fl(i,"particle",Hl(n,r))):t.push(Fl(i,"identifier",Hl(n,r)));continue}if(Xl(e[r])){const n=r;let i="";for(;r<e.length&&Xl(e[r]);)i+=e[r],r++;const a=this.lookupKeyword(i);t.push(Fl(i,a?"keyword":"identifier",Hl(n,r),a?.normalized||i.toLowerCase()));continue}t.push(Fl(e[r],"operator",Hl(r,r+1))),r++}return new Wl(t,this.language)}classifyToken(e){return this.isKeyword(e)?"keyword":jc.has(e)?"particle":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}extractNumber(e,t){let r=t,n="";for("-"===e[r]&&(n+="-",r++);r<e.length&&Yl(e[r]);)n+=e[r],r++;if(r<e.length&&"."===e[r])for(n+=".",r++;r<e.length&&Yl(e[r]);)n+=e[r],r++;return"-"===n?null:Fl(n,"literal",Hl(t,r))}})}}),_c={};Tl(_c,{germanProfile:()=>Mc});var $c,Wc,Vc,Dc,Bc,Hc,Fc,Uc=Sl({"src/generators/profiles/german.ts"(){Mc={code:"de",name:"German",nativeName:"Deutsch",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!1},references:{me:"ich",it:"es",you:"du",result:"Ergebnis",event:"Ereignis",target:"Ziel",body:"Körper"},possessive:{marker:"",markerPosition:"before-property",usePossessiveAdjectives:!0,specialForms:{me:"mein",it:"sein",you:"dein"},keywords:{mein:"me",meine:"me",meinen:"me",dein:"you",deine:"you",deinen:"you",sein:"it",seine:"it",seinen:"it"}},roleMarkers:{destination:{primary:"auf",alternatives:["zu","in"],position:"before"},source:{primary:"von",alternatives:["aus"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"mit",position:"before"}},keywords:{toggle:{primary:"umschalten",alternatives:["wechseln"],normalized:"toggle"},add:{primary:"hinzufügen",normalized:"add"},remove:{primary:"entfernen",alternatives:["löschen"],normalized:"remove"},put:{primary:"setzen",alternatives:["stellen","platzieren"],normalized:"put"},append:{primary:"anhängen",normalized:"append"},prepend:{primary:"voranstellen",normalized:"prepend"},take:{primary:"nehmen",normalized:"take"},make:{primary:"machen",alternatives:["erstellen","erzeugen"],normalized:"make"},clone:{primary:"klonen",alternatives:["kopieren"],normalized:"clone"},swap:{primary:"austauschen",alternatives:["tauschen","wechseln"],normalized:"swap"},morph:{primary:"verwandeln",alternatives:["transformieren"],normalized:"morph"},set:{primary:"festlegen",alternatives:["definieren"],normalized:"set"},get:{primary:"holen",alternatives:["bekommen"],normalized:"get"},increment:{primary:"erhöhen",normalized:"increment"},decrement:{primary:"verringern",alternatives:["vermindern"],normalized:"decrement"},log:{primary:"protokollieren",alternatives:["ausgeben"],normalized:"log"},show:{primary:"zeigen",alternatives:["anzeigen"],normalized:"show"},hide:{primary:"verbergen",alternatives:["verstecken"],normalized:"hide"},transition:{primary:"übergang",alternatives:["animieren"],normalized:"transition"},on:{primary:"bei",alternatives:["wenn","auf"],normalized:"on"},trigger:{primary:"auslösen",normalized:"trigger"},send:{primary:"senden",alternatives:["schicken"],normalized:"send"},focus:{primary:"fokussieren",normalized:"focus"},blur:{primary:"defokussieren",alternatives:["entfokussieren"],normalized:"blur"},go:{primary:"gehen",alternatives:["navigieren"],normalized:"go"},wait:{primary:"warten",normalized:"wait"},fetch:{primary:"abrufen",alternatives:["laden"],normalized:"fetch"},settle:{primary:"stabilisieren",normalized:"settle"},if:{primary:"wenn",alternatives:["falls"],normalized:"if"},when:{primary:"wenn",normalized:"when"},where:{primary:"wo",normalized:"where"},else:{primary:"sonst",alternatives:["ansonsten"],normalized:"else"},repeat:{primary:"wiederholen",normalized:"repeat"},for:{primary:"für",normalized:"for"},while:{primary:"solange",alternatives:["während"],normalized:"while"},continue:{primary:"fortfahren",alternatives:["weiter"],normalized:"continue"},halt:{primary:"anhalten",alternatives:["stoppen"],normalized:"halt"},throw:{primary:"werfen",normalized:"throw"},call:{primary:"aufrufen",normalized:"call"},return:{primary:"zurückgeben",normalized:"return"},then:{primary:"dann",alternatives:["danach","anschließend"],normalized:"then"},and:{primary:"und",alternatives:["sowie","auch"],normalized:"and"},end:{primary:"ende",alternatives:["beenden","fertig"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asynchron",normalized:"async"},tell:{primary:"sagen",normalized:"tell"},default:{primary:"standard",normalized:"default"},init:{primary:"initialisieren",normalized:"init"},behavior:{primary:"verhalten",normalized:"behavior"},install:{primary:"installieren",normalized:"install"},measure:{primary:"messen",normalized:"measure"},into:{primary:"hinein",normalized:"into"},before:{primary:"vor",normalized:"before"},after:{primary:"nach",normalized:"after"},click:{primary:"Klick",alternatives:["Klicken"],normalized:"click"},hover:{primary:"Hover",alternatives:["Schweben"],normalized:"hover"},submit:{primary:"Absenden",alternatives:["Senden"],normalized:"submit"},input:{primary:"Eingabe",normalized:"input"},change:{primary:"Änderung",alternatives:["Ändern"],normalized:"change"},until:{primary:"bis",normalized:"until"},event:{primary:"Ereignis",alternatives:["Event"],normalized:"event"},from:{primary:"von",alternatives:["aus"],normalized:"from"}},eventHandler:{keyword:{primary:"bei",alternatives:["auf"],normalized:"on"},sourceMarker:{primary:"von",alternatives:["aus"],position:"before"},conditionalKeyword:{primary:"wenn",alternatives:["falls"]},eventMarker:{primary:"bei",alternatives:["beim"],position:"before"},temporalMarkers:["wenn","bei"]}}}}),Kc={};Tl(Kc,{GermanTokenizer:()=>Hc,germanTokenizer:()=>Fc});var Gc,Yc=Sl({"src/tokenizers/german.ts"(){rc(),Uc(),({isLetter:$c,isIdentifierChar:Wc}=Ql(/[a-zA-ZäöüÄÖÜß]/)),Vc=new Set(["an","auf","aus","bei","durch","für","fur","gegen","in","mit","nach","ohne","seit","über","uber","um","unter","von","vor","zu","zwischen","bis","gegenüber","gegenuber","während","wahrend","wegen","trotz","statt","innerhalb","außerhalb","ausserhalb"]),Dc=[{native:"wahr",normalized:"true"},{native:"falsch",normalized:"false"},{native:"null",normalized:"null"},{native:"undefiniert",normalized:"undefined"},{native:"erste",normalized:"first"},{native:"erster",normalized:"first"},{native:"erstes",normalized:"first"},{native:"letzte",normalized:"last"},{native:"letzter",normalized:"last"},{native:"letztes",normalized:"last"},{native:"nächste",normalized:"next"},{native:"nachste",normalized:"next"},{native:"vorherige",normalized:"previous"},{native:"nächste",normalized:"closest"},{native:"eltern",normalized:"parent"},{native:"klick",normalized:"click"},{native:"click",normalized:"click"},{native:"eingabe",normalized:"input"},{native:"änderung",normalized:"change"},{native:"anderung",normalized:"change"},{native:"absenden",normalized:"submit"},{native:"taste unten",normalized:"keydown"},{native:"taste oben",normalized:"keyup"},{native:"maus drüber",normalized:"mouseover"},{native:"maus druber",normalized:"mouseover"},{native:"maus weg",normalized:"mouseout"},{native:"fokus",normalized:"focus"},{native:"unschärfe",normalized:"blur"},{native:"unscharfe",normalized:"blur"},{native:"scrollen",normalized:"scroll"},{native:"meine",normalized:"my"},{native:"meinen",normalized:"my"},{native:"ergebnis",normalized:"result"},{native:"ziel",normalized:"target"},{native:"sekunde",normalized:"s"},{native:"sekunden",normalized:"s"},{native:"millisekunde",normalized:"ms"},{native:"millisekunden",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minuten",normalized:"m"},{native:"stunde",normalized:"h"},{native:"stunden",normalized:"h"},{native:"hinzufugen",normalized:"add"},{native:"hinzufgen",normalized:"add"},{native:"loschen",normalized:"remove"},{native:"anhangen",normalized:"append"},{native:"erhohen",normalized:"increment"},{native:"ubergang",normalized:"transition"},{native:"auslosen",normalized:"trigger"},{native:"zuruckgeben",normalized:"return"},{native:"anschliessend",normalized:"then"},{native:"erhöhe",normalized:"increment"},{native:"erhohe",normalized:"increment"},{native:"verringere",normalized:"decrement"}],Bc=[{pattern:"millisekunden",suffix:"ms",length:13,caseInsensitive:!0},{pattern:"millisekunde",suffix:"ms",length:12,caseInsensitive:!0},{pattern:"sekunden",suffix:"s",length:8,caseInsensitive:!0},{pattern:"sekunde",suffix:"s",length:7,caseInsensitive:!0},{pattern:"minuten",suffix:"m",length:7,caseInsensitive:!0},{pattern:"minute",suffix:"m",length:6,caseInsensitive:!0},{pattern:"stunden",suffix:"h",length:7,caseInsensitive:!0},{pattern:"stunde",suffix:"h",length:6,caseInsensitive:!0}],Fc=new(Hc=class extends Dl{constructor(){super(),this.language="de",this.direction="ltr",this.initializeKeywordsFromProfile(Mc,Dc)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if($c(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"de")}classifyToken(e){const t=e.toLowerCase();return Vc.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&Wc(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):Vc.has(i)?Fl(n,"particle",Hl(t,r)):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){return this.tryNumberWithTimeUnits(e,t,Bc,{allowSign:!0,skipWhitespace:!0})}})}}),Xc={};Tl(Xc,{englishProfile:()=>Gc});var Zc,Jc,Qc,eu=Sl({"src/generators/profiles/english.ts"(){Gc={code:"en",name:"English",nativeName:"English",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"base",verb:{position:"start",subjectDrop:!1},references:{me:"me",it:"it",you:"you",result:"result",event:"event",target:"target",body:"body"},possessive:{marker:"'s",markerPosition:"after-object",specialForms:{me:"my",it:"its",you:"your"},keywords:{my:"me",your:"you",its:"it"}},roleMarkers:{destination:{primary:"on",alternatives:["to","from"],position:"before"},source:{primary:"from",position:"before"},patient:{primary:"",position:"before"},style:{primary:"with",alternatives:["by","using"],position:"before"},responseType:{primary:"as",position:"before"},method:{primary:"via",alternatives:["using"],position:"before"}},keywords:{toggle:{primary:"toggle"},add:{primary:"add"},remove:{primary:"remove"},put:{primary:"put"},append:{primary:"append"},prepend:{primary:"prepend"},take:{primary:"take"},make:{primary:"make"},clone:{primary:"clone"},swap:{primary:"swap"},morph:{primary:"morph"},set:{primary:"set"},get:{primary:"get"},increment:{primary:"increment"},decrement:{primary:"decrement"},log:{primary:"log"},show:{primary:"show"},hide:{primary:"hide"},transition:{primary:"transition"},on:{primary:"on"},trigger:{primary:"trigger"},send:{primary:"send"},focus:{primary:"focus"},blur:{primary:"blur"},go:{primary:"go"},wait:{primary:"wait"},fetch:{primary:"fetch"},settle:{primary:"settle"},if:{primary:"if"},when:{primary:"when",normalized:"when"},where:{primary:"where",normalized:"where"},else:{primary:"else"},repeat:{primary:"repeat"},for:{primary:"for"},while:{primary:"while"},continue:{primary:"continue"},halt:{primary:"halt"},throw:{primary:"throw"},call:{primary:"call"},return:{primary:"return"},then:{primary:"then"},and:{primary:"and"},end:{primary:"end"},js:{primary:"js"},async:{primary:"async"},tell:{primary:"tell"},default:{primary:"default"},init:{primary:"init"},behavior:{primary:"behavior"},install:{primary:"install"},measure:{primary:"measure"},into:{primary:"into"},before:{primary:"before"},after:{primary:"after"},until:{primary:"until"},event:{primary:"event"},from:{primary:"from"}}}}}),tu={};Tl(tu,{EnglishTokenizer:()=>Jc,englishTokenizer:()=>Qc});var ru,nu,iu,au=Sl({"src/tokenizers/english.ts"(){rc(),eu(),Zc=[{native:"true",normalized:"true"},{native:"false",normalized:"false"},{native:"null",normalized:"null"},{native:"undefined",normalized:"undefined"},{native:"first",normalized:"first"},{native:"last",normalized:"last"},{native:"next",normalized:"next"},{native:"previous",normalized:"previous"},{native:"closest",normalized:"closest"},{native:"click",normalized:"click"},{native:"dblclick",normalized:"dblclick"},{native:"mousedown",normalized:"mousedown"},{native:"mouseup",normalized:"mouseup"},{native:"mouseover",normalized:"mouseover"},{native:"mouseout",normalized:"mouseout"},{native:"mouseenter",normalized:"mouseenter"},{native:"mouseleave",normalized:"mouseleave"},{native:"mousemove",normalized:"mousemove"},{native:"keydown",normalized:"keydown"},{native:"keyup",normalized:"keyup"},{native:"keypress",normalized:"keypress"},{native:"input",normalized:"input"},{native:"change",normalized:"change"},{native:"submit",normalized:"submit"},{native:"reset",normalized:"reset"},{native:"load",normalized:"load"},{native:"unload",normalized:"unload"},{native:"scroll",normalized:"scroll"},{native:"resize",normalized:"resize"},{native:"dragstart",normalized:"dragstart"},{native:"drag",normalized:"drag"},{native:"dragend",normalized:"dragend"},{native:"dragenter",normalized:"dragenter"},{native:"dragleave",normalized:"dragleave"},{native:"dragover",normalized:"dragover"},{native:"drop",normalized:"drop"},{native:"touchstart",normalized:"touchstart"},{native:"touchmove",normalized:"touchmove"},{native:"touchend",normalized:"touchend"},{native:"touchcancel",normalized:"touchcancel"},{native:"in",normalized:"in"},{native:"to",normalized:"to"},{native:"at",normalized:"at"},{native:"by",normalized:"by"},{native:"with",normalized:"with"},{native:"without",normalized:"without"},{native:"of",normalized:"of"},{native:"as",normalized:"as"},{native:"every",normalized:"every"},{native:"upon",normalized:"upon"},{native:"unless",normalized:"unless"},{native:"forever",normalized:"forever"},{native:"times",normalized:"times"},{native:"and",normalized:"and"},{native:"or",normalized:"or"},{native:"not",normalized:"not"},{native:"is",normalized:"is"},{native:"exists",normalized:"exists"},{native:"empty",normalized:"empty"},{native:"my",normalized:"my"},{native:"your",normalized:"your"},{native:"its",normalized:"its"},{native:"the",normalized:"the"},{native:"a",normalized:"a"},{native:"an",normalized:"an"},{native:"delete",normalized:"delete"},{native:"innerHTML",normalized:"innerHTML"},{native:"outerHTML",normalized:"outerHTML"},{native:"beforebegin",normalized:"beforebegin"},{native:"afterend",normalized:"afterend"},{native:"beforeend",normalized:"beforeend"},{native:"afterbegin",normalized:"afterbegin"},{native:"flip",normalized:"toggle"},{native:"switch",normalized:"toggle"},{native:"increase",normalized:"increment"},{native:"decrease",normalized:"decrement"},{native:"display",normalized:"show"},{native:"reveal",normalized:"show"},{native:"conceal",normalized:"hide"},{native:"colour",normalized:"color"},{native:"grey",normalized:"gray"},{native:"centre",normalized:"center"},{native:"behaviour",normalized:"behavior"},{native:"initialise",normalized:"initialize"},{native:"favourite",normalized:"favorite"}],Qc=new(Jc=class extends Dl{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(Gc,Zc)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}if("."===e[r]){const n=t[t.length-1];if(n&&!(n&&n.position.end<r)&&("identifier"===n.kind||"keyword"===n.kind||"selector"===n.kind)){t.push(Fl(".","operator",Hl(r,r+1))),r++;continue}let i=r+1;for(;i<e.length&&Xl(e[i]);)i++;if(i<e.length&&"("===e[i]){t.push(Fl(".","operator",Hl(r,r+1))),r++;continue}}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){if("'"===e[r]&&ec(e,r)){t.push(Fl("'s","punctuation",Hl(r,r+2))),r+=2;continue}const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.tryNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(Xl(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"en")}classifyToken(e){return this.isKeyword(e)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&Xl(e[r]);)n+=e[r++];if(!n)return null;if(r<e.length&&":"===e[r]){const t=r;r++;let i="";for(;r<e.length&&Xl(e[r]);)i+=e[r++];i?n=n+":"+i:r=t}const i=this.classifyToken(n),a=this.lookupKeyword(n),o=a&&a.normalized!==a.native?a.normalized:void 0;if("identifier"===i){const t=this.tryConvertToClassSelector(e,r,n);if(t)return t.token}return Fl(n,i,Hl(t,r),o)}tryConvertToClassSelector(e,t,r){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n++;if("class"===e.slice(n,n+5).toLowerCase()){const i=n+5;if(i>=e.length||!Xl(e[i])){return{token:Fl("."+r,"selector",Hl(t-r.length,t)),endPos:t}}}return null}})}});function ou(e,t){return e.replace(/\{(\w+)\}/g,(e,r)=>String(t[r]??`{${r}}`))}function su(e,t,r={},n){const i=ou(nu[e],r),a=iu[e],o=a?ou(a,r):void 0;return{code:e,message:i,severity:t,...n&&{role:n},...o&&{suggestion:o}}}var lu,cu,uu=Sl({"src/generators/schema-error-codes.ts"(){ru={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"},nu={[ru.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[ru.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[ru.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[ru.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[ru.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[ru.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.",[ru.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.",[ru.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[ru.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[ru.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[ru.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[ru.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[ru.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition."},iu={[ru.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[ru.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[ru.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[ru.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[ru.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[ru.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[ru.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[ru.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[ru.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[ru.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition."}}}),pu={};function mu(e){const t=[];for(const r of e.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&("patient"===r.role&&lu.has(e.action)?t.push(su(ru.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:e.action},r.role)):t.push(su(ru.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!lu.has(e.action)&&t.push(su(ru.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));switch(e.action){case"transition":!function(e,t){const r=e.roles.find(e=>"patient"===e.role),n=e.roles.find(e=>"goal"===e.role);r&&r.expectedTypes.includes("selector")&&t.push(su(ru.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient"));r&&!n&&t.push(su(ru.TRANSITION_MISSING_GOAL,"error",{}))}(e,t);break;case"on":!function(e,t){const r=e.roles.find(e=>"event"===e.role);r||t.push(su(ru.EVENT_HANDLER_MISSING_EVENT,"warning",{}));r&&!r.required&&t.push(su(ru.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}))}(e,t);break;case"if":case"unless":!function(e,t){const r=e.roles.find(e=>"condition"===e.role);r||t.push(su(ru.CONDITIONAL_MISSING_CONDITION,"warning",{}));r&&!r.required&&t.push(su(ru.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}))}(e,t);break;case"repeat":case"for":case"while":!function(e,t){if("for"===e.action){e.roles.find(e=>"source"===e.role)||t.push(su(ru.FOR_LOOP_MISSING_SOURCE,"warning",{}))}else if("while"===e.action){e.roles.find(e=>"condition"===e.role)||t.push(su(ru.WHILE_LOOP_MISSING_CONDITION,"warning",{}))}}(e,t)}return 0===e.roles.filter(e=>e.required).length&&(cu.has(e.action)?t.push(su(ru.NO_REQUIRED_ROLES_EXPECTED,"note",{command:e.action})):t.push(su(ru.NO_REQUIRED_ROLES,"warning",{}))),function(e,t){return{action:e,items:t,get notes(){return t.filter(e=>"note"===e.severity).map(e=>e.message)},get warnings(){return t.filter(e=>"warning"===e.severity).map(e=>e.message)},get errors(){return t.filter(e=>"error"===e.severity).map(e=>e.message)}}}(e.action,t)}function du(e,t={}){const r=new Map,{includeNotes:n=!1}=t;for(const[t,i]of Object.entries(e)){const e=mu(i),a=e.items.some(e=>"warning"===e.severity||"error"===e.severity),o=n&&e.items.some(e=>"note"===e.severity);(a||o)&&r.set(t,e)}return r}function hu(e,t={}){const r=[],{showNotes:n=!1,showCodes:i=!0}=t;for(const[t,a]of e){const e=a.items.filter(e=>"error"===e.severity),o=a.items.filter(e=>"warning"===e.severity),s=a.items.filter(e=>"note"===e.severity);if(e.length>0){r.push(` ❌ ${t}:`);for(const t of e){r.push(` ERROR${i?` [${t.code}]`:""}: ${t.message}`),t.suggestion&&r.push(` 💡 Suggestion: ${t.suggestion}`)}}if(o.length>0){r.push(` ⚠️ ${t}:`);for(const e of o){r.push(` ${(i?` [${e.code}]`:"")?`${e.code}: `:""}${e.message}`),e.suggestion&&r.push(` 💡 ${e.suggestion}`)}}if(n&&s.length>0){r.push(` ℹ️ ${t}:`);for(const e of s){r.push(` ${(i?` [${e.code}]`:"")?`${e.code}: `:""}${e.message}`)}}}return r.join("\n")}function fu(e){let t=0,r=0,n=0;const i={};for(const a of e.values())for(const e of a.items)"error"===e.severity?t++:"warning"===e.severity?r++:"note"===e.severity&&n++,i[e.code]=(i[e.code]||0)+1;return{totalCommands:e.size,errors:t,warnings:r,notes:n,byCode:i}}Tl(pu,{SchemaErrorCodes:()=>ru,formatValidationResults:()=>hu,getValidationStats:()=>fu,validateAllSchemas:()=>du,validateCommandSchema:()=>mu});var yu,vu,gu,ku,wu,bu,zu,xu,Eu,Su,Tu,Cu,Au,Lu,ju,Pu,Nu=Sl({"src/generators/schema-validator.ts"(){uu(),lu=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph"]),cu=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure"])}});function Ou(){return Object.values(Pu).filter(e=>e.roles.length>0)}var Iu=Sl({"src/generators/command-schemas.ts"(){Pu={toggle:yu={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:!0,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:!1,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)"}},add:vu={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:!0,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],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"}},remove:gu={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:!0,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:!1,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"}},put:ku={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:!0,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:!0,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2}],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"}},set:wu={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:!0,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"を",ko:"를",tr:"i",ar:""}},{role:"patient",description:"The value to set",required:!0,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"à",de:"auf",id:"ke",ja:"に",ko:"으로",tr:"e",ar:"إلى"}}],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>"}},show:bu={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:!0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:!1,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},hide:zu={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:!0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:!1,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},on:xu={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:!0,roles:[{role:"event",description:"The event to handle",required:!0,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},trigger:Eu={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:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},wait:Su={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},fetch:Tu={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:!1,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:!1,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:!1,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},increment:Cu={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:!0,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:!1,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2}]},decrement:Au={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:!0,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:!1,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2}]},append:Lu={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:!0,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:!0,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1}]},prepend:ju={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:!0,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:!0,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1}]},log:{action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:!0,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},get:{action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:!0,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"を",zh:"",ko:"를",ar:"على",tr:"i",id:""}},{role:"destination",description:"Where to store the result (optional)",required:!1,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},take:{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:!0,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},make:{action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:!0,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},halt:{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:!1,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},settle:{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:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},throw:{action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},send:{action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"に",ar:"إلى",es:"a",ko:"에게",zh:"到",tr:"-e",pt:"para",fr:"à",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},if:{action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:!0,roles:[{role:"condition",description:"The condition to evaluate",required:!0,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},unless:{action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:!0,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:!0,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},else:{action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[]},repeat:{action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:!0,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:!0,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:!1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:!1,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:!1,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},for:{action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[{role:"patient",description:"The iteration variable",required:!0,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:!0,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1}]},while:{action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:!0,roles:[{role:"condition",description:"The condition to check",required:!0,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},continue:{action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},go:{action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},transition:{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:!0,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"goal",description:"The target value to transition to",required:!0,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:!1,expectedTypes:["literal"],svoPosition:4,sovPosition:4},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:!1,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},clone:{action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:!0,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:!1,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1}]},focus:{action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},blur:{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:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},call:{action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:!0,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},return:{action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:!1,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},js:{action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[{role:"patient",description:"The JavaScript code to execute",required:!1,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},async:{action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:!0,roles:[]},tell:{action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:!0,roles:[{role:"destination",description:"The element to tell",required:!0,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1}]},default:{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:!0,expectedTypes:["reference"],svoPosition:1,sovPosition:1},{role:"patient",description:"The default value",required:!0,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2}]},init:{action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[]},behavior:{action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:!0,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},install:{action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:!0,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},measure:{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:!1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2}]},swap:{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:!1,expectedTypes:["literal"],svoPosition:1,sovPosition:3},{role:"destination",description:"The element to swap content in/for",required:!0,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1},{role:"patient",description:"The content to swap in (optional for delete)",required:!1,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2}]},morph:{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:!0,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1},{role:"patient",description:"The target content/element to morph into",required:!0,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2}]},compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:!0,roles:[]}},"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&Promise.resolve().then(()=>(Nu(),pu)).then(({validateAllSchemas:e})=>{e(Pu)}).catch(e=>{})}});function Ru(e,t){const r="SOV"===t?"sovPosition":"svoPosition";return[...e].sort((e,t)=>(e[r]??99)-(t[r]??99))}var Mu=Sl({"src/parser/utils/role-positioning.ts"(){}});var qu,_u=Sl({"src/parser/utils/marker-resolution.ts"(){}});function $u(){return Ml().map(e=>Rl(e)).filter(e=>void 0!==e)}function Wu(e,t,r=qu){const n=`${e.action}-${t.code}-generated`,i=r.basePriority??100,a=t.keywords[e.action];if(!a)throw new Error(`No keyword translation for '${e.action}' in ${t.code}`);const o=function(e,t,r){const n=[],i=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},a=function(e,t){const r=[],n=Ru(e.roles,t.wordOrder);for(const e of n){const n=Ku(e,t);e.required?r.push(...n):r.push({type:"group",optional:!0,tokens:n})}return r}(e,t);switch(t.wordOrder){case"SVO":case"VSO":default:n.push(i),n.push(...a);break;case"SOV":n.push(...a),n.push(i)}return n}(e,t,a),s=Gu(e,t),l=function(e,t,r){const n=[],i=Ru(e.roles,t.wordOrder),a=i.map(e=>{const r=function(e,t){const r=e.markerOverride?.[t.code],n=t.roleMarkers[e.role];if(void 0!==r)return{primary:r,position:n?.position??"before",isOverride:!0};if(n&&n.primary){const e={primary:n.primary,position:n.position,isOverride:!1};return n.alternatives&&(e.alternatives=n.alternatives),e}return null}(e,t);let n="";return n=r&&r.primary?"before"===r.position?`${r.primary} {${e.role}}`:`{${e.role}} ${r.primary}`:`{${e.role}}`,e.required?n:`[${n}]`});switch(t.wordOrder){case"SVO":case"VSO":default:n.push(r.primary,...a);break;case"SOV":n.push(...a,r.primary)}return n.join(" ")}(e,t,a);return{id:n,language:t.code,command:e.action,priority:i,template:{format:l,tokens:o},extraction:s}}function Vu(e,t,r=qu){if(0===e.roles.filter(e=>!e.required).length)return null;const n=e.roles.filter(e=>e.required);return{...Wu({...e,roles:n},t,r),id:`${e.action}-${t.code}-simple`,priority:(r.basePriority??100)-5,extraction:Gu(e,t)}}function Du(e,t,r=qu){const n=[];if(n.push(Wu(e,t,r)),r.generateSimpleVariants){const i=Vu(e,t,r);i&&n.push(i)}return n}function Bu(e,t=qu){const r=[],n=Ou();for(const i of n){if(!e.keywords[i.action])continue;const n=Du(i,e,t);if(r.push(...n),e.eventHandler?.eventMarker){const n=Hu(i,e,t);r.push(...n)}}return r}function Hu(e,t,r=qu){if(!t.eventHandler||!t.eventHandler.eventMarker)return[];const n=[],i=t.eventHandler.eventMarker,a=t.keywords[e.action];if(!a)return[];const o=2===e.roles.filter(e=>e.required).length;if("SOV"===t.wordOrder)if(o)n.push(function(e,t,r,n,i){const a=[];if(a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else{a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}}const o=e.roles.filter(e=>e.required),s=[...o].sort((e,t)=>(e.sovPosition??999)-(t.sovPosition??999));for(const e of s){let r,n;if(a.push({type:"role",role:e.role,optional:!1}),e.markerOverride&&e.markerOverride[t.code])r=e.markerOverride[t.code];else{const i=t.roleMarkers[e.role];i&&(r=i.primary,n=i.alternatives)}if(r){a.push(n?{type:"literal",value:r,alternatives:n}:{type:"literal",value:r})}}const l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(l);const c=s.map(e=>`{${e.role}}`).join(" ");return{id:`${e.action}-event-${t.code}-sov-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${n.primary} ${c} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}(e,t,a,i,r));else{n.push(function(e,t,r,n,i){const a=[];if(a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else{a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}}const o=t.roleMarkers.destination;o&&a.push({type:"group",optional:!0,tokens:[{type:"role",role:"destination",optional:!0},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]});a.push({type:"role",role:"patient",optional:!1});const s=t.roleMarkers.patient;if(s){a.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})}const l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(l),{id:`${e.action}-event-${t.code}-sov`,language:t.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${n.primary} {destination?} {patient} ${s?.primary||""} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,i,r));const o=i.primary.split(/\s+/),s=i.alternatives?.some(e=>!e.includes(" ")&&e.length>1);o.length>1&&s&&n.push(function(e,t,r,n,i){const a=[];a.push({type:"role",role:"event",optional:!1});const o=n.alternatives?.filter(e=>!e.includes(" ")&&e.length>1)||[];o.length>0&&a.push({type:"literal",value:o[0],alternatives:o.slice(1)});const s=t.roleMarkers.destination;s&&a.push({type:"group",optional:!0,tokens:[{type:"role",role:"destination",optional:!0},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]});a.push({type:"role",role:"patient",optional:!1});const l=t.roleMarkers.patient;if(l){a.push(l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary})}const c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(c),{id:`${e.action}-event-${t.code}-sov-compact`,language:t.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,i,r)),n.push(function(e,t,r,n,i){const a=[];if(a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else{a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}}const o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(o),{id:`${e.action}-event-${t.code}-sov-simple`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${n.primary} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}(e,t,a,i,r));const l=function(e,t,r,n){const i=t.eventHandler?.temporalMarkers;if(!i||0===i.length)return null;const a=[];a.push({type:"role",role:"event",optional:!1}),t.possessive?.marker&&a.push({type:"group",optional:!0,tokens:[{type:"literal",value:t.possessive.marker}]});a.push({type:"literal",value:i[0],alternatives:i.slice(1)}),a.push({type:"role",role:"patient",optional:!1});const o=t.roleMarkers.patient;if(o?.primary){a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary})}const s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(s),{id:`${e.action}-event-${t.code}-sov-temporal`,language:t.code,command:"on",priority:(n.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}(e,t,a,r);l&&n.push(l)}else"VSO"===t.wordOrder?o?n.push(Uu(e,t,a,i,r)):(n.push(Fu(e,t,a,i,r)),t.eventHandler?.negationMarker&&n.push(function(e,t,r,n,i){const a=[],o=t.eventHandler?.negationMarker;if("before"===n.position){a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}if(o){a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary})}a.push({type:"role",role:"event",optional:!1});const s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(s),a.push({type:"role",role:"patient",optional:!1});const l=t.roleMarkers.destination;l&&a.push({type:"group",optional:!0,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:!0}]});return{id:`${e.action}-event-${t.code}-vso-negated`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${o?.primary||""} {event} ${r.primary} {patient} ${l?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,i,r)),t.tokenization?.prefixes&&n.push(function(e,t,r,n){const i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:!1});const a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(a),i.push({type:"role",role:"patient",optional:!1});const o=t.roleMarkers.destination;o&&i.push({type:"group",optional:!0,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:!0}]});return{id:`${e.action}-event-${t.code}-vso-proclitic`,language:t.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,r))):n.push(o?Uu(e,t,a,i,r):Fu(e,t,a,i,r));return n}function Fu(e,t,r,n,i){const a=[];if("before"===n.position){a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}a.push({type:"role",role:"event",optional:!1});a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"patient",optional:!1});const o=t.roleMarkers.destination;return o&&a.push({type:"group",optional:!0,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:!0}]}),{id:`${e.action}-event-${t.code}-vso`,language:t.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${n.primary} {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Uu(e,t,r,n,i){const a=[];if("before"===n.position){a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}a.push({type:"role",role:"event",optional:!1});a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});const o=[...e.roles.filter(e=>e.required)].sort((e,t)=>(e.svoPosition??999)-(t.svoPosition??999));for(const e of o){let r,n;if(e.markerOverride&&e.markerOverride[t.code])r=e.markerOverride[t.code];else{const i=t.roleMarkers[e.role];i&&(r=i.primary,n=i.alternatives)}if(r){a.push(n?{type:"literal",value:r,alternatives:n}:{type:"literal",value:r})}a.push({type:"role",role:e.role,optional:!1})}const s=o.map(e=>`{${e.role}}`).join(" ");return{id:`${e.action}-event-${t.code}-vso-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${n.primary} {event} ${r.primary} ${s}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Ku(e,t){const r=[],n=e.markerOverride?.[t.code],i=t.roleMarkers[e.role],a={type:"role",role:e.role,optional:!e.required,expectedTypes:e.expectedTypes};if(void 0!==n){"before"===(i?.position??"before")?(n&&r.push({type:"literal",value:n}),r.push(a)):(r.push(a),n&&r.push({type:"literal",value:n}))}else if(i)if("before"===i.position){if(i.primary){r.push(i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary})}r.push(a)}else{r.push(a);r.push(i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary})}else r.push(a);return r}function Gu(e,t){const r=function(e,t){const r={};for(const n of e.roles){const e=n.markerOverride?.[t.code],i=t.roleMarkers[n.role];r[n.role]=void 0!==e?e?{marker:e}:{}:i&&i.primary?i.alternatives?{marker:i.primary,markerAlternatives:i.alternatives}:{marker:i.primary}:{}}return r}(e,t),n={};for(const t of e.roles){const e=r[t.role]||{};n[t.role]=!t.required&&t.default?{...e,default:t.default}:e}return n}var Yu=Sl({"src/generators/pattern-generator.ts"(){Iu(),Mu(),_u(),Bl(),qu={basePriority:100,generateSimpleVariants:!0,generateAlternatives:!0}}});var Xu=Sl({"src/patterns/toggle/en.ts"(){}});var Zu=Sl({"src/patterns/put/en.ts"(){}});var Ju,Qu,ep,tp,rp,np,ip,ap,op,sp,lp,cp=Sl({"src/patterns/event-handler/en.ts"(){}}),up={};function pp(){const e=[];e.push({id:"toggle-en-full",language:"en",command:"toggle",priority:100,template:{format:"toggle {patient} on {target}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"on",alternatives:["from"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"on",markerAlternatives:["from"],default:{type:"reference",value:"me"}}}},{id:"toggle-en-simple",language:"en",command:"toggle",priority:90,template:{format:"toggle {patient}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}),e.push({id:"put-en-into",language:"en",command:"put",priority:100,template:{format:"put {patient} into {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"into",alternatives:["in","to"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"into",markerAlternatives:["in","to"]}}},{id:"put-en-before",language:"en",command:"put",priority:95,template:{format:"put {patient} before {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-en-after",language:"en",command:"put",priority:95,template:{format:"put {patient} after {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}}),e.push({id:"event-en-when-source",language:"en",command:"on",priority:115,template:{format:"when {event} from {source} {body}",tokens:[{type:"literal",value:"when"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-when",language:"en",command:"on",priority:105,template:{format:"when {event} {body}",tokens:[{type:"literal",value:"when"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-source",language:"en",command:"on",priority:110,template:{format:"on {event} from {source} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-standard",language:"en",command:"on",priority:100,template:{format:"on {event} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-upon",language:"en",command:"on",priority:98,template:{format:"upon {event} {body}",tokens:[{type:"literal",value:"upon"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-if",language:"en",command:"on",priority:95,template:{format:"if {event} {body}",tokens:[{type:"literal",value:"if"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}),e.push(Ju,Qu,ep,tp,rp,np,ip,ap,op,sp,lp);const t=Bu(Gc);return e.push(...t),e}Tl(up,{buildEnglishPatterns:()=>pp});var mp,dp,hp,fp,yp,vp,gp=Sl({"src/patterns/en.ts"(){eu(),Yu(),Xu(),Zu(),cp(),Ju={id:"fetch-en-with-response-type",language:"en",command:"fetch",priority:90,template:{format:"fetch {source} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},responseType:{marker:"as"}}},Qu={id:"fetch-en-simple",language:"en",command:"fetch",priority:80,template:{format:"fetch {source}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source"}]},extraction:{source:{position:1}}},ep={id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination}",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"}]},extraction:{method:{position:1},destination:{position:2}}},tp={id:"repeat-en-until-event-from",language:"en",command:"repeat",priority:120,template:{format:"repeat until event {event} from {source}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"from"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{event:{marker:"event"},source:{marker:"from"},loopType:{default:{type:"literal",value:"until-event"}}}},rp={id:"repeat-en-until-event",language:"en",command:"repeat",priority:110,template:{format:"repeat until event {event}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{marker:"event"},loopType:{default:{type:"literal",value:"until-event"}}}},np={id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient}",tokens:[{type:"literal",value:"set"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"to"},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"to"}}},ip={id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"},loopType:{default:{type:"literal",value:"for"}}}},ap={id:"if-en-basic",language:"en",command:"if",priority:100,template:{format:"if {condition}",tokens:[{type:"literal",value:"if"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},op={id:"unless-en-basic",language:"en",command:"unless",priority:100,template:{format:"unless {condition}",tokens:[{type:"literal",value:"unless"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},sp={id:"temporal-en-in",language:"en",command:"wait",priority:95,template:{format:"in {duration}",tokens:[{type:"literal",value:"in"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},lp={id:"temporal-en-after",language:"en",command:"wait",priority:95,template:{format:"after {duration}",tokens:[{type:"literal",value:"after"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}}}});function kp(e){return/[áéíóúüñÁÉÍÓÚÜÑ]/.test(e)}var wp,bp=Sl({"src/tokenizers/morphology/spanish-normalizer.ts"(){uc(),mp=["se","me","te","nos","os"],dp=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"áis",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.82,type:"present"},{ending:"an",stem:"ar",confidence:.8,type:"present"},{ending:"é",stem:"ar",confidence:.85,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"ó",stem:"ar",confidence:.82,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"asteis",stem:"ar",confidence:.88,type:"past"},{ending:"aron",stem:"ar",confidence:.88,type:"past"},{ending:"aba",stem:"ar",confidence:.88,type:"past"},{ending:"abas",stem:"ar",confidence:.88,type:"past"},{ending:"ábamos",stem:"ar",confidence:.88,type:"past"},{ending:"abamos",stem:"ar",confidence:.85,type:"past"},{ending:"abais",stem:"ar",confidence:.88,type:"past"},{ending:"aban",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"éis",stem:"ar",confidence:.85,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"en",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ad",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],hp=[{ending:"iendo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"éis",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"en",stem:"er",confidence:.78,type:"present"},{ending:"í",stem:"er",confidence:.85,type:"past"},{ending:"iste",stem:"er",confidence:.88,type:"past"},{ending:"ió",stem:"er",confidence:.85,type:"past"},{ending:"io",stem:"er",confidence:.82,type:"past"},{ending:"imos",stem:"er",confidence:.85,type:"past"},{ending:"isteis",stem:"er",confidence:.88,type:"past"},{ending:"ieron",stem:"er",confidence:.88,type:"past"},{ending:"ía",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"ías",stem:"er",confidence:.88,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"íamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"íais",stem:"er",confidence:.88,type:"past"},{ending:"iais",stem:"er",confidence:.85,type:"past"},{ending:"ían",stem:"er",confidence:.88,type:"past"},{ending:"ian",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],fp=[{ending:"iendo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"ís",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"en",stem:"ir",confidence:.78,type:"present"},{ending:"í",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"ió",stem:"ir",confidence:.85,type:"past"},{ending:"io",stem:"ir",confidence:.82,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"isteis",stem:"ir",confidence:.88,type:"past"},{ending:"ieron",stem:"ir",confidence:.88,type:"past"},{ending:"ía",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"ías",stem:"ir",confidence:.88,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"íamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"íais",stem:"ir",confidence:.88,type:"past"},{ending:"iais",stem:"ir",confidence:.85,type:"past"},{ending:"ían",stem:"ir",confidence:.88,type:"past"},{ending:"ian",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],yp=[...dp,...hp,...fp].sort((e,t)=>t.ending.length-e.ending.length),new(vp=class{constructor(){this.language="es"}isNormalizable(e){return!(e.length<3)&&function(e){const t=e.toLowerCase();if(t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))return!0;if(t.endsWith("ando")||t.endsWith("iendo"))return!0;if(t.endsWith("ado")||t.endsWith("ido"))return!0;if(t.endsWith("arse")||t.endsWith("erse")||t.endsWith("irse"))return!0;for(const t of e)if(kp(t))return!0;return!1}(e)}normalize(e){const t=e.toLowerCase();if((t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))&&!mp.some(e=>t.endsWith(e+"ar")||t.endsWith(e+"er")||t.endsWith(e+"ir")))return nc(e);const r=this.tryReflexiveNormalization(t);if(r)return r;const n=this.tryConjugationNormalization(t);return n||nc(e)}tryReflexiveNormalization(e){for(const t of mp)if(e.endsWith(t)){const r=e.slice(0,-t.length);if(r.endsWith("ar")||r.endsWith("er")||r.endsWith("ir"))return ic(r,.88,{removedSuffixes:[t],conjugationType:"reflexive"});const n=this.tryConjugationNormalization(r);if(n&&n.stem!==r)return ic(n.stem,.95*n.confidence,{removedSuffixes:[t,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(e){for(const t of yp)if(e.endsWith(t.ending)){const r=e.slice(0,-t.ending.length);if(r.length<2)continue;return ic(r+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}})}}),zp={};Tl(zp,{spanishProfile:()=>wp});var xp,Ep,Sp,Tp,Cp,Ap,Lp,jp=Sl({"src/generators/profiles/spanish.ts"(){wp={code:"es",name:"Spanish",nativeName:"Español",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!0},references:{me:"yo",it:"ello",you:"tú",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:!0,specialForms:{me:"mi",it:"su",you:"tu"},keywords:{mi:"me",tu:"you",su:"it"}},roleMarkers:{destination:{primary:"en",alternatives:["sobre","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["cambiar","conmutar"],normalized:"toggle"},add:{primary:"agregar",alternatives:["añadir"],normalized:"add"},remove:{primary:"quitar",alternatives:["eliminar","remover","sacar"],normalized:"remove"},put:{primary:"poner",alternatives:["colocar"],normalized:"put"},append:{primary:"añadir",normalized:"append"},prepend:{primary:"anteponer",normalized:"prepend"},take:{primary:"tomar",normalized:"take"},make:{primary:"hacer",alternatives:["crear"],normalized:"make"},clone:{primary:"clonar",alternatives:["copiar"],normalized:"clone"},swap:{primary:"intercambiar",alternatives:["cambiar"],normalized:"swap"},morph:{primary:"transformar",alternatives:["convertir"],normalized:"morph"},set:{primary:"establecer",alternatives:["fijar","definir"],normalized:"set"},get:{primary:"obtener",alternatives:["conseguir"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["disminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["enseñar"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transición",alternatives:["animar"],normalized:"transition"},on:{primary:"en",alternatives:["cuando","al"],normalized:"on"},trigger:{primary:"disparar",alternatives:["activar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"enfocar",normalized:"focus"},blur:{primary:"desenfocar",normalized:"blur"},click:{primary:"clic",alternatives:["hacer clic"],normalized:"click"},hover:{primary:"sobrevolar",alternatives:["pasar por encima"],normalized:"hover"},submit:{primary:"envío",alternatives:["enviar"],normalized:"submit"},input:{primary:"entrada",alternatives:["introducir"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiar"],normalized:"change"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},wait:{primary:"esperar",normalized:"wait"},fetch:{primary:"buscar",alternatives:["obtener"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"cuando",normalized:"when"},where:{primary:"donde",normalized:"where"},else:{primary:"sino",alternatives:["de lo contrario"],normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"mientras",normalized:"while"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"detener",alternatives:["parar"],normalized:"halt"},throw:{primary:"lanzar",alternatives:["arrojar"],normalized:"throw"},call:{primary:"llamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"entonces",alternatives:["luego","después"],normalized:"then"},and:{primary:"y",alternatives:["además","también"],normalized:"and"},end:{primary:"fin",alternatives:["final","terminar"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asíncrono",normalized:"async"},tell:{primary:"decir",normalized:"tell"},default:{primary:"predeterminar",alternatives:["por defecto"],normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamiento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},into:{primary:"en",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"después",normalized:"after"},until:{primary:"hasta",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"}},eventHandler:{keyword:{primary:"al",alternatives:["cuando","en"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},eventMarker:{primary:"al",alternatives:["cuando"],position:"before"},temporalMarkers:["cuando","al"]}}}}),Pp={};Tl(Pp,{SpanishTokenizer:()=>Ap,spanishTokenizer:()=>Lp});var Np,Op=Sl({"src/tokenizers/spanish.ts"(){rc(),bp(),jp(),({isLetter:xp,isIdentifierChar:Ep}=Ql(/[a-zA-ZáéíóúüñÁÉÍÓÚÜÑ]/)),Sp=[{pattern:"milisegundos",suffix:"ms",length:12,caseInsensitive:!0},{pattern:"milisegundo",suffix:"ms",length:11,caseInsensitive:!0},{pattern:"segundos",suffix:"s",length:8,caseInsensitive:!0},{pattern:"segundo",suffix:"s",length:7,caseInsensitive:!0},{pattern:"minutos",suffix:"m",length:7,caseInsensitive:!0},{pattern:"minuto",suffix:"m",length:6,caseInsensitive:!0},{pattern:"horas",suffix:"h",length:5,caseInsensitive:!0},{pattern:"hora",suffix:"h",length:4,caseInsensitive:!0}],Tp=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","después","despues","dentro","fuera","al","del"]),Cp=[{native:"verdadero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primero",normalized:"first"},{native:"primera",normalized:"first"},{native:"último",normalized:"last"},{native:"ultima",normalized:"last"},{native:"siguiente",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"cercano",normalized:"closest"},{native:"padre",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"hacer clic",normalized:"click"},{native:"entrada",normalized:"input"},{native:"cambio",normalized:"change"},{native:"envío",normalized:"submit"},{native:"envio",normalized:"submit"},{native:"tecla abajo",normalized:"keydown"},{native:"tecla arriba",normalized:"keyup"},{native:"ratón encima",normalized:"mouseover"},{native:"raton encima",normalized:"mouseover"},{native:"ratón fuera",normalized:"mouseout"},{native:"raton fuera",normalized:"mouseout"},{native:"enfoque",normalized:"focus"},{native:"desenfoque",normalized:"blur"},{native:"carga",normalized:"load"},{native:"desplazamiento",normalized:"scroll"},{native:"yo",normalized:"me"},{native:"mí",normalized:"me"},{native:"mi",normalized:"me"},{native:"ello",normalized:"it"},{native:"resultado",normalized:"result"},{native:"objetivo",normalized:"target"},{native:"destino",normalized:"target"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milisegundo",normalized:"ms"},{native:"milisegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"de lo contrario",normalized:"else"},{native:"hasta que",normalized:"until"},{native:"antes de",normalized:"before"},{native:"después de",normalized:"after"},{native:"despues de",normalized:"after"},{native:"dentro de",normalized:"into"},{native:"fuera de",normalized:"out"},{native:"asincrono",normalized:"async"},{native:"despues",normalized:"after"},{native:"añadir",normalized:"add"},{native:"toggle",normalized:"toggle"},{native:"borrar",normalized:"remove"},{native:"pon",normalized:"put"},{native:"crear",normalized:"make"},{native:"y",normalized:"and"},{native:"o",normalized:"or"},{native:"no",normalized:"not"},{native:"es",normalized:"is"},{native:"existe",normalized:"exists"},{native:"vacío",normalized:"empty"},{native:"vacio",normalized:"empty"}],Lp=new(Ap=class extends Dl{constructor(){super(),this.language="es",this.direction="ltr",this.initializeKeywordsFromProfile(wp,Cp),this.normalizer=new vp}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractSpanishNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.tryMultiWordPhrase(e,r);if(i){t.push(i),r=i.position.end;continue}if(xp(e[r])){const n=this.extractSpanishWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const a=this.tryOperator(e,r);a?(t.push(a),r=a.position.end):r++}return new Wl(t,"es")}classifyToken(e){const t=e.toLowerCase();return Tp.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}tryMultiWordPhrase(e,t){for(const r of this.profileKeywords){if(!r.native.includes(" "))continue;const n=r.native;if(e.slice(t,t+n.length).toLowerCase()===n.toLowerCase()){const i=t+n.length;if(i>=e.length||Ul(e[i])||!xp(e[i]))return Fl(e.slice(t,t+n.length),"keyword",Hl(t,i),r.normalized)}}return null}extractSpanishWord(e,t){let r=t,n="";for(;r<e.length&&Ep(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase();if(Tp.has(i))return Fl(n,"particle",Hl(t,r));const a=this.lookupKeyword(i);if(a)return Fl(n,"keyword",Hl(t,r),a.normalized);const o=this.tryMorphKeywordMatch(i,t,r);return o||Fl(n,"identifier",Hl(t,r))}extractSpanishNumber(e,t){return this.tryNumberWithTimeUnits(e,t,Sp,{allowSign:!0,skipWhitespace:!0})}})}}),Ip={};Tl(Ip,{frenchProfile:()=>Np});var Rp,Mp,qp,_p,$p,Wp,Vp,Dp=Sl({"src/generators/profiles/french.ts"(){Np={code:"fr",name:"French",nativeName:"Français",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!1},references:{me:"moi",it:"il",you:"toi",result:"résultat",event:"événement",target:"cible",body:"corps"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:!0,specialForms:{me:"ma",it:"sa",you:"ta"},keywords:{mon:"me",ma:"me",mes:"me",ton:"you",ta:"you",tes:"you",son:"it",sa:"it",ses:"it"}},roleMarkers:{destination:{primary:"sur",alternatives:["à","dans"],position:"before"},source:{primary:"de",alternatives:["depuis"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"avec",position:"before"}},keywords:{toggle:{primary:"basculer",alternatives:["permuter","alterner"],normalized:"toggle"},add:{primary:"ajouter",normalized:"add"},remove:{primary:"supprimer",alternatives:["enlever","retirer"],normalized:"remove"},put:{primary:"mettre",alternatives:["placer"],normalized:"put"},append:{primary:"annexer",normalized:"append"},prepend:{primary:"préfixer",normalized:"prepend"},take:{primary:"prendre",normalized:"take"},make:{primary:"faire",alternatives:["créer"],normalized:"make"},clone:{primary:"cloner",alternatives:["copier"],normalized:"clone"},swap:{primary:"échanger",alternatives:["permuter"],normalized:"swap"},morph:{primary:"transformer",alternatives:["métamorphoser"],normalized:"morph"},set:{primary:"définir",alternatives:["établir"],normalized:"set"},get:{primary:"obtenir",normalized:"get"},increment:{primary:"incrémenter",alternatives:["augmenter"],normalized:"increment"},decrement:{primary:"décrémenter",alternatives:["diminuer"],normalized:"decrement"},log:{primary:"enregistrer",alternatives:["afficher"],normalized:"log"},show:{primary:"montrer",alternatives:["afficher"],normalized:"show"},hide:{primary:"cacher",alternatives:["masquer"],normalized:"hide"},transition:{primary:"transition",alternatives:["animer"],normalized:"transition"},on:{primary:"sur",alternatives:["quand","lors"],normalized:"on"},trigger:{primary:"déclencher",normalized:"trigger"},send:{primary:"envoyer",normalized:"send"},focus:{primary:"focaliser",alternatives:["concentrer"],normalized:"focus"},blur:{primary:"défocaliser",normalized:"blur"},go:{primary:"aller",alternatives:["naviguer"],normalized:"go"},wait:{primary:"attendre",normalized:"wait"},fetch:{primary:"chercher",alternatives:["récupérer"],normalized:"fetch"},settle:{primary:"stabiliser",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"quand",normalized:"when"},where:{primary:"où",normalized:"where"},else:{primary:"sinon",normalized:"else"},repeat:{primary:"répéter",normalized:"repeat"},for:{primary:"pour",normalized:"for"},while:{primary:"pendant",normalized:"while"},continue:{primary:"continuer",normalized:"continue"},halt:{primary:"arrêter",alternatives:["stopper"],normalized:"halt"},throw:{primary:"lancer",normalized:"throw"},call:{primary:"appeler",normalized:"call"},return:{primary:"retourner",alternatives:["renvoyer"],normalized:"return"},then:{primary:"puis",alternatives:["ensuite","alors"],normalized:"then"},and:{primary:"et",alternatives:["aussi","également"],normalized:"and"},end:{primary:"fin",alternatives:["terminer","finir"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asynchrone",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"défaut",normalized:"default"},init:{primary:"initialiser",normalized:"init"},behavior:{primary:"comportement",normalized:"behavior"},install:{primary:"installer",normalized:"install"},measure:{primary:"mesurer",normalized:"measure"},into:{primary:"dans",normalized:"into"},before:{primary:"avant",normalized:"before"},after:{primary:"après",normalized:"after"},click:{primary:"clic",alternatives:["clique"],normalized:"click"},hover:{primary:"survol",alternatives:["survoler"],normalized:"hover"},submit:{primary:"soumission",alternatives:["soumettre"],normalized:"submit"},input:{primary:"saisie",alternatives:["entrée"],normalized:"input"},change:{primary:"changement",alternatives:["modifier"],normalized:"change"},until:{primary:"jusqu'à",alternatives:["jusque"],normalized:"until"},event:{primary:"événement",normalized:"event"},from:{primary:"de",alternatives:["depuis"],normalized:"from"}},eventHandler:{keyword:{primary:"sur",alternatives:["lors"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["depuis"],position:"before"},conditionalKeyword:{primary:"quand",alternatives:["lorsque"]},eventMarker:{primary:"au",alternatives:["lors du","lors de"],position:"before"},temporalMarkers:["quand","lorsque"]}}}}),Bp={};Tl(Bp,{FrenchTokenizer:()=>Wp,frenchTokenizer:()=>Vp});var Hp,Fp,Up,Kp,Gp,Yp,Xp,Zp,Jp,Qp,em=Sl({"src/tokenizers/french.ts"(){rc(),Dp(),({isLetter:Rp,isIdentifierChar:Mp}=Ql(/[a-zA-ZàâäéèêëîïôùûüçœæÀÂÄÉÈÊËÎÏÔÙÛÜÇŒÆ]/)),qp=new Set(["à","a","de","du","des","dans","sur","sous","avec","sans","par","pour","entre","avant","après","apres","depuis","vers","chez","contre","au","aux"]),_p=[{native:"vrai",normalized:"true"},{native:"faux",normalized:"false"},{native:"nul",normalized:"null"},{native:"indéfini",normalized:"undefined"},{native:"indefini",normalized:"undefined"},{native:"premier",normalized:"first"},{native:"première",normalized:"first"},{native:"premiere",normalized:"first"},{native:"dernier",normalized:"last"},{native:"dernière",normalized:"last"},{native:"derniere",normalized:"last"},{native:"suivant",normalized:"next"},{native:"précédent",normalized:"previous"},{native:"precedent",normalized:"previous"},{native:"plus proche",normalized:"closest"},{native:"parent",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"entrée",normalized:"input"},{native:"entree",normalized:"input"},{native:"changement",normalized:"change"},{native:"soumission",normalized:"submit"},{native:"touche bas",normalized:"keydown"},{native:"touche haut",normalized:"keyup"},{native:"souris dessus",normalized:"mouseover"},{native:"souris dehors",normalized:"mouseout"},{native:"focus",normalized:"focus"},{native:"flou",normalized:"blur"},{native:"chargement",normalized:"load"},{native:"défilement",normalized:"scroll"},{native:"defilement",normalized:"scroll"},{native:"je",normalized:"me"},{native:"mon",normalized:"my"},{native:"ma",normalized:"my"},{native:"mes",normalized:"my"},{native:"ça",normalized:"it"},{native:"ca",normalized:"it"},{native:"resultat",normalized:"result"},{native:"evenement",normalized:"event"},{native:"seconde",normalized:"s"},{native:"secondes",normalized:"s"},{native:"milliseconde",normalized:"ms"},{native:"millisecondes",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minutes",normalized:"m"},{native:"heure",normalized:"h"},{native:"heures",normalized:"h"},{native:"prefixer",normalized:"prepend"},{native:"creer",normalized:"make"},{native:"definir",normalized:"set"},{native:"etablir",normalized:"set"},{native:"incrementer",normalized:"increment"},{native:"decrementer",normalized:"decrement"},{native:"declencher",normalized:"trigger"},{native:"defocaliser",normalized:"blur"},{native:"recuperer",normalized:"fetch"},{native:"repeter",normalized:"repeat"},{native:"arreter",normalized:"halt"},{native:"defaut",normalized:"default"},{native:"jusqua",normalized:"until"},{native:"apres",normalized:"after"},{native:"journaliser",normalized:"log"},{native:"transmuter",normalized:"morph"},{native:"tant que",normalized:"while"}],$p=[{pattern:"millisecondes",suffix:"ms",length:13,caseInsensitive:!0},{pattern:"milliseconde",suffix:"ms",length:12,caseInsensitive:!0},{pattern:"secondes",suffix:"s",length:8,caseInsensitive:!0},{pattern:"seconde",suffix:"s",length:7,caseInsensitive:!0},{pattern:"minutes",suffix:"m",length:7,caseInsensitive:!0},{pattern:"minute",suffix:"m",length:6,caseInsensitive:!0},{pattern:"heures",suffix:"h",length:6,caseInsensitive:!0},{pattern:"heure",suffix:"h",length:5,caseInsensitive:!0}],Vp=new(Wp=class extends Dl{constructor(){super(),this.language="fr",this.direction="ltr",this.initializeKeywordsFromProfile(Np,_p)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(Rp(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"fr")}classifyToken(e){const t=e.toLowerCase();return qp.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&Mp(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):qp.has(i)?Fl(n,"particle",Hl(t,r)):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){return this.tryNumberWithTimeUnits(e,t,$p,{allowSign:!0,skipWhitespace:!0})}})}}),tm=Sl({"src/generators/profiles/hebrew.ts"(){Hp={code:"he",name:"Hebrew",nativeName:"עברית",direction:"rtl",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"second",subjectDrop:!0},references:{me:"אני",it:"זה",you:"אתה",result:"תוצאה",event:"אירוע",target:"יעד",body:"גוף"},possessive:{marker:"של",markerPosition:"before-property",usePossessiveAdjectives:!0,specialForms:{me:"שלי",it:"שלו",you:"שלך"},keywords:{"שלי":"me","שלך":"you","שלו":"it","שלה":"it"}},roleMarkers:{destination:{primary:"על",alternatives:["ב","אל","ל"],position:"before"},source:{primary:"מ",alternatives:["מן","מאת"],position:"before"},patient:{primary:"את",position:"before"},style:{primary:"עם",alternatives:["ב"],position:"before"}},keywords:{toggle:{primary:"החלף",alternatives:["שנה","הפוך"],normalized:"toggle"},add:{primary:"הוסף",alternatives:["הכנס"],normalized:"add"},remove:{primary:"הסר",alternatives:["מחק","הורד"],normalized:"remove"},put:{primary:"שים",alternatives:["הנח","הכנס"],normalized:"put"},append:{primary:"צרף",alternatives:["הוסף בסוף"],normalized:"append"},prepend:{primary:"הקדם",alternatives:["הוסף בהתחלה"],normalized:"prepend"},take:{primary:"קח",normalized:"take"},make:{primary:"צור",alternatives:["הכן"],normalized:"make"},clone:{primary:"שכפל",alternatives:["העתק"],normalized:"clone"},swap:{primary:"החלף",alternatives:["המר"],normalized:"swap"},morph:{primary:"הפוך",alternatives:["שנה"],normalized:"morph"},set:{primary:"קבע",alternatives:["הגדר"],normalized:"set"},get:{primary:"קבל",alternatives:["השג"],normalized:"get"},increment:{primary:"הגדל",alternatives:["הוסף אחד"],normalized:"increment"},decrement:{primary:"הקטן",alternatives:["הפחת"],normalized:"decrement"},log:{primary:"רשום",normalized:"log"},show:{primary:"הראה",alternatives:["הצג"],normalized:"show"},hide:{primary:"הסתר",alternatives:["החבא"],normalized:"hide"},transition:{primary:"מעבר",alternatives:["הנפש"],normalized:"transition"},on:{primary:"ב",alternatives:["כש","כאשר","עם"],normalized:"on"},trigger:{primary:"הפעל",alternatives:["שגר"],normalized:"trigger"},send:{primary:"שלח",normalized:"send"},focus:{primary:"מקד",alternatives:["התמקד"],normalized:"focus"},blur:{primary:"טשטש",alternatives:["הסר מיקוד"],normalized:"blur"},go:{primary:"לך",alternatives:["נווט","עבור"],normalized:"go"},wait:{primary:"חכה",alternatives:["המתן"],normalized:"wait"},fetch:{primary:"הבא",alternatives:["טען"],normalized:"fetch"},settle:{primary:"התייצב",normalized:"settle"},if:{primary:"אם",normalized:"if"},when:{primary:"כאשר",alternatives:["כש"],normalized:"when"},where:{primary:"איפה",alternatives:["היכן"],normalized:"where"},else:{primary:"אחרת",alternatives:["אם לא"],normalized:"else"},repeat:{primary:"חזור",normalized:"repeat"},for:{primary:"עבור",alternatives:["לכל"],normalized:"for"},while:{primary:"כל עוד",alternatives:["בזמן"],normalized:"while"},continue:{primary:"המשך",normalized:"continue"},halt:{primary:"עצור",alternatives:["הפסק"],normalized:"halt"},throw:{primary:"זרוק",normalized:"throw"},call:{primary:"קרא",alternatives:["הפעל"],normalized:"call"},return:{primary:"החזר",alternatives:["חזור"],normalized:"return"},then:{primary:"אז",alternatives:["אחרי","ואז"],normalized:"then"},and:{primary:"וגם",alternatives:["גם"],normalized:"and"},end:{primary:"סוף",alternatives:["סיום"],normalized:"end"},js:{primary:"js",alternatives:["ג׳אווהסקריפט"],normalized:"js"},async:{primary:"אסינכרוני",normalized:"async"},tell:{primary:"אמור",normalized:"tell"},default:{primary:"ברירת מחדל",normalized:"default"},init:{primary:"אתחל",alternatives:["התחל"],normalized:"init"},behavior:{primary:"התנהגות",normalized:"behavior"},install:{primary:"התקן",normalized:"install"},measure:{primary:"מדוד",normalized:"measure"},into:{primary:"לתוך",alternatives:["אל"],normalized:"into"},before:{primary:"לפני",normalized:"before"},after:{primary:"אחרי",normalized:"after"},click:{primary:"לחיצה",alternatives:["קליק"],normalized:"click"},hover:{primary:"ריחוף",alternatives:["מעבר"],normalized:"hover"},submit:{primary:"שליחה",alternatives:["הגשה"],normalized:"submit"},input:{primary:"קלט",alternatives:["הזנה"],normalized:"input"},change:{primary:"שינוי",alternatives:["עדכון"],normalized:"change"},until:{primary:"עד",normalized:"until"},event:{primary:"אירוע",normalized:"event"},from:{primary:"מ",alternatives:["מאת"],normalized:"from"}},tokenization:{prefixes:["ה","ו","ב","כ","ל","מ","ש"]},eventHandler:{keyword:{primary:"ב",alternatives:["כש","כאשר","עם"],normalized:"on"},sourceMarker:{primary:"מ",alternatives:["מאת"],position:"before"},conditionalKeyword:{primary:"כאשר",alternatives:["כש","אם"]},eventMarker:{primary:"ב",alternatives:["כש","עם"],position:"before"},temporalMarkers:["כאשר","כש","עם"]}}}}),rm=Sl({"src/tokenizers/he.ts"(){rc(),tm(),Fp=Zl([[1424,1535],[64285,64335]]),Up=new Map([["ו","and"]]),Kp=new Map([["ב","on"],["כ","when"]]),Gp=new Set(["לחיצה","קליק","שליחה","הגשה","ריחוף","מעבר","שינוי","עדכון","קלט","הזנה","מיקוד","טשטוש","טעינה","גלילה"]),Yp=new Set(["על","את","אל","מן","עם","בתוך","מתוך","ליד","אחרי","לפני","בין","עד","של"]),Xp=[{native:"אמת",normalized:"true"},{native:"שקר",normalized:"false"},{native:"null",normalized:"null"},{native:"ריק",normalized:"null"},{native:"לא מוגדר",normalized:"undefined"},{native:"ראשון",normalized:"first"},{native:"אחרון",normalized:"last"},{native:"הבא",normalized:"next"},{native:"הקודם",normalized:"previous"},{native:"הקרוב",normalized:"closest"},{native:"הורה",normalized:"parent"},{native:"לחיצה",normalized:"click"},{native:"קליק",normalized:"click"},{native:"קלט",normalized:"input"},{native:"שינוי",normalized:"change"},{native:"שליחה",normalized:"submit"},{native:"מיקוד",normalized:"focus"},{native:"טשטוש",normalized:"blur"},{native:"לחיצת מקש",normalized:"keydown"},{native:"שחרור מקש",normalized:"keyup"},{native:"מעבר עכבר",normalized:"mouseover"},{native:"יציאת עכבר",normalized:"mouseout"},{native:"טעינה",normalized:"load"},{native:"גלילה",normalized:"scroll"},{native:"היא",normalized:"it"},{native:"הוא",normalized:"it"},{native:"את",normalized:"you"},{native:"שנייה",normalized:"s"},{native:"שניות",normalized:"s"},{native:"מילישנייה",normalized:"ms"},{native:"דקה",normalized:"m"},{native:"דקות",normalized:"m"},{native:"שעה",normalized:"h"},{native:"שעות",normalized:"h"}],Zp=[{pattern:"מילישנייה",suffix:"ms",length:8,caseInsensitive:!1},{pattern:"מילישניות",suffix:"ms",length:9,caseInsensitive:!1},{pattern:"שניות",suffix:"s",length:5,caseInsensitive:!1},{pattern:"שנייה",suffix:"s",length:5,caseInsensitive:!1},{pattern:"דקות",suffix:"m",length:4,caseInsensitive:!1},{pattern:"דקה",suffix:"m",length:3,caseInsensitive:!1},{pattern:"שעות",suffix:"h",length:4,caseInsensitive:!1},{pattern:"שעה",suffix:"h",length:3,caseInsensitive:!1}],Jp=new class extends Dl{constructor(){super(),this.language="he",this.direction="rtl",this.initializeKeywordsFromProfile(Hp,Xp)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])){const n=this.extractHebrewNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.tryPreposition(e,r);if(i)t.push(i),r=i.position.end;else{if(Fp(e[r])){const n=this.tryEventMarkerPrefix(e,r);if(n){t.push(n.marker),t.push(n.event),r=n.event.position.end;continue}const i=this.tryPrefixConjunction(e,r);if(i){t.push(i.conjunction),r=i.conjunction.position.end;continue}const a=this.extractHebrewWord(e,r);if(a){t.push(a),r=a.position.end;continue}}if(Xl(e[r])){const n=this.extractAsciiWord(e,r);if(n){t.push(n),r=n.position.end;continue}}r++}}return new Wl(t,"he")}classifyToken(e){return Yp.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}tryPreposition(e,t){const r=Array.from(Yp).sort((e,t)=>t.length-e.length);for(const n of r)if(e.slice(t,t+n.length)===n){const r=t+n.length;if(r>=e.length||Ul(e[r])||!Fp(e[r])){return{...Fl(n,"particle",Hl(t,r)),metadata:{prepositionValue:n}}}}return null}tryPrefixConjunction(e,t){let r=t;for(;r<e.length&&Fp(e[r]);)r++;const n=e.slice(t,r);if(this.lookupKeyword(n))return null;if(Yp.has(n))return null;const i=e[t],a=Up.get(i);if(!a)return null;const o=t+1;if(o>=e.length||!Fp(e[o]))return null;let s=0,l=o;for(;l<e.length&&Fp(e[l]);)s++,l++;if(s<2)return null;const c=e.slice(o,r);return this.lookupKeyword(c)?{conjunction:Fl(i,"conjunction",Hl(t,o),a)}:null}tryEventMarkerPrefix(e,t){const r=e[t],n=Kp.get(r);if(!n)return null;const i=t+1;if(i>=e.length||!Fp(e[i]))return null;let a=i;for(;a<e.length&&Fp(e[a]);)a++;const o=e.slice(i,a);if(Gp.has(o)){const e=Fl(r,"keyword",Hl(t,i),n),s=this.lookupKeyword(o);return{marker:e,event:s?Fl(o,"keyword",Hl(i,a),s.normalized):Fl(o,"keyword",Hl(i,a))}}return null}extractHebrewWord(e,t){let r=t,n="";for(;r<e.length&&Fp(e[r]);)n+=e[r++];if(!n)return null;const i=this.lookupKeyword(n);if(i)return Fl(n,"keyword",Hl(t,r),i.normalized);if(Yp.has(n)){return{...Fl(n,"particle",Hl(t,r)),metadata:{prepositionValue:n}}}const a=this.tryMorphKeywordMatch(n,t,r);return a||Fl(n,"identifier",Hl(t,r))}extractAsciiWord(e,t){let r=t,n="";for(;r<e.length&&Xl(e[r]);)n+=e[r++];return n?Fl(n,"identifier",Hl(t,r)):null}extractHebrewNumber(e,t){return this.tryNumberWithTimeUnits(e,t,Zp,{allowSign:!1,skipWhitespace:!0})}}}}),nm={};Tl(nm,{hindiProfile:()=>Qp});var im,am,om,sm,lm,cm,um=Sl({"src/generators/profiles/hindi.ts"(){Qp={code:"hi",name:"Hindi",nativeName:"हिन्दी",direction:"ltr",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:!0,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["ें","ा","ी","े","ो"],subjectDrop:!0},references:{me:"मैं",it:"यह",you:"आप",result:"परिणाम",event:"घटना",target:"लक्ष्य",body:"बॉडी"},possessive:{marker:"का",markerPosition:"between",keywords:{"मेरा":"me","मेरी":"me","मेरे":"me","तेरा":"you","तेरी":"you","तेरे":"you","आपका":"you","आपकी":"you","आपके":"you","उसका":"it","उसकी":"it","उसके":"it","इसका":"it","इसकी":"it","इसके":"it"}},roleMarkers:{patient:{primary:"को",position:"after"},destination:{primary:"में",alternatives:["को","पर"],position:"after"},source:{primary:"से",position:"after"},style:{primary:"से",position:"after"},event:{primary:"पर",position:"after"}},keywords:{toggle:{primary:"टॉगल",alternatives:["बदलें","बदल"],normalized:"toggle"},add:{primary:"जोड़ें",alternatives:["जोड़"],normalized:"add"},remove:{primary:"हटाएं",alternatives:["हटा","मिटाएं"],normalized:"remove"},put:{primary:"रखें",alternatives:["रख","डालें","डाल"],normalized:"put"},append:{primary:"जोड़ें_अंत",alternatives:[],normalized:"append"},prepend:{primary:"जोड़ें_शुरू",alternatives:[],normalized:"prepend"},take:{primary:"लें",alternatives:["ले"],normalized:"take"},make:{primary:"बनाएं",alternatives:["बना"],normalized:"make"},clone:{primary:"कॉपी",alternatives:["प्रतिलिपि"],normalized:"clone"},swap:{primary:"बदलें_स्थान",alternatives:[],normalized:"swap"},morph:{primary:"रूपांतर",alternatives:[],normalized:"morph"},set:{primary:"सेट",alternatives:["निर्धारित"],normalized:"set"},get:{primary:"प्राप्त",alternatives:["पाएं"],normalized:"get"},increment:{primary:"बढ़ाएं",alternatives:["बढ़ा"],normalized:"increment"},decrement:{primary:"घटाएं",alternatives:["घटा"],normalized:"decrement"},log:{primary:"लॉग",alternatives:["दर्ज"],normalized:"log"},show:{primary:"दिखाएं",alternatives:["दिखा"],normalized:"show"},hide:{primary:"छिपाएं",alternatives:["छिपा"],normalized:"hide"},transition:{primary:"संक्रमण",alternatives:[],normalized:"transition"},on:{primary:"पर",alternatives:["में","जब"],normalized:"on"},trigger:{primary:"ट्रिगर",alternatives:[],normalized:"trigger"},send:{primary:"भेजें",alternatives:["भेज"],normalized:"send"},focus:{primary:"फोकस",alternatives:["केंद्रित"],normalized:"focus"},blur:{primary:"धुंधला",alternatives:["फोकस_हटाएं"],normalized:"blur"},click:{primary:"क्लिक",normalized:"click"},hover:{primary:"होवर",alternatives:["ऊपर_रखें"],normalized:"hover"},submit:{primary:"सबमिट",alternatives:["जमा"],normalized:"submit"},input:{primary:"इनपुट",alternatives:["दर्ज"],normalized:"input"},change:{primary:"बदलाव",alternatives:["परिवर्तन"],normalized:"change"},go:{primary:"जाएं",alternatives:["जा"],normalized:"go"},wait:{primary:"प्रतीक्षा",alternatives:["रुकें"],normalized:"wait"},fetch:{primary:"लाएं",alternatives:[],normalized:"fetch"},settle:{primary:"स्थिर",alternatives:[],normalized:"settle"},if:{primary:"अगर",alternatives:["यदि"],normalized:"if"},when:{primary:"जब",normalized:"when"},where:{primary:"कहाँ",normalized:"where"},else:{primary:"वरना",alternatives:["नहीं तो"],normalized:"else"},repeat:{primary:"दोहराएं",alternatives:["दोहरा"],normalized:"repeat"},for:{primary:"के लिए",alternatives:[],normalized:"for"},while:{primary:"जब तक",alternatives:[],normalized:"while"},continue:{primary:"जारी",alternatives:[],normalized:"continue"},halt:{primary:"रोकें",alternatives:["रोक"],normalized:"halt"},throw:{primary:"फेंकें",alternatives:["फेंक"],normalized:"throw"},call:{primary:"कॉल",alternatives:["बुलाएं"],normalized:"call"},return:{primary:"लौटाएं",alternatives:["लौटा"],normalized:"return"},then:{primary:"फिर",alternatives:["तब"],normalized:"then"},and:{primary:"और",alternatives:[],normalized:"and"},end:{primary:"समाप्त",alternatives:["अंत"],normalized:"end"},js:{primary:"जेएस",alternatives:["js"],normalized:"js"},async:{primary:"असिंक",alternatives:[],normalized:"async"},tell:{primary:"बताएं",alternatives:["बता"],normalized:"tell"},default:{primary:"डिफ़ॉल्ट",alternatives:[],normalized:"default"},init:{primary:"प्रारंभ",alternatives:[],normalized:"init"},behavior:{primary:"व्यवहार",alternatives:[],normalized:"behavior"},install:{primary:"इंस्टॉल",alternatives:[],normalized:"install"},measure:{primary:"मापें",alternatives:[],normalized:"measure"},into:{primary:"में",alternatives:["को"],normalized:"into"},before:{primary:"से पहले",alternatives:["पहले"],normalized:"before"},after:{primary:"के बाद",alternatives:["बाद"],normalized:"after"},until:{primary:"तक",alternatives:[],normalized:"until"},event:{primary:"घटना",alternatives:[],normalized:"event"},from:{primary:"से",normalized:"from"}},tokenization:{particles:["को","में","पर","से","का","की","के","तक","ने"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"पर",alternatives:["में","जब"],normalized:"on"},sourceMarker:{primary:"से",position:"after"},eventMarker:{primary:"पर",alternatives:["में"],position:"after"},temporalMarkers:["जब","जब भी"]}}}}),pm={};Tl(pm,{HindiTokenizer:()=>lm,hindiTokenizer:()=>cm});var mm,dm=Sl({"src/tokenizers/hindi.ts"(){rc(),um(),im=Zl([[2304,2431],[43232,43263]]),am=im,om=new Set(["को","में","पर","से","का","की","के","तक","ने"]),sm=[{native:"सच",normalized:"true"},{native:"सत्य",normalized:"true"},{native:"झूठ",normalized:"false"},{native:"असत्य",normalized:"false"},{native:"खाली",normalized:"null"},{native:"अपरिभाषित",normalized:"undefined"},{native:"पहला",normalized:"first"},{native:"अंतिम",normalized:"last"},{native:"अगला",normalized:"next"},{native:"पिछला",normalized:"previous"},{native:"निकटतम",normalized:"closest"},{native:"मूल",normalized:"parent"},{native:"क्लिक",normalized:"click"},{native:"परिवर्तन",normalized:"change"},{native:"जमा",normalized:"submit"},{native:"इनपुट",normalized:"input"},{native:"लोड",normalized:"load"},{native:"स्क्रॉल",normalized:"scroll"},{native:"को",normalized:"to"},{native:"के साथ",normalized:"with"}],cm=new(lm=class extends Dl{constructor(){super(),this.language="hi",this.direction="ltr",this.initializeKeywordsFromProfile(Qp,sm)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}if(":"===e[r]){const n=r;r++;let i="";for(;r<e.length&&(Xl(e[r])||am(e[r]));)i+=e[r],r++;if(i){t.push(Fl(":"+i,"identifier",Hl(n,r),":"+i));continue}r=n}if(am(e[r])){const n=r;let i="";for(;r<e.length&&(am(e[r])||" "===e[r]);){if(" "===e[r]){if(r+1<e.length&&am(e[r+1])){const t=e.slice(r),n=[" के लिए"," के साथ"," के बाद"," से पहले"," नहीं तो"," जब तक"," के बारे में"].find(e=>t.startsWith(e));if(n){i+=n,r+=n.length;continue}}break}i+=e[r],r++}const a=this.lookupKeyword(i);a?t.push(Fl(i,"keyword",Hl(n,r),a.normalized)):om.has(i)?t.push(Fl(i,"particle",Hl(n,r))):t.push(Fl(i,"identifier",Hl(n,r)));continue}if(Xl(e[r])){const n=r;let i="";for(;r<e.length&&Xl(e[r]);)i+=e[r],r++;const a=this.lookupKeyword(i);t.push(Fl(i,a?"keyword":"identifier",Hl(n,r),a?.normalized||i.toLowerCase()));continue}t.push(Fl(e[r],"operator",Hl(r,r+1))),r++}return new Wl(t,this.language)}classifyToken(e){return this.isKeyword(e)?"keyword":om.has(e)?"particle":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}extractNumber(e,t){let r=t,n="";for("-"===e[r]&&(n+="-",r++);r<e.length&&Yl(e[r]);)n+=e[r],r++;if(r<e.length&&"."===e[r])for(n+=".",r++;r<e.length&&Yl(e[r]);)n+=e[r],r++;return"-"===n?null:Fl(n,"literal",Hl(t,r))}})}}),hm={};Tl(hm,{indonesianProfile:()=>mm});var fm,ym,vm,gm,km,wm,bm=Sl({"src/generators/profiles/indonesian.ts"(){mm={code:"id",name:"Indonesian",nativeName:"Bahasa Indonesia",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"start",subjectDrop:!0},references:{me:"saya",it:"itu",you:"anda",result:"hasil",event:"peristiwa",target:"target",body:"tubuh"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,specialForms:{me:"saya",it:"nya",you:"anda"},keywords:{saya:"me",aku:"me",ku:"me",anda:"you",kamu:"you",mu:"you",nya:"it",dia:"it"}},roleMarkers:{destination:{primary:"pada",alternatives:["ke","di"],position:"before"},source:{primary:"dari",position:"before"},patient:{primary:"",position:"before"},style:{primary:"dengan",position:"before"}},keywords:{toggle:{primary:"alihkan",alternatives:["ganti","tukar"],normalized:"toggle"},add:{primary:"tambah",alternatives:["tambahkan"],normalized:"add"},remove:{primary:"hapus",alternatives:["buang","hilangkan"],normalized:"remove"},put:{primary:"taruh",alternatives:["letakkan","masukkan"],normalized:"put"},append:{primary:"sisipkan",normalized:"append"},prepend:{primary:"awali",normalized:"prepend"},take:{primary:"ambil",normalized:"take"},make:{primary:"buat",alternatives:["bikin","ciptakan"],normalized:"make"},clone:{primary:"klon",alternatives:["salin","tiru"],normalized:"clone"},swap:{primary:"tukar",alternatives:["ganti"],normalized:"swap"},morph:{primary:"ubah",alternatives:["transformasi"],normalized:"morph"},set:{primary:"atur",alternatives:["tetapkan"],normalized:"set"},get:{primary:"dapatkan",alternatives:["peroleh"],normalized:"get"},increment:{primary:"tingkatkan",alternatives:["naikkan"],normalized:"increment"},decrement:{primary:"turunkan",alternatives:["kurangi"],normalized:"decrement"},log:{primary:"catat",alternatives:["rekam","cetak"],normalized:"log"},show:{primary:"tampilkan",alternatives:["perlihatkan"],normalized:"show"},hide:{primary:"sembunyikan",alternatives:["tutup"],normalized:"hide"},transition:{primary:"transisi",alternatives:["animasikan"],normalized:"transition"},on:{primary:"pada",alternatives:["saat","ketika"],normalized:"on"},trigger:{primary:"picu",alternatives:["jalankan"],normalized:"trigger"},send:{primary:"kirim",alternatives:["kirimkan"],normalized:"send"},focus:{primary:"fokus",alternatives:["fokuskan"],normalized:"focus"},blur:{primary:"blur",normalized:"blur"},go:{primary:"pergi",alternatives:["pindah","navigasi"],normalized:"go"},wait:{primary:"tunggu",normalized:"wait"},fetch:{primary:"ambil",alternatives:["muat"],normalized:"fetch"},settle:{primary:"stabilkan",normalized:"settle"},if:{primary:"jika",alternatives:["kalau","bila"],normalized:"if"},when:{primary:"ketika",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"selainnya",normalized:"else"},repeat:{primary:"ulangi",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selama",normalized:"while"},continue:{primary:"lanjutkan",alternatives:["terus"],normalized:"continue"},halt:{primary:"hentikan",alternatives:["berhenti"],normalized:"halt"},throw:{primary:"lempar",normalized:"throw"},call:{primary:"panggil",normalized:"call"},return:{primary:"kembalikan",alternatives:["kembali"],normalized:"return"},then:{primary:"lalu",alternatives:["kemudian","setelah itu"],normalized:"then"},and:{primary:"dan",alternatives:["juga","serta"],normalized:"and"},end:{primary:"selesai",alternatives:["akhir","tamat"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asinkron",normalized:"async"},tell:{primary:"katakan",alternatives:["beritahu"],normalized:"tell"},default:{primary:"bawaan",normalized:"default"},init:{primary:"inisialisasi",alternatives:["mulai"],normalized:"init"},behavior:{primary:"perilaku",normalized:"behavior"},install:{primary:"pasang",alternatives:["instal"],normalized:"install"},measure:{primary:"ukur",normalized:"measure"},into:{primary:"ke dalam",normalized:"into"},before:{primary:"sebelum",normalized:"before"},after:{primary:"sesudah",alternatives:["setelah"],normalized:"after"},click:{primary:"klik",alternatives:["tekan"],normalized:"click"},hover:{primary:"hover",alternatives:["arahkan"],normalized:"hover"},submit:{primary:"kirim",alternatives:["submit"],normalized:"submit"},input:{primary:"masuk",alternatives:["input"],normalized:"input"},change:{primary:"ubah",alternatives:["berubah"],normalized:"change"},until:{primary:"sampai",normalized:"until"},event:{primary:"peristiwa",alternatives:["event"],normalized:"event"},from:{primary:"dari",normalized:"from"}},eventHandler:{keyword:{primary:"pada",alternatives:["ketika","saat"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"},conditionalKeyword:{primary:"ketika",alternatives:["saat","waktu"]},eventMarker:{primary:"saat",alternatives:["ketika"],position:"before"},temporalMarkers:["ketika","saat"]}}}}),zm={};Tl(zm,{IndonesianTokenizer:()=>km,indonesianTokenizer:()=>wm});var xm,Em,Sm,Tm,Cm,Am,Lm=Sl({"src/tokenizers/indonesian.ts"(){rc(),bm(),({isLetter:fm,isIdentifierChar:ym}=Ql(/[a-zA-Z]/)),vm=new Set(["di","ke","dari","pada","dengan","tanpa","untuk","oleh","antara","sebelum","sesudah","setelah","selama","sampai","hingga","sejak","menuju","tentang","terhadap","melalui","dalam","luar"]),gm=[{native:"benar",normalized:"true"},{native:"salah",normalized:"false"},{native:"null",normalized:"null"},{native:"kosong",normalized:"null"},{native:"tidak terdefinisi",normalized:"undefined"},{native:"pertama",normalized:"first"},{native:"terakhir",normalized:"last"},{native:"selanjutnya",normalized:"next"},{native:"berikutnya",normalized:"next"},{native:"sebelumnya",normalized:"previous"},{native:"terdekat",normalized:"closest"},{native:"induk",normalized:"parent"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"masukan",normalized:"input"},{native:"input",normalized:"input"},{native:"perubahan",normalized:"change"},{native:"tombol turun",normalized:"keydown"},{native:"tombol naik",normalized:"keyup"},{native:"mouse masuk",normalized:"mouseover"},{native:"mouse keluar",normalized:"mouseout"},{native:"gulir",normalized:"scroll"},{native:"aku",normalized:"me"},{native:"ini",normalized:"me"},{native:"milikku",normalized:"my"},{native:"dia",normalized:"it"},{native:"kejadian",normalized:"event"},{native:"sasaran",normalized:"target"},{native:"detik",normalized:"s"},{native:"milidetik",normalized:"ms"},{native:"menit",normalized:"m"},{native:"jam",normalized:"h"},{native:"jika tidak",normalized:"else"},{native:"hilangkan fokus",normalized:"blur"},{native:"maka",normalized:"then"}],wm=new(km=class extends Dl{constructor(){super(),this.language="id",this.direction="ltr",this.initializeKeywordsFromProfile(mm,gm)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(fm(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"id")}classifyToken(e){const t=e.toLowerCase();return vm.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&ym(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):vm.has(i)?Fl(n,"particle",Hl(t,r)):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){let r=t,n="";for("-"!==e[r]&&"+"!==e[r]||(n+=e[r++]);r<e.length&&Yl(e[r]);)n+=e[r++];if(r<e.length&&"."===e[r])for(n+=e[r++];r<e.length&&Yl(e[r]);)n+=e[r++];let i=r;for(;i<e.length&&Ul(e[i]);)i++;const a=e.slice(i).toLowerCase();return a.startsWith("milidetik")?(n+="ms",r=i+9):a.startsWith("detik")?(n+="s",r=i+5):a.startsWith("menit")?(n+="m",r=i+5):a.startsWith("jam")&&(n+="h",r=i+3),n&&"-"!==n&&"+"!==n?Fl(n,"literal",Hl(t,r)):null}})}});function jm(e){return/[àèéìíîòóùúÀÈÉÌÍÎÒÓÙÚ]/.test(e)}var Pm,Nm=Sl({"src/tokenizers/morphology/italian-normalizer.ts"(){uc(),xm=["si","mi","ti","ci","vi"],Em=[{ending:"ando",stem:"are",confidence:.88,type:"gerund"},{ending:"ato",stem:"are",confidence:.88,type:"participle"},{ending:"ata",stem:"are",confidence:.88,type:"participle"},{ending:"ati",stem:"are",confidence:.88,type:"participle"},{ending:"ate",stem:"are",confidence:.88,type:"participle"},{ending:"o",stem:"are",confidence:.75,type:"present"},{ending:"i",stem:"are",confidence:.72,type:"present"},{ending:"a",stem:"are",confidence:.75,type:"present"},{ending:"iamo",stem:"are",confidence:.85,type:"present"},{ending:"ate",stem:"are",confidence:.85,type:"present"},{ending:"ano",stem:"are",confidence:.85,type:"present"},{ending:"avo",stem:"are",confidence:.88,type:"past"},{ending:"avi",stem:"are",confidence:.88,type:"past"},{ending:"ava",stem:"are",confidence:.88,type:"past"},{ending:"avamo",stem:"are",confidence:.88,type:"past"},{ending:"avate",stem:"are",confidence:.88,type:"past"},{ending:"avano",stem:"are",confidence:.88,type:"past"},{ending:"ai",stem:"are",confidence:.85,type:"past"},{ending:"asti",stem:"are",confidence:.88,type:"past"},{ending:"ò",stem:"are",confidence:.85,type:"past"},{ending:"ammo",stem:"are",confidence:.88,type:"past"},{ending:"aste",stem:"are",confidence:.88,type:"past"},{ending:"arono",stem:"are",confidence:.88,type:"past"},{ending:"i",stem:"are",confidence:.72,type:"subjunctive"},{ending:"ino",stem:"are",confidence:.82,type:"subjunctive"},{ending:"a",stem:"are",confidence:.75,type:"imperative"},{ending:"are",stem:"are",confidence:.92,type:"dictionary"}],Sm=[{ending:"endo",stem:"ere",confidence:.88,type:"gerund"},{ending:"uto",stem:"ere",confidence:.85,type:"participle"},{ending:"uta",stem:"ere",confidence:.85,type:"participle"},{ending:"uti",stem:"ere",confidence:.85,type:"participle"},{ending:"ute",stem:"ere",confidence:.85,type:"participle"},{ending:"o",stem:"ere",confidence:.72,type:"present"},{ending:"i",stem:"ere",confidence:.72,type:"present"},{ending:"e",stem:"ere",confidence:.72,type:"present"},{ending:"iamo",stem:"ere",confidence:.85,type:"present"},{ending:"ete",stem:"ere",confidence:.85,type:"present"},{ending:"ono",stem:"ere",confidence:.82,type:"present"},{ending:"evo",stem:"ere",confidence:.88,type:"past"},{ending:"evi",stem:"ere",confidence:.88,type:"past"},{ending:"eva",stem:"ere",confidence:.88,type:"past"},{ending:"evamo",stem:"ere",confidence:.88,type:"past"},{ending:"evate",stem:"ere",confidence:.88,type:"past"},{ending:"evano",stem:"ere",confidence:.88,type:"past"},{ending:"ei",stem:"ere",confidence:.85,type:"past"},{ending:"etti",stem:"ere",confidence:.85,type:"past"},{ending:"esti",stem:"ere",confidence:.88,type:"past"},{ending:"é",stem:"ere",confidence:.85,type:"past"},{ending:"ette",stem:"ere",confidence:.85,type:"past"},{ending:"emmo",stem:"ere",confidence:.88,type:"past"},{ending:"este",stem:"ere",confidence:.88,type:"past"},{ending:"erono",stem:"ere",confidence:.88,type:"past"},{ending:"ettero",stem:"ere",confidence:.88,type:"past"},{ending:"ere",stem:"ere",confidence:.92,type:"dictionary"}],Tm=[{ending:"endo",stem:"ire",confidence:.85,type:"gerund"},{ending:"ito",stem:"ire",confidence:.85,type:"participle"},{ending:"ita",stem:"ire",confidence:.85,type:"participle"},{ending:"iti",stem:"ire",confidence:.85,type:"participle"},{ending:"ite",stem:"ire",confidence:.85,type:"participle"},{ending:"o",stem:"ire",confidence:.7,type:"present"},{ending:"i",stem:"ire",confidence:.7,type:"present"},{ending:"e",stem:"ire",confidence:.7,type:"present"},{ending:"iamo",stem:"ire",confidence:.85,type:"present"},{ending:"ite",stem:"ire",confidence:.85,type:"present"},{ending:"ono",stem:"ire",confidence:.78,type:"present"},{ending:"isco",stem:"ire",confidence:.85,type:"present"},{ending:"isci",stem:"ire",confidence:.85,type:"present"},{ending:"isce",stem:"ire",confidence:.85,type:"present"},{ending:"iscono",stem:"ire",confidence:.88,type:"present"},{ending:"ivo",stem:"ire",confidence:.88,type:"past"},{ending:"ivi",stem:"ire",confidence:.88,type:"past"},{ending:"iva",stem:"ire",confidence:.88,type:"past"},{ending:"ivamo",stem:"ire",confidence:.88,type:"past"},{ending:"ivate",stem:"ire",confidence:.88,type:"past"},{ending:"ivano",stem:"ire",confidence:.88,type:"past"},{ending:"ii",stem:"ire",confidence:.85,type:"past"},{ending:"isti",stem:"ire",confidence:.88,type:"past"},{ending:"ì",stem:"ire",confidence:.85,type:"past"},{ending:"immo",stem:"ire",confidence:.88,type:"past"},{ending:"iste",stem:"ire",confidence:.88,type:"past"},{ending:"irono",stem:"ire",confidence:.88,type:"past"},{ending:"ire",stem:"ire",confidence:.92,type:"dictionary"}],Cm=[...Em,...Sm,...Tm].sort((e,t)=>t.ending.length-e.ending.length),new(Am=class{constructor(){this.language="it"}isNormalizable(e){return!(e.length<3)&&function(e){const t=e.toLowerCase();if(t.endsWith("are")||t.endsWith("ere")||t.endsWith("ire"))return!0;if(t.endsWith("ando")||t.endsWith("endo"))return!0;if(t.endsWith("ato")||t.endsWith("uto")||t.endsWith("ito"))return!0;if(t.endsWith("arsi")||t.endsWith("ersi")||t.endsWith("irsi"))return!0;for(const t of e)if(jm(t))return!0;return!1}(e)}normalize(e){const t=e.toLowerCase();if((t.endsWith("are")||t.endsWith("ere")||t.endsWith("ire"))&&!xm.some(e=>t.endsWith(e+"are")||t.endsWith(e+"ere")||t.endsWith(e+"ire")))return nc(e);const r=this.tryReflexiveNormalization(t);if(r)return r;const n=this.tryConjugationNormalization(t);return n||nc(e)}tryReflexiveNormalization(e){for(const t of xm)if(e.endsWith(t)){const r=e.slice(0,-t.length);if(r.endsWith("ar")||r.endsWith("er")||r.endsWith("ir")){return ic(r+"e",.88,{removedSuffixes:[t],conjugationType:"reflexive"})}if(r.endsWith("are")||r.endsWith("ere")||r.endsWith("ire"))return ic(r,.88,{removedSuffixes:[t],conjugationType:"reflexive"});const n=this.tryConjugationNormalization(r);if(n&&n.stem!==r)return ic(n.stem,.95*n.confidence,{removedSuffixes:[t,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(e){for(const t of Cm)if(e.endsWith(t.ending)){const r=e.slice(0,-t.ending.length);if(r.length<2)continue;return ic(r+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}})}}),Om={};Tl(Om,{italianProfile:()=>Pm});var Im,Rm,Mm,qm,_m,$m,Wm,Vm=Sl({"src/generators/profiles/italian.ts"(){Pm={code:"it",name:"Italian",nativeName:"Italiano",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!0},references:{me:"io",it:"esso",you:"tu",result:"risultato",event:"evento",target:"obiettivo",body:"corpo"},possessive:{marker:"di",markerPosition:"before-property",usePossessiveAdjectives:!0,specialForms:{me:"mio",it:"suo",you:"tuo"},keywords:{mio:"me",mia:"me",miei:"me",mie:"me",tuo:"you",tua:"you",tuoi:"you",tue:"you",suo:"it",sua:"it",suoi:"it",sue:"it"}},roleMarkers:{destination:{primary:"in",alternatives:["su","a"],position:"before"},source:{primary:"da",alternatives:["di"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"commutare",alternatives:["alternare","cambiare"],normalized:"toggle"},add:{primary:"aggiungere",alternatives:["aggiungi"],normalized:"add"},remove:{primary:"rimuovere",alternatives:["eliminare","togliere"],normalized:"remove"},put:{primary:"mettere",alternatives:["inserire"],normalized:"put"},append:{primary:"aggiungere",normalized:"append"},prepend:{primary:"anteporre",normalized:"prepend"},take:{primary:"prendere",normalized:"take"},make:{primary:"fare",alternatives:["creare"],normalized:"make"},clone:{primary:"clonare",alternatives:["copiare"],normalized:"clone"},swap:{primary:"scambiare",alternatives:["cambiare"],normalized:"swap"},morph:{primary:"trasformare",alternatives:["convertire"],normalized:"morph"},set:{primary:"impostare",alternatives:["definire"],normalized:"set"},get:{primary:"ottenere",alternatives:["prendere"],normalized:"get"},increment:{primary:"incrementare",alternatives:["aumentare"],normalized:"increment"},decrement:{primary:"decrementare",alternatives:["diminuire"],normalized:"decrement"},log:{primary:"registrare",normalized:"log"},show:{primary:"mostrare",alternatives:["visualizzare"],normalized:"show"},hide:{primary:"nascondere",normalized:"hide"},transition:{primary:"transizione",alternatives:["animare"],normalized:"transition"},on:{primary:"su",alternatives:["quando","al"],normalized:"on"},trigger:{primary:"scatenare",alternatives:["attivare"],normalized:"trigger"},send:{primary:"inviare",normalized:"send"},focus:{primary:"focalizzare",normalized:"focus"},blur:{primary:"sfuocare",normalized:"blur"},go:{primary:"andare",alternatives:["navigare","vai"],normalized:"go"},wait:{primary:"aspettare",alternatives:["attendere"],normalized:"wait"},fetch:{primary:"recuperare",normalized:"fetch"},settle:{primary:"stabilizzare",normalized:"settle"},if:{primary:"se",normalized:"if"},when:{primary:"quando",normalized:"when"},where:{primary:"dove",normalized:"where"},else:{primary:"altrimenti",normalized:"else"},repeat:{primary:"ripetere",normalized:"repeat"},for:{primary:"per",normalized:"for"},while:{primary:"mentre",normalized:"while"},continue:{primary:"continuare",normalized:"continue"},halt:{primary:"fermare",normalized:"halt"},throw:{primary:"lanciare",normalized:"throw"},call:{primary:"chiamare",normalized:"call"},return:{primary:"ritornare",normalized:"return"},then:{primary:"allora",alternatives:["poi","quindi"],normalized:"then"},and:{primary:"e",alternatives:["anche"],normalized:"and"},end:{primary:"fine",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asincrono",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"predefinito",normalized:"default"},init:{primary:"inizializzare",alternatives:["inizia"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"installare",normalized:"install"},measure:{primary:"misurare",normalized:"measure"},into:{primary:"in",alternatives:["dentro"],normalized:"into"},before:{primary:"prima",normalized:"before"},after:{primary:"dopo",normalized:"after"},click:{primary:"clic",alternatives:["clicca"],normalized:"click"},hover:{primary:"passaggio",alternatives:["sorvolo"],normalized:"hover"},submit:{primary:"invio",alternatives:["inviare"],normalized:"submit"},input:{primary:"inserimento",alternatives:["input"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiamento"],normalized:"change"},until:{primary:"fino",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"da",alternatives:["di"],normalized:"from"}},eventHandler:{keyword:{primary:"su",alternatives:["al","quando"],normalized:"on"},sourceMarker:{primary:"da",alternatives:["di"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"al",alternatives:["allo","alla"],position:"before"},temporalMarkers:["quando","al"]}}}}),Dm={};Tl(Dm,{ItalianTokenizer:()=>$m,italianTokenizer:()=>Wm});var Bm,Hm,Fm,Um=Sl({"src/tokenizers/italian.ts"(){rc(),Nm(),Vm(),({isLetter:Im,isIdentifierChar:Rm}=Ql(/[a-zA-ZàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚ]/)),Mm=[{pattern:"millisecondi",suffix:"ms",length:12,caseInsensitive:!0},{pattern:"millisecondo",suffix:"ms",length:12,caseInsensitive:!0},{pattern:"secondi",suffix:"s",length:7,caseInsensitive:!0},{pattern:"secondo",suffix:"s",length:7,caseInsensitive:!0},{pattern:"minuti",suffix:"m",length:6,caseInsensitive:!0},{pattern:"minuto",suffix:"m",length:6,caseInsensitive:!0},{pattern:"ore",suffix:"h",length:3,caseInsensitive:!0},{pattern:"ora",suffix:"h",length:3,caseInsensitive:!0}],qm=new Set(["in","a","di","da","con","su","per","tra","fra","dopo","prima","dentro","fuori","sopra","sotto","al","allo","alla","ai","agli","alle","del","dello","della","dei","degli","delle","dal","dallo","dalla","dai","dagli","dalle","nel","nello","nella","nei","negli","nelle","sul","sullo","sulla","sui","sugli","sulle"]),_m=[{native:"vero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nullo",normalized:"null"},{native:"indefinito",normalized:"undefined"},{native:"primo",normalized:"first"},{native:"prima",normalized:"first"},{native:"ultimo",normalized:"last"},{native:"ultima",normalized:"last"},{native:"prossimo",normalized:"next"},{native:"successivo",normalized:"next"},{native:"precedente",normalized:"previous"},{native:"vicino",normalized:"closest"},{native:"padre",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"fare clic",normalized:"click"},{native:"input",normalized:"input"},{native:"cambio",normalized:"change"},{native:"invio",normalized:"submit"},{native:"tasto giù",normalized:"keydown"},{native:"tasto su",normalized:"keyup"},{native:"mouse sopra",normalized:"mouseover"},{native:"mouse fuori",normalized:"mouseout"},{native:"fuoco",normalized:"focus"},{native:"sfuocatura",normalized:"blur"},{native:"caricamento",normalized:"load"},{native:"scorrimento",normalized:"scroll"},{native:"io",normalized:"me"},{native:"me",normalized:"me"},{native:"destinazione",normalized:"target"},{native:"secondo",normalized:"s"},{native:"secondi",normalized:"s"},{native:"millisecondo",normalized:"ms"},{native:"millisecondi",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minuti",normalized:"m"},{native:"ora",normalized:"h"},{native:"ore",normalized:"h"},{native:"fino a",normalized:"until"},{native:"prima di",normalized:"before"},{native:"dopo di",normalized:"after"},{native:"dentro di",normalized:"into"},{native:"fuori di",normalized:"out"},{native:"aggiungere",normalized:"add"},{native:"aggiungi",normalized:"add"},{native:"rimuovi",normalized:"remove"},{native:"elimina",normalized:"remove"},{native:"togli",normalized:"remove"},{native:"metti",normalized:"put"},{native:"inserisci",normalized:"put"},{native:"prendi",normalized:"take"},{native:"fai",normalized:"make"},{native:"crea",normalized:"make"},{native:"clona",normalized:"clone"},{native:"copia",normalized:"clone"},{native:"imposta",normalized:"set"},{native:"ottieni",normalized:"get"},{native:"incrementa",normalized:"increment"},{native:"aumenta",normalized:"increment"},{native:"decrementa",normalized:"decrement"},{native:"diminuisci",normalized:"decrement"},{native:"registra",normalized:"log"},{native:"mostra",normalized:"show"},{native:"visualizza",normalized:"show"},{native:"nascondi",normalized:"hide"},{native:"anima",normalized:"transition"},{native:"scatena",normalized:"trigger"},{native:"attiva",normalized:"trigger"},{native:"invia",normalized:"send"},{native:"focalizza",normalized:"focus"},{native:"sfuoca",normalized:"blur"},{native:"vai",normalized:"go"},{native:"naviga",normalized:"go"},{native:"aspetta",normalized:"wait"},{native:"attendi",normalized:"wait"},{native:"recupera",normalized:"fetch"},{native:"stabilizza",normalized:"settle"},{native:"ripeti",normalized:"repeat"},{native:"continua",normalized:"continue"},{native:"ferma",normalized:"halt"},{native:"lancia",normalized:"throw"},{native:"chiama",normalized:"call"},{native:"ritorna",normalized:"return"},{native:"inizializza",normalized:"init"},{native:"installa",normalized:"install"},{native:"misura",normalized:"measure"},{native:"e",normalized:"and"},{native:"o",normalized:"or"},{native:"non",normalized:"not"},{native:"è",normalized:"is"},{native:"esiste",normalized:"exists"},{native:"vuoto",normalized:"empty"},{native:"toggle",normalized:"toggle"},{native:"di",normalized:"tell"}],Wm=new($m=class extends Dl{constructor(){super(),this.language="it",this.direction="ltr",this.initializeKeywordsFromProfile(Pm,_m),this.normalizer=new Am}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractItalianNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.tryMultiWordPhrase(e,r);if(i){t.push(i),r=i.position.end;continue}if(Im(e[r])){const n=this.extractItalianWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const a=this.tryOperator(e,r);a?(t.push(a),r=a.position.end):r++}return new Wl(t,"it")}classifyToken(e){const t=e.toLowerCase();return qm.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}tryMultiWordPhrase(e,t){for(const r of this.profileKeywords){if(!r.native.includes(" "))continue;const n=r.native;if(e.slice(t,t+n.length).toLowerCase()===n.toLowerCase()){const i=t+n.length;if(i>=e.length||Ul(e[i])||!Im(e[i]))return Fl(e.slice(t,t+n.length),"keyword",Hl(t,i),r.normalized)}}return null}extractItalianWord(e,t){let r=t,n="";for(;r<e.length&&Rm(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase();if(qm.has(i))return Fl(n,"particle",Hl(t,r));const a=this.lookupKeyword(i);if(a)return Fl(n,"keyword",Hl(t,r),a.normalized);const o=this.tryMorphKeywordMatch(i,t,r);return o||Fl(n,"identifier",Hl(t,r))}extractItalianNumber(e,t){return this.tryNumberWithTimeUnits(e,t,Mm,{allowSign:!0,skipWhitespace:!0})}})}});function Km(e){const t=e.charCodeAt(0);return t>=12352&&t<=12447}function Gm(e){const t=e.charCodeAt(0);return t>=12448&&t<=12543}function Ym(e){const t=e.charCodeAt(0);return t>=19968&&t<=40959||t>=13312&&t<=19903}var Xm,Zm=Sl({"src/tokenizers/morphology/japanese-normalizer.ts"(){uc(),Bm=[{pattern:"したら",confidence:.88,conjugationType:"conditional-tara",minStemLength:2},{pattern:"すると",confidence:.88,conjugationType:"conditional-to",minStemLength:2},{pattern:"すれば",confidence:.85,conjugationType:"conditional-ba",minStemLength:2},{pattern:"たら",confidence:.85,conjugationType:"conditional-tara",minStemLength:2},{pattern:"れば",confidence:.82,conjugationType:"conditional-ba",minStemLength:2},{pattern:"ていました",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"ています",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"てください",confidence:.85,conjugationType:"request",minStemLength:2},{pattern:"でください",confidence:.85,conjugationType:"request",minStemLength:2},{pattern:"ている",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"ておく",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"てみる",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"てある",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"てくれ",confidence:.8,conjugationType:"casual-request",minStemLength:2},{pattern:"でくれ",confidence:.8,conjugationType:"casual-request",minStemLength:2},{pattern:"ちゃった",confidence:.82,conjugationType:"contracted-past",minStemLength:2},{pattern:"じゃった",confidence:.82,conjugationType:"contracted-past",minStemLength:2},{pattern:"ちゃう",confidence:.82,conjugationType:"contracted",minStemLength:2},{pattern:"じゃう",confidence:.82,conjugationType:"contracted",minStemLength:2},{pattern:"ました",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"ません",confidence:.85,conjugationType:"negative",minStemLength:2},{pattern:"ます",confidence:.85,conjugationType:"polite",minStemLength:2},{pattern:"て",confidence:.85,conjugationType:"te-form",minStemLength:2},{pattern:"た",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"ない",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"なかった",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"られる",confidence:.8,conjugationType:"potential",minStemLength:2},{pattern:"れる",confidence:.78,conjugationType:"potential",minStemLength:2},{pattern:"られた",confidence:.8,conjugationType:"passive",minStemLength:2},{pattern:"させる",confidence:.8,conjugationType:"causative",minStemLength:2},{pattern:"せる",confidence:.78,conjugationType:"causative",minStemLength:2},{pattern:"よう",confidence:.8,conjugationType:"volitional",minStemLength:2},{pattern:"る",confidence:.75,conjugationType:"dictionary",minStemLength:3}],Hm=[{pattern:"したら",confidence:.88,conjugationType:"conditional-tara"},{pattern:"すると",confidence:.88,conjugationType:"conditional-to"},{pattern:"すれば",confidence:.85,conjugationType:"conditional-ba"},{pattern:"しています",confidence:.85,conjugationType:"progressive"},{pattern:"している",confidence:.85,conjugationType:"progressive"},{pattern:"しました",confidence:.85,conjugationType:"past"},{pattern:"します",confidence:.85,conjugationType:"polite"},{pattern:"しない",confidence:.82,conjugationType:"negative"},{pattern:"して",confidence:.85,conjugationType:"te-form"},{pattern:"した",confidence:.85,conjugationType:"past"},{pattern:"する",confidence:.88,conjugationType:"dictionary"}],new(Fm=class{constructor(){this.language="ja"}isNormalizable(e){if(!function(e){for(const t of e)if(Km(t)||Gm(t)||Ym(t))return!0;return!1}(e))return!1;if(e.length<2)return!1;return Km(e[e.length-1])}normalize(e){const t=this.normalizeCompound(e);if(t)return t;const r=this.trySuruNormalization(e);if(r)return r;for(const t of Bm)if(e.endsWith(t.pattern)){const r=e.slice(0,-t.pattern.length);if(r.length<(t.minStemLength??2))continue;const n={removedSuffixes:[t.pattern]};return t.conjugationType&&(n.conjugationType=t.conjugationType),ic(r,t.confidence,n)}return nc(e)}trySuruNormalization(e){for(const t of Hm)if(e.endsWith(t.pattern)){const r=e.slice(0,-t.pattern.length);if(r.length<1)continue;return ic(r,t.confidence,{removedSuffixes:[t.pattern],conjugationType:t.conjugationType,originalForm:"suru-verb"})}return null}normalizeCompound(e){const t=[{pattern:"ていなかった",suffixes:["て","い","なかった"],confidence:.8,minStemLength:2},{pattern:"でいなかった",suffixes:["で","い","なかった"],confidence:.8,minStemLength:2},{pattern:"ていない",suffixes:["て","い","ない"],confidence:.82,minStemLength:2},{pattern:"でいない",suffixes:["で","い","ない"],confidence:.82,minStemLength:2},{pattern:"ていた",suffixes:["て","い","た"],confidence:.85,minStemLength:2},{pattern:"でいた",suffixes:["で","い","た"],confidence:.85,minStemLength:2}];for(const{pattern:r,suffixes:n,confidence:i,minStemLength:a}of t)if(e.endsWith(r)){const t=e.slice(0,-r.length);if(t.length<a)continue;return ic(t,i,{removedSuffixes:n,conjugationType:"compound"})}return null}})}}),Jm={};Tl(Jm,{japaneseProfile:()=>Xm});var Qm,ed,td,rd,nd,id,ad,od,sd,ld,cd,ud,pd=Sl({"src/generators/profiles/japanese.ts"(){Xm={code:"ja",name:"Japanese",nativeName:"日本語",direction:"ltr",wordOrder:"SOV",markingStrategy:"particle",usesSpaces:!1,defaultVerbForm:"base",verb:{position:"end",suffixes:["る","て","た","ます","ない"],subjectDrop:!0},references:{me:"自分",it:"それ",you:"あなた",result:"結果",event:"イベント",target:"ターゲット",body:"ボディ"},possessive:{marker:"の",markerPosition:"between",keywords:{"私の":"me","あなたの":"you","その":"it"}},roleMarkers:{patient:{primary:"を",position:"after"},destination:{primary:"に",alternatives:["へ","で","の"],position:"after"},source:{primary:"から",position:"after"},style:{primary:"で",position:"after"},event:{primary:"を",position:"after"}},keywords:{toggle:{primary:"切り替え",alternatives:["切り替える","トグル","トグルする"],normalized:"toggle"},add:{primary:"追加",alternatives:["追加する","加える"],normalized:"add"},remove:{primary:"削除",alternatives:["削除する","取り除く"],normalized:"remove"},put:{primary:"置く",alternatives:["入れる","セット"],normalized:"put"},append:{primary:"末尾追加",alternatives:["末尾に追加","アペンド"],normalized:"append"},prepend:{primary:"先頭追加",alternatives:["先頭に追加","プリペンド"],normalized:"prepend"},take:{primary:"取る",normalized:"take"},make:{primary:"作る",alternatives:["作成"],normalized:"make"},clone:{primary:"複製",alternatives:["クローン"],normalized:"clone"},swap:{primary:"交換",alternatives:["スワップ","入れ替え"],normalized:"swap"},morph:{primary:"変形",alternatives:["モーフ","変換"],normalized:"morph"},set:{primary:"設定",alternatives:["設定する","セット"],normalized:"set"},get:{primary:"取得",alternatives:["取得する","ゲット"],normalized:"get"},increment:{primary:"増加",alternatives:["増やす","インクリメント"],normalized:"increment"},decrement:{primary:"減少",alternatives:["減らす","デクリメント"],normalized:"decrement"},log:{primary:"記録",alternatives:["ログ","出力"],normalized:"log"},show:{primary:"表示",alternatives:["表示する","見せる"],normalized:"show"},hide:{primary:"隠す",alternatives:["非表示","非表示にする"],normalized:"hide"},transition:{primary:"遷移",alternatives:["トランジション","アニメーション"],normalized:"transition"},on:{primary:"で",alternatives:["時","とき"],normalized:"on"},trigger:{primary:"引き金",alternatives:["発火","トリガー"],normalized:"trigger"},send:{primary:"送る",alternatives:["送信"],normalized:"send"},focus:{primary:"フォーカス",alternatives:["集中"],normalized:"focus"},blur:{primary:"ぼかし",alternatives:["フォーカス解除"],normalized:"blur"},go:{primary:"移動",alternatives:["行く","ナビゲート"],normalized:"go"},wait:{primary:"待つ",alternatives:["待機"],normalized:"wait"},fetch:{primary:"取得",alternatives:["フェッチ"],normalized:"fetch"},settle:{primary:"安定",alternatives:["落ち着く"],normalized:"settle"},if:{primary:"もし",alternatives:["条件"],normalized:"if"},when:{primary:"とき",normalized:"when"},where:{primary:"どこ",normalized:"where"},else:{primary:"そうでなければ",alternatives:["それ以外"],normalized:"else"},repeat:{primary:"繰り返し",alternatives:["繰り返す","リピート"],normalized:"repeat"},for:{primary:"ために",alternatives:["各"],normalized:"for"},while:{primary:"の間",alternatives:["間"],normalized:"while"},continue:{primary:"続ける",alternatives:["継続"],normalized:"continue"},halt:{primary:"停止",alternatives:["止める","ハルト"],normalized:"halt"},throw:{primary:"投げる",alternatives:["スロー"],normalized:"throw"},call:{primary:"呼び出し",alternatives:["コール","呼ぶ"],normalized:"call"},return:{primary:"戻る",alternatives:["返す","リターン"],normalized:"return"},then:{primary:"それから",alternatives:["次に","そして"],normalized:"then"},and:{primary:"そして",alternatives:["と","また"],normalized:"and"},end:{primary:"終わり",alternatives:["終了","おわり"],normalized:"end"},js:{primary:"JS実行",alternatives:["js"],normalized:"js"},async:{primary:"非同期",alternatives:["アシンク"],normalized:"async"},tell:{primary:"伝える",alternatives:["テル"],normalized:"tell"},default:{primary:"既定",alternatives:["デフォルト"],normalized:"default"},init:{primary:"初期化",alternatives:["イニット"],normalized:"init"},behavior:{primary:"振る舞い",alternatives:["ビヘイビア"],normalized:"behavior"},install:{primary:"インストール",alternatives:["導入"],normalized:"install"},measure:{primary:"測定",alternatives:["計測","メジャー"],normalized:"measure"},into:{primary:"へ",alternatives:["に"],normalized:"into"},before:{primary:"前に",alternatives:["前"],normalized:"before"},after:{primary:"後に",alternatives:["後"],normalized:"after"},until:{primary:"まで",alternatives:["迄"],normalized:"until"},event:{primary:"イベント",alternatives:["事象"],normalized:"event"},from:{primary:"から",normalized:"from"}},tokenization:{particles:["を","に","で","から","の","が","は","も","へ","と"],boundaryStrategy:"particle"},eventHandler:{eventMarker:{primary:"で",position:"after"},temporalMarkers:["時","とき"]}}}}),md={};Tl(md,{JapaneseTokenizer:()=>cd,japaneseTokenizer:()=>ud});var dd,hd,fd,yd=Sl({"src/tokenizers/japanese.ts"(){rc(),Zm(),pd(),Qm=Zl([[12352,12447]]),ed=Zl([[12448,12543]]),td=Zl([[19968,40959],[13312,19903]]),rd=Jl(Qm,ed,td),nd=new Set(["を","に","で","から","まで","へ","と","の","が","は","も","より"]),id=new Set(["を","に","で","へ","と","の","が","は","も"]),ad=["から","まで","より"],od=new Map([["を",{role:"patient",confidence:.95,description:"object marker"}],["に",{role:"destination",confidence:.85,description:"destination/time marker"}],["で",{role:"manner",confidence:.88,description:"means/location marker"}],["から",{role:"source",confidence:.9,description:"from/source marker"}],["まで",{role:"destination",confidence:.75,description:"until/boundary marker"}],["へ",{role:"destination",confidence:.9,description:"direction marker"}],["と",{role:"style",confidence:.7,description:"with/and marker"}],["の",{role:"destination",confidence:.75,description:"possessive/destination marker"}],["が",{role:"agent",confidence:.85,description:"subject marker"}],["は",{role:"agent",confidence:.75,description:"topic marker"}],["も",{role:"patient",confidence:.65,description:"also/too marker"}],["より",{role:"source",confidence:.85,description:"from/than marker"}]]),sd=[{native:"真",normalized:"true"},{native:"偽",normalized:"false"},{native:"ヌル",normalized:"null"},{native:"未定義",normalized:"undefined"},{native:"最初",normalized:"first"},{native:"最後",normalized:"last"},{native:"次",normalized:"next"},{native:"前",normalized:"previous"},{native:"最も近い",normalized:"closest"},{native:"親",normalized:"parent"},{native:"クリック",normalized:"click"},{native:"変更",normalized:"change"},{native:"送信",normalized:"submit"},{native:"入力",normalized:"input"},{native:"ロード",normalized:"load"},{native:"スクロール",normalized:"scroll"},{native:"キーダウン",normalized:"keydown"},{native:"キーアップ",normalized:"keyup"},{native:"マウスオーバー",normalized:"mouseover"},{native:"マウスアウト",normalized:"mouseout"},{native:"ブラー",normalized:"blur"},{native:"私",normalized:"me"},{native:"私の",normalized:"my"},{native:"その",normalized:"its"},{native:"したら",normalized:"on"},{native:"すると",normalized:"on"},{native:"時に",normalized:"on"},{native:"もし",normalized:"if"},{native:"ならば",normalized:"then"},{native:"なら",normalized:"then"},{native:"それから",normalized:"then"},{native:"そして",normalized:"and"},{native:"秒",normalized:"s"},{native:"ミリ秒",normalized:"ms"},{native:"分",normalized:"m"},{native:"時間",normalized:"h"}],ld=[{pattern:"ミリ秒",suffix:"ms",length:3},{pattern:"時間",suffix:"h",length:2},{pattern:"秒",suffix:"s",length:1},{pattern:"分",suffix:"m",length:1}],ud=new(cd=class extends Dl{constructor(){super(),this.language="ja",this.direction="ltr",this.initializeKeywordsFromProfile(Xm,sd),this.normalizer=new Fm}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])){const n=this.extractJapaneseNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.tryMultiCharParticle(e,r,ad);if(i){const e=od.get(i.value);t.push(e?{...i,metadata:{particleRole:e.role,particleConfidence:e.confidence}}:i),r=i.position.end;continue}if(id.has(e[r])){const n=this.tryProfileKeyword(e,r);if(n&&n.value.length>1){t.push(n),r=n.position.end;continue}const i=e[r],a=od.get(i);t.push(a?{...Fl(i,"particle",Hl(r,r+1)),metadata:{particleRole:a.role,particleConfidence:a.confidence}}:Fl(i,"particle",Hl(r,r+1))),r++;continue}if(rd(e[r])){const n=this.extractJapaneseWord(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Xl(e[r])){const n=this.extractAsciiWord(e,r);if(n){t.push(n),r=n.position.end;continue}}r++}return new Wl(t,"ja")}classifyToken(e){return nd.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||e.startsWith("「")||/^\d/.test(e)?"literal":"identifier"}extractJapaneseWord(e,t){let r=t,n="";for(;r<e.length;){const t=e[r];if(id.has(t)&&n.length>0)break;let i=!1;for(const t of ad)if(e.slice(r,r+t.length)===t&&n.length>0){i=!0;break}if(i)break;if(!rd(t))break;n+=t,r++}if(!n)return null;const i=this.lookupKeyword(n);if(i)return Fl(n,"keyword",Hl(t,r),i.normalized);const a=this.tryMorphKeywordMatch(n,t,r);return a||Fl(n,"identifier",Hl(t,r))}extractAsciiWord(e,t){let r=t,n="";for(;r<e.length&&Xl(e[r]);)n+=e[r++];return n?Fl(n,"identifier",Hl(t,r)):null}extractJapaneseNumber(e,t){return this.tryNumberWithTimeUnits(e,t,ld,{allowSign:!1,skipWhitespace:!1})}})}});function vd(e){const t=e.charCodeAt(0);return t>=44032&&t<=55203}var gd,kd=Sl({"src/tokenizers/morphology/korean-normalizer.ts"(){uc(),dd=[{pattern:"하시니까",confidence:.85,conjugationType:"honorific-causal",minStemLength:1},{pattern:"하실때",confidence:.88,conjugationType:"honorific-temporal",minStemLength:1},{pattern:"하실 때",confidence:.88,conjugationType:"honorific-temporal",minStemLength:1},{pattern:"하시면",confidence:.88,conjugationType:"honorific-conditional",minStemLength:1},{pattern:"으시면",confidence:.85,conjugationType:"honorific-conditional",minStemLength:2},{pattern:"시면",confidence:.82,conjugationType:"honorific-conditional",minStemLength:2},{pattern:"하고나서",confidence:.85,conjugationType:"sequential-after",minStemLength:1},{pattern:"하고 나서",confidence:.85,conjugationType:"sequential-after",minStemLength:1},{pattern:"하고서",confidence:.85,conjugationType:"sequential-after",minStemLength:1},{pattern:"고나서",confidence:.82,conjugationType:"sequential-after",minStemLength:2},{pattern:"고 나서",confidence:.82,conjugationType:"sequential-after",minStemLength:2},{pattern:"고서",confidence:.82,conjugationType:"sequential-after",minStemLength:2},{pattern:"하기전에",confidence:.85,conjugationType:"sequential-before",minStemLength:1},{pattern:"하기 전에",confidence:.85,conjugationType:"sequential-before",minStemLength:1},{pattern:"기전에",confidence:.82,conjugationType:"sequential-before",minStemLength:2},{pattern:"기 전에",confidence:.82,conjugationType:"sequential-before",minStemLength:2},{pattern:"하자마자",confidence:.88,conjugationType:"immediate",minStemLength:1},{pattern:"자마자",confidence:.85,conjugationType:"immediate",minStemLength:2},{pattern:"해야해요",confidence:.85,conjugationType:"obligation",minStemLength:1},{pattern:"해야해",confidence:.85,conjugationType:"obligation",minStemLength:1},{pattern:"해야하다",confidence:.85,conjugationType:"obligation",minStemLength:1},{pattern:"어야해요",confidence:.82,conjugationType:"obligation",minStemLength:2},{pattern:"어야해",confidence:.82,conjugationType:"obligation",minStemLength:2},{pattern:"아야해요",confidence:.82,conjugationType:"obligation",minStemLength:2},{pattern:"아야해",confidence:.82,conjugationType:"obligation",minStemLength:2},{pattern:"하니까",confidence:.85,conjugationType:"causal-nikka",minStemLength:1},{pattern:"할때",confidence:.88,conjugationType:"temporal-ttae",minStemLength:1},{pattern:"할 때",confidence:.88,conjugationType:"temporal-ttae",minStemLength:1},{pattern:"을때",confidence:.85,conjugationType:"temporal-ttae",minStemLength:2},{pattern:"을 때",confidence:.85,conjugationType:"temporal-ttae",minStemLength:2},{pattern:"하면",confidence:.88,conjugationType:"conditional-myeon",minStemLength:1},{pattern:"으면",confidence:.85,conjugationType:"conditional-myeon",minStemLength:2},{pattern:"니까",confidence:.82,conjugationType:"causal-nikka",minStemLength:2},{pattern:"면",confidence:.8,conjugationType:"conditional-myeon",minStemLength:2},{pattern:"하였습니다",confidence:.85,conjugationType:"past",minStemLength:1},{pattern:"했습니다",confidence:.85,conjugationType:"past",minStemLength:1},{pattern:"합니다",confidence:.85,conjugationType:"polite",minStemLength:1},{pattern:"습니다",confidence:.82,conjugationType:"polite",minStemLength:2},{pattern:"됩니다",confidence:.82,conjugationType:"polite",minStemLength:1},{pattern:"ㅂ니다",confidence:.82,conjugationType:"polite",minStemLength:2},{pattern:"하세요",confidence:.85,conjugationType:"honorific",minStemLength:1},{pattern:"하십시오",confidence:.85,conjugationType:"honorific",minStemLength:1},{pattern:"세요",confidence:.82,conjugationType:"honorific",minStemLength:2},{pattern:"십시오",confidence:.82,conjugationType:"honorific",minStemLength:2},{pattern:"하고있어요",confidence:.82,conjugationType:"progressive",minStemLength:1},{pattern:"하고있어",confidence:.82,conjugationType:"progressive",minStemLength:1},{pattern:"했어요",confidence:.85,conjugationType:"past",minStemLength:1},{pattern:"해요",confidence:.85,conjugationType:"polite",minStemLength:1},{pattern:"어요",confidence:.82,conjugationType:"polite",minStemLength:2},{pattern:"아요",confidence:.82,conjugationType:"polite",minStemLength:2},{pattern:"했어",confidence:.85,conjugationType:"past",minStemLength:1},{pattern:"해",confidence:.8,conjugationType:"present",minStemLength:1},{pattern:"었어",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"았어",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"하고있다",confidence:.82,conjugationType:"progressive",minStemLength:1},{pattern:"고있다",confidence:.8,conjugationType:"progressive",minStemLength:2},{pattern:"고있어",confidence:.8,conjugationType:"progressive",minStemLength:2},{pattern:"하다",confidence:.88,conjugationType:"dictionary",minStemLength:1},{pattern:"하지않다",confidence:.82,conjugationType:"negative",minStemLength:1},{pattern:"안하다",confidence:.82,conjugationType:"negative",minStemLength:1},{pattern:"지않다",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"해라",confidence:.82,conjugationType:"imperative",minStemLength:1},{pattern:"하라",confidence:.82,conjugationType:"imperative",minStemLength:1},{pattern:"다",confidence:.75,conjugationType:"dictionary",minStemLength:2}],hd=[{pattern:"하시니까",confidence:.88,conjugationType:"honorific-causal"},{pattern:"하실때",confidence:.88,conjugationType:"honorific-temporal"},{pattern:"하실 때",confidence:.88,conjugationType:"honorific-temporal"},{pattern:"하시면",confidence:.88,conjugationType:"honorific-conditional"},{pattern:"하셨어요",confidence:.85,conjugationType:"honorific-past"},{pattern:"하셨어",confidence:.85,conjugationType:"honorific-past"},{pattern:"하십니다",confidence:.85,conjugationType:"honorific-polite"},{pattern:"하고나서",confidence:.88,conjugationType:"sequential-after"},{pattern:"하고 나서",confidence:.88,conjugationType:"sequential-after"},{pattern:"하고서",confidence:.88,conjugationType:"sequential-after"},{pattern:"하기전에",confidence:.88,conjugationType:"sequential-before"},{pattern:"하기 전에",confidence:.88,conjugationType:"sequential-before"},{pattern:"하자마자",confidence:.88,conjugationType:"immediate"},{pattern:"해야해요",confidence:.88,conjugationType:"obligation"},{pattern:"해야해",confidence:.88,conjugationType:"obligation"},{pattern:"해야하다",confidence:.88,conjugationType:"obligation"},{pattern:"하니까",confidence:.88,conjugationType:"causal-nikka"},{pattern:"할때",confidence:.88,conjugationType:"temporal-ttae"},{pattern:"할 때",confidence:.88,conjugationType:"temporal-ttae"},{pattern:"하면",confidence:.88,conjugationType:"conditional-myeon"},{pattern:"하였습니다",confidence:.85,conjugationType:"past"},{pattern:"했습니다",confidence:.85,conjugationType:"past"},{pattern:"합니다",confidence:.85,conjugationType:"polite"},{pattern:"하십시오",confidence:.85,conjugationType:"honorific"},{pattern:"하세요",confidence:.85,conjugationType:"honorific"},{pattern:"했어요",confidence:.85,conjugationType:"past"},{pattern:"해요",confidence:.85,conjugationType:"polite"},{pattern:"했어",confidence:.85,conjugationType:"past"},{pattern:"해",confidence:.8,conjugationType:"present"},{pattern:"하고있어요",confidence:.82,conjugationType:"progressive"},{pattern:"하고있어",confidence:.82,conjugationType:"progressive"},{pattern:"하고있다",confidence:.82,conjugationType:"progressive"},{pattern:"해서",confidence:.82,conjugationType:"connective"},{pattern:"하고",confidence:.8,conjugationType:"connective"},{pattern:"하지않아요",confidence:.82,conjugationType:"negative"},{pattern:"하지않다",confidence:.82,conjugationType:"negative"},{pattern:"안해요",confidence:.82,conjugationType:"negative"},{pattern:"안해",confidence:.82,conjugationType:"negative"},{pattern:"해라",confidence:.82,conjugationType:"imperative"},{pattern:"하라",confidence:.82,conjugationType:"imperative"},{pattern:"하다",confidence:.88,conjugationType:"dictionary"}],new(fd=class{constructor(){this.language="ko"}isNormalizable(e){return!!function(e){for(const t of e)if(vd(t))return!0;return!1}(e)&&!(e.length<2)}normalize(e){const t=this.normalizeCompound(e);if(t)return t;const r=this.tryHadaNormalization(e);if(r)return r;for(const t of dd)if(e.endsWith(t.pattern)){const r=e.slice(0,-t.pattern.length);if(r.length<(t.minStemLength??2))continue;const n={removedSuffixes:[t.pattern]};return t.conjugationType&&(n.conjugationType=t.conjugationType),ic(r,t.confidence,n)}return nc(e)}tryHadaNormalization(e){for(const t of hd)if(e.endsWith(t.pattern)){const r=e.slice(0,-t.pattern.length);if(r.length<1)continue;return ic(r,t.confidence,{removedSuffixes:[t.pattern],conjugationType:t.conjugationType,originalForm:"hada-verb"})}return null}normalizeCompound(e){const t=[{pattern:"하고나서였어",suffixes:["하고나서","였어"],confidence:.78,conjugationType:"sequential-after",minStemLength:2},{pattern:"하고나서였다",suffixes:["하고나서","였다"],confidence:.78,conjugationType:"sequential-after",minStemLength:2},{pattern:"하고나서",suffixes:["하고","나서"],confidence:.85,conjugationType:"sequential-after",minStemLength:2},{pattern:"해야했어",suffixes:["해야","했어"],confidence:.8,conjugationType:"obligation",minStemLength:2},{pattern:"해야했다",suffixes:["해야","했다"],confidence:.8,conjugationType:"obligation",minStemLength:2},{pattern:"해야했습니다",suffixes:["해야","했습니다"],confidence:.8,conjugationType:"obligation",minStemLength:2},{pattern:"하시면서",suffixes:["하시","면서"],confidence:.82,conjugationType:"connective",minStemLength:2},{pattern:"하시며",suffixes:["하시","며"],confidence:.82,conjugationType:"connective",minStemLength:2},{pattern:"하고있었어",suffixes:["하고","있었어"],confidence:.8,conjugationType:"progressive",minStemLength:2},{pattern:"하고있었다",suffixes:["하고","있었다"],confidence:.8,conjugationType:"progressive",minStemLength:2}];for(const{pattern:r,suffixes:n,confidence:i,conjugationType:a,minStemLength:o}of t)if(e.endsWith(r)){const t=e.slice(0,-r.length);if(t.length<o)continue;return ic(t,i,{removedSuffixes:n,conjugationType:a})}return null}})}}),wd={};Tl(wd,{koreanProfile:()=>gd});var bd,zd,xd,Ed,Sd,Td,Cd,Ad,Ld,jd,Pd,Nd,Od=Sl({"src/generators/profiles/korean.ts"(){gd={code:"ko",name:"Korean",nativeName:"한국어",direction:"ltr",wordOrder:"SOV",markingStrategy:"particle",usesSpaces:!0,verb:{position:"end",suffixes:["다","요","니다","세요"],subjectDrop:!0},references:{me:"나",it:"그것",you:"너",result:"결과",event:"이벤트",target:"대상",body:"본문"},possessive:{marker:"의",markerPosition:"between",specialForms:{me:"내",it:"그것의",you:"네"},keywords:{"내":"me","네":"you","그의":"it"}},roleMarkers:{patient:{primary:"을",alternatives:["를"],position:"after"},destination:{primary:"에",alternatives:["으로","로","에서","의"],position:"after"},source:{primary:"에서",alternatives:["부터"],position:"after"},style:{primary:"로",alternatives:["으로"],position:"after"},event:{primary:"을",alternatives:["를"],position:"after"}},keywords:{toggle:{primary:"토글",alternatives:["전환"],normalized:"toggle"},add:{primary:"추가",normalized:"add"},remove:{primary:"제거",alternatives:["삭제"],normalized:"remove"},put:{primary:"넣다",alternatives:["넣기","놓기"],normalized:"put"},append:{primary:"추가",normalized:"append"},take:{primary:"가져오다",normalized:"take"},make:{primary:"만들다",normalized:"make"},clone:{primary:"복사",normalized:"clone"},swap:{primary:"교환",alternatives:["바꾸다"],normalized:"swap"},morph:{primary:"변형",alternatives:["변환"],normalized:"morph"},set:{primary:"설정",normalized:"set"},get:{primary:"얻다",alternatives:["가져오기"],normalized:"get"},increment:{primary:"증가",normalized:"increment"},decrement:{primary:"감소",normalized:"decrement"},log:{primary:"로그",normalized:"log"},show:{primary:"보이다",alternatives:["표시","보이기"],normalized:"show"},hide:{primary:"숨기다",alternatives:["숨기기"],normalized:"hide"},transition:{primary:"전환",normalized:"transition"},on:{primary:"에",alternatives:["시","때","할 때"],normalized:"on"},trigger:{primary:"트리거",normalized:"trigger"},send:{primary:"보내다",normalized:"send"},focus:{primary:"포커스",normalized:"focus"},blur:{primary:"블러",normalized:"blur"},click:{primary:"클릭",normalized:"click"},hover:{primary:"호버",normalized:"hover"},submit:{primary:"제출",normalized:"submit"},input:{primary:"입력",normalized:"input"},change:{primary:"변경",normalized:"change"},go:{primary:"이동",normalized:"go"},wait:{primary:"대기",normalized:"wait"},fetch:{primary:"가져오기",normalized:"fetch"},settle:{primary:"안정",normalized:"settle"},if:{primary:"만약",normalized:"if"},when:{primary:"때",normalized:"when"},where:{primary:"어디",normalized:"where"},else:{primary:"아니면",normalized:"else"},repeat:{primary:"반복",normalized:"repeat"},for:{primary:"동안",normalized:"for"},while:{primary:"동안",normalized:"while"},continue:{primary:"계속",normalized:"continue"},halt:{primary:"정지",normalized:"halt"},throw:{primary:"던지다",normalized:"throw"},call:{primary:"호출",normalized:"call"},return:{primary:"반환",normalized:"return"},then:{primary:"그다음",alternatives:["그리고","그런후"],normalized:"then"},and:{primary:"그리고",alternatives:["또한","및"],normalized:"and"},end:{primary:"끝",alternatives:["종료","마침"],normalized:"end"},js:{primary:"JS실행",alternatives:["js"],normalized:"js"},async:{primary:"비동기",normalized:"async"},tell:{primary:"말하다",normalized:"tell"},default:{primary:"기본값",normalized:"default"},init:{primary:"초기화",normalized:"init"},behavior:{primary:"동작",normalized:"behavior"},install:{primary:"설치",normalized:"install"},measure:{primary:"측정",normalized:"measure"},into:{primary:"으로",normalized:"into"},before:{primary:"전에",normalized:"before"},after:{primary:"후에",normalized:"after"},until:{primary:"까지",normalized:"until"},event:{primary:"이벤트",normalized:"event"},from:{primary:"에서",normalized:"from"}},tokenization:{particles:["을","를","이","가","은","는","에","에서","으로","로","와","과","도"],boundaryStrategy:"space"},eventHandler:{eventMarker:{primary:"할 때",alternatives:["할때","때","에"],position:"after"},temporalMarkers:["할 때","할때","때"]}}}}),Id={};Tl(Id,{KoreanTokenizer:()=>Pd,koreanTokenizer:()=>Nd});var Rd,Md=Sl({"src/tokenizers/korean.ts"(){rc(),kd(),Od(),bd=Zl([[44032,55203]]),zd=Zl([[4352,4607],[12592,12687]]),xd=Jl(bd,zd),Ed=new Set(["이","가","을","를","은","는","에","에서","로","으로","와","과","의","도","만","부터","까지","처럼","보다"]),Sd=new Set(["이","가","을","를","은","는","에","로","와","과","의","도","만"]),Td=["에서","으로","부터","까지","처럼","보다"],Cd=["할때","하면","하니까","할 때"],Ad=new Map([["이",{role:"agent",confidence:.85,variant:"consonant",description:"subject marker (after consonant)"}],["가",{role:"agent",confidence:.85,variant:"vowel",description:"subject marker (after vowel)"}],["을",{role:"patient",confidence:.95,variant:"consonant",description:"object marker (after consonant)"}],["를",{role:"patient",confidence:.95,variant:"vowel",description:"object marker (after vowel)"}],["은",{role:"agent",confidence:.75,variant:"consonant",description:"topic marker (after consonant)"}],["는",{role:"agent",confidence:.75,variant:"vowel",description:"topic marker (after vowel)"}],["에",{role:"destination",confidence:.85,description:"at/to marker"}],["에서",{role:"source",confidence:.8,description:"at/from marker (action location)"}],["로",{role:"destination",confidence:.85,variant:"vowel",description:"to/by means (after vowel or ㄹ)"}],["으로",{role:"destination",confidence:.85,variant:"consonant",description:"to/by means (after consonant)"}],["와",{role:"style",confidence:.7,variant:"vowel",description:"and/with (after vowel)"}],["과",{role:"style",confidence:.7,variant:"consonant",description:"and/with (after consonant)"}],["의",{role:"patient",confidence:.6,description:"possessive marker"}],["도",{role:"patient",confidence:.65,description:"also/too marker"}],["만",{role:"patient",confidence:.65,description:"only marker"}],["부터",{role:"source",confidence:.9,description:"from/since marker"}],["까지",{role:"destination",confidence:.75,description:"until/to marker"}],["처럼",{role:"manner",confidence:.8,description:"like/as marker"}],["보다",{role:"source",confidence:.75,description:"than marker"}]]),Ld=[{native:"참",normalized:"true"},{native:"거짓",normalized:"false"},{native:"널",normalized:"null"},{native:"미정의",normalized:"undefined"},{native:"첫번째",normalized:"first"},{native:"마지막",normalized:"last"},{native:"다음",normalized:"next"},{native:"이전",normalized:"previous"},{native:"가장가까운",normalized:"closest"},{native:"부모",normalized:"parent"},{native:"클릭",normalized:"click"},{native:"더블클릭",normalized:"dblclick"},{native:"변경",normalized:"change"},{native:"제출",normalized:"submit"},{native:"입력",normalized:"input"},{native:"로드",normalized:"load"},{native:"스크롤",normalized:"scroll"},{native:"키다운",normalized:"keydown"},{native:"키업",normalized:"keyup"},{native:"마우스오버",normalized:"mouseover"},{native:"마우스아웃",normalized:"mouseout"},{native:"내",normalized:"my"},{native:"그것의",normalized:"its"},{native:"그리고",normalized:"and"},{native:"또는",normalized:"or"},{native:"아니",normalized:"not"},{native:"이다",normalized:"is"},{native:"초",normalized:"s"},{native:"밀리초",normalized:"ms"},{native:"분",normalized:"m"},{native:"시간",normalized:"h"}],jd=[{pattern:"밀리초",suffix:"ms",length:3},{pattern:"시간",suffix:"h",length:2},{pattern:"초",suffix:"s",length:1},{pattern:"분",suffix:"m",length:1}],Nd=new(Pd=class extends Dl{constructor(){super(),this.language="ko",this.direction="ltr",this.initializeKeywordsFromProfile(gd,Ld),this.normalizer=new fd}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])){const n=this.extractKoreanNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(xd(e[r])){const n=this.extractKoreanWord(e,r);if(n){const e=this.trySplitTemporalSuffix(n);e?(t.push(e.stemToken),t.push(e.suffixToken)):t.push(n),r=n.position.end;continue}}const i=this.tryMultiCharParticle(e,r,Td);if(i){const e=Ad.get(i.value);t.push(e?{...i,metadata:{particleRole:e.role,particleConfidence:e.confidence,particleVariant:e.variant}}:i),r=i.position.end;continue}if(Sd.has(e[r])){const n=e[r],i=Ad.get(n);t.push(i?{...Fl(n,"particle",Hl(r,r+1)),metadata:{particleRole:i.role,particleConfidence:i.confidence,particleVariant:i.variant}}:Fl(n,"particle",Hl(r,r+1))),r++;continue}if(Xl(e[r])){const n=this.extractAsciiWord(e,r);if(n){t.push(n),r=n.position.end;continue}}r++}return new Wl(t,"ko")}classifyToken(e){return Ed.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractKoreanWord(e,t){for(let r=Math.min(6,e.length-t);r>=2;r--){const n=e.slice(t,t+r);let i=!0;for(let e=0;e<n.length;e++)if(!xd(n[e])){i=!1;break}if(!i)continue;if(Ed.has(n)&&t==t){const n=t+r,i=n<e.length?e[n]:"";if(""===i||Ul(i)||!xd(i))return null}const a=this.lookupKeyword(n);if(a)return Fl(n,"keyword",Hl(t,t+r),a.normalized);const o=this.tryMorphKeywordMatch(n,t,t+r);if(o)return o}let r=t,n="";for(;r<e.length;){const t=e[r],i=r+1<e.length?e[r+1]:"";if(0===n.length&&Sd.has(t))return null;if(Sd.has(t)&&n.length>0){if(""===i||Ul(i)||!xd(i)||Sd.has(i))break}let a=!1;for(const t of Td)if(e.slice(r,r+t.length)===t&&n.length>0){const n=r+t.length,i=n<e.length?e[n]:"";if(""===i||Ul(i)||!xd(i)){a=!0;break}}if(a)break;if(!xd(t))break;n+=t,r++}if(!n)return null;if(Ed.has(n))return null;const i=this.lookupKeyword(n);if(i)return Fl(n,"keyword",Hl(t,r),i.normalized);const a=this.tryMorphKeywordMatch(n,t,r);return a||Fl(n,"identifier",Hl(t,r))}extractAsciiWord(e,t){let r=t,n="";for(;r<e.length&&Xl(e[r]);)n+=e[r++];return n?Fl(n,"identifier",Hl(t,r)):null}extractKoreanNumber(e,t){return this.tryNumberWithTimeUnits(e,t,jd,{allowSign:!1,skipWhitespace:!1})}trySplitTemporalSuffix(e){const t=e.value;for(const r of Cd)if(t.endsWith(r)&&t.length>r.length){const n=t.slice(0,-r.length),i=n.toLowerCase(),a=this.lookupKeyword(i);if(!a)continue;const o=e.position.start+n.length;return{stemToken:Fl(n,"keyword",Hl(e.position.start,o),a.normalized),suffixToken:Fl(r,"keyword",Hl(o,e.position.end),"when")}}return null}})}}),qd={};Tl(qd,{malayProfile:()=>Rd});var _d,$d,Wd,Vd=Sl({"src/generators/profiles/ms.ts"(){Rd={code:"ms",name:"Malay",nativeName:"Melayu",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"base",verb:{position:"start",subjectDrop:!0},references:{me:"saya",it:"ia",you:"kamu",result:"hasil",event:"peristiwa",target:"sasaran",body:"badan"},possessive:{marker:"",markerPosition:"after-object",keywords:{saya:"me",aku:"me",awak:"you",kamu:"you",anda:"you",dia:"it",ia:"it","-ku":"me","-mu":"you","-nya":"it"}},roleMarkers:{destination:{primary:"ke",alternatives:["pada"],position:"before"},source:{primary:"dari",position:"before"},patient:{primary:"",position:"before"},style:{primary:"dengan",position:"before"}},keywords:{toggle:{primary:"togol",alternatives:["tukar"],normalized:"toggle"},add:{primary:"tambah",normalized:"add"},remove:{primary:"buang",alternatives:["padam"],normalized:"remove"},put:{primary:"letak",alternatives:["letakkan"],normalized:"put"},append:{primary:"tambah_hujung",normalized:"append"},prepend:{primary:"tambah_mula",normalized:"prepend"},take:{primary:"ambil",normalized:"take"},make:{primary:"buat",alternatives:["cipta"],normalized:"make"},clone:{primary:"klon",alternatives:["salin"],normalized:"clone"},swap:{primary:"tukar_tempat",normalized:"swap"},morph:{primary:"ubah_bentuk",normalized:"morph"},set:{primary:"tetapkan",alternatives:["setkan"],normalized:"set"},get:{primary:"dapatkan",alternatives:["ambil"],normalized:"get"},increment:{primary:"tambah_satu",normalized:"increment"},decrement:{primary:"kurang_satu",normalized:"decrement"},log:{primary:"catat",alternatives:["log"],normalized:"log"},show:{primary:"tunjuk",alternatives:["papar"],normalized:"show"},hide:{primary:"sembunyi",alternatives:["sorok"],normalized:"hide"},transition:{primary:"peralihan",normalized:"transition"},on:{primary:"apabila",alternatives:["bila","ketika"],normalized:"on"},trigger:{primary:"cetuskan",normalized:"trigger"},send:{primary:"hantar",normalized:"send"},focus:{primary:"fokus",normalized:"focus"},blur:{primary:"kabur",normalized:"blur"},go:{primary:"pergi",alternatives:["pindah"],normalized:"go"},wait:{primary:"tunggu",normalized:"wait"},fetch:{primary:"ambil_dari",alternatives:["muat"],normalized:"fetch"},settle:{primary:"selesai",normalized:"settle"},if:{primary:"jika",alternatives:["kalau"],normalized:"if"},when:{primary:"apabila",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"kalau_tidak",alternatives:["jika_tidak"],normalized:"else"},repeat:{primary:"ulang",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selagi",alternatives:["semasa"],normalized:"while"},continue:{primary:"teruskan",normalized:"continue"},halt:{primary:"henti",alternatives:["berhenti"],normalized:"halt"},throw:{primary:"lempar",normalized:"throw"},call:{primary:"panggil",normalized:"call"},return:{primary:"pulang",alternatives:["kembali"],normalized:"return"},then:{primary:"kemudian",alternatives:["lepas_itu"],normalized:"then"},and:{primary:"dan",normalized:"and"},end:{primary:"tamat",alternatives:["habis"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"tak_segerak",normalized:"async"},tell:{primary:"beritahu",normalized:"tell"},default:{primary:"lalai",normalized:"default"},init:{primary:"mula",alternatives:["mulakan"],normalized:"init"},behavior:{primary:"kelakuan",normalized:"behavior"},install:{primary:"pasang",normalized:"install"},measure:{primary:"ukur",normalized:"measure"},into:{primary:"ke_dalam",normalized:"into"},before:{primary:"sebelum",normalized:"before"},after:{primary:"selepas",alternatives:["lepas"],normalized:"after"},until:{primary:"sehingga",alternatives:["sampai"],normalized:"until"},event:{primary:"peristiwa",normalized:"event"},from:{primary:"dari",normalized:"from"}},eventHandler:{keyword:{primary:"apabila",alternatives:["bila","ketika"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"}}}}}),Dd={};Tl(Dd,{MalayTokenizer:()=>$d,malayTokenizer:()=>Wd});var Bd,Hd=Sl({"src/tokenizers/ms.ts"(){rc(),Vd(),_d=[{native:"benar",normalized:"true"},{native:"salah",normalized:"false"},{native:"kosong",normalized:"null"},{native:"tak_tentu",normalized:"undefined"},{native:"pertama",normalized:"first"},{native:"terakhir",normalized:"last"},{native:"seterusnya",normalized:"next"},{native:"sebelumnya",normalized:"previous"},{native:"terdekat",normalized:"closest"},{native:"induk",normalized:"parent"},{native:"klik",normalized:"click"},{native:"berubah",normalized:"change"},{native:"ubah",normalized:"change"},{native:"hantar",normalized:"submit"},{native:"input",normalized:"input"},{native:"masuk",normalized:"input"},{native:"muat",normalized:"load"},{native:"tatal",normalized:"scroll"},{native:"hover",normalized:"hover"}],Wd=new($d=class extends Dl{constructor(){super(),this.language="ms",this.direction="ltr",this.initializeKeywordsFromProfile(Rd,_d)}tokenize(e){const t=[];let r=0;for(;r<e.length;)if(Ul(e[r]))r++;else{if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.tryNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(":"===e[r]){const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}}if("()[]{}:,;".includes(e[r]))t.push(Fl(e[r],"operator",Hl(r,r+1))),r++;else{if(Xl(e[r])){const n=r,i=this.tryProfileKeyword(e,r);if(i){t.push(i),r=i.position.end;continue}let a="";for(;r<e.length&&Xl(e[r]);)a+=e[r],r++;a&&t.push(Fl(a,"identifier",Hl(n,r)));continue}r++}}return new Wl(t,"ms")}classifyToken(e){return this.isKeyword(e)?"keyword":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}})}}),Fd={};Tl(Fd,{polishProfile:()=>Bd});var Ud,Kd,Gd,Yd,Xd,Zd,Jd=Sl({"src/generators/profiles/polish.ts"(){Bd={code:"pl",name:"Polish",nativeName:"Polski",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"imperative",verb:{position:"start",subjectDrop:!0,suffixes:["ać","eć","ić","yć","ąć","ować"]},references:{me:"ja",it:"to",you:"ty",result:"wynik",event:"zdarzenie",target:"cel",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,specialForms:{me:"mój",it:"jego",you:"twój"},keywords:{"mój":"me",moja:"me",moje:"me","twój":"you",twoja:"you",twoje:"you",jego:"it",jej:"it"}},roleMarkers:{destination:{primary:"do",alternatives:["w","na"],position:"before"},source:{primary:"z",alternatives:["od","ze"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"z",alternatives:["ze"],position:"before"}},keywords:{toggle:{primary:"przełącz",alternatives:["przelacz"],normalized:"toggle",form:"imperative"},add:{primary:"dodaj",normalized:"add",form:"imperative"},remove:{primary:"usuń",alternatives:["usun","wyczyść","wyczysc"],normalized:"remove",form:"imperative"},put:{primary:"umieść",alternatives:["umiesc","wstaw"],normalized:"put",form:"imperative"},append:{primary:"dołącz",alternatives:["dolacz"],normalized:"append",form:"imperative"},prepend:{primary:"poprzedź",alternatives:["poprzedz"],normalized:"prepend",form:"imperative"},take:{primary:"weź",alternatives:["wez"],normalized:"take",form:"imperative"},make:{primary:"utwórz",alternatives:["utworz","stwórz","stworz"],normalized:"make",form:"imperative"},clone:{primary:"sklonuj",alternatives:["kopiuj"],normalized:"clone",form:"imperative"},swap:{primary:"zamień",alternatives:["zamien"],normalized:"swap",form:"imperative"},morph:{primary:"przekształć",alternatives:["przeksztalc"],normalized:"morph",form:"imperative"},set:{primary:"ustaw",alternatives:["określ","okresl"],normalized:"set",form:"imperative"},get:{primary:"pobierz",alternatives:["weź","wez"],normalized:"get",form:"imperative"},increment:{primary:"zwiększ",alternatives:["zwieksz"],normalized:"increment",form:"imperative"},decrement:{primary:"zmniejsz",normalized:"decrement",form:"imperative"},log:{primary:"loguj",alternatives:["wypisz"],normalized:"log",form:"imperative"},show:{primary:"pokaż",alternatives:["pokaz","wyświetl","wyswietl"],normalized:"show",form:"imperative"},hide:{primary:"ukryj",alternatives:["schowaj"],normalized:"hide",form:"imperative"},transition:{primary:"animuj",alternatives:["przejście","przejscie"],normalized:"transition",form:"imperative"},on:{primary:"gdy",alternatives:["kiedy","przy","na"],normalized:"on"},trigger:{primary:"wywołaj",alternatives:["wywolaj","wyzwól","wyzwol"],normalized:"trigger",form:"imperative"},send:{primary:"wyślij",alternatives:["wyslij"],normalized:"send",form:"imperative"},focus:{primary:"skup",alternatives:["skupienie"],normalized:"focus",form:"imperative"},blur:{primary:"rozmyj",alternatives:["odskup"],normalized:"blur",form:"imperative"},go:{primary:"idź",alternatives:["idz","przejdź","przejdz","nawiguj"],normalized:"go",form:"imperative"},wait:{primary:"czekaj",alternatives:["poczekaj"],normalized:"wait",form:"imperative"},fetch:{primary:"pobierz",alternatives:["załaduj","zaladuj"],normalized:"fetch",form:"imperative"},settle:{primary:"ustabilizuj",normalized:"settle",form:"imperative"},if:{primary:"jeśli",alternatives:["jesli","jeżeli","jezeli"],normalized:"if"},when:{primary:"kiedy",normalized:"when"},where:{primary:"gdzie",normalized:"where"},else:{primary:"inaczej",alternatives:["wpp"],normalized:"else"},repeat:{primary:"powtórz",alternatives:["powtorz"],normalized:"repeat",form:"imperative"},for:{primary:"dla",alternatives:["każdy","kazdy"],normalized:"for"},while:{primary:"dopóki",alternatives:["dopoki","podczas"],normalized:"while"},continue:{primary:"kontynuuj",alternatives:["dalej"],normalized:"continue",form:"imperative"},halt:{primary:"zatrzymaj",alternatives:["przerwij","stop"],normalized:"halt",form:"imperative"},throw:{primary:"rzuć",alternatives:["rzuc"],normalized:"throw",form:"imperative"},call:{primary:"wywołaj",alternatives:["wywolaj"],normalized:"call",form:"imperative"},return:{primary:"zwróć",alternatives:["zwroc"],normalized:"return",form:"imperative"},then:{primary:"wtedy",alternatives:["potem","następnie","nastepnie"],normalized:"then"},and:{primary:"i",alternatives:["oraz"],normalized:"and"},end:{primary:"koniec",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",alternatives:["asynchronicznie"],normalized:"async"},tell:{primary:"powiedz",normalized:"tell",form:"imperative"},default:{primary:"domyślnie",alternatives:["domyslnie"],normalized:"default"},init:{primary:"inicjuj",normalized:"init",form:"imperative"},behavior:{primary:"zachowanie",normalized:"behavior"},install:{primary:"zainstaluj",normalized:"install",form:"imperative"},measure:{primary:"zmierz",normalized:"measure",form:"imperative"},into:{primary:"do",alternatives:["w"],normalized:"into"},before:{primary:"przed",normalized:"before"},after:{primary:"po",normalized:"after"},click:{primary:"kliknięciu",alternatives:["klikniecie","klik"],normalized:"click"},hover:{primary:"najechaniu",alternatives:["hover"],normalized:"hover"},submit:{primary:"wysłaniu",alternatives:["wyslaniu","submit"],normalized:"submit"},input:{primary:"wprowadzeniu",alternatives:["input"],normalized:"input"},change:{primary:"zmianie",alternatives:["zmiana"],normalized:"change"},until:{primary:"aż",alternatives:["az","do"],normalized:"until"},event:{primary:"zdarzenie",normalized:"event"},from:{primary:"z",alternatives:["od","ze"],normalized:"from"}},eventHandler:{keyword:{primary:"gdy",alternatives:["kiedy","przy","na"],normalized:"on"},sourceMarker:{primary:"na",alternatives:["w","przy"],position:"before"},conditionalKeyword:{primary:"kiedy",alternatives:["gdy","jeśli"]},eventMarker:{primary:"przy",alternatives:["na"],position:"before"},temporalMarkers:["kiedy","gdy","przy"]}}}}),Qd={};Tl(Qd,{PolishTokenizer:()=>Xd,polishTokenizer:()=>Zd});var eh,th=Sl({"src/tokenizers/polish.ts"(){rc(),Jd(),({isLetter:Ud,isIdentifierChar:Kd}=Ql(/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/)),Gd=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","między","miedzy","przez","dla","bez","o","przy","u","według","wedlug","mimo","wśród","wsrod","obok","poza","wokół","wokol","przeciw","ku"]),Yd=[{native:"prawda",normalized:"true"},{native:"fałsz",normalized:"false"},{native:"falsz",normalized:"false"},{native:"null",normalized:"null"},{native:"nieokreślony",normalized:"undefined"},{native:"nieokreslony",normalized:"undefined"},{native:"pierwszy",normalized:"first"},{native:"pierwsza",normalized:"first"},{native:"pierwsze",normalized:"first"},{native:"ostatni",normalized:"last"},{native:"ostatnia",normalized:"last"},{native:"ostatnie",normalized:"last"},{native:"następny",normalized:"next"},{native:"nastepny",normalized:"next"},{native:"poprzedni",normalized:"previous"},{native:"najbliższy",normalized:"closest"},{native:"najblizszy",normalized:"closest"},{native:"rodzic",normalized:"parent"},{native:"kliknięcie",normalized:"click"},{native:"klikniecie",normalized:"click"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"zmiana",normalized:"change"},{native:"wysłanie",normalized:"submit"},{native:"wyslanie",normalized:"submit"},{native:"naciśnięcie",normalized:"keydown"},{native:"nacisniecie",normalized:"keydown"},{native:"klawisz",normalized:"keydown"},{native:"najechanie",normalized:"mouseover"},{native:"zjechanie",normalized:"mouseout"},{native:"rozmycie",normalized:"blur"},{native:"załadowanie",normalized:"load"},{native:"zaladowanie",normalized:"load"},{native:"przewinięcie",normalized:"scroll"},{native:"przewiniecie",normalized:"scroll"},{native:"input",normalized:"input"},{native:"mój",normalized:"my"},{native:"moj",normalized:"my"},{native:"sekunda",normalized:"s"},{native:"sekundy",normalized:"s"},{native:"sekund",normalized:"s"},{native:"milisekunda",normalized:"ms"},{native:"milisekundy",normalized:"ms"},{native:"milisekund",normalized:"ms"},{native:"minuta",normalized:"m"},{native:"minuty",normalized:"m"},{native:"minut",normalized:"m"},{native:"godzina",normalized:"h"},{native:"godziny",normalized:"h"},{native:"godzin",normalized:"h"},{native:"połóż",normalized:"put"},{native:"poloz",normalized:"put"},{native:"lub",normalized:"or"},{native:"nie",normalized:"not"},{native:"jest",normalized:"is"},{native:"istnieje",normalized:"exists"},{native:"pusty",normalized:"empty"},{native:"puste",normalized:"empty"}],Zd=new(Xd=class extends Dl{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(Bd,Yd)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(Ud(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"pl")}classifyToken(e){const t=e.toLowerCase();return Gd.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&Kd(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase();if(Gd.has(i))return Fl(n,"particle",Hl(t,r));const a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){let r=t,n="";for("-"!==e[r]&&"+"!==e[r]||(n+=e[r++]);r<e.length&&Yl(e[r]);)n+=e[r++];if(r<e.length&&"."===e[r])for(n+=e[r++];r<e.length&&Yl(e[r]);)n+=e[r++];let i=r;for(;i<e.length&&Ul(e[i]);)i++;const a=e.slice(i).toLowerCase();return a.startsWith("milisekund")||a.startsWith("milisekunda")?(n+="ms",r=i+(a.startsWith("milisekundy")||a.startsWith("milisekunda")?11:10)):a.startsWith("sekund")||a.startsWith("sekunda")?(n+="s",r=i+(a.startsWith("sekundy")||a.startsWith("sekunda")?7:6)):a.startsWith("minut")||a.startsWith("minuta")?(n+="m",r=i+(a.startsWith("minuty")||a.startsWith("minuta")?6:5)):a.startsWith("godzin")||a.startsWith("godzina")?(n+="h",r=i+(a.startsWith("godziny")||a.startsWith("godzina")?7:6)):a.startsWith("ms")?(n+="ms",r=i+2):a.startsWith("s")&&!a.startsWith("se")&&(n+="s",r=i+1),n&&"-"!==n&&"+"!==n?Fl(n,"literal",Hl(t,r)):null}})}}),rh={};Tl(rh,{portugueseProfile:()=>eh});var nh,ih,ah,oh,sh,lh,ch,uh=Sl({"src/generators/profiles/portuguese.ts"(){eh={code:"pt",name:"Portuguese",nativeName:"Português",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"start",subjectDrop:!0},references:{me:"eu",it:"ele",you:"você",result:"resultado",event:"evento",target:"alvo",body:"corpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:!0,specialForms:{me:"meu",it:"seu",you:"teu"},keywords:{meu:"me",minha:"me",teu:"you",tua:"you",seu:"it",sua:"it"}},roleMarkers:{destination:{primary:"em",alternatives:["para","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"com",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["trocar"],normalized:"toggle"},add:{primary:"adicionar",alternatives:["acrescentar"],normalized:"add"},remove:{primary:"remover",alternatives:["eliminar","apagar"],normalized:"remove"},put:{primary:"colocar",alternatives:["pôr","por"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"preceder",normalized:"prepend"},take:{primary:"pegar",normalized:"take"},make:{primary:"fazer",alternatives:["criar"],normalized:"make"},clone:{primary:"clonar",alternatives:["copiar"],normalized:"clone"},swap:{primary:"trocar",alternatives:["substituir"],normalized:"swap"},morph:{primary:"transformar",alternatives:["converter"],normalized:"morph"},set:{primary:"definir",alternatives:["configurar"],normalized:"set"},get:{primary:"obter",normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["diminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["exibir"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transição",alternatives:["animar"],normalized:"transition"},on:{primary:"em",alternatives:["quando","ao"],normalized:"on"},trigger:{primary:"disparar",alternatives:["ativar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"focar",normalized:"focus"},blur:{primary:"desfocar",normalized:"blur"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},wait:{primary:"esperar",alternatives:["aguardar"],normalized:"wait"},fetch:{primary:"buscar",normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"se",normalized:"if"},when:{primary:"quando",normalized:"when"},where:{primary:"onde",normalized:"where"},else:{primary:"senão",normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"enquanto",normalized:"while"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"parar",normalized:"halt"},throw:{primary:"lançar",normalized:"throw"},call:{primary:"chamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"então",alternatives:["depois","logo"],normalized:"then"},and:{primary:"e",alternatives:["também","além disso"],normalized:"and"},end:{primary:"fim",alternatives:["final","término"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"assíncrono",normalized:"async"},tell:{primary:"dizer",normalized:"tell"},default:{primary:"padrão",normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},into:{primary:"em",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"depois",normalized:"after"},click:{primary:"clique",alternatives:["clicar"],normalized:"click"},hover:{primary:"sobrevoar",alternatives:["passar"],normalized:"hover"},submit:{primary:"envio",alternatives:["submeter"],normalized:"submit"},input:{primary:"entrada",alternatives:["inserção"],normalized:"input"},change:{primary:"alteração",alternatives:["mudança"],normalized:"change"},until:{primary:"até",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"}},eventHandler:{keyword:{primary:"em",alternatives:["ao","quando"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"ao",alternatives:["no"],position:"before"},temporalMarkers:["quando","ao"]}}}}),ph={};Tl(ph,{PortugueseTokenizer:()=>lh,portugueseTokenizer:()=>ch});var mh,dh=Sl({"src/tokenizers/portuguese.ts"(){rc(),uh(),({isLetter:nh,isIdentifierChar:ih}=Ql(/[a-zA-ZáàâãéêíóôõúüçÁÀÂÃÉÊÍÓÔÕÚÜÇ]/)),ah=new Set(["em","a","de","desde","até","ate","com","sem","por","para","sobre","entre","antes","depois","dentro","fora","ao","do","no","na"]),oh=[{native:"verdadeiro",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primeiro",normalized:"first"},{native:"primeira",normalized:"first"},{native:"último",normalized:"last"},{native:"ultima",normalized:"last"},{native:"próximo",normalized:"next"},{native:"proximo",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"mais próximo",normalized:"closest"},{native:"mais proximo",normalized:"closest"},{native:"pai",normalized:"parent"},{native:"clique",normalized:"click"},{native:"click",normalized:"click"},{native:"entrada",normalized:"input"},{native:"mudança",normalized:"change"},{native:"mudanca",normalized:"change"},{native:"envio",normalized:"submit"},{native:"tecla baixo",normalized:"keydown"},{native:"tecla cima",normalized:"keyup"},{native:"mouse sobre",normalized:"mouseover"},{native:"mouse fora",normalized:"mouseout"},{native:"foco",normalized:"focus"},{native:"desfoque",normalized:"blur"},{native:"carregar",normalized:"load"},{native:"rolagem",normalized:"scroll"},{native:"meu",normalized:"my"},{native:"minha",normalized:"my"},{native:"isso",normalized:"it"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milissegundo",normalized:"ms"},{native:"milissegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"senao",normalized:"else"},{native:"transicao",normalized:"transition"},{native:"ate",normalized:"until"},{native:"entao",normalized:"then"},{native:"lancar",normalized:"throw"},{native:"assincrono",normalized:"async"},{native:"padrao",normalized:"default"},{native:"até que",normalized:"until"},{native:"dentro de",normalized:"into"}],sh=[{pattern:"milissegundos",suffix:"ms",length:13,caseInsensitive:!0},{pattern:"milissegundo",suffix:"ms",length:12,caseInsensitive:!0},{pattern:"segundos",suffix:"s",length:8,caseInsensitive:!0},{pattern:"segundo",suffix:"s",length:7,caseInsensitive:!0},{pattern:"minutos",suffix:"m",length:7,caseInsensitive:!0},{pattern:"minuto",suffix:"m",length:6,caseInsensitive:!0},{pattern:"horas",suffix:"h",length:5,caseInsensitive:!0},{pattern:"hora",suffix:"h",length:4,caseInsensitive:!0}],ch=new(lh=class extends Dl{constructor(){super(),this.language="pt",this.direction="ltr",this.initializeKeywordsFromProfile(eh,oh)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(nh(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"pt")}classifyToken(e){const t=e.toLowerCase();return ah.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&ih(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):ah.has(i)?Fl(n,"particle",Hl(t,r)):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){return this.tryNumberWithTimeUnits(e,t,sh,{allowSign:!0,skipWhitespace:!0})}})}}),hh={};Tl(hh,{quechuaProfile:()=>mh});var fh,yh,vh,gh,kh,wh,bh=Sl({"src/generators/profiles/quechua.ts"(){mh={code:"qu",name:"Quechua",nativeName:"Runasimi",direction:"ltr",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:!0,verb:{position:"end",subjectDrop:!0},references:{me:"ñuqa",it:"pay",you:"qam",result:"rurasqa",event:"ruwakuq",target:"ñawpaqman",body:"ukhu"},possessive:{marker:"-pa",markerPosition:"after-object",keywords:{"ñuqapa":"me","ñuqaypa":"me",qampa:"you",paypa:"it"}},roleMarkers:{patient:{primary:"-ta",position:"after"},destination:{primary:"-man",position:"after"},source:{primary:"-manta",position:"after"},style:{primary:"-wan",position:"after"},event:{primary:"-ta",position:"after"}},keywords:{toggle:{primary:"t'ikray",alternatives:["tikray","kutichiy"],normalized:"toggle"},add:{primary:"yapay",alternatives:["yapaykuy"],normalized:"add"},remove:{primary:"qichuy",alternatives:["hurquy","anchuchiy"],normalized:"remove"},put:{primary:"churay",alternatives:["tiyachiy"],normalized:"put"},append:{primary:"qatichiy",normalized:"append"},prepend:{primary:"ñawpachiy",normalized:"prepend"},take:{primary:"hapiy",normalized:"take"},make:{primary:"ruray",alternatives:["kamay"],normalized:"make"},clone:{primary:"kikinchay",alternatives:["qillqay"],normalized:"clone"},swap:{primary:"t'inkuy",alternatives:["rantikunakuy"],normalized:"swap"},morph:{primary:"tikray",alternatives:["kutichiy"],normalized:"morph"},set:{primary:"churay",alternatives:["kamaykuy"],normalized:"set"},get:{primary:"taripay",normalized:"get"},increment:{primary:"yapachiy",normalized:"increment"},decrement:{primary:"pisiyachiy",normalized:"decrement"},log:{primary:"qillqakuy",alternatives:["willakuy"],normalized:"log"},show:{primary:"rikuchiy",alternatives:["qawachiy"],normalized:"show"},hide:{primary:"pakay",alternatives:["pakakuy"],normalized:"hide"},transition:{primary:"tikray",alternatives:["kuyuchiy"],normalized:"transition"},on:{primary:"chaypim",alternatives:["kaypi"],normalized:"on"},trigger:{primary:"qallarichiy",normalized:"trigger"},send:{primary:"kachay",alternatives:["apachiy"],normalized:"send"},focus:{primary:"qhawachiy",normalized:"focus"},blur:{primary:"mana qhawachiy",normalized:"blur"},go:{primary:"riy",alternatives:["puriy"],normalized:"go"},wait:{primary:"suyay",normalized:"wait"},fetch:{primary:"apamuy",alternatives:["taripakaramuy"],normalized:"fetch"},settle:{primary:"tiyakuy",normalized:"settle"},if:{primary:"sichus",normalized:"if"},when:{primary:"maykama",normalized:"when"},where:{primary:"maypi",normalized:"where"},else:{primary:"manachus",alternatives:["hukniraq"],normalized:"else"},repeat:{primary:"kutipay",alternatives:["muyu"],normalized:"repeat"},for:{primary:"sapankaq",normalized:"for"},while:{primary:"kaykamaqa",normalized:"while"},continue:{primary:"qatipay",normalized:"continue"},halt:{primary:"sayay",alternatives:["tukuy"],normalized:"halt"},throw:{primary:"chanqay",normalized:"throw"},call:{primary:"waqyay",normalized:"call"},return:{primary:"kutichiy",alternatives:["kutimuy"],normalized:"return"},then:{primary:"chaymantataq",alternatives:["hinaspa","chaymanta"],normalized:"then"},and:{primary:"hinallataq",alternatives:["ima","chaymantawan"],normalized:"and"},end:{primary:"tukukuy",alternatives:["tukuy","puchukay"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"mana waqtalla",normalized:"async"},tell:{primary:"niy",alternatives:["willakuy"],normalized:"tell"},default:{primary:"qallariy",normalized:"default"},init:{primary:"qallarichiy",normalized:"init"},behavior:{primary:"ruwana",normalized:"behavior"},install:{primary:"churay",normalized:"install"},measure:{primary:"tupuy",normalized:"measure"},into:{primary:"ukuman",normalized:"into"},before:{primary:"ñawpaq",normalized:"before"},after:{primary:"qhipa",normalized:"after"},until:{primary:"-kama",alternatives:["kama"],normalized:"until"},event:{primary:"ruwakuq",alternatives:["imayna"],normalized:"event"},from:{primary:"-manta",normalized:"from"}}}}}),zh={};Tl(zh,{QuechuaTokenizer:()=>kh,quechuaTokenizer:()=>wh});var xh,Eh=Sl({"src/tokenizers/quechua.ts"(){rc(),bh(),({isLetter:fh,isIdentifierChar:yh}=Ql(/[a-zA-ZñÑ']/)),vh=new Set(["-ta","-man","-manta","-pi","-wan","-paq","-kama","-rayku","-hina"]),gh=[{native:"arí",normalized:"true"},{native:"ari",normalized:"true"},{native:"manan",normalized:"false"},{native:"mana",normalized:"false"},{native:"ch'usaq",normalized:"null"},{native:"chusaq",normalized:"null"},{native:"mana riqsisqa",normalized:"undefined"},{native:"ñawpaq",normalized:"first"},{native:"nawpaq",normalized:"first"},{native:"qhipa",normalized:"last"},{native:"hamuq",normalized:"next"},{native:"ñawpaq kaq",normalized:"previous"},{native:"aswan qayllaqa",normalized:"closest"},{native:"tayta",normalized:"parent"},{native:"llikllay",normalized:"click"},{native:"ñitiy",normalized:"click"},{native:"click",normalized:"click"},{native:"yaykuy",normalized:"input"},{native:"llave uray",normalized:"keydown"},{native:"llave hawa",normalized:"keyup"},{native:"mausiri yayku",normalized:"mouseover"},{native:"mausiri lluqsi",normalized:"mouseout"},{native:"qhaway",normalized:"focus"},{native:"mana qhaway",normalized:"blur"},{native:"kargay",normalized:"load"},{native:"muyuy",normalized:"scroll"},{native:"ñuqa",normalized:"me"},{native:"nuqa",normalized:"me"},{native:"ñuqap",normalized:"my"},{native:"nuqap",normalized:"my"},{native:"chay",normalized:"it"},{native:"chaymi",normalized:"it"},{native:"lluqsiy",normalized:"result"},{native:"ruway",normalized:"event"},{native:"maypi",normalized:"target"},{native:"sikundu",normalized:"s"},{native:"segundu",normalized:"s"},{native:"waranqa sikundu",normalized:"ms"},{native:"minutu",normalized:"m"},{native:"ura",normalized:"h"},{native:"hora",normalized:"h"},{native:"chaypim",normalized:"on"},{native:"kaypi",normalized:"on"},{native:"chayqa",normalized:"then"},{native:"chaymanta",normalized:"then"},{native:"chaymantataq",normalized:"then"},{native:"hinaspa",normalized:"then"},{native:"tukukuy",normalized:"end"},{native:"puchukay",normalized:"end"},{native:"kaykama",normalized:"until"},{native:"yapay",normalized:"add"},{native:"t'ikray",normalized:"toggle"},{native:"tikray",normalized:"toggle"},{native:"qhawachiy",normalized:"focus"},{native:"mana qhawachiy",normalized:"blur"},{native:"-manta",normalized:"from"}],wh=new(kh=class extends Dl{constructor(){super(),this.language="qu",this.direction="ltr",this.initializeKeywordsFromProfile(mh,gh)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){const e=this.splitSelectorSuffix(i);2===e.length?(t.push(e[0]),t.push(e[1]),r=e[1].position.end):(t.push(i),r=i.position.end);continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if("-"===e[r]){const n=this.trySuffix(e,r);if(n){t.push(n),r=n.position.end;continue}}if(fh(e[r])){const n=this.tryMultiWordKeyword(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.extractWord(e,r);if(i){t.push(i),r=i.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"qu")}classifyToken(e){const t=e.toLowerCase();return vh.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}trySuffix(e,t){for(const r of vh)if(e.slice(t,t+r.length).toLowerCase()===r)return Fl(e.slice(t,t+r.length),"particle",Hl(t,t+r.length));return null}splitSelectorSuffix(e){const t=e.value;for(const r of vh)if(t.toLowerCase().endsWith(r)){const n=t.length-r.length,i=t.slice(0,n),a=t.slice(n);return[Fl(i,"selector",Hl(e.position.start,e.position.start+n)),Fl(a,"particle",Hl(e.position.start+n,e.position.end))]}return[e]}tryMultiWordKeyword(e,t){const r=[{pattern:"mana qhawachiy",normalized:"blur"},{pattern:"mana qhaway",normalized:"blur"},{pattern:"mana riqsisqa",normalized:"undefined"},{pattern:"mana waqtalla",normalized:"async"},{pattern:"ñawpaq kaq",normalized:"previous"},{pattern:"aswan qayllaqa",normalized:"closest"},{pattern:"llave uray",normalized:"keydown"},{pattern:"llave hawa",normalized:"keyup"},{pattern:"mausiri yayku",normalized:"mouseover"},{pattern:"mausiri lluqsi",normalized:"mouseout"},{pattern:"waranqa sikundu",normalized:"ms"}],n=e.toLowerCase();for(const{pattern:i,normalized:a}of r)if(n.slice(t,t+i.length)===i){const r=t+i.length;if(r>=e.length||Ul(e[r])||!fh(e[r]))return Fl(e.slice(t,r),"keyword",Hl(t,r),a)}return null}extractWord(e,t){let r=t,n="";for(;r<e.length&&yh(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){let r=t,n="";for("-"!==e[r]&&"+"!==e[r]||(n+=e[r++]);r<e.length&&Yl(e[r]);)n+=e[r++];if(r<e.length&&"."===e[r])for(n+=e[r++];r<e.length&&Yl(e[r]);)n+=e[r++];let i=r;for(;i<e.length&&Ul(e[i]);)i++;const a=e.slice(i).toLowerCase();return a.startsWith("sikundu")||a.startsWith("segundu")?(n+="s",r=i+7):a.startsWith("minutu")?(n+="m",r=i+6):(a.startsWith("hora")||a.startsWith("ura"))&&(n+="h",r=i+(a.startsWith("hora")?4:3)),n&&"-"!==n&&"+"!==n?Fl(n,"literal",Hl(t,r)):null}})}}),Sh={};Tl(Sh,{russianProfile:()=>xh});var Th,Ch,Ah,Lh,jh,Ph,Nh=Sl({"src/generators/profiles/russian.ts"(){xh={code:"ru",name:"Russian",nativeName:"Русский",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!0,suffixes:["ть","ться","ить","иться","ать","аться","еть","еться"]},references:{me:"я",it:"это",you:"ты",result:"результат",event:"событие",target:"цель",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,specialForms:{me:"мой",it:"его",you:"твой"},keywords:{"мой":"me","моя":"me","моё":"me","мои":"me","твой":"you","твоя":"you","твоё":"you","твои":"you","его":"it","её":"it"}},roleMarkers:{destination:{primary:"в",alternatives:["на","к"],position:"before"},source:{primary:"из",alternatives:["от","с"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"с",alternatives:["со"],position:"before"}},keywords:{toggle:{primary:"переключить",alternatives:["переключи"],normalized:"toggle",form:"infinitive"},add:{primary:"добавить",alternatives:["добавь"],normalized:"add",form:"infinitive"},remove:{primary:"удалить",alternatives:["удали","убрать","убери"],normalized:"remove",form:"infinitive"},put:{primary:"положить",alternatives:["положи","поместить","помести","вставить","вставь"],normalized:"put",form:"infinitive"},append:{primary:"добавить_в_конец",alternatives:["дописать"],normalized:"append",form:"infinitive"},prepend:{primary:"добавить_в_начало",normalized:"prepend",form:"infinitive"},take:{primary:"взять",alternatives:["возьми"],normalized:"take",form:"infinitive"},make:{primary:"создать",alternatives:["создай"],normalized:"make",form:"infinitive"},clone:{primary:"клонировать",alternatives:["клонируй"],normalized:"clone",form:"infinitive"},swap:{primary:"поменять",alternatives:["поменяй"],normalized:"swap",form:"infinitive"},morph:{primary:"трансформировать",alternatives:["трансформируй"],normalized:"morph",form:"infinitive"},set:{primary:"установить",alternatives:["установи","задать","задай"],normalized:"set",form:"infinitive"},get:{primary:"получить",alternatives:["получи"],normalized:"get",form:"infinitive"},increment:{primary:"увеличить",alternatives:["увеличь"],normalized:"increment",form:"infinitive"},decrement:{primary:"уменьшить",alternatives:["уменьши"],normalized:"decrement",form:"infinitive"},log:{primary:"записать",alternatives:["запиши"],normalized:"log",form:"infinitive"},show:{primary:"показать",alternatives:["покажи"],normalized:"show",form:"infinitive"},hide:{primary:"скрыть",alternatives:["скрой","спрятать","спрячь"],normalized:"hide",form:"infinitive"},transition:{primary:"анимировать",alternatives:["анимируй"],normalized:"transition",form:"infinitive"},on:{primary:"при",alternatives:["когда"],normalized:"on"},trigger:{primary:"вызвать",alternatives:["вызови"],normalized:"trigger",form:"infinitive"},send:{primary:"отправить",alternatives:["отправь"],normalized:"send",form:"infinitive"},focus:{primary:"сфокусировать",alternatives:["сфокусируй","фокус"],normalized:"focus",form:"infinitive"},blur:{primary:"размыть",alternatives:["размой"],normalized:"blur",form:"infinitive"},click:{primary:"клик",alternatives:["клике","нажатии"],normalized:"click"},hover:{primary:"наведении",alternatives:["наведение"],normalized:"hover"},submit:{primary:"отправке",alternatives:["отправка"],normalized:"submit"},input:{primary:"вводе",alternatives:["ввод"],normalized:"input"},change:{primary:"изменении",alternatives:["изменение"],normalized:"change"},go:{primary:"перейти",alternatives:["перейди","идти","иди"],normalized:"go",form:"infinitive"},wait:{primary:"ждать",alternatives:["жди","подожди"],normalized:"wait",form:"infinitive"},fetch:{primary:"загрузить",alternatives:["загрузи"],normalized:"fetch",form:"infinitive"},settle:{primary:"стабилизировать",normalized:"settle",form:"infinitive"},if:{primary:"если",normalized:"if"},when:{primary:"когда",normalized:"when"},where:{primary:"где",normalized:"where"},else:{primary:"иначе",normalized:"else"},repeat:{primary:"повторить",alternatives:["повтори"],normalized:"repeat",form:"infinitive"},for:{primary:"для",alternatives:["каждый"],normalized:"for"},while:{primary:"пока",normalized:"while"},continue:{primary:"продолжить",alternatives:["продолжи"],normalized:"continue",form:"infinitive"},halt:{primary:"остановить",alternatives:["остановись","стоп"],normalized:"halt",form:"infinitive"},throw:{primary:"бросить",alternatives:["брось"],normalized:"throw",form:"infinitive"},call:{primary:"вызвать",alternatives:["вызови"],normalized:"call",form:"infinitive"},return:{primary:"вернуть",alternatives:["верни"],normalized:"return",form:"infinitive"},then:{primary:"затем",alternatives:["потом","тогда"],normalized:"then"},and:{primary:"и",normalized:"and"},end:{primary:"конец",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"асинхронно",alternatives:["async"],normalized:"async"},tell:{primary:"сказать",alternatives:["скажи"],normalized:"tell",form:"infinitive"},default:{primary:"по_умолчанию",normalized:"default"},init:{primary:"инициализировать",alternatives:["инициализируй"],normalized:"init",form:"infinitive"},behavior:{primary:"поведение",normalized:"behavior"},install:{primary:"установить_пакет",normalized:"install",form:"infinitive"},measure:{primary:"измерить",alternatives:["измерь"],normalized:"measure",form:"infinitive"},into:{primary:"в",alternatives:["во"],normalized:"into"},before:{primary:"до",alternatives:["перед"],normalized:"before"},after:{primary:"после",normalized:"after"},until:{primary:"до",alternatives:["пока_не"],normalized:"until"},event:{primary:"событие",normalized:"event"},from:{primary:"из",alternatives:["от","с"],normalized:"from"}},eventHandler:{keyword:{primary:"при",alternatives:["когда"],normalized:"on"},sourceMarker:{primary:"на",alternatives:["в","при"],position:"before"},eventMarker:{primary:"при",alternatives:["когда"],position:"before"},temporalMarkers:["когда","если"]}}}}),Oh={};Tl(Oh,{RussianTokenizer:()=>jh,russianTokenizer:()=>Ph});var Ih,Rh=Sl({"src/tokenizers/russian.ts"(){rc(),Nh(),({isLetter:Th,isIdentifierChar:Ch}=Ql(/[a-zA-Zа-яА-ЯёЁ]/)),Ah=new Set(["в","во","на","с","со","к","ко","о","об","обо","у","от","до","из","за","по","под","над","перед","передо","между","через","без","для","при","про","после","вокруг","против","вместо","кроме","среди"]),Lh=[{native:"истина",normalized:"true"},{native:"правда",normalized:"true"},{native:"ложь",normalized:"false"},{native:"null",normalized:"null"},{native:"неопределено",normalized:"undefined"},{native:"первый",normalized:"first"},{native:"первая",normalized:"first"},{native:"первое",normalized:"first"},{native:"последний",normalized:"last"},{native:"последняя",normalized:"last"},{native:"последнее",normalized:"last"},{native:"следующий",normalized:"next"},{native:"следующая",normalized:"next"},{native:"предыдущий",normalized:"previous"},{native:"предыдущая",normalized:"previous"},{native:"ближайший",normalized:"closest"},{native:"родитель",normalized:"parent"},{native:"клик",normalized:"click"},{native:"нажатие",normalized:"click"},{native:"click",normalized:"click"},{native:"изменение",normalized:"change"},{native:"отправка",normalized:"submit"},{native:"клавиша",normalized:"keydown"},{native:"наведение",normalized:"mouseover"},{native:"уход",normalized:"mouseout"},{native:"загрузка",normalized:"load"},{native:"прокрутка",normalized:"scroll"},{native:"ввод",normalized:"input"},{native:"мой",normalized:"my"},{native:"моя",normalized:"my"},{native:"моё",normalized:"my"},{native:"мои",normalized:"my"},{native:"секунда",normalized:"s"},{native:"секунды",normalized:"s"},{native:"секунд",normalized:"s"},{native:"миллисекунда",normalized:"ms"},{native:"миллисекунды",normalized:"ms"},{native:"миллисекунд",normalized:"ms"},{native:"минута",normalized:"m"},{native:"минуты",normalized:"m"},{native:"минут",normalized:"m"},{native:"час",normalized:"h"},{native:"часа",normalized:"h"},{native:"часов",normalized:"h"},{native:"или",normalized:"or"},{native:"не",normalized:"not"},{native:"есть",normalized:"is"},{native:"существует",normalized:"exists"},{native:"пустой",normalized:"empty"},{native:"пустая",normalized:"empty"},{native:"пустое",normalized:"empty"}],Ph=new(jh=class extends Dl{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(xh,Lh)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(Th(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"ru")}classifyToken(e){const t=e.toLowerCase();return Ah.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&Ch(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase();if(Ah.has(i))return Fl(n,"particle",Hl(t,r));const a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){let r=t,n="";for("-"!==e[r]&&"+"!==e[r]||(n+=e[r++]);r<e.length&&Yl(e[r]);)n+=e[r++];if(r<e.length&&"."===e[r])for(n+=e[r++];r<e.length&&Yl(e[r]);)n+=e[r++];let i=r;for(;i<e.length&&Ul(e[i]);)i++;const a=e.slice(i).toLowerCase();return a.startsWith("миллисекунд")||a.startsWith("мс")?a.startsWith("миллисекунд")?(n+="ms",r=i+11,a.length>11&&/[аы]/.test(a[11])&&r++):(n+="ms",r=i+2):a.startsWith("секунд")||a.startsWith("сек")?a.startsWith("секунд")?(n+="s",r=i+6,a.length>6&&/[аы]/.test(a[6])&&r++):(n+="s",r=i+3):a.startsWith("минут")||a.startsWith("мин")?a.startsWith("минут")?(n+="m",r=i+5,a.length>5&&/[аы]/.test(a[5])&&r++):(n+="m",r=i+3):a.startsWith("час")?(n+="h",r=i+3,a.length>3&&"а"===a[3]?r++:a.length>3&&"ов"===a.slice(3,5)&&(r+=2)):a.startsWith("ms")?(n+="ms",r=i+2):a.startsWith("s")&&!a.startsWith("se")&&(n+="s",r=i+1),n&&"-"!==n&&"+"!==n?Fl(n,"literal",Hl(t,r)):null}})}}),Mh={};Tl(Mh,{swahiliProfile:()=>Ih});var qh,_h,$h,Wh,Vh,Dh,Bh=Sl({"src/generators/profiles/swahili.ts"(){Ih={code:"sw",name:"Swahili",nativeName:"Kiswahili",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"start",subjectDrop:!0},references:{me:"mimi",it:"hiyo",you:"wewe",result:"matokeo",event:"tukio",target:"lengo",body:"mwili"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,specialForms:{me:"yangu",it:"yake",you:"yako"},keywords:{wangu:"me",yangu:"me",langu:"me",changu:"me",wako:"you",yako:"you",lako:"you",chako:"you",wake:"it",yake:"it",lake:"it",chake:"it"}},roleMarkers:{destination:{primary:"kwenye",alternatives:["kwa"],position:"before"},source:{primary:"kutoka",position:"before"},patient:{primary:"",position:"before"},style:{primary:"na",position:"before"}},keywords:{toggle:{primary:"badilisha",alternatives:["geuza"],normalized:"toggle"},add:{primary:"ongeza",alternatives:["weka"],normalized:"add"},remove:{primary:"ondoa",alternatives:["futa","toa"],normalized:"remove"},put:{primary:"weka",alternatives:["tia"],normalized:"put"},append:{primary:"ambatanisha",normalized:"append"},prepend:{primary:"tanguliza",normalized:"prepend"},take:{primary:"chukua",normalized:"take"},make:{primary:"tengeneza",alternatives:["unda"],normalized:"make"},clone:{primary:"nakili",alternatives:["rudufu"],normalized:"clone"},swap:{primary:"badilisha",alternatives:["badalisha"],normalized:"swap"},morph:{primary:"geuza",alternatives:["badilisha umbo"],normalized:"morph"},set:{primary:"weka",alternatives:["seti"],normalized:"set"},get:{primary:"pata",alternatives:["pokea"],normalized:"get"},increment:{primary:"ongeza",normalized:"increment"},decrement:{primary:"punguza",normalized:"decrement"},log:{primary:"andika",alternatives:["rekodi"],normalized:"log"},show:{primary:"onyesha",normalized:"show"},hide:{primary:"ficha",alternatives:["mficho"],normalized:"hide"},transition:{primary:"hamisha",alternatives:["animisha"],normalized:"transition"},on:{primary:"wakati",alternatives:["kwenye","unapo"],normalized:"on"},trigger:{primary:"chochea",alternatives:["anzisha"],normalized:"trigger"},send:{primary:"tuma",alternatives:["peleka"],normalized:"send"},focus:{primary:"lenga",alternatives:["angazia"],normalized:"focus"},blur:{primary:"blur",normalized:"blur"},go:{primary:"nenda",alternatives:["enda","elekea"],normalized:"go"},wait:{primary:"subiri",alternatives:["ngoja"],normalized:"wait"},fetch:{primary:"leta",alternatives:["pakia"],normalized:"fetch"},settle:{primary:"tulia",alternatives:["imarika"],normalized:"settle"},if:{primary:"kama",alternatives:["ikiwa"],normalized:"if"},when:{primary:"wakati",normalized:"when"},where:{primary:"wapi",normalized:"where"},else:{primary:"vinginevyo",alternatives:["sivyo"],normalized:"else"},repeat:{primary:"rudia",normalized:"repeat"},for:{primary:"kwa",normalized:"for"},while:{primary:"wakati",normalized:"while"},continue:{primary:"endelea",normalized:"continue"},halt:{primary:"simama",alternatives:["acha"],normalized:"halt"},throw:{primary:"tupa",normalized:"throw"},call:{primary:"ita",normalized:"call"},return:{primary:"rudisha",alternatives:["rejea"],normalized:"return"},then:{primary:"kisha",alternatives:["halafu","baadaye"],normalized:"then"},and:{primary:"na",alternatives:["pia","vilevile"],normalized:"and"},end:{primary:"mwisho",alternatives:["maliza","tamati"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"isiyo sawia",normalized:"async"},tell:{primary:"sema",alternatives:["ambia"],normalized:"tell"},default:{primary:"chaguo-msingi",normalized:"default"},init:{primary:"anzisha",alternatives:["anza"],normalized:"init"},behavior:{primary:"tabia",normalized:"behavior"},install:{primary:"weka",alternatives:["sakinisha"],normalized:"install"},measure:{primary:"pima",normalized:"measure"},into:{primary:"ndani",normalized:"into"},before:{primary:"kabla",normalized:"before"},after:{primary:"baada",normalized:"after"},until:{primary:"hadi",normalized:"until"},event:{primary:"tukio",normalized:"event"},from:{primary:"kutoka",normalized:"from"}},eventHandler:{keyword:{primary:"wakati",alternatives:["kwenye","kwa"]},sourceMarker:{primary:"kutoka",position:"before"},conditionalKeyword:{primary:"unapo",alternatives:["anapo","tunapo","mnapo","wanapo"]}}}}}),Hh={};Tl(Hh,{SwahiliTokenizer:()=>Vh,swahiliTokenizer:()=>Dh});var Fh,Uh=Sl({"src/tokenizers/swahili.ts"(){rc(),Bh(),({isLetter:qh,isIdentifierChar:_h}=Ql(/[a-zA-Z]/)),$h=new Set(["kwa","na","katika","kwenye","kutoka","hadi","mpaka","kabla","baada","wakati","bila","kuhusu","karibu","mbele","nyuma","ndani","nje","juu","chini","kati"]),Wh=[{native:"kweli",normalized:"true"},{native:"uongo",normalized:"false"},{native:"null",normalized:"null"},{native:"tupu",normalized:"null"},{native:"haijafafanuliwa",normalized:"undefined"},{native:"kwanza",normalized:"first"},{native:"mwisho",normalized:"last"},{native:"inayofuata",normalized:"next"},{native:"iliyopita",normalized:"previous"},{native:"karibu zaidi",normalized:"closest"},{native:"mzazi",normalized:"parent"},{native:"bonyeza",normalized:"click"},{native:"click",normalized:"click"},{native:"ingiza",normalized:"input"},{native:"badiliko",normalized:"change"},{native:"wasilisha",normalized:"submit"},{native:"funguo chini",normalized:"keydown"},{native:"funguo juu",normalized:"keyup"},{native:"kipanya juu",normalized:"mouseover"},{native:"kipanya nje",normalized:"mouseout"},{native:"ukungu",normalized:"blur"},{native:"sogeza",normalized:"scroll"},{native:"yenyewe",normalized:"it"},{native:"wangu",normalized:"my"},{native:"langu",normalized:"my"},{native:"changu",normalized:"my"},{native:"sekunde",normalized:"s"},{native:"milisekunde",normalized:"ms"},{native:"dakika",normalized:"m"},{native:"saa",normalized:"h"},{native:"ondoa lenga",normalized:"blur"},{native:"piga simu",normalized:"call"},{native:"basi",normalized:"then"},{native:"mpaka",normalized:"until"}],Dh=new(Vh=class extends Dl{constructor(){super(),this.language="sw",this.direction="ltr",this.initializeKeywordsFromProfile(Ih,Wh)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(qh(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"sw")}classifyToken(e){const t=e.toLowerCase();return $h.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&_h(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):$h.has(i)?Fl(n,"particle",Hl(t,r)):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){let r=t,n="";for("-"!==e[r]&&"+"!==e[r]||(n+=e[r++]);r<e.length&&Yl(e[r]);)n+=e[r++];if(r<e.length&&"."===e[r])for(n+=e[r++];r<e.length&&Yl(e[r]);)n+=e[r++];let i=r;for(;i<e.length&&Ul(e[i]);)i++;const a=e.slice(i).toLowerCase();return a.startsWith("milisekunde")?(n+="ms",r=i+11):a.startsWith("sekunde")?(n+="s",r=i+7):a.startsWith("dakika")?(n+="m",r=i+6):a.startsWith("saa")&&(n+="h",r=i+3),n&&"-"!==n&&"+"!==n?Fl(n,"literal",Hl(t,r)):null}})}}),Kh={};Tl(Kh,{thaiProfile:()=>Fh});var Gh,Yh,Xh,Zh,Jh=Sl({"src/generators/profiles/thai.ts"(){Fh={code:"th",name:"Thai",nativeName:"ไทย",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!1,defaultVerbForm:"base",verb:{position:"second",subjectDrop:!0},references:{me:"ฉัน",it:"มัน",you:"คุณ",result:"ผลลัพธ์",event:"เหตุการณ์",target:"เป้าหมาย",body:"บอดี้"},possessive:{marker:"ของ",markerPosition:"between",keywords:{"ของฉัน":"me","ของผม":"me","ของคุณ":"you","ของมัน":"it","ของเขา":"it","ของเธอ":"it"}},roleMarkers:{patient:{primary:"",position:"before"},destination:{primary:"ใน",alternatives:["ไปยัง"],position:"before"},source:{primary:"จาก",position:"before"},style:{primary:"ด้วย",position:"before"},event:{primary:"เมื่อ",position:"before"}},keywords:{toggle:{primary:"สลับ",alternatives:[],normalized:"toggle"},add:{primary:"เพิ่ม",alternatives:[],normalized:"add"},remove:{primary:"ลบ",alternatives:["ลบออก"],normalized:"remove"},put:{primary:"ใส่",alternatives:["วาง"],normalized:"put"},append:{primary:"เพิ่มท้าย",alternatives:[],normalized:"append"},prepend:{primary:"เพิ่มหน้า",alternatives:[],normalized:"prepend"},take:{primary:"รับ",alternatives:[],normalized:"take"},make:{primary:"สร้าง",alternatives:[],normalized:"make"},clone:{primary:"คัดลอก",alternatives:["สำเนา"],normalized:"clone"},swap:{primary:"สลับที่",alternatives:[],normalized:"swap"},morph:{primary:"แปลงร่าง",alternatives:[],normalized:"morph"},set:{primary:"ตั้ง",alternatives:["กำหนด"],normalized:"set"},get:{primary:"รับค่า",alternatives:[],normalized:"get"},increment:{primary:"เพิ่มค่า",alternatives:[],normalized:"increment"},decrement:{primary:"ลดค่า",alternatives:[],normalized:"decrement"},log:{primary:"บันทึก",alternatives:[],normalized:"log"},show:{primary:"แสดง",alternatives:[],normalized:"show"},hide:{primary:"ซ่อน",alternatives:[],normalized:"hide"},transition:{primary:"เปลี่ยน",alternatives:[],normalized:"transition"},on:{primary:"เมื่อ",alternatives:["ตอน"],normalized:"on"},trigger:{primary:"ทริกเกอร์",alternatives:[],normalized:"trigger"},send:{primary:"ส่ง",alternatives:[],normalized:"send"},focus:{primary:"โฟกัส",alternatives:[],normalized:"focus"},blur:{primary:"เบลอ",alternatives:[],normalized:"blur"},click:{primary:"คลิก",normalized:"click"},hover:{primary:"โฮเวอร์",alternatives:["วางเมาส์"],normalized:"hover"},submit:{primary:"ส่ง",alternatives:["ส่งข้อมูล"],normalized:"submit"},input:{primary:"ป้อน",alternatives:["กรอก"],normalized:"input"},change:{primary:"เปลี่ยน",alternatives:["เปลี่ยนแปลง"],normalized:"change"},go:{primary:"ไป",alternatives:["ไปที่"],normalized:"go"},wait:{primary:"รอ",alternatives:[],normalized:"wait"},fetch:{primary:"ดึงข้อมูล",alternatives:[],normalized:"fetch"},settle:{primary:"คงที่",alternatives:[],normalized:"settle"},if:{primary:"ถ้า",alternatives:["หาก"],normalized:"if"},when:{primary:"เมื่อ",normalized:"when"},where:{primary:"ที่ไหน",normalized:"where"},else:{primary:"ไม่งั้น",alternatives:["ไม่เช่นนั้น"],normalized:"else"},repeat:{primary:"ทำซ้ำ",alternatives:[],normalized:"repeat"},for:{primary:"สำหรับ",alternatives:[],normalized:"for"},while:{primary:"ในขณะที่",alternatives:[],normalized:"while"},continue:{primary:"ต่อไป",alternatives:[],normalized:"continue"},halt:{primary:"หยุด",alternatives:[],normalized:"halt"},throw:{primary:"โยน",alternatives:[],normalized:"throw"},call:{primary:"เรียก",alternatives:[],normalized:"call"},return:{primary:"คืนค่า",alternatives:["กลับ"],normalized:"return"},then:{primary:"แล้ว",alternatives:[],normalized:"then"},and:{primary:"และ",alternatives:[],normalized:"and"},end:{primary:"จบ",alternatives:[],normalized:"end"},js:{primary:"เจเอส",alternatives:["js"],normalized:"js"},async:{primary:"อะซิงค์",alternatives:[],normalized:"async"},tell:{primary:"บอก",alternatives:[],normalized:"tell"},default:{primary:"ค่าเริ่มต้น",alternatives:[],normalized:"default"},init:{primary:"เริ่มต้น",alternatives:[],normalized:"init"},behavior:{primary:"พฤติกรรม",alternatives:[],normalized:"behavior"},install:{primary:"ติดตั้ง",alternatives:[],normalized:"install"},measure:{primary:"วัด",alternatives:[],normalized:"measure"},into:{primary:"ใน",alternatives:[],normalized:"into"},before:{primary:"ก่อน",alternatives:[],normalized:"before"},after:{primary:"หลัง",alternatives:[],normalized:"after"},until:{primary:"จนถึง",alternatives:[],normalized:"until"},event:{primary:"เหตุการณ์",alternatives:[],normalized:"event"},from:{primary:"จาก",normalized:"from"}},tokenization:{boundaryStrategy:"character"},eventHandler:{keyword:{primary:"เมื่อ",alternatives:["ตอน"],normalized:"on"},sourceMarker:{primary:"จาก",position:"before"},eventMarker:{primary:"เมื่อ",alternatives:["ตอน"],position:"before"},temporalMarkers:["เมื่อ","ตอน"]}}}}),Qh={};Tl(Qh,{ThaiTokenizer:()=>Xh,thaiTokenizer:()=>Zh});var ef,tf=Sl({"src/tokenizers/thai.ts"(){rc(),Jh(),Gh=Zl([[3584,3711]]),Yh=[{native:"จริง",normalized:"true"},{native:"เท็จ",normalized:"false"},{native:"ว่าง",normalized:"null"},{native:"ไม่กำหนด",normalized:"undefined"},{native:"แรก",normalized:"first"},{native:"สุดท้าย",normalized:"last"},{native:"ถัดไป",normalized:"next"},{native:"ก่อนหน้า",normalized:"previous"},{native:"ใกล้สุด",normalized:"closest"},{native:"ต้นทาง",normalized:"parent"},{native:"คลิก",normalized:"click"},{native:"เปลี่ยนแปลง",normalized:"change"},{native:"ส่ง",normalized:"submit"},{native:"อินพุต",normalized:"input"},{native:"โหลด",normalized:"load"},{native:"เลื่อน",normalized:"scroll"},{native:"เวลา",normalized:"when"},{native:"ไปยัง",normalized:"to"},{native:"ด้วย",normalized:"with"},{native:"และ",normalized:"and"}],Zh=new(Xh=class extends Dl{constructor(){super(),this.language="th",this.direction="ltr",this.initializeKeywordsFromProfile(Fh,Yh)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.tryNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}if(":"===e[r]){const n=r;r++;let i="";for(;r<e.length&&(Xl(e[r])||Gh(e[r]));)i+=e[r],r++;if(i){t.push(Fl(":"+i,"identifier",Hl(n,r),":"+i));continue}r=n}if(Gh(e[r])){const n=r,i=this.tryProfileKeyword(e,r);if(i){t.push(i),r=i.position.end;continue}let a="";for(;r<e.length&&Gh(e[r])&&!(a.length>0&&this.isKeywordStart(e,r));)a+=e[r],r++;a&&t.push(Fl(a,"identifier",Hl(n,r)));continue}if(Xl(e[r])){const n=r;let i="";for(;r<e.length&&Xl(e[r]);)i+=e[r],r++;t.push(Fl(i,"identifier",Hl(n,r),i.toLowerCase()));continue}t.push(Fl(e[r],"operator",Hl(r,r+1))),r++}return new Wl(t,this.language)}classifyToken(e){return this.isKeyword(e)?"keyword":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}})}}),rf={};Tl(rf,{tagalogProfile:()=>ef});var nf,af,of,sf=Sl({"src/generators/profiles/tl.ts"(){ef={code:"tl",name:"Tagalog",nativeName:"Tagalog",direction:"ltr",wordOrder:"VSO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"base",verb:{position:"start",subjectDrop:!0},references:{me:"ako",it:"ito",you:"ikaw",result:"resulta",event:"pangyayari",target:"target",body:"body"},possessive:{marker:"ng",markerPosition:"between",keywords:{ko:"me",akin:"me",mo:"you",iyo:"you",niya:"it",kaniya:"it"}},roleMarkers:{destination:{primary:"sa",position:"before"},source:{primary:"mula_sa",position:"before"},patient:{primary:"",position:"before"},style:{primary:"nang",position:"before"}},keywords:{toggle:{primary:"palitan",alternatives:["itoggle"],normalized:"toggle"},add:{primary:"idagdag",alternatives:["magdagdag"],normalized:"add"},remove:{primary:"alisin",alternatives:["tanggalin"],normalized:"remove"},put:{primary:"ilagay",alternatives:["maglagay"],normalized:"put"},append:{primary:"idagdag_sa_dulo",normalized:"append"},prepend:{primary:"idagdag_sa_simula",normalized:"prepend"},take:{primary:"kumuha",normalized:"take"},make:{primary:"gumawa",alternatives:["lumikha"],normalized:"make"},clone:{primary:"kopyahin",normalized:"clone"},swap:{primary:"magpalit",normalized:"swap"},morph:{primary:"baguhin",normalized:"morph"},set:{primary:"itakda",alternatives:["magtakda"],normalized:"set"},get:{primary:"kumuha",alternatives:["kunin"],normalized:"get"},increment:{primary:"dagdagan",alternatives:["taasan"],normalized:"increment"},decrement:{primary:"bawasan",alternatives:["ibaba"],normalized:"decrement"},log:{primary:"itala",normalized:"log"},show:{primary:"ipakita",alternatives:["magpakita"],normalized:"show"},hide:{primary:"itago",alternatives:["magtago"],normalized:"hide"},transition:{primary:"lumipat",normalized:"transition"},on:{primary:"kapag",alternatives:["kung","sa"],normalized:"on"},trigger:{primary:"magpatugtog",normalized:"trigger"},send:{primary:"ipadala",alternatives:["magpadala"],normalized:"send"},focus:{primary:"ituon",normalized:"focus"},blur:{primary:"alisin_tuon",normalized:"blur"},go:{primary:"pumunta",alternatives:["punta"],normalized:"go"},wait:{primary:"maghintay",alternatives:["hintay"],normalized:"wait"},fetch:{primary:"kunin",normalized:"fetch"},settle:{primary:"magpatahimik",normalized:"settle"},if:{primary:"kung",alternatives:["kapag"],normalized:"if"},when:{primary:"kapag",normalized:"when"},where:{primary:"kung_saan",normalized:"where"},else:{primary:"kung_hindi",alternatives:["kundi"],normalized:"else"},repeat:{primary:"ulitin",alternatives:["paulit-ulit"],normalized:"repeat"},for:{primary:"para_sa",normalized:"for"},while:{primary:"habang",normalized:"while"},continue:{primary:"magpatuloy",normalized:"continue"},halt:{primary:"itigil",alternatives:["huminto"],normalized:"halt"},throw:{primary:"ihagis",alternatives:["itapon"],normalized:"throw"},call:{primary:"tawagan",alternatives:["tumawag"],normalized:"call"},return:{primary:"ibalik",alternatives:["bumalik"],normalized:"return"},then:{primary:"pagkatapos",alternatives:["saka"],normalized:"then"},and:{primary:"at",normalized:"and"},end:{primary:"wakas",alternatives:["tapos"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",normalized:"async"},tell:{primary:"sabihin",alternatives:["magsabi"],normalized:"tell"},default:{primary:"default",alternatives:["unang_halaga"],normalized:"default"},init:{primary:"simulan",alternatives:["magsimula"],normalized:"init"},behavior:{primary:"ugali",alternatives:["kilos"],normalized:"behavior"},install:{primary:"ikabit",alternatives:["mag-install"],normalized:"install"},measure:{primary:"sukatin",normalized:"measure"},into:{primary:"sa",normalized:"into"},before:{primary:"bago",normalized:"before"},after:{primary:"matapos",alternatives:["pagkatapos"],normalized:"after"},until:{primary:"hanggang",normalized:"until"},event:{primary:"pangyayari",normalized:"event"},from:{primary:"mula",alternatives:["galing"],normalized:"from"}},eventHandler:{keyword:{primary:"kapag",normalized:"on"},sourceMarker:{primary:"mula_sa",alternatives:["galing_sa"],position:"before"}}}}}),lf={};Tl(lf,{TagalogTokenizer:()=>af,tagalogTokenizer:()=>of});var cf,uf,pf=Sl({"src/tokenizers/tl.ts"(){rc(),sf(),nf=[{native:"totoo",normalized:"true"},{native:"mali",normalized:"false"},{native:"wala",normalized:"null"},{native:"hindi_tinukoy",normalized:"undefined"},{native:"una",normalized:"first"},{native:"huli",normalized:"last"},{native:"susunod",normalized:"next"},{native:"nakaraan",normalized:"previous"},{native:"pinakamalapit",normalized:"closest"},{native:"magulang",normalized:"parent"},{native:"pindot",normalized:"click"},{native:"pagbabago",normalized:"change"},{native:"isumite",normalized:"submit"},{native:"input",normalized:"input"},{native:"karga",normalized:"load"},{native:"mag_scroll",normalized:"scroll"}],of=new(af=class extends Dl{constructor(){super(),this.language="tl",this.direction="ltr",this.initializeKeywordsFromProfile(ef,nf)}tokenize(e){const t=[];let r=0;for(;r<e.length;)if(Ul(e[r]))r++;else{if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.tryNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(":"===e[r]){const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}}if("()[]{}:,;".includes(e[r]))t.push(Fl(e[r],"operator",Hl(r,r+1))),r++;else{if(Xl(e[r])){const n=r,i=this.tryProfileKeyword(e,r);if(i){t.push(i),r=i.position.end;continue}let a="";for(;r<e.length&&Xl(e[r]);)a+=e[r],r++;a&&t.push(Fl(a,"identifier",Hl(n,r)));continue}r++}}return new Wl(t,"tl")}classifyToken(e){return this.isKeyword(e)?"keyword":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}})}});function mf(e){const t=e.charCodeAt(0);if(t>=65&&t<=90||t>=97&&t<=122)return!0;return"çÇğĞıİöÖşŞüÜ".includes(e)}function df(e){return"aıouAIOU".includes(e)}function hf(e){return"eiöüEİÖÜ".includes(e)}function ff(e){return df(e)||hf(e)}function yf(e,t){const r=function(e){for(let t=e.length-1;t>=0;t--)if(ff(e[t]))return e[t];return null}(e);if(!r)return!0;const n=t.split("").find(e=>ff(e));return!n||(df(r)?df(n):hf(n))}var vf,gf=Sl({"src/tokenizers/morphology/turkish-normalizer.ts"(){uc(),cf=[{pattern:"iyorsunuz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"ıyorsunuz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"üyorsunuz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"uyorsunuz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"iyorsun",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"ıyorsun",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"üyorsun",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"uyorsun",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"iyoruz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"ıyoruz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"üyoruz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"uyoruz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"iyorum",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"ıyorum",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"üyorum",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"uyorum",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"iyorlar",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"ıyorlar",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"üyorlar",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"uyorlar",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"eceksiniz",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"acaksınız",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"eceksin",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"acaksın",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"eceğiz",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"acağız",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"eceğim",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"acağım",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"ecekler",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"acaklar",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"mişsiniz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mışsınız",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"müşsünüz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"muşsunuz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mişsin",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mışsın",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"müşsün",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"muşsun",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mişiz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mışız",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"müşüz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"muşuz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mişim",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"mışım",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"müşüm",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"muşum",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"mişler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mışlar",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"müşler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"muşlar",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"diniz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dınız",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dünüz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dunuz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tiniz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tınız",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tünüz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tunuz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"diler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dılar",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"düler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dular",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tiler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tılar",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tüler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tular",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"din",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dın",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dün",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dun",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tin",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tın",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tün",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tun",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dik",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dık",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dük",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"duk",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tik",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tık",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tük",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tuk",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dim",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"dım",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"düm",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"dum",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tim",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tım",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tüm",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tum",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"iyor",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"ıyor",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"üyor",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"uyor",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"ecek",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"acak",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"miş",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"mış",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"müş",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"muş",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"di",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"dı",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"dü",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"du",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"ti",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tı",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tü",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tu",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"mek",confidence:.88,conjugationType:"dictionary",minStemLength:2},{pattern:"mak",confidence:.88,conjugationType:"dictionary",minStemLength:2},{pattern:"eyelim",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"ayalım",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"eyim",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"ayım",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"elim",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"alım",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"melisiniz",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"malısınız",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"melisin",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"malısın",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"meliyiz",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"malıyız",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"meliyim",confidence:.85,conjugationType:"necessitative",minStemLength:2},{pattern:"malıyım",confidence:.85,conjugationType:"necessitative",minStemLength:2},{pattern:"meliler",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"malılar",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"meli",confidence:.85,conjugationType:"necessitative",minStemLength:2},{pattern:"malı",confidence:.85,conjugationType:"necessitative",minStemLength:2},{pattern:"ebiliyor",confidence:.82,conjugationType:"potential",minStemLength:2},{pattern:"abiliyor",confidence:.82,conjugationType:"potential",minStemLength:2},{pattern:"ebilir",confidence:.85,conjugationType:"potential",minStemLength:2},{pattern:"abilir",confidence:.85,conjugationType:"potential",minStemLength:2},{pattern:"ebildi",confidence:.82,conjugationType:"potential",minStemLength:2},{pattern:"abildi",confidence:.82,conjugationType:"potential",minStemLength:2},{pattern:"ebilmek",confidence:.85,conjugationType:"potential",minStemLength:2},{pattern:"abilmek",confidence:.85,conjugationType:"potential",minStemLength:2},{pattern:"iniz",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"ınız",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"ünüz",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"unuz",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"in",confidence:.8,conjugationType:"imperative",minStemLength:2},{pattern:"ın",confidence:.8,conjugationType:"imperative",minStemLength:2},{pattern:"ün",confidence:.8,conjugationType:"imperative",minStemLength:2},{pattern:"un",confidence:.8,conjugationType:"imperative",minStemLength:2},{pattern:"ildi",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ıldı",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"üldü",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"uldu",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ilir",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ılır",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ülür",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ulur",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"tirmek",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"tırmak",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"türmek",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"turmak",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"dirmek",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"dırmak",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"dürmek",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"durmak",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"miyorsunuz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"mıyorsunuz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"müyorsunuz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"muyorsunuz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"miyorsun",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"mıyorsun",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"müyorsun",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"muyorsun",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"miyoruz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"mıyoruz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"müyoruz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"muyoruz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"miyorum",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"mıyorum",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"müyorum",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"muyorum",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"miyor",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"mıyor",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"müyor",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"muyor",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"medi",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"madı",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"me",confidence:.75,conjugationType:"negative",minStemLength:3},{pattern:"ma",confidence:.75,conjugationType:"negative",minStemLength:3}],new(uf=class{constructor(){this.language="tr"}isNormalizable(e){return!!function(e){for(const t of e)if(mf(t))return!0;return!1}(e)&&!(e.length<3)}normalize(e){const t=e.toLowerCase();for(const e of cf)if(t.endsWith(e.pattern)){const r=t.slice(0,-e.pattern.length);if(r.length<(e.minStemLength??2))continue;if(!yf(r,e.pattern)){const t=.9*e.confidence,n={removedSuffixes:[e.pattern]};return e.conjugationType&&(n.conjugationType=e.conjugationType),ic(r,t,n)}const n={removedSuffixes:[e.pattern]};return e.conjugationType&&(n.conjugationType=e.conjugationType),ic(r,e.confidence,n)}return nc(e)}})}}),kf={};Tl(kf,{turkishProfile:()=>vf});var wf,bf,zf,xf,Ef,Sf,Tf,Cf=Sl({"src/generators/profiles/turkish.ts"(){vf={code:"tr",name:"Turkish",nativeName:"Türkçe",direction:"ltr",wordOrder:"SOV",markingStrategy:"case-suffix",usesSpaces:!0,verb:{position:"end",suffixes:["mek","mak","yor","di","miş"],subjectDrop:!0},references:{me:"ben",it:"o",you:"sen",result:"sonuç",event:"olay",target:"hedef",body:"gövde"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,specialForms:{me:"benim",it:"onun",you:"senin"},keywords:{benim:"me",senin:"you",onun:"it"}},roleMarkers:{patient:{primary:"i",alternatives:["ı","u","ü","yi","yı","yu","yü","ni","nı","nu","nü"],position:"after"},destination:{primary:"e",alternatives:["a","ye","ya","ne","na","de","da","te","ta","ın","in","un","ün","nın","nin","nun","nün"],position:"after"},source:{primary:"den",alternatives:["dan","ten","tan"],position:"after"},style:{primary:"le",alternatives:["la","yle","yla"],position:"after"},event:{primary:"i",alternatives:["ı","u","ü"],position:"after"}},keywords:{toggle:{primary:"değiştir",alternatives:["aç/kapat"],normalized:"toggle"},add:{primary:"ekle",normalized:"add"},remove:{primary:"kaldır",alternatives:["sil"],normalized:"remove"},put:{primary:"koy",normalized:"put"},append:{primary:"ekle",normalized:"append"},take:{primary:"tut",normalized:"take"},make:{primary:"yap",normalized:"make"},clone:{primary:"kopyala",normalized:"clone"},swap:{primary:"takas",normalized:"swap"},morph:{primary:"dönüştür",alternatives:["şekil değiştir"],normalized:"morph"},set:{primary:"ayarla",alternatives:["yap","belirle"],normalized:"set"},get:{primary:"al",normalized:"get"},increment:{primary:"artır",normalized:"increment"},decrement:{primary:"azalt",normalized:"decrement"},log:{primary:"kaydet",normalized:"log"},show:{primary:"göster",normalized:"show"},hide:{primary:"gizle",normalized:"hide"},transition:{primary:"geçiş",normalized:"transition"},on:{primary:"üzerinde",alternatives:["olduğunda","zaman"],normalized:"on"},trigger:{primary:"tetikle",normalized:"trigger"},send:{primary:"gönder",normalized:"send"},focus:{primary:"odak",alternatives:["odaklanma"],normalized:"focus"},blur:{primary:"bulanık",alternatives:["bulanıklık"],normalized:"blur"},click:{primary:"tıklama",alternatives:["tıkla"],normalized:"click"},hover:{primary:"üzerine gelme",alternatives:["üzerinde gezinme"],normalized:"hover"},submit:{primary:"gönderme",alternatives:["gönder"],normalized:"submit"},input:{primary:"giriş",alternatives:["girdi"],normalized:"input"},change:{primary:"değişiklik",alternatives:["değişim"],normalized:"change"},go:{primary:"git",normalized:"go"},wait:{primary:"bekle",normalized:"wait"},fetch:{primary:"getir",normalized:"fetch"},settle:{primary:"sabitlen",normalized:"settle"},if:{primary:"eğer",normalized:"if"},when:{primary:"iken",alternatives:["durumunda","olduğunda"],normalized:"when"},where:{primary:"nerede",normalized:"where"},else:{primary:"yoksa",normalized:"else"},repeat:{primary:"tekrarla",normalized:"repeat"},for:{primary:"için",normalized:"for"},while:{primary:"iken",normalized:"while"},continue:{primary:"devam",normalized:"continue"},halt:{primary:"durdur",normalized:"halt"},throw:{primary:"fırlat",normalized:"throw"},call:{primary:"çağır",normalized:"call"},return:{primary:"dön",normalized:"return"},then:{primary:"sonra",alternatives:["ardından","daha sonra"],normalized:"then"},and:{primary:"ve",alternatives:["ayrıca","hem de"],normalized:"and"},end:{primary:"son",alternatives:["bitiş","bitti"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asenkron",normalized:"async"},tell:{primary:"söyle",normalized:"tell"},default:{primary:"varsayılan",normalized:"default"},init:{primary:"başlat",normalized:"init"},behavior:{primary:"davranış",normalized:"behavior"},install:{primary:"yükle",normalized:"install"},measure:{primary:"ölç",normalized:"measure"},into:{primary:"içine",normalized:"into"},before:{primary:"önce",normalized:"before"},after:{primary:"sonra",normalized:"after"},until:{primary:"kadar",normalized:"until"},event:{primary:"olay",normalized:"event"},from:{primary:"den",alternatives:["dan"],normalized:"from"}},eventHandler:{eventMarker:{primary:"da",alternatives:["de","ta","te"],position:"after"},temporalMarkers:["dığında","diğinde"]}}}}),Af={};Tl(Af,{TurkishTokenizer:()=>Sf,turkishTokenizer:()=>Tf});var Lf,jf=Sl({"src/tokenizers/turkish.ts"(){rc(),gf(),Cf(),({isLetter:wf}=Ql(/[a-zA-ZçÇğĞıİöÖşŞüÜ]/)),bf=new Set(["ile","için","kadar","gibi","sonra","önce","üzerinde","altında","içinde","dışında","arasında","karşı","göre","rağmen","doğru","boyunca"]),zf=new Set(["de","da","te","ta","den","dan","ten","tan","e","a","ye","ya","i","ı","u","ü","in","ın","un","ün","le","la","yle","yla"]),xf=[{native:"doğru",normalized:"true"},{native:"dogru",normalized:"true"},{native:"yanlış",normalized:"false"},{native:"yanlis",normalized:"false"},{native:"null",normalized:"null"},{native:"boş",normalized:"null"},{native:"bos",normalized:"null"},{native:"tanımsız",normalized:"undefined"},{native:"tanimsiz",normalized:"undefined"},{native:"ilk",normalized:"first"},{native:"son",normalized:"last"},{native:"sonraki",normalized:"next"},{native:"önceki",normalized:"previous"},{native:"onceki",normalized:"previous"},{native:"en_yakın",normalized:"closest"},{native:"en_yakin",normalized:"closest"},{native:"ebeveyn",normalized:"parent"},{native:"tıklama",normalized:"click"},{native:"tiklama",normalized:"click"},{native:"tık",normalized:"click"},{native:"tik",normalized:"click"},{native:"giriş",normalized:"input"},{native:"giris",normalized:"input"},{native:"değişim",normalized:"change"},{native:"degisim",normalized:"change"},{native:"odak",normalized:"focus"},{native:"bulanık",normalized:"blur"},{native:"bulanik",normalized:"blur"},{native:"fare üzerinde",normalized:"mouseover"},{native:"fare uzerinde",normalized:"mouseover"},{native:"fare dışında",normalized:"mouseout"},{native:"fare disinda",normalized:"mouseout"},{native:"kaydır",normalized:"scroll"},{native:"kaydir",normalized:"scroll"},{native:"tuş_bas",normalized:"keydown"},{native:"tus_bas",normalized:"keydown"},{native:"tuş_bırak",normalized:"keyup"},{native:"tus_birak",normalized:"keyup"},{native:"benim",normalized:"my"},{native:"onun",normalized:"its"},{native:"saniye",normalized:"s"},{native:"milisaniye",normalized:"ms"},{native:"dakika",normalized:"m"},{native:"saat",normalized:"h"},{native:"ve",normalized:"and"},{native:"veya",normalized:"or"},{native:"değil",normalized:"not"},{native:"degil",normalized:"not"}],Ef=[{pattern:"milisaniye",suffix:"ms",length:10,caseInsensitive:!0},{pattern:"dakika",suffix:"m",length:6,caseInsensitive:!0},{pattern:"saniye",suffix:"s",length:6,caseInsensitive:!0},{pattern:"saat",suffix:"h",length:4,caseInsensitive:!0},{pattern:"dk",suffix:"m",length:2,checkBoundary:!0},{pattern:"sa",suffix:"h",length:2,checkBoundary:!0}],Tf=new(Sf=class extends Dl{constructor(){super(),this.language="tr",this.direction="ltr",this.initializeKeywordsFromProfile(vf,xf),this.normalizer=new uf}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])){const n=this.extractTurkishNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.tryMultiWordPhrase(e,r);if(i)t.push(i),r=i.position.end;else{if(wf(e[r])){const n=this.extractTurkishWord(e,r);if(n){t.push(n),r=n.position.end;continue}}r++}}return new Wl(t,"tr")}classifyToken(e){const t=e.toLowerCase();return bf.has(t)||zf.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}tryMultiWordPhrase(e,t){for(const r of this.profileKeywords){if(!r.native.includes(" "))continue;const n=r.native;if(e.slice(t,t+n.length).toLowerCase()===n.toLowerCase()){const i=t+n.length;if(i>=e.length||Ul(e[i])||!wf(e[i]))return Fl(e.slice(t,t+n.length),"keyword",Hl(t,i),r.normalized)}}return null}extractTurkishWord(e,t){let r=t,n="";for(;r<e.length&&(wf(e[r])||"_"===e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase();if(zf.has(i))return Fl(n,"particle",Hl(t,r));if(bf.has(i))return Fl(n,"particle",Hl(t,r));const a=this.lookupKeyword(i);if(a)return Fl(n,"keyword",Hl(t,r),a.normalized);const o=this.tryMorphKeywordMatch(i,t,r);return o||Fl(n,"identifier",Hl(t,r))}extractTurkishNumber(e,t){return this.tryNumberWithTimeUnits(e,t,Ef,{allowSign:!1,skipWhitespace:!0})}})}}),Pf={};Tl(Pf,{ukrainianProfile:()=>Lf});var Nf,Of,If,Rf,Mf,qf,_f=Sl({"src/generators/profiles/ukrainian.ts"(){Lf={code:"uk",name:"Ukrainian",nativeName:"Українська",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!0,suffixes:["ти","тися","ити","итися","ати","атися","іти","ітися"]},references:{me:"я",it:"це",you:"ти",result:"результат",event:"подія",target:"ціль",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,specialForms:{me:"мій",it:"його",you:"твій"},keywords:{"мій":"me","моя":"me","моє":"me","мої":"me","твій":"you","твоя":"you","твоє":"you","твої":"you","його":"it","її":"it"}},roleMarkers:{destination:{primary:"в",alternatives:["на","до"],position:"before"},source:{primary:"з",alternatives:["від","із"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"з",alternatives:["із"],position:"before"}},keywords:{toggle:{primary:"перемкнути",alternatives:["перемкни"],normalized:"toggle",form:"infinitive"},add:{primary:"додати",alternatives:["додай"],normalized:"add",form:"infinitive"},remove:{primary:"видалити",alternatives:["видали","прибрати","прибери"],normalized:"remove",form:"infinitive"},put:{primary:"покласти",alternatives:["поклади","помістити","помісти","вставити","встав"],normalized:"put",form:"infinitive"},append:{primary:"додати_в_кінець",alternatives:["дописати"],normalized:"append",form:"infinitive"},prepend:{primary:"додати_на_початок",normalized:"prepend",form:"infinitive"},take:{primary:"взяти",alternatives:["візьми"],normalized:"take",form:"infinitive"},make:{primary:"створити",alternatives:["створи"],normalized:"make",form:"infinitive"},clone:{primary:"клонувати",alternatives:["клонуй"],normalized:"clone",form:"infinitive"},swap:{primary:"поміняти",alternatives:["поміняй"],normalized:"swap",form:"infinitive"},morph:{primary:"трансформувати",alternatives:["трансформуй"],normalized:"morph",form:"infinitive"},set:{primary:"встановити",alternatives:["встанови","задати","задай"],normalized:"set",form:"infinitive"},get:{primary:"отримати",alternatives:["отримай"],normalized:"get",form:"infinitive"},increment:{primary:"збільшити",alternatives:["збільш"],normalized:"increment",form:"infinitive"},decrement:{primary:"зменшити",alternatives:["зменш"],normalized:"decrement",form:"infinitive"},log:{primary:"записати",alternatives:["запиши"],normalized:"log",form:"infinitive"},show:{primary:"показати",alternatives:["покажи"],normalized:"show",form:"infinitive"},hide:{primary:"сховати",alternatives:["сховай","приховати","приховай"],normalized:"hide",form:"infinitive"},transition:{primary:"анімувати",alternatives:["анімуй"],normalized:"transition",form:"infinitive"},on:{primary:"при",alternatives:["коли"],normalized:"on"},trigger:{primary:"викликати",alternatives:["виклич"],normalized:"trigger",form:"infinitive"},send:{primary:"надіслати",alternatives:["надішли"],normalized:"send",form:"infinitive"},focus:{primary:"сфокусувати",alternatives:["сфокусуй","фокус"],normalized:"focus",form:"infinitive"},blur:{primary:"розфокусувати",alternatives:["розфокусуй"],normalized:"blur",form:"infinitive"},click:{primary:"кліку",alternatives:["клік","натисканні"],normalized:"click"},hover:{primary:"наведенні",alternatives:["наведення"],normalized:"hover"},submit:{primary:"відправці",alternatives:["відправка"],normalized:"submit"},input:{primary:"введенні",alternatives:["введення"],normalized:"input"},change:{primary:"зміні",alternatives:["зміна"],normalized:"change"},go:{primary:"перейти",alternatives:["перейди","йти","йди"],normalized:"go",form:"infinitive"},wait:{primary:"чекати",alternatives:["чекай","зачекай"],normalized:"wait",form:"infinitive"},fetch:{primary:"завантажити",alternatives:["завантаж"],normalized:"fetch",form:"infinitive"},settle:{primary:"стабілізувати",normalized:"settle",form:"infinitive"},if:{primary:"якщо",normalized:"if"},when:{primary:"коли",normalized:"when"},where:{primary:"де",normalized:"where"},else:{primary:"інакше",normalized:"else"},repeat:{primary:"повторити",alternatives:["повтори"],normalized:"repeat",form:"infinitive"},for:{primary:"для",alternatives:["кожний"],normalized:"for"},while:{primary:"поки",normalized:"while"},continue:{primary:"продовжити",alternatives:["продовжуй"],normalized:"continue",form:"infinitive"},halt:{primary:"зупинити",alternatives:["зупинись","стоп"],normalized:"halt",form:"infinitive"},throw:{primary:"кинути",alternatives:["кинь"],normalized:"throw",form:"infinitive"},call:{primary:"викликати",alternatives:["виклич"],normalized:"call",form:"infinitive"},return:{primary:"повернути",alternatives:["поверни"],normalized:"return",form:"infinitive"},then:{primary:"потім",alternatives:["далі","тоді"],normalized:"then"},and:{primary:"і",alternatives:["та"],normalized:"and"},end:{primary:"кінець",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"асинхронно",alternatives:["async"],normalized:"async"},tell:{primary:"сказати",alternatives:["скажи"],normalized:"tell",form:"infinitive"},default:{primary:"за_замовчуванням",normalized:"default"},init:{primary:"ініціалізувати",alternatives:["ініціалізуй"],normalized:"init",form:"infinitive"},behavior:{primary:"поведінка",normalized:"behavior"},install:{primary:"встановити_пакет",normalized:"install",form:"infinitive"},measure:{primary:"виміряти",alternatives:["виміряй"],normalized:"measure",form:"infinitive"},into:{primary:"в",alternatives:["у"],normalized:"into"},before:{primary:"до",alternatives:["перед"],normalized:"before"},after:{primary:"після",normalized:"after"},until:{primary:"до",alternatives:["поки_не"],normalized:"until"},event:{primary:"подія",normalized:"event"},from:{primary:"з",alternatives:["від","із"],normalized:"from"}},eventHandler:{keyword:{primary:"при",alternatives:["коли"],normalized:"on"},sourceMarker:{primary:"на",alternatives:["в","при"],position:"before"},eventMarker:{primary:"при",alternatives:["коли"],position:"before"},temporalMarkers:["коли","якщо"]}}}}),$f={};Tl($f,{UkrainianTokenizer:()=>Mf,ukrainianTokenizer:()=>qf});var Wf,Vf=Sl({"src/tokenizers/ukrainian.ts"(){rc(),_f(),({isLetter:Nf,isIdentifierChar:Of}=Ql(/[a-zA-Zа-яА-ЯіІїЇєЄґҐьЬ']/)),If=new Set(["в","у","на","з","із","зі","до","від","о","об","при","для","під","над","перед","між","через","без","по","за","про","після","навколо","проти","замість","крім","серед","к"]),Rf=[{native:"істина",normalized:"true"},{native:"правда",normalized:"true"},{native:"хибність",normalized:"false"},{native:"null",normalized:"null"},{native:"невизначено",normalized:"undefined"},{native:"перший",normalized:"first"},{native:"перша",normalized:"first"},{native:"перше",normalized:"first"},{native:"останній",normalized:"last"},{native:"остання",normalized:"last"},{native:"останнє",normalized:"last"},{native:"наступний",normalized:"next"},{native:"наступна",normalized:"next"},{native:"попередній",normalized:"previous"},{native:"попередня",normalized:"previous"},{native:"найближчий",normalized:"closest"},{native:"батько",normalized:"parent"},{native:"клік",normalized:"click"},{native:"натискання",normalized:"click"},{native:"click",normalized:"click"},{native:"зміна",normalized:"change"},{native:"надсилання",normalized:"submit"},{native:"клавіша",normalized:"keydown"},{native:"наведення",normalized:"mouseover"},{native:"відведення",normalized:"mouseout"},{native:"завантаження",normalized:"load"},{native:"прокрутка",normalized:"scroll"},{native:"введення",normalized:"input"},{native:"мій",normalized:"my"},{native:"моя",normalized:"my"},{native:"моє",normalized:"my"},{native:"мої",normalized:"my"},{native:"секунда",normalized:"s"},{native:"секунди",normalized:"s"},{native:"секунд",normalized:"s"},{native:"мілісекунда",normalized:"ms"},{native:"мілісекунди",normalized:"ms"},{native:"мілісекунд",normalized:"ms"},{native:"хвилина",normalized:"m"},{native:"хвилини",normalized:"m"},{native:"хвилин",normalized:"m"},{native:"година",normalized:"h"},{native:"години",normalized:"h"},{native:"годин",normalized:"h"},{native:"або",normalized:"or"},{native:"не",normalized:"not"},{native:"є",normalized:"is"},{native:"існує",normalized:"exists"},{native:"порожній",normalized:"empty"},{native:"порожня",normalized:"empty"},{native:"порожнє",normalized:"empty"}],qf=new(Mf=class extends Dl{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(Lf,Rf)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])||"-"===e[r]&&r+1<e.length&&Yl(e[r+1])){const n=this.extractNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}if(Nf(e[r])){const n=this.extractWord(e,r);if(n){t.push(n),r=n.position.end;continue}}const i=this.tryOperator(e,r);i?(t.push(i),r=i.position.end):r++}return new Wl(t,"uk")}classifyToken(e){const t=e.toLowerCase();return If.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,t){let r=t,n="";for(;r<e.length&&Of(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase();if(If.has(i))return Fl(n,"particle",Hl(t,r));const a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):Fl(n,"identifier",Hl(t,r))}extractNumber(e,t){let r=t,n="";for("-"!==e[r]&&"+"!==e[r]||(n+=e[r++]);r<e.length&&Yl(e[r]);)n+=e[r++];if(r<e.length&&"."===e[r])for(n+=e[r++];r<e.length&&Yl(e[r]);)n+=e[r++];let i=r;for(;i<e.length&&Ul(e[i]);)i++;const a=e.slice(i).toLowerCase();return a.startsWith("мілісекунд")||a.startsWith("мс")?a.startsWith("мілісекунд")?(n+="ms",r=i+10,a.length>10&&/[аи]/.test(a[10])&&r++):(n+="ms",r=i+2):a.startsWith("секунд")||a.startsWith("сек")?a.startsWith("секунд")?(n+="s",r=i+6,a.length>6&&/[аи]/.test(a[6])&&r++):(n+="s",r=i+3):a.startsWith("хвилин")||a.startsWith("хв")?a.startsWith("хвилин")?(n+="m",r=i+6,a.length>6&&/[аи]/.test(a[6])&&r++):(n+="m",r=i+2):a.startsWith("годин")?(n+="h",r=i+5,a.length>5&&/[аи]/.test(a[5])&&r++):a.startsWith("ms")?(n+="ms",r=i+2):a.startsWith("s")&&!a.startsWith("se")&&(n+="s",r=i+1),n&&"-"!==n&&"+"!==n?Fl(n,"literal",Hl(t,r)):null}})}}),Df={};Tl(Df,{vietnameseProfile:()=>Wf});var Bf,Hf,Ff,Uf,Kf,Gf,Yf=Sl({"src/generators/profiles/vietnamese.ts"(){Wf={code:"vi",name:"Vietnamese",nativeName:"Tiếng Việt",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"base",verb:{position:"start",subjectDrop:!0},references:{me:"tôi",it:"nó",you:"bạn",result:"kết quả",event:"sự kiện",target:"mục tiêu",body:"body"},possessive:{marker:"của",markerPosition:"between",specialForms:{me:"của tôi",it:"của nó",you:"của bạn"},keywords:{"của tôi":"me","của bạn":"you","của anh":"you","của chị":"you","của nó":"it"}},roleMarkers:{destination:{primary:"vào",alternatives:["cho","đến"],position:"before"},source:{primary:"từ",alternatives:["khỏi"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"với",position:"before"}},keywords:{toggle:{primary:"chuyển đổi",alternatives:["bật tắt","chuyển"],normalized:"toggle"},add:{primary:"thêm",alternatives:["bổ sung"],normalized:"add"},remove:{primary:"xóa",alternatives:["gỡ bỏ","loại bỏ","bỏ"],normalized:"remove"},put:{primary:"đặt",alternatives:["để","đưa"],normalized:"put"},append:{primary:"nối",normalized:"append"},prepend:{primary:"thêm vào đầu",normalized:"prepend"},take:{primary:"lấy",normalized:"take"},make:{primary:"tạo",normalized:"make"},clone:{primary:"sao chép",normalized:"clone"},swap:{primary:"hoán đổi",normalized:"swap"},morph:{primary:"biến đổi",normalized:"morph"},set:{primary:"gán",alternatives:["thiết lập","đặt"],normalized:"set"},get:{primary:"lấy giá trị",alternatives:["nhận","lấy"],normalized:"get"},increment:{primary:"tăng",alternatives:["tăng lên"],normalized:"increment"},decrement:{primary:"giảm",alternatives:["giảm đi"],normalized:"decrement"},log:{primary:"in ra",normalized:"log"},show:{primary:"hiển thị",alternatives:["hiện"],normalized:"show"},hide:{primary:"ẩn",alternatives:["che","giấu"],normalized:"hide"},transition:{primary:"chuyển tiếp",normalized:"transition"},on:{primary:"khi",alternatives:["lúc","trên"],normalized:"on"},trigger:{primary:"kích hoạt",normalized:"trigger"},send:{primary:"gửi",normalized:"send"},focus:{primary:"tập trung",normalized:"focus"},blur:{primary:"mất tập trung",normalized:"blur"},click:{primary:"nhấp",alternatives:["bấm"],normalized:"click"},hover:{primary:"di chuột",alternatives:["rê chuột"],normalized:"hover"},submit:{primary:"gửi",alternatives:["nộp"],normalized:"submit"},input:{primary:"nhập",alternatives:["nhập liệu"],normalized:"input"},change:{primary:"thay đổi",alternatives:["đổi"],normalized:"change"},go:{primary:"đi đến",alternatives:["đi"],normalized:"go"},wait:{primary:"chờ",alternatives:["đợi"],normalized:"wait"},fetch:{primary:"tải",normalized:"fetch"},settle:{primary:"ổn định",normalized:"settle"},if:{primary:"nếu",normalized:"if"},when:{primary:"khi",normalized:"when"},where:{primary:"ở_đâu",normalized:"where"},else:{primary:"không thì",alternatives:["nếu không"],normalized:"else"},repeat:{primary:"lặp lại",normalized:"repeat"},for:{primary:"với mỗi",normalized:"for"},while:{primary:"trong khi",normalized:"while"},continue:{primary:"tiếp tục",normalized:"continue"},halt:{primary:"dừng",alternatives:["dừng lại"],normalized:"halt"},throw:{primary:"ném",normalized:"throw"},call:{primary:"gọi",normalized:"call"},return:{primary:"trả về",normalized:"return"},then:{primary:"rồi",alternatives:["sau đó","thì"],normalized:"then"},and:{primary:"và",normalized:"and"},end:{primary:"kết thúc",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"bất đồng bộ",normalized:"async"},tell:{primary:"nói với",normalized:"tell"},default:{primary:"mặc định",normalized:"default"},init:{primary:"khởi tạo",normalized:"init"},behavior:{primary:"hành vi",normalized:"behavior"},install:{primary:"cài đặt",normalized:"install"},measure:{primary:"đo lường",normalized:"measure"},into:{primary:"vào",alternatives:["vào trong"],normalized:"into"},before:{primary:"trước",alternatives:["trước khi"],normalized:"before"},after:{primary:"sau",alternatives:["sau khi"],normalized:"after"},until:{primary:"cho đến khi",normalized:"until"},event:{primary:"sự kiện",normalized:"event"},from:{primary:"từ",alternatives:["khỏi"],normalized:"from"}},eventHandler:{keyword:{primary:"khi",alternatives:["lúc","trên"],normalized:"on"},sourceMarker:{primary:"trên",alternatives:["tại"],position:"before"},eventMarker:{primary:"khi",alternatives:["lúc"],position:"before"},temporalMarkers:["khi","lúc"]}}}}),Xf={};Tl(Xf,{VietnameseTokenizer:()=>Kf,vietnameseTokenizer:()=>Gf});var Zf,Jf=Sl({"src/tokenizers/vietnamese.ts"(){rc(),Yf(),({isLetter:Bf,isIdentifierChar:Hf}=Ql(/[a-zA-ZàáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵđÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÈÉẺẼẸÊỀẾỂỄỆÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰỲÝỶỸỴĐ]/)),Ff=new Set(["trong","ngoài","trên","dưới","vào","ra","đến","từ","với","cho","bởi","qua","trước","sau","giữa","bên","theo","về","tới","lên","xuống"]),Uf=[{native:"đúng",normalized:"true"},{native:"sai",normalized:"false"},{native:"null",normalized:"null"},{native:"không xác định",normalized:"undefined"},{native:"đầu tiên",normalized:"first"},{native:"cuối cùng",normalized:"last"},{native:"tiếp theo",normalized:"next"},{native:"trước đó",normalized:"previous"},{native:"gần nhất",normalized:"closest"},{native:"cha",normalized:"parent"},{native:"nhấp",normalized:"click"},{native:"nhấp chuột",normalized:"click"},{native:"click",normalized:"click"},{native:"nhấp đúp",normalized:"dblclick"},{native:"nhập",normalized:"input"},{native:"thay đổi",normalized:"change"},{native:"gửi biểu mẫu",normalized:"submit"},{native:"phím xuống",normalized:"keydown"},{native:"phím lên",normalized:"keyup"},{native:"chuột vào",normalized:"mouseover"},{native:"chuột ra",normalized:"mouseout"},{native:"tải trang",normalized:"load"},{native:"cuộn",normalized:"scroll"},{native:"của tôi",normalized:"my"},{native:"của nó",normalized:"its"},{native:"giây",normalized:"s"},{native:"mili giây",normalized:"ms"},{native:"phút",normalized:"m"},{native:"giờ",normalized:"h"},{native:"thêm vào cuối",normalized:"append"},{native:"nhân bản",normalized:"clone"},{native:"tạo ra",normalized:"make"},{native:"đặt giá trị",normalized:"set"},{native:"ghi nhật ký",normalized:"log"},{native:"chuyển tới",normalized:"go"},{native:"ngược lại",normalized:"else"},{native:"lặp",normalized:"repeat"},{native:"hoặc",normalized:"or"},{native:"không",normalized:"not"},{native:"là",normalized:"is"},{native:"tồn tại",normalized:"exists"},{native:"rỗng",normalized:"empty"},{native:"javascript",normalized:"js"}],Gf=new(Kf=class extends Dl{constructor(){super(),this.language="vi",this.direction="ltr",this.initializeKeywordsFromProfile(Wf,Uf)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])){const n=this.tryString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])){const n=this.extractVietnameseNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.tryOperator(e,r);if(i){t.push(i),r=i.position.end;continue}const a=this.tryMultiWordPhrase(e,r);if(a)t.push(a),r=a.position.end;else{if(Bf(e[r])){const n=this.extractVietnameseWord(e,r);if(n){t.push(n),r=n.position.end;continue}}r++}}return new Wl(t,"vi")}classifyToken(e){const t=e.toLowerCase();return Ff.has(t)?"particle":this.isKeyword(t)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}tryMultiWordPhrase(e,t){for(const r of this.profileKeywords){if(!r.native.includes(" "))continue;const n=r.native;if(e.slice(t,t+n.length).toLowerCase()===n.toLowerCase()){const i=e[t+n.length];if(i&&Bf(i))continue;return Fl(e.slice(t,t+n.length),"keyword",Hl(t,t+n.length),r.normalized)}}return null}extractVietnameseWord(e,t){let r=t,n="";for(;r<e.length&&Hf(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase();if(Ff.has(i))return Fl(n,"particle",Hl(t,r));const a=this.lookupKeyword(i);return a?Fl(n,"keyword",Hl(t,r),a.normalized):Fl(n,"identifier",Hl(t,r))}extractVietnameseNumber(e,t){let r=t,n="";for(;r<e.length&&Yl(e[r]);)n+=e[r++];if(r<e.length&&"."===e[r])for(n+=e[r++];r<e.length&&Yl(e[r]);)n+=e[r++];if(r<e.length){const t=e.slice(r).toLowerCase();t.startsWith(" mili giây")||t.startsWith(" miligiây")?(n+="ms",r+=t.startsWith(" mili giây")?10:9):t.startsWith(" giây")?(n+="s",r+=5):t.startsWith(" phút")?(n+="m",r+=5):t.startsWith(" giờ")?(n+="h",r+=4):t.startsWith("ms")?(n+="ms",r+=2):"s"!==t[0]||Bf(t[1]||"")?"m"!==t[0]||"s"===t[1]||Bf(t[1]||"")?"h"!==t[0]||Bf(t[1]||"")||(n+="h",r+=1):(n+="m",r+=1):(n+="s",r+=1)}return n?Fl(n,"literal",Hl(t,r)):null}})}}),Qf={};Tl(Qf,{chineseProfile:()=>Zf});var ey,ty,ry,ny,iy,ay,oy,sy=Sl({"src/generators/profiles/chinese.ts"(){Zf={code:"zh",name:"Chinese",nativeName:"中文",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!1,verb:{position:"second",subjectDrop:!0},references:{me:"我",it:"它",you:"你",result:"结果",event:"事件",target:"目标",body:"主体"},possessive:{marker:"的",markerPosition:"between",keywords:{"我的":"me","你的":"you","它的":"it","他的":"it","她的":"it"}},roleMarkers:{destination:{primary:"在",alternatives:["到","于"],position:"before"},source:{primary:"从",alternatives:["由"],position:"before"},patient:{primary:"把",position:"before"},style:{primary:"用",alternatives:["以"],position:"before"}},keywords:{toggle:{primary:"切换",normalized:"toggle"},add:{primary:"添加",alternatives:["加"],normalized:"add"},remove:{primary:"移除",alternatives:["删除","去掉"],normalized:"remove"},put:{primary:"放置",alternatives:["放","放入"],normalized:"put"},append:{primary:"追加",alternatives:["附加"],normalized:"append"},prepend:{primary:"前置",alternatives:["预置"],normalized:"prepend"},take:{primary:"获取",normalized:"take"},make:{primary:"制作",normalized:"make"},clone:{primary:"复制",normalized:"clone"},swap:{primary:"交换",normalized:"swap"},morph:{primary:"变形",alternatives:["转换"],normalized:"morph"},set:{primary:"设置",alternatives:["设定"],normalized:"set"},get:{primary:"获得",alternatives:["获取","取得"],normalized:"get"},increment:{primary:"增加",normalized:"increment"},decrement:{primary:"减少",normalized:"decrement"},log:{primary:"日志",normalized:"log"},show:{primary:"显示",alternatives:["展示"],normalized:"show"},hide:{primary:"隐藏",normalized:"hide"},transition:{primary:"过渡",normalized:"transition"},on:{primary:"当",alternatives:["在...时"],normalized:"on"},trigger:{primary:"触发",normalized:"trigger"},send:{primary:"发送",normalized:"send"},focus:{primary:"聚焦",normalized:"focus"},blur:{primary:"失焦",normalized:"blur"},click:{primary:"点击",normalized:"click"},hover:{primary:"悬停",alternatives:["悬浮"],normalized:"hover"},submit:{primary:"提交",normalized:"submit"},input:{primary:"输入",normalized:"input"},change:{primary:"改变",alternatives:["变化"],normalized:"change"},go:{primary:"前往",normalized:"go"},wait:{primary:"等待",normalized:"wait"},fetch:{primary:"获取",normalized:"fetch"},settle:{primary:"稳定",normalized:"settle"},if:{primary:"如果",normalized:"if"},when:{primary:"当",normalized:"when"},where:{primary:"哪里",normalized:"where"},else:{primary:"否则",normalized:"else"},repeat:{primary:"重复",normalized:"repeat"},for:{primary:"为",normalized:"for"},while:{primary:"当",normalized:"while"},continue:{primary:"继续",normalized:"continue"},halt:{primary:"停止",normalized:"halt"},throw:{primary:"抛出",normalized:"throw"},call:{primary:"调用",normalized:"call"},return:{primary:"返回",normalized:"return"},then:{primary:"然后",alternatives:["接着","之后"],normalized:"then"},and:{primary:"并且",alternatives:["和","而且"],normalized:"and"},end:{primary:"结束",alternatives:["终止","完"],normalized:"end"},js:{primary:"JS执行",alternatives:["js"],normalized:"js"},async:{primary:"异步",normalized:"async"},tell:{primary:"告诉",normalized:"tell"},default:{primary:"默认",normalized:"default"},init:{primary:"初始化",normalized:"init"},behavior:{primary:"行为",normalized:"behavior"},install:{primary:"安装",normalized:"install"},measure:{primary:"测量",normalized:"measure"},into:{primary:"进入",normalized:"into"},before:{primary:"之前",normalized:"before"},after:{primary:"之后",normalized:"after"},until:{primary:"直到",normalized:"until"},event:{primary:"事件",normalized:"event"},from:{primary:"从",normalized:"from"}},tokenization:{boundaryStrategy:"character"},eventHandler:{keyword:{primary:"当",alternatives:["在...时"],normalized:"on"},sourceMarker:{primary:"从",position:"before"},eventMarker:{primary:"当",alternatives:["在"],position:"before"},temporalMarkers:["当","在...时"]}}}}),ly={};Tl(ly,{ChineseTokenizer:()=>ay,chineseTokenizer:()=>oy});var cy=Sl({"src/tokenizers/chinese.ts"(){rc(),sy(),ey=Zl([[19968,40959],[13312,19903],[131072,173791],[63744,64255],[194560,195103]]),ty=new Set(["把","在","从","到","向","给","对","用","被","让","的","地","得","了","着","过","吗","呢","吧"]),ry=["然后","接着","并且","或者","如果","那么","否则"],ny=[{native:"真",normalized:"true"},{native:"假",normalized:"false"},{native:"空",normalized:"null"},{native:"未定义",normalized:"undefined"},{native:"第一个",normalized:"first"},{native:"首个",normalized:"first"},{native:"最后一个",normalized:"last"},{native:"末个",normalized:"last"},{native:"下一个",normalized:"next"},{native:"上一个",normalized:"previous"},{native:"最近的",normalized:"closest"},{native:"父级",normalized:"parent"},{native:"点击",normalized:"click"},{native:"双击",normalized:"dblclick"},{native:"输入",normalized:"input"},{native:"变更",normalized:"change"},{native:"改变",normalized:"change"},{native:"提交",normalized:"submit"},{native:"按键",normalized:"keydown"},{native:"释放键",normalized:"keyup"},{native:"鼠标移入",normalized:"mouseover"},{native:"鼠标移出",normalized:"mouseout"},{native:"获得焦点",normalized:"focus"},{native:"失去焦点",normalized:"blur"},{native:"加载",normalized:"load"},{native:"滚动",normalized:"scroll"},{native:"我的",normalized:"my"},{native:"它的",normalized:"its"},{native:"秒",normalized:"s"},{native:"毫秒",normalized:"ms"},{native:"分钟",normalized:"m"},{native:"小时",normalized:"h"},{native:"和",normalized:"and"},{native:"或者",normalized:"or"},{native:"或",normalized:"or"},{native:"不",normalized:"not"},{native:"非",normalized:"not"},{native:"是",normalized:"is"},{native:"若",normalized:"if"},{native:"不然",normalized:"else"},{native:"循环",normalized:"repeat"},{native:"遍历",normalized:"for"},{native:"每个",normalized:"for"},{native:"为每",normalized:"for"},{native:"中止",normalized:"halt"},{native:"抛",normalized:"throw"},{native:"呼叫",normalized:"call"},{native:"回",normalized:"return"},{native:"脚本",normalized:"js"},{native:"通知",normalized:"tell"},{native:"缺省",normalized:"default"},{native:"初始",normalized:"init"},{native:"动作",normalized:"behavior"},{native:"激发",normalized:"trigger"},{native:"对焦",normalized:"focus"},{native:"模糊",normalized:"blur"},{native:"跳转",normalized:"go"},{native:"导航",normalized:"go"},{native:"抓取",normalized:"fetch"},{native:"获取数据",normalized:"fetch"},{native:"安定",normalized:"settle"},{native:"拿取",normalized:"take"},{native:"取",normalized:"take"},{native:"创建",normalized:"make"},{native:"克隆",normalized:"clone"},{native:"记录",normalized:"log"},{native:"打印",normalized:"log"},{native:"动画",normalized:"transition"},{native:"到里面",normalized:"into"},{native:"里",normalized:"into"},{native:"前",normalized:"before"},{native:"后",normalized:"after"},{native:"那么",normalized:"then"},{native:"完",normalized:"end"}],iy=[{pattern:"毫秒",suffix:"ms",length:2},{pattern:"分钟",suffix:"m",length:2},{pattern:"小时",suffix:"h",length:2},{pattern:"秒",suffix:"s",length:1},{pattern:"分",suffix:"m",length:1}],oy=new(ay=class extends Dl{constructor(){super(),this.language="zh",this.direction="ltr",this.initializeKeywordsFromProfile(Zf,ny)}tokenize(e){const t=[];let r=0;for(;r<e.length;){if(Ul(e[r])){r++;continue}if(Kl(e[r])){const n=this.tryEventModifier(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.trySelector(e,r);if(i){t.push(i),r=i.position.end;continue}}if(Gl(e[r])||"“"===e[r]||"”"===e[r]||"‘"===e[r]||"’"===e[r]){const n=this.tryChineseString(e,r);if(n){t.push(n),r=n.position.end;continue}}if(tc(e,r)){const n=this.tryUrl(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Yl(e[r])){const n=this.extractChineseNumber(e,r);if(n){t.push(n),r=n.position.end;continue}}const n=this.tryVariableRef(e,r);if(n){t.push(n),r=n.position.end;continue}const i=this.tryMultiCharParticle(e,r,ry);if(i)t.push(i),r=i.position.end;else{if(ey(e[r])){const n=this.extractChineseWord(e,r);if(n){t.push(n),r=n.position.end;continue}}if(Xl(e[r])){const n=this.extractAsciiWord(e,r);if(n){t.push(n),r=n.position.end;continue}}r++}}return new Wl(t,"zh")}classifyToken(e){return ty.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||e.startsWith("“")||e.startsWith("‘")||/^\d/.test(e)?"literal":"identifier"}extractChineseWord(e,t){for(const r of this.profileKeywords){const n=r.native,i=e.slice(t,t+n.length);if(i===n){let e=!0;for(let t=0;t<n.length;t++)if(!ey(n[t])){e=!1;break}if(e)return Fl(i,"keyword",Hl(t,t+n.length),r.normalized)}}let r=t,n="";for(;r<e.length;){const t=e[r];if(ty.has(t)&&n.length>0)break;if(!ey(t))break;n+=t,r++}return n?ty.has(n)?Fl(n,"particle",Hl(t,r)):Fl(n,"identifier",Hl(t,r)):null}extractAsciiWord(e,t){let r=t,n="";for(;r<e.length&&Xl(e[r]);)n+=e[r++];return n?Fl(n,"identifier",Hl(t,r)):null}tryChineseString(e,t){const r=e[t];if('"'===r||"'"===r||"`"===r)return this.tryString(e,t);if("“"===r){let r=t+1;for(;r<e.length&&"”"!==e[r];)r++;if(r>=e.length)return null;return Fl(e.slice(t,r+1),"literal",Hl(t,r+1))}if("‘"===r){let r=t+1;for(;r<e.length&&"’"!==e[r];)r++;if(r>=e.length)return null;return Fl(e.slice(t,r+1),"literal",Hl(t,r+1))}return null}extractChineseNumber(e,t){return this.tryNumberWithTimeUnits(e,t,iy,{allowSign:!1,skipWhitespace:!1})}})}});function uy(e){let t="complex";return e.startsWith("#")&&!e.includes(" ")?t="id":e.startsWith(".")&&!e.includes(" ")?t="class":e.startsWith("[")&&e.endsWith("]")?t="attribute":/^[a-z][a-z0-9]*$/i.test(e)&&(t="element"),{type:"selector",value:e,selectorKind:t}}function py(e,t){return void 0!==t?{type:"literal",value:e,dataType:t}:{type:"literal",value:e}}function my(e){return{type:"reference",value:e}}function dy(e,t){return{type:"property-path",object:e,property:t}}function hy(e,t,r){const n={kind:"command",action:e,roles:new Map(Object.entries(t))};return void 0!==r?{...n,metadata:r}:n}function fy(e,t,r,n,i){const a=new Map;a.set("event",e);const o={kind:"event-handler",action:"on",roles:a,body:t};return void 0!==r&&(o.eventModifiers=r),void 0!==n&&(o.metadata=n),void 0!==i&&i.length>0&&(o.parameterNames=i),o}function yy(e,t="then",r){const n={kind:"compound",action:"compound",roles:new Map,statements:e,chainType:t};return void 0!==r&&(n.metadata=r),n}var vy=Sl({"src/types.ts"(){}});function gy(e){return function(e){let t=yl.get(e);return!t&&Il(e)&&(t=yl.get(Ol(e))),t}(e)}function ky(e,t){return _l(e,t)}function wy(){return Ml()}var by=Sl({"src/tokenizers/index.ts"(){Bl(),au(),yd(),Md(),Cc(),Op(),jf(),cy(),rc()}});function zy(e,t){return!t||0===t.length||(!!t.includes(e)||(!!t.includes("expression")||"property-path"===e&&t.some(e=>["selector","reference","expression"].includes(e))))}var xy=Sl({"src/parser/utils/type-validation.ts"(){}});var Ey,Sy,Ty,Cy=Sl({"src/parser/utils/possessive-keywords.ts"(){}});var Ay,Ly,jy=Sl({"src/parser/pattern-matcher.ts"(){vy(),xy(),Cy(),Bl(),(Ey=class e{constructor(){this.stemMatchCount=0,this.totalKeywordMatches=0}matchPattern(e,t){const r=e.mark(),n=new Map;this.currentProfile=Rl(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0;if(!this.matchTokenSequence(e,t.template.tokens,n))return e.reset(r),null;const i=this.calculateConfidence(t,n);return this.applyExtractionRules(t,n),{pattern:t,captured:n,consumedTokens:e.position()-r.position,confidence:i}}matchBest(e,t){const r=[];for(const n of t){const t=e.mark(),i=this.matchPattern(e,n);i&&r.push(i),e.reset(t)}if(0===r.length)return null;r.sort((e,t)=>{const r=t.pattern.priority-e.pattern.priority;return 0!==r?r:t.confidence-e.confidence});const n=r[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,t,r){const n=t[0],i="literal"===n?.type&&("and"===n.value||"then"===n.value||n.alternatives?.includes("and")||n.alternatives?.includes("then"));if("ar"===this.currentProfile?.code&&!i)for(;"conjunction"===e.peek()?.kind;)e.advance();for(const n of t){if(!this.matchPatternToken(e,n,r)){if(this.isOptional(n))continue;return!1}}return!0}matchPatternToken(e,t,r){switch(t.type){case"literal":return this.matchLiteralToken(e,t);case"role":return this.matchRoleToken(e,t,r);case"group":return this.matchGroupToken(e,t,r);default:return!1}}matchLiteralToken(e,t){const r=e.peek();if(!r)return!1;const n=this.getMatchType(r,t.value);if("none"!==n)return this.totalKeywordMatches++,"stem"===n&&this.stemMatchCount++,e.advance(),!0;if(t.alternatives)for(const n of t.alternatives){const t=this.getMatchType(r,n);if("none"!==t)return this.totalKeywordMatches++,"stem"===t&&this.stemMatchCount++,e.advance(),!0}return!1}matchRoleToken(e,t,r){this.skipNoiseWords(e);const n=e.peek();if(!n)return t.optional||!1;const i=this.tryMatchPossessiveExpression(e);if(i)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(i.type)&&!t.expectedTypes.includes("expression")?t.optional||!1:(r.set(t.role,i),!0);const a=this.tryMatchMethodCallExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(a.type)&&!t.expectedTypes.includes("expression")?t.optional||!1:(r.set(t.role,a),!0);const o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!zy(o.type,t.expectedTypes)?t.optional||!1:(r.set(t.role,o),!0);const s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(s.type)&&!t.expectedTypes.includes("expression")?t.optional||!1:(r.set(t.role,s),!0);const l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!zy(l.type,t.expectedTypes)?t.optional||!1:(r.set(t.role,l),!0);const c=this.tokenToSemanticValue(n);return c?t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(c.type)?t.optional||!1:(r.set(t.role,c),e.advance(),!0):t.optional||!1}tryMatchPossessiveExpression(e){const t=e.peek();if(!t)return null;if(!this.currentProfile)return null;const r=(t.normalized||t.value).toLowerCase(),n=(i=this.currentProfile,a=r,i.possessive?.keywords?.[a]);var i,a;if(!n)return null;const o=e.mark();e.advance();const s=e.peek();return s&&("identifier"===s.kind||"keyword"===s.kind&&!this.isStructuralKeyword(s.value)||"selector"===s.kind&&s.value.startsWith("*"))?(e.advance(),dy(my(n),s.value)):(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(t){const r=t.peek();if(!r||"selector"!==r.kind)return null;const n=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(n),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(n),null;t.advance();const o=t.peek();if(!o||"punctuation"!==o.kind||"("!==o.value)return t.reset(n),null;t.advance();const s=[];for(;!t.isAtEnd()&&s.length<e.MAX_METHOD_ARGS;){const e=t.peek();if(!e)break;if("punctuation"===e.kind&&")"===e.value){t.advance();break}"punctuation"!==e.kind||","!==e.value?(s.push(e.value),t.advance()):t.advance()}return{type:"expression",raw:`${r.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(t){const r=t.peek();if(!r)return null;if("identifier"!==r.kind&&"keyword"!==r.kind)return null;const n=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(n),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(n),null;t.advance();let o=`${r.value}.${a.value}`,s=1;for(;!t.isAtEnd()&&s<e.MAX_PROPERTY_DEPTH;){const e=t.peek();if(!e||"operator"!==e.kind||"."!==e.value)break;t.advance();const r=t.peek();if(!r||"identifier"!==r.kind)break;t.advance(),o+=`.${r.value}`,s++}const l=t.peek();if(l&&"punctuation"===l.kind&&"("===l.value){t.advance();const r=[];let n=0;for(;!t.isAtEnd()&&r.length<e.MAX_METHOD_ARGS;){const e=t.peek();if(!e)break;if("punctuation"===e.kind&&")"===e.value){if(0===n){t.advance();break}n--}"punctuation"===e.kind&&"("===e.value&&n++,"punctuation"!==e.kind||","!==e.value?(r.push(e.value),t.advance()):t.advance()}return{type:"expression",raw:`${o}(${r.join(", ")})`}}return{type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;const r=e.mark();e.advance();const n=e.peek();if(!n||"punctuation"!==n.kind||"'s"!==n.value)return e.reset(r),null;e.advance();const i=e.peek();return i?"selector"!==i.kind&&"identifier"!==i.kind?(e.reset(r),null):(e.advance(),dy(uy(t.value),i.value)):(e.reset(r),null)}tryMatchSelectorPropertyExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;if(!t.value.startsWith("#"))return null;const r=e.mark();e.advance();const n=e.peek();if(!n||"selector"!==n.kind)return e.reset(r),null;if(!n.value.startsWith("."))return e.reset(r),null;e.peek(1);e.advance();const i=n.value.slice(1);return dy(uy(t.value),i)}matchGroupToken(e,t,r){const n=e.mark(),i=new Set(r.keys());if(!this.matchTokenSequence(e,t.tokens,r)){e.reset(n);for(const e of r.keys())i.has(e)||r.delete(e);return t.optional||!1}return!0}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&void 0!==e.stemConfidence&&e.stemConfidence>=.7?"stem":"keyword"===e.kind&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case"selector":return uy(e.value);case"literal":return this.parseLiteralValue(e.value);case"keyword":const t=(e.normalized||e.value).toLowerCase();return["me","you","it","result","event","target","body"].includes(t)?my(t):py(e.normalized||e.value);case"identifier":if(e.value.startsWith(":"))return my(e.value);const r=e.value.toLowerCase();return["me","you","it","result","event","target","body"].includes(r)?my(r):{type:"expression",raw:e.value};case"url":return py(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("「")){return py(e.slice(1,-1),"string")}if("true"===e)return py(!0,"boolean");if("false"===e)return py(!1,"boolean");const t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){const r=parseFloat(t[1]);return t[2]?py(e,"duration"):py(r,"number")}const r=parseFloat(e);return isNaN(r)?py(e,"string"):py(r,"number")}applyExtractionRules(e,t){for(const[r,n]of Object.entries(e.extraction))!t.has(r)&&n.default&&t.set(r,n.default)}isOptional(e){return!0===e.optional}calculateConfidence(e,t){let r=0,n=0;const i=t=>void 0!==e.extraction?.[t]?.default;for(const a of e.template.tokens)if("role"===a.type)n+=1,t.has(a.role)&&(r+=1);else if("group"===a.type)for(const e of a.tokens)if("role"===e.type){const a=i(e.role),o=.8;n+=o,t.has(e.role)?r+=o:a&&(r+=.6*o)}let a=n>0?r/n:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){a=Math.max(.5,a-this.stemMatchCount/this.totalKeywordMatches*.15)}const o=this.calculateVSOConfidenceBoost(e);a=Math.min(1,a+o);const s=this.arabicPrepositionDisambiguation(e,t);return a=Math.max(0,Math.min(1,a+s)),a}calculateVSOConfidenceBoost(e){if("ar"!==e.language)return 0;const t=e.template.tokens[0];if(!t||"literal"!==t.type)return 0;const r=new Set(["بدل","غير","أضف","أزل","ضع","اجعل","عين","زد","انقص","سجل","أظهر","أخف","شغل","أرسل","ركز","شوش","توقف","انسخ","احذف","اصنع","انتظر","انتقال","أو"]);if(r.has(t.value))return.15;if(t.alternatives)for(const e of t.alternatives)if(r.has(e))return.15;return 0}arabicPrepositionDisambiguation(e,t){if("ar"!==e.language)return 0;let r=0;const n={patient:["على"],destination:["إلى","الى"],source:["من"],agent:["من"],manner:["ب"],style:["ب"],goal:["إلى","الى"],method:["ب"]};for(const[e,i]of t.entries()){const t=n[e];if(!t||0===t.length)continue;const a=i.metadata;if(a&&"string"==typeof a.prepositionValue){t.includes(a.prepositionValue)?r+=.1:r-=.1}}return Math.max(-.1,Math.min(.1,r))}skipNoiseWords(t){const r=t.peek();if(!r)return;const n=r.value.toLowerCase();if(e.ENGLISH_NOISE_WORDS.has(n)){const e=t.mark();t.advance();const r=t.peek();if(r&&"selector"===r.kind)return;t.reset(e)}"class"===n&&t.advance()}extractEventModifiers(e){const t={};let r=!1;for(;!e.isAtEnd();){const n=e.peek();if(!n||"event-modifier"!==n.kind)break;const i=n.metadata;if(!i)break;switch(r=!0,i.modifierName){case"once":t.once=!0;break;case"debounce":"number"==typeof i.value&&(t.debounce=i.value);break;case"throttle":"number"==typeof i.value&&(t.throttle=i.value);break;case"queue":"first"!==i.value&&"last"!==i.value&&"all"!==i.value&&"none"!==i.value||(t.queue=i.value)}e.advance()}return r?t:void 0}}).MAX_PROPERTY_DEPTH=10,Ey.MAX_METHOD_ARGS=20,Ey.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]),Ty=new(Sy=Ey)}});function Py(e,t){return Ly.render(e,t)}function Ny(e){return Ly.renderExplicit(e)}var Oy=Sl({"src/explicit/renderer.ts"(){Bl(),by(),Ay=class{render(e,t){if("compound"===e.kind)return this.renderCompound(e,t);const r=function(e,t){return $l(e).filter(e=>e.command===t).sort((e,t)=>t.priority-e.priority)}(t,e.action);if(0===r.length)return this.renderExplicit(e);const n=this.findBestPattern(e,r);return n?this.renderWithPattern(e,n):this.renderExplicit(e)}renderCompound(e,t){const r=e.statements.map(e=>this.render(e,t)),n=this.getChainWord(e.chainType,t);return r.join(` ${n} `)}getChainWord(e,t){const r=Rl(t);if(!r?.keywords)return e;const n=r.keywords[e];return n?.primary??e}renderExplicit(e){if("compound"===e.kind){const t=e;return t.statements.map(e=>this.renderExplicit(e)).join(` ${t.chainType} `)}const t=[e.action];for(const[r,n]of e.roles)t.push(`${r}:${this.valueToString(n)}`);if("event-handler"===e.kind){if(e.body&&e.body.length>0){const r=e.body.map(e=>this.renderExplicit(e));t.push(`body:${r.join(" ")}`)}}return`[${t.join(" ")}]`}supportedLanguages(){return wy()}findBestPattern(e,t){const r=t.map(t=>{let r=t.priority;for(const n of t.template.tokens)"role"===n.type&&(e.roles.has(n.role)?r+=10:n.optional||(r-=50));return"en"===t.language&&((t.id.includes("standard")||t.id.includes("en-source"))&&(r+=20),(t.id.includes("-when")||t.id.includes("-if")||t.id.includes("-upon"))&&(r-=15)),{pattern:t,score:r}});return r.sort((e,t)=>t.score-e.score),r.length>0?r[0].pattern:null}renderWithPattern(e,t){const r=[],n=t.language;for(const i of t.template.tokens){const t=this.renderPatternToken(i,e,n);null!==t&&r.push(t)}if("event-handler"===e.kind){if(e.body&&e.body.length>0){const t=e.body.map(e=>this.render(e,n));r.push(t.join(" "))}}return r.join(" ")}renderPatternToken(e,t,r){switch(e.type){case"literal":return e.value;case"role":{const n=t.roles.get(e.role);return n?this.valueToNaturalString(n,r):null}case"group":{if(!e.tokens.filter(e=>"role"===e.type&&!e.optional).every(e=>t.roles.has(e.role))&&e.optional)return null;if(e.optional){if(e.tokens.find(e=>"role"===e.type&&"destination"===e.role)){const e=t.roles.get("destination");if("reference"===e?.type&&"me"===e.value)return null}}const n=[];for(const i of e.tokens){const e=this.renderPatternToken(i,t,r);null!==e&&n.push(e)}return n.length>0?n.join(" "):null}default:return null}}valueToString(e){switch(e.type){case"literal":return"string"==typeof e.value?"string"===e.dataType||/\s/.test(e.value)?`"${e.value}"`:e.value:String(e.value);case"selector":case"reference":return e.value;case"property-path":return`${this.valueToString(e.object)}'s ${e.property}`;case"expression":return e.raw}}valueToNaturalString(e,t="en"){switch(e.type){case"literal":return"string"==typeof e.value&&"string"===e.dataType?`"${e.value}"`:String(e.value);case"selector":return e.value;case"reference":return this.renderReference(e,t);case"property-path":return this.renderPropertyPath(e,t);case"expression":return e.raw}}renderReference(e,t){const r=Rl(t);return r?.references?r.references[e.value]??e.value:e.value}renderPropertyPath(e,t){const r=Rl(t),n=e.property,i="reference"===e.object.type?e.object.value:null;if(r?.possessive?.specialForms&&i){const e=r.possessive.specialForms[i];if(e){const{markerPosition:t,usePossessiveAdjectives:i}=r.possessive;return i&&"after-object"===t?`${n} ${e}`:`${e} ${n}`}}const a=this.valueToNaturalString(e.object,t);if(r?.possessive){const{marker:e,markerPosition:t,usePossessiveAdjectives:o}=r.possessive;if(o&&i&&"after-object"===t)return`${n} ${a}`;if(e)switch(t){case"between":return r.usesSpaces?`${a}${e} ${n}`:`${a}${e}${n}`;case"after-object":return`${a}${e} ${n}`;case"before-property":return`${a} ${e} ${n}`}}return"en"!==t&&r?.possessive?`${a} ${n}`:"me"===a?`my ${n}`:"it"===a?`its ${n}`:`${a}'s ${n}`}},Ly=new Ay}});function Iy(e){const t=e.trim();if(!t.startsWith("[")||!t.endsWith("]"))throw new Error("Explicit syntax must be wrapped in brackets: [command role:value ...]");const r=t.slice(1,-1).trim();if(!r)throw new Error("Empty explicit statement");const n=function(e){const t=[];let r="",n=!1,i="",a=0;for(let o=0;o<e.length;o++){const s=e[o];n?(r+=s,s===i&&"\\"!==e[o-1]&&(n=!1)):'"'!==s&&"'"!==s?"["!==s?"]"!==s?" "!==s||0!==a?r+=s:r&&(t.push(r),r=""):(a--,r+=s):(a++,r+=s):(n=!0,i=s,r+=s)}r&&t.push(r);return t}(r);if(0===n.length)throw new Error("No command specified in explicit statement");const i=n[0].toLowerCase(),a=new Map;for(let e=1;e<n.length;e++){const t=n[e],r=t.indexOf(":");if(-1===r)throw new Error(`Invalid role format: "${t}". Expected role:value`);const i=t.slice(0,r),o=t.slice(r+1);if("body"===i&&o.startsWith("[")){const e=My(t,r+1),n=t.slice(r+1,e+1);a.set(i,{type:"expression",raw:n});continue}const s=Ry(o);a.set(i,s)}if("on"===i){const e=a.get("event");if(!e)throw new Error("Event handler requires event role: [on event:click ...]");const t=a.get("body"),r=[];return t&&"expression"===t.type&&r.push(Iy(t.raw)),a.delete("body"),fy(e,r,void 0,{sourceLanguage:"explicit"})}const o={};for(const[e,t]of a)o[e]=t;return hy(i,o,{sourceLanguage:"explicit"})}function Ry(e){if(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("@")||e.startsWith("*"))return uy(e);if(e.startsWith('"')||e.startsWith("'")){return py(e.slice(1,-1),"string")}if("true"===e)return py(!0,"boolean");if("false"===e)return py(!1,"boolean");if(["me","you","it","result","event","target","body"].includes(e.toLowerCase()))return my(e.toLowerCase());const t=e.match(/^(-?\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){const r=parseFloat(t[1]);return t[2]?py(e,"duration"):py(r,"number")}return py(e,"string")}function My(e,t){let r=0;for(let n=t;n<e.length;n++)if("["===e[n])r++;else if("]"===e[n]&&(r--,0===r))return n;return e.length-1}function qy(e){const t=e.trim();return t.startsWith("[")&&t.endsWith("]")}var _y,$y,Wy=Sl({"src/explicit/parser.ts"(){vy()}}),Vy={};function Dy(e,t){return $y.parse(e,t)}function By(e,t){return $y.canParse(e,t)}function Hy(e,t){try{return $y.parse(e,t).action}catch{return null}}function Fy(e,t){return ky(e,t)}function Uy(){return wy()}function Ky(e,t,r){return Xy(Dy(e,t),r)}function Gy(e,t){const r=Dy(e,t),n={};for(const e of Uy())try{n[e]=Xy(r,e)}catch{}return n}function Yy(){return{analyze(e,t){try{return{node:Dy(e,t),confidence:1,success:!0}}catch(e){return{node:null,confidence:0,success:!1,error:e}}}}}function Xy(e,t){return Py(e,t)}function Zy(e){return Py(e,"explicit")}function Jy(e){return Iy(e)}function Qy(e,t){return Zy(Dy(e,t))}function ev(e,t){return Xy(Jy(e),t)}function tv(e,t){return ev(Qy(e,t),t)}Tl(Vy,{SemanticParserImpl:()=>_y,canParse:()=>By,createSemanticAnalyzer:()=>Yy,fromExplicit:()=>ev,getAllTranslations:()=>Gy,getCommandType:()=>Hy,getSupportedLanguages:()=>Uy,parse:()=>Dy,parseExplicit:()=>Jy,render:()=>Xy,renderExplicit:()=>Zy,roundTrip:()=>tv,semanticParser:()=>$y,toExplicit:()=>Qy,tokenize:()=>Fy,translate:()=>Ky});var rv=Sl({"src/parser/semantic-parser.ts"(){vy(),by(),Bl(),jy(),Oy(),Wy(),$y=new(_y=class{parse(e,t){const r=ky(e,t),n=$l(t);if(0===n.length)throw new Error(`No patterns available for language: ${t}`);const i=[...n].sort((e,t)=>t.priority-e.priority),a=i.filter(e=>"on"===e.command),o=Ty.matchBest(r,a);if(o)return this.buildEventHandler(o,r,t);const s=i.filter(e=>"on"!==e.command),l=Ty.matchBest(r,s);if(l)return this.buildCommand(l,t);throw new Error(`Could not parse input in ${t}: ${e}`)}canParse(e,t){try{return this.parse(e,t),!0}catch{return!1}}supportedLanguages(){return wy()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");const r={};for(const[t,n]of e.captured)r[t]=n;return hy(e.pattern.command,r,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,r){if(!e)throw new Error("No match to build event handler from");const n=e.captured.get("event");if(!n)throw new Error("Event handler pattern matched but no event captured");const i=Ty.extractEventModifiers(t);let a;const o=e.captured.get("action");if(o&&"literal"===o.type){const n=o.value,i={};for(const[t,r]of e.captured)"event"!==t&&"action"!==t&&"continues"!==t&&(i[t]=r);const s=hy(n,i,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence}),l=e.captured.get("continues");if(l&&"literal"===l.type&&"then"===l.value){const e=$l(r).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority),n=$l(r).filter(e=>e.id.startsWith("grammar-")&&e.id.includes("-continuation")).sort((e,t)=>t.priority-e.priority),i=this.parseBodyWithGrammarPatterns(t,e,n,r);a=i.length>0?[s,...i]:[s]}else a=[s]}else{const e=$l(r).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority);a=this.parseBodyWithClauses(t,e,r)}return fy(n,a,i,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,r){const n=[],i=[];for(;!e.isAtEnd();){const a=e.peek();if(!a)break;const o="conjunction"===a.kind||"keyword"===a.kind&&this.isThenKeyword(a.value,r),s="keyword"===a.kind&&this.isEndKeyword(a.value,r);if(o){if(i.length>0){const e=this.parseClause(i,t,r);n.push(...e),i.length=0}e.advance()}else{if(s){if(i.length>0){const e=this.parseClause(i,t,r);n.push(...e)}e.advance();break}i.push(a),e.advance()}}if(i.length>0){const e=this.parseClause(i,t,r);n.push(...e)}return n.length>1?[yy(n,"then",{sourceLanguage:r})]:n}parseClause(e,t,r){if(0===e.length)return[];const n=new Wl(e,r),i=[];for(;!n.isAtEnd();){const e=Ty.matchBest(n,t);e?i.push(this.buildCommand(e,r)):n.advance()}return i}parseBodyWithGrammarPatterns(e,t,r,n){const i=[];for(;!e.isAtEnd();){const a=e.peek();if(a&&this.isThenKeyword(a.value,n)){e.advance();continue}if(a&&this.isEndKeyword(a.value,n)){e.advance();break}let o=!1;if(r.length>0){const t=Ty.matchBest(e,r);if(t){const e=t.pattern.command,r={};for(const[e,n]of t.captured)"event"!==e&&"action"!==e&&"continues"!==e&&(r[e]=n);const a=hy(e,r,{sourceLanguage:n,patternId:t.pattern.id});i.push(a),o=!0;const s=t.captured.get("continues");if(s&&"literal"===s.type&&"then"===s.value)continue}}if(!o){const r=Ty.matchBest(e,t);r&&(i.push(this.buildCommand(r,n)),o=!0)}o||e.advance()}return i}isThenKeyword(e,t){const r={en:new Set(["then"]),ja:new Set(["それから","次に","そして"]),ar:new Set(["ثم","بعدها","ثمّ"]),es:new Set(["entonces","luego","después"]),ko:new Set(["그다음","그리고","그런후"]),zh:new Set(["然后","接着","之后"]),tr:new Set(["sonra","ardından","daha sonra"]),pt:new Set(["então","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschließend"]),id:new Set(["lalu","kemudian","setelah itu"]),qu:new Set(["chaymantataq","hinaspa","chaymanta"]),sw:new Set(["kisha","halafu","baadaye"])};return(r[t]||r.en).has(e.toLowerCase())}isEndKeyword(e,t){const r={en:new Set(["end"]),ja:new Set(["終わり","終了","おわり"]),ar:new Set(["نهاية","انتهى","آخر"]),es:new Set(["fin","final","terminar"]),ko:new Set(["끝","종료","마침"]),zh:new Set(["结束","终止","完"]),tr:new Set(["son","bitiş","bitti"]),pt:new Set(["fim","final","término"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return(r[t]||r.en).has(e.toLowerCase())}})}});Bl(),Cc(),Ec(),Pl("ar",xc,mc),Bl(),qc(),Ic(),Pl("bn",Oc,Tc),Bl(),Yc(),Uc(),Pl("de",Fc,Mc),Bl(),au(),eu(),gp(),Pl("en",Qc,Gc),Nl("en",pp()),Bl(),Op(),jp(),Pl("es",Lp,wp),Bl(),Op();var nv={code:"es-MX",name:"Spanish (Mexico)",nativeName:"Español (México)",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",extends:"es",verb:{position:"start",subjectDrop:!0},references:{me:"yo",it:"ello",you:"tú",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:!0,specialForms:{me:"mi",it:"su",you:"tu"},keywords:{mi:"me",tu:"you",su:"it"}},roleMarkers:{destination:{primary:"en",alternatives:["sobre","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["cambiar","conmutar","switchear"],normalized:"toggle"},add:{primary:"agregar",alternatives:["añadir","meter"],normalized:"add"},remove:{primary:"quitar",alternatives:["eliminar","borrar","sacar"],normalized:"remove"},put:{primary:"poner",alternatives:["colocar","meter"],normalized:"put"},append:{primary:"añadir",normalized:"append"},prepend:{primary:"anteponer",normalized:"prepend"},take:{primary:"tomar",alternatives:["agarrar"],normalized:"take"},make:{primary:"hacer",alternatives:["crear"],normalized:"make"},clone:{primary:"clonar",alternatives:["copiar"],normalized:"clone"},swap:{primary:"intercambiar",alternatives:["cambiar"],normalized:"swap"},morph:{primary:"transformar",alternatives:["convertir"],normalized:"morph"},set:{primary:"establecer",alternatives:["fijar","definir","setear"],normalized:"set"},get:{primary:"obtener",alternatives:["conseguir","jalar"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar","subir"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["disminuir","bajar"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir","loguear"],normalized:"log"},show:{primary:"mostrar",alternatives:["enseñar"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transición",alternatives:["animar"],normalized:"transition"},on:{primary:"en",alternatives:["cuando","al"],normalized:"on"},trigger:{primary:"disparar",alternatives:["activar"],normalized:"trigger"},send:{primary:"enviar",alternatives:["mandar"],normalized:"send"},focus:{primary:"enfocar",normalized:"focus"},blur:{primary:"desenfocar",normalized:"blur"},click:{primary:"clic",alternatives:["hacer clic","dar clic"],normalized:"click"},hover:{primary:"sobrevolar",alternatives:["pasar encima"],normalized:"hover"},submit:{primary:"envío",alternatives:["enviar"],normalized:"submit"},input:{primary:"entrada",alternatives:["introducir"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiar"],normalized:"change"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},wait:{primary:"esperar",alternatives:["ahorita","aguantar"],normalized:"wait"},fetch:{primary:"buscar",alternatives:["obtener","jalar","traer"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"cuando",normalized:"when"},where:{primary:"donde",normalized:"where"},else:{primary:"sino",alternatives:["de lo contrario","si no"],normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"mientras",normalized:"while"},continue:{primary:"continuar",alternatives:["seguir"],normalized:"continue"},halt:{primary:"detener",alternatives:["parar"],normalized:"halt"},throw:{primary:"lanzar",alternatives:["aventar","arrojar"],normalized:"throw"},call:{primary:"llamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver","regresar"],normalized:"return"},then:{primary:"entonces",alternatives:["luego","después"],normalized:"then"},and:{primary:"y",alternatives:["además","también"],normalized:"and"},end:{primary:"fin",alternatives:["final","terminar"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asíncrono",normalized:"async"},tell:{primary:"decir",normalized:"tell"},default:{primary:"predeterminar",alternatives:["por defecto"],normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar","arrancar"],normalized:"init"},behavior:{primary:"comportamiento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},into:{primary:"en",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"después",normalized:"after"},until:{primary:"hasta",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"}},eventHandler:{keyword:{primary:"al",alternatives:["cuando","en"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},eventMarker:{primary:"al",alternatives:["cuando"],position:"before"},temporalMarkers:["cuando","al"]}};function iv(e){switch(e){case"ar":case"ja":case"ko":case"ms":case"tl":case"tr":default:return[];case"bn":return[{id:"toggle-bn-full",language:"bn",command:"toggle",priority:100,template:{format:"{patient} কে টগল করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"টগল",alternatives:["পরিবর্তন"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0}}},{id:"toggle-bn-simple",language:"bn",command:"toggle",priority:90,template:{format:"টগল {patient}",tokens:[{type:"literal",value:"টগল",alternatives:["পরিবর্তন"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-bn-with-dest",language:"bn",command:"toggle",priority:95,template:{format:"{destination} এ {patient} কে টগল করুন",tokens:[{type:"role",role:"destination"},{type:"literal",value:"এ",alternatives:["তে"]},{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"টগল",alternatives:["পরিবর্তন"]},{type:"literal",value:"করুন"}]},extraction:{destination:{position:0},patient:{position:2}}}];case"en":return[{id:"toggle-en-full",language:"en",command:"toggle",priority:100,template:{format:"toggle {patient} on {target}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"on",alternatives:["from"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"on",markerAlternatives:["from"],default:{type:"reference",value:"me"}}}},{id:"toggle-en-simple",language:"en",command:"toggle",priority:90,template:{format:"toggle {patient}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"es":return[{id:"toggle-es-full",language:"es",command:"toggle",priority:100,template:{format:"alternar {patient} en {target}",tokens:[{type:"literal",value:"alternar",alternatives:["cambiar","toggle"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"en",alternatives:["sobre","de"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"en",markerAlternatives:["sobre","de"],default:{type:"reference",value:"me"}}}},{id:"toggle-es-simple",language:"es",command:"toggle",priority:90,template:{format:"alternar {patient}",tokens:[{type:"literal",value:"alternar",alternatives:["cambiar","toggle"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"hi":return[{id:"toggle-hi-full",language:"hi",command:"toggle",priority:100,template:{format:"{patient} को {destination} पर टॉगल करें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"destination"},{type:"literal",value:"पर"},{type:"literal",value:"टॉगल",alternatives:["बदलें","बदल"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"करें",alternatives:["करो"]}]}]},extraction:{patient:{position:0},destination:{marker:"को",position:2}}},{id:"toggle-hi-simple",language:"hi",command:"toggle",priority:90,template:{format:"{patient} टॉगल करें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"टॉगल",alternatives:["बदलें","बदल"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"करें",alternatives:["करो"]}]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-hi-bare",language:"hi",command:"toggle",priority:80,template:{format:"टॉगल {patient}",tokens:[{type:"literal",value:"टॉगल",alternatives:["बदलें","बदल"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"toggle-it-full",language:"it",command:"toggle",priority:100,template:{format:"commutare {patient} su {target}",tokens:[{type:"literal",value:"commutare",alternatives:["alternare","toggle","cambiare"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"su",alternatives:["in","di"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"su",markerAlternatives:["in","di"],default:{type:"reference",value:"me"}}}},{id:"toggle-it-simple",language:"it",command:"toggle",priority:90,template:{format:"commutare {patient}",tokens:[{type:"literal",value:"commutare",alternatives:["alternare","toggle","cambiare"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"pl":return[{id:"toggle-pl-full",language:"pl",command:"toggle",priority:100,template:{format:"przełącz {patient} na {destination}",tokens:[{type:"literal",value:"przełącz",alternatives:["przelacz","przełączaj"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"na",alternatives:["w","dla"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"na",markerAlternatives:["w","dla"],default:{type:"reference",value:"me"}}}},{id:"toggle-pl-simple",language:"pl",command:"toggle",priority:90,template:{format:"przełącz {patient}",tokens:[{type:"literal",value:"przełącz",alternatives:["przelacz","przełączaj"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"qu":return[{id:"toggle-qu-sov",language:"qu",command:"toggle",priority:100,template:{format:"{patient} ta t'ikray",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{patient:{position:0}}},{id:"toggle-qu-simple",language:"qu",command:"toggle",priority:90,template:{format:"t'ikray {patient}",tokens:[{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-qu-with-dest",language:"qu",command:"toggle",priority:95,template:{format:"{destination} pi {patient} ta t'ikray",tokens:[{type:"role",role:"destination"},{type:"literal",value:"pi"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{destination:{position:0},patient:{position:2}}},{id:"toggle-qu-dest-man",language:"qu",command:"toggle",priority:93,template:{format:"{destination} man {patient} ta t'ikray",tokens:[{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"ru":return[{id:"toggle-ru-full",language:"ru",command:"toggle",priority:100,template:{format:"переключить {patient} на {destination}",tokens:[{type:"literal",value:"переключить",alternatives:["переключи"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"на",alternatives:["в","для"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"на",markerAlternatives:["в","для"],default:{type:"reference",value:"me"}}}},{id:"toggle-ru-simple",language:"ru",command:"toggle",priority:90,template:{format:"переключить {patient}",tokens:[{type:"literal",value:"переключить",alternatives:["переключи"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"th":return[{id:"toggle-th-simple",language:"th",command:"toggle",priority:100,template:{format:"สลับ {patient}",tokens:[{type:"literal",value:"สลับ"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-th-with-dest",language:"th",command:"toggle",priority:95,template:{format:"สลับ {patient} ใน {destination}",tokens:[{type:"literal",value:"สลับ"},{type:"role",role:"patient"},{type:"literal",value:"ใน"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"ใน",position:3}}}];case"uk":return[{id:"toggle-uk-full",language:"uk",command:"toggle",priority:100,template:{format:"перемкнути {patient} на {destination}",tokens:[{type:"literal",value:"перемкнути",alternatives:["перемкни"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"на",alternatives:["в","для"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"на",markerAlternatives:["в","для"],default:{type:"reference",value:"me"}}}},{id:"toggle-uk-simple",language:"uk",command:"toggle",priority:90,template:{format:"перемкнути {patient}",tokens:[{type:"literal",value:"перемкнути",alternatives:["перемкни"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"vi":return[{id:"toggle-vi-full",language:"vi",command:"toggle",priority:100,template:{format:"chuyển đổi {patient} trên {target}",tokens:[{type:"literal",value:"chuyển đổi",alternatives:["chuyển","bật tắt"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"trên",alternatives:["tại","ở"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"trên",markerAlternatives:["tại","ở"],default:{type:"reference",value:"me"}}}},{id:"toggle-vi-simple",language:"vi",command:"toggle",priority:90,template:{format:"chuyển đổi {patient}",tokens:[{type:"literal",value:"chuyển đổi",alternatives:["chuyển","bật tắt"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"zh":return[{id:"toggle-zh-full",language:"zh",command:"toggle",priority:100,template:{format:"切换 {patient} 在 {target}",tokens:[{type:"literal",value:"切换"},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"在",alternatives:["到","于"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"在",markerAlternatives:["到","于"],default:{type:"reference",value:"me"}}}},{id:"toggle-zh-simple",language:"zh",command:"toggle",priority:90,template:{format:"切换 {patient}",tokens:[{type:"literal",value:"切换"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-zh-ba",language:"zh",command:"toggle",priority:95,template:{format:"把 {patient} 切换",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"切换"}]},extraction:{patient:{marker:"把"},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-zh-full-ba",language:"zh",command:"toggle",priority:98,template:{format:"在 {target} 把 {patient} 切换",tokens:[{type:"literal",value:"在",alternatives:["到","于"]},{type:"role",role:"destination"},{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"切换"}]},extraction:{destination:{marker:"在",markerAlternatives:["到","于"]},patient:{marker:"把"}}}]}}function av(e){switch(e){case"ar":case"ja":case"ko":case"ms":case"tl":case"tr":default:return[];case"bn":return[{id:"put-bn-full",language:"bn",command:"put",priority:100,template:{format:"{patient} কে {destination} এ রাখুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"role",role:"destination"},{type:"literal",value:"এ",alternatives:["তে"]},{type:"literal",value:"রাখুন",alternatives:["রাখ"]}]},extraction:{patient:{position:0},destination:{marker:"এ",position:2}}},{id:"put-bn-simple",language:"bn",command:"put",priority:90,template:{format:"রাখুন {patient} {destination} এ",tokens:[{type:"literal",value:"রাখুন",alternatives:["রাখ"]},{type:"role",role:"patient"},{type:"role",role:"destination"},{type:"literal",value:"এ",alternatives:["তে"]}]},extraction:{patient:{position:1},destination:{position:2}}}];case"en":return[{id:"put-en-into",language:"en",command:"put",priority:100,template:{format:"put {patient} into {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"into",alternatives:["in","to"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"into",markerAlternatives:["in","to"]}}},{id:"put-en-before",language:"en",command:"put",priority:95,template:{format:"put {patient} before {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-en-after",language:"en",command:"put",priority:95,template:{format:"put {patient} after {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}}];case"es":return[{id:"put-es-full",language:"es",command:"put",priority:100,template:{format:"poner {patient} en {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar","put"]},{type:"role",role:"patient"},{type:"literal",value:"en",alternatives:["dentro de","a"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"en",markerAlternatives:["dentro de","a"]}}},{id:"put-es-before",language:"es",command:"put",priority:95,template:{format:"poner {patient} antes de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"antes de",alternatives:["antes"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"antes de",markerAlternatives:["antes"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-es-after",language:"es",command:"put",priority:95,template:{format:"poner {patient} después de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"después de",alternatives:["despues de","después"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"después de",markerAlternatives:["despues de","después"]},manner:{default:{type:"literal",value:"after"}}}}];case"hi":return[{id:"put-hi-full",language:"hi",command:"put",priority:100,template:{format:"{patient} को {destination} में रखें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"destination"},{type:"literal",value:"में"},{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]}]},extraction:{patient:{position:0},destination:{marker:"में",position:3}}},{id:"put-hi-simple",language:"hi",command:"put",priority:90,template:{format:"{patient} रखें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"put-hi-bare",language:"hi",command:"put",priority:80,template:{format:"रखें {patient}",tokens:[{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"id":return[{id:"put-id-full",language:"id",command:"put",priority:100,template:{format:"taruh {patient} ke dalam {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan","tempatkan","put"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"ke"},{type:"literal",value:"dalam",alternatives:["di"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:4}}},{id:"put-id-simple-ke",language:"id",command:"put",priority:95,template:{format:"taruh {patient} ke {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan","tempatkan"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["di","pada"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}},{id:"put-id-di",language:"id",command:"put",priority:90,template:{format:"taruh {patient} di {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"di"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}];case"it":return[{id:"put-it-full",language:"it",command:"put",priority:100,template:{format:"mettere {patient} in {target}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"in",alternatives:["dentro","nel"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"in",markerAlternatives:["dentro","nel"]}}},{id:"put-it-simple",language:"it",command:"put",priority:90,template:{format:"mettere {patient}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"put-pl-full",language:"pl",command:"put",priority:100,template:{format:"umieść {patient} w {destination}",tokens:[{type:"literal",value:"umieść",alternatives:["umiesc","wstaw","włóż","wloz"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"w",alternatives:["do","na"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"w",markerAlternatives:["do","na"]}}},{id:"put-pl-before",language:"pl",command:"put",priority:95,template:{format:"umieść {patient} przed {destination}",tokens:[{type:"literal",value:"umieść",alternatives:["umiesc","wstaw"]},{type:"role",role:"patient"},{type:"literal",value:"przed"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"przed"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-pl-after",language:"pl",command:"put",priority:95,template:{format:"umieść {patient} po {destination}",tokens:[{type:"literal",value:"umieść",alternatives:["umiesc","wstaw"]},{type:"role",role:"patient"},{type:"literal",value:"po"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"po"},manner:{default:{type:"literal",value:"after"}}}}];case"ru":return[{id:"put-ru-full",language:"ru",command:"put",priority:100,template:{format:"положить {patient} в {destination}",tokens:[{type:"literal",value:"положить",alternatives:["положи","поместить","помести","вставить","вставь"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"в",alternatives:["во","на"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"в",markerAlternatives:["во","на"]}}},{id:"put-ru-before",language:"ru",command:"put",priority:95,template:{format:"положить {patient} перед {destination}",tokens:[{type:"literal",value:"положить",alternatives:["положи","поместить","помести"]},{type:"role",role:"patient"},{type:"literal",value:"перед",alternatives:["до"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"перед",markerAlternatives:["до"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-ru-after",language:"ru",command:"put",priority:95,template:{format:"положить {patient} после {destination}",tokens:[{type:"literal",value:"положить",alternatives:["положи","поместить","помести"]},{type:"role",role:"patient"},{type:"literal",value:"после"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"после"},manner:{default:{type:"literal",value:"after"}}}}];case"th":return[{id:"put-th-full",language:"th",command:"put",priority:100,template:{format:"ใส่ {patient} ใน {destination}",tokens:[{type:"literal",value:"ใส่",alternatives:["วาง"]},{type:"role",role:"patient"},{type:"literal",value:"ใน"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"ใน",position:3}}}];case"uk":return[{id:"put-uk-full",language:"uk",command:"put",priority:100,template:{format:"покласти {patient} в {destination}",tokens:[{type:"literal",value:"покласти",alternatives:["поклади","помістити","помісти","вставити","встав"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"в",alternatives:["у","на"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"в",markerAlternatives:["у","на"]}}},{id:"put-uk-before",language:"uk",command:"put",priority:95,template:{format:"покласти {patient} перед {destination}",tokens:[{type:"literal",value:"покласти",alternatives:["поклади","помістити","помісти"]},{type:"role",role:"patient"},{type:"literal",value:"перед",alternatives:["до"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"перед",markerAlternatives:["до"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-uk-after",language:"uk",command:"put",priority:95,template:{format:"покласти {patient} після {destination}",tokens:[{type:"literal",value:"покласти",alternatives:["поклади","помістити","помісти"]},{type:"role",role:"patient"},{type:"literal",value:"після"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"після"},manner:{default:{type:"literal",value:"after"}}}}];case"vi":return[{id:"put-vi-into",language:"vi",command:"put",priority:100,template:{format:"đặt {patient} vào {target}",tokens:[{type:"literal",value:"đặt",alternatives:["để","đưa"]},{type:"role",role:"patient"},{type:"literal",value:"vào",alternatives:["vào trong"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"vào",markerAlternatives:["vào trong"]}}},{id:"put-vi-before",language:"vi",command:"put",priority:95,template:{format:"đặt {patient} trước {target}",tokens:[{type:"literal",value:"đặt",alternatives:["để","đưa"]},{type:"role",role:"patient"},{type:"literal",value:"trước",alternatives:["trước khi"]},{type:"role",role:"manner"}]},extraction:{patient:{position:1},manner:{marker:"trước",markerAlternatives:["trước khi"]}}},{id:"put-vi-after",language:"vi",command:"put",priority:95,template:{format:"đặt {patient} sau {target}",tokens:[{type:"literal",value:"đặt",alternatives:["để","đưa"]},{type:"role",role:"patient"},{type:"literal",value:"sau",alternatives:["sau khi"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"sau",markerAlternatives:["sau khi"]}}}];case"zh":return[{id:"put-zh-full",language:"zh",command:"put",priority:100,template:{format:"放置 {patient} 到 {destination}",tokens:[{type:"literal",value:"放置",alternatives:["放","放入","置入","put"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"到",alternatives:["在","于","入"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}},{id:"put-zh-ba",language:"zh",command:"put",priority:95,template:{format:"把 {patient} 放到 {destination}",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"放到",alternatives:["放在","放入"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}]}}function ov(e){switch(e){case"ar":case"he":case"ja":case"ko":case"tl":case"tr":default:return[];case"bn":return[{id:"event-handler-bn-sov",language:"bn",command:"on",priority:100,template:{format:"{event} তে {action}",tokens:[{type:"role",role:"event"},{type:"literal",value:"তে",alternatives:["এ"]},{type:"role",role:"action"}]},extraction:{event:{position:0},action:{position:2}}},{id:"event-handler-bn-with-source",language:"bn",command:"on",priority:95,template:{format:"{source} থেকে {event} তে {action}",tokens:[{type:"role",role:"source"},{type:"literal",value:"থেকে"},{type:"role",role:"event"},{type:"literal",value:"তে",alternatives:["এ"]},{type:"role",role:"action"}]},extraction:{source:{position:0},event:{marker:"তে",position:2},action:{position:4}}},{id:"event-handler-bn-when",language:"bn",command:"on",priority:90,template:{format:"যখন {event} {action}",tokens:[{type:"literal",value:"যখন"},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}}];case"de":return[{id:"event-de-wenn-source",language:"de",command:"on",priority:115,template:{format:"wenn {event} von {source} {body}",tokens:[{type:"literal",value:"wenn",alternatives:["falls","sobald"]},{type:"role",role:"event"},{type:"literal",value:"von",alternatives:["aus"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"von",markerAlternatives:["aus"]}}},{id:"event-de-wenn",language:"de",command:"on",priority:105,template:{format:"wenn {event} {body}",tokens:[{type:"literal",value:"wenn",alternatives:["falls","sobald"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-bei-source",language:"de",command:"on",priority:110,template:{format:"bei {event} von {source} {body}",tokens:[{type:"literal",value:"bei",alternatives:["beim"]},{type:"role",role:"event"},{type:"literal",value:"von",alternatives:["aus"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"von",markerAlternatives:["aus"]}}},{id:"event-de-bei",language:"de",command:"on",priority:100,template:{format:"bei {event} {body}",tokens:[{type:"literal",value:"bei",alternatives:["beim"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-auf",language:"de",command:"on",priority:95,template:{format:"auf {event} {body}",tokens:[{type:"literal",value:"auf"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-im-falle",language:"de",command:"on",priority:90,template:{format:"im Falle von {event} {body}",tokens:[{type:"literal",value:"im Falle von",alternatives:["im Fall von"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"en":return[{id:"event-en-when-source",language:"en",command:"on",priority:115,template:{format:"when {event} from {source} {body}",tokens:[{type:"literal",value:"when"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-when",language:"en",command:"on",priority:105,template:{format:"when {event} {body}",tokens:[{type:"literal",value:"when"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-source",language:"en",command:"on",priority:110,template:{format:"on {event} from {source} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-standard",language:"en",command:"on",priority:100,template:{format:"on {event} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-upon",language:"en",command:"on",priority:98,template:{format:"upon {event} {body}",tokens:[{type:"literal",value:"upon"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-if",language:"en",command:"on",priority:95,template:{format:"if {event} {body}",tokens:[{type:"literal",value:"if"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"es":return[{id:"event-es-native-al-source",language:"es",command:"on",priority:115,template:{format:"al {event} en {source} {body}",tokens:[{type:"literal",value:"al"},{type:"role",role:"event"},{type:"literal",value:"en",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"en",markerAlternatives:["de"]}}},{id:"event-es-cuando-source",language:"es",command:"on",priority:112,template:{format:"cuando {event} en {source} {body}",tokens:[{type:"literal",value:"cuando"},{type:"role",role:"event"},{type:"literal",value:"en",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"en",markerAlternatives:["de"]}}},{id:"event-es-native-al",language:"es",command:"on",priority:108,template:{format:"al {event} {body}",tokens:[{type:"literal",value:"al"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-standard",language:"es",command:"on",priority:100,template:{format:"en {event} {body}",tokens:[{type:"literal",value:"en",alternatives:["al","cuando"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-source",language:"es",command:"on",priority:110,template:{format:"en {event} desde {source} {body}",tokens:[{type:"literal",value:"en",alternatives:["al"]},{type:"role",role:"event"},{type:"literal",value:"desde",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"desde",markerAlternatives:["de"]}}},{id:"event-es-when",language:"es",command:"on",priority:95,template:{format:"cuando {event} {body}",tokens:[{type:"literal",value:"cuando"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-conditional-si",language:"es",command:"on",priority:85,template:{format:"si {event} {body}",tokens:[{type:"literal",value:"si"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"fr":return[{id:"event-fr-quand-source",language:"fr",command:"on",priority:115,template:{format:"quand {event} de {source} {body}",tokens:[{type:"literal",value:"quand",alternatives:["lorsque"]},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["depuis"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["depuis"]}}},{id:"event-fr-quand",language:"fr",command:"on",priority:105,template:{format:"quand {event} {body}",tokens:[{type:"literal",value:"quand",alternatives:["lorsque"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-sur-source",language:"fr",command:"on",priority:110,template:{format:"sur {event} de {source} {body}",tokens:[{type:"literal",value:"sur",alternatives:["lors de"]},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["depuis"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["depuis"]}}},{id:"event-fr-sur",language:"fr",command:"on",priority:100,template:{format:"sur {event} {body}",tokens:[{type:"literal",value:"sur",alternatives:["lors de"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-si",language:"fr",command:"on",priority:95,template:{format:"si {event} {body}",tokens:[{type:"literal",value:"si"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-a",language:"fr",command:"on",priority:90,template:{format:"à {event} {body}",tokens:[{type:"literal",value:"à",alternatives:["au"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"hi":return[{id:"event-hi-standard",language:"hi",command:"on",priority:100,template:{format:"{event} पर",tokens:[{type:"role",role:"event"},{type:"literal",value:"पर",alternatives:["में","जब"]}]},extraction:{event:{position:0}}},{id:"event-hi-with-source",language:"hi",command:"on",priority:95,template:{format:"{source} से {event} पर",tokens:[{type:"role",role:"source"},{type:"literal",value:"से"},{type:"role",role:"event"},{type:"literal",value:"पर",alternatives:["में","जब"]}]},extraction:{source:{position:0},event:{marker:"से",position:2}}},{id:"event-hi-bare",language:"hi",command:"on",priority:80,template:{format:"{event}",tokens:[{type:"role",role:"event"}]},extraction:{event:{position:0}}}];case"id":return[{id:"event-id-ketika-source",language:"id",command:"on",priority:115,template:{format:"ketika {event} dari {source} {body}",tokens:[{type:"literal",value:"ketika",alternatives:["saat","waktu"]},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}},{id:"event-id-ketika",language:"id",command:"on",priority:105,template:{format:"ketika {event} {body}",tokens:[{type:"literal",value:"ketika",alternatives:["saat","waktu"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-pada-source",language:"id",command:"on",priority:110,template:{format:"pada {event} dari {source} {body}",tokens:[{type:"literal",value:"pada"},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}},{id:"event-id-pada",language:"id",command:"on",priority:100,template:{format:"pada {event} {body}",tokens:[{type:"literal",value:"pada"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-jika",language:"id",command:"on",priority:95,template:{format:"jika {event} {body}",tokens:[{type:"literal",value:"jika",alternatives:["kalau","apabila"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-bila",language:"id",command:"on",priority:90,template:{format:"bila {event} {body}",tokens:[{type:"literal",value:"bila"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"it":return[{id:"event-handler-it-full",language:"it",command:"on",priority:100,template:{format:"su {event} {action}",tokens:[{type:"literal",value:"su",alternatives:["quando","al","on"]},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}},{id:"event-handler-it-from",language:"it",command:"on",priority:95,template:{format:"su {event} da {source} {action}",tokens:[{type:"literal",value:"su",alternatives:["quando","al","on"]},{type:"role",role:"event"},{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"source"},{type:"role",role:"action"}]},extraction:{event:{position:1},source:{marker:"da",markerAlternatives:["di"]},action:{position:-1}}}];case"ms":return[{id:"event-ms-apabila",language:"ms",command:"on",priority:100,template:{format:"apabila {event} {body}",tokens:[{type:"literal",value:"apabila",alternatives:["bila","ketika"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-ms-apabila-source",language:"ms",command:"on",priority:110,template:{format:"apabila {event} dari {source} {body}",tokens:[{type:"literal",value:"apabila",alternatives:["bila","ketika"]},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}}];case"pl":return[{id:"event-handler-pl-full",language:"pl",command:"on",priority:100,template:{format:"gdy {event} na {source}",tokens:[{type:"literal",value:"gdy",alternatives:["kiedy","przy","na"]},{type:"role",role:"event"},{type:"group",optional:!0,tokens:[{type:"literal",value:"na",alternatives:["w","przy","z"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"na",markerAlternatives:["w","przy","z"],default:{type:"reference",value:"me"}}}},{id:"event-handler-pl-simple",language:"pl",command:"on",priority:90,template:{format:"gdy {event}",tokens:[{type:"literal",value:"gdy",alternatives:["kiedy","przy","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"pt":return[{id:"event-pt-ao-source",language:"pt",command:"on",priority:115,template:{format:"ao {event} em {source} {body}",tokens:[{type:"literal",value:"ao",alternatives:["à"]},{type:"role",role:"event"},{type:"literal",value:"em",alternatives:["de","no","na"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"em",markerAlternatives:["de","no","na"]}}},{id:"event-pt-quando-source",language:"pt",command:"on",priority:110,template:{format:"quando {event} de {source} {body}",tokens:[{type:"literal",value:"quando"},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["em","no","na"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["em","no","na"]}}},{id:"event-pt-ao",language:"pt",command:"on",priority:105,template:{format:"ao {event} {body}",tokens:[{type:"literal",value:"ao",alternatives:["à"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-quando",language:"pt",command:"on",priority:100,template:{format:"quando {event} {body}",tokens:[{type:"literal",value:"quando"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-em",language:"pt",command:"on",priority:95,template:{format:"em {event} {body}",tokens:[{type:"literal",value:"em",alternatives:["no","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-se",language:"pt",command:"on",priority:90,template:{format:"se {event} {body}",tokens:[{type:"literal",value:"se"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"qu":return[{id:"event-qu-source",language:"qu",command:"on",priority:110,template:{format:"{event} pi {source} manta {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi"},{type:"role",role:"source"},{type:"literal",value:"manta"}]},extraction:{event:{position:0},source:{marker:"manta"}}},{id:"event-qu-kaqtin",language:"qu",command:"on",priority:105,template:{format:"{event} kaqtin {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"kaqtin",alternatives:["qtin","ptin"]}]},extraction:{event:{position:0}}},{id:"event-qu-standard",language:"qu",command:"on",priority:100,template:{format:"{event} pi {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi",alternatives:["kaqpi","kaqpim"]}]},extraction:{event:{position:0}}}];case"ru":return[{id:"event-handler-ru-full",language:"ru",command:"on",priority:100,template:{format:"при {event} на {source}",tokens:[{type:"literal",value:"при",alternatives:["когда"]},{type:"role",role:"event"},{type:"group",optional:!0,tokens:[{type:"literal",value:"на",alternatives:["в","от"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"на",markerAlternatives:["в","от"],default:{type:"reference",value:"me"}}}},{id:"event-handler-ru-simple",language:"ru",command:"on",priority:90,template:{format:"при {event}",tokens:[{type:"literal",value:"при",alternatives:["когда"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"sw":return[{id:"event-sw-unapo-source",language:"sw",command:"on",priority:115,template:{format:"unapo {event} kutoka {source} {body}",tokens:[{type:"literal",value:"unapo",alternatives:["wakati wa","wakati"]},{type:"role",role:"event"},{type:"literal",value:"kutoka"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"kutoka"}}},{id:"event-sw-unapo",language:"sw",command:"on",priority:105,template:{format:"unapo {event} {body}",tokens:[{type:"literal",value:"unapo",alternatives:["wakati wa","wakati"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-kwa-source",language:"sw",command:"on",priority:110,template:{format:"kwa {event} kutoka {source} {body}",tokens:[{type:"literal",value:"kwa"},{type:"role",role:"event"},{type:"literal",value:"kutoka"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"kutoka"}}},{id:"event-sw-kwa",language:"sw",command:"on",priority:100,template:{format:"kwa {event} {body}",tokens:[{type:"literal",value:"kwa"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-ikiwa",language:"sw",command:"on",priority:95,template:{format:"ikiwa {event} {body}",tokens:[{type:"literal",value:"ikiwa",alternatives:["kama"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-baada-ya",language:"sw",command:"on",priority:90,template:{format:"baada ya {event} {body}",tokens:[{type:"literal",value:"baada ya"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"th":return[{id:"event-handler-th-svo",language:"th",command:"on",priority:100,template:{format:"เมื่อ {event} {action}",tokens:[{type:"literal",value:"เมื่อ",alternatives:["ตอน"]},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}},{id:"event-handler-th-with-source",language:"th",command:"on",priority:95,template:{format:"เมื่อ {event} จาก {source} {action}",tokens:[{type:"literal",value:"เมื่อ",alternatives:["ตอน"]},{type:"role",role:"event"},{type:"literal",value:"จาก"},{type:"role",role:"source"},{type:"role",role:"action"}]},extraction:{event:{position:1},source:{marker:"จาก",position:3},action:{position:4}}}];case"uk":return[{id:"event-handler-uk-full",language:"uk",command:"on",priority:100,template:{format:"при {event} на {source}",tokens:[{type:"literal",value:"при",alternatives:["коли"]},{type:"role",role:"event"},{type:"group",optional:!0,tokens:[{type:"literal",value:"на",alternatives:["в","від"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"на",markerAlternatives:["в","від"],default:{type:"reference",value:"me"}}}},{id:"event-handler-uk-simple",language:"uk",command:"on",priority:90,template:{format:"при {event}",tokens:[{type:"literal",value:"при",alternatives:["коли"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"vi":return[{id:"event-handler-vi-full",language:"vi",command:"on",priority:100,template:{format:"khi {event} trên {source}",tokens:[{type:"literal",value:"khi",alternatives:["lúc","trên"]},{type:"role",role:"event"},{type:"group",optional:!0,tokens:[{type:"literal",value:"trên",alternatives:["tại"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"trên",markerAlternatives:["tại"],default:{type:"reference",value:"me"}}}},{id:"event-handler-vi-simple",language:"vi",command:"on",priority:90,template:{format:"khi {event}",tokens:[{type:"literal",value:"khi",alternatives:["lúc","trên"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"zh":return[{id:"event-zh-temporal-source",language:"zh",command:"on",priority:115,template:{format:"{event} 的时候 从 {source} {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"的时候",alternatives:["时候","时"]},{type:"literal",value:"从",alternatives:["在"]},{type:"role",role:"source"}]},extraction:{event:{position:0},source:{marker:"从",markerAlternatives:["在"]}}},{id:"event-zh-source",language:"zh",command:"on",priority:110,template:{format:"当 {event} 从 {source} {body}",tokens:[{type:"literal",value:"当"},{type:"role",role:"event"},{type:"literal",value:"从",alternatives:["在"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"从",markerAlternatives:["在"]}}},{id:"event-zh-immediate",language:"zh",command:"on",priority:108,template:{format:"一 {event} 就 {body}",tokens:[{type:"literal",value:"一"},{type:"role",role:"event"},{type:"literal",value:"就"}]},extraction:{event:{position:1}}},{id:"event-zh-temporal",language:"zh",command:"on",priority:105,template:{format:"{event} 的时候 {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"的时候",alternatives:["时候","时"]}]},extraction:{event:{position:0}}},{id:"event-zh-whenever",language:"zh",command:"on",priority:103,template:{format:"每当 {event} {body}",tokens:[{type:"literal",value:"每当",alternatives:["每次"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-zh-standard",language:"zh",command:"on",priority:100,template:{format:"当 {event} {body}",tokens:[{type:"literal",value:"当"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-zh-completion",language:"zh",command:"on",priority:95,template:{format:"{event} 了 {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"了"}]},extraction:{event:{position:0}}},{id:"event-zh-conditional",language:"zh",command:"on",priority:90,template:{format:"如果 {event} {body}",tokens:[{type:"literal",value:"如果",alternatives:["若","假如"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}}Pl("es-MX",Lp,nv),Bl(),em(),Dp(),Pl("fr",Vp,Np),Bl(),rm(),tm(),Pl("he",Jp,Hp),Bl(),dm(),um(),Pl("hi",cm,Qp),Bl(),Lm(),bm(),Pl("id",wm,mm),Bl(),Um(),Vm(),Pl("it",Wm,Pm),Bl(),yd(),pd(),Pl("ja",ud,Xm),Bl(),Md(),Od(),Pl("ko",Nd,gd),Bl(),Hd(),Vd(),Pl("ms",Wd,Rd),Bl(),th(),Jd(),Pl("pl",Zd,Bd),Bl(),dh(),uh(),Pl("pt",ch,eh),Bl(),Eh(),bh(),Pl("qu",wh,mh),Bl(),Rh(),Nh(),Pl("ru",Ph,xh),Bl(),Uh(),Bh(),Pl("sw",Dh,Ih),Bl(),tf(),Jh(),Pl("th",Zh,Fh),Bl(),pf(),sf(),Pl("tl",of,ef),Bl(),jf(),Cf(),Pl("tr",Tf,vf),Bl(),Vf(),_f(),Pl("uk",qf,Lf),Bl(),Jf(),Yf(),Pl("vi",Gf,Wf),Bl(),cy(),sy(),Pl("zh",oy,Zf),vy(),Xu(),Zu(),cp();var sv=[...[{id:"fetch-en-with-response-type",language:"en",command:"fetch",priority:90,template:{format:"fetch {source} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},responseType:{marker:"as"}}},{id:"fetch-en-simple",language:"en",command:"fetch",priority:80,template:{format:"fetch {source}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source"}]},extraction:{source:{position:1}}}],...[{id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination}",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"}]},extraction:{method:{position:1},destination:{position:2}}}],...[{id:"repeat-en-until-event-from",language:"en",command:"repeat",priority:120,template:{format:"repeat until event {event} from {source}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"from"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{event:{marker:"event"},source:{marker:"from"},loopType:{default:{type:"literal",value:"until-event"}}}},{id:"repeat-en-until-event",language:"en",command:"repeat",priority:110,template:{format:"repeat until event {event}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{marker:"event"},loopType:{default:{type:"literal",value:"until-event"}}}}],...[{id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient}",tokens:[{type:"literal",value:"set"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"to"},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"to"}}}],...[{id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"},loopType:{default:{type:"literal",value:"for"}}}},{id:"if-en-basic",language:"en",command:"if",priority:100,template:{format:"if {condition}",tokens:[{type:"literal",value:"if"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},{id:"unless-en-basic",language:"en",command:"unless",priority:100,template:{format:"unless {condition}",tokens:[{type:"literal",value:"unless"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}}],...[{id:"temporal-en-in",language:"en",command:"wait",priority:95,template:{format:"in {duration}",tokens:[{type:"literal",value:"in"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},{id:"temporal-en-after",language:"en",command:"wait",priority:95,template:{format:"after {duration}",tokens:[{type:"literal",value:"after"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}}]];Yu(),Bl();var lv=[iv,function(e){return[]},av,ov,function(e){switch(e){case"ar":case"ja":case"ko":case"ms":case"tl":case"tr":default:return[];case"bn":return[{id:"add-bn-full",language:"bn",command:"add",priority:100,template:{format:"{patient} কে যোগ করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"যোগ"},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0}}},{id:"add-bn-simple",language:"bn",command:"add",priority:90,template:{format:"যোগ {patient}",tokens:[{type:"literal",value:"যোগ"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"add-bn-with-dest",language:"bn",command:"add",priority:95,template:{format:"{destination} এ {patient} কে যোগ করুন",tokens:[{type:"role",role:"destination"},{type:"literal",value:"এ",alternatives:["তে"]},{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"যোগ"},{type:"literal",value:"করুন"}]},extraction:{destination:{position:0},patient:{position:2}}}];case"hi":return[{id:"add-hi-full",language:"hi",command:"add",priority:100,template:{format:"{patient} को {destination} में जोड़ें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"destination"},{type:"literal",value:"में"},{type:"literal",value:"जोड़ें",alternatives:["जोड़"]}]},extraction:{patient:{position:0},destination:{marker:"में",position:3}}},{id:"add-hi-simple",language:"hi",command:"add",priority:90,template:{format:"{patient} जोड़ें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"जोड़ें",alternatives:["जोड़"]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"add-hi-bare",language:"hi",command:"add",priority:80,template:{format:"जोड़ें {patient}",tokens:[{type:"literal",value:"जोड़ें",alternatives:["जोड़"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"add-it-full",language:"it",command:"add",priority:100,template:{format:"aggiungere {patient} a {target}",tokens:[{type:"literal",value:"aggiungere",alternatives:["aggiungi","add"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"a",alternatives:["su","in"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"a",markerAlternatives:["su","in"],default:{type:"reference",value:"me"}}}},{id:"add-it-simple",language:"it",command:"add",priority:90,template:{format:"aggiungere {patient}",tokens:[{type:"literal",value:"aggiungere",alternatives:["aggiungi","add"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"pl":return[{id:"add-pl-full",language:"pl",command:"add",priority:100,template:{format:"dodaj {patient} do {destination}",tokens:[{type:"literal",value:"dodaj",alternatives:["dołącz","dolacz"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"do",alternatives:["na","w"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"do",markerAlternatives:["na","w"],default:{type:"reference",value:"me"}}}},{id:"add-pl-simple",language:"pl",command:"add",priority:90,template:{format:"dodaj {patient}",tokens:[{type:"literal",value:"dodaj",alternatives:["dołącz","dolacz"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"qu":return[{id:"add-qu-sov",language:"qu",command:"add",priority:100,template:{format:"{patient} ta yapay",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"yapay",alternatives:["yapaykuy"]}]},extraction:{patient:{position:0}}},{id:"add-qu-simple",language:"qu",command:"add",priority:90,template:{format:"yapay {patient}",tokens:[{type:"literal",value:"yapay",alternatives:["yapaykuy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"add-qu-with-dest",language:"qu",command:"add",priority:95,template:{format:"{destination} man {patient} ta yapay",tokens:[{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"yapay",alternatives:["yapaykuy"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"ru":return[{id:"add-ru-full",language:"ru",command:"add",priority:100,template:{format:"добавить {patient} к {destination}",tokens:[{type:"literal",value:"добавить",alternatives:["добавь"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"к",alternatives:["на","в"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"к",markerAlternatives:["на","в"],default:{type:"reference",value:"me"}}}},{id:"add-ru-simple",language:"ru",command:"add",priority:90,template:{format:"добавить {patient}",tokens:[{type:"literal",value:"добавить",alternatives:["добавь"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"th":return[{id:"add-th-simple",language:"th",command:"add",priority:100,template:{format:"เพิ่ม {patient}",tokens:[{type:"literal",value:"เพิ่ม"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"add-th-with-dest",language:"th",command:"add",priority:95,template:{format:"เพิ่ม {patient} ใน {destination}",tokens:[{type:"literal",value:"เพิ่ม"},{type:"role",role:"patient"},{type:"literal",value:"ใน"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"ใน",position:3}}}];case"uk":return[{id:"add-uk-full",language:"uk",command:"add",priority:100,template:{format:"додати {patient} до {destination}",tokens:[{type:"literal",value:"додати",alternatives:["додай"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"до",alternatives:["на","в"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"до",markerAlternatives:["на","в"],default:{type:"reference",value:"me"}}}},{id:"add-uk-simple",language:"uk",command:"add",priority:90,template:{format:"додати {patient}",tokens:[{type:"literal",value:"додати",alternatives:["додай"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"vi":return[{id:"add-vi-full",language:"vi",command:"add",priority:100,template:{format:"thêm {patient} vào {target}",tokens:[{type:"literal",value:"thêm",alternatives:["bổ sung"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"vào",alternatives:["cho"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"vào",markerAlternatives:["cho"],default:{type:"reference",value:"me"}}}},{id:"add-vi-simple",language:"vi",command:"add",priority:90,template:{format:"thêm {patient}",tokens:[{type:"literal",value:"thêm",alternatives:["bổ sung"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"zh":return[{id:"add-zh-full",language:"zh",command:"add",priority:100,template:{format:"给 {destination} 添加 {patient}",tokens:[{type:"literal",value:"给",alternatives:["為","为"]},{type:"role",role:"destination"},{type:"literal",value:"添加",alternatives:["加","增加","加上"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"add-zh-simple",language:"zh",command:"add",priority:90,template:{format:"添加 {patient}",tokens:[{type:"literal",value:"添加",alternatives:["加","增加"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"add-zh-ba",language:"zh",command:"add",priority:95,template:{format:"把 {patient} 添加到 {destination}",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"添加到",alternatives:["加到","增加到"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"添加到",markerAlternatives:["加到","增加到"]}}}]}},function(e){switch(e){case"ar":case"ja":case"ko":case"ms":case"tl":case"tr":default:return[];case"bn":return[{id:"remove-bn-full",language:"bn",command:"remove",priority:100,template:{format:"{patient} কে সরান",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"সরান",alternatives:["মুছুন"]}]},extraction:{patient:{position:0}}},{id:"remove-bn-simple",language:"bn",command:"remove",priority:90,template:{format:"সরান {patient}",tokens:[{type:"literal",value:"সরান",alternatives:["মুছুন"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-bn-with-source",language:"bn",command:"remove",priority:95,template:{format:"{source} থেকে {patient} কে সরান",tokens:[{type:"role",role:"source"},{type:"literal",value:"থেকে"},{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"সরান",alternatives:["মুছুন"]}]},extraction:{source:{position:0},patient:{position:2}}}];case"hi":return[{id:"remove-hi-full",language:"hi",command:"remove",priority:100,template:{format:"{patient} को {source} से हटाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"source"},{type:"literal",value:"से"},{type:"literal",value:"हटाएं",alternatives:["हटा","मिटाएं"]}]},extraction:{patient:{position:0},source:{marker:"से",position:3}}},{id:"remove-hi-simple",language:"hi",command:"remove",priority:90,template:{format:"{patient} हटाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"हटाएं",alternatives:["हटा","मिटाएं"]}]},extraction:{patient:{position:0},source:{default:{type:"reference",value:"me"}}}},{id:"remove-hi-bare",language:"hi",command:"remove",priority:80,template:{format:"हटाएं {patient}",tokens:[{type:"literal",value:"हटाएं",alternatives:["हटा","मिटाएं"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"remove-it-full",language:"it",command:"remove",priority:100,template:{format:"rimuovere {patient} da {target}",tokens:[{type:"literal",value:"rimuovere",alternatives:["rimuovi","eliminare","togliere","remove"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"da",markerAlternatives:["di"],default:{type:"reference",value:"me"}}}},{id:"remove-it-simple",language:"it",command:"remove",priority:90,template:{format:"rimuovere {patient}",tokens:[{type:"literal",value:"rimuovere",alternatives:["rimuovi","eliminare","togliere","remove"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"pl":return[{id:"remove-pl-full",language:"pl",command:"remove",priority:100,template:{format:"usuń {patient} z {source}",tokens:[{type:"literal",value:"usuń",alternatives:["usun","wyczyść","wyczysc"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"z",alternatives:["od","ze"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"z",markerAlternatives:["od","ze"],default:{type:"reference",value:"me"}}}},{id:"remove-pl-simple",language:"pl",command:"remove",priority:90,template:{format:"usuń {patient}",tokens:[{type:"literal",value:"usuń",alternatives:["usun","wyczyść","wyczysc"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"qu":return[{id:"remove-qu-sov",language:"qu",command:"remove",priority:100,template:{format:"{patient} ta qichuy",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]}]},extraction:{patient:{position:0}}},{id:"remove-qu-simple",language:"qu",command:"remove",priority:90,template:{format:"qichuy {patient}",tokens:[{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-qu-with-source",language:"qu",command:"remove",priority:95,template:{format:"{source} manta {patient} ta qichuy",tokens:[{type:"role",role:"source"},{type:"literal",value:"manta"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]}]},extraction:{source:{position:0},patient:{position:2}}}];case"ru":return[{id:"remove-ru-full",language:"ru",command:"remove",priority:100,template:{format:"удалить {patient} из {source}",tokens:[{type:"literal",value:"удалить",alternatives:["удали","убрать","убери"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"из",alternatives:["от","с"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"из",markerAlternatives:["от","с"],default:{type:"reference",value:"me"}}}},{id:"remove-ru-simple",language:"ru",command:"remove",priority:90,template:{format:"удалить {patient}",tokens:[{type:"literal",value:"удалить",alternatives:["удали","убрать","убери"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"th":return[{id:"remove-th-simple",language:"th",command:"remove",priority:100,template:{format:"ลบ {patient}",tokens:[{type:"literal",value:"ลบ",alternatives:["ลบออก"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-th-with-source",language:"th",command:"remove",priority:95,template:{format:"ลบ {patient} จาก {source}",tokens:[{type:"literal",value:"ลบ",alternatives:["ลบออก"]},{type:"role",role:"patient"},{type:"literal",value:"จาก"},{type:"role",role:"source"}]},extraction:{patient:{position:1},source:{marker:"จาก",position:3}}}];case"uk":return[{id:"remove-uk-full",language:"uk",command:"remove",priority:100,template:{format:"видалити {patient} з {source}",tokens:[{type:"literal",value:"видалити",alternatives:["видали","прибрати","прибери"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"з",alternatives:["від","із"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"з",markerAlternatives:["від","із"],default:{type:"reference",value:"me"}}}},{id:"remove-uk-simple",language:"uk",command:"remove",priority:90,template:{format:"видалити {patient}",tokens:[{type:"literal",value:"видалити",alternatives:["видали","прибрати","прибери"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"vi":return[{id:"remove-vi-full",language:"vi",command:"remove",priority:100,template:{format:"xóa {patient} khỏi {target}",tokens:[{type:"literal",value:"xóa",alternatives:["gỡ bỏ","loại bỏ","bỏ"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"khỏi",alternatives:["từ"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"khỏi",markerAlternatives:["từ"],default:{type:"reference",value:"me"}}}},{id:"remove-vi-simple",language:"vi",command:"remove",priority:90,template:{format:"xóa {patient}",tokens:[{type:"literal",value:"xóa",alternatives:["gỡ bỏ","loại bỏ","bỏ"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"zh":return[{id:"remove-zh-full",language:"zh",command:"remove",priority:100,template:{format:"从 {destination} 删除 {patient}",tokens:[{type:"literal",value:"从",alternatives:["從"]},{type:"role",role:"destination"},{type:"literal",value:"删除",alternatives:["刪除","移除","去掉"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"remove-zh-simple",language:"zh",command:"remove",priority:90,template:{format:"删除 {patient}",tokens:[{type:"literal",value:"删除",alternatives:["刪除","移除","去掉"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"remove-zh-ba",language:"zh",command:"remove",priority:95,template:{format:"把 {patient} 从 {destination} 删除",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"从",alternatives:["從"]},{type:"role",role:"destination"},{type:"literal",value:"删除",alternatives:["刪除","移除"]}]},extraction:{patient:{position:1},destination:{position:3}}}]}},function(e){switch(e){case"ar":case"ja":case"ko":case"ms":case"tl":case"tr":default:return[];case"bn":return[{id:"show-bn-full",language:"bn",command:"show",priority:100,template:{format:"{patient} কে দেখান",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"দেখান",alternatives:["দেখাও"]}]},extraction:{patient:{position:0}}},{id:"show-bn-simple",language:"bn",command:"show",priority:90,template:{format:"দেখান {patient}",tokens:[{type:"literal",value:"দেখান",alternatives:["দেখাও"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"de":return[{id:"show-de-full",language:"de",command:"show",priority:100,template:{format:"zeige {patient}",tokens:[{type:"literal",value:"zeige",alternatives:["zeigen","anzeigen","show"]},{type:"role",role:"patient",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1}}}];case"fr":return[{id:"show-fr-full",language:"fr",command:"show",priority:100,template:{format:"afficher {patient}",tokens:[{type:"literal",value:"afficher",alternatives:["montrer","présenter","show"]},{type:"role",role:"patient",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1}}}];case"hi":return[{id:"show-hi-full",language:"hi",command:"show",priority:100,template:{format:"{patient} को दिखाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"दिखाएं",alternatives:["दिखा"]}]},extraction:{patient:{position:0}}},{id:"show-hi-simple",language:"hi",command:"show",priority:90,template:{format:"दिखाएं {patient}",tokens:[{type:"literal",value:"दिखाएं",alternatives:["दिखा"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"show-hi-bare",language:"hi",command:"show",priority:80,template:{format:"दिखाएं",tokens:[{type:"literal",value:"दिखाएं",alternatives:["दिखा"]}]},extraction:{patient:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"show-it-full",language:"it",command:"show",priority:100,template:{format:"mostrare {patient} con {style}",tokens:[{type:"literal",value:"mostrare",alternatives:["mostra","visualizzare","show"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"con"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"con"}}},{id:"show-it-simple",language:"it",command:"show",priority:90,template:{format:"mostrare {patient}",tokens:[{type:"literal",value:"mostrare",alternatives:["mostra","visualizzare","show"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"show-pl-full",language:"pl",command:"show",priority:100,template:{format:"pokaż {patient} z {style}",tokens:[{type:"literal",value:"pokaż",alternatives:["pokaz","wyświetl","wyswietl"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"z",alternatives:["ze","jako"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"z",markerAlternatives:["ze","jako"]}}},{id:"show-pl-simple",language:"pl",command:"show",priority:90,template:{format:"pokaż {patient}",tokens:[{type:"literal",value:"pokaż",alternatives:["pokaz","wyświetl","wyswietl"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"ru":return[{id:"show-ru-full",language:"ru",command:"show",priority:100,template:{format:"показать {patient} с {style}",tokens:[{type:"literal",value:"показать",alternatives:["покажи"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"с",alternatives:["со","как"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"с",markerAlternatives:["со","как"]}}},{id:"show-ru-simple",language:"ru",command:"show",priority:90,template:{format:"показать {patient}",tokens:[{type:"literal",value:"показать",alternatives:["покажи"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"th":return[{id:"show-th-simple",language:"th",command:"show",priority:100,template:{format:"แสดง {patient}",tokens:[{type:"literal",value:"แสดง"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"uk":return[{id:"show-uk-full",language:"uk",command:"show",priority:100,template:{format:"показати {patient} з {style}",tokens:[{type:"literal",value:"показати",alternatives:["покажи"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"з",alternatives:["із","як"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"з",markerAlternatives:["із","як"]}}},{id:"show-uk-simple",language:"uk",command:"show",priority:90,template:{format:"показати {patient}",tokens:[{type:"literal",value:"показати",alternatives:["покажи"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"vi":return[{id:"show-vi-full",language:"vi",command:"show",priority:100,template:{format:"hiển thị {patient} với {effect}",tokens:[{type:"literal",value:"hiển thị",alternatives:["hiện"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"với"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"với"}}},{id:"show-vi-simple",language:"vi",command:"show",priority:90,template:{format:"hiển thị {patient}",tokens:[{type:"literal",value:"hiển thị",alternatives:["hiện"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"zh":return[{id:"show-zh-full",language:"zh",command:"show",priority:100,template:{format:"显示 {patient}",tokens:[{type:"literal",value:"显示",alternatives:["顯示","展示","呈现","呈現"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"show-zh-ba",language:"zh",command:"show",priority:95,template:{format:"把 {patient} 显示",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"显示",alternatives:["顯示","展示"]}]},extraction:{patient:{position:1}}},{id:"show-zh-with-给",language:"zh",command:"show",priority:90,template:{format:"给 {destination} 显示 {patient}",tokens:[{type:"literal",value:"给",alternatives:["給"]},{type:"role",role:"destination"},{type:"literal",value:"显示",alternatives:["顯示"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}}]}},function(e){switch(e){case"ar":case"ja":case"ko":case"ms":case"tl":case"tr":default:return[];case"bn":return[{id:"hide-bn-full",language:"bn",command:"hide",priority:100,template:{format:"{patient} কে লুকান",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"লুকান",alternatives:["লুকাও"]}]},extraction:{patient:{position:0}}},{id:"hide-bn-simple",language:"bn",command:"hide",priority:90,template:{format:"লুকান {patient}",tokens:[{type:"literal",value:"লুকান",alternatives:["লুকাও"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"de":return[{id:"hide-de-full",language:"de",command:"hide",priority:100,template:{format:"verstecke {patient}",tokens:[{type:"literal",value:"verstecke",alternatives:["verstecken","verberge","verbergen","hide"]},{type:"role",role:"patient",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1}}}];case"hi":return[{id:"hide-hi-full",language:"hi",command:"hide",priority:100,template:{format:"{patient} को छिपाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"छिपाएं",alternatives:["छिपा"]}]},extraction:{patient:{position:0}}},{id:"hide-hi-simple",language:"hi",command:"hide",priority:90,template:{format:"छिपाएं {patient}",tokens:[{type:"literal",value:"छिपाएं",alternatives:["छिपा"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"hide-hi-bare",language:"hi",command:"hide",priority:80,template:{format:"छिपाएं",tokens:[{type:"literal",value:"छिपाएं",alternatives:["छिपा"]}]},extraction:{patient:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"hide-it-full",language:"it",command:"hide",priority:100,template:{format:"nascondere {patient} con {style}",tokens:[{type:"literal",value:"nascondere",alternatives:["nascondi","hide"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"con"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"con"}}},{id:"hide-it-simple",language:"it",command:"hide",priority:90,template:{format:"nascondere {patient}",tokens:[{type:"literal",value:"nascondere",alternatives:["nascondi","hide"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"hide-pl-full",language:"pl",command:"hide",priority:100,template:{format:"ukryj {patient} z {style}",tokens:[{type:"literal",value:"ukryj",alternatives:["schowaj","zasłoń","zaslon"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"z",alternatives:["ze","jako"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"z",markerAlternatives:["ze","jako"]}}},{id:"hide-pl-simple",language:"pl",command:"hide",priority:90,template:{format:"ukryj {patient}",tokens:[{type:"literal",value:"ukryj",alternatives:["schowaj","zasłoń","zaslon"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"ru":return[{id:"hide-ru-full",language:"ru",command:"hide",priority:100,template:{format:"скрыть {patient} с {style}",tokens:[{type:"literal",value:"скрыть",alternatives:["скрой","спрятать","спрячь"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"с",alternatives:["со","как"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"с",markerAlternatives:["со","как"]}}},{id:"hide-ru-simple",language:"ru",command:"hide",priority:90,template:{format:"скрыть {patient}",tokens:[{type:"literal",value:"скрыть",alternatives:["скрой","спрятать","спрячь"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"th":return[{id:"hide-th-simple",language:"th",command:"hide",priority:100,template:{format:"ซ่อน {patient}",tokens:[{type:"literal",value:"ซ่อน"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"uk":return[{id:"hide-uk-full",language:"uk",command:"hide",priority:100,template:{format:"сховати {patient} з {style}",tokens:[{type:"literal",value:"сховати",alternatives:["сховай","приховати","приховай"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"з",alternatives:["із","як"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"з",markerAlternatives:["із","як"]}}},{id:"hide-uk-simple",language:"uk",command:"hide",priority:90,template:{format:"сховати {patient}",tokens:[{type:"literal",value:"сховати",alternatives:["сховай","приховати","приховай"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"vi":return[{id:"hide-vi-full",language:"vi",command:"hide",priority:100,template:{format:"ẩn {patient} với {effect}",tokens:[{type:"literal",value:"ẩn",alternatives:["che","giấu"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"với"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"với"}}},{id:"hide-vi-simple",language:"vi",command:"hide",priority:90,template:{format:"ẩn {patient}",tokens:[{type:"literal",value:"ẩn",alternatives:["che","giấu"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"zh":return[{id:"hide-zh-full",language:"zh",command:"hide",priority:100,template:{format:"隐藏 {patient}",tokens:[{type:"literal",value:"隐藏",alternatives:["隱藏","藏起","藏"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"hide-zh-ba",language:"zh",command:"hide",priority:95,template:{format:"把 {patient} 隐藏",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"隐藏",alternatives:["隱藏","藏起"]}]},extraction:{patient:{position:1}}},{id:"hide-zh-from",language:"zh",command:"hide",priority:90,template:{format:"从 {destination} 隐藏 {patient}",tokens:[{type:"literal",value:"从",alternatives:["從"]},{type:"role",role:"destination"},{type:"literal",value:"隐藏",alternatives:["隱藏"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}}]}},function(e){switch(e){case"ar":case"ja":case"ko":case"ms":case"tl":case"tr":default:return[];case"bn":return[{id:"set-bn-full",language:"bn",command:"set",priority:100,template:{format:"{patient} কে {goal} এ সেট করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"role",role:"goal"},{type:"literal",value:"এ",alternatives:["তে"]},{type:"literal",value:"সেট",alternatives:["নির্ধারণ"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0},goal:{marker:"এ",position:2}}},{id:"set-bn-simple",language:"bn",command:"set",priority:90,template:{format:"সেট {patient} {goal}",tokens:[{type:"literal",value:"সেট",alternatives:["নির্ধারণ"]},{type:"role",role:"patient"},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{position:2}}}];case"de":return[{id:"set-de-full",language:"de",command:"set",priority:100,template:{format:"setze {destination} auf {patient}",tokens:[{type:"literal",value:"setze",alternatives:["setzen","stelle","stellen","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"auf",alternatives:["zu","an"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-de-festlegen-auf",language:"de",command:"set",priority:99,template:{format:"festlegen auf {destination} {patient}",tokens:[{type:"literal",value:"festlegen",alternatives:["einstellen","setzen"]},{type:"literal",value:"auf",alternatives:["an"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-de-equals",language:"de",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"es":return[{id:"set-es-full",language:"es",command:"set",priority:100,template:{format:"establecer {destination} a {patient}",tokens:[{type:"literal",value:"establecer",alternatives:["fijar","definir","poner","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"a",alternatives:["en","como"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-es-prep-first",language:"es",command:"set",priority:95,template:{format:"establecer en {destination} {patient}",tokens:[{type:"literal",value:"establecer",alternatives:["fijar","definir","poner","set"]},{type:"literal",value:"en",alternatives:["a"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-es-equals",language:"es",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"fr":return[{id:"set-fr-full",language:"fr",command:"set",priority:100,template:{format:"définir {destination} à {patient}",tokens:[{type:"literal",value:"définir",alternatives:["definir","mettre","fixer","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"à",alternatives:["a","sur","comme"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-fr-sur-direct",language:"fr",command:"set",priority:98,template:{format:"définir sur {destination} {patient}",tokens:[{type:"literal",value:"définir",alternatives:["definir","mettre","fixer"]},{type:"literal",value:"sur",alternatives:["à","en"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-fr-equals",language:"fr",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"hi":return[{id:"set-hi-full",language:"hi",command:"set",priority:100,template:{format:"{destination} को {patient} सेट करें",tokens:[{type:"role",role:"destination"},{type:"literal",value:"को"},{type:"role",role:"patient"},{type:"literal",value:"सेट",alternatives:["निर्धारित"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"करें",alternatives:["करो"]}]}]},extraction:{destination:{position:0},patient:{marker:"को",position:2}}},{id:"set-hi-simple",language:"hi",command:"set",priority:90,template:{format:"सेट {destination} {patient}",tokens:[{type:"literal",value:"सेट",alternatives:["निर्धारित"]},{type:"role",role:"destination"},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:2}}}];case"id":return[{id:"set-id-full",language:"id",command:"set",priority:100,template:{format:"atur {destination} ke {patient}",tokens:[{type:"literal",value:"atur",alternatives:["tetapkan","setel","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["menjadi","jadi","pada"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-id-pada-direct",language:"id",command:"set",priority:98,template:{format:"atur pada {destination} {patient}",tokens:[{type:"literal",value:"atur",alternatives:["tetapkan","setel"]},{type:"literal",value:"pada",alternatives:["ke","di"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-id-equals",language:"id",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"it":return[{id:"set-it-full",language:"it",command:"set",priority:100,template:{format:"impostare {patient} a {goal}",tokens:[{type:"literal",value:"impostare",alternatives:["imposta","set","definire"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"a",alternatives:["su","come"]},{type:"role",role:"goal"}]}]},extraction:{patient:{position:1},goal:{marker:"a",markerAlternatives:["su","come"]}}},{id:"set-it-simple",language:"it",command:"set",priority:90,template:{format:"impostare {patient}",tokens:[{type:"literal",value:"impostare",alternatives:["imposta","set"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"set-pl-full",language:"pl",command:"set",priority:100,template:{format:"ustaw {patient} na {goal}",tokens:[{type:"literal",value:"ustaw",alternatives:["określ","okresl","przypisz"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"na",alternatives:["do","jako"]},{type:"role",role:"goal"}]}]},extraction:{patient:{position:1},goal:{marker:"na",markerAlternatives:["do","jako"]}}},{id:"set-pl-simple",language:"pl",command:"set",priority:90,template:{format:"ustaw {patient}",tokens:[{type:"literal",value:"ustaw",alternatives:["określ","okresl"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pt":return[{id:"set-pt-full",language:"pt",command:"set",priority:100,template:{format:"definir {destination} para {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer","colocar","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"para",alternatives:["como","a","em"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-pt-em-direct",language:"pt",command:"set",priority:98,template:{format:"definir em {destination} {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer","colocar"]},{type:"literal",value:"em",alternatives:["para","a"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-pt-equals",language:"pt",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"ru":return[{id:"set-ru-full",language:"ru",command:"set",priority:100,template:{format:"установить {patient} в {goal}",tokens:[{type:"literal",value:"установить",alternatives:["установи","задать","задай"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"в",alternatives:["на","как"]},{type:"role",role:"goal"}]}]},extraction:{patient:{position:1},goal:{marker:"в",markerAlternatives:["на","как"]}}},{id:"set-ru-simple",language:"ru",command:"set",priority:90,template:{format:"установить {patient}",tokens:[{type:"literal",value:"установить",alternatives:["установи","задать","задай"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"th":return[{id:"set-th-simple",language:"th",command:"set",priority:100,template:{format:"ตั้ง {patient} {goal}",tokens:[{type:"literal",value:"ตั้ง",alternatives:["กำหนด"]},{type:"role",role:"patient"},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{position:2}}}];case"uk":return[{id:"set-uk-full",language:"uk",command:"set",priority:100,template:{format:"встановити {patient} в {goal}",tokens:[{type:"literal",value:"встановити",alternatives:["встанови","задати","задай"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"в",alternatives:["на","як"]},{type:"role",role:"goal"}]}]},extraction:{patient:{position:1},goal:{marker:"в",markerAlternatives:["на","як"]}}},{id:"set-uk-simple",language:"uk",command:"set",priority:90,template:{format:"встановити {patient}",tokens:[{type:"literal",value:"встановити",alternatives:["встанови","задати","задай"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"vi":return[{id:"set-vi-full",language:"vi",command:"set",priority:100,template:{format:"gán {target} thành {value}",tokens:[{type:"literal",value:"gán",alternatives:["thiết lập","đặt giá trị"]},{type:"role",role:"patient"},{type:"literal",value:"thành",alternatives:["bằng","là"]},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{marker:"thành",markerAlternatives:["bằng","là"]}}},{id:"set-vi-simple",language:"vi",command:"set",priority:90,template:{format:"đặt {target} là {value}",tokens:[{type:"literal",value:"đặt"},{type:"role",role:"patient"},{type:"literal",value:"là"},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{marker:"là"}}}];case"zh":return[{id:"set-zh-full",language:"zh",command:"set",priority:100,template:{format:"设置 {destination} 为 {patient}",tokens:[{type:"literal",value:"设置",alternatives:["設置","设定","設定"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"为",alternatives:["為","到","成"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"为",markerAlternatives:["為","到","成"]}}},{id:"set-zh-ba",language:"zh",command:"set",priority:95,template:{format:"把 {destination} 设置为 {patient}",tokens:[{type:"literal",value:"把"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"设置为",alternatives:["設置為","设定为","設定為"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"设置为",markerAlternatives:["設置為","设定为","設定為"]}}},{id:"set-zh-simple",language:"zh",command:"set",priority:90,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}]}},function(e){switch(e){case"ar":case"ja":case"ko":case"ms":case"tl":default:return[];case"bn":return[{id:"get-bn-full",language:"bn",command:"get",priority:100,template:{format:"{source} থেকে পান",tokens:[{type:"role",role:"source"},{type:"literal",value:"থেকে"},{type:"literal",value:"পান",alternatives:["নিন"]}]},extraction:{source:{position:0}}},{id:"get-bn-simple",language:"bn",command:"get",priority:90,template:{format:"পান {source}",tokens:[{type:"literal",value:"পান",alternatives:["নিন"]},{type:"role",role:"source"}]},extraction:{source:{position:1}}}];case"de":return[{id:"get-de-full",language:"de",command:"get",priority:100,template:{format:"hole {source}",tokens:[{type:"literal",value:"hole",alternatives:["holen","get","bekomme","bekommen"]},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{source:{position:1}}}];case"hi":return[{id:"get-hi-full",language:"hi",command:"get",priority:100,template:{format:"{source} से प्राप्त करें",tokens:[{type:"role",role:"source"},{type:"literal",value:"से"},{type:"literal",value:"प्राप्त",alternatives:["पाएं"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"करें",alternatives:["करो"]}]}]},extraction:{source:{position:0}}},{id:"get-hi-simple",language:"hi",command:"get",priority:90,template:{format:"प्राप्त {source}",tokens:[{type:"literal",value:"प्राप्त",alternatives:["पाएं"]},{type:"role",role:"source"}]},extraction:{source:{position:1}}}];case"it":return[{id:"get-it-full",language:"it",command:"get",priority:100,template:{format:"ottenere {patient} da {source}",tokens:[{type:"literal",value:"ottenere",alternatives:["ottieni","get","prendere"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"da",markerAlternatives:["di"]}}},{id:"get-it-simple",language:"it",command:"get",priority:90,template:{format:"ottenere {patient}",tokens:[{type:"literal",value:"ottenere",alternatives:["ottieni","get"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"get-pl-full",language:"pl",command:"get",priority:100,template:{format:"pobierz {patient} z {source}",tokens:[{type:"literal",value:"pobierz",alternatives:["weź","wez","uzyskaj"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"z",alternatives:["od","ze"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"z",markerAlternatives:["od","ze"]}}},{id:"get-pl-simple",language:"pl",command:"get",priority:90,template:{format:"pobierz {patient}",tokens:[{type:"literal",value:"pobierz",alternatives:["weź","wez","uzyskaj"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"ru":return[{id:"get-ru-full",language:"ru",command:"get",priority:100,template:{format:"получить {patient} из {source}",tokens:[{type:"literal",value:"получить",alternatives:["получи","взять","возьми"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"из",alternatives:["от","с"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"из",markerAlternatives:["от","с"]}}},{id:"get-ru-simple",language:"ru",command:"get",priority:90,template:{format:"получить {patient}",tokens:[{type:"literal",value:"получить",alternatives:["получи","взять","возьми"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"th":return[{id:"get-th-simple",language:"th",command:"get",priority:100,template:{format:"รับค่า {source}",tokens:[{type:"literal",value:"รับค่า"},{type:"role",role:"source"}]},extraction:{source:{position:1}}}];case"uk":return[{id:"get-uk-full",language:"uk",command:"get",priority:100,template:{format:"отримати {patient} з {source}",tokens:[{type:"literal",value:"отримати",alternatives:["отримай","взяти","візьми"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"з",alternatives:["від","із"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"з",markerAlternatives:["від","із"]}}},{id:"get-uk-simple",language:"uk",command:"get",priority:90,template:{format:"отримати {patient}",tokens:[{type:"literal",value:"отримати",alternatives:["отримай","взяти","візьми"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"vi":return[{id:"get-vi-full",language:"vi",command:"get",priority:100,template:{format:"lấy giá trị của {target}",tokens:[{type:"literal",value:"lấy giá trị",alternatives:["nhận","lấy"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"của"}]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"get-vi-simple",language:"vi",command:"get",priority:90,template:{format:"lấy {target}",tokens:[{type:"literal",value:"lấy",alternatives:["nhận","lấy giá trị"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}},function(e){switch(e){case"bn":return[{id:"increment-bn-full",language:"bn",command:"increment",priority:100,template:{format:"{patient} কে বৃদ্ধি করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"বৃদ্ধি",alternatives:["বাড়ান"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0}}},{id:"increment-bn-with-quantity",language:"bn",command:"increment",priority:95,template:{format:"{patient} কে {quantity} দিয়ে বৃদ্ধি করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"role",role:"quantity"},{type:"literal",value:"দিয়ে"},{type:"literal",value:"বৃদ্ধি",alternatives:["বাড়ান"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0},quantity:{marker:"দিয়ে",position:2}}},{id:"increment-bn-simple",language:"bn",command:"increment",priority:90,template:{format:"বৃদ্ধি {patient}",tokens:[{type:"literal",value:"বৃদ্ধি",alternatives:["বাড়ান"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"de":return[{id:"increment-de-full",language:"de",command:"increment",priority:100,template:{format:"erhöhe {patient}",tokens:[{type:"literal",value:"erhöhe",alternatives:["erhoehe","erhöhen","inkrementiere","inkrementieren","increment"]},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]}]},extraction:{patient:{position:1}}}];case"hi":return[{id:"increment-hi-full",language:"hi",command:"increment",priority:100,template:{format:"{patient} को बढ़ाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"बढ़ाएं",alternatives:["बढ़ा"]}]},extraction:{patient:{position:0}}},{id:"increment-hi-with-quantity",language:"hi",command:"increment",priority:95,template:{format:"{patient} को {quantity} से बढ़ाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"quantity"},{type:"literal",value:"से"},{type:"literal",value:"बढ़ाएं",alternatives:["बढ़ा"]}]},extraction:{patient:{position:0},quantity:{marker:"से",position:2}}},{id:"increment-hi-simple",language:"hi",command:"increment",priority:90,template:{format:"बढ़ाएं {patient}",tokens:[{type:"literal",value:"बढ़ाएं",alternatives:["बढ़ा"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"it":return[{id:"increment-it-full",language:"it",command:"increment",priority:100,template:{format:"incrementare {patient} di {quantity}",tokens:[{type:"literal",value:"incrementare",alternatives:["incrementa","aumentare","increment"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"di",alternatives:["per"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"di",markerAlternatives:["per"],default:{type:"literal",value:"1"}}}},{id:"increment-it-simple",language:"it",command:"increment",priority:90,template:{format:"incrementare {patient}",tokens:[{type:"literal",value:"incrementare",alternatives:["incrementa","aumentare","increment"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}];case"ms":case"tl":case"tr":default:return[];case"pl":return[{id:"increment-pl-full",language:"pl",command:"increment",priority:100,template:{format:"zwiększ {patient} o {quantity}",tokens:[{type:"literal",value:"zwiększ",alternatives:["zwieksz","podnieś","podnies"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"o"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"o",default:{type:"literal",value:1}}}},{id:"increment-pl-simple",language:"pl",command:"increment",priority:90,template:{format:"zwiększ {patient}",tokens:[{type:"literal",value:"zwiększ",alternatives:["zwieksz","podnieś","podnies"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"ru":return[{id:"increment-ru-full",language:"ru",command:"increment",priority:100,template:{format:"увеличить {patient} на {quantity}",tokens:[{type:"literal",value:"увеличить",alternatives:["увеличь"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"на"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"на",default:{type:"literal",value:1}}}},{id:"increment-ru-simple",language:"ru",command:"increment",priority:90,template:{format:"увеличить {patient}",tokens:[{type:"literal",value:"увеличить",alternatives:["увеличь"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"th":return[{id:"increment-th-simple",language:"th",command:"increment",priority:100,template:{format:"เพิ่มค่า {patient}",tokens:[{type:"literal",value:"เพิ่มค่า"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"increment-th-with-quantity",language:"th",command:"increment",priority:95,template:{format:"เพิ่มค่า {patient} ด้วย {quantity}",tokens:[{type:"literal",value:"เพิ่มค่า"},{type:"role",role:"patient"},{type:"literal",value:"ด้วย"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"ด้วย",position:3}}}];case"uk":return[{id:"increment-uk-full",language:"uk",command:"increment",priority:100,template:{format:"збільшити {patient} на {quantity}",tokens:[{type:"literal",value:"збільшити",alternatives:["збільш"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"на"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"на",default:{type:"literal",value:1}}}},{id:"increment-uk-simple",language:"uk",command:"increment",priority:90,template:{format:"збільшити {patient}",tokens:[{type:"literal",value:"збільшити",alternatives:["збільш"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"vi":return[{id:"increment-vi-full",language:"vi",command:"increment",priority:100,template:{format:"tăng {target} thêm {amount}",tokens:[{type:"literal",value:"tăng",alternatives:["tăng lên"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"thêm",alternatives:["lên"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"thêm",markerAlternatives:["lên"],default:{type:"literal",value:"1"}}}},{id:"increment-vi-simple",language:"vi",command:"increment",priority:90,template:{format:"tăng {target}",tokens:[{type:"literal",value:"tăng",alternatives:["tăng lên"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}];case"zh":return[{id:"increment-zh-full",language:"zh",command:"increment",priority:100,template:{format:"增加 {patient}",tokens:[{type:"literal",value:"增加",alternatives:["递增","加","增","increment"]},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]}]},extraction:{patient:{position:1}}}]}},function(e){switch(e){case"bn":return[{id:"decrement-bn-full",language:"bn",command:"decrement",priority:100,template:{format:"{patient} কে হ্রাস করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"হ্রাস",alternatives:["কমান"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0}}},{id:"decrement-bn-with-quantity",language:"bn",command:"decrement",priority:95,template:{format:"{patient} কে {quantity} দিয়ে হ্রাস করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"role",role:"quantity"},{type:"literal",value:"দিয়ে"},{type:"literal",value:"হ্রাস",alternatives:["কমান"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0},quantity:{marker:"দিয়ে",position:2}}},{id:"decrement-bn-simple",language:"bn",command:"decrement",priority:90,template:{format:"হ্রাস {patient}",tokens:[{type:"literal",value:"হ্রাস",alternatives:["কমান"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"de":return[{id:"decrement-de-full",language:"de",command:"decrement",priority:100,template:{format:"verringere {patient}",tokens:[{type:"literal",value:"verringere",alternatives:["verringern","dekrementiere","dekrementieren","reduziere","decrement"]},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]}]},extraction:{patient:{position:1}}}];case"hi":return[{id:"decrement-hi-full",language:"hi",command:"decrement",priority:100,template:{format:"{patient} को घटाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"घटाएं",alternatives:["घटा"]}]},extraction:{patient:{position:0}}},{id:"decrement-hi-with-quantity",language:"hi",command:"decrement",priority:95,template:{format:"{patient} को {quantity} से घटाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"quantity"},{type:"literal",value:"से"},{type:"literal",value:"घटाएं",alternatives:["घटा"]}]},extraction:{patient:{position:0},quantity:{marker:"से",position:2}}},{id:"decrement-hi-simple",language:"hi",command:"decrement",priority:90,template:{format:"घटाएं {patient}",tokens:[{type:"literal",value:"घटाएं",alternatives:["घटा"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"it":return[{id:"decrement-it-full",language:"it",command:"decrement",priority:100,template:{format:"decrementare {patient} di {quantity}",tokens:[{type:"literal",value:"decrementare",alternatives:["decrementa","diminuire","decrement"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"di",alternatives:["per"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"di",markerAlternatives:["per"],default:{type:"literal",value:"1"}}}},{id:"decrement-it-simple",language:"it",command:"decrement",priority:90,template:{format:"decrementare {patient}",tokens:[{type:"literal",value:"decrementare",alternatives:["decrementa","diminuire","decrement"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}];case"ms":case"tl":case"tr":default:return[];case"pl":return[{id:"decrement-pl-full",language:"pl",command:"decrement",priority:100,template:{format:"zmniejsz {patient} o {quantity}",tokens:[{type:"literal",value:"zmniejsz",alternatives:["obniż","obniz"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"o"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"o",default:{type:"literal",value:1}}}},{id:"decrement-pl-simple",language:"pl",command:"decrement",priority:90,template:{format:"zmniejsz {patient}",tokens:[{type:"literal",value:"zmniejsz",alternatives:["obniż","obniz"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"ru":return[{id:"decrement-ru-full",language:"ru",command:"decrement",priority:100,template:{format:"уменьшить {patient} на {quantity}",tokens:[{type:"literal",value:"уменьшить",alternatives:["уменьши"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"на"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"на",default:{type:"literal",value:1}}}},{id:"decrement-ru-simple",language:"ru",command:"decrement",priority:90,template:{format:"уменьшить {patient}",tokens:[{type:"literal",value:"уменьшить",alternatives:["уменьши"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"th":return[{id:"decrement-th-simple",language:"th",command:"decrement",priority:100,template:{format:"ลดค่า {patient}",tokens:[{type:"literal",value:"ลดค่า"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"decrement-th-with-quantity",language:"th",command:"decrement",priority:95,template:{format:"ลดค่า {patient} ด้วย {quantity}",tokens:[{type:"literal",value:"ลดค่า"},{type:"role",role:"patient"},{type:"literal",value:"ด้วย"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"ด้วย",position:3}}}];case"uk":return[{id:"decrement-uk-full",language:"uk",command:"decrement",priority:100,template:{format:"зменшити {patient} на {quantity}",tokens:[{type:"literal",value:"зменшити",alternatives:["зменш"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"на"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"на",default:{type:"literal",value:1}}}},{id:"decrement-uk-simple",language:"uk",command:"decrement",priority:90,template:{format:"зменшити {patient}",tokens:[{type:"literal",value:"зменшити",alternatives:["зменш"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"vi":return[{id:"decrement-vi-full",language:"vi",command:"decrement",priority:100,template:{format:"giảm {target} đi {amount}",tokens:[{type:"literal",value:"giảm",alternatives:["giảm đi"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"đi",alternatives:["xuống"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"đi",markerAlternatives:["xuống"],default:{type:"literal",value:"1"}}}},{id:"decrement-vi-simple",language:"vi",command:"decrement",priority:90,template:{format:"giảm {target}",tokens:[{type:"literal",value:"giảm",alternatives:["giảm đi"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}];case"zh":return[{id:"decrement-zh-full",language:"zh",command:"decrement",priority:100,template:{format:"减少 {patient}",tokens:[{type:"literal",value:"减少",alternatives:["递减","减","降低","decrement"]},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]}]},extraction:{patient:{position:1}}}]}},function(e){return[]}],cv=new Map;function uv(e){const t=lv.flatMap(t=>t(e));return"en"===e&&t.push(...sv),t.push(...function(e){const t=cv.get(e);if(t)return t;const r=Rl(e);if(!r)return[];const n=Bu(r);return cv.set(e,n),n}(e)),t}var pv=["en","ja","ar","es","ko","zh","tr","pt","fr","de","id","qu","sw","it","vi","pl","ru","uk","hi","bn","th","ms","tl","he"];function mv(){const e=[];for(const t of pv)e.push(...uv(t));return e}var dv=new Map,hv=null;function fv(){return null===hv&&(hv=mv()),hv}var yv=new Proxy([],{get(e,t){const r=fv(),n=Reflect.get(r,t);return"function"==typeof n?n.bind(r):n},ownKeys:()=>Reflect.ownKeys(fv()),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(fv(),t)});function vv(e){if(dv.has(e))return dv.get(e);const t=uv(e);return dv.set(e,t),t}var gv={ko:{"클릭":"click","입력":"input","변경":"change","제출":"submit","키다운":"keydown","키업":"keyup","마우스오버":"mouseover","마우스아웃":"mouseout","포커스":"focus","블러":"blur","로드":"load","스크롤":"scroll"},ja:{"クリック":"click","入力":"input","変更":"change","送信":"submit","キーダウン":"keydown","キーアップ":"keyup","キープレス":"keypress","マウスオーバー":"mouseover","マウスアウト":"mouseout","フォーカス":"focus","ブラー":"blur","ロード":"load","スクロール":"scroll"},ar:{"النقر":"click","نقر":"click","الإدخال":"input","إدخال":"input","التغيير":"change","تغيير":"change","الإرسال":"submit","إرسال":"submit","ضغط المفتاح":"keydown","رفع المفتاح":"keyup","تمرير الماوس":"mouseover","التركيز":"focus","تحميل":"load","تمرير":"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change","envío":"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","ratón encima":"mouseover","ratón fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{"tıklama":"click","tıkla":"click","tık":"click","giriş":"input",girdi:"input","değişiklik":"change","değişim":"change","gönderme":"submit","gönder":"submit","tuşbasma":"keydown","tuşbırakma":"keyup","fareiçinde":"mouseover","faredışında":"mouseout",odaklanma:"focus",odak:"focus","bulanıklık":"blur","yükleme":"load","kaydırma":"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input","mudança":"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:{"点击":"click","单击":"click","双击":"dblclick","输入":"input","改变":"change","变化":"change","变更":"change","提交":"submit","发送":"submit","按键":"keydown","键入":"keydown","松键":"keyup","鼠标进入":"mouseover","鼠标移入":"mouseover","鼠标离开":"mouseout","鼠标移出":"mouseout","焦点":"focus","聚焦":"focus","失焦":"blur","模糊":"blur","加载":"load","载入":"load","滚动":"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input","entrée":"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éfocus":"blur","défocaliser":"blur",chargement:"load",charger:"load","défilement":"scroll","défiler":"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input","änderung":"change","ändern":"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus über":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur","unschärfe":"blur",laden:"load",ladung:"load",scrollen:"scroll","blättern":"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"},qu:{click:"click","ñit'iy":"click",yaykuy:"input",tikray:"change","t'ikray":"change",apachiy:"submit",kachay:"submit","llave uray":"keydown","llave hawa":"keyup","q'away":"focus","mana q'away":"blur",cargay:"load",apamuy:"load",muyuy:"scroll"},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"}};function kv(e,t){if(qy(e))return e;return Ny(Dy(e,t))}function wv(e,t){return Py(Iy(e),t)}function bv(e,t,r){if(qy(e))return wv(e,r);return Py(Dy(e,t),r)}function zv(e,t){return qy(e)?Iy(e):Dy(e,t)}function xv(e,t){if(e.type!==t.type)return!1;switch(e.type){case"literal":case"selector":case"reference":return e.value===t.value;case"property-path":return xv(e.object,t.object)&&e.property===t.property;case"expression":return e.raw===t.raw;default:return!1}}Bl(),kl=function(e){return uv(e.code)},by(),jy(),rv(),Wy(),Oy(),Oy(),Wy(),Bl(),jy(),by(),Bl();var Ev=class{constructor(e={}){this.cache=new Map,this.config={maxSize:e.maxSize??1e3,ttlMs:e.ttlMs??0,enabled:e.enabled??!0},this.stats={hits:0,misses:0,evictions:0,expirations:0}}makeKey(e,t){return`${t}:${e}`}isExpired(e){return 0!==this.config.ttlMs&&Date.now()-e.createdAt>this.config.ttlMs}evictLRU(){const e=this.cache.keys().next().value;void 0!==e&&(this.cache.delete(e),this.stats.evictions++)}get(e,t){if(!this.config.enabled)return void this.stats.misses++;const r=this.makeKey(e,t),n=this.cache.get(r);if(n)return this.isExpired(n)?(this.cache.delete(r),this.stats.expirations++,void this.stats.misses++):(this.cache.delete(r),n.lastAccessed=Date.now(),this.cache.set(r,n),this.stats.hits++,n.result);this.stats.misses++}set(e,t,r){if(!this.config.enabled)return;if(0===r.confidence)return;const n=this.makeKey(e,t),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(n,{result:r,createdAt:i,lastAccessed:i})}has(e,t){if(!this.config.enabled)return!1;const r=this.makeKey(e,t),n=this.cache.get(r);return!!n&&(!this.isExpired(n)||(this.cache.delete(r),this.stats.expirations++,!1))}delete(e,t){const r=this.makeKey(e,t);return this.cache.delete(r)}clear(){this.cache.clear()}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0}}getStats(){const e=this.stats.hits+this.stats.misses;return{hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:e>0?this.stats.hits/e:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(e){if(void 0!==e.maxSize)for(this.config.maxSize=e.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();void 0!==e.ttlMs&&(this.config.ttlMs=e.ttlMs),void 0!==e.enabled&&(this.config.enabled=e.enabled)}enable(){this.config.enabled=!0}disable(){this.config.enabled=!1}getConfig(){return{...this.config}}},Sv=new Ev;var Tv=class{constructor(e={}){this.patternMatcher=new Sy,this.languages=new Set(Ml()),this.cache=!1===e.cache?new Ev({enabled:!1}):e.cache?new Ev(e.cache):Sv}analyze(e,t){if(!this.supportsLanguage(t))return{confidence:0,errors:[`Language '${t}' is not supported for semantic parsing`]};const r=this.cache.get(e,t);if(r)return r;const n=this.analyzeUncached(e,t);return this.cache.set(e,t,n),n}analyzeUncached(e,t){try{const r=gy(t);if(!r)return{confidence:0,errors:[`No tokenizer available for language '${t}'`]};const n=r.tokenize(e),i=$l(t);if(0===i.length)return{confidence:0,errors:[`No patterns available for language '${t}'`]};const a=this.patternMatcher.matchBest(n,i);if(!a)return{confidence:0,errors:["No pattern matched the input"]};const o=this.buildSemanticNode(a);return{confidence:a.confidence,command:{name:a.pattern.command,roles:a.captured},node:o,tokensConsumed:a.consumedTokens}}catch(e){return{confidence:0,errors:[e instanceof Error?e.message:String(e)]}}}supportsLanguage(e){return this.languages.has(e)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear()}configureCache(e){this.cache.configure(e)}buildSemanticNode(e){return{kind:"command",action:e.pattern.command,roles:e.captured,metadata:{patternId:e.pattern.id}}}};function Cv(e){return new Tv(e)}var Av=.5;Ec(),sy(),eu(),Dp(),Uc(),bm(),pd(),Od(),uh(),bh(),jp(),Bh(),Cf(),Ec(),Ic(),sy(),eu(),Dp(),Uc(),tm(),um(),bm(),Vm(),pd(),Od(),Vd(),Jd(),uh(),bh(),Nh(),jp(),Bh(),Jh(),sf(),Cf(),_f(),Yf();var Lv={ar:mc,bn:Tc,zh:Zf,en:Gc,fr:Np,de:Mc,he:Hp,hi:Qp,id:mm,it:Pm,ja:Xm,ko:gd,ms:Rd,pl:Bd,pt:eh,qu:mh,ru:xh,es:wp,"es-MX":nv,sw:Ih,th:Fh,tl:ef,tr:vf,uk:Lf,vi:Wf};Iu(),Yu(),Iu();var jv=new Map([["toggle",yu],["add",vu],["remove",gu],["put",ku],["set",wu],["show",bu],["hide",zu],["on",xu],["trigger",Eu],["wait",Su],["fetch",Tu],["increment",Cu],["decrement",Au],["append",Lu]]);function Pv(e){return jv.get(e)}function Nv(e){return"literal"===e.type&&"string"==typeof e.value||"selector"===e.type||"reference"===e.type?e.value:void 0}function Ov(e,t){if(null==e)return!1;for(const r of t)switch(r){case"selector":if("selector"===e.type)return!0;const t=Nv(e);if(t&&(t.startsWith(".")||t.startsWith("#")||t.startsWith("[")))return!0;break;case"literal":if("literal"===e.type)return!0;if("property-path"===e.type)return!0;break;case"reference":if("reference"===e.type)return!0;if("property-path"===e.type)return!0;const r=Nv(e);if(r&&["me","you","it","my","its","result","event","target"].includes(r.toLowerCase()))return!0;break;case"expression":if("expression"===e.type)return!0;if("property-path"===e.type)return!0}return!1}function Iv(e){const t=[],r=[],n=[];let i=0;const a=Pv(e.action);if(!a)return r.push({code:"UNKNOWN_ROLE",message:`No schema found for action '${e.action}'. Skipping validation.`,severity:"warning"}),{valid:!0,errors:t,warnings:r,confidenceAdjustment:-.1,suggestions:n};const o=new Map;for(const t of e.arguments)t.role&&o.set(t.role,t);for(const e of a.roles){const a=o.get(e.role);!e.required||a?a&&!Ov(a,e.expectedTypes)&&(r.push({code:"INVALID_TYPE",message:`Role '${e.role}' expected ${e.expectedTypes.join(" or ")}, got ${a.type}.`,role:e.role,expected:e.expectedTypes,actual:a,severity:"warning"}),i-=.1):e.default?r.push({code:"MISSING_REQUIRED_ROLE",message:`Role '${e.role}' not provided, using default.`,role:e.role,severity:"warning"}):(t.push({code:"MISSING_REQUIRED_ROLE",message:`Required role '${e.role}' (${e.description}) is missing.`,role:e.role,expected:e.expectedTypes,severity:"error"}),n.push(`Add ${e.description.toLowerCase()} to the command.`),i-=.2)}for(const t of e.arguments)if(t.role){a.roles.some(e=>e.role===t.role)||(r.push({code:"UNKNOWN_ROLE",message:`Role '${t.role}' is not recognized for command '${e.action}'.`,role:t.role,severity:"warning"}),i-=.05)}return a.roles.filter(e=>e.required&&!e.default).every(e=>o.has(e.role))&&0===t.length&&(i+=.1),{valid:0===t.length,errors:t,warnings:r,confidenceAdjustment:Math.max(-1,Math.min(1,i)),suggestions:n}}function Rv(e){switch(e){case"preposition":return"preposition";case"postposition":case"particle":case"case-suffix":return"postposition";default:return"none"}}function Mv(e,t,r){const n={form:t.primary,role:e,position:Rv(r),required:t.required??!1};return t.alternatives&&(n.alternatives=t.alternatives),n}var qv={accessibility:!0,performance:!0,schema:!0,strict:!1},_v=new Set(["scroll","mousemove","touchmove","resize","input","keydown","keyup","keypress"]),$v=new Set(["scroll","mousemove","touchmove","resize"]);function Wv(e,t){const r=[];if("event-handler"===e.kind){const n=e.roles.get("event");if(n&&"literal"===n.type){const e=String(n.value).toLowerCase();"mouseenter"!==e&&"mouseover"!==e&&"hover"!==e||r.push({code:"HOVER_ONLY_INTERACTION",severity:"warning",message:`Hover-only interaction detected (${e}). Not accessible to keyboard or touch users.`,suggestion:"Add keyboard equivalent (focus) or use a click-based interaction.",location:{input:t,role:"event"}})}}return r}function Vv(e,t){const r=[];if("event-handler"===e.kind){const n=e.roles.get("event");if(n&&"literal"===n.type){const e=String(n.value).toLowerCase();if(_v.has(e)){const n=$v.has(e)?"warning":"info";r.push({code:"HIGH_FREQUENCY_TRIGGER",severity:n,message:`High-frequency event '${e}' may cause performance issues.`,suggestion:$v.has(e)?`Consider using 'on ${e} throttled:100ms' to limit execution frequency.`:"Consider debouncing or throttling this handler.",location:{input:t,role:"event"}})}}}return r}function Dv(e,t){const r=[];if("command"!==e.kind)return r;const n=Pv(e.action);if(!n)return r;const i=Array.isArray(n.roles)?n.roles:[],a=new Set;for(const n of i)n&&"object"==typeof n&&"role"in n&&(a.add(n.role),n.required&&!e.roles.has(n.role)&&r.push({code:"MISSING_REQUIRED_ROLE",severity:"error",message:`Command '${e.action}' requires '${n.role}' but it was not provided.`,suggestion:n.description,location:{input:t}}));return e.roles.forEach((n,i)=>{a.has(i)||r.push({code:"INVALID_ROLE_FOR_COMMAND",severity:"warning",message:`Role '${i}' is not typically used with '${e.action}' command.`,location:{input:t,role:i}})}),r}function Bv(e){if("event-handler"===e.kind){return e.body??[]}return[]}function Hv(e,t={}){const r=[],n=new Map;for(const t of e)if("event-handler"===t.kind){const e=t.roles.get("event"),r=t.roles.get("source"),i=`${"literal"===e?.type?e.value:"unknown"}:${"selector"===r?.type?r.value:"self"}`;n.has(i)||n.set(i,[]);const a=Bv(t);n.get(i).push({handler:t,commands:a})}return n.forEach((e,t)=>{if(e.length>1){const n=[],i=[];for(const{commands:t}of e)for(const e of t){n.push(e.action);const t=e.roles.get("patient");i.push("selector"===t?.type?t.value:"unknown")}const a=n.includes("toggle"),o=n.includes("show"),s=n.includes("hide");if(a&&(o||s)){i.filter((e,t)=>("toggle"===n[t]||"show"===n[t]||"hide"===n[t])&&i.some((r,n)=>t!==n&&e===r)).length>0&&r.push({code:"CONFLICTING_ACTIONS",severity:"warning",message:`Conflicting actions on '${t}': ${[...new Set(n)].join(", ")} may interfere with each other.`,suggestion:"Consider using a single toggle or conditional logic."})}n.some(e=>["fetch","wait","send"].includes(e))&&e.length>1&&r.push({code:"POTENTIAL_RACE_CONDITION",severity:"info",message:`Multiple handlers on '${t}' include async operations. Consider sequencing.`,suggestion:'Use "then" to chain operations or add loading states.'})}}),r}function Fv(e,t="en",r={}){const n={...qv,...r},i=[];let a=null;try{a=Dy(e,t)}catch{}if(!a)return{valid:!1,warnings:[{code:"UNREACHABLE_BEHAVIOR",severity:"error",message:"Could not parse input to semantic representation.",location:{input:e}}],node:null};n.accessibility&&i.push(...Wv(a,e)),n.performance&&i.push(...Vv(a,e)),n.schema&&i.push(...Dv(a,e));const o=i.some(e=>"error"===e.severity),s=i.some(e=>"warning"===e.severity);return{valid:n.strict?!o&&!s:!o,warnings:i,node:a}}var Uv=!1,Kv={};var Gv=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document"]),Yv=new Set(["and","or","not","no"]),Xv=new Set(["true","false","null","undefined"]),Zv=new Set(["ms","s","seconds","second","milliseconds","millisecond","minutes","minute","hours","hour"]);var Jv=class{constructor(){this.tokens=[],this.current=0}parse(e){try{if(this.tokens=function(e){const t=[];let r=0,n=1,i=1;function a(){return 0===t.length||["OPERATOR","COMPARISON","LOGICAL","LPAREN","LBRACKET","LBRACE","COMMA","COLON"].includes(t[t.length-1].type)}function o(t=0){return e[r+t]??""}function s(){const t=e[r];return r++,"\n"===t?(n++,i=1):i++,t}function l(){for(;r<e.length&&/\s/.test(e[r]);)s()}function c(t){let n="";for(;r<e.length&&t(e[r]);)n+=s();return n}function u(t){let n=t;for(s();r<e.length&&e[r]!==t;)"\\"===e[r]&&r+1<e.length?(n+=s(),n+=s()):n+=s();return r<e.length&&(n+=s()),n}function p(){let t="`";for(s();r<e.length&&"`"!==e[r];)"\\"===e[r]&&r+1<e.length?(t+=s(),t+=s()):t+=s();return r<e.length&&(t+=s()),t}function m(){let t="<";for(s();r<e.length&&(t+=s(),!t.endsWith("/>")););return t}function d(e,t,a){return{type:e,value:t,start:a,end:r,line:n,column:i-t.length}}for(;r<e.length&&(l(),!(r>=e.length));){const n=r,i=o();if("'"!==i||"s"!==o(1)||/\w/.test(o(2))){if('"'===i||"'"===i){const e=u(i);t.push(d("STRING",e,n));continue}if("`"===i){const e=p();t.push(d("TEMPLATE_LITERAL",e,n));continue}if("<"===i&&/[a-zA-Z.#\[]/.test(o(1))){const e=m();t.push(d("QUERY_SELECTOR",e,n));continue}if("#"===i&&a()){s();const e=c(e=>/[\w-]/.test(e));t.push(d("ID_SELECTOR","#"+e,n));continue}if("."===i&&/[a-zA-Z_-]/.test(o(1))&&a()){s();const e=c(e=>/[\w-]/.test(e));t.push(d("CLASS_SELECTOR","."+e,n));continue}if("["===i&&a()){const i=o(1);if("@"===i||/[a-zA-Z]/.test(i)){let i="";for(i+=s();r<e.length&&"]"!==e[r];)i+='"'===e[r]||"'"===e[r]?u(e[r]):s();r<e.length&&(i+=s()),t.push(d("ATTRIBUTE_SELECTOR",i,n));continue}}if("["!==i)if("]"!==i){if(/\d/.test(i)){const e=c(e=>/[\d.]/.test(e)),i=r,a=c(e=>/[a-zA-Z]/.test(e));Zv.has(a)?t.push(d("TIME_EXPRESSION",e+a,n)):(r=i,t.push(d("NUMBER",e,n)));continue}if("("!==i)if(")"!==i)if("{"!==i)if("}"!==i)if(","!==i)if(":"!==i)if("."!==i)if("+"!==i&&"-"!==i&&"*"!==i&&"/"!==i&&"%"!==i){if("="===i||"!"===i||"<"===i||">"===i){let e=s();"="===o()&&(e+=s()),t.push(d("COMPARISON",e,n));continue}if(/[a-zA-Z_$]/.test(i)){const e=c(e=>/[\w$]/.test(e)),r=e.toLowerCase();Gv.has(r)?t.push(d("CONTEXT_VAR",e,n)):Yv.has(r)?t.push(d("LOGICAL",e,n)):Xv.has(r)?t.push(d("BOOLEAN",e,n)):t.push(d("IDENTIFIER",e,n));continue}s()}else s(),t.push(d("OPERATOR",i,n));else s(),t.push(d("DOT",".",n));else s(),t.push(d("COLON",":",n));else s(),t.push(d("COMMA",",",n));else s(),t.push(d("RBRACE","}",n));else s(),t.push(d("LBRACE","{",n));else s(),t.push(d("RPAREN",")",n));else s(),t.push(d("LPAREN","(",n))}else s(),t.push(d("RBRACKET","]",n));else s(),t.push(d("LBRACKET","[",n))}else s(),s(),t.push(d("POSSESSIVE","'s",n))}return t.push(d("EOF","",r)),t}(e),this.current=0,this.isAtEnd())return{success:!1,error:"Empty expression"};return{success:!0,node:this.parseExpression(),consumed:this.current}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Parse error"}}}peek(){return this.tokens[this.current]??{type:"EOF",value:"",start:0,end:0}}previous(){return this.tokens[this.current-1]??{type:"EOF",value:"",start:0,end:0}}isAtEnd(){return"EOF"===this.peek().type}advance(){return this.isAtEnd()||this.current++,this.previous()}check(e){return this.peek().type===e}checkValue(e){return this.peek().value.toLowerCase()===e.toLowerCase()}match(...e){for(const t of e)if(this.check(t))return this.advance(),!0;return!1}parseExpression(){return this.parseOr()}parseOr(){let e=this.parseAnd();for(;this.checkValue("or");){const t=this.advance().value,r=this.parseAnd();e=this.createBinaryExpression(t,e,r)}return e}parseAnd(){let e=this.parseEquality();for(;this.checkValue("and");){const t=this.advance().value,r=this.parseEquality();e=this.createBinaryExpression(t,e,r)}return e}parseEquality(){let e=this.parseComparison();for(;this.match("COMPARISON")||this.checkValue("is")||this.checkValue("matches")||this.checkValue("contains")||this.checkValue("in");){const t=this.previous().value,r=this.parseComparison();e=this.createBinaryExpression(t,e,r)}return e}parseComparison(){let e=this.parseAddition();for(;this.check("COMPARISON");){const t=this.advance().value,r=this.parseAddition();e=this.createBinaryExpression(t,e,r)}return e}parseAddition(){let e=this.parseMultiplication();for(;"+"===this.peek().value||"-"===this.peek().value;){const t=this.advance().value,r=this.parseMultiplication();e=this.createBinaryExpression(t,e,r)}return e}parseMultiplication(){let e=this.parseUnary();for(;"*"===this.peek().value||"/"===this.peek().value||"%"===this.peek().value;){const t=this.advance().value,r=this.parseUnary();e=this.createBinaryExpression(t,e,r)}return e}parseUnary(){if(this.checkValue("not")||this.checkValue("no")||"-"===this.peek().value){const e=this.advance().value,t=this.parseUnary();return this.createUnaryExpression(e,t)}return this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;)if(this.match("DOT")){if(!this.check("IDENTIFIER")&&!this.check("CONTEXT_VAR"))break;{const t=this.advance().value;e=this.createPropertyAccess(e,t)}}else if(this.match("POSSESSIVE")){if(!this.check("IDENTIFIER")&&!this.check("CONTEXT_VAR"))break;{const t=this.advance().value;e=this.createPossessiveExpression(e,t)}}else if(this.match("LPAREN")){const t=this.parseArguments();e=this.createCallExpression(e,t)}else{if(!this.match("LBRACKET"))break;{const t=this.parseExpression();if(!this.match("RBRACKET"))throw new Error("Expected ] after index");e=this.createPropertyAccess(e,t)}}return e}parsePrimary(){const e=this.peek();if(this.match("NUMBER"))return this.createLiteral(parseFloat(e.value),"number",e);if(this.match("STRING")){const t=e.value.slice(1,-1);return this.createLiteral(t,"string",e)}if(this.match("BOOLEAN")){return this.createLiteral("true"===e.value||"false"!==e.value&&("null"===e.value?null:void 0),e.value,e)}if(this.match("TEMPLATE_LITERAL")){return{type:"templateLiteral",value:e.value,start:e.start,end:e.end,line:e.line,column:e.column}}if(this.match("TIME_EXPRESSION"))return this.parseTimeExpression(e);if(this.match("ID_SELECTOR"))return this.createSelector(e.value,"id",e);if(this.match("CLASS_SELECTOR"))return this.createSelector(e.value,"class",e);if(this.match("ATTRIBUTE_SELECTOR"))return this.createSelector(e.value,"attribute",e);if(this.match("QUERY_SELECTOR")){const t=e.value.slice(1,-2);return this.createSelector(t,"query",e)}if(this.match("CONTEXT_VAR"))return this.createContextReference(e.value,e);if(this.match("IDENTIFIER"))return this.createIdentifier(e.value,e);if(this.match("LPAREN")){const e=this.parseExpression();if(!this.match("RPAREN"))throw new Error("Expected ) after expression");return e}if(this.match("LBRACKET"))return this.parseArrayLiteral();if(this.match("LBRACE"))return this.parseObjectLiteral();throw new Error(`Unexpected token: ${e.value}`)}parseArguments(){const e=[];if(!this.check("RPAREN"))do{e.push(this.parseExpression())}while(this.match("COMMA"));if(!this.match("RPAREN"))throw new Error("Expected ) after arguments");return e}parseArrayLiteral(){const e=[],t=this.previous().start;if(!this.check("RBRACKET"))do{e.push(this.parseExpression())}while(this.match("COMMA"));if(!this.match("RBRACKET"))throw new Error("Expected ] after array elements");return{type:"arrayLiteral",elements:e,start:t,end:this.previous().end}}parseObjectLiteral(){const e=[],t=this.previous().start;if(!this.check("RBRACE"))do{let t;if(this.check("STRING"))t=this.advance().value.slice(1,-1);else{if(!this.check("IDENTIFIER"))throw new Error("Expected property name");t=this.advance().value}if(!this.match("COLON"))throw new Error("Expected : after property name");const r=this.parseExpression();e.push({key:t,value:r})}while(this.match("COMMA"));if(!this.match("RBRACE"))throw new Error("Expected } after object properties");return{type:"objectLiteral",properties:e.map(e=>({type:"objectProperty",key:e.key,value:e.value})),start:t,end:this.previous().end}}parseTimeExpression(e){const t=e.value.match(/^(\d+(?:\.\d+)?)(ms|s|seconds?|milliseconds?|minutes?|hours?)$/i);if(!t)throw new Error(`Invalid time expression: ${e.value}`);return{type:"timeExpression",value:parseFloat(t[1]),unit:t[2].toLowerCase(),raw:e.value,start:e.start,end:e.end,line:e.line,column:e.column}}createLiteral(e,t,r){return{type:"literal",value:e,dataType:t,raw:r.value,start:r.start,end:r.end,line:r.line,column:r.column}}createSelector(e,t,r){return{type:"selector",value:e,selector:e,selectorType:t,start:r.start,end:r.end,line:r.line,column:r.column}}createContextReference(e,t){return{type:"contextReference",contextType:e,name:t.value,start:t.start,end:t.end,line:t.line,column:t.column}}createIdentifier(e,t){return{type:"identifier",name:e,start:t.start,end:t.end,line:t.line,column:t.column}}createPropertyAccess(e,t){return{type:"propertyAccess",object:e,property:"string"==typeof t?t:t.name??"",start:e.start,end:this.previous().end}}createPossessiveExpression(e,t){return{type:"possessiveExpression",object:e,property:t,start:e.start,end:this.previous().end}}createBinaryExpression(e,t,r){return{type:"binaryExpression",operator:e,left:t,right:r,start:t.start,end:r.end}}createUnaryExpression(e,t){return{type:"unaryExpression",operator:e,operand:t,prefix:!0,start:this.previous().start,end:t.end}}createCallExpression(e,t){return{type:"callExpression",callee:e,arguments:t,start:e.start,end:this.previous().end}}};function Qv(e,t){switch(e.type){case"literal":return eg(e);case"selector":return tg(e,t);case"reference":return rg(e);case"property-path":return ng(e,t);case"expression":return ig(e);default:throw new Error(`Unknown semantic value type: ${e.type}`)}}function eg(e){const t={type:"literal",value:e.value};return e.dataType?{...t,dataType:e.dataType}:t}function tg(e,t){return t&&e.value.startsWith("*")&&/^[a-zA-Z-]/.test(e.value.slice(1))&&t.push(`Converted '${e.value}' to a CSS selector, but it looks like a CSS property name. CSS properties in commands like 'transition' should be literal strings, not selectors. Consider using expectedTypes: ['literal'] instead of ['literal', 'selector'] in the command schema.`),{type:"selector",value:e.value,selector:e.value,selectorType:e.selectorKind}}function rg(e){return{type:"contextReference",contextType:e.value,name:e.value}}function ng(e,t){return{type:"propertyAccess",object:Qv(e.object,t),property:e.property}}function ig(e){const t=(r=e.raw,(new Jv).parse(r));var r;if(!t.success||!t.node){return{type:"identifier",name:e.raw}}return t.node}function ag(e,t){return e.roles.get(t)}function og(e,t,r){const n=ag(e,t);return n?Qv(n,r):void 0}function sg(e,t=[],r,n={}){const i={type:"command",name:e,args:t};return r&&Object.keys(r).length>0&&(i.modifiers=r),n.isBlocking&&(i.isBlocking=n.isBlocking),n.implicitTarget&&(i.implicitTarget=n.implicitTarget),i}var lg={action:"toggle",toAST(e,t){const r=og(e,"patient"),n=og(e,"destination"),i=og(e,"duration"),a=r?[r]:[],o={};return n&&(o.on=n),i&&(o.for=i),sg("toggle",a,o)}},cg={action:"add",toAST(e,t){const r=og(e,"patient"),n=og(e,"destination"),i=r?[r]:[],a={};return n&&(a.to=n),sg("add",i,a)}},ug={action:"remove",toAST(e,t){const r=og(e,"patient"),n=og(e,"source"),i=r?[r]:[],a={};return n&&(a.from=n),sg("remove",i,a)}},pg={action:"set",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=[],a={};return r&&i.push(r),n&&(a.to=n),sg("set",i,a)}},mg={action:"show",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=og(e,"duration"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.with=i),sg("show",a,o)}},dg={action:"hide",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=og(e,"duration"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.with=i),sg("hide",a,o)}},hg={action:"increment",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=og(e,"quantity"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.by=i),sg("increment",a,o)}},fg={action:"decrement",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=og(e,"quantity"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.by=i),sg("decrement",a,o)}},yg={action:"wait",toAST(e,t){const r=og(e,"duration");return sg("wait",r?[r]:[],void 0,{isBlocking:!0})}},vg={action:"log",toAST(e,t){const r=og(e,"patient"),n=[];return r&&n.push(r),sg("log",n)}},gg={action:"put",toAST(e,t){const r=og(e,"patient"),n=og(e,"destination"),i=ag(e,"method"),a=r?[r]:[],o={};if(n){o["literal"===i?.type?String(i.value):"into"]=n}return sg("put",a,o)}},kg={action:"fetch",toAST(e,t){const r=og(e,"source"),n=og(e,"method"),i=og(e,"responseType"),a=og(e,"patient"),o=r?[r]:[],s={};return n&&(s.with=n),i&&(s.as=i),a&&(s.body=a),sg("fetch",o,s,{isBlocking:!0})}},wg={action:"append",toAST(e,t){const r=og(e,"patient"),n=og(e,"destination"),i=r?[r]:[],a={};return n&&(a.to=n),sg("append",i,a)}},bg={action:"prepend",toAST(e,t){const r=og(e,"patient"),n=og(e,"destination"),i=r?[r]:[],a={};return n&&(a.to=n),sg("prepend",i,a)}},zg={action:"trigger",toAST(e,t){const r=og(e,"event"),n=og(e,"destination"),i=r?[r]:[],a={};return n&&(a.on=n),sg("trigger",i,a)}},xg={action:"send",toAST(e,t){const r=og(e,"event"),n=og(e,"destination"),i=og(e,"patient"),a=r?[r]:[],o={};return n&&(o.to=n),i&&(o.detail=i),sg("send",a,o)}},Eg={action:"go",toAST(e,t){const r=og(e,"source"),n=og(e,"destination"),i=[],a={};return r&&i.push(r),n&&(a.to=n),sg("go",i,a)}},Sg={action:"transition",toAST(e,t){const r=og(e,"patient"),n=og(e,"goal"),i=og(e,"duration"),a=og(e,"destination"),o=r?[r]:[],s={};return n&&(s.to=n),i&&(s.over=i),a&&(s.on=a),sg("transition",o,s)}},Tg={action:"focus",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=[],a=r??n;return a&&i.push(a),sg("focus",i,{})}},Cg={action:"blur",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=[],a=r??n;return a&&i.push(a),sg("blur",i)}},Ag={action:"get",toAST(e,t){const r=og(e,"source"),n=og(e,"patient"),i=[],a=r??n;return a&&i.push(a),sg("get",i)}},Lg={action:"take",toAST(e,t){const r=og(e,"patient"),n=og(e,"source"),i=r?[r]:[],a={};return n&&(a.from=n),sg("take",i,a)}},jg={action:"call",toAST(e,t){const r=og(e,"patient");return sg("call",r?[r]:[])}},Pg={action:"return",toAST(e,t){const r=og(e,"patient");return sg("return",r?[r]:[])}},Ng={action:"halt",toAST:(e,t)=>sg("halt",[])},Og={action:"throw",toAST(e,t){const r=og(e,"patient");return sg("throw",r?[r]:[])}},Ig={action:"settle",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=[],a=r??n;return a&&i.push(a),sg("settle",i,void 0,{isBlocking:!0})}},Rg={action:"swap",toAST(e,t){const r=og(e,"patient"),n=og(e,"source"),i=og(e,"destination"),a=og(e,"style"),o=[],s={};return r&&o.push(r),n&&o.push(n),i&&(s.on=i),a&&(s.with=a),sg("swap",o,s)}},Mg={action:"morph",toAST(e,t){const r=og(e,"source"),n=og(e,"destination"),i=og(e,"patient"),a=[],o={},s=r??i;return s&&a.push(s),n&&(o.on=n),sg("morph",a,o)}},qg={action:"clone",toAST(e,t){const r=og(e,"source"),n=og(e,"destination"),i=og(e,"patient"),a=[],o={},s=r??i;return s&&a.push(s),n&&(o.into=n),sg("clone",a,o)}},_g={action:"make",toAST(e,t){const r=og(e,"patient");return sg("make",r?[r]:[])}},$g={action:"measure",toAST(e,t){const r=og(e,"patient"),n=og(e,"destination"),i=og(e,"source"),a=[],o={};r&&a.push(r);const s=n??i;return s&&(o.of=s),sg("measure",a,o)}},Wg={action:"tell",toAST(e,t){const r=og(e,"destination"),n=og(e,"patient"),i=[],a=r??n;return a&&i.push(a),sg("tell",i)}},Vg={action:"js",toAST(e,t){const r=og(e,"patient");return sg("js",r?[r]:[])}},Dg={action:"async",toAST:(e,t)=>sg("async",[])},Bg={action:"if",toAST(e,t){const r=og(e,"condition");return sg("if",r?[r]:[])}},Hg={action:"unless",toAST(e,t){const r=og(e,"condition");return sg("unless",r?[r]:[])}},Fg={action:"repeat",toAST(e,t){const r=og(e,"quantity"),n=og(e,"patient"),i=[],a=r??n;return a&&i.push(a),sg("repeat",i)}},Ug={action:"for",toAST(e,t){const r=og(e,"patient"),n=og(e,"source"),i=r?[r]:[],a={};return n&&(a.in=n),sg("for",i,a)}},Kg={action:"while",toAST(e,t){const r=og(e,"condition");return sg("while",r?[r]:[])}},Gg={action:"continue",toAST:(e,t)=>sg("continue",[])},Yg={action:"default",toAST(e,t){const r=og(e,"patient"),n=og(e,"source"),i=r?[r]:[],a={};return n&&(a.to=n),sg("default",i,a)}},Xg={action:"init",toAST:(e,t)=>sg("init",[])},Zg={action:"behavior",toAST(e,t){const r=og(e,"patient");return sg("behavior",r?[r]:[])}},Jg={action:"install",toAST(e,t){const r=og(e,"patient"),n=og(e,"destination"),i=r?[r]:[],a={};return n&&(a.on=n),sg("install",i,a)}},Qg=new Map([["toggle",lg],["add",cg],["remove",ug],["set",pg],["show",mg],["hide",dg],["increment",hg],["decrement",fg],["wait",yg],["log",vg],["put",gg],["fetch",kg],["append",wg],["prepend",bg],["get",Ag],["take",Lg],["trigger",zg],["send",xg],["on",{action:"on",toAST(e,t){const r=og(e,"event"),n=og(e,"source"),i=r?[r]:[],a={};return n&&(a.from=n),sg("on",i,a)}}],["go",Eg],["transition",Sg],["focus",Tg],["blur",Cg],["call",jg],["return",Pg],["halt",Ng],["throw",Og],["settle",Ig],["swap",Rg],["morph",Mg],["clone",qg],["measure",$g],["make",_g],["tell",Wg],["default",Yg],["js",Vg],["async",Dg],["if",Bg],["unless",Hg],["repeat",Fg],["for",Ug],["while",Kg],["continue",Gg],["init",Xg],["behavior",Zg],["install",Jg]]);function ek(e){return Qg.get(e)}var tk=class{constructor(e={}){this.warnings=[]}build(e){switch(e.kind){case"command":return this.buildCommand(e);case"event-handler":return this.buildEventHandler(e);case"conditional":return this.buildConditional(e);case"compound":return this.buildCompound(e);case"loop":return this.buildLoop(e);default:throw new Error(`Unknown semantic node kind: ${e.kind}`)}}buildCommand(e){const t=ek(e.action);if(t){const r=t.toAST(e,this);if("ast"in r&&"warnings"in r){const e=r;return this.warnings.push(...e.warnings),e.ast}return r}return this.buildGenericCommand(e)}buildGenericCommand(e){const t=[],r={},n=["patient","source","quantity"],i=["destination","duration","method","style"];for(const r of n){const n=e.roles.get(r);n&&t.push(Qv(n))}for(const t of i){const n=e.roles.get(t);if(n){r[this.roleToModifierKey(t)]=Qv(n)}}const a={type:"command",name:e.action,args:t};return Object.keys(r).length>0?{...a,modifiers:r}:a}roleToModifierKey(e){return{destination:"on",duration:"for",source:"from",condition:"if",method:"via",style:"with"}[e]??e}buildEventHandler(e){const t=e.roles.get("event");let r,n;if("literal"===t?.type){const e=String(t.value);e.includes("|")||e.includes(" or ")?(n=e.split(/\s+or\s+|\|/).map(e=>e.trim()),r=n[0]):r=e}else r="reference"===t?.type?t.value:"click";const i=e.body.map(e=>this.build(e)),a=e.roles.get("source");let o,s;"selector"===a?.type?(o=a.value,s=a.value):"reference"===a?.type?s=a.value:"literal"===a?.type&&(s=String(a.value));const l=e.roles.get("condition"),c=l?Qv(l):void 0,u=e.roles.get("destination"),p=u?Qv(u):void 0,m=e.eventModifiers;let d=o;if(m?.from){const e=m.from;"selector"!==e.type||o||(d=e.value)}const h=e.parameterNames?[...e.parameterNames]:void 0;return{type:"eventHandler",event:r,commands:i,...n&&n.length>1?{events:n}:{},...d?{selector:d}:{},...s?{target:s}:{},...c?{condition:c}:{},...p?{watchTarget:p}:{},...h&&h.length>0?{args:h,params:h}:{}}}buildConditional(e){const t=e.roles.get("condition");if(!t)throw new Error("Conditional node missing condition");const r=Qv(t),n=e.thenBranch.map(e=>this.build(e)),i=e.elseBranch?.map(e=>this.build(e)),a=[r,{type:"block",commands:n}];return i&&i.length>0&&a.push({type:"block",commands:i}),{type:"command",name:"if",args:a}}buildCompound(e){const t=e.statements.map(e=>this.build(e));if(1===t.length)return t[0];if(0===t.length)return{type:"block",commands:[]};return{type:"CommandSequence",commands:t}}buildLoop(e){const t=e.body.map(e=>this.build(e)),r=[{type:"identifier",name:e.loopVariant}];switch(e.loopVariant){case"times":{const t=e.roles.get("quantity");t&&r.push(Qv(t));break}case"for":{e.loopVariable&&r.push({type:"string",value:e.loopVariable});const t=e.roles.get("source");t&&r.push(Qv(t));break}case"while":case"until":{const t=e.roles.get("condition");t&&r.push(Qv(t));break}}return r.push({type:"block",commands:t}),{type:"command",name:"repeat",args:r}}buildBlock(e){return{type:"block",commands:e.map(e=>this.build(e))}}};Bl();var rk={en:async()=>{const{englishTokenizer:e}=await Promise.resolve().then(()=>(au(),tu)),{englishProfile:t}=await Promise.resolve().then(()=>(eu(),Xc)),{buildEnglishPatterns:r}=await Promise.resolve().then(()=>(gp(),up));return{tokenizer:e,profile:t,buildPatterns:r}},es:async()=>{const{spanishTokenizer:e}=await Promise.resolve().then(()=>(Op(),Pp)),{spanishProfile:t}=await Promise.resolve().then(()=>(jp(),zp));return{tokenizer:e,profile:t}},ja:async()=>{const{japaneseTokenizer:e}=await Promise.resolve().then(()=>(yd(),md)),{japaneseProfile:t}=await Promise.resolve().then(()=>(pd(),Jm));return{tokenizer:e,profile:t}},ar:async()=>{const{arabicTokenizer:e}=await Promise.resolve().then(()=>(Cc(),Sc)),{arabicProfile:t}=await Promise.resolve().then(()=>(Ec(),hc));return{tokenizer:e,profile:t}},ko:async()=>{const{koreanTokenizer:e}=await Promise.resolve().then(()=>(Md(),Id)),{koreanProfile:t}=await Promise.resolve().then(()=>(Od(),wd));return{tokenizer:e,profile:t}},zh:async()=>{const{chineseTokenizer:e}=await Promise.resolve().then(()=>(cy(),ly)),{chineseProfile:t}=await Promise.resolve().then(()=>(sy(),Qf));return{tokenizer:e,profile:t}},tr:async()=>{const{turkishTokenizer:e}=await Promise.resolve().then(()=>(jf(),Af)),{turkishProfile:t}=await Promise.resolve().then(()=>(Cf(),kf));return{tokenizer:e,profile:t}},pt:async()=>{const{portugueseTokenizer:e}=await Promise.resolve().then(()=>(dh(),ph)),{portugueseProfile:t}=await Promise.resolve().then(()=>(uh(),rh));return{tokenizer:e,profile:t}},fr:async()=>{const{frenchTokenizer:e}=await Promise.resolve().then(()=>(em(),Bp)),{frenchProfile:t}=await Promise.resolve().then(()=>(Dp(),Ip));return{tokenizer:e,profile:t}},de:async()=>{const{germanTokenizer:e}=await Promise.resolve().then(()=>(Yc(),Kc)),{germanProfile:t}=await Promise.resolve().then(()=>(Uc(),_c));return{tokenizer:e,profile:t}},id:async()=>{const{indonesianTokenizer:e}=await Promise.resolve().then(()=>(Lm(),zm)),{indonesianProfile:t}=await Promise.resolve().then(()=>(bm(),hm));return{tokenizer:e,profile:t}},qu:async()=>{const{quechuaTokenizer:e}=await Promise.resolve().then(()=>(Eh(),zh)),{quechuaProfile:t}=await Promise.resolve().then(()=>(bh(),hh));return{tokenizer:e,profile:t}},sw:async()=>{const{swahiliTokenizer:e}=await Promise.resolve().then(()=>(Uh(),Hh)),{swahiliProfile:t}=await Promise.resolve().then(()=>(Bh(),Mh));return{tokenizer:e,profile:t}},bn:async()=>{const{bengaliTokenizer:e}=await Promise.resolve().then(()=>(qc(),Rc)),{bengaliProfile:t}=await Promise.resolve().then(()=>(Ic(),Ac));return{tokenizer:e,profile:t}},hi:async()=>{const{hindiTokenizer:e}=await Promise.resolve().then(()=>(dm(),pm)),{hindiProfile:t}=await Promise.resolve().then(()=>(um(),nm));return{tokenizer:e,profile:t}},it:async()=>{const{italianTokenizer:e}=await Promise.resolve().then(()=>(Um(),Dm)),{italianProfile:t}=await Promise.resolve().then(()=>(Vm(),Om));return{tokenizer:e,profile:t}},ms:async()=>{const{malayTokenizer:e}=await Promise.resolve().then(()=>(Hd(),Dd)),{malayProfile:t}=await Promise.resolve().then(()=>(Vd(),qd));return{tokenizer:e,profile:t}},pl:async()=>{const{polishTokenizer:e}=await Promise.resolve().then(()=>(th(),Qd)),{polishProfile:t}=await Promise.resolve().then(()=>(Jd(),Fd));return{tokenizer:e,profile:t}},ru:async()=>{const{russianTokenizer:e}=await Promise.resolve().then(()=>(Rh(),Oh)),{russianProfile:t}=await Promise.resolve().then(()=>(Nh(),Sh));return{tokenizer:e,profile:t}},th:async()=>{const{thaiTokenizer:e}=await Promise.resolve().then(()=>(tf(),Qh)),{thaiProfile:t}=await Promise.resolve().then(()=>(Jh(),Kh));return{tokenizer:e,profile:t}},tl:async()=>{const{tagalogTokenizer:e}=await Promise.resolve().then(()=>(pf(),lf)),{tagalogProfile:t}=await Promise.resolve().then(()=>(sf(),rf));return{tokenizer:e,profile:t}},uk:async()=>{const{ukrainianTokenizer:e}=await Promise.resolve().then(()=>(Vf(),$f)),{ukrainianProfile:t}=await Promise.resolve().then(()=>(_f(),Pf));return{tokenizer:e,profile:t}},vi:async()=>{const{vietnameseTokenizer:e}=await Promise.resolve().then(()=>(Jf(),Xf)),{vietnameseProfile:t}=await Promise.resolve().then(()=>(Yf(),Df));return{tokenizer:e,profile:t}}},nk=Object.keys(rk);async function ik(e,t={}){const{url:r,module:n,skipIfRegistered:i=!0}=t;if(i&&ql(e))return{code:e,loaded:!1};try{let t;if(n)t=n;else if(r)t=await async function(e,t){try{const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch ${t}: ${e.status} ${e.statusText}`);const r=await e.text(),n=new Blob([r],{type:"application/javascript"}),i=URL.createObjectURL(n);try{const e=await import(i);if(!e.tokenizer||!e.profile)throw new Error("Invalid language module: missing tokenizer or profile");return e}finally{URL.revokeObjectURL(i)}}catch(r){throw new Error(`Failed to load language '${e}' from ${t}: ${r instanceof Error?r.message:String(r)}`)}}(e,r);else{const r=rk[e];if(!r)throw new Error(`Unknown language: ${e}. Supported: ${nk.join(", ")}`);t=await r()}return function(e,t){Pl(e,t.tokenizer,t.profile),t.patterns?Nl(e,t.patterns):t.buildPatterns&&Nl(e,t.buildPatterns())}(e,t),{code:e,loaded:!0}}catch(t){return{code:e,loaded:!1,error:t instanceof Error?t.message:String(t)}}}function ak(e,t){try{const r=ky(e,t),n=$l(t);if(0===n.length)return{confidence:0,parseSuccess:!1,error:`No patterns available for language: ${t}`};const i=[...n].sort((e,t)=>t.priority-e.priority),a=i.filter(e=>"on"===e.command),o=Ty.matchBest(r,a);if(o)return{confidence:o.confidence,parseSuccess:!0,patternId:o.pattern.id,action:o.pattern.command,tokensConsumed:o.consumedTokens};r.reset(r.mark());const s=i.filter(e=>"on"!==e.command),l=Ty.matchBest(r,s);return l?{confidence:l.confidence,parseSuccess:!0,patternId:l.pattern.id,action:l.pattern.command,tokensConsumed:l.consumedTokens}:{confidence:0,parseSuccess:!1,error:`Could not match any patterns for: ${e}`}}catch(e){return{confidence:0,parseSuccess:!1,error:e instanceof Error?e.message:String(e)}}}by(),Bl(),jy();var ok=Object.freeze({__proto__:null,ASTBuilder:tk,DEFAULT_CONFIDENCE_THRESHOLD:Av,HIGH_CONFIDENCE_THRESHOLD:.8,LAZY_LOAD_LANGUAGES:nk,get PatternMatcher(){return Sy},SemanticAnalyzerImpl:Tv,SemanticCache:Ev,get SemanticParserImpl(){return _y},get SemanticRendererImpl(){return Ay},get TokenStreamImpl(){return Wl},VERSION:"0.1.0",get addSchema(){return vu},analyze:Fv,analyzeAll:function(e,t="en",r={}){const n=[],i=[];for(const a of e){const e=Fv(a,t,r);n.push(...e.warnings),e.node&&i.push(e.node)}n.push(...Hv(i,r));const a=n.some(e=>"error"===e.severity),o={...qv,...r},s=n.some(e=>"warning"===e.severity);return{valid:o.strict?!a&&!s:!a,warnings:n,node:i[0]??null}},analyzeMultiple:Hv,get appendSchema(){return Lu},get arabicProfile(){return mc},get arabicTokenizer(){return xc},buildAST:function(e){const t=new tk;return{ast:t.build(e),warnings:t.warnings}},calculateTranslationConfidence:ak,canLoadLanguage:function(e){return e in rk},canParse:By,checkAccessibility:Wv,checkPerformance:Vv,checkSchema:Dv,get chineseProfile(){return Zf},get chineseTokenizer(){return oy},get commandSchemas(){return Pu},convertExpression:ig,convertLiteral:eg,convertPropertyPath:ng,convertReference:rg,convertSelector:tg,convertValue:Qv,createCommandNode:hy,createCompoundNode:yy,createConditionalNode:function(e,t,r,n){const i=new Map;i.set("condition",e);const a={kind:"conditional",action:"if",roles:i,thenBranch:t};return void 0!==r&&(a.elseBranch=r),void 0!==n&&(a.metadata=n),a},createEventHandler:fy,createLiteral:py,createLoopNode:function(e,t,r,n,i){const a={kind:"loop",action:e,loopVariant:t,roles:new Map(Object.entries(r)),body:n};return i?.loopVariable&&(a.loopVariable=i.loopVariable),i?.indexVariable&&(a.indexVariable=i.indexVariable),i?.metadata&&(a.metadata=i.metadata),a},createPropertyPath:dy,createReference:my,createSelector:uy,createSemanticAnalyzer:Cv,createSemanticCache:function(e){return new Ev(e)},get decrementSchema(){return Au},devModeAnalyze:function(e,t,r){if(!Uv)return;if(!r)return;const n=Fv(e,t,Kv);for(const e of n.warnings){}},disableDevMode:function(){Uv=!1},enableDevMode:function(e={}){Uv=!0,Kv=e},get englishProfile(){return Gc},get englishTokenizer(){return Qc},eventNameTranslations:gv,get fetchSchema(){return Tu},get frenchProfile(){return Np},fromExplicit:wv,generateAllPatterns:function(e,t=qu){const r=[],n=e??$u();for(const e of n){const n=Bu(e,t);r.push(...n)}return r},generatePattern:Wu,generatePatternVariants:Du,generatePatternsForCommand:function(e,t,r=qu){const n=[],i=t??$u();for(const t of i){if(!t.keywords[e.action])continue;const i=Du(e,t,r);n.push(...i)}return n},generatePatternsForLanguage:Bu,generateSimplePattern:Vu,get germanProfile(){return Mc},getAllPatterns:function(){return null===hv&&(hv=mv()),hv},getAllTranslations:function(e,t,r=["en","ja","ar","es","ko","zh","tr","pt","fr","de","id","qu","sw"]){const n={},i=zv(e,t);for(const e of r)n[e]=Py(i,e);return n.explicit=Ny(i),n},getCommandMapper:ek,getCommandType:Hy,getDefinedSchemas:Ou,getDevModeConfig:function(){return{...Kv}},getEventHandlerPatternsForLanguage:ov,getGeneratorLanguages:function(){return Object.keys(Lv)},getGeneratorSummary:function(){const e=Ml(),t=Ou().map(e=>e.action);let r=0;for(const t of e){const e=Rl(t);if(e)for(const t of Ou())e.keywords[t.action]&&(r+=2)}return{languages:e,commands:t,totalPatterns:r}},getLoadedLanguages:function(){return nk.filter(ql)},getPatternById:function(e){return yv.find(t=>t.id===e)},getPatternStats:function(){const e={},t={};for(const r of yv)e[r.language]=(e[r.language]||0)+1,t[r.command]=(t[r.command]||0)+1;return{totalPatterns:yv.length,byLanguage:e,byCommand:t}},getPatternsForLanguage:vv,getPatternsForLanguageAndCommand:function(e,t){return vv(e).filter(e=>e.command===t).sort((e,t)=>t.priority-e.priority)},getProfile:function(e){return Lv[e]},getPutPatternsForLanguage:av,getRegisteredLanguages:Ml,getRegisteredMappers:function(){return new Map(Qg)},getSchema:function(e){return Pu[e]},getSchemasByCategory:function(e){return Object.values(Pu).filter(t=>t.category===e)},getSupportedCommands:function(){const e=new Set(yv.map(e=>e.command));return Array.from(e)},getSupportedLanguages:function(){return["en","ja","ar","es","ko","zh","tr","pt","fr","de","id","qu","sw"]},getSupportedPatternLanguages:function(){const e=new Set(yv.map(e=>e.language));return Array.from(e)},getSupportedTokenizerLanguages:wy,getTogglePatternsForLanguage:iv,getTokenizer:gy,getUnloadedLanguages:function(){return nk.filter(e=>!ql(e))},getValidatorSchema:Pv,get hideSchema(){return zu},get incrementSchema(){return Cu},get indonesianProfile(){return mm},isDevModeEnabled:function(){return Uv},isExplicitSyntax:qy,isGeneratorLanguageSupported:function(e){return e in Lv},isLanguageSupported:function(e){return ql(e)},isUnifiedProfile:function(e){return!(!e||"object"!=typeof e)&&("string"==typeof e.code&&"string"==typeof e.name&&"string"==typeof e.wordOrder&&"string"==typeof e.markingStrategy&&"string"==typeof e.morphology&&"object"==typeof e.keywords&&Array.isArray(e.canonicalOrder))},get japaneseProfile(){return Xm},get japaneseTokenizer(){return ud},get koreanProfile(){return gd},get koreanTokenizer(){return Nd},languageProfiles:Lv,loadLanguage:ik,loadLanguages:async function(e,t={}){return Promise.all(e.map(e=>ik(e,t)))},markingStrategyToAdpositionType:Rv,matchBest:function(e,t){return Ty.matchBest(e,t)},matchPattern:function(e,t){return Ty.matchPattern(e,t)},normalizeEventName:function(e,t){const r=gv[t];return r&&r[e]?r[e]:e.toLowerCase()},get onSchema(){return xu},parse:Dy,parseAny:zv,parseExplicit:Iy,parseWithConfidence:function(e,t){const r=ak(e,t);if(!r.parseSuccess)return{node:null,confidence:0,error:r.error};try{const{parse:n}=(rv(),Cl(Vy));return{node:n(e,t),confidence:r.confidence,error:void 0}}catch(e){return{node:null,confidence:r.confidence,error:e instanceof Error?e.message:String(e)}}},get patternMatcher(){return Ty},get portugueseProfile(){return eh},get prependSchema(){return ju},get putSchema(){return ku},get quechuaProfile(){return mh},registerCommandMapper:function(e){Qg.set(e.action,e)},registerSchema:function(e,t){jv.set(e,t)},registerTokenizer:function(e){!function(e){yl.set(e.language,e)}(e)},get removeSchema(){return gu},render:Py,renderExplicit:Ny,rolesToCommandArgs:function(e,t){const r=[],n={};for(const[i,a]of e)switch(i){case"patient":case"event":r.push(a);break;case"destination":"put"===t?n.into=a:n.on=a;break;case"source":n.from=a;break;case"quantity":n.by=a;break;case"duration":n.over=a;break;case"method":n.as=a;break;case"style":n.with=a;break;case"condition":n.if=a;break;case"agent":n.agent=a;break;default:n[i]=a}return{args:r,modifiers:n}},roundTrip:function(e,t,r){const n=zv(e,t),i=r??t,a=qy(e)?Ny(n):Py(n,i);if(void 0!==r)return a;const o=e.trim().toLowerCase(),s=a.trim().toLowerCase();return{original:e,semantic:n,rendered:a,matches:o===s}},schemaRegistry:jv,semanticCache:Sv,get semanticParser(){return $y},get semanticRenderer(){return Ly},get setSchema(){return wu},shouldUseSemanticResult:function(e,t=.5){return e.confidence>=t&&void 0!==e.command},get showSchema(){return bu},get spanishProfile(){return wp},get spanishTokenizer(){return Lp},get swahiliProfile(){return Ih},toExplicit:kv,toGrammaticalMarker:Mv,toI18nProfile:function(e){const t=[];for(const[r,n]of Object.entries(e.roleMarkers))n&&t.push(Mv(r,n,e.markingStrategy));return{code:e.code,name:e.nativeName,wordOrder:e.wordOrder,adpositionType:Rv(e.markingStrategy),morphology:e.morphology,direction:e.direction,markers:t,canonicalOrder:e.canonicalOrder}},get toggleSchema(){return yu},tokenize:ky,translate:bv,get triggerSchema(){return Eu},tryGetProfile:Rl,get turkishProfile(){return vf},get turkishTokenizer(){return Tf},validateAndAdjustConfidence:function(e){const t=Iv(e);return{...e,confidence:Math.max(0,Math.min(1,e.confidence+t.confidenceAdjustment)),validation:t}},validateLanguageKeywords:function(e,t=Ou()){const r=[],n=[];for(const i of t)e.keywords[i.action]?n.push(i.action):r.push(i.action);return{missing:r,available:n}},validateSemanticResult:Iv,validateTranslation:function(e,t,r,n){try{const i=zv(e,r),a=zv(t,n);if(i.action!==a.action)return!1;for(const[e,t]of i.roles){const r=a.roles.get(e);if(!r)return!1;if(!xv(t,r))return!1}return!0}catch{return!1}},get waitSchema(){return Su},withCache:function(e,t=Sv){return(r,n)=>{const i=t.get(r,n);if(i)return i;const a=e(r,n);return t.set(r,n,a),a}}});let sk=null;function lk(){return sk||(sk=Cv()),sk}function ck(e){if(e&&"object"==typeof e.locals&&e.locals instanceof Map)return e;const t={me:e?.me||null,you:e?.you||null,it:e?.it||e?.result,result:e?.result,locals:new Map,globals:new Map,halted:!1,returned:!1,broke:!1,continued:!1,async:!1};if(!e)return t;if(e.locals&&"object"==typeof e.locals)for(const[r,n]of Object.entries(e.locals))t.locals.set(r,n);if(e.globals&&"object"==typeof e.globals)if(e.globals instanceof Map)for(const[r,n]of e.globals)t.globals.set(r,n);else for(const[r,n]of Object.entries(e.globals))t.globals.set(r,n);const r=new Set(["me","you","it","result","locals","globals","language"]);for(const[n,i]of Object.entries(e))r.has(n)||void 0===i||t.locals.set(n,i);return t}async function uk(e,t){if(!e||""===e.trim())throw new Error("Cannot evaluate empty script");try{const r=ck(t),n=t?.language||"en";if(function(e){const t=e.trim().toLowerCase();return[/^set\s+.+\s+to\s+.+/,/^put\s+.+\s+(into|before|after)\s+.+/,/^add\s+.+(\s+to\s+.+)?/,/^remove\s+.+(\s+from\s+.+)?/,/^show\s+.+/,/^hide\s+.+/,/^toggle\s+.+/,/^log\s+.*/,/^wait\s+.+/,/^call\s+.+/,/^send\s+.+/,/^make\s+.+/,/^increment\s+.+/,/^decrement\s+.+/,/^fetch\s+.+/,/^throw\s+.+/,/^return\s+.+/,/^break/,/^continue/,/^halt/,/^go\s+.+/,/^if\s+.+/,/^repeat\s+.+/,/^on\s+.+/,/^render\s+.+/].some(e=>e.test(t))}(e))return await async function(e,t,r="en"){const n=J(e),i=new ei(n,{semanticAnalyzer:lk(),language:r,semanticConfidenceThreshold:Av}),a=i.parse();if(!a.success||!a.node)throw new Error(`Parse error: ${a.error?.message||"Unknown parse error"}`);const o=new fl,s=await o.execute(a.node,t);return s}(e,r,n);return await cn(e,r)}catch(e){if(e instanceof Error)throw new Error(`HyperScript evaluation error: ${e.message}`);throw e}}async function pk(e,t){if(!e||""===e.trim())throw new Error("Cannot evaluate empty expression");try{const r=ck(t);return await cn(e,r)}catch(e){if(e instanceof Error)throw new Error(`HyperScript evaluation error: ${e.message}`);throw e}}async function mk(e,t){if(function(e){const t=e.toLowerCase();return["fetch","wait","settle","async","promise"].some(e=>t.includes(e))}(e))return pk(e,t);try{return uk(e,t)}catch(r){if(r instanceof Error&&r.message.includes("Async expressions not yet supported"))return pk(e,t);throw r}}function dk(e){const{target:t,strategy:r="morph",useViewTransition:n=!1,fetchOptions:i={},transformUrl:a,onBeforeFetch:o,onAfterSwap:s,onError:l}=e,c=async e=>{const c=(()=>{if("string"==typeof t){const e=document.querySelector(t);return Vi(e)?e:null}return Vi(t)?t:null})();if(!c)return;let u=window.location.href;a&&(u=a(u));try{o&&await o(u),c.classList.add("hx-swapping");const e=await fetch(u,{method:"GET",headers:{Accept:"text/html","HX-Request":"true","HX-History-Restore-Request":"true"},...i});if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);const a=await e.text(),l=()=>{Uo(c,a,r)};n&&bo()?await To(l):l(),c.classList.remove("hx-swapping"),s&&await s(u,a),ns(window,"historyswap",{url:u,strategy:r,target:t})}catch(e){c.classList.remove("hx-swapping"),l&&l(e,u)}};return window.addEventListener("popstate",c),{destroy:()=>{window.removeEventListener("popstate",c)},config:e}}const hk={name:"HistorySwap",init:(e,t={})=>dk({target:t.target||e,strategy:t.strategy||"morph",useViewTransition:Boolean(t.useViewTransition)}),destroy(e){e.destroy()}};function fk(e){return!function(e){try{return new URL(e,window.location.origin).origin!==window.location.origin}catch{return!1}}(e.href)&&((!e.target||"_self"===e.target)&&(!e.hasAttribute("download")&&(!e.hasAttribute("data-no-boost")&&!e.hasAttribute("hx-boost-off")&&("javascript:"!==e.protocol&&"mailto:"!==e.protocol))))}function yk(e){const{container:t,target:r,linkSelector:n="a[href]",formSelector:i="form",boostForms:a=!1,strategy:o="morph",pushUrl:s=!0,useViewTransition:l=!1,fetchOptions:c={},onBeforeFetch:u,onAfterSwap:p,onError:m}=e,d=async(e,n="GET",i=null)=>{const a=(()=>{if(!r)return document.body;if("string"==typeof r){const e=document.querySelector(r);return Vi(e)?e:null}return Vi(r)?r:null})();if(a)try{if(u){if(!1===await u(e,n))return}a.classList.add("hx-swapping"),t.classList.add("hx-boosting");const m={method:n,headers:{Accept:"text/html","HX-Request":"true","HX-Boosted":"true"},...c};i&&"GET"!==n&&(m.body=i);const d=await fetch(e,m);if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);const h=await d.text(),f=()=>{Uo(a,h,o)};l&&bo()?await To(f):f(),a.classList.remove("hx-swapping"),t.classList.remove("hx-boosting"),s&&"GET"===n&&window.history.pushState(null,"",e),p&&await p(e,h),ns(window,"boosted",{url:e,method:n,strategy:o,target:r})}catch(r){a.classList.remove("hx-swapping"),t.classList.remove("hx-boosting"),m?m(r,e):window.location.href=e}},h=async e=>{const t=e.target.closest(n);t&&function(e){return!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)&&0===e.button}(e)&&fk(t)&&(e.preventDefault(),e.stopPropagation(),await d(t.href))},f=async e=>{if(!a)return;const t=e.target.closest(i);if(!t)return;if(t.hasAttribute("data-no-boost")||t.hasAttribute("hx-boost-off"))return;if(t.target&&"_self"!==t.target)return;e.preventDefault(),e.stopPropagation();const r=(t.method||"GET").toUpperCase(),n=new FormData(t);let o,s=null;if("GET"===r){const e=new URLSearchParams;n.forEach((t,r)=>{e.append(r,String(t))}),o=`${t.action||window.location.pathname}?${e.toString()}`}else o=t.action||window.location.pathname,s=n;await d(o,r,s)};return t.addEventListener("click",h),a&&t.addEventListener("submit",f),{destroy:()=>{t.removeEventListener("click",h),t.removeEventListener("submit",f)},config:e,boost:d}}const vk={name:"Boosted",init:(e,t={})=>yk({container:e,target:t.target,linkSelector:t.linkSelector||"a[href]",formSelector:t.formSelector||"form",boostForms:Boolean(t.boostForms),strategy:t.strategy||"morph",pushUrl:!1!==t.pushUrl,useViewTransition:Boolean(t.useViewTransition)}),destroy(e){e.destroy()}};const gk="click";let kk,wk,bk;function zk(e,t,r){r.errors?.length&&r.errors.forEach((e,t)=>{}),t.split("\n")}async function xk(e,t){try{return await bk().execute(e,t)}catch(e){throw e}}function Ek(e,t,r){try{const n=function(e){try{if(function(e){return"eventHandler"===e.type}(e)){return{eventType:e.event||gk,body:{type:"CommandSequence",commands:e.commands||[],start:e.start||0,end:e.end||0,line:e.line||1,column:e.column||1}}}if(function(e){return"FeatureNode"===e.type}(e)&&"on"===e.name){return{eventType:e.args?.[0]?.value||gk,body:e.body||e}}return"CommandSequence"===e.type||"Block"===e.type?{eventType:gk,body:e}:null}catch(e){return null}}(t);if(!n)return;e.addEventListener(n.eventType,async e=>{try{r.locals.set("event",e),r.locals.set("target",e.target),await xk(n.body,r)}catch(e){}})}catch(e){}}function Sk(e){return si(e)}function Tk(e,t){const r=function(e){const t=e.getAttribute("data-lang");if(t)return t;const r=e.closest("[lang]")?.getAttribute("lang");if(r)return r.split("-")[0];if("undefined"!=typeof document){const e=document.documentElement?.lang;if(e)return e.split("-")[0]}return"en"}(e);"en"===r?function(e,t){try{const r=kk(t);if(!r.ok)return void zk(0,t,r);if(!r.ast)return;const n=Sk(e);if(t.trim().startsWith("on "))try{Ek(e,r.ast,n)}catch(e){throw e}else xk(r.ast,n)}catch(e){}}(e,t):async function(e,t,r){try{const n=await wk(t,{language:r});if(!n.ok)return void zk(0,t,n);if(!n.ast)return;const i=Sk(e);t.trim().startsWith("on ")||"eventHandler"===n.ast.type?Ek(e,n.ast,i):xk(n.ast,i)}catch(e){}}(e,t,r)}const Ck="en";let Ak=null,Lk=null;const jk={semantic:!0,language:"en",confidenceThreshold:Av};async function Pk(){if(!Lk){const{SemanticGrammarBridge:e}=await Promise.resolve().then(function(){return Fk});Lk=new e,await Lk.initialize()}return Lk}let Nk=null;function Ok(){if(!Nk&&(Nk=new fl({lazyLoad:!1}),(e=Nk.behaviorRegistry)instanceof Map||e&&"function"==typeof e.set?e.set("HistorySwap",hk):e&&"object"==typeof e&&(e.HistorySwap=hk),function(e){e instanceof Map||e&&"function"==typeof e.set?e.set("Boosted",vk):e&&"object"==typeof e&&(e.Boosted=vk)}(Nk.behaviorRegistry),"undefined"!=typeof globalThis)){const e=globalThis;e._hyperscript=e._hyperscript||{},e._hyperscript.runtime=Nk,e._hyperscript.behaviors=Nk.behaviorAPI}var e;return Nk}async function Ik(e,t){if(!e)throw new Error("AST is required for execution");const r=t||si();return await Ok().execute(e,r)}function Rk(e,t){if("string"!=typeof e)throw new TypeError("Code must be a string");const r=performance.now(),n=t?.language||Ck;try{const a=t?.traditional??!1,o=a?{}:jk.semantic?{semanticAnalyzer:(Ak||(Ak=Cv()),Ak),language:jk.language,semanticConfidenceThreshold:jk.confidenceThreshold}:{},s=!a,l=function(e,t){const r=J(e);return new ei(r,t,e).parse()}(e,o),c=performance.now()-r;return l.success&&l.node?{ok:!0,ast:l.node,meta:{parser:s?"semantic":"traditional",language:n,timeMs:c}}:{ok:!1,errors:l.error?[(i=l.error,{message:i.message,line:i.line??1,column:i.column??1})]:[],meta:{parser:s?"semantic":"traditional",language:n,timeMs:c}}}catch(i){const e=performance.now()-r;return{ok:!1,errors:[{message:i instanceof Error?i.message:"Unknown compilation error",line:1,column:1}],meta:{parser:"traditional",language:n,timeMs:e}}}var i}async function Mk(e,t){if("string"!=typeof e)throw new TypeError("Code must be a string");const r=t?.language||Ck,n=performance.now();if(r===Ck||t?.traditional)return Rk(e,t);try{const i=await Pk(),a=await i.parseToASTWithDetails(e,r);if(a.usedDirectPath&&a.ast){const e=performance.now()-n;return{ok:!0,ast:a.ast,meta:{parser:"semantic",confidence:a.confidence,language:r,timeMs:e,directPath:!0}}}const o=Rk(a.fallbackText||e,{...t,language:Ck});return{...o,meta:{...o.meta,language:r,confidence:a.confidence,directPath:!1}}}catch{return Rk(e,{...t,language:"en"})}}!function(e,t,r){kk=e,wk=t,bk=r}(Rk,Mk,Ok);const qk={compile:Mk,compileSync:Rk,execute:Ik,eval:async function(e,t,r){if("string"!=typeof e||0===e.trim().length)throw new Error("Code must be a non-empty string");let n;if(t)if(t instanceof Element)n=si(t);else if("object"==typeof(i=t)&&null!==i&&"locals"in i&&i.locals instanceof Map)n=t;else{const e=t;n=function(e){return"object"==typeof e&&null!==e&&"me"in e}(e)?si(e.me):si()}else n=si();var i;const a=await Mk(e.trim(),r);if(!a.ok){throw new Error(`Compilation failed: ${a.errors?.[0]?.message||"Unknown compilation error"}`)}return Ik(a.ast,n)},validate:async function(e,t){const r=await Mk(e,t);return{valid:r.ok,errors:r.errors}},process:function(e){try{const t=e.getAttribute("_");t&&Tk(e,t);e.querySelectorAll("[_]").forEach(e=>{const t=e.getAttribute("_");t&&Tk(e,t)})}catch(e){}},createContext:function(e,t){return t?function(e,t){return{me:t||null,it:null,you:null,result:null,locals:new Map,globals:e.globals,parent:e,flags:{halted:!1,breaking:!1,continuing:!1,returning:!1,async:!1}}}(t,e):si(e)},config:jk,version:"2.0.0",createRuntime:function(e){return new fl(e)},registerHooks:(e,t)=>{Ok().registerHooks(e,t)},unregisterHooks:e=>Ok().unregisterHooks(e),getRegisteredHooks:()=>Ok().getRegisteredHooks()};const _k=new class{constructor(e={}){this.processedElements=new WeakSet,this.observer=null,this.processedCount=0,this.readyEventDispatched=!1,this.initialized=!1,this.options={attributeName:"_",autoScan:!0,processOnlyNewElements:!0,...e}}async init(){"undefined"!=typeof document&&(this.initialized||(this.initialized=!0,this.options.autoScan&&(await this.scanAndProcessAll(),this.dispatchReadyEvent()),this.setupMutationObserver()))}async scanAndProcessAll(){"undefined"!=typeof window&&window.__hyperfixi_behaviors_ready&&await window.__hyperfixi_behaviors_ready;const e=document.querySelectorAll('script[type="text/hyperscript"]');for(const t of e)t instanceof HTMLScriptElement&&(t.textContent?.substring(0,50),await this.processHyperscriptTag(t));const t=document.querySelectorAll(`[${this.options.attributeName}]`),r=[];t.forEach(e=>{e instanceof HTMLElement&&r.push(this.processElementAsync(e))}),await Promise.all(r),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("lokascript:initialized",{detail:{scriptsProcessed:e.length,elementsProcessed:t.length}}))}async processHyperscriptTag(e){const t=e.getAttribute("for");t?await this.processHyperscriptTagForElements(e,t):await this.processHyperscriptTagGlobal(e)}async processHyperscriptTagForElements(e,t){const r=e.textContent||e.innerHTML;if(!r||!r.trim())return;const n=document.querySelectorAll(t);if(0!==n.length)try{r.substring(0,50);const e=qk.compileSync(r);if(!e.ok)return;for(const t of n)if(t instanceof HTMLElement){const r=si(t);await qk.execute(e.ast,r)}}catch(e){}}async processHyperscriptTagGlobal(e){const t=e.textContent||e.innerHTML;if(t&&t.trim())try{t.substring(0,50);const e=si(null),r=qk.compileSync(t);if(!r.ok)return;await qk.execute(r.ast,e)}catch(e){}}processElement(e){this.processElementAsync(e)}async processElementAsync(e){if(this.options.processOnlyNewElements&&this.processedElements.has(e))return;const t=e.getAttribute(this.options.attributeName);if(t)try{const r=si(e),n=qk.compileSync(t);if(!n.ok)return JSON.stringify(n.errors,null,2),void(n.errors||[]).forEach((e,t)=>{});await qk.execute(n.ast,r),this.processedElements.add(e),this.processedCount++,this.dispatchLoadEvent(e)}catch(e){}}dispatchLoadEvent(e){try{const t=new Event("load",{bubbles:!1,cancelable:!1});e.dispatchEvent(t)}catch(e){}}dispatchReadyEvent(){if(!this.readyEventDispatched)try{const e=new CustomEvent("hyperscript:ready",{bubbles:!0,cancelable:!1,detail:{processedElements:this.processedCount,timestamp:Date.now()}});document.dispatchEvent(e),this.readyEventDispatched=!0}catch(e){}}setupMutationObserver(){"undefined"!=typeof MutationObserver&&(this.observer=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;"SCRIPT"===t.tagName&&"text/hyperscript"===t.getAttribute("type")&&this.processHyperscriptTag(t).catch(e=>{});const r=t.querySelectorAll?.('script[type="text/hyperscript"]');r?.forEach(e=>{e instanceof HTMLScriptElement&&this.processHyperscriptTag(e).catch(e=>{})}),t.getAttribute&&t.getAttribute(this.options.attributeName)&&this.processElementAsync(t).catch(e=>{});const n=t.querySelectorAll?.(`[${this.options.attributeName}]`);n?.forEach(e=>{e instanceof HTMLElement&&this.processElementAsync(e).catch(e=>{})})}})})}),this.observer.observe(document.body,{childList:!0,subtree:!0}))}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.initialized=!1,this.readyEventDispatched=!1,this.processedCount=0}reset(){this.destroy()}};const $k=new class{constructor(){this.defaultStrategy=null,this.strategies={twDisplay:this.createDisplayStrategy(),twVisibility:this.createVisibilityStrategy(),twOpacity:this.createOpacityStrategy()}}getStrategies(){return{...this.strategies}}setDefaultStrategy(e){if(!this.strategies[e])throw new Error(`Unknown Tailwind strategy: ${e}`);this.defaultStrategy=e}getDefaultStrategy(){return this.defaultStrategy}resetDefaultStrategy(){this.defaultStrategy=null}async executeStrategy(e,t,r){if(!r)throw new Error("Element is required");if(!this.strategies[e])throw new Error(`Unknown Tailwind strategy: ${e}`);if(!["hide","show","toggle"].includes(t))throw new Error(`Invalid operation: ${t}`);await this.strategies[e](t,r)}async executeWithDefaultStrategy(e,t){if(!this.defaultStrategy)throw new Error("No default strategy set");await this.executeStrategy(this.defaultStrategy,e,t)}createDisplayStrategy(){return async(e,t)=>{switch(e){case"toggle":t.classList.contains("hidden")?await this.executeStrategy("twDisplay","show",t):await this.executeStrategy("twDisplay","hide",t);break;case"hide":t.classList.add("hidden");break;case"show":t.classList.remove("hidden")}}}createVisibilityStrategy(){return async(e,t)=>{switch(e){case"toggle":t.classList.contains("invisible")?await this.executeStrategy("twVisibility","show",t):await this.executeStrategy("twVisibility","hide",t);break;case"hide":t.classList.add("invisible");break;case"show":t.classList.remove("invisible")}}}createOpacityStrategy(){return async(e,t)=>{switch(e){case"toggle":t.classList.contains("opacity-0")?await this.executeStrategy("twOpacity","show",t):await this.executeStrategy("twOpacity","hide",t);break;case"hide":t.classList.add("opacity-0");break;case"show":t.classList.remove("opacity-0")}}}};class Wk{constructor(e,t,r=0){this.pool=[],this.index=0,this.metrics={allocations:0,reuses:0,peakPoolSize:0},this.factory=e,this.reset=t;for(let t=0;t<r;t++)this.pool.push(e());this.metrics.allocations=r,this.metrics.peakPoolSize=r}get(){let e;return this.index<this.pool.length?(e=this.pool[this.index++],this.metrics.reuses++,this.reset&&this.reset(e)):(e=this.factory(),this.pool.push(e),this.index++,this.metrics.allocations++,this.pool.length>this.metrics.peakPoolSize&&(this.metrics.peakPoolSize=this.pool.length)),e}releaseAll(){this.index=0}getMetrics(){const e=this.metrics.allocations+this.metrics.reuses;return{...this.metrics,hitRate:e>0?this.metrics.reuses/e*100:0}}clear(){this.pool=[],this.index=0,this.metrics={allocations:0,reuses:0,peakPoolSize:0}}}const Vk=new class{constructor(){this.pending=new Map,this.rafId=null,this.stylePool=new Wk(()=>({}),e=>{for(const t of Object.keys(e))delete e[t]},10)}add(e,t){let r=this.pending.get(e);r||(r=this.stylePool.get(),this.pending.set(e,r)),Object.assign(r,t),this.rafId||(this.rafId=requestAnimationFrame(()=>this.flush()))}flush(){for(const[e,t]of this.pending)for(const[r,n]of Object.entries(t))if(r.startsWith("--"))e.style.setProperty(r,n);else{const t=r.replace(/-([a-z])/g,e=>e[1].toUpperCase());e.style[t]=n}this.pending.clear(),this.stylePool.releaseAll(),this.rafId=null}cancel(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pending.clear(),this.stylePool.releaseAll()}getPendingCount(){return this.pending.size}getPoolMetrics(){return this.stylePool.getMetrics()}},Dk={evalHyperScript:uk,evalHyperScriptAsync:pk,evalHyperScriptSmart:mk,evaluate:uk,compile:(e,t)=>{const r=qk.compileSync(e,t);if(!r.ok){throw new Error(r.errors&&r.errors.length>0?r.errors[0].message:"Compilation failed")}return r},compileSync:(e,t)=>qk.compileSync(e,t),compileMultilingual:async(e,t)=>qk.compile(e,{language:t}),execute:qk.execute,run:async(e,t)=>qk.eval(e,t),createContext:qk.createContext,createRuntime:qk.createRuntime,Parser:ei,Runtime:fl,tokenize:J,processNode:async e=>(e===document?_k.scanAndProcessAll():e instanceof HTMLElement&&_k.processElement(e),Promise.resolve()),process:e=>Dk.processNode(e),attributeProcessor:_k,tailwindExtension:$k,styleBatcher:Vk,ObjectPool:Wk,debug:t,debugControl:r,semantic:{createAnalyzer:Cv,parse:Dy,translate:bv,render:Py,toExplicit:kv,fromExplicit:wv,supportedLanguages:["ar","bn","de","en","es","fr","hi","id","it","ja","ko","ms","pl","pt","qu","ru","sw","th","tl","tr","uk","vi","zh"]},semanticDebug:{enable:function(e){Sn=!0,Tn=e??("undefined"!=typeof window?window:null)},disable:function(){Sn=!1},isEnabled:Cn,getStats:function(){return{...An}},resetStats:function(){An={totalParses:0,semanticSuccesses:0,semanticFallbacks:0,traditionalParses:0,averageConfidence:0,confidenceHistory:[]},jn=[]},getEventHistory:function(){return[...jn]},replayEvents:function(e){for(const t of jn)e(t)}},config:jk,registerHooks:qk.registerHooks,unregisterHooks:qk.unregisterHooks,getRegisteredHooks:qk.getRegisteredHooks,version:"2.0.0-full"};"undefined"!=typeof window&&(window.lokascript=Dk,void 0===window.hyperfixi&&Object.defineProperty(window,"hyperfixi",{get:()=>window.lokascript,enumerable:!0,configurable:!0}),window.evalHyperScript=uk,window.evalHyperScriptAsync=pk,window.evalHyperScriptSmart=mk,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{_k.init()}):_k.init());let Bk=null;async function Hk(){return Bk||(Bk=await Promise.resolve().then(function(){return ok})),Bk}var Fk=Object.freeze({__proto__:null,SemanticGrammarBridge:class{constructor(e={}){this.analyzer=null,this.config={confidenceThreshold:e.confidenceThreshold??Av,fallbackOnLowConfidence:e.fallbackOnLowConfidence??!0}}async initialize(){const e=await Hk();this.analyzer=e.createSemanticAnalyzer()}isInitialized(){return null!==this.analyzer}async transform(e,t,r){if(this.isInitialized()||await this.initialize(),t===r)return{output:e,usedSemantic:!1,confidence:1,sourceLang:t,targetLang:r};const n=await Hk();try{const i=n.translate(e,t,r);if(i!==e)return{output:i,usedSemantic:!0,confidence:.9,sourceLang:t,targetLang:r}}catch{}return{output:e,usedSemantic:!1,confidence:0,sourceLang:t,targetLang:r}}async parse(e,t){if(this.isInitialized()||await this.initialize(),!this.analyzer)return null;return this.analyzer.analyze(e,t).node??null}async render(e,t){return(await Hk()).render(e,t)}async parseToAST(e,t){if(this.isInitialized()||await this.initialize(),!this.analyzer)return null;const r=this.analyzer.analyze(e,t);if(r.confidence>=this.config.confidenceThreshold&&r.node){const e=await Hk();try{return e.buildAST(r.node).ast}catch(e){}}return null}async parseToASTWithDetails(e,t){if(this.isInitialized()||await this.initialize(),!this.analyzer)return{ast:null,usedDirectPath:!1,confidence:0,lang:t,fallbackText:null};const r=this.analyzer.analyze(e,t),n=await Hk();if(r.confidence>=this.config.confidenceThreshold&&r.node)try{const e=n.buildAST(r.node);return{ast:e.ast,usedDirectPath:!0,confidence:r.confidence,lang:t,fallbackText:null,warnings:e.warnings}}catch{}if(r.node&&this.config.fallbackOnLowConfidence){const e=n.render(r.node,"en");return{ast:null,usedDirectPath:!1,confidence:r.confidence,lang:t,fallbackText:e}}return{ast:null,usedDirectPath:!1,confidence:r.confidence,lang:t,fallbackText:null}}async getAllTranslations(e,t){const r=(await Hk()).getSupportedLanguages(),n={};for(const i of r)n[i]=await this.transform(e,t,i);return n}}});return Dk}();
|
|
2
|
+
//# sourceMappingURL=lokascript-browser.js.map
|