@hyperscript-tools/multilingual 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +118 -0
- package/dist/hyperscript-i18n-ar.global.js +4 -0
- package/dist/hyperscript-i18n-bn.global.js +4 -0
- package/dist/hyperscript-i18n-de.global.js +4 -0
- package/dist/hyperscript-i18n-east-asian.global.js +4 -0
- package/dist/hyperscript-i18n-en.global.js +6 -0
- package/dist/hyperscript-i18n-es.global.js +4 -0
- package/dist/hyperscript-i18n-fr.global.js +4 -0
- package/dist/hyperscript-i18n-he.global.js +4 -0
- package/dist/hyperscript-i18n-hi.global.js +4 -0
- package/dist/hyperscript-i18n-id.global.js +4 -0
- package/dist/hyperscript-i18n-it.global.js +4 -0
- package/dist/hyperscript-i18n-ja.global.js +4 -0
- package/dist/hyperscript-i18n-ko.global.js +4 -0
- package/dist/hyperscript-i18n-lite.global.js +1 -0
- package/dist/hyperscript-i18n-ms.global.js +4 -0
- package/dist/hyperscript-i18n-pl.global.js +4 -0
- package/dist/hyperscript-i18n-pt.global.js +4 -0
- package/dist/hyperscript-i18n-qu.global.js +4 -0
- package/dist/hyperscript-i18n-ru.global.js +4 -0
- package/dist/hyperscript-i18n-slavic.global.js +4 -0
- package/dist/hyperscript-i18n-south-asian.global.js +4 -0
- package/dist/hyperscript-i18n-southeast-asian.global.js +4 -0
- package/dist/hyperscript-i18n-sw.global.js +4 -0
- package/dist/hyperscript-i18n-th.global.js +4 -0
- package/dist/hyperscript-i18n-tl.global.js +4 -0
- package/dist/hyperscript-i18n-tr.global.js +4 -0
- package/dist/hyperscript-i18n-uk.global.js +4 -0
- package/dist/hyperscript-i18n-vi.global.js +4 -0
- package/dist/hyperscript-i18n-western.global.js +4 -0
- package/dist/hyperscript-i18n-zh.global.js +4 -0
- package/dist/hyperscript-i18n.global.js +63 -0
- package/package.json +101 -4
- package/scripts/copy-bundles.mjs +25 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function T(t,e){return e?{type:"literal",value:t,dataType:e}:{type:"literal",value:t}}function me(t,e){return e?{type:"selector",value:t,selectorKind:e}:{type:"selector",value:t}}function ee(t){return {type:"reference",value:t}}function pe(t,e){return {type:"property-path",object:t,property:e}}var Re=new Set(["me","you","it","result","event","target","body"]);function be(t,e=Re){return e.has(t)}var Rr=class{constructor(t){this.namespace=t,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let t=process.env.DEBUG||"";return t==="*"||t.includes("framework:*")||t.includes(`framework:${this.namespace}`)}return false}log(t,e,...r){if(!this.enabled)return;let i=`[framework:${this.namespace}]`,a=new Date().toISOString();switch(t){case "debug":console.debug(`${a} ${i} DEBUG:`,e,...r);break;case "info":console.info(`${a} ${i} INFO:`,e,...r);break;case "warn":console.warn(`${a} ${i} WARN:`,e,...r);break;case "error":console.error(`${a} ${i} ERROR:`,e,...r);break}}debug(t,...e){this.log("debug",t,...e);}info(t,...e){this.log("info",t,...e);}warn(t,...e){this.log("warn",t,...e);}error(t,...e){this.log("error",t,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function Nr(t){return new Rr(t)}function G(t,e){return !e||e.length===0||e.includes(t)||e.includes("expression")?true:t==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function _r(t,e){return t?.possessive?.keywords?.[e]}var re=class H{constructor(){this.logger=Nr("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,r,i){let a=e.mark(),n=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",r.id),this.logger.debug("Pattern command:",r.command),this.logger.debug("Pattern language:",r.language),this.logger.debug("Pattern template:",JSON.stringify(r.template,null,2)),this.logger.isEnabled()){let u=[];for(let l=0;l<10;l++){let c=e.peek(l);if(c)u.push({type:c.type,value:c.value,kind:c.kind});else break}this.logger.debug("Input tokens (first 10):",u),this.logger.debug("Profile code:",i?.code);}this.currentProfile=i,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(r.template.tokens,null,2));let o=this.matchTokenSequence(e,r.template.tokens,n);if(this.logger.debug("matchTokenSequence returned:",o),this.logger.debug("Captured roles:",Array.from(n.entries()).map(([u,l])=>[u,JSON.stringify(l)])),!o)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(a),null;let s=this.calculateConfidence(r,n);return this.applyExtractionRules(r,n),{pattern:r,captured:n,consumedTokens:e.position()-a.position,confidence:s}}matchBest(e,r,i){let a=[];for(let o of r){let s=e.mark(),u=this.matchPattern(e,o,i);u&&a.push(u),e.reset(s);}if(a.length===0)return null;a.sort((o,s)=>{let u=s.pattern.priority-o.pattern.priority;if(u!==0)return u;let l=s.confidence-o.confidence;return Math.abs(l)>.001?l:s.consumedTokens-o.consumedTokens});let n=a[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,r,i,a){let n=r[0],o=n?.type==="literal"&&(n.value==="and"||n.value==="then"||n.alternatives?.includes("and")||n.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();let s=null,u=null;for(let l=0;l<r.length;l++){let c=r[l];this.logger.debug(" >> Matching pattern token:",JSON.stringify(c,null,2));let m=e.peek();if(this.logger.debug(" >> Current input token:",m?JSON.stringify({type:m.type,value:m.value,kind:m.kind}):"EOF"),c.type==="role"&&c.greedy){let h=this.collectStopMarkers(r,l+1);if(a)for(let z of a)h.add(z);let g=[];for(;!e.isAtEnd();){let z=e.peek();if(!z||this.isStopMarker(z,h))break;g.push(z.value),e.advance();}if(g.length>0){i.set(c.role,{type:"expression",raw:g.join(" ")}),s=null,u=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let h=this.collectStopMarkers(r,l+1);if(a)for(let z of a)h.add(z);if(this.matchGroupToken(e,c,i,h)){s=null,u=null;continue}if(this.isOptional(c))continue;return false}let p=c.type==="role"&&c.optional===true,d=p?e.mark():null;if(c.type==="role"&&!p){let h=l+1<r.length?r[l+1]:null;if(h?.type==="literal"){let g=e.peek();if(g&&this.getMatchType(g,h.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(c))continue;if(s&&u){this.logger.debug(" >> BACKTRACKING: undoing optional role",u),e.reset(s),i.delete(u),s=null,u=null;let z=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",z),z)continue}return false}}}let v=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Match result:",v),v){p?(s=d,u=c.role):(s=null,u=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(c)){if(s&&u){this.logger.debug(" >> BACKTRACKING: undoing optional role",u),e.reset(s),i.delete(u),s=null,u=null;let h=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",h),h)continue}return false}}return true}matchPatternToken(e,r,i){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,i);case "group":return this.matchGroupToken(e,r,i);default:return false}}matchLiteralToken(e,r){let i=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",r.value),this.logger.debug(" >>> matchLiteralToken: got token",i?JSON.stringify({type:i.type,value:i.value,kind:i.kind}):"null"),!i)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let a=this.getMatchType(i,r.value);if(this.logger.debug(" >>> matchType for",i.value,"vs",r.value,":",a),a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let n of r.alternatives){let o=this.getMatchType(i,n);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,i){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",r.role),this.logger.debug(" >>> matchRoleToken: expected types",r.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",r.optional),this.skipNoiseWords(e);let a=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",a?JSON.stringify({value:a.value,kind:a.kind}):"null"),!a)return r.optional||false;let n=this.tryMatchPossessiveExpression(e);if(n)return r.expectedTypes&&r.expectedTypes.length>0&&!G(n.type,r.expectedTypes)?r.optional||false:(i.set(r.role,n),true);let o=this.tryMatchMethodCallExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!G(o.type,r.expectedTypes)?r.optional||false:(i.set(r.role,o),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!G(s.type,r.expectedTypes)?r.optional||false:(i.set(r.role,s),true);let u=this.tryMatchPropertyAccessExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!G(u.type,r.expectedTypes)?r.optional||false:(i.set(r.role,u),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return r.expectedTypes&&r.expectedTypes.length>0&&!G(l.type,r.expectedTypes)?r.optional||false:(i.set(r.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",a?JSON.stringify({value:a.value,kind:a.kind}):"null");let c=this.tokenToSemanticValue(a);return this.logger.debug(" >>> tokenToSemanticValue returned:",c?JSON.stringify(c):"null"),c?(this.logger.debug(" >>> Validating type:",c.type,"against expected:",r.expectedTypes),r.expectedTypes&&r.expectedTypes.length>0&&!G(c.type,r.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",r.optional||false),r.optional||false):(this.logger.debug(" >>> Type validation PASSED"),i.set(r.role,c),e.advance(),true)):r.optional||false}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let i=r.normalized||r.value,a=this.safeToLowerCase(i),n=_r(this.currentProfile,a);if(!n)return null;let o=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(o),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let u=s.value;s.kind==="selector"&&u.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u)&&(u=u.substring(1));let l=u;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let c=e.peek();return c?.kind==="literal"&&c.value.startsWith("(")&&(l+=c.value,e.advance()),pe(ee(n),l)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(i),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(i),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<H.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}s.push(l.value),e.advance();}return {type:"expression",raw:`${r.value}.${n.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(i),null;e.advance();let o=`${r.value}.${n.value}`,s=1;for(;!e.isAtEnd()&&s<H.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),o+=`.${c.value}`,s++;}let u=e.peek();if(u&&u.kind==="punctuation"&&u.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<H.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(c===0){e.advance();break}c--;}if(p.kind==="punctuation"&&p.value==="("&&c++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${o}(${l.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="'s")return e.reset(i),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"&&n.kind!=="identifier"?(e.reset(i),null):(e.advance(),pe(me(r.value),n.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||typeof r.value!="string"||!r.value.startsWith("#"))return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="selector"||!a.value.startsWith("."))return e.reset(i),null;let n=e.peek(1);n&&n.kind,e.advance();let o=a.value.slice(1);return pe(me(r.value),o)}matchGroupToken(e,r,i,a){let n=e.mark(),o=new Set(i.keys());if(this.matchTokenSequence(e,r.tokens,i,a))return true;e.reset(n);for(let l of i.keys())o.has(l)||i.delete(l);if(!r.optional)return false;let u=this.getGroupLeadingMarker(r);if(u)for(let l=1;l<=H.MAX_MARKER_SCAN;l++){let c=e.peek(l);if(!c)break;if((c.normalized||c.value).toLowerCase()===u){this.logger.debug(" >> MARKER SCAN: found",u,"at offset",l,"- skipping intervening tokens");for(let d=0;d<l;d++)e.advance();if(this.matchTokenSequence(e,r.tokens,i,a))return true;e.reset(n);for(let d of i.keys())o.has(d)||i.delete(d);break}}return true}getGroupLeadingMarker(e){let r=e.tokens[0];return r?.type==="literal"?r.value.toLowerCase():null}getMatchType(e,r){return e.value===r?"exact":e.normalized===r?"normalized":e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===r.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,r){let i=new Set;for(let a=r;a<e.length;a++){let n=e[a];if(n.type==="literal"){if(i.add(n.value.toLowerCase()),n.alternatives)for(let o of n.alternatives)i.add(o.toLowerCase());break}if(n.type==="group"){for(let o of n.tokens)if(o.type==="literal"){if(i.add(o.value.toLowerCase()),o.alternatives)for(let s of o.alternatives)i.add(s.toLowerCase());break}if(!n.optional)break}}return i}isStopMarker(e,r){return r.size===0?false:!!(r.has(e.value.toLowerCase())||e.normalized&&r.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return me(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=e.normalized||e.value;this.safeToLowerCase(r);return T(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return ee(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return T(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let a=e.slice(1,-1);return T(a,"string")}if(e==="true")return T(true,"boolean");if(e==="false")return T(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let a=parseFloat(r[1]);return r[2]?T(e,"duration"):T(a,"number")}let i=parseFloat(e);return isNaN(i)?T(e,"string"):T(i,"number")}applyExtractionRules(e,r){for(let[i,a]of Object.entries(e.extraction))r.has(i)||(a.value!==void 0?r.set(i,{type:"literal",value:a.value}):a.default&&r.set(i,a.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,r){let i=0,a=0,n=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")a+=1,r.has(l.role)&&(i+=1);else if(l.type==="group"){for(let c of l.tokens)if(c.type==="role"){let m=n(c.role),p=.8;a+=p,r.has(c.role)?i+=p:m&&(i+=p*.6);}}let o=a>0?i/a:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;o=Math.max(.5,o-l);}let s=this.calculateVSOConfidenceBoost(e);o=Math.min(1,o+s);let u=this.arabicPrepositionDisambiguation(e,r);return o=Math.max(0,Math.min(1,o+u)),o}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let r=e.template.tokens[0];if(!r||r.type!=="literal")return 0;let i=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(i.has(r.value))return .15;if(r.alternatives){for(let a of r.alternatives)if(i.has(a))return .15}return 0}arabicPrepositionDisambiguation(e,r){if(e.language!=="ar")return 0;let i=0,a={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[n,o]of r.entries()){let s=a[n];if(!s||s.length===0)continue;let u="metadata"in o?o.metadata:void 0;if(u&&typeof u.prepositionValue=="string"){let l=u.prepositionValue;s.includes(l)?i+=.1:i-=.1;}}return Math.max(-0.1,Math.min(.1,i))}skipNoiseWords(e){let r=e.peek();if(!r)return;let i=this.safeToLowerCase(r.value);if(H.ENGLISH_NOISE_WORDS.has(i)){let a=e.mark();e.advance();let n=e.peek();if(n&&n.kind==="selector")return;e.reset(a);}i==="class"&&e.advance();}extractEventModifiers(e){let r={},i=false;for(;!e.isAtEnd();){let a=e.peek();if(!a||a.kind!=="event-modifier")break;let n=a.metadata;if(!n)break;switch(i=true,n.modifierName){case "once":r.once=true;break;case "debounce":typeof n.value=="number"&&(r.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(r.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(r.queue=n.value);break}e.advance();}return i?r:void 0}};re.MAX_MARKER_SCAN=3;re.MAX_PROPERTY_DEPTH=10;re.MAX_METHOD_ARGS=20;re.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Or=re;new Or;var O=class{constructor(){this.name="string-literal";}canExtract(t,e){let r=t[e];return r==='"'||r==="'"||r==="`"||r==="\u201C"||r==="\u2018"}extract(t,e){let r=t[e];if(r==="\u201C"){let n=1;for(;e+n<t.length;){if(t[e+n]==="\u201D")return n++,{value:t.substring(e,e+n),length:n};n++;}return null}if(r==="\u2018"){let n=1;for(;e+n<t.length;){if(t[e+n]==="\u2019")return n++,{value:t.substring(e,e+n),length:n};n++;}return null}let i=1,a=false;for(;e+i<t.length;){let n=t[e+i];if(a){a=false,i++;continue}if(n==="\\"){a=true,i++;continue}if(n===r)return i++,{value:t.substring(e,e+i),length:i};i++;}return null}},M=class{constructor(){this.name="number";}canExtract(t,e){return /\d/.test(t[e])}extract(t,e){let r=0,i=false;for(;e+r<t.length;){let o=t[e+r];if(/\d/.test(o))r++;else if(o==="."&&!i)i=true,r++;else break}if(r===0)return null;let a=t.substring(e,e+r),n=e+r;if(n<t.length){let o=t.slice(n),s=[{pattern:"\u6BEB\u79D2",suffix:"ms"},{pattern:"\u5206\u949F",suffix:"m"},{pattern:"\u5C0F\u65F6",suffix:"h"},{pattern:"\u30DF\u30EA\u79D2",suffix:"ms"},{pattern:"\u6642\u9593",suffix:"h"}];for(let l of s)if(o.startsWith(l.pattern))return {value:a+l.suffix,length:r+l.pattern.length,metadata:{hasTimeUnit:true}};if(o.startsWith("ms"))return {value:a+"ms",length:r+2,metadata:{hasTimeUnit:true}};let u=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of u)if(o.startsWith(l.pattern))return {value:a+l.suffix,length:r+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(o))return {value:a+o[0],length:r+1,metadata:{hasTimeUnit:true}}}return {value:a,length:r}}};function Mr(t){return "setContext"in t&&typeof t.setContext=="function"}function Ir(t){let e={language:t.language,direction:t.direction,lookupKeyword:t.lookupKeyword.bind(t),isKeyword:t.isKeyword.bind(t),isKeywordStart:t.isKeywordStart.bind(t)};return t.normalizer?{...e,normalizer:t.normalizer}:e}var te=class{constructor(t,e){this.pos=0,this.tokens=t,this.language=e;}peek(t=0){let e=this.pos+t;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(t){this.pos=t.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(t){let e=[];for(;!this.isAtEnd()&&t(this.peek());)e.push(this.advance());return e}skipWhile(t){for(;!this.isAtEnd()&&t(this.peek());)this.advance();}};function b(t,e){return {start:t,end:e}}function k(t,e,r,i){if(typeof t=="object"){let{value:n,kind:o,position:s,normalized:u,stem:l,stemConfidence:c,metadata:m}=t;return {value:n,kind:o,position:s,...u!==void 0&&{normalized:u},...l!==void 0&&{stem:l},...c!==void 0&&{stemConfidence:c},...m!==void 0&&{metadata:m}}}let a=t;if(!e||!r)throw new Error("createToken requires kind and position parameters");if(typeof i=="string")return {value:a,kind:e,position:r,normalized:i};if(i){let{normalized:n,stem:o,stemConfidence:s,metadata:u}=i;return {value:a,kind:e,position:r,...n!==void 0&&{normalized:n},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s},...u!==void 0&&{metadata:u}}}return {value:a,kind:e,position:r}}function $(t){return /\s/.test(t)}function Lr(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function jr(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function V(t){return /\d/.test(t)}function Vr(t){return /[a-zA-Z]/.test(t)}function x(t){return /[a-zA-Z0-9_-]/.test(t)}function $r(t,e){if(e>=t.length)return null;let r=t[e];if(!Lr(r))return null;let i=e,a="";if(r==="#"||r==="."){for(a+=t[i++];i<t.length&&x(t[i]);)a+=t[i++];if(a.length<=1)return null;if(i<t.length&&t[i]==="."&&r==="#"){let o=i+1;for(;o<t.length&&x(t[o]);)o++;if(o<t.length&&t[o]==="(")return a}}else if(r==="["){let n=1,o=false,s=null,u=false;for(a+=t[i++];i<t.length&&n>0;){let l=t[i];a+=l,u?u=false:l==="\\"?u=true:o?l===s&&(o=false,s=null):l==='"'||l==="'"||l==="`"?(o=true,s=l):l==="["?n++:l==="]"&&n--,i++;}if(n!==0)return null}else if(r==="@"){for(a+=t[i++];i<t.length&&x(t[i]);)a+=t[i++];if(a.length<=1)return null}else if(r==="*"){for(a+=t[i++];i<t.length&&x(t[i]);)a+=t[i++];if(a.length<=1)return null}else if(r==="<"){if(a+=t[i++],i>=t.length||!Vr(t[i]))return null;for(;i<t.length&&x(t[i]);)a+=t[i++];for(;i<t.length;){let n=t[i];if(n==="."){if(a+=t[i++],i>=t.length||!x(t[i]))return null;for(;i<t.length&&x(t[i]);)a+=t[i++];}else if(n==="#"){if(a+=t[i++],i>=t.length||!x(t[i]))return null;for(;i<t.length&&x(t[i]);)a+=t[i++];}else if(n==="["){let o=1,s=false,u=null,l=false;for(a+=t[i++];i<t.length&&o>0;){let c=t[i];a+=c,l?l=false:c==="\\"?l=true:s?c===u&&(s=false,u=null):c==='"'||c==="'"||c==="`"?(s=true,u=c):c==="["?o++:c==="]"&&o--,i++;}if(o!==0)return null}else break}for(;i<t.length&&$(t[i]);)a+=t[i++];if(i<t.length&&t[i]==="/")for(a+=t[i++];i<t.length&&$(t[i]);)a+=t[i++];if(i>=t.length||t[i]!==">")return null;a+=t[i++];}return a||null}function qr(t,e){if(e>=t.length||t[e]!=="'"||e+1>=t.length||t[e+1].toLowerCase()!=="s")return false;if(e+2>=t.length)return true;let i=t[e+2];return $(i)||i==="*"||!x(i)}function Wr(t,e){if(e>=t.length)return null;let r=t[e];if(!jr(r)||r==="'"&&qr(t,e))return null;let a={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!a)return null;let n=e+1,o=r,s=false;for(;n<t.length;){let u=t[n];if(o+=u,s)s=false;else if(u==="\\")s=true;else if(u===a)return o;n++;}return o}function Kr(t,e){if(e>=t.length)return false;let r=t[e],i=t[e+1]||"",a=t[e+2]||"";if(r==="/"&&i!=="/"&&/[a-zA-Z0-9._-]/.test(i)||r==="/"&&i==="/"&&/[a-zA-Z]/.test(a)||r==="."&&(i==="/"||i==="."&&a==="/"))return true;let n=t.slice(e,e+8).toLowerCase();return !!(n.startsWith("http://")||n.startsWith("https://"))}function Ur(t,e){if(!Kr(t,e))return null;let r=e,i="",a=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<t.length;){let n=t[r];if(n==="#"){if(i.length>0&&/[a-zA-Z0-9/.]$/.test(i))for(i+=n,r++;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)i+=t[r++];break}if(a.test(n))i+=n,r++;else break}return i.length<2?null:i}function Gr(t,e){if(e>=t.length)return null;let r=t[e];if(!V(r)&&r!=="-"&&r!=="+")return null;let i=e,a="";if((t[i]==="-"||t[i]==="+")&&(a+=t[i++]),i>=t.length||!V(t[i]))return null;for(;i<t.length&&V(t[i]);)a+=t[i++];if(i<t.length&&t[i]===".")for(a+=t[i++];i<t.length&&V(t[i]);)a+=t[i++];return i<t.length&&(t.slice(i,i+2)==="ms"?a+="ms":(t[i]==="s"||t[i]==="m"||t[i]==="h")&&(a+=t[i])),a}var Hr=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Hr);var Oe=class Me{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map,this.extractors=[];}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw new Error(`${this.constructor.name}: tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.`)}registerExtractor(e){Mr(e)&&e.setContext(Ir(this)),this.extractors.push(e);}registerExtractors(e){for(let r of e)this.registerExtractor(r);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let r=[],i=0;for(;i<e.length;){for(;i<e.length&&$(e[i]);)i++;if(i>=e.length)break;let a=false;for(let n of this.extractors)if(n.canExtract(e,i)){let o=n.extract(e,i);if(o){let s=o.metadata?.normalized,u=o.metadata?.stem,l=o.metadata?.stemConfidence,c={};if(o.metadata)for(let[p,d]of Object.entries(o.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(c[p]=d);let m={};s&&(m.normalized=s),u&&(m.stem=u),l!==void 0&&(m.stemConfidence=l),Object.keys(c).length>0&&(m.metadata=c),r.push(k(o.value,this.classifyToken(o.value),b(i,i+o.length),Object.keys(m).length>0?m:void 0)),i+=o.length,a=true;break}}if(!a){let n=e[i],o=this.classifyUnknownChar(n);r.push(k(n,o,b(i,i+1))),i++;}}return new te(r,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,r,i){if(e[r]!==".")return false;let a=i[i.length-1],n=a&&a.position.end<r;if(a&&!n&&(a.kind==="identifier"||a.kind==="keyword"||a.kind==="selector"))return i.push(k(".","operator",b(r,r+1))),true;let u=r+1;for(;u<e.length&&x(e[u]);)u++;return u<e.length&&e[u]==="("?(i.push(k(".","operator",b(r,r+1))),true):false}initializeKeywordsFromProfile(e,r=[]){let i=new Map;if(e.keywords){for(let[a,n]of Object.entries(e.keywords))if(i.set(n.primary,{native:n.primary,normalized:n.normalized||a}),n.alternatives)for(let o of n.alternatives)i.set(o,{native:o,normalized:n.normalized||a});}if(e.references){for(let[a,n]of Object.entries(e.references))i.set(n,{native:n,normalized:a});for(let a of Object.keys(e.references))i.has(a)||i.set(a,{native:a,normalized:a});}if(e.roleMarkers){for(let[a,n]of Object.entries(e.roleMarkers))if(n.primary&&i.set(n.primary,{native:n.primary,normalized:a}),n.alternatives)for(let o of n.alternatives)i.set(o,{native:o,normalized:a});}if(e.possessive?.keywords)for(let[a,n]of Object.entries(e.possessive.keywords))i.set(a,{native:a,normalized:n});for(let a of r)i.set(a.native,a);this.profileKeywords=Array.from(i.values()).sort((a,n)=>n.native.length-a.native.length),this.profileKeywordMap=new Map;for(let a of this.profileKeywords){this.profileKeywordMap.set(a.native.toLowerCase(),a);let n=this.removeDiacritics(a.native);n!==a.native&&!this.profileKeywordMap.has(n.toLowerCase())&&this.profileKeywordMap.set(n.toLowerCase(),a);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,r){for(let i of this.profileKeywords)if(e.slice(r).startsWith(i.native))return k(i.native,"keyword",b(r,r+i.native.length),i.normalized);return null}isKeywordStart(e,r){let i=e.slice(r);return this.profileKeywords.some(a=>i.startsWith(a.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let r=this.normalizer.normalize(e);return r.stem!==e&&r.confidence>=.7?r:null}tryMorphKeywordMatch(e,r,i){let a=this.tryNormalize(e);if(!a)return null;let n=this.lookupKeyword(a.stem);if(!n)return null;let o={normalized:n.normalized,stem:a.stem,stemConfidence:a.confidence};return k(e,"keyword",b(r,i),o)}trySelector(e,r){let i=$r(e,r);return i?k(i,"selector",b(r,r+i.length)):null}tryEventModifier(e,r){if(e[r]!==".")return null;let i=e.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!i)return null;let a=i[0].replace(/(\s|\.)$/,""),n=a.slice(1).split("(")[0],o=i[1];return {...k(a,"event-modifier",b(r,r+a.length)),metadata:{modifierName:n,value:o?n==="queue"?o:parseInt(o,10):void 0}}}tryString(e,r){let i=Wr(e,r);return i?k(i,"literal",b(r,r+i.length)):null}tryNumber(e,r){let i=Gr(e,r);return i?k(i,"literal",b(r,r+i.length)):null}tryMatchTimeUnit(e,r,i,a=false){let n=r;if(a)for(;n<e.length&&$(e[n]);)n++;let o=e.slice(n);for(let s of i){let u=o.slice(0,s.length);if(s.caseInsensitive?u.toLowerCase()===s.pattern.toLowerCase():u===s.pattern){if(s.notFollowedBy&&(o[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let c=o[s.length]||"";if(x(c))continue}return {suffix:s.suffix,endPos:n+s.length}}}return null}parseBaseNumber(e,r,i=true){let a=r,n="";if(i&&(e[a]==="-"||e[a]==="+")&&(n+=e[a++]),a>=e.length||!V(e[a]))return null;for(;a<e.length&&V(e[a]);)n+=e[a++];if(a<e.length&&e[a]===".")for(n+=e[a++];a<e.length&&V(e[a]);)n+=e[a++];return !n||n==="-"||n==="+"?null:{number:n,endPos:a}}tryNumberWithTimeUnits(e,r,i,a={}){let{allowSign:n=true,skipWhitespace:o=false}=a,s=this.parseBaseNumber(e,r,n);if(!s)return null;let{number:u,endPos:l}=s,c=[...i,...Me.STANDARD_TIME_UNITS],m=this.tryMatchTimeUnit(e,l,c,o);return m&&(u+=m.suffix,l=m.endPos),k(u,"literal",b(r,l))}tryUrl(e,r){let i=Ur(e,r);return i?k(i,"url",b(r,r+i.length)):null}tryVariableRef(e,r){if(e[r]!==":"||r+1>=e.length||!x(e[r+1]))return null;let i=r+1;for(;i<e.length&&x(e[i]);)i++;let a=e.slice(r,i);return k(a,"identifier",b(r,i))}tryOperator(e,r){let i=e.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return k(i,"operator",b(r,r+2));let a=e[r];return ["<",">","!","+","-","*","/","="].includes(a)?k(a,"operator",b(r,r+1)):["(",")","{","}",",",";",":"].includes(a)?k(a,"punctuation",b(r,r+1)):null}tryMultiCharParticle(e,r,i){for(let a of i)if(e.slice(r,r+a.length)===a)return k(a,"particle",b(r,r+a.length));return null}};Oe.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var I=Oe;function B(t){return {stem:t,confidence:1}}function w(t,e,r){return r?{stem:t,confidence:e,metadata:r}:{stem:t,confidence:e}}var Ie=class{constructor(t){this.language=t.language,this.config={minWordLength:3,minStemLength:2,...t};}normalize(t){let e=t.toLowerCase();if(this.isAlreadyNormalized(e))return B(t);if(this.config.reflexiveSuffixes){let r=this.tryReflexiveNormalization(e);if(r)return r}if(this.config.endings){let r=this.tryConjugationEndings(e);if(r)return r}if(this.config.suffixRules){let r=this.trySuffixRules(e);if(r)return r}if(this.config.prefixRules){let r=this.tryPrefixRules(e);if(r)return r}return B(t)}isAlreadyNormalized(t){return this.config.infinitiveEndings?this.config.infinitiveEndings.some(e=>t.endsWith(e)):false}tryReflexiveNormalization(t){let e=this.config.reflexiveSuffixes;if(!e)return null;for(let r of e){if(!t.endsWith(r))continue;let i=t.slice(0,-r.length);if(this.isAlreadyNormalized(i))return w(i,.88,{removedSuffixes:[r],conjugationType:"reflexive"});let a=this.tryConjugationEndings(i)||this.trySuffixRules(i);if(a&&a.stem!==i)return w(a.stem,a.confidence*.95,{removedSuffixes:[r,...a.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationEndings(t){let e=this.config.endings;if(!e)return null;let r=this.config.minStemLength??2;for(let i of e){if(!t.endsWith(i.ending))continue;let a=t.slice(0,-i.ending.length);if(a.length<r)continue;let n=a+i.stem;return w(n,i.confidence,{removedSuffixes:[i.ending],conjugationType:i.type})}return null}trySuffixRules(t){let e=this.config.suffixRules;if(!e)return null;let r=this.config.minStemLength??2;for(let i of e){if(!t.endsWith(i.pattern))continue;let a=t.slice(0,-i.pattern.length),n=i.minStemLength??r;if(a.length<n)continue;let o=a+(i.replacement||"");return w(o,i.confidence,{removedSuffixes:[i.pattern],...i.conjugationType&&{conjugationType:i.conjugationType}})}return null}tryPrefixRules(t){let e=this.config.prefixRules;if(!e)return null;for(let r of e){if(!t.startsWith(r.pattern))continue;let i=t.slice(r.pattern.length),a=r.minRemaining??this.config.minStemLength??2;if(!(i.length<a))return w(i,1-r.confidencePenalty,{removedPrefixes:[r.pattern]})}return null}};var Yr=Object.defineProperty,Xr=Object.getOwnPropertyNames,Ze=(t,e)=>function(){return t&&(e=(0, t[Xr(t)[0]])(t=0)),e},Zr=(t,e)=>{for(var r in e)Yr(t,r,{get:e[r],enumerable:true});};function Le(t,e){return t.replace(/\{(\w+)\}/g,(r,i)=>String(e[i]??`{${i}}`))}function D(t,e,r={},i){let a=Je[t],n=Le(a,r),o=Qe[t],s=o?Le(o,r):void 0;return {code:t,message:n,severity:e,...i&&{role:i},...s&&{suggestion:s}}}var f,Je,Qe,Jr=Ze({"src/generators/schema-error-codes.ts"(){f={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},Je={[f.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[f.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[f.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[f.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[f.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[f.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[f.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[f.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[f.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[f.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[f.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[f.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[f.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[f.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[f.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[f.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[f.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Qe={[f.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[f.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[f.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[f.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[f.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[f.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[f.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[f.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[f.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[f.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[f.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[f.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[f.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[f.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),er={};Zr(er,{SchemaErrorCodes:()=>f,formatValidationResults:()=>nt,getValidationStats:()=>ot,validateAllKeywordCollisions:()=>ut,validateAllSchemas:()=>at,validateCommandSchema:()=>rr,validateKeywordCollisions:()=>tr,validateRoleValues:()=>st});function Qr(t,e){return {action:t,items:e}}function rr(t){let e=[];for(let i of t.roles)i.expectedTypes.includes("literal")&&i.expectedTypes.includes("selector")&&(i.role==="patient"&&Ce.has(t.action)?e.push(D(f.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:t.action},i.role)):e.push(D(f.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!Ce.has(t.action)&&e.push(D(f.TOO_MANY_EXPECTED_TYPES,"warning",{role:i.role,count:i.expectedTypes.length},i.role));for(let i of t.roles)i.selectorKinds&&i.selectorKinds.length>0&&(i.expectedTypes.includes("selector")||e.push(D(f.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(t.action){case "transition":et(t,e);break;case "on":rt(t,e);break;case "if":case "unless":tt(t,e);break;case "repeat":case "for":case "while":it(t,e);break}return t.roles.filter(i=>i.required).length===0&&(ir.has(t.action)?e.push(D(f.NO_REQUIRED_ROLES_EXPECTED,"note",{command:t.action})):e.push(D(f.NO_REQUIRED_ROLES,"warning",{}))),Qr(t.action,e)}function et(t,e){let r=t.roles.find(a=>a.role==="patient"),i=t.roles.find(a=>a.role==="goal");r&&r.expectedTypes.includes("selector")&&e.push(D(f.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),r&&!i&&e.push(D(f.TRANSITION_MISSING_GOAL,"error",{}));}function rt(t,e){let r=t.roles.find(i=>i.role==="event");r||e.push(D(f.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(D(f.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function tt(t,e){let r=t.roles.find(i=>i.role==="condition");r||e.push(D(f.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(D(f.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function it(t,e){t.action==="for"?t.roles.find(i=>i.role==="source")||e.push(D(f.FOR_LOOP_MISSING_SOURCE,"warning",{})):t.action==="while"&&(t.roles.find(i=>i.role==="condition")||e.push(D(f.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function at(t,e={}){let r=new Map,{includeNotes:i=false}=e;for(let[a,n]of Object.entries(t)){let o=rr(n),s=o.items.some(l=>l.severity==="warning"||l.severity==="error"),u=i&&o.items.some(l=>l.severity==="note");(s||u)&&r.set(a,o);}return r}function nt(t,e={}){let r=[],{showNotes:i=false,showCodes:a=true}=e;for(let[n,o]of t){let s=o.items.filter(c=>c.severity==="error"),u=o.items.filter(c=>c.severity==="warning"),l=o.items.filter(c=>c.severity==="note");if(s.length>0){r.push(` \u274C ${n}:`);for(let c of s){let m=a?` [${c.code}]`:"";r.push(` ERROR${m}: ${c.message}`),c.suggestion&&r.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(u.length>0){r.push(` \u26A0\uFE0F ${n}:`);for(let c of u){let m=a?` [${c.code}]`:"";r.push(` ${m?`${c.code}: `:""}${c.message}`),c.suggestion&&r.push(` \u{1F4A1} ${c.suggestion}`);}}if(i&&l.length>0){r.push(` \u2139\uFE0F ${n}:`);for(let c of l){let m=a?` [${c.code}]`:"";r.push(` ${m?`${c.code}: `:""}${c.message}`);}}}return r.join(`
|
|
2
|
+
`)}function ot(t){let e=0,r=0,i=0,a={};for(let n of t.values())for(let o of n.items)o.severity==="error"?e++:o.severity==="warning"?r++:o.severity==="note"&&i++,a[o.code]=(a[o.code]||0)+1;return {totalCommands:t.size,errors:e,warnings:r,notes:i,byCode:a}}function st(t,e){let r=[];for(let i of e){let a=t.roles.find(n=>n.role===i.role);a&&(a.expectedTypes.length>0&&!a.expectedTypes.includes(i.type)&&(a.expectedTypes.includes("expression")||r.push({level:"error",role:i.role,message:`${t.action}.${i.role} expects type [${a.expectedTypes.join(", ")}], got '${i.type}'`,code:f.VALUE_TYPE_MISMATCH})),i.type==="selector"&&i.selectorKind&&a.selectorKinds&&a.selectorKinds.length>0&&(a.selectorKinds.includes(i.selectorKind)||r.push({level:"error",role:i.role,message:`${t.action}.${i.role} expects selector kind [${a.selectorKinds.join(", ")}], got '${i.selectorKind}'`,code:f.SELECTOR_KIND_MISMATCH})));}return r}function tr(t){let e=[];if(!t.keywords)return {language:t.code,collisions:e};let r=new Map;for(let[a,n]of Object.entries(t.keywords)){if(!n||!n.primary)continue;let o=r.get(n.primary)||[];if(o.push({command:a,isPrimary:true}),r.set(n.primary,o),n.alternatives)for(let s of n.alternatives){let u=r.get(s)||[];u.push({command:a,isPrimary:false}),r.set(s,u);}}for(let[a,n]of r){let o=[...new Set(n.map(l=>l.command))];if(o.length<=1)continue;let s=n.filter(l=>l.isPrimary).length,u;s>=2?u="primary-primary":s===1?u="primary-alternative":u="alternative-alternative",e.push({keyword:a,commands:o.sort(),type:u});}let i={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((a,n)=>i[a.type]-i[n.type]),{language:t.code,collisions:e}}function ut(t){let e=[];for(let[,r]of Object.entries(t)){let i=tr(r);i.collisions.length>0&&e.push(i);}return e.sort((r,i)=>r.language.localeCompare(i.language))}var Ce,ir,lt=Ze({"src/generators/schema-validator.ts"(){Jr(),Ce=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),ir=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint"]);}});var W=new Map,R=new Map,ie=new Map,Ae=null;function ar(t,e){let r={...t};for(let i of Object.keys(e)){let a=e[i],n=t[i];a!==void 0&&(typeof a=="object"&&a!==null&&!Array.isArray(a)&&typeof n=="object"&&n!==null&&!Array.isArray(n)?r[i]=ar(n,a):r[i]=a);}return r}function ct(t,e){return ar(t,e)}function xe(t){if(!t.extends)return t;let e=R.get(t.extends);if(!e)return console.warn(`[Registry] Profile '${t.code}' extends '${t.extends}' but base is not registered. Make sure to import the base language before the variant.`),t;let r=xe(e);return ct(r,t)}function j(t,e,r){W.set(t,e),R.set(t,r),ie.delete(t);}function nr(t){Ae=t;}var je=new Map;function X(t){return t.split("-")[0]}function Z(t){return t.includes("-")}function mt(t){let e=W.get(t);if(!e&&Z(t)){let r=X(t);e=W.get(r);}if(!e){let r=Array.from(W.keys()).join(", ");throw new Error(`Language '${t}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${t}';`)}return e}function pt(t){let e=R.get(t);if(!e&&Z(t)){let r=X(t);e=R.get(r);}if(!e){let r=Array.from(R.keys()).join(", ");throw new Error(`Language profile '${t}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${t}';`)}return xe(e)}function K(t){let e=R.get(t);return !e&&Z(t)&&(e=R.get(X(t))),e?xe(e):void 0}function dt(){return Array.from(W.keys())}function or(t){if(W.has(t)&&R.has(t))return true;if(Z(t)){let e=X(t);return W.has(e)&&R.has(e)}return false}function yt(t,e){return mt(e).tokenize(t)}function Y(t){let e=ie.get(t);if(!e&&Z(t)&&(e=ie.get(X(t))),e)return e;let r=je.get(t);if(!r&&Z(t)&&(r=je.get(X(t))),r)return ie.set(t,r),r;if(!Ae)throw new Error(`No patterns registered for language '${t}'. Either import the language module or set a pattern generator.`);let i=pt(t),a=Ae(i);return ie.set(t,a),a}function ne(t){let e="complex";return t.startsWith("#")&&!t.includes(" ")?e="id":t.startsWith(".")&&!t.includes(" ")?e="class":t.startsWith("[")&&t.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(t)&&(e="element"),{type:"selector",value:t,selectorKind:e}}function C(t,e){let r={type:"literal",value:t};return e!==void 0?{type:"literal",value:t,dataType:e}:r}function Ve(t){return be(t)}function q(t){return {type:"reference",value:t}}function ke(t,e){return {type:"property-path",object:t,property:e}}function de(t,e,r){let i={kind:"command",action:t,roles:new Map(Object.entries(e))};return r!==void 0?{...i,metadata:r}:i}function $e(t,e,r,i,a,n){let o=new Map;o.set("event",t);let s={kind:"event-handler",action:"on",roles:o,body:e};return r!==void 0&&(s.eventModifiers=r),i!==void 0&&(s.metadata=i),s}function qe(t,e="then",r){let i={kind:"compound",action:"compound",roles:new Map,statements:t,chainType:e};return r!==void 0&&(i.metadata=r),i}function We(t,e){return !e||e.length===0||e.includes(t)||e.includes("expression")?true:t==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function jt(t,e){return t.possessive?.keywords?.[e]}var we=.8,Vt=.6,$t=.15,qt=.5,Ke=.15,Ue=.1,Ge=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]),Wt={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]},Kt=class{calculate(t){return this.calculateWithBreakdown(t).final}calculateWithBreakdown(t){let e=this.scoreRoleCoverage(t),r=this.scoreStemPenalty(t),i=this.scoreLanguageBoost(t),a=this.scoreLanguageAdjustment(t),n=e;return n=Math.max(qt,n+r),n=Math.min(1,n+i),n=Math.max(0,Math.min(1,n+a)),{roleCoverage:e,stemPenalty:r,languageBoost:i,languageAdjustment:a,final:n}}scoreRoleCoverage(t){let{pattern:e,captured:r}=t,i=0,a=0,n=o=>e.extraction?.[o]?.default!==void 0;for(let o of e.template.tokens)if(o.type==="role")a+=1,r.has(o.role)&&(i+=1);else if(o.type==="group")for(let s of o.tokens)s.type==="role"&&(a+=we,r.has(s.role)?i+=we:n(s.role)&&(i+=we*Vt));return a>0?i/a:1}scoreStemPenalty(t){let{stemMatchCount:e,totalKeywordMatches:r}=t;return e<=0||r<=0?0:-(e/r)*$t}scoreLanguageBoost(t){let{pattern:e}=t;if(e.language!=="ar")return 0;let r=e.template.tokens[0];return !r||r.type!=="literal"?0:Ge.has(r.value)||r.alternatives?.some(i=>Ge.has(i))?Ke:0}scoreLanguageAdjustment(t){let{pattern:e,captured:r}=t;if(e.language!=="ar")return 0;let i=0;for(let[a,n]of r.entries()){let o=Wt[a];if(!o||o.length===0)continue;let s="metadata"in n?n.metadata:void 0;s&&typeof s.prepositionValue=="string"&&(o.includes(s.prepositionValue)?i+=.1:i-=.1);}return Math.max(-Ue,Math.min(Ue,i))}},Ut=new Kt,fe=class ae{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Ut;}matchPattern(e,r){let i=e.mark(),a=new Map;if(this.currentProfile=K(r.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,r.template.tokens,a))return e.reset(i),null;let o=this.confidenceModel.calculate({pattern:r,captured:a,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(r,a),{pattern:r,captured:a,consumedTokens:e.position()-i.position,confidence:o}}matchBest(e,r){this.matchCache.clear();let i=[],a=e.position();for(let o of r){let s=e.mark(),u=`${a}:${o.id}`,l;this.matchCache.has(u)?l=this.matchCache.get(u):(l=this.matchPattern(e,o),this.matchCache.set(u,l)),l&&i.push(l),e.reset(s);}if(i.length===0)return null;i.sort((o,s)=>{let u=s.pattern.priority-o.pattern.priority;return u!==0?u:s.confidence-o.confidence});let n=i[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,r,i){let a=r[0],n=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!n)for(;e.peek()?.kind==="conjunction";)e.advance();for(let o of r)if(!this.matchPatternToken(e,o,i)){if(this.isOptional(o))continue;return false}return true}matchPatternToken(e,r,i){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,i);case "group":return this.matchGroupToken(e,r,i);default:return false}}matchLiteralToken(e,r){let i=e.peek();if(!i)return false;let a=this.getMatchType(i,r.value);if(a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let n of r.alternatives){let o=this.getMatchType(i,n);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,i){this.skipNoiseWords(e);let a=e.peek();if(!a)return r.optional||false;let n=this.tryMatchPossessiveExpression(e);if(n)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(n.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,n),true);let o=this.tryMatchMethodCallExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(o.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,o),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!We(s.type,r.expectedTypes)?r.optional||false:(i.set(r.role,s),true);let u=this.tryMatchPropertyAccessExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(u.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,u),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return r.expectedTypes&&r.expectedTypes.length>0&&!We(l.type,r.expectedTypes)?r.optional||false:(i.set(r.role,l),true);let c=this.tokenToSemanticValue(a);return !c||r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(c.type)?r.optional||false:(i.set(r.role,c),e.advance(),true)}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let i=(r.normalized||r.value).toLowerCase(),a=jt(this.currentProfile,i);if(!a)return null;let n=e.mark();e.advance();let o=e.peek();if(!o)return e.reset(n),null;if(o.kind==="identifier"||o.kind==="keyword"&&!this.isStructuralKeyword(o.value)||o.kind==="selector"&&o.value.startsWith("*")||o.kind==="selector"&&o.value.startsWith("@")||o.kind==="selector"&&o.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(o.value)){e.advance();let s=o.value;o.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1));let u=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)u+=e.peek().value,e.advance();let l=e.peek();return l?.kind==="literal"&&l.value.startsWith("(")&&(u+=l.value,e.advance()),ke(q(a),u)}return e.reset(n),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(i),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(i),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<ae.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}s.push(l.value),e.advance();}return {type:"expression",raw:`${r.value}.${n.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(i),null;e.advance();let o=`${r.value}.${n.value}`,s=1;for(;!e.isAtEnd()&&s<ae.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),o+=`.${c.value}`,s++;}let u=e.peek();if(u&&u.kind==="punctuation"&&u.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<ae.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(c===0){e.advance();break}c--;}if(p.kind==="punctuation"&&p.value==="("&&c++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${o}(${l.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="'s")return e.reset(i),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"&&n.kind!=="identifier"?(e.reset(i),null):(e.advance(),ke(ne(r.value),n.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||!r.value.startsWith("#"))return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="selector"||!a.value.startsWith("."))return e.reset(i),null;let n=e.peek(1);n&&n.kind,e.advance();let o=a.value.slice(1);return ke(ne(r.value),o)}matchGroupToken(e,r,i){let a=e.mark(),n=new Set(i.keys());if(!this.matchTokenSequence(e,r.tokens,i)){e.reset(a);for(let s of i.keys())n.has(s)||i.delete(s);return r.optional||false}return true}getMatchType(e,r){return e.value===r?"exact":e.normalized===r?"normalized":e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===r.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ne(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=(e.normalized||e.value).toLowerCase();return Ve(r)?q(r):C(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return q(e.value);let i=e.value.toLowerCase();return Ve(i)?q(i):{type:"expression",raw:e.value};case "url":return C(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let a=e.slice(1,-1);return C(a,"string")}if(e==="true")return C(true,"boolean");if(e==="false")return C(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let a=parseFloat(r[1]);return r[2]?C(e,"duration"):C(a,"number")}let i=parseFloat(e);return isNaN(i)?C(e,"string"):C(i,"number")}applyExtractionRules(e,r){for(let[i,a]of Object.entries(e.extraction))r.has(i)||(a.value!==void 0?r.set(i,{type:"literal",value:a.value}):a.default&&r.set(i,a.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let r=e.peek();if(!r)return;let i=r.value.toLowerCase();if(ae.ENGLISH_NOISE_WORDS.has(i)){let a=e.mark();e.advance();let n=e.peek();if(n&&(n.kind==="selector"||n.kind==="identifier"))return;e.reset(a);}i==="class"&&e.advance();}extractEventModifiers(e){let r={},i=false;for(;!e.isAtEnd();){let a=e.peek();if(!a||a.kind!=="event-modifier")break;let n=a.metadata;if(!n)break;switch(i=true,n.modifierName){case "once":r.once=true;break;case "debounce":typeof n.value=="number"&&(r.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(r.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(r.queue=n.value);break}e.advance();}return i?r:void 0}};fe.MAX_PROPERTY_DEPTH=10;fe.MAX_METHOD_ARGS=20;fe.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Gt=fe,L=new Gt;function oe(t,e){return yt(t,e)}function sr(){return dt()}var Ht={ko:{\uD074\uB9AD:"click",\uC785\uB825:"input",\uBCC0\uACBD:"change",\uC81C\uCD9C:"submit",\uD0A4\uB2E4\uC6B4:"keydown",\uD0A4\uC5C5:"keyup",\uB9C8\uC6B0\uC2A4\uC624\uBC84:"mouseover",\uB9C8\uC6B0\uC2A4\uC544\uC6C3:"mouseout",\uB9C8\uC6B0\uC2A4\uB2E4\uC6B4:"mousedown",\uB9C8\uC6B0\uC2A4\uC5C5:"mouseup",\uD3EC\uCEE4\uC2A4:"focus",\uBE14\uB7EC:"blur",\uB85C\uB4DC:"load",\uB9AC\uC0AC\uC774\uC988:"resize",\uC2A4\uD06C\uB864:"scroll"},ja:{\u30AF\u30EA\u30C3\u30AF:"click",\u5165\u529B:"input",\u5909\u66F4:"change",\u9001\u4FE1:"submit",\u30AD\u30FC\u30C0\u30A6\u30F3:"keydown",\u30AD\u30FC\u30A2\u30C3\u30D7:"keyup",\u30AD\u30FC\u30D7\u30EC\u30B9:"keypress",\u30DE\u30A6\u30B9\u30AA\u30FC\u30D0\u30FC:"mouseover",\u30DE\u30A6\u30B9\u30A2\u30A6\u30C8:"mouseout",\u30DE\u30A6\u30B9\u62BC\u4E0B:"mousedown",\u30DE\u30A6\u30B9\u89E3\u653E:"mouseup",\u30D5\u30A9\u30FC\u30AB\u30B9:"focus",\u30D6\u30E9\u30FC:"blur",\u30ED\u30FC\u30C9:"load",\u8AAD\u307F\u8FBC\u307F:"load",\u30B5\u30A4\u30BA\u5909\u66F4:"resize",\u30B9\u30AF\u30ED\u30FC\u30EB:"scroll"},ar:{\u0627\u0644\u0646\u0642\u0631:"click",\u0646\u0642\u0631:"click",\u0627\u0644\u0625\u062F\u062E\u0627\u0644:"input",\u0625\u062F\u062E\u0627\u0644:"input",\u0627\u0644\u062A\u063A\u064A\u064A\u0631:"change",\u062A\u063A\u064A\u064A\u0631:"change",\u0627\u0644\u0625\u0631\u0633\u0627\u0644:"submit",\u0625\u0631\u0633\u0627\u0644:"submit","\u0636\u063A\u0637 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keydown","\u0631\u0641\u0639 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keyup","\u062A\u0645\u0631\u064A\u0631 \u0627\u0644\u0645\u0627\u0648\u0633":"mouseover",\u0627\u0644\u062A\u0631\u0643\u064A\u0632:"focus",\u062A\u062D\u0645\u064A\u0644:"load",\u062A\u0645\u0631\u064A\u0631:"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change",env\u00EDo:"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","rat\xF3n encima":"mouseover","rat\xF3n fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{t\u0131klama:"click",t\u0131kla:"click",t\u0131k:"click",giri\u015F:"input",girdi:"input",de\u011Fi\u015Fiklik:"change",de\u011Fi\u015Fim:"change",g\u00F6nderme:"submit",g\u00F6nder:"submit",tu\u015Fbasma:"keydown",tu\u015Fb\u0131rakma:"keyup",fare_bas:"mousedown",fare_b\u0131rak:"mouseup",farei\u00E7inde:"mouseover",fared\u0131\u015F\u0131nda:"mouseout",odaklanma:"focus",odak:"focus",bulan\u0131kl\u0131k:"blur",y\u00FCkleme:"load",y\u00FCkle:"load",boyut_de\u011Fi\u015Ftir:"resize",kayd\u0131rma:"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input",mudan\u00E7a:"change",mudanca:"change",alterar:"change",envio:"submit",enviar:"submit","tecla baixo":"keydown","tecla cima":"keyup","pressionar tecla":"keydown","soltar tecla":"keyup","mouse sobre":"mouseover","mouse fora":"mouseout",foco:"focus",focar:"focus",desfoque:"blur",desfocar:"blur",carregar:"load",carregamento:"load",rolagem:"scroll",rolar:"scroll"},zh:{\u70B9\u51FB:"click",\u5355\u51FB:"click",\u53CC\u51FB:"dblclick",\u8F93\u5165:"input",\u6539\u53D8:"change",\u53D8\u5316:"change",\u53D8\u66F4:"change",\u63D0\u4EA4:"submit",\u53D1\u9001:"submit",\u6309\u952E:"keydown",\u952E\u5165:"keydown",\u677E\u952E:"keyup",\u9F20\u6807\u8FDB\u5165:"mouseover",\u9F20\u6807\u79FB\u5165:"mouseover",\u9F20\u6807\u79BB\u5F00:"mouseout",\u9F20\u6807\u79FB\u51FA:"mouseout",\u7126\u70B9:"focus",\u805A\u7126:"focus",\u5931\u7126:"blur",\u6A21\u7CCA:"blur",\u52A0\u8F7D:"load",\u8F7D\u5165:"load",\u6EDA\u52A8:"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input",entr\u00E9e:"input",changement:"change",changer:"change",soumettre:"submit",soumission:"submit",envoi:"submit","touche bas":"keydown","touche haut":"keyup","souris dessus":"mouseover","souris dehors":"mouseout",focus:"focus",focaliser:"focus",d\u00E9focus:"blur",d\u00E9focaliser:"blur",chargement:"load",charger:"load",d\u00E9filement:"scroll",d\u00E9filer:"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input",\u00E4nderung:"change",\u00E4ndern:"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus \xFCber":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur",unsch\u00E4rfe:"blur",laden:"load",ladung:"load",scrollen:"scroll",bl\u00E4ttern:"scroll"},id:{klik:"click",click:"click",masukan:"input",input:"input",ubah:"change",perubahan:"change",kirim:"submit","tekan tombol":"keydown","lepas tombol":"keyup","mouse masuk":"mouseover","mouse keluar":"mouseout",fokus:"focus",blur:"blur",muat:"load",memuat:"load",gulir:"scroll",menggulir:"scroll"},bn:{\u0995\u09CD\u09B2\u09BF\u0995:"click",\u0987\u09A8\u09AA\u09C1\u099F:"input",\u099C\u09AE\u09BE:"submit",\u09B2\u09CB\u09A1:"load",\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2:"scroll",\u09B0\u09BF\u09B8\u09BE\u0987\u099C:"resize",\u099D\u09BE\u09AA\u09B8\u09BE:"blur",\u09AB\u09CB\u0995\u09BE\u09B8:"focus",\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8:"change"},qu:{click:"click","\xF1it'iy":"click",\u00F1itiy:"click",yaykuchiy:"input",yaykuy:"input",tikray:"change","t'ikray":"change",apachiy:"submit",kachay:"submit","llave uray":"keydown","llave hawa":"keyup","q'away":"focus",qhaway:"focus",paqariy:"blur","mana q'away":"blur",cargay:"load",apakuy:"load",apamuy:"load",kunray:"scroll",muyuy:"scroll",hatun_kay:"resize"},sw:{bofya:"click",click:"click",kubofya:"click",ingiza:"input",kubadilisha:"change",mabadiliko:"change",tuma:"submit",kutuma:"submit","bonyeza chini":"keydown","bonyeza juu":"keyup","panya juu":"mouseover","panya nje":"mouseout",lenga:"focus",kulenga:"focus",blur:"blur",pakia:"load",kupakia:"load",sogeza:"scroll",kusogeza:"scroll"}};var Xt={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Zt={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to add",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},Jt={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Qt={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"},markerVariants:{en:["before","after"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},ei={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},ri={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},ti={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},ii={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ai={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ni={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"duration",roles:[{role:"duration",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},oi={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"as"}},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},si={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},ui={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},li={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},ci={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},mi={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},pi={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},di={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},yi={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},fi={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},hi={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},vi={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},gi={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},Ei={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},zi={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},bi={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},ki={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},wi={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},Ci={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Ai={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},xi={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},Di={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Si={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},Bi={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ti={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Fi={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Pi={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"as"}}]},Ri={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ni={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},_i={action:"clear",description:"Clear a variable, local, or input element",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The variable or element to clear (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Oi={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Mi={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[]},Ii={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},Li={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},ji={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Vi={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},$i={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},qi={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},Wi={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Ki={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Ui={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Gi={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},Hi={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},Yi={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},Xi={action:"beep",description:"Debug output for expressions with type information",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The expression(s) to debug",required:false,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Zi={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ji={action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Qi={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},ea={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},ra={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",argSkipTokens:["of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"],roles:[{role:"destination",description:"The element to scroll to",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"}}]},ur={en:"url",es:"url",pt:"url",fr:"url",de:"url",it:"url",ja:"url",ko:"url",zh:"url",ar:"url",he:"url",hi:"url",bn:"url",tr:"url",ru:"url",uk:"url",pl:"url",id:"url",vi:"url",th:"url",ms:"url",tl:"url",sw:"url",qu:"url"},ta={en:"partials in",es:"partials in",pt:"partials in",fr:"partials in",de:"partials in",it:"partials in",ja:"partials in",ko:"partials in",zh:"partials in",ar:"partials in",he:"partials in",hi:"partials in",bn:"partials in",tr:"partials in",ru:"partials in",uk:"partials in",pl:"partials in",id:"partials in",vi:"partials in",th:"partials in",ms:"partials in",tl:"partials in",sw:"partials in",qu:"partials in"},ia={action:"push",description:"Push a URL onto the browser history",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to push (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:ur}]},aa={action:"replace",description:"Replace the current browser history entry with a URL",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to replace with (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:ur}]},na={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:ta}]},oa={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},lr={toggle:Xt,add:Zt,remove:Jt,put:Qt,set:ei,show:ri,hide:ti,on:ii,trigger:ai,wait:ni,fetch:oi,increment:si,decrement:ui,append:li,prepend:ci,log:mi,get:pi,take:di,make:yi,halt:fi,settle:hi,throw:vi,send:gi,if:Ei,unless:zi,else:bi,repeat:ki,for:wi,while:Ci,continue:Ai,go:xi,scroll:ra,push:ia,replace:aa,process:na,transition:Di,clone:Si,focus:Bi,blur:Ti,empty:Fi,open:Pi,close:Ri,select:Ni,clear:_i,reset:Oi,breakpoint:Mi,call:Ii,return:Li,js:ji,async:Vi,tell:$i,default:qi,init:Wi,behavior:Ki,install:Ui,measure:Gi,swap:Hi,morph:Yi,beep:Xi,break:Zi,copy:Ji,exit:Qi,pick:ea,render:oa,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function sa(){return Object.values(lr).filter(t=>t.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(lt(),er)).then(({validateAllSchemas:t,formatValidationResults:e})=>{let r=t(lr);r.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(r)),console.warn(`
|
|
3
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(t=>{console.debug("Schema validation skipped:",t);});var He=class extends Error{constructor(t,e,r,i){super(t),this.name="SemanticParseError",this.language=e,this.input=r,this.diagnostics=i;}};function F(t,e,r){return {message:t,severity:e,source:"semantic-parser",...r&&{code:r}}}function ye(t,e){return e.length===0?t:{...t,diagnostics:e}}var J=class P{parse(e,r){let{modifiers:i,remainingInput:a}=this.extractStandaloneModifiers(e,r),n=a||e,o=[],s=oe(n,r),u=Y(r);if(u.length===0)throw new He(`No patterns available for language: ${r}`,r,n,[F(`No patterns registered for language '${r}'`,"error","no-patterns")]);let l=[...u].sort((h,g)=>g.priority-h.priority),c=l.filter(h=>h.command==="on"),m=L.matchBest(s,c);if(m){o.push(F(`event pattern matched: ${m.pattern.id} (confidence: ${m.confidence.toFixed(2)})`,"info","pattern-match"));let h=this.buildEventHandler(m,s,r),g=i?this.applyModifiers(h,i):h;return ye(g,o)}o.push(F(`event patterns: ${c.length} tried, no match`,"info","stage-event"));let p=l.filter(h=>h.command!=="on"),d=L.matchBest(s,p);if(d)return o.push(F(`command pattern matched: ${d.pattern.id} (confidence: ${d.confidence.toFixed(2)})`,"info","pattern-match")),ye(this.buildCommand(d,r),o);o.push(F(`command patterns: ${p.length} tried, no match`,"info","stage-command"));let y=this.trySOVEventExtraction(n,r,l);if(y){o.push(F("SOV event extraction succeeded","info","stage-sov"));let h=i?this.applyModifiers(y,i):y;return ye(h,o)}o.push(F("SOV event extraction: no event keyword found","info","stage-sov"));let v=this.tryCompoundCommandParsing(s,p,r);if(v)return o.push(F("compound command parsing succeeded","info","stage-compound")),ye(v,o);throw o.push(F("compound parsing: no then-keywords or no command matches","info","stage-compound")),o.push(F(`all parse stages exhausted for "${n}"`,"error","parse-failed")),new He(`Could not parse input in ${r}: ${n}`,r,n,o)}canParse(e,r){try{return this.parse(e,r),!0}catch{return false}}supportedLanguages(){return sr()}buildCommand(e,r){if(!e)throw new Error("No match to build command from");let i={};for(let[a,n]of e.captured)i[a]=n;return de(e.pattern.command,i,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,r,i){if(!e)throw new Error("No match to build event handler from");let a=e.captured.get("event");if(!a)throw new Error("Event handler pattern matched but no event captured");let n=L.extractEventModifiers(r),o=this.extractOrConjunctionEvents(r,i),s=a;o.length>0&&a.type==="literal"&&(s={type:"literal",value:[String(a.value),...o.map(m=>String("value"in m?m.value:""))].join(" or ")});let u,l=e.captured.get("action");if(l&&l.type==="literal"){let c=l.value,m={};for(let[y,v]of e.captured)y!=="event"&&y!=="action"&&y!=="continues"&&(m[y]=v);let p=de(c,m,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence}),d=e.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then"){let y=Y(i).filter(g=>g.command!=="on").sort((g,z)=>z.priority-g.priority),v=Y(i).filter(g=>g.id.startsWith("grammar-")&&g.id.includes("-continuation")).sort((g,z)=>z.priority-g.priority),h=this.parseBodyWithGrammarPatterns(r,y,v,i);h.length>0?u=[p,...h]:u=[p];}else u=[p];}else {let c=Y(i).filter(m=>m.command!=="on").sort((m,p)=>p.priority-m.priority);u=this.parseBodyWithClauses(r,c,i);}return $e(s,u,n,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,r,i){let a=[],n=[];for(;!e.isAtEnd();){let o=e.peek();if(!o)break;let s=o.kind==="conjunction"||o.kind==="keyword"&&this.isThenKeyword(o.value,i),u=o.kind==="keyword"&&this.isEndKeyword(o.value,i);if(s){if(n.length>0){let l=this.parseClause(n,r,i);a.push(...l),n.length=0;}e.advance();continue}if(u){if(n.length>0){let l=this.parseClause(n,r,i);a.push(...l);}e.advance();break}n.push(o),e.advance();}if(n.length>0){let o=this.parseClause(n,r,i);a.push(...o);}return a.length>1?[qe(a,"then",{sourceLanguage:i})]:a}parseClause(e,r,i){if(e.length===0)return [];let a=new te(e,i),n=[];for(;!a.isAtEnd();){let o=L.matchBest(a,r);o?n.push(this.buildCommand(o,i)):a.advance();}if(n.length===0){let o=this.parseSOVClauseByVerbAnchoring(e,i);if(o.length>0)return o}return n}static buildVerbLookup(e){let r=new Map;for(let[i,a]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(i)&&(r.set(a.primary.toLowerCase(),i),a.alternatives))for(let n of a.alternatives)r.set(n.toLowerCase(),i);return r}static buildMarkerToRoleLookup(e){let r=new Map;for(let[i,a]of Object.entries(e.roleMarkers))if(a&&(r.set(a.primary,i),a.alternatives))for(let n of a.alternatives)r.has(n)||r.set(n,i);return r}parseSOVClauseByVerbAnchoring(e,r){let i=K(r);if(!i||i.wordOrder!=="SOV")return [];let a=P.buildVerbLookup(i),n=P.buildMarkerToRoleLookup(i),o=[],s=0;for(;s<e.length;){let u=-1,l="";for(let y=s;y<e.length;y++){let v=e[y],h=a.get(v.value.toLowerCase()),g=v.normalized?a.get(v.normalized.toLowerCase()):void 0,z=h||g;if(z){u=y,l=z;break}}if(u===-1)break;let c=e.slice(s,u),m=e.length;for(let y=u+1;y<e.length;y++){let v=e[y];if(v.kind==="conjunction"||this.isThenKeyword(v.value,r)){m=y;break}if(y>u+1&&(a.get(v.value.toLowerCase())||(v.normalized?a.get(v.normalized.toLowerCase()):void 0))){m=y;break}}let p=e.slice(u+1,m),d=this.extractRolesFromMarkedTokens(c,p,n,l,r);if(o.push(de(l,d,{sourceLanguage:r,confidence:.7})),s=m,s<e.length){let y=e[s];(y.kind==="conjunction"||this.isThenKeyword(y.value,r))&&s++;}}return o}extractRolesFromMarkedTokens(e,r,i,a,n){let o={},s=u=>{let l=[];for(let c of u){let m=i.get(c.value);if(m&&c.kind==="particle"&&l.length>0){let p=this.tokensToSemanticValue(l);if(p){let d=this.mapRoleForCommand(m,a,o);d&&(o[d]=p);}l=[];}else l.push(c);}if(l.length>0){let c=this.tokensToSemanticValue(l);c&&(o.patient?o.destination||(o.destination=c):o.patient=c);}};return s(e),s(r),o}mapRoleForCommand(e,r,i){return i[e]?e==="patient"&&!i.destination?"destination":e==="destination"&&!i.patient?"patient":e==="source"&&!i.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let r=e.filter(n=>n.kind!=="whitespace");if(r.length===0)return null;if(r.length===1)return this.tokenToSemanticValue(r[0]);let i=r.map(n=>n.value).join(""),a=r[0];return a.kind==="selector"||a.value.startsWith("#")||a.value.startsWith(".")||a.value.startsWith("@")||a.value.startsWith("*")?ne(i):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?C(i):a.kind==="reference"?q(i):C(i)}tokenToSemanticValue(e){let r=e.value;if(e.kind==="selector"||r.startsWith("#")||r.startsWith(".")||r.startsWith("@")||r.startsWith("*"))return ne(r);if(r.startsWith('"')||r.startsWith("'"))return C(r);if(/^-?\d+(\.\d+)?$/.test(r))return C(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return C(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return C(false);let i=e.normalized?.toLowerCase();return i==="me"||i==="it"||i==="you"||i==="result"||i==="body"?q(i):e.kind==="reference"?q(e.normalized||"me"):C(r)}parseBodyWithGrammarPatterns(e,r,i,a){let n=[];for(;!e.isAtEnd();){let o=e.peek();if(o&&this.isThenKeyword(o.value,a)){e.advance();continue}if(o&&this.isEndKeyword(o.value,a)){e.advance();break}let s=false;if(i.length>0){let u=L.matchBest(e,i);if(u){let l=u.pattern.command,c={};for(let[d,y]of u.captured)d!=="event"&&d!=="action"&&d!=="continues"&&(c[d]=y);let m=de(l,c,{sourceLanguage:a,patternId:u.pattern.id});n.push(m),s=true;let p=u.captured.get("continues");if(p&&p.type==="literal"&&p.value==="then")continue}}if(!s){let u=L.matchBest(e,r);u&&(n.push(this.buildCommand(u,a)),s=true);}s||e.advance();}return n}tryCompoundCommandParsing(e,r,i){let a=e.tokens;if(!a.some(u=>u.kind==="conjunction"||u.kind==="keyword"&&this.isThenKeyword(u.value,i)))return null;let o=new te(a,i),s=this.parseBodyWithClauses(o,r,i);return s.length===0?null:s.length===1?s[0]:qe(s,"then",{sourceLanguage:i,confidence:.65})}trySOVEventExtraction(e,r,i){let a=P.SOV_EVENT_MARKERS[r];if(!a)return null;let o=oe(e,r).tokens,s=Ht[r],u=new Set;if(s)for(let E of Object.keys(s))u.add(E.toLowerCase());let l=P.SOV_SOURCE_MARKERS[r],c=-1,m="",p="",d=1;for(let E=0;E<o.length;E++){let A=o[E],N=A.value.toLowerCase(),_=N,U="",ge=N.indexOf("[");ge>0&&(_=N.slice(0,ge),U=A.value.slice(ge));let Ee=A.normalized?.toLowerCase(),Fe=Ee&&P.KNOWN_EVENTS.has(Ee),Pe=u.has(N)||u.has(_),Fr=P.KNOWN_EVENTS.has(_);if(Fe||Pe||Fr){let Q;if(Fe?Q=Ee:Pe?Q=s?.[N]??s?.[_]??_:Q=_,a.size>0){let le=1,ze=o[E+1];ze&&ze.kind==="selector"&&ze.value.startsWith("[")&&(le=2);let ce=o[E+le];if(ce&&(ce.kind==="particle"||ce.kind==="keyword")&&a.has(ce.value)){c=E,m=Q,p=U||(le===2?o[E+1].value:""),d=le+1;break}}else {c=E,m=Q,p=U,d=1;break}}}if(c===-1)return null;let y=new Set;for(let E=c;E<c+d;E++)y.add(E);if(l){let E=c+d;if(E<o.length){let A=o[E];(A.kind==="particle"||A.kind==="keyword")&&l.markers.has(A.value)&&y.add(E);}for(let A=0;A<c;A++){let N=o[A],_=N.value.toLowerCase(),U=N.normalized?.toLowerCase();if(l.windowTokens.has(_)||U&&l.windowTokens.has(U)){y.add(A);break}}}let v=o.filter((E,A)=>!y.has(A));if(v.length===0)return null;let h=i.filter(E=>E.command!=="on"),g=new te(v,r),z=this.parseBodyWithClauses(g,h,r);if(z.length===0)return null;let Te={sourceLanguage:r,confidence:.75};return p&&(Te.keyFilter=p),$e({type:"literal",value:m},z,void 0,Te)}isThenKeyword(e,r){let i={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (i[r]||i.en).has(e.toLowerCase())}isEndKeyword(e,r){let i={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (i[r]||i.en).has(e.toLowerCase())}extractStandaloneModifiers(e,r){let a=oe(e,r).tokens;if(a.length===0)return {modifiers:null,remainingInput:null};let o=a[0].value.toLowerCase(),s=P.STANDALONE_MODIFIERS[o];if(!s)return {modifiers:null,remainingInput:null};let u={},l=1;if(s==="once")u.once=true;else {let d=1;if(d<a.length){let y=a[d];(y.kind==="keyword"||y.kind==="particle")&&(d++,l++);}if(d<a.length){let y=a[d];if(y.kind==="literal"){let v=y.value.match(/^(\d+)(ms|s|m)?$/);if(v){let h=parseInt(v[1],10),g=v[2]||"ms";g==="s"?h*=1e3:g==="m"&&(h*=6e4),u[s]=h,l=d+1;}}}u[s]||(u[s]=s==="debounce"?300:100);}let c=a.slice(l);if(c.length===0)return {modifiers:null,remainingInput:null};let m=c[0].position.start,p=e.slice(m);return {modifiers:u,remainingInput:p}}applyModifiers(e,r){return {...e,eventModifiers:{...e.eventModifiers,...r}}}extractOrConjunctionEvents(e,r){let i=[];for(;;){let a=e.mark(),n=e.peek();if(!n)break;let o=(n.normalized||n.value).toLowerCase();if(!P.OR_KEYWORDS.has(o)){e.reset(a);break}e.advance();let s=e.peek();if(!s){e.reset(a);break}let u=(s.normalized||s.value).toLowerCase();e.advance(),i.push({type:"literal",value:u});}return i}};J.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);J.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"])};J.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])}};J.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};J.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o"]);var ua=J,la=new ua;function ca(t,e){return la.parse(t,e)}function ma(t,e){try{let r=oe(t,e),i=Y(e);if(i.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let a=[...i].sort((l,c)=>c.priority-l.priority),n=a.filter(l=>l.command==="on"),o=L.matchBest(r,n);if(o)return {confidence:o.confidence,parseSuccess:!0,patternId:o.pattern.id,action:o.pattern.command,tokensConsumed:o.consumedTokens};r.reset(r.mark());let s=a.filter(l=>l.command!=="on"),u=L.matchBest(r,s);return u?{confidence:u.confidence,parseSuccess:!0,patternId:u.pattern.id,action:u.pattern.command,tokensConsumed:u.consumedTokens}:{confidence:0,parseSuccess:!1,error:`Could not match any patterns for: ${t}`}}catch(r){return {confidence:0,parseSuccess:false,error:r instanceof Error?r.message:String(r)}}}function cr(t,e){try{let i=ca(t,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:oe(t,e).tokens.length}}catch{}let r=ma(t,e);return r.parseSuccess?{node:null,confidence:r.confidence,error:void 0,tokensConsumed:r.tokensConsumed}:{node:null,confidence:0,error:r.error}}function mr(t,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...t].sort((i,a)=>{let n=i[r]??99,o=a[r]??99;return n-o})}function pa(t,e){let r=t.markerOverride?.[e.code],i=e.roleMarkers[t.role];if(r!==void 0)return {primary:r,position:i?.position??"before",isOverride:true};if(i&&i.primary){let a={primary:i.primary,position:i.position,isOverride:false};return i.alternatives&&(a.alternatives=i.alternatives),a}return null}function da(t,e,r,i,a){let n=[];if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let l=i.primary.split(/\s+/);if(l.length>1)for(let c of l)n.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(c);}}let o=e.roleMarkers.destination;o&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(l);}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${t.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(a.basePriority??100)+50,template:{format:`{event} ${i.primary} {destination?} {patient} ${s?.primary||""} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ya(t,e,r,i,a){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let u=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(u);}if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let u=i.primary.split(/\s+/);if(u.length>1)for(let l of u)n.push({type:"literal",value:l});else {let l=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(l);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${t.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(a.basePriority??100)+45,template:{format:`{patient} ${o?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function fa(t,e,r,i,a){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(l);}let s=e.roleMarkers.destination;if(s&&(n.push({type:"role",role:"destination",optional:false}),n.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),n.push({type:"role",role:"event",optional:false}),i.position==="after"){let l=i.primary.split(/\s+/);if(l.length>1)for(let c of l)n.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(c);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${t.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(a.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${s?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function ha(t,e,r,i,a){let n=[];n.push({type:"role",role:"event",optional:false});let o=i.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];o.length>0&&n.push({type:"literal",value:o[0],alternatives:o.slice(1)});let s=e.roleMarkers.destination;s&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let c=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(c);}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(l),{id:`${t.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(a.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function va(t,e,r,i,a){let n=[];if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let s=i.primary.split(/\s+/);if(s.length>1)for(let u of s)n.push({type:"literal",value:u});else {let u=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(u);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(o),{id:`${t.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`{event} ${i.primary} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function ga(t,e,r,i){let a=e.eventHandler?.temporalMarkers;if(!a||a.length===0)return null;let n=[];n.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&n.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),n.push({type:"literal",value:a[0],alternatives:a.slice(1)}),n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o?.primary){let u=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(u);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${t.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(i.basePriority??100)+49,template:{format:`{event} ${a[0]} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Ea(t,e,r,i,a){let n=[];if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let c=i.primary.split(/\s+/);if(c.length>1)for(let m of c)n.push({type:"literal",value:m});else {let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(m);}}let s=[...t.roles.filter(c=>c.required)].sort((c,m)=>{let p=c.sovPosition??999,d=m.sovPosition??999;return p-d});for(let c of s){n.push({type:"role",role:c.role,optional:false});let m,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)m=c.markerOverride[e.code];else {let d=e.roleMarkers[c.role];d&&(m=d.primary,p=d.alternatives);}if(m){let d=p?{type:"literal",value:m,alternatives:p}:{type:"literal",value:m};n.push(d);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u);let l=s.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+55,template:{format:`{event} ${i.primary} ${l} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(s.map(c=>[c.role,{fromRole:c.role}]))}}}function za(t,e,r,i,a){let n=[],s=[...t.roles.filter(y=>y.required)].sort((y,v)=>{let h=y.sovPosition??999,g=v.sovPosition??999;return h-g}),u=s[0];n.push({type:"role",role:u.role,optional:false});let l;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)l=u.markerOverride[e.code];else {let y=e.roleMarkers[u.role];y&&(l=y.primary);}if(l&&n.push({type:"literal",value:l}),n.push({type:"role",role:"event",optional:false}),i.position==="after"){let y=i.primary.split(/\s+/);if(y.length>1)for(let v of y)n.push({type:"literal",value:v});else {let v=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(v);}}let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);let m=s[1];n.push({type:"role",role:m.role,optional:false});let p,d;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)p=m.markerOverride[e.code];else {let y=e.roleMarkers[m.role];y&&(p=y.primary,d=y.alternatives);}if(p){let y=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(y);}return {id:`${t.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`{${u.role}} {event} ${i.primary} ${r.primary} {${m.role}}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},[u.role]:{fromRole:u.role},[m.role]:{fromRole:m.role}}}}function Ye(t,e,r,i,a){let n=[];if(i.position==="before"){let u=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(u);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&n.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${t.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(a.basePriority??100)+50,template:{format:`${i.primary} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ba(t,e,r,i,a){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;if(s&&n.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),i.position==="before"){let u=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(u);}return n.push({type:"role",role:"event",optional:false}),{id:`${t.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(a.basePriority??100)+45,template:{format:`${r.primary} {patient} ${s?.primary||""} {destination?} ${i.primary} {event}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ka(t,e,r,i,a){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let u=[...t.roles.filter(c=>c.required)].sort((c,m)=>{let p=c.svoPosition??999,d=m.svoPosition??999;return p-d});for(let c of u){let m,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)m=c.markerOverride[e.code];else {let d=e.roleMarkers[c.role];d&&(m=d.primary,p=d.alternatives);}if(m){let d=p?{type:"literal",value:m,alternatives:p}:{type:"literal",value:m};n.push(d);}n.push({type:"role",role:c.role,optional:false});}if(i.position==="before"){let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(c);}n.push({type:"role",role:"event",optional:false});let l=u.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`${r.primary} ${l} ${i.primary} {event}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(u.map(c=>[c.role,{fromRole:c.role}]))}}}function Xe(t,e,r,i,a){let n=[];if(i.position==="before"){let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(c);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let u=[...t.roles.filter(c=>c.required)].sort((c,m)=>{let p=c.svoPosition??999,d=m.svoPosition??999;return p-d});for(let c of u){let m,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)m=c.markerOverride[e.code];else {let d=e.roleMarkers[c.role];d&&(m=d.primary,p=d.alternatives);}if(m){let d=p?{type:"literal",value:m,alternatives:p}:{type:"literal",value:m};n.push(d);}n.push({type:"role",role:c.role,optional:false});}let l=u.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+55,template:{format:`${i.primary} {event} ${r.primary} ${l}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(u.map(c=>[c.role,{fromRole:c.role}]))}}}function wa(t,e,r,i,a){let n=[],o=e.eventHandler?.negationMarker;if(i.position==="before"){let l=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(l);}if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(s),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),{id:`${t.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`${i.primary} ${o?.primary||""} {event} ${r.primary} {patient} ${u?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ca(t,e,r,i){let a=[];a.push({type:"literal",value:"and",alternatives:["then"]}),a.push({type:"role",role:"event",optional:false});let n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(n),a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&a.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),{id:`${t.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var se={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function pr(t,e,r=se){let i=`${t.action}-${e.code}-generated`,a=r.basePriority??100,n=e.keywords[t.action];if(!n)throw new Error(`No keyword translation for '${t.action}' in ${e.code}`);let o=Sa(t,e,n),s=yr(t,e),u=Pa(t,e,n);return {id:i,language:e.code,command:t.action,priority:a,template:{format:u,tokens:o},extraction:s}}function Aa(t,e,r=se){if(t.roles.filter(s=>!s.required).length===0)return null;let a=t.roles.filter(s=>s.required),n={...t,roles:a};return {...pr(n,e,r),id:`${t.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:yr(t,e)}}function xa(t,e,r=se){let i=[];if(i.push(pr(t,e,r)),r.generateSimpleVariants){let a=Aa(t,e,r);a&&i.push(a);}return i}function dr(t,e=se){let r=[],i=sa();for(let a of i){if(!t.keywords[a.action])continue;let n=xa(a,t,e);if(r.push(...n),t.eventHandler?.eventMarker){let o=Da(a,t,e);r.push(...o);}}return r}function Da(t,e,r=se){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let i=[],a=e.eventHandler.eventMarker,n=e.keywords[t.action];if(!n)return [];let s=t.roles.filter(u=>u.required).length===2;if(e.wordOrder==="SOV")if(s)i.push(Ea(t,e,n,a,r)),i.push(za(t,e,n,a,r));else {i.push(da(t,e,n,a,r)),i.push(ya(t,e,n,a,r));let u=e.roleMarkers.destination;u&&u.primary!==a.primary&&i.push(fa(t,e,n,a,r));let l=a.primary.split(/\s+/),c=a.alternatives?.some(p=>!p.includes(" ")&&p.length>1);l.length>1&&c&&i.push(ha(t,e,n,a,r)),i.push(va(t,e,n,a,r));let m=ga(t,e,n,r);m&&i.push(m);}else e.wordOrder==="VSO"?s?(i.push(Xe(t,e,n,a,r)),i.push(ka(t,e,n,a,r))):(i.push(Ye(t,e,n,a,r)),i.push(ba(t,e,n,a,r)),e.eventHandler?.negationMarker&&i.push(wa(t,e,n,a,r)),e.tokenization?.prefixes&&i.push(Ca(t,e,n,r))):s?i.push(Xe(t,e,n,a,r)):i.push(Ye(t,e,n,a,r));return i}function Sa(t,e,r){let i=[],a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},n=Ba(t,e);switch(e.wordOrder){case "SVO":i.push(a),i.push(...n);break;case "SOV":i.push(...n),i.push(a);break;case "VSO":i.push(a),i.push(...n);break;default:i.push(a),i.push(...n);}return i}function Ba(t,e){let r=[],i=mr(t.roles,e.wordOrder);for(let a of i){let n=Ta(a,e);a.required?r.push(...n):r.push({type:"group",optional:true,tokens:n});}return r}function Ta(t,e){let r=[],i=t.markerOverride?.[e.code],a=e.roleMarkers[t.role],n={type:"role",role:t.role,optional:!t.required,expectedTypes:t.expectedTypes};if(i!==void 0){let o=i?i.split(/\s+/).filter(Boolean):[];if((a?.position??"before")==="before"){for(let u of o)r.push({type:"literal",value:u});r.push(n);}else {r.push(n);for(let u of o)r.push({type:"literal",value:u});}}else if(a)if(a.position==="before"){if(a.primary){let o=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};r.push(o);}r.push(n);}else {r.push(n);let o=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};r.push(o);}else r.push(n);return r}function Fa(t,e){let r={};for(let i of t.roles){let a=i.markerOverride?.[e.code],n=e.roleMarkers[i.role];a!==void 0?r[i.role]=a?{marker:a}:{}:n&&n.primary?r[i.role]=n.alternatives?{marker:n.primary,markerAlternatives:n.alternatives}:{marker:n.primary}:r[i.role]={};}return r}function yr(t,e){let r=Fa(t,e),i={};for(let a of t.roles){let n=r[a.role]||{};!a.required&&a.default?i[a.role]={...n,default:a.default}:i[a.role]=n;}return i}function Pa(t,e,r){let i=[],n=mr(t.roles,e.wordOrder).map(o=>{let s=pa(o,e),u="";return s&&s.primary?s.position==="before"?u=`${s.primary} {${o.role}}`:u=`{${o.role}} ${s.primary}`:u=`{${o.role}}`,o.required?u:`[${u}]`});switch(e.wordOrder){case "SVO":case "VSO":i.push(r.primary,...n);break;case "SOV":i.push(...n,r.primary);break;default:i.push(r.primary,...n);}return i.join(" ")}var Ra=class{constructor(t={}){this.cache=new Map,this.config={maxSize:t.maxSize??1e3,ttlMs:t.ttlMs??0,enabled:t.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(t,e){return `${e}:${t}`}isExpired(t){return this.config.ttlMs===0?false:Date.now()-t.createdAt>this.config.ttlMs}evictLRU(){let t=this.cache.keys().next().value;t!==void 0&&(this.cache.delete(t),this.stats.evictions++);}get(t,e){if(!this.config.enabled){this.stats.misses++;return}let r=this.makeKey(t,e),i=this.cache.get(r);if(!i){this.stats.misses++;return}if(this.isExpired(i)){this.cache.delete(r),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(r),i.lastAccessed=Date.now(),this.cache.set(r,i),this.stats.hits++,i.result}set(t,e,r){if(!this.config.enabled||r!==null&&typeof r=="object"&&"confidence"in r&&r.confidence===0)return;let i=this.makeKey(t,e),a=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(i,{result:r,createdAt:a,lastAccessed:a});}has(t,e){if(!this.config.enabled)return false;let r=this.makeKey(t,e),i=this.cache.get(r);return i?this.isExpired(i)?(this.cache.delete(r),this.stats.expirations++,false):true:false}delete(t,e){let r=this.makeKey(t,e);return this.cache.delete(r)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let t=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:t>0?this.stats.hits/t:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(t){if(t.maxSize!==void 0)for(this.config.maxSize=t.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();t.ttlMs!==void 0&&(this.config.ttlMs=t.ttlMs),t.enabled!==void 0&&(this.config.enabled=t.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new Ra;function Na(t){return /[áéíóúüñÁÉÍÓÚÜÑ]/.test(t)}var _a=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"\xE1is",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.82,type:"present"},{ending:"an",stem:"ar",confidence:.8,type:"present"},{ending:"\xE9",stem:"ar",confidence:.85,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"\xF3",stem:"ar",confidence:.82,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"asteis",stem:"ar",confidence:.88,type:"past"},{ending:"aron",stem:"ar",confidence:.88,type:"past"},{ending:"aba",stem:"ar",confidence:.88,type:"past"},{ending:"abas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1bamos",stem:"ar",confidence:.88,type:"past"},{ending:"abamos",stem:"ar",confidence:.85,type:"past"},{ending:"abais",stem:"ar",confidence:.88,type:"past"},{ending:"aban",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"\xE9is",stem:"ar",confidence:.85,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"en",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ad",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],Oa=[{ending:"iendo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"\xE9is",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"en",stem:"er",confidence:.78,type:"present"},{ending:"\xED",stem:"er",confidence:.85,type:"past"},{ending:"iste",stem:"er",confidence:.88,type:"past"},{ending:"i\xF3",stem:"er",confidence:.85,type:"past"},{ending:"io",stem:"er",confidence:.82,type:"past"},{ending:"imos",stem:"er",confidence:.85,type:"past"},{ending:"isteis",stem:"er",confidence:.88,type:"past"},{ending:"ieron",stem:"er",confidence:.88,type:"past"},{ending:"\xEDa",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"\xEDas",stem:"er",confidence:.88,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDais",stem:"er",confidence:.88,type:"past"},{ending:"iais",stem:"er",confidence:.85,type:"past"},{ending:"\xEDan",stem:"er",confidence:.88,type:"past"},{ending:"ian",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],Ma=[{ending:"iendo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"\xEDs",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"en",stem:"ir",confidence:.78,type:"present"},{ending:"\xED",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"i\xF3",stem:"ir",confidence:.85,type:"past"},{ending:"io",stem:"ir",confidence:.82,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"isteis",stem:"ir",confidence:.88,type:"past"},{ending:"ieron",stem:"ir",confidence:.88,type:"past"},{ending:"\xEDa",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDas",stem:"ir",confidence:.88,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDais",stem:"ir",confidence:.88,type:"past"},{ending:"iais",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDan",stem:"ir",confidence:.88,type:"past"},{ending:"ian",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],Ia=[..._a,...Oa,...Ma].sort((t,e)=>e.ending.length-t.ending.length),hr=class extends Ie{constructor(){super({language:"es",minWordLength:3,minStemLength:2,endings:Ia,reflexiveSuffixes:["se","me","te","nos","os"],infinitiveEndings:["ar","er","ir"]});}isNormalizable(t){if(t.length<3)return false;let e=t.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("iendo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("arse")||e.endsWith("erse")||e.endsWith("irse"))return true;for(let r of t)if(Na(r))return true;return false}};new hr;var vr={code:"es",name:"Spanish",nativeName:"Espa\xF1ol",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true},references:{me:"yo",it:"ello",you:"t\xFA",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mi",it:"su",you:"tu"},keywords:{mi:"me",tu:"you",su:"it"}},roleMarkers:{destination:{primary:"en",alternatives:["sobre","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["conmutar","toggle"],normalized:"toggle"},add:{primary:"agregar",alternatives:["a\xF1adir"],normalized:"add"},remove:{primary:"quitar",alternatives:["eliminar","remover","sacar","borrar"],normalized:"remove"},put:{primary:"poner",alternatives:["colocar","pon"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"anteponer",normalized:"prepend"},take:{primary:"tomar",normalized:"take"},make:{primary:"hacer",alternatives:["crear"],normalized:"make"},clone:{primary:"clonar",alternatives:["duplicar"],normalized:"clone"},swap:{primary:"intercambiar",alternatives:["permutar"],normalized:"swap"},morph:{primary:"transformar",alternatives:["convertir"],normalized:"morph"},set:{primary:"establecer",alternatives:["fijar","definir"],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\xF1ar"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transici\xF3n",alternatives:["animar"],normalized:"transition"},on:{primary:"en",alternatives:["al"],normalized:"on"},trigger:{primary:"disparar",alternatives:["activar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"enfocar",alternatives:["enfoque"],normalized:"focus"},blur:{primary:"desenfocar",alternatives:["desenfoque"],normalized:"blur"},open:{primary:"abrir",normalized:"open"},close:{primary:"cerrar",normalized:"close"},select:{primary:"seleccionar",normalized:"select"},clear:{primary:"limpiar",normalized:"clear"},reset:{primary:"reiniciar",alternatives:["restablecer"],normalized:"reset"},breakpoint:{primary:"punto-interrupci\xF3n",alternatives:["punto-interrupcion"],normalized:"breakpoint"},click:{primary:"clic",alternatives:["hacer clic","click"],normalized:"click"},hover:{primary:"sobrevolar",alternatives:["pasar por encima"],normalized:"hover"},submit:{primary:"env\xEDo",alternatives:["envio","someter"],normalized:"submit"},input:{primary:"entrada",alternatives:["introducir"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiar"],normalized:"change"},load:{primary:"carga",normalized:"load"},scroll:{primary:"desplazar",alternatives:["desplazamiento"],normalized:"scroll"},keydown:{primary:"tecla abajo",normalized:"keydown"},keyup:{primary:"tecla arriba",normalized:"keyup"},mouseover:{primary:"rat\xF3n encima",alternatives:["raton encima"],normalized:"mouseover"},mouseout:{primary:"rat\xF3n fuera",alternatives:["raton fuera"],normalized:"mouseout"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},push:{primary:"empujar",alternatives:["push"],normalized:"push"},replace:{primary:"reemplazar",alternatives:["sustituir"],normalized:"replace"},process:{primary:"procesar",normalized:"process"},wait:{primary:"esperar",normalized:"wait"},fetch:{primary:"buscar",alternatives:["recuperar"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"si",normalized:"if"},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"],normalized:"then"},and:{primary:"y",alternatives:["adem\xE1s","tambi\xE9n"],normalized:"and"},or:{primary:"o",normalized:"or"},not:{primary:"no",normalized:"not"},is:{primary:"es",normalized:"is"},exists:{primary:"existe",normalized:"exists"},empty:{primary:"vac\xEDo",alternatives:["vacio"],normalized:"empty"},end:{primary:"fin",alternatives:["final","terminar"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"as\xEDncrono",alternatives:["asincrono"],normalized:"async"},tell:{primary:"decir",normalized:"tell"},default:{primary:"predeterminar",alternatives:["por defecto"],normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamiento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"pitido",normalized:"beep"},break:{primary:"romper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"salir",normalized:"exit"},pick:{primary:"escoger",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},first:{primary:"primero",alternatives:["primera"],normalized:"first"},last:{primary:"\xFAltimo",alternatives:["ultima"],normalized:"last"},next:{primary:"siguiente",normalized:"next"},previous:{primary:"anterior",normalized:"previous"},closest:{primary:"cercano",normalized:"closest"},parent:{primary:"padre",normalized:"parent"},into:{primary:"dentro",alternatives:["adentro","dentro de"],normalized:"into"},before:{primary:"antes",alternatives:["antes de"],normalized:"before"},after:{primary:"despu\xE9s",alternatives:["despues","despu\xE9s de","despues de"],normalized:"after"},out:{primary:"fuera",alternatives:["fuera de"],normalized:"out"},until:{primary:"hasta",alternatives:["hasta que"],normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"},connect:{primary:"conectar",alternatives:["conectarse"],normalized:"connect"},stream:{primary:"transmitir",alternatives:["flujo"],normalized:"stream"},live:{primary:"en-vivo",alternatives:["vivo","directo"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}},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"]}},La=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],ja=class{constructor(t=La){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},Va="()[]{},:;",$a=class{constructor(t=Va){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function qa(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="."){let i=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="["){let i=0,a=e;for(;a<t.length;){if(t[a]==="["&&i++,t[a]==="]"&&(i--,i===0))return t.slice(e,a+1);a++;}return null}if(r==="<"){let i=t.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var Wa=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"}extract(t,e){let r=qa(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},Ka=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let i=r[0],a=i.slice(1).split("(")[0],n=r[1];return {value:i,length:i.length,metadata:{modifierName:a,value:n?a==="queue"?n:parseInt(n,10):void 0}}}};function Ua(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let i=r.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("//")){let i=r.match(/^\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("./")||r.startsWith("../")){let i=r.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(r.startsWith("/")){let i=r.match(/^\/[^\s]*/);return i?i[0]:null}return null}var Ga=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=Ua(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},Ha=class{constructor(){this.name="variable-ref";}canExtract(t,e){return t[e]===":"&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function Ya(){return [new Ga,new Ka,new Ha,new Wa]}function Xa(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var{isLetter:fr,isIdentifierChar:Za}=Xa(/[a-zA-ZáéíóúüñÁÉÍÓÚÜÑ]/),Ja=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),Qa=class{constructor(){this.name="spanish-keyword";}setContext(t){this.context=t;}canExtract(t,e){return fr(t[e])}extract(t,e){if(!this.context)throw new Error("SpanishKeywordExtractor: context not set");let r=this.tryMultiWordPhrase(t,e);return r||this.extractSpanishWord(t,e)}tryMultiWordPhrase(t,e){if(!this.context)return null;let r=["de lo contrario","de lo normal","por defecto","de nuevo","de otra manera"];for(let i of r)if(t.slice(e,e+i.length).toLowerCase()===i.toLowerCase()){let n=e+i.length;if(n>=t.length||$(t[n])||!fr(t[n])){let o=this.context.lookupKeyword(i);return {value:t.slice(e,n),length:i.length,metadata:{normalized:o?.normalized,multiWord:true}}}}return null}extractSpanishWord(t,e){if(!this.context)return null;let r=e,i="";for(;r<t.length&&Za(t[r]);)i+=t[r++];if(!i)return null;let a=i.toLowerCase(),n=Ja.has(a),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0,u;if(!o&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(u=c.normalized);}}return {value:i,length:r-e,metadata:{normalized:s||u,isPreposition:n}}}};function en(){return [new Qa]}var rn=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),tn=[{native:"verdadero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milisegundo",normalized:"ms"},{native:"milisegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"m\xED",normalized:"me"},{native:"destino",normalized:"target"}],an=class extends I{constructor(){super(),this.language="es",this.direction="ltr",this.initializeKeywordsFromProfile(vr,tn),this.setNormalizer(new hr),this.registerExtractors(Ya()),this.registerExtractor(new O),this.registerExtractor(new M),this.registerExtractors(en()),this.registerExtractor(new ja),this.registerExtractor(new $a);}classifyToken(t){let e=t.toLowerCase();return rn.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(t)?"operator":"identifier"}},nn=new an;j("es",nn,vr);var Er={code:"pt",name:"Portuguese",nativeName:"Portugu\xEAs",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,verb:{position:"start",subjectDrop:true},references:{me:"eu",it:"ele",you:"voc\xEA",result:"resultado",event:"evento",target:"alvo",body:"corpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"meu",it:"seu",you:"teu"},keywords:{meu:"me",minha:"me",teu:"you",tua:"you",seu:"it",sua:"it"}},roleMarkers:{destination:{primary:"em",alternatives:["para","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"com",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:[],normalized:"toggle"},add:{primary:"adicionar",alternatives:["acrescentar"],normalized:"add"},remove:{primary:"remover",alternatives:["eliminar","apagar"],normalized:"remove"},put:{primary:"colocar",alternatives:["p\xF4r","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:[],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\xE7\xE3o",alternatives:["animar"],normalized:"transition"},on:{primary:"em",alternatives:["ao"],normalized:"on"},trigger:{primary:"disparar",alternatives:["ativar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"focar",normalized:"focus"},blur:{primary:"desfocar",normalized:"blur"},empty:{primary:"esvaziar",normalized:"empty"},open:{primary:"abrir",normalized:"open"},close:{primary:"fechar",normalized:"close"},select:{primary:"selecionar",normalized:"select"},clear:{primary:"limpar",normalized:"clear"},reset:{primary:"redefinir",alternatives:["resetar"],normalized:"reset"},breakpoint:{primary:"ponto-interrup\xE7\xE3o",alternatives:["ponto-interrupcao"],normalized:"breakpoint"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},scroll:{primary:"rolar",alternatives:["scroll"],normalized:"scroll"},push:{primary:"empurrar",alternatives:["push"],normalized:"push"},replace:{primary:"repor",alternatives:["recolocar"],normalized:"replace"},process:{primary:"processar",normalized:"process"},wait:{primary:"esperar",alternatives:["aguardar"],normalized:"wait"},fetch:{primary:"buscar",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\xE3o",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\xE7ar",normalized:"throw"},call:{primary:"chamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"ent\xE3o",alternatives:["logo"],normalized:"then"},and:{primary:"e",alternatives:["tamb\xE9m","al\xE9m disso"],normalized:"and"},end:{primary:"fim",alternatives:["final","t\xE9rmino"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"ass\xEDncrono",normalized:"async"},tell:{primary:"dizer",normalized:"tell"},default:{primary:"padr\xE3o",normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"apitar",normalized:"beep"},break:{primary:"interromper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"sair",normalized:"exit"},pick:{primary:"escolher",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},into:{primary:"dentro",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"depois",normalized:"after"},click:{primary:"clique",alternatives:["clicar"],normalized:"click"},hover:{primary:"sobrevoar",alternatives:["passar"],normalized:"hover"},submit:{primary:"envio",alternatives:["submeter"],normalized:"submit"},input:{primary:"entrada",alternatives:["inser\xE7\xE3o"],normalized:"input"},change:{primary:"altera\xE7\xE3o",alternatives:["mudan\xE7a"],normalized:"change"},until:{primary:"at\xE9",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"},connect:{primary:"conectar",alternatives:["conex\xE3o"],normalized:"connect"},stream:{primary:"transmitir",alternatives:["fluxo"],normalized:"stream"},live:{primary:"ao-vivo",alternatives:["vivo","direto"],normalized:"live"},socket:{primary:"soquete",alternatives:["websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"em",alternatives:["ao"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"ao",alternatives:["no"],position:"before"},temporalMarkers:["quando","ao"]}};function on(t){return /[áàâãéêíóôõúüçÁÀÂÃÉÊÍÓÔÕÚÜÇ]/.test(t)}function sn(t){let e=t.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("endo")||e.endsWith("indo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("ar-se")||e.endsWith("er-se")||e.endsWith("ir-se"))return true;for(let r of t)if(on(r))return true;return false}var gr=["-se","-me","-te","-nos","-vos"],un=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.85,type:"present"},{ending:"am",stem:"ar",confidence:.8,type:"present"},{ending:"ei",stem:"ar",confidence:.88,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"ou",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1mos",stem:"ar",confidence:.88,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"astes",stem:"ar",confidence:.88,type:"past"},{ending:"aram",stem:"ar",confidence:.88,type:"past"},{ending:"ava",stem:"ar",confidence:.88,type:"past"},{ending:"avas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1vamos",stem:"ar",confidence:.88,type:"past"},{ending:"avamos",stem:"ar",confidence:.85,type:"past"},{ending:"\xE1veis",stem:"ar",confidence:.88,type:"past"},{ending:"aveis",stem:"ar",confidence:.85,type:"past"},{ending:"avam",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"em",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ai",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],ln=[{ending:"endo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"em",stem:"er",confidence:.78,type:"present"},{ending:"i",stem:"er",confidence:.85,type:"past"},{ending:"este",stem:"er",confidence:.88,type:"past"},{ending:"eu",stem:"er",confidence:.88,type:"past"},{ending:"emos",stem:"er",confidence:.85,type:"past"},{ending:"estes",stem:"er",confidence:.88,type:"past"},{ending:"eram",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"er",confidence:.88,type:"past"},{ending:"ieis",stem:"er",confidence:.85,type:"past"},{ending:"iam",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],cn=[{ending:"indo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"em",stem:"ir",confidence:.78,type:"present"},{ending:"i",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"iu",stem:"ir",confidence:.88,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"istes",stem:"ir",confidence:.88,type:"past"},{ending:"iram",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"ir",confidence:.88,type:"past"},{ending:"ieis",stem:"ir",confidence:.85,type:"past"},{ending:"iam",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],mn=[...un,...ln,...cn].sort((t,e)=>e.ending.length-t.ending.length),zr=class{constructor(){this.language="pt";}isNormalizable(t){return t.length<3?false:sn(t)}normalize(t){let e=t.toLowerCase();if((e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir"))&&!gr.some(a=>e.endsWith(a)))return B(t);let r=this.tryReflexiveNormalization(e);if(r)return r;let i=this.tryConjugationNormalization(e);return i||B(t)}tryReflexiveNormalization(t){for(let e of gr)if(t.endsWith(e)){let r=t.slice(0,-e.length);if(r.endsWith("ar")||r.endsWith("er")||r.endsWith("ir"))return w(r,.88,{removedSuffixes:[e],conjugationType:"reflexive"});let i=this.tryConjugationNormalization(r);if(i&&i.stem!==r)return w(i.stem,i.confidence*.95,{removedSuffixes:[e,...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(t){for(let e of mn)if(t.endsWith(e.ending)){let r=t.slice(0,-e.ending.length);if(r.length<2)continue;let i=r+e.stem;return w(i,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},pn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],dn=class{constructor(t=pn){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},yn="()[]{},:;",fn=class{constructor(t=yn){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function hn(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="."){let i=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="["){let i=0,a=e;for(;a<t.length;){if(t[a]==="["&&i++,t[a]==="]"&&(i--,i===0))return t.slice(e,a+1);a++;}return null}if(r==="<"){let i=t.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var vn=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"}extract(t,e){let r=hn(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},gn=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let i=r[0],a=i.slice(1).split("(")[0],n=r[1];return {value:i,length:i.length,metadata:{modifierName:a,value:n?a==="queue"?n:parseInt(n,10):void 0}}}};function En(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let i=r.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("//")){let i=r.match(/^\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("./")||r.startsWith("../")){let i=r.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(r.startsWith("/")){let i=r.match(/^\/[^\s]*/);return i?i[0]:null}return null}var zn=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=En(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},bn=class{constructor(){this.name="variable-ref";}canExtract(t,e){return t[e]===":"&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function kn(){return [new zn,new gn,new bn,new vn]}function wn(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var{isLetter:Cn,isIdentifierChar:An}=wn(/[a-zA-ZáâãéêíóôõúçÁÂÃÉÊÍÓÔÕÚÇ]/),xn=new Set(["em","a","de","para","com","sem","por","sobre","entre","antes","depois","dentro","fora","ao","do","da","no","na"]),Dn=class{constructor(){this.name="portuguese-keyword";}setContext(t){this.context=t;}canExtract(t,e){return Cn(t[e])}extract(t,e){if(!this.context)throw new Error("PortugueseKeywordExtractor: context not set");let r=e,i="";for(;r<t.length&&An(t[r]);)i+=t[r++];if(!i)return null;let a=i.toLowerCase(),n=xn.has(a),o=this.context.lookupKeyword(a),s=o&&o.normalized!==o.native?o.normalized:void 0,u;if(!o&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(u=c.normalized);}}return {value:i,length:r-e,metadata:{normalized:s||u,isPreposition:n}}}};function Sn(){return [new Dn]}var Bn=new Set(["em","a","de","desde","at\xE9","ate","com","sem","por","para","sobre","entre","antes","depois","dentro","fora","ao","do","no","na"]),Tn=[{native:"verdadeiro",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primeiro",normalized:"first"},{native:"primeira",normalized:"first"},{native:"\xFAltimo",normalized:"last"},{native:"ultima",normalized:"last"},{native:"pr\xF3ximo",normalized:"next"},{native:"proximo",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"mais pr\xF3ximo",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\xE7a",normalized:"change"},{native:"mudanca",normalized:"change"},{native:"envio",normalized:"submit"},{native:"tecla baixo",normalized:"keydown"},{native:"tecla cima",normalized:"keyup"},{native:"mouse sobre",normalized:"mouseover"},{native:"mouse fora",normalized:"mouseout"},{native:"foco",normalized:"focus"},{native:"desfoque",normalized:"blur"},{native:"carregar",normalized:"load"},{native:"rolagem",normalized:"scroll"},{native:"meu",normalized:"my"},{native:"minha",normalized:"my"},{native:"isso",normalized:"it"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milissegundo",normalized:"ms"},{native:"milissegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"senao",normalized:"else"},{native:"transicao",normalized:"transition"},{native:"ate",normalized:"until"},{native:"entao",normalized:"then"},{native:"lancar",normalized:"throw"},{native:"assincrono",normalized:"async"},{native:"padrao",normalized:"default"},{native:"at\xE9 que",normalized:"until"},{native:"dentro de",normalized:"into"}],Fn=class extends I{constructor(){super(),this.language="pt",this.direction="ltr",this.initializeKeywordsFromProfile(Er,Tn),this.setNormalizer(new zr),this.registerExtractors(kn()),this.registerExtractor(new O),this.registerExtractor(new M),this.registerExtractors(Sn()),this.registerExtractor(new dn),this.registerExtractor(new fn);}classifyToken(t){let e=t.toLowerCase();return Bn.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":"identifier"}},Pn=new Fn;j("pt",Pn,Er);var br={code:"fr",name:"French",nativeName:"Fran\xE7ais",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"moi",it:"il",you:"toi",result:"r\xE9sultat",event:"\xE9v\xE9nement",target:"cible",body:"corps"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"ma",it:"sa",you:"ta"},keywords:{mon:"me",ma:"me",mes:"me",ton:"you",ta:"you",tes:"you",son:"it",sa:"it",ses:"it"}},roleMarkers:{destination:{primary:"sur",alternatives:["\xE0","dans"],position:"before"},source:{primary:"de",alternatives:["depuis"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"avec",position:"before"}},keywords:{toggle:{primary:"basculer",alternatives:["alterner"],normalized:"toggle"},add:{primary:"ajouter",normalized:"add"},remove:{primary:"supprimer",alternatives:["enlever","retirer"],normalized:"remove"},put:{primary:"mettre",alternatives:["placer"],normalized:"put"},append:{primary:"annexer",normalized:"append"},prepend:{primary:"pr\xE9fixer",normalized:"prepend"},take:{primary:"prendre",normalized:"take"},make:{primary:"faire",alternatives:["cr\xE9er"],normalized:"make"},clone:{primary:"cloner",alternatives:["dupliquer"],normalized:"clone"},swap:{primary:"\xE9changer",alternatives:["permuter"],normalized:"swap"},morph:{primary:"transformer",alternatives:["m\xE9tamorphoser"],normalized:"morph"},set:{primary:"d\xE9finir",alternatives:["\xE9tablir"],normalized:"set"},get:{primary:"obtenir",normalized:"get"},increment:{primary:"incr\xE9menter",alternatives:["augmenter"],normalized:"increment"},decrement:{primary:"d\xE9cr\xE9menter",alternatives:["diminuer"],normalized:"decrement"},log:{primary:"enregistrer",alternatives:["journaliser"],normalized:"log"},show:{primary:"montrer",alternatives:["afficher"],normalized:"show"},hide:{primary:"cacher",alternatives:["masquer"],normalized:"hide"},transition:{primary:"transition",alternatives:["animer"],normalized:"transition"},on:{primary:"sur",alternatives:["lors"],normalized:"on"},trigger:{primary:"d\xE9clencher",normalized:"trigger"},send:{primary:"envoyer",normalized:"send"},focus:{primary:"focaliser",alternatives:["concentrer"],normalized:"focus"},blur:{primary:"d\xE9focaliser",normalized:"blur"},empty:{primary:"vider",normalized:"empty"},open:{primary:"ouvrir",normalized:"open"},close:{primary:"fermer",normalized:"close"},select:{primary:"s\xE9lectionner",alternatives:["selectionner"],normalized:"select"},clear:{primary:"effacer",normalized:"clear"},reset:{primary:"r\xE9initialiser",alternatives:["reinitialiser"],normalized:"reset"},breakpoint:{primary:"point-arr\xEAt",alternatives:["point-arret"],normalized:"breakpoint"},go:{primary:"aller",alternatives:["naviguer"],normalized:"go"},scroll:{primary:"d\xE9filer",alternatives:["faire-d\xE9filer"],normalized:"scroll"},push:{primary:"pousser",normalized:"push"},replace:{primary:"remplacer",normalized:"replace"},process:{primary:"traiter",normalized:"process"},wait:{primary:"attendre",normalized:"wait"},fetch:{primary:"chercher",alternatives:["r\xE9cup\xE9rer"],normalized:"fetch"},settle:{primary:"stabiliser",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"quand",normalized:"when"},where:{primary:"o\xF9",normalized:"where"},else:{primary:"sinon",normalized:"else"},repeat:{primary:"r\xE9p\xE9ter",normalized:"repeat"},for:{primary:"pour",normalized:"for"},while:{primary:"pendant",normalized:"while"},continue:{primary:"continuer",normalized:"continue"},halt:{primary:"arr\xEAter",alternatives:["stopper"],normalized:"halt"},throw:{primary:"lancer",normalized:"throw"},call:{primary:"appeler",normalized:"call"},return:{primary:"retourner",alternatives:["renvoyer"],normalized:"return"},then:{primary:"puis",alternatives:["ensuite","alors"],normalized:"then"},and:{primary:"et",alternatives:["aussi","\xE9galement"],normalized:"and"},end:{primary:"fin",alternatives:["terminer","finir"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asynchrone",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"d\xE9faut",normalized:"default"},init:{primary:"initialiser",normalized:"init"},behavior:{primary:"comportement",normalized:"behavior"},install:{primary:"installer",normalized:"install"},measure:{primary:"mesurer",normalized:"measure"},beep:{primary:"bip",normalized:"beep"},break:{primary:"interrompre",normalized:"break"},copy:{primary:"copier",normalized:"copy"},exit:{primary:"sortir",normalized:"exit"},pick:{primary:"choisir",normalized:"pick"},render:{primary:"rendu",normalized:"render"},into:{primary:"dans",normalized:"into"},before:{primary:"avant",normalized:"before"},after:{primary:"apr\xE8s",normalized:"after"},click:{primary:"clic",alternatives:["clique"],normalized:"click"},hover:{primary:"survol",alternatives:["survoler"],normalized:"hover"},submit:{primary:"soumission",alternatives:["soumettre"],normalized:"submit"},input:{primary:"saisie",alternatives:["entr\xE9e"],normalized:"input"},change:{primary:"changement",alternatives:["modifier"],normalized:"change"},until:{primary:"jusqu'\xE0",alternatives:["jusque"],normalized:"until"},event:{primary:"\xE9v\xE9nement",normalized:"event"},from:{primary:"de",alternatives:["depuis"],normalized:"from"},connect:{primary:"connecter",alternatives:["connexion"],normalized:"connect"},stream:{primary:"flux",alternatives:["streaming"],normalized:"stream"},live:{primary:"en-direct",alternatives:["direct"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}},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"]}};function Rn(t){let e=t.toLowerCase();return !!(e.endsWith("er")||e.endsWith("ir")||e.endsWith("re")||e.endsWith("ant")||e.endsWith("\xE9")||e.endsWith("i")||e.endsWith("u")||/[àâäéèêëïîôùûüÿçœæ]/i.test(t))}var Nn=["toi","vous","nous"],_n=[{ending:"ant",stem:"er",confidence:.88,type:"gerund"},{ending:"\xE9",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9e",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9s",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9es",stem:"er",confidence:.88,type:"participle"},{ending:"e",stem:"er",confidence:.75,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"ons",stem:"er",confidence:.85,type:"present"},{ending:"ez",stem:"er",confidence:.85,type:"present"},{ending:"ent",stem:"er",confidence:.82,type:"present"},{ending:"ais",stem:"er",confidence:.82,type:"past"},{ending:"ait",stem:"er",confidence:.82,type:"past"},{ending:"ions",stem:"er",confidence:.85,type:"past"},{ending:"iez",stem:"er",confidence:.85,type:"past"},{ending:"aient",stem:"er",confidence:.85,type:"past"},{ending:"ai",stem:"er",confidence:.8,type:"past"},{ending:"as",stem:"er",confidence:.78,type:"past"},{ending:"a",stem:"er",confidence:.75,type:"past"},{ending:"\xE2mes",stem:"er",confidence:.88,type:"past"},{ending:"\xE2tes",stem:"er",confidence:.88,type:"past"},{ending:"\xE8rent",stem:"er",confidence:.88,type:"past"},{ending:"erai",stem:"er",confidence:.85,type:"future"},{ending:"eras",stem:"er",confidence:.85,type:"future"},{ending:"era",stem:"er",confidence:.82,type:"future"},{ending:"erons",stem:"er",confidence:.88,type:"future"},{ending:"erez",stem:"er",confidence:.88,type:"future"},{ending:"eront",stem:"er",confidence:.88,type:"future"},{ending:"erais",stem:"er",confidence:.85,type:"conditional"},{ending:"erait",stem:"er",confidence:.85,type:"conditional"},{ending:"erions",stem:"er",confidence:.88,type:"conditional"},{ending:"eriez",stem:"er",confidence:.88,type:"conditional"},{ending:"eraient",stem:"er",confidence:.88,type:"conditional"},{ending:"ions",stem:"er",confidence:.8,type:"subjunctive"},{ending:"iez",stem:"er",confidence:.8,type:"subjunctive"},{ending:"ons",stem:"er",confidence:.82,type:"imperative"},{ending:"ez",stem:"er",confidence:.82,type:"imperative"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],On=[{ending:"issant",stem:"ir",confidence:.88,type:"gerund"},{ending:"i",stem:"ir",confidence:.8,type:"participle"},{ending:"ie",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"participle"},{ending:"ies",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"present"},{ending:"it",stem:"ir",confidence:.78,type:"present"},{ending:"issons",stem:"ir",confidence:.88,type:"present"},{ending:"issez",stem:"ir",confidence:.88,type:"present"},{ending:"issent",stem:"ir",confidence:.88,type:"present"},{ending:"issais",stem:"ir",confidence:.85,type:"past"},{ending:"issait",stem:"ir",confidence:.85,type:"past"},{ending:"issions",stem:"ir",confidence:.88,type:"past"},{ending:"issiez",stem:"ir",confidence:.88,type:"past"},{ending:"issaient",stem:"ir",confidence:.88,type:"past"},{ending:"irai",stem:"ir",confidence:.85,type:"future"},{ending:"iras",stem:"ir",confidence:.85,type:"future"},{ending:"ira",stem:"ir",confidence:.82,type:"future"},{ending:"irons",stem:"ir",confidence:.88,type:"future"},{ending:"irez",stem:"ir",confidence:.88,type:"future"},{ending:"iront",stem:"ir",confidence:.88,type:"future"},{ending:"ir",stem:"ir",confidence:.9,type:"dictionary"}],Mn=[{ending:"ant",stem:"re",confidence:.82,type:"gerund"},{ending:"u",stem:"re",confidence:.8,type:"participle"},{ending:"ue",stem:"re",confidence:.82,type:"participle"},{ending:"us",stem:"re",confidence:.82,type:"participle"},{ending:"ues",stem:"re",confidence:.82,type:"participle"},{ending:"s",stem:"re",confidence:.72,type:"present"},{ending:"d",stem:"re",confidence:.75,type:"present"},{ending:"ons",stem:"re",confidence:.82,type:"present"},{ending:"ez",stem:"re",confidence:.82,type:"present"},{ending:"ent",stem:"re",confidence:.8,type:"present"},{ending:"re",stem:"re",confidence:.9,type:"dictionary"}],In=[..._n,...On,...Mn].sort((t,e)=>e.ending.length-t.ending.length),kr=class{constructor(){this.language="fr";}isNormalizable(t){return t.length<3?false:Rn(t)}normalize(t){let e=t.toLowerCase();if((e.endsWith("er")||e.endsWith("ir")||e.endsWith("re"))&&e.length>=4)return B(t);let r=this.tryReflexiveNormalization(e);if(r)return r;let i=this.tryConjugationNormalization(e);return i||B(t)}tryReflexiveNormalization(t){for(let e of Nn){let r="-"+e;if(t.endsWith(r)){let i=t.slice(0,-r.length),a=this.tryConjugationNormalization(i);if(a&&a.stem!==i)return w(a.stem,a.confidence*.95,{removedSuffixes:[r,...a.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}}return null}tryConjugationNormalization(t){for(let e of In)if(t.endsWith(e.ending)){let r=t.slice(0,-e.ending.length);if(r.length<2)continue;let i=r+e.stem;return w(i,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},Ln=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],jn=class{constructor(t=Ln){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},Vn="()[]{},:;",$n=class{constructor(t=Vn){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function qn(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="."){let i=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="["){let i=0,a=e;for(;a<t.length;){if(t[a]==="["&&i++,t[a]==="]"&&(i--,i===0))return t.slice(e,a+1);a++;}return null}if(r==="<"){let i=t.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var Wn=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"}extract(t,e){let r=qn(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},Kn=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let i=r[0],a=i.slice(1).split("(")[0],n=r[1];return {value:i,length:i.length,metadata:{modifierName:a,value:n?a==="queue"?n:parseInt(n,10):void 0}}}};function Un(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let i=r.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("//")){let i=r.match(/^\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("./")||r.startsWith("../")){let i=r.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(r.startsWith("/")){let i=r.match(/^\/[^\s]*/);return i?i[0]:null}return null}var Gn=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=Un(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},Hn=class{constructor(){this.name="variable-ref";}canExtract(t,e){return t[e]===":"&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function Yn(){return [new Gn,new Kn,new Hn,new Wn]}function Xn(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var{isLetter:Zn,isIdentifierChar:Jn}=Xn(/[a-zA-ZàâæçéèêëïîôùûüÿœÀÂÆÇÉÈÊËÏÎÔÙÛÜŸŒ]/),Qn=new Set(["\xE0","a","de","du","des","dans","sur","sous","avec","sans","par","pour","entre","avant","apr\xE8s","apres","depuis","vers","chez","contre","au","aux"]),eo=class{constructor(){this.name="french-keyword";}setContext(t){this.context=t;}canExtract(t,e){return Zn(t[e])}extract(t,e){if(!this.context)throw new Error("FrenchKeywordExtractor: context not set");let r=e,i="";for(;r<t.length&&Jn(t[r]);)i+=t[r++];if(!i)return null;let a=i.toLowerCase(),n=Qn.has(a),o=this.context.lookupKeyword(a),s=o&&o.normalized!==o.native?o.normalized:void 0,u;if(!o&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(u=c.normalized);}}return {value:i,length:r-e,metadata:{normalized:s||u,isPreposition:n}}}};function ro(){return [new eo]}var to=[{native:"vrai",normalized:"true"},{native:"faux",normalized:"false"},{native:"nul",normalized:"null"},{native:"ind\xE9fini",normalized:"undefined"},{native:"indefini",normalized:"undefined"},{native:"premier",normalized:"first"},{native:"premi\xE8re",normalized:"first"},{native:"premiere",normalized:"first"},{native:"dernier",normalized:"last"},{native:"derni\xE8re",normalized:"last"},{native:"derniere",normalized:"last"},{native:"suivant",normalized:"next"},{native:"pr\xE9c\xE9dent",normalized:"previous"},{native:"precedent",normalized:"previous"},{native:"plus proche",normalized:"closest"},{native:"parent",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"entr\xE9e",normalized:"input"},{native:"entree",normalized:"input"},{native:"changement",normalized:"change"},{native:"soumission",normalized:"submit"},{native:"touche bas",normalized:"keydown"},{native:"touche haut",normalized:"keyup"},{native:"souris dessus",normalized:"mouseover"},{native:"souris dehors",normalized:"mouseout"},{native:"focus",normalized:"focus"},{native:"flou",normalized:"blur"},{native:"chargement",normalized:"load"},{native:"d\xE9filement",normalized:"scroll"},{native:"defilement",normalized:"scroll"},{native:"je",normalized:"me"},{native:"mon",normalized:"my"},{native:"ma",normalized:"my"},{native:"mes",normalized:"my"},{native:"\xE7a",normalized:"it"},{native:"ca",normalized:"it"},{native:"resultat",normalized:"result"},{native:"evenement",normalized:"event"},{native:"seconde",normalized:"s"},{native:"secondes",normalized:"s"},{native:"milliseconde",normalized:"ms"},{native:"millisecondes",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minutes",normalized:"m"},{native:"heure",normalized:"h"},{native:"heures",normalized:"h"},{native:"prefixer",normalized:"prepend"},{native:"creer",normalized:"make"},{native:"definir",normalized:"set"},{native:"etablir",normalized:"set"},{native:"incrementer",normalized:"increment"},{native:"decrementer",normalized:"decrement"},{native:"declencher",normalized:"trigger"},{native:"defocaliser",normalized:"blur"},{native:"recuperer",normalized:"fetch"},{native:"repeter",normalized:"repeat"},{native:"arreter",normalized:"halt"},{native:"defaut",normalized:"default"},{native:"jusqua",normalized:"until"},{native:"apres",normalized:"after"},{native:"journaliser",normalized:"log"},{native:"transmuter",normalized:"morph"},{native:"tant que",normalized:"while"}],io=class extends I{constructor(){super(),this.language="fr",this.direction="ltr",this.initializeKeywordsFromProfile(br,to),this.normalizer=new kr,this.registerExtractors(Yn()),this.registerExtractor(new O),this.registerExtractor(new M),this.registerExtractors(ro()),this.registerExtractor(new jn),this.registerExtractor(new $n);}classifyToken(t){return this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(t)?"operator":t.startsWith("/")||t.startsWith("./")||t.startsWith("http")?"url":"identifier"}},ao=new io;j("fr",ao,br);var wr={code:"de",name:"German",nativeName:"Deutsch",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"ich",it:"es",you:"du",result:"Ergebnis",event:"Ereignis",target:"Ziel",body:"K\xF6rper"},possessive:{marker:"",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mein",it:"sein",you:"dein"},keywords:{mein:"me",meine:"me",meinen:"me",dein:"you",deine:"you",deinen:"you",sein:"it",seine:"it",seinen:"it"}},roleMarkers:{destination:{primary:"auf",alternatives:["zu","in"],position:"before"},source:{primary:"von",alternatives:["aus"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"mit",position:"before"}},keywords:{toggle:{primary:"umschalten",alternatives:["wechseln"],normalized:"toggle"},add:{primary:"hinzuf\xFCgen",normalized:"add"},remove:{primary:"entfernen",alternatives:["l\xF6schen"],normalized:"remove"},put:{primary:"setzen",alternatives:["stellen","platzieren"],normalized:"put"},append:{primary:"anh\xE4ngen",normalized:"append"},prepend:{primary:"voranstellen",normalized:"prepend"},take:{primary:"nehmen",normalized:"take"},make:{primary:"machen",alternatives:["erstellen","erzeugen"],normalized:"make"},clone:{primary:"klonen",alternatives:["duplizieren"],normalized:"clone"},swap:{primary:"austauschen",alternatives:["tauschen","vertauschen"],normalized:"swap"},morph:{primary:"verwandeln",alternatives:["transformieren"],normalized:"morph"},set:{primary:"festlegen",alternatives:["definieren"],normalized:"set"},get:{primary:"holen",alternatives:["bekommen"],normalized:"get"},increment:{primary:"erh\xF6hen",normalized:"increment"},decrement:{primary:"verringern",alternatives:["vermindern"],normalized:"decrement"},log:{primary:"protokollieren",alternatives:["ausgeben"],normalized:"log"},show:{primary:"zeigen",alternatives:["anzeigen"],normalized:"show"},hide:{primary:"verbergen",alternatives:["verstecken"],normalized:"hide"},transition:{primary:"\xFCbergang",alternatives:["animieren"],normalized:"transition"},on:{primary:"bei",alternatives:["auf"],normalized:"on"},trigger:{primary:"ausl\xF6sen",normalized:"trigger"},send:{primary:"senden",alternatives:["schicken"],normalized:"send"},focus:{primary:"fokussieren",normalized:"focus"},blur:{primary:"defokussieren",alternatives:["entfokussieren"],normalized:"blur"},empty:{primary:"leeren",normalized:"empty"},open:{primary:"\xF6ffnen",alternatives:["oeffnen"],normalized:"open"},close:{primary:"schlie\xDFen",alternatives:["schliessen"],normalized:"close"},select:{primary:"markieren",normalized:"select"},clear:{primary:"bereinigen",normalized:"clear"},reset:{primary:"zur\xFCcksetzen",alternatives:["zuruecksetzen"],normalized:"reset"},breakpoint:{primary:"haltepunkt",normalized:"breakpoint"},go:{primary:"gehen",alternatives:["navigieren"],normalized:"go"},scroll:{primary:"scrollen",normalized:"scroll"},push:{primary:"dr\xFCcken",alternatives:["push"],normalized:"push"},replace:{primary:"ersetzen",normalized:"replace"},process:{primary:"verarbeiten",normalized:"process"},wait:{primary:"warten",normalized:"wait"},fetch:{primary:"abrufen",alternatives:["laden"],normalized:"fetch"},settle:{primary:"stabilisieren",normalized:"settle"},if:{primary:"falls",alternatives:["sofern"],normalized:"if"},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\xFCr",normalized:"for"},while:{primary:"solange",alternatives:["w\xE4hrend"],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\xFCckgeben",normalized:"return"},then:{primary:"dann",alternatives:["danach","anschlie\xDFend"],normalized:"then"},and:{primary:"und",alternatives:["sowie","auch"],normalized:"and"},end:{primary:"ende",alternatives:["fertig"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asynchron",normalized:"async"},tell:{primary:"sagen",normalized:"tell"},default:{primary:"standard",normalized:"default"},init:{primary:"initialisieren",normalized:"init"},behavior:{primary:"verhalten",normalized:"behavior"},install:{primary:"installieren",normalized:"install"},measure:{primary:"messen",normalized:"measure"},beep:{primary:"piepton",normalized:"beep"},break:{primary:"unterbrechen",normalized:"break"},copy:{primary:"kopieren",normalized:"copy"},exit:{primary:"beenden",normalized:"exit"},pick:{primary:"ausw\xE4hlen",normalized:"pick"},render:{primary:"rendern",normalized:"render"},into:{primary:"hinein",normalized:"into"},before:{primary:"vor",normalized:"before"},after:{primary:"nach",normalized:"after"},click:{primary:"Klick",alternatives:["Klicken"],normalized:"click"},hover:{primary:"Hover",alternatives:["Schweben"],normalized:"hover"},submit:{primary:"Absenden",alternatives:["Senden"],normalized:"submit"},input:{primary:"Eingabe",normalized:"input"},change:{primary:"\xC4nderung",alternatives:["\xC4ndern"],normalized:"change"},until:{primary:"bis",normalized:"until"},event:{primary:"Ereignis",alternatives:["Event"],normalized:"event"},from:{primary:"von",alternatives:["aus"],normalized:"from"},connect:{primary:"verbinden",alternatives:["Verbindung"],normalized:"connect"},stream:{primary:"stream",alternatives:["Strom"],normalized:"stream"},live:{primary:"direkt",alternatives:["live","echtzeit"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}},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"]}},no=["an","auf","aus","ein","mit","vor","zu","ab","bei","nach","weg","um","her","hin"];function oo(t){let e=t.toLowerCase();return !!(e.endsWith("en")||e.endsWith("eln")||e.endsWith("ern")||e.startsWith("ge")&&e.endsWith("t")||e.startsWith("ge")&&e.endsWith("en")||/[äöüß]/i.test(t))}var so=[{ending:"end",stem:"en",confidence:.88,type:"gerund"},{ending:"e",stem:"en",confidence:.75,type:"present"},{ending:"st",stem:"en",confidence:.8,type:"present"},{ending:"t",stem:"en",confidence:.78,type:"present"},{ending:"en",stem:"en",confidence:.85,type:"dictionary"},{ending:"test",stem:"en",confidence:.85,type:"past"},{ending:"ten",stem:"en",confidence:.82,type:"past"},{ending:"tet",stem:"en",confidence:.85,type:"past"},{ending:"te",stem:"en",confidence:.82,type:"past"},{ending:"test",stem:"en",confidence:.8,type:"subjunctive"},{ending:"ten",stem:"en",confidence:.78,type:"subjunctive"},{ending:"tet",stem:"en",confidence:.8,type:"subjunctive"},{ending:"te",stem:"en",confidence:.78,type:"subjunctive"},{ending:"e",stem:"en",confidence:.72,type:"imperative"},{ending:"t",stem:"en",confidence:.72,type:"imperative"},{ending:"en",stem:"en",confidence:.75,type:"imperative"}],uo=[{ending:"le",stem:"eln",confidence:.82,type:"present"},{ending:"elst",stem:"eln",confidence:.85,type:"present"},{ending:"elt",stem:"eln",confidence:.85,type:"present"},{ending:"eln",stem:"eln",confidence:.88,type:"dictionary"},{ending:"re",stem:"ern",confidence:.82,type:"present"},{ending:"erst",stem:"ern",confidence:.85,type:"present"},{ending:"ert",stem:"ern",confidence:.85,type:"present"},{ending:"ern",stem:"ern",confidence:.88,type:"dictionary"}],lo=[...so,...uo].sort((t,e)=>e.ending.length-t.ending.length),Cr=class{constructor(){this.language="de";}isNormalizable(t){return t.length<3?false:oo(t)}normalize(t){let e=t.toLowerCase();if(e.endsWith("en")&&e.length>=4)return B(t);if((e.endsWith("eln")||e.endsWith("ern"))&&e.length>=5)return B(t);let r=this.tryParticipleNormalization(e);if(r)return r;let i=this.tryConjugationNormalization(e);return i||B(t)}tryParticipleNormalization(t){for(let e of no)if(t.startsWith(e+"ge")){let r=t.slice(e.length),i=this.trySimpleParticipleNormalization(r);if(i){let a={removedPrefixes:["ge"],conjugationType:"participle"};return i.metadata?.removedSuffixes&&(a.removedSuffixes=i.metadata.removedSuffixes),w(e+i.stem,i.confidence*.95,a)}}return this.trySimpleParticipleNormalization(t)}trySimpleParticipleNormalization(t){if(!t.startsWith("ge"))return null;let e=t.slice(2);if(e.endsWith("t")&&e.length>=3){let r=e.slice(0,-1);return w(r+"en",.85,{removedPrefixes:["ge"],removedSuffixes:["t"],conjugationType:"participle"})}return e.endsWith("en")&&e.length>=4?w(e,.82,{removedPrefixes:["ge"],conjugationType:"participle"}):null}tryConjugationNormalization(t){for(let e of lo)if(t.endsWith(e.ending)){let r=t.slice(0,-e.ending.length);if(r.length<2)continue;let i=r+e.stem;return w(i,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},co=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],mo=class{constructor(t=co){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},po="()[]{},:;",yo=class{constructor(t=po){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function fo(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="."){let i=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="["){let i=0,a=e;for(;a<t.length;){if(t[a]==="["&&i++,t[a]==="]"&&(i--,i===0))return t.slice(e,a+1);a++;}return null}if(r==="<"){let i=t.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var ho=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"}extract(t,e){let r=fo(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},vo=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let i=r[0],a=i.slice(1).split("(")[0],n=r[1];return {value:i,length:i.length,metadata:{modifierName:a,value:n?a==="queue"?n:parseInt(n,10):void 0}}}};function go(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let i=r.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("//")){let i=r.match(/^\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("./")||r.startsWith("../")){let i=r.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(r.startsWith("/")){let i=r.match(/^\/[^\s]*/);return i?i[0]:null}return null}var Eo=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=go(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},zo=class{constructor(){this.name="variable-ref";}canExtract(t,e){return t[e]===":"&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function bo(){return [new Eo,new vo,new zo,new ho]}function ko(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var{isLetter:wo,isIdentifierChar:Co}=ko(/[a-zA-ZäöüÄÖÜß]/),Ao=new Set(["an","auf","aus","bei","durch","f\xFCr","fur","gegen","in","mit","nach","ohne","seit","\xFCber","uber","um","unter","von","vor","zu","zwischen","bis","gegen\xFCber","gegenuber","w\xE4hrend","wahrend","wegen","trotz","statt","innerhalb","au\xDFerhalb","ausserhalb"]),xo=class{constructor(){this.name="german-keyword";}setContext(t){this.context=t;}canExtract(t,e){return wo(t[e])}extract(t,e){if(!this.context)throw new Error("GermanKeywordExtractor: context not set");return this.extractGermanWord(t,e)}extractGermanWord(t,e){if(!this.context)return null;let r=e,i="";for(;r<t.length&&Co(t[r]);)i+=t[r++];if(!i)return null;let a=i.toLowerCase(),n=Ao.has(a),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0,u;if(!o&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(u=c.normalized);}}return {value:i,length:r-e,metadata:{normalized:s||u,isPreposition:n}}}};function Do(){return [new xo]}var So=[{native:"wahr",normalized:"true"},{native:"falsch",normalized:"false"},{native:"null",normalized:"null"},{native:"undefiniert",normalized:"undefined"},{native:"erste",normalized:"first"},{native:"erster",normalized:"first"},{native:"erstes",normalized:"first"},{native:"letzte",normalized:"last"},{native:"letzter",normalized:"last"},{native:"letztes",normalized:"last"},{native:"n\xE4chste",normalized:"next"},{native:"nachste",normalized:"next"},{native:"vorherige",normalized:"previous"},{native:"n\xE4chste",normalized:"closest"},{native:"eltern",normalized:"parent"},{native:"klick",normalized:"click"},{native:"click",normalized:"click"},{native:"eingabe",normalized:"input"},{native:"\xE4nderung",normalized:"change"},{native:"anderung",normalized:"change"},{native:"absenden",normalized:"submit"},{native:"taste unten",normalized:"keydown"},{native:"taste oben",normalized:"keyup"},{native:"maus dr\xFCber",normalized:"mouseover"},{native:"maus druber",normalized:"mouseover"},{native:"maus weg",normalized:"mouseout"},{native:"fokus",normalized:"focus"},{native:"unsch\xE4rfe",normalized:"blur"},{native:"unscharfe",normalized:"blur"},{native:"scrollen",normalized:"scroll"},{native:"meine",normalized:"my"},{native:"meinen",normalized:"my"},{native:"ergebnis",normalized:"result"},{native:"ziel",normalized:"target"},{native:"sekunde",normalized:"s"},{native:"sekunden",normalized:"s"},{native:"millisekunde",normalized:"ms"},{native:"millisekunden",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minuten",normalized:"m"},{native:"stunde",normalized:"h"},{native:"stunden",normalized:"h"},{native:"hinzufugen",normalized:"add"},{native:"hinzufgen",normalized:"add"},{native:"loschen",normalized:"remove"},{native:"anhangen",normalized:"append"},{native:"erhohen",normalized:"increment"},{native:"ubergang",normalized:"transition"},{native:"auslosen",normalized:"trigger"},{native:"zuruckgeben",normalized:"return"},{native:"anschliessend",normalized:"then"},{native:"erh\xF6he",normalized:"increment"},{native:"erhohe",normalized:"increment"},{native:"verringere",normalized:"decrement"}],Bo=class extends I{constructor(){super(),this.language="de",this.direction="ltr",this.initializeKeywordsFromProfile(wr,So),this.normalizer=new Cr,this.registerExtractors(bo()),this.registerExtractor(new O),this.registerExtractor(new M),this.registerExtractors(Do()),this.registerExtractor(new mo),this.registerExtractor(new yo);}classifyToken(t){return this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":"identifier"}},To=new Bo;j("de",To,wr);function he(t){let e=t.getAttribute("data-lang");if(e)return De(e);let r=t.getAttribute("data-hyperscript-lang")??t.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return De(r);let i=typeof document<"u"?document.documentElement?.lang:null;return i&&i!=="en"?De(i):null}function De(t){return t.split("-")[0].toLowerCase()}var Ar={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],breakpoint:[],call:[["patient",""]],clear:[["patient",""]],clone:[["patient",""],["destination","into"]],close:[["patient",""]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],empty:[["patient",""]],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],open:[["style","as"],["patient",""]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],process:[["patient","partials in"]],push:[["patient","url"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],replace:[["patient","url"]],reset:[["patient",""]],return:[["patient",""]],scroll:[["destination","to"]],select:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["duration",""]],while:[["condition",""]]};function ve(t){switch(t.kind){case "event-handler":return Fo(t);case "compound":return Po(t);default:return Ro(t)}}function Fo(t){let e=["on"],r=t.roles.get("event");r&&e.push(ue(r));let i=t.roles.get("source");if(i&&e.push("from",ue(i)),t.body&&t.body.length>0){let a=t.body.map(ve);e.push(a.join(" then "));}return e.join(" ")}function Po(t){let e=t.chainType==="async"?"async":t.chainType;return t.statements.map(ve).join(` ${e} `)}function Ro(t){let e=Ar[t.action];if(e){let i=[t.action];for(let[a,n]of e){let o=t.roles.get(a);o&&(a==="destination"&&o.type==="reference"&&o.value==="me"||(n&&i.push(n),i.push(ue(o))));}return i.join(" ")}let r=[t.action];for(let[,i]of t.roles)r.push(ue(i));return r.join(" ")}function ue(t){switch(t.type){case "literal":return typeof t.value=="string"&&t.dataType==="string"?`"${t.value}"`:String(t.value);case "selector":return t.value;case "reference":return t.value;case "property-path":return No(t);case "expression":return t.raw;case "flag":return t.enabled?`+${t.name}`:`~${t.name}`}}function No(t){let e=ue(t.object),r=t.property;if(t.object.type==="reference")switch(t.object.value){case "me":return `my ${r}`;case "it":return `its ${r}`;case "you":return `your ${r}`}return `${e}'s ${r}`}var Dr=.5,_o={confidenceThreshold:Dr,strategy:"semantic",fallbackToOriginal:true};function Oo(t,e){return typeof t=="number"?t:t[e]??t["*"]??Dr}function Se(t,e,r={}){let i={..._o,...r},a=xr(t,e,i);if(a!==null)return a;let n=Io(t);if(n){let o=xr(n.commands,e,i);if(o!==null)return n.prefix+o}return t}function xr(t,e,r){if(r.strategy==="semantic"||r.strategy==="auto"){let i=Oo(r.confidenceThreshold,e),a=Sr(t,e,i);if(a!==null)return a}if((r.strategy==="auto"||r.strategy==="i18n")&&r.i18nToEnglish){let i=Lo(t,e,r.i18nToEnglish);if(i!==null)return i}return null}var Mo=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Io(t){let e=t.match(Mo);if(!e)return null;let r=e[1],i=t.slice(r.length);return i?{prefix:r,commands:i}:null}function Sr(t,e,r){try{let i=Vo(t,e);if(i.length>1)return $o(i,e,r);if(!or(e))return null;let a=cr(t,e);return a.confidence<r||!a.node?null:ve(a.node)}catch{return null}}function Lo(t,e,r){try{let i=r(t,e);return i!==t?i:null}catch{return null}}function jo(t){let e=["then"],r=K(t);if(r?.keywords?.then){let i=r.keywords.then;if(i.primary&&i.primary!=="then"&&e.push(i.primary),i.alternatives)for(let a of i.alternatives)e.includes(a)||e.push(a);}return e}function Vo(t,e){let i=jo(e).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),a=new RegExp(`\\s+(?:${i.join("|")})\\s+`,"i"),n=t.split(`
|
|
4
|
+
`).map(s=>s.trim()).filter(s=>s.length>0),o=[];for(let s of n){let u=s.split(a);o.push(...u);}return o}function $o(t,e,r){let i=[];for(let a of t){let n=Sr(a.trim(),e,r);if(n===null)return null;i.push(n);}return i.join(" then ")}function Be(t={}){return function(r){let{internals:i}=r,a=i.runtime,n=a.getScript.bind(a);a.getScript=function(o){let s=n(o);if(!s)return null;let u=qo(o,t);if(!u||u==="en")return s;let l=Se(s,u,t);return t.debug&&l!==s&&console.log(`[hyperscript-i18n] ${u}: "${s}" \u2192 "${l}"`),l};}}function qo(t,e){if(e.languageAttribute){let i=t.getAttribute(e.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let r=he(t);return r||(e.defaultLanguage??null)}function Br(t,e,r={}){return e==="en"?t:Se(t,e,r)}nr(t=>dr(t));function Tr(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Be()),Wo());}function Wo(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let r=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(r).forEach(i=>{let a=e.getInternalData(i);a.initialized&&(a.initialized=false);}),e.processNode(document.body);}var Cl=["es","pt","fr","de"];Tr();exports.plugin=Be;exports.preprocess=Br;exports.resolveLanguage=he;exports.supportedLanguages=Cl;return exports;})({});
|