@lokascript/hyperscript-adapter 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -3
- package/dist/hyperscript-i18n-ar.global.js +4 -4
- package/dist/hyperscript-i18n-bn.global.js +4 -4
- package/dist/hyperscript-i18n-de.global.js +4 -4
- package/dist/hyperscript-i18n-east-asian.global.js +4 -4
- package/dist/hyperscript-i18n-en.global.js +6 -6
- package/dist/hyperscript-i18n-es.global.js +4 -4
- package/dist/hyperscript-i18n-fr.global.js +4 -4
- package/dist/hyperscript-i18n-he.global.js +4 -4
- package/dist/hyperscript-i18n-hi.global.js +4 -4
- package/dist/hyperscript-i18n-id.global.js +4 -4
- package/dist/hyperscript-i18n-it.global.js +4 -4
- package/dist/hyperscript-i18n-ja.global.js +4 -4
- package/dist/hyperscript-i18n-ko.global.js +4 -4
- package/dist/hyperscript-i18n-ms.global.js +4 -4
- package/dist/hyperscript-i18n-pl.global.js +4 -4
- package/dist/hyperscript-i18n-pt.global.js +4 -4
- package/dist/hyperscript-i18n-qu.global.js +4 -4
- package/dist/hyperscript-i18n-ru.global.js +4 -4
- package/dist/hyperscript-i18n-slavic.global.js +4 -4
- package/dist/hyperscript-i18n-south-asian.global.js +4 -4
- package/dist/hyperscript-i18n-southeast-asian.global.js +4 -4
- package/dist/hyperscript-i18n-sw.global.js +4 -4
- package/dist/hyperscript-i18n-th.global.js +4 -4
- package/dist/hyperscript-i18n-tl.global.js +4 -4
- package/dist/hyperscript-i18n-tr.global.js +4 -4
- package/dist/hyperscript-i18n-uk.global.js +4 -4
- package/dist/hyperscript-i18n-vi.global.js +4 -4
- package/dist/hyperscript-i18n-western.global.js +4 -4
- package/dist/hyperscript-i18n-zh.global.js +4 -4
- package/dist/hyperscript-i18n.global.js +73 -7
- package/dist/hyperscript-i18n.global.js.map +1 -1
- package/package.json +1 -1
- package/src/hyperscript-renderer.ts +3 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var HyperscriptI18n=(function(exports){'use strict';var Xt=new Map,Yt=new Map,Jt=new Map;function er(e,n,r){Xt.set(e,n),Yt.set(e,r),Jt.delete(e);}var tr=class{constructor(e,n){this.pos=0,this.tokens=e,this.language=n;}peek(e=0){let n=this.pos+e;return n<0||n>=this.tokens.length?null:this.tokens[n]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(e){this.pos=e.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(e){let n=[];for(;!this.isAtEnd()&&e(this.peek());)n.push(this.advance());return n}skipWhile(e){for(;!this.isAtEnd()&&e(this.peek());)this.advance();}};function k(e,n){return {start:e,end:n}}function w(e,n,r,t){if(typeof t=="string")return {value:e,kind:n,position:r,normalized:t};if(t){let{normalized:i,stem:a,stemConfidence:o}=t;return {value:e,kind:n,position:r,...i!==void 0&&{normalized:i},...a!==void 0&&{stem:a},...o!==void 0&&{stemConfidence:o}}}return {value:e,kind:n,position:r}}function Z(e){return /\s/.test(e)}function We(e){return e==="#"||e==="."||e==="["||e==="@"||e==="*"||e==="<"}function qe(e){return e==='"'||e==="'"||e==="`"||e==="\u300C"||e==="\u300D"}function L(e){return /\d/.test(e)}function rr(e){return /[a-zA-Z]/.test(e)}function O(e){return /[a-zA-Z0-9_-]/.test(e)}function nr(e){let n=t=>e.test(t);return {isLetter:n,isIdentifierChar:t=>n(t)||/[0-9_-]/.test(t)}}function ir(e,n){if(n>=e.length)return null;let r=e[n];if(!We(r))return null;let t=n,i="";if(r==="#"||r==="."){for(i+=e[t++];t<e.length&&O(e[t]);)i+=e[t++];if(i.length<=1)return null;if(t<e.length&&e[t]==="."&&r==="#"){let o=t+1;for(;o<e.length&&O(e[o]);)o++;if(o<e.length&&e[o]==="(")return i}}else if(r==="["){let a=1,o=false,s=null,l=false;for(i+=e[t++];t<e.length&&a>0;){let c=e[t];i+=c,l?l=false:c==="\\"?l=true:o?c===s&&(o=false,s=null):c==='"'||c==="'"||c==="`"?(o=true,s=c):c==="["?a++:c==="]"&&a--,t++;}if(a!==0)return null}else if(r==="@"){for(i+=e[t++];t<e.length&&O(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="*"){for(i+=e[t++];t<e.length&&O(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="<"){if(i+=e[t++],t>=e.length||!rr(e[t]))return null;for(;t<e.length&&O(e[t]);)i+=e[t++];for(;t<e.length;){let a=e[t];if(a==="."){if(i+=e[t++],t>=e.length||!O(e[t]))return null;for(;t<e.length&&O(e[t]);)i+=e[t++];}else if(a==="#"){if(i+=e[t++],t>=e.length||!O(e[t]))return null;for(;t<e.length&&O(e[t]);)i+=e[t++];}else if(a==="["){let o=1,s=false,l=null,c=false;for(i+=e[t++];t<e.length&&o>0;){let u=e[t];i+=u,c?c=false:u==="\\"?c=true:s?u===l&&(s=false,l=null):u==='"'||u==="'"||u==="`"?(s=true,l=u):u==="["?o++:u==="]"&&o--,t++;}if(o!==0)return null}else break}for(;t<e.length&&Z(e[t]);)i+=e[t++];if(t<e.length&&e[t]==="/")for(i+=e[t++];t<e.length&&Z(e[t]);)i+=e[t++];if(t>=e.length||e[t]!==">")return null;i+=e[t++];}return i||null}function ar(e,n){if(n>=e.length||e[n]!=="'"||n+1>=e.length||e[n+1].toLowerCase()!=="s")return false;if(n+2>=e.length)return true;let t=e[n+2];return Z(t)||t==="*"||!O(t)}function or(e,n){if(n>=e.length)return null;let r=e[n];if(!qe(r)||r==="'"&&ar(e,n))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!i)return null;let a=n+1,o=r,s=false;for(;a<e.length;){let l=e[a];if(o+=l,s)s=false;else if(l==="\\")s=true;else if(l===i)return o;a++;}return o}function Ve(e,n){if(n>=e.length)return false;let r=e[n],t=e[n+1]||"",i=e[n+2]||"";if(r==="/"&&t!=="/"&&/[a-zA-Z0-9._-]/.test(t)||r==="/"&&t==="/"&&/[a-zA-Z]/.test(i)||r==="."&&(t==="/"||t==="."&&i==="/"))return true;let a=e.slice(n,n+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function sr(e,n){if(!Ve(e,n))return null;let r=n,t="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<e.length;){let a=e[r];if(a==="#"){if(t.length>0&&/[a-zA-Z0-9/.]$/.test(t))for(t+=a,r++;r<e.length&&/[a-zA-Z0-9_-]/.test(e[r]);)t+=e[r++];break}if(i.test(a))t+=a,r++;else break}return t.length<2?null:t}function lr(e,n){if(n>=e.length)return null;let r=e[n];if(!L(r)&&r!=="-"&&r!=="+")return null;let t=n,i="";if((e[t]==="-"||e[t]==="+")&&(i+=e[t++]),t>=e.length||!L(e[t]))return null;for(;t<e.length&&L(e[t]);)i+=e[t++];if(t<e.length&&e[t]===".")for(i+=e[t++];t<e.length&&L(e[t]);)i+=e[t++];return t<e.length&&(e.slice(t,t+2)==="ms"?i+="ms":(e[t]==="s"||e[t]==="m"||e[t]==="h")&&(i+=e[t])),i}var Ke=class je{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(n,r,t){if(n[r]!==".")return false;let i=t[t.length-1],a=i&&i.position.end<r;if(i&&!a&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return t.push(w(".","operator",k(r,r+1))),true;let l=r+1;for(;l<n.length&&O(n[l]);)l++;return l<n.length&&n[l]==="("?(t.push(w(".","operator",k(r,r+1))),true):false}initializeKeywordsFromProfile(n,r=[]){let t=new Map;if(n.keywords){for(let[i,a]of Object.entries(n.keywords))if(t.set(a.primary,{native:a.primary,normalized:a.normalized||i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:a.normalized||i});}if(n.references){for(let[i,a]of Object.entries(n.references))t.set(a,{native:a,normalized:i});for(let i of Object.keys(n.references))t.has(i)||t.set(i,{native:i,normalized:i});}if(n.roleMarkers){for(let[i,a]of Object.entries(n.roleMarkers))if(a.primary&&t.set(a.primary,{native:a.primary,normalized:i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:i});}for(let i of r)t.set(i.native,i);this.profileKeywords=Array.from(t.values()).sort((i,a)=>a.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let a=this.removeDiacritics(i.native);a!==i.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),i);}}removeDiacritics(n){return n.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(n,r){for(let t of this.profileKeywords)if(n.slice(r).startsWith(t.native))return w(t.native,"keyword",k(r,r+t.native.length),t.normalized);return null}isKeywordStart(n,r){let t=n.slice(r);return this.profileKeywords.some(i=>t.startsWith(i.native))}lookupKeyword(n){return this.profileKeywordMap.get(n.toLowerCase())}isKeyword(n){return this.profileKeywordMap.has(n.toLowerCase())}setNormalizer(n){this.normalizer=n;}tryNormalize(n){if(!this.normalizer)return null;let r=this.normalizer.normalize(n);return r.stem!==n&&r.confidence>=.7?r:null}tryMorphKeywordMatch(n,r,t){let i=this.tryNormalize(n);if(!i)return null;let a=this.lookupKeyword(i.stem);if(!a)return null;let o={normalized:a.normalized,stem:i.stem,stemConfidence:i.confidence};return w(n,"keyword",k(r,t),o)}trySelector(n,r){let t=ir(n,r);return t?w(t,"selector",k(r,r+t.length)):null}tryEventModifier(n,r){if(n[r]!==".")return null;let t=n.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!t)return null;let i=t[0].replace(/(\s|\.)$/,""),a=i.slice(1).split("(")[0],o=t[1];return {...w(i,"event-modifier",k(r,r+i.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(n,r){let t=or(n,r);return t?w(t,"literal",k(r,r+t.length)):null}tryNumber(n,r){let t=lr(n,r);return t?w(t,"literal",k(r,r+t.length)):null}tryMatchTimeUnit(n,r,t,i=false){let a=r;if(i)for(;a<n.length&&Z(n[a]);)a++;let o=n.slice(a);for(let s of t){let l=o.slice(0,s.length);if(s.caseInsensitive?l.toLowerCase()===s.pattern.toLowerCase():l===s.pattern){if(s.notFollowedBy&&(o[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let u=o[s.length]||"";if(O(u))continue}return {suffix:s.suffix,endPos:a+s.length}}}return null}parseBaseNumber(n,r,t=true){let i=r,a="";if(t&&(n[i]==="-"||n[i]==="+")&&(a+=n[i++]),i>=n.length||!L(n[i]))return null;for(;i<n.length&&L(n[i]);)a+=n[i++];if(i<n.length&&n[i]===".")for(a+=n[i++];i<n.length&&L(n[i]);)a+=n[i++];return !a||a==="-"||a==="+"?null:{number:a,endPos:i}}tryNumberWithTimeUnits(n,r,t,i={}){let{allowSign:a=true,skipWhitespace:o=false}=i,s=this.parseBaseNumber(n,r,a);if(!s)return null;let{number:l,endPos:c}=s,u=[...t,...je.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(n,c,u,o);return d&&(l+=d.suffix,c=d.endPos),w(l,"literal",k(r,c))}tryUrl(n,r){let t=sr(n,r);return t?w(t,"url",k(r,r+t.length)):null}tryVariableRef(n,r){if(n[r]!==":"||r+1>=n.length||!O(n[r+1]))return null;let t=r+1;for(;t<n.length&&O(n[t]);)t++;let i=n.slice(r,t);return w(i,"identifier",k(r,t))}tryOperator(n,r){let t=n.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(t))return w(t,"operator",k(r,r+2));let i=n[r];return ["<",">","!","+","-","*","/","="].includes(i)?w(i,"operator",k(r,r+1)):["(",")","{","}",",",";",":"].includes(i)?w(i,"punctuation",k(r,r+1)):null}tryMultiCharParticle(n,r,t){for(let i of t)if(n.slice(r,r+i.length)===i)return w(i,"particle",k(r,r+i.length));return null}};Ke.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 ur=Ke,Ue={code:"id",name:"Indonesian",nativeName:"Bahasa Indonesia",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,verb:{position:"start",subjectDrop:true},references:{me:"saya",it:"itu",you:"anda",result:"hasil",event:"peristiwa",target:"target",body:"tubuh"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"saya",it:"nya",you:"anda"},keywords:{saya:"me",aku:"me",ku:"me",anda:"you",kamu:"you",mu:"you",nya:"it",dia:"it"}},roleMarkers:{destination:{primary:"pada",alternatives:["ke","di"],position:"before"},source:{primary:"dari",position:"before"},patient:{primary:"",position:"before"},style:{primary:"dengan",position:"before"}},keywords:{toggle:{primary:"alihkan",alternatives:["ganti","tukar"],normalized:"toggle"},add:{primary:"tambah",alternatives:["tambahkan"],normalized:"add"},remove:{primary:"hapus",alternatives:["buang","hilangkan"],normalized:"remove"},put:{primary:"taruh",alternatives:["letakkan","masukkan"],normalized:"put"},append:{primary:"sisipkan",normalized:"append"},prepend:{primary:"awali",normalized:"prepend"},take:{primary:"ambil",normalized:"take"},make:{primary:"buat",alternatives:["bikin","ciptakan"],normalized:"make"},clone:{primary:"klon",alternatives:["salin","tiru"],normalized:"clone"},swap:{primary:"tukar",alternatives:["ganti"],normalized:"swap"},morph:{primary:"ubah",alternatives:["transformasi"],normalized:"morph"},set:{primary:"atur",alternatives:["tetapkan"],normalized:"set"},get:{primary:"dapatkan",alternatives:["peroleh"],normalized:"get"},increment:{primary:"tingkatkan",alternatives:["naikkan"],normalized:"increment"},decrement:{primary:"turunkan",alternatives:["kurangi"],normalized:"decrement"},log:{primary:"catat",alternatives:["rekam","cetak"],normalized:"log"},show:{primary:"tampilkan",alternatives:["perlihatkan"],normalized:"show"},hide:{primary:"sembunyikan",alternatives:["tutup"],normalized:"hide"},transition:{primary:"transisi",alternatives:["animasikan"],normalized:"transition"},on:{primary:"pada",alternatives:["saat","ketika"],normalized:"on"},trigger:{primary:"picu",alternatives:["jalankan"],normalized:"trigger"},send:{primary:"kirim",alternatives:["kirimkan"],normalized:"send"},focus:{primary:"fokus",alternatives:["fokuskan"],normalized:"focus"},blur:{primary:"blur",normalized:"blur"},go:{primary:"pergi",alternatives:["pindah","navigasi"],normalized:"go"},wait:{primary:"tunggu",normalized:"wait"},fetch:{primary:"ambil",alternatives:["muat"],normalized:"fetch"},settle:{primary:"stabilkan",normalized:"settle"},if:{primary:"jika",alternatives:["kalau","bila"],normalized:"if"},when:{primary:"ketika",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"selainnya",normalized:"else"},repeat:{primary:"ulangi",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selama",normalized:"while"},continue:{primary:"lanjutkan",alternatives:["terus"],normalized:"continue"},halt:{primary:"hentikan",alternatives:["berhenti"],normalized:"halt"},throw:{primary:"lempar",normalized:"throw"},call:{primary:"panggil",normalized:"call"},return:{primary:"kembalikan",alternatives:["kembali"],normalized:"return"},then:{primary:"lalu",alternatives:["kemudian","setelah itu"],normalized:"then"},and:{primary:"dan",alternatives:["juga","serta"],normalized:"and"},end:{primary:"selesai",alternatives:["akhir","tamat"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asinkron",normalized:"async"},tell:{primary:"katakan",alternatives:["beritahu"],normalized:"tell"},default:{primary:"bawaan",normalized:"default"},init:{primary:"inisialisasi",alternatives:["mulai"],normalized:"init"},behavior:{primary:"perilaku",normalized:"behavior"},install:{primary:"pasang",alternatives:["instal"],normalized:"install"},measure:{primary:"ukur",normalized:"measure"},beep:{primary:"bunyi",normalized:"beep"},break:{primary:"hentikan",normalized:"break"},copy:{primary:"salin",normalized:"copy"},exit:{primary:"keluar",normalized:"exit"},pick:{primary:"pilih",normalized:"pick"},render:{primary:"tampilkan",normalized:"render"},into:{primary:"ke dalam",normalized:"into"},before:{primary:"sebelum",normalized:"before"},after:{primary:"sesudah",alternatives:["setelah"],normalized:"after"},click:{primary:"klik",alternatives:["tekan"],normalized:"click"},hover:{primary:"hover",alternatives:["arahkan"],normalized:"hover"},submit:{primary:"kirim",alternatives:["submit"],normalized:"submit"},input:{primary:"masuk",alternatives:["input"],normalized:"input"},change:{primary:"ubah",alternatives:["berubah"],normalized:"change"},until:{primary:"sampai",normalized:"until"},event:{primary:"peristiwa",alternatives:["event"],normalized:"event"},from:{primary:"dari",normalized:"from"}},eventHandler:{keyword:{primary:"pada",alternatives:["ketika","saat"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"},conditionalKeyword:{primary:"ketika",alternatives:["saat","waktu"]},eventMarker:{primary:"saat",alternatives:["ketika"],position:"before"},temporalMarkers:["ketika","saat"]}},{isLetter:cr,isIdentifierChar:dr}=nr(/[a-zA-Z]/),$e=new Set(["di","ke","dari","pada","dengan","tanpa","untuk","oleh","antara","sebelum","sesudah","setelah","selama","sampai","hingga","sejak","menuju","tentang","terhadap","melalui","dalam","luar"]),mr=[{native:"benar",normalized:"true"},{native:"salah",normalized:"false"},{native:"null",normalized:"null"},{native:"kosong",normalized:"null"},{native:"tidak terdefinisi",normalized:"undefined"},{native:"pertama",normalized:"first"},{native:"terakhir",normalized:"last"},{native:"selanjutnya",normalized:"next"},{native:"berikutnya",normalized:"next"},{native:"sebelumnya",normalized:"previous"},{native:"terdekat",normalized:"closest"},{native:"induk",normalized:"parent"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"masukan",normalized:"input"},{native:"input",normalized:"input"},{native:"perubahan",normalized:"change"},{native:"tombol turun",normalized:"keydown"},{native:"tombol naik",normalized:"keyup"},{native:"mouse masuk",normalized:"mouseover"},{native:"mouse keluar",normalized:"mouseout"},{native:"gulir",normalized:"scroll"},{native:"aku",normalized:"me"},{native:"ini",normalized:"me"},{native:"milikku",normalized:"my"},{native:"dia",normalized:"it"},{native:"kejadian",normalized:"event"},{native:"sasaran",normalized:"target"},{native:"detik",normalized:"s"},{native:"milidetik",normalized:"ms"},{native:"menit",normalized:"m"},{native:"jam",normalized:"h"},{native:"jika tidak",normalized:"else"},{native:"hilangkan fokus",normalized:"blur"},{native:"maka",normalized:"then"}],fr=class extends ur{constructor(){super(),this.language="id",this.direction="ltr",this.initializeKeywordsFromProfile(Ue,mr);}tokenize(e){let n=[],r=0;for(;r<e.length;){if(Z(e[r])){r++;continue}if(We(e[r])){let a=this.tryEventModifier(e,r);if(a){n.push(a),r=a.position.end;continue}if(this.tryPropertyAccess(e,r,n)){r++;continue}let o=this.trySelector(e,r);if(o){n.push(o),r=o.position.end;continue}}if(qe(e[r])){let a=this.tryString(e,r);if(a){n.push(a),r=a.position.end;continue}}if(Ve(e,r)){let a=this.tryUrl(e,r);if(a){n.push(a),r=a.position.end;continue}}if(L(e[r])||e[r]==="-"&&r+1<e.length&&L(e[r+1])){let a=this.extractNumber(e,r);if(a){n.push(a),r=a.position.end;continue}}let t=this.tryVariableRef(e,r);if(t){n.push(t),r=t.position.end;continue}if(cr(e[r])){let a=this.extractWord(e,r);if(a){n.push(a),r=a.position.end;continue}}let i=this.tryOperator(e,r);if(i){n.push(i),r=i.position.end;continue}r++;}return new tr(n,"id")}classifyToken(e){let n=e.toLowerCase();return $e.has(n)?"particle":this.isKeyword(n)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}extractWord(e,n){let r=n,t="";for(;r<e.length&&dr(e[r]);)t+=e[r++];if(!t)return null;let i=t.toLowerCase(),a=this.lookupKeyword(i);return a?w(t,"keyword",k(n,r),a.normalized):$e.has(i)?w(t,"particle",k(n,r)):w(t,"identifier",k(n,r))}extractNumber(e,n){let r=n,t="";for((e[r]==="-"||e[r]==="+")&&(t+=e[r++]);r<e.length&&L(e[r]);)t+=e[r++];if(r<e.length&&e[r]===".")for(t+=e[r++];r<e.length&&L(e[r]);)t+=e[r++];let i=r;for(;i<e.length&&Z(e[i]);)i++;let a=e.slice(i).toLowerCase();return a.startsWith("milidetik")?(t+="ms",r=i+9):a.startsWith("detik")?(t+="s",r=i+5):a.startsWith("menit")?(t+="m",r=i+5):a.startsWith("jam")&&(t+="h",r=i+3),!t||t==="-"||t==="+"?null:w(t,"literal",k(n,r))}},hr=new fr;er("id",hr,Ue);var pr=new Map,yr=new Map,vr=new Map;function Er(e,n,r){pr.set(e,n),yr.set(e,r),vr.delete(e);}var gr=class{constructor(e,n){this.pos=0,this.tokens=e,this.language=n;}peek(e=0){let n=this.pos+e;return n<0||n>=this.tokens.length?null:this.tokens[n]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(e){this.pos=e.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(e){let n=[];for(;!this.isAtEnd()&&e(this.peek());)n.push(this.advance());return n}skipWhile(e){for(;!this.isAtEnd()&&e(this.peek());)this.advance();}};function S(e,n){return {start:e,end:n}}function A(e,n,r,t){if(typeof t=="string")return {value:e,kind:n,position:r,normalized:t};if(t){let{normalized:i,stem:a,stemConfidence:o}=t;return {value:e,kind:n,position:r,...i!==void 0&&{normalized:i},...a!==void 0&&{stem:a},...o!==void 0&&{stemConfidence:o}}}return {value:e,kind:n,position:r}}function ae(e){return /\s/.test(e)}function Ge(e){return e==="#"||e==="."||e==="["||e==="@"||e==="*"||e==="<"}function He(e){return e==='"'||e==="'"||e==="`"||e==="\u300C"||e==="\u300D"}function W(e){return /\d/.test(e)}function kr(e){return /[a-zA-Z]/.test(e)}function _(e){return /[a-zA-Z0-9_-]/.test(e)}function wr(e,n){if(n>=e.length)return null;let r=e[n];if(!Ge(r))return null;let t=n,i="";if(r==="#"||r==="."){for(i+=e[t++];t<e.length&&_(e[t]);)i+=e[t++];if(i.length<=1)return null;if(t<e.length&&e[t]==="."&&r==="#"){let o=t+1;for(;o<e.length&&_(e[o]);)o++;if(o<e.length&&e[o]==="(")return i}}else if(r==="["){let a=1,o=false,s=null,l=false;for(i+=e[t++];t<e.length&&a>0;){let c=e[t];i+=c,l?l=false:c==="\\"?l=true:o?c===s&&(o=false,s=null):c==='"'||c==="'"||c==="`"?(o=true,s=c):c==="["?a++:c==="]"&&a--,t++;}if(a!==0)return null}else if(r==="@"){for(i+=e[t++];t<e.length&&_(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="*"){for(i+=e[t++];t<e.length&&_(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="<"){if(i+=e[t++],t>=e.length||!kr(e[t]))return null;for(;t<e.length&&_(e[t]);)i+=e[t++];for(;t<e.length;){let a=e[t];if(a==="."){if(i+=e[t++],t>=e.length||!_(e[t]))return null;for(;t<e.length&&_(e[t]);)i+=e[t++];}else if(a==="#"){if(i+=e[t++],t>=e.length||!_(e[t]))return null;for(;t<e.length&&_(e[t]);)i+=e[t++];}else if(a==="["){let o=1,s=false,l=null,c=false;for(i+=e[t++];t<e.length&&o>0;){let u=e[t];i+=u,c?c=false:u==="\\"?c=true:s?u===l&&(s=false,l=null):u==='"'||u==="'"||u==="`"?(s=true,l=u):u==="["?o++:u==="]"&&o--,t++;}if(o!==0)return null}else break}for(;t<e.length&&ae(e[t]);)i+=e[t++];if(t<e.length&&e[t]==="/")for(i+=e[t++];t<e.length&&ae(e[t]);)i+=e[t++];if(t>=e.length||e[t]!==">")return null;i+=e[t++];}return i||null}function br(e,n){if(n>=e.length||e[n]!=="'"||n+1>=e.length||e[n+1].toLowerCase()!=="s")return false;if(n+2>=e.length)return true;let t=e[n+2];return ae(t)||t==="*"||!_(t)}function Tr(e,n){if(n>=e.length)return null;let r=e[n];if(!He(r)||r==="'"&&br(e,n))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!i)return null;let a=n+1,o=r,s=false;for(;a<e.length;){let l=e[a];if(o+=l,s)s=false;else if(l==="\\")s=true;else if(l===i)return o;a++;}return o}function Qe(e,n){if(n>=e.length)return false;let r=e[n],t=e[n+1]||"",i=e[n+2]||"";if(r==="/"&&t!=="/"&&/[a-zA-Z0-9._-]/.test(t)||r==="/"&&t==="/"&&/[a-zA-Z]/.test(i)||r==="."&&(t==="/"||t==="."&&i==="/"))return true;let a=e.slice(n,n+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function zr(e,n){if(!Qe(e,n))return null;let r=n,t="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<e.length;){let a=e[r];if(a==="#"){if(t.length>0&&/[a-zA-Z0-9/.]$/.test(t))for(t+=a,r++;r<e.length&&/[a-zA-Z0-9_-]/.test(e[r]);)t+=e[r++];break}if(i.test(a))t+=a,r++;else break}return t.length<2?null:t}function Sr(e,n){if(n>=e.length)return null;let r=e[n];if(!W(r)&&r!=="-"&&r!=="+")return null;let t=n,i="";if((e[t]==="-"||e[t]==="+")&&(i+=e[t++]),t>=e.length||!W(e[t]))return null;for(;t<e.length&&W(e[t]);)i+=e[t++];if(t<e.length&&e[t]===".")for(i+=e[t++];t<e.length&&W(e[t]);)i+=e[t++];return t<e.length&&(e.slice(t,t+2)==="ms"?i+="ms":(e[t]==="s"||e[t]==="m"||e[t]==="h")&&(i+=e[t])),i}var Ze=class Xe{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(n,r,t){if(n[r]!==".")return false;let i=t[t.length-1],a=i&&i.position.end<r;if(i&&!a&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return t.push(A(".","operator",S(r,r+1))),true;let l=r+1;for(;l<n.length&&_(n[l]);)l++;return l<n.length&&n[l]==="("?(t.push(A(".","operator",S(r,r+1))),true):false}initializeKeywordsFromProfile(n,r=[]){let t=new Map;if(n.keywords){for(let[i,a]of Object.entries(n.keywords))if(t.set(a.primary,{native:a.primary,normalized:a.normalized||i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:a.normalized||i});}if(n.references){for(let[i,a]of Object.entries(n.references))t.set(a,{native:a,normalized:i});for(let i of Object.keys(n.references))t.has(i)||t.set(i,{native:i,normalized:i});}if(n.roleMarkers){for(let[i,a]of Object.entries(n.roleMarkers))if(a.primary&&t.set(a.primary,{native:a.primary,normalized:i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:i});}for(let i of r)t.set(i.native,i);this.profileKeywords=Array.from(t.values()).sort((i,a)=>a.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let a=this.removeDiacritics(i.native);a!==i.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),i);}}removeDiacritics(n){return n.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(n,r){for(let t of this.profileKeywords)if(n.slice(r).startsWith(t.native))return A(t.native,"keyword",S(r,r+t.native.length),t.normalized);return null}isKeywordStart(n,r){let t=n.slice(r);return this.profileKeywords.some(i=>t.startsWith(i.native))}lookupKeyword(n){return this.profileKeywordMap.get(n.toLowerCase())}isKeyword(n){return this.profileKeywordMap.has(n.toLowerCase())}setNormalizer(n){this.normalizer=n;}tryNormalize(n){if(!this.normalizer)return null;let r=this.normalizer.normalize(n);return r.stem!==n&&r.confidence>=.7?r:null}tryMorphKeywordMatch(n,r,t){let i=this.tryNormalize(n);if(!i)return null;let a=this.lookupKeyword(i.stem);if(!a)return null;let o={normalized:a.normalized,stem:i.stem,stemConfidence:i.confidence};return A(n,"keyword",S(r,t),o)}trySelector(n,r){let t=wr(n,r);return t?A(t,"selector",S(r,r+t.length)):null}tryEventModifier(n,r){if(n[r]!==".")return null;let t=n.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!t)return null;let i=t[0].replace(/(\s|\.)$/,""),a=i.slice(1).split("(")[0],o=t[1];return {...A(i,"event-modifier",S(r,r+i.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(n,r){let t=Tr(n,r);return t?A(t,"literal",S(r,r+t.length)):null}tryNumber(n,r){let t=Sr(n,r);return t?A(t,"literal",S(r,r+t.length)):null}tryMatchTimeUnit(n,r,t,i=false){let a=r;if(i)for(;a<n.length&&ae(n[a]);)a++;let o=n.slice(a);for(let s of t){let l=o.slice(0,s.length);if(s.caseInsensitive?l.toLowerCase()===s.pattern.toLowerCase():l===s.pattern){if(s.notFollowedBy&&(o[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let u=o[s.length]||"";if(_(u))continue}return {suffix:s.suffix,endPos:a+s.length}}}return null}parseBaseNumber(n,r,t=true){let i=r,a="";if(t&&(n[i]==="-"||n[i]==="+")&&(a+=n[i++]),i>=n.length||!W(n[i]))return null;for(;i<n.length&&W(n[i]);)a+=n[i++];if(i<n.length&&n[i]===".")for(a+=n[i++];i<n.length&&W(n[i]);)a+=n[i++];return !a||a==="-"||a==="+"?null:{number:a,endPos:i}}tryNumberWithTimeUnits(n,r,t,i={}){let{allowSign:a=true,skipWhitespace:o=false}=i,s=this.parseBaseNumber(n,r,a);if(!s)return null;let{number:l,endPos:c}=s,u=[...t,...Xe.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(n,c,u,o);return d&&(l+=d.suffix,c=d.endPos),A(l,"literal",S(r,c))}tryUrl(n,r){let t=zr(n,r);return t?A(t,"url",S(r,r+t.length)):null}tryVariableRef(n,r){if(n[r]!==":"||r+1>=n.length||!_(n[r+1]))return null;let t=r+1;for(;t<n.length&&_(n[t]);)t++;let i=n.slice(r,t);return A(i,"identifier",S(r,t))}tryOperator(n,r){let t=n.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(t))return A(t,"operator",S(r,r+2));let i=n[r];return ["<",">","!","+","-","*","/","="].includes(i)?A(i,"operator",S(r,r+1)):["(",")","{","}",",",";",":"].includes(i)?A(i,"punctuation",S(r,r+1)):null}tryMultiCharParticle(n,r,t){for(let i of t)if(n.slice(r,r+i.length)===i)return A(i,"particle",S(r,r+i.length));return null}};Ze.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var Ar=Ze,Ye={code:"ms",name:"Malay",nativeName:"Melayu",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:true},references:{me:"saya",it:"ia",you:"kamu",result:"hasil",event:"peristiwa",target:"sasaran",body:"badan"},possessive:{marker:"",markerPosition:"after-object",keywords:{saya:"me",aku:"me",awak:"you",kamu:"you",anda:"you",dia:"it",ia:"it","-ku":"me","-mu":"you","-nya":"it"}},roleMarkers:{destination:{primary:"ke",alternatives:["pada"],position:"before"},source:{primary:"dari",position:"before"},patient:{primary:"",position:"before"},style:{primary:"dengan",position:"before"}},keywords:{toggle:{primary:"togol",alternatives:["tukar"],normalized:"toggle"},add:{primary:"tambah",normalized:"add"},remove:{primary:"buang",alternatives:["padam"],normalized:"remove"},put:{primary:"letak",alternatives:["letakkan"],normalized:"put"},append:{primary:"tambah_hujung",normalized:"append"},prepend:{primary:"tambah_mula",normalized:"prepend"},take:{primary:"ambil",normalized:"take"},make:{primary:"buat",alternatives:["cipta"],normalized:"make"},clone:{primary:"klon",alternatives:["salin"],normalized:"clone"},swap:{primary:"tukar_tempat",normalized:"swap"},morph:{primary:"ubah_bentuk",normalized:"morph"},set:{primary:"tetapkan",alternatives:["setkan"],normalized:"set"},get:{primary:"dapatkan",alternatives:["ambil"],normalized:"get"},increment:{primary:"tambah_satu",normalized:"increment"},decrement:{primary:"kurang_satu",normalized:"decrement"},log:{primary:"catat",alternatives:["log"],normalized:"log"},show:{primary:"tunjuk",alternatives:["papar"],normalized:"show"},hide:{primary:"sembunyi",alternatives:["sorok"],normalized:"hide"},transition:{primary:"peralihan",normalized:"transition"},on:{primary:"apabila",alternatives:["bila","ketika"],normalized:"on"},trigger:{primary:"cetuskan",normalized:"trigger"},send:{primary:"hantar",normalized:"send"},focus:{primary:"fokus",normalized:"focus"},blur:{primary:"kabur",normalized:"blur"},go:{primary:"pergi",alternatives:["pindah"],normalized:"go"},wait:{primary:"tunggu",normalized:"wait"},fetch:{primary:"ambil_dari",alternatives:["muat"],normalized:"fetch"},settle:{primary:"selesai",normalized:"settle"},if:{primary:"jika",alternatives:["kalau"],normalized:"if"},when:{primary:"apabila",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"kalau_tidak",alternatives:["jika_tidak"],normalized:"else"},repeat:{primary:"ulang",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selagi",alternatives:["semasa"],normalized:"while"},continue:{primary:"teruskan",normalized:"continue"},halt:{primary:"henti",alternatives:["berhenti"],normalized:"halt"},throw:{primary:"lempar",normalized:"throw"},call:{primary:"panggil",normalized:"call"},return:{primary:"pulang",alternatives:["kembali"],normalized:"return"},then:{primary:"kemudian",alternatives:["lepas_itu"],normalized:"then"},and:{primary:"dan",normalized:"and"},end:{primary:"tamat",alternatives:["habis"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"tak_segerak",normalized:"async"},tell:{primary:"beritahu",normalized:"tell"},default:{primary:"lalai",normalized:"default"},init:{primary:"mula",alternatives:["mulakan"],normalized:"init"},behavior:{primary:"kelakuan",normalized:"behavior"},install:{primary:"pasang",normalized:"install"},measure:{primary:"ukur",normalized:"measure"},beep:{primary:"bunyi",normalized:"beep"},break:{primary:"henti",normalized:"break"},copy:{primary:"salin",normalized:"copy"},exit:{primary:"keluar",normalized:"exit"},pick:{primary:"pilih",normalized:"pick"},render:{primary:"papar",normalized:"render"},into:{primary:"ke_dalam",normalized:"into"},before:{primary:"sebelum",normalized:"before"},after:{primary:"selepas",alternatives:["lepas"],normalized:"after"},until:{primary:"sehingga",alternatives:["sampai"],normalized:"until"},event:{primary:"peristiwa",normalized:"event"},from:{primary:"dari",normalized:"from"}},eventHandler:{keyword:{primary:"apabila",alternatives:["bila","ketika"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"}}},Cr=[{native:"benar",normalized:"true"},{native:"salah",normalized:"false"},{native:"kosong",normalized:"null"},{native:"tak_tentu",normalized:"undefined"},{native:"pertama",normalized:"first"},{native:"terakhir",normalized:"last"},{native:"seterusnya",normalized:"next"},{native:"sebelumnya",normalized:"previous"},{native:"terdekat",normalized:"closest"},{native:"induk",normalized:"parent"},{native:"klik",normalized:"click"},{native:"berubah",normalized:"change"},{native:"ubah",normalized:"change"},{native:"hantar",normalized:"submit"},{native:"input",normalized:"input"},{native:"masuk",normalized:"input"},{native:"muat",normalized:"load"},{native:"tatal",normalized:"scroll"},{native:"hover",normalized:"hover"}],xr=class extends Ar{constructor(){super(),this.language="ms",this.direction="ltr",this.initializeKeywordsFromProfile(Ye,Cr);}tokenize(e){let n=[],r=0;for(;r<e.length;){if(ae(e[r])){r++;continue}if(Ge(e[r])){let t=this.tryEventModifier(e,r);if(t){n.push(t),r=t.position.end;continue}if(this.tryPropertyAccess(e,r,n)){r++;continue}let i=this.trySelector(e,r);if(i){n.push(i),r=i.position.end;continue}}if(He(e[r])){let t=this.tryString(e,r);if(t){n.push(t),r=t.position.end;continue}}if(W(e[r])||e[r]==="-"&&r+1<e.length&&W(e[r+1])){let t=this.tryNumber(e,r);if(t){n.push(t),r=t.position.end;continue}}if(Qe(e,r)){let t=this.tryUrl(e,r);if(t){n.push(t),r=t.position.end;continue}}if(e[r]===":"){let t=this.tryVariableRef(e,r);if(t){n.push(t),r=t.position.end;continue}}if("()[]{}:,;".includes(e[r])){n.push(A(e[r],"operator",S(r,r+1))),r++;continue}if(_(e[r])){let t=r,i=this.tryProfileKeyword(e,r);if(i){n.push(i),r=i.position.end;continue}let a="";for(;r<e.length&&_(e[r]);)a+=e[r],r++;a&&n.push(A(a,"identifier",S(t,r)));continue}r++;}return new gr(n,"ms")}classifyToken(e){return this.isKeyword(e)?"keyword":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}},Pr=new xr;Er("ms",Pr,Ye);var _r=new Map,Rr=new Map,Mr=new Map;function Nr(e,n,r){_r.set(e,n),Rr.set(e,r),Mr.delete(e);}var Ir=class{constructor(e,n){this.pos=0,this.tokens=e,this.language=n;}peek(e=0){let n=this.pos+e;return n<0||n>=this.tokens.length?null:this.tokens[n]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(e){this.pos=e.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(e){let n=[];for(;!this.isAtEnd()&&e(this.peek());)n.push(this.advance());return n}skipWhile(e){for(;!this.isAtEnd()&&e(this.peek());)this.advance();}};function C(e,n){return {start:e,end:n}}function x(e,n,r,t){if(typeof t=="string")return {value:e,kind:n,position:r,normalized:t};if(t){let{normalized:i,stem:a,stemConfidence:o}=t;return {value:e,kind:n,position:r,...i!==void 0&&{normalized:i},...a!==void 0&&{stem:a},...o!==void 0&&{stemConfidence:o}}}return {value:e,kind:n,position:r}}function oe(e){return /\s/.test(e)}function Je(e){return e==="#"||e==="."||e==="["||e==="@"||e==="*"||e==="<"}function et(e){return e==='"'||e==="'"||e==="`"||e==="\u300C"||e==="\u300D"}function q(e){return /\d/.test(e)}function Or(e){return /[a-zA-Z]/.test(e)}function R(e){return /[a-zA-Z0-9_-]/.test(e)}function Dr(e,n){if(n>=e.length)return null;let r=e[n];if(!Je(r))return null;let t=n,i="";if(r==="#"||r==="."){for(i+=e[t++];t<e.length&&R(e[t]);)i+=e[t++];if(i.length<=1)return null;if(t<e.length&&e[t]==="."&&r==="#"){let o=t+1;for(;o<e.length&&R(e[o]);)o++;if(o<e.length&&e[o]==="(")return i}}else if(r==="["){let a=1,o=false,s=null,l=false;for(i+=e[t++];t<e.length&&a>0;){let c=e[t];i+=c,l?l=false:c==="\\"?l=true:o?c===s&&(o=false,s=null):c==='"'||c==="'"||c==="`"?(o=true,s=c):c==="["?a++:c==="]"&&a--,t++;}if(a!==0)return null}else if(r==="@"){for(i+=e[t++];t<e.length&&R(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="*"){for(i+=e[t++];t<e.length&&R(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="<"){if(i+=e[t++],t>=e.length||!Or(e[t]))return null;for(;t<e.length&&R(e[t]);)i+=e[t++];for(;t<e.length;){let a=e[t];if(a==="."){if(i+=e[t++],t>=e.length||!R(e[t]))return null;for(;t<e.length&&R(e[t]);)i+=e[t++];}else if(a==="#"){if(i+=e[t++],t>=e.length||!R(e[t]))return null;for(;t<e.length&&R(e[t]);)i+=e[t++];}else if(a==="["){let o=1,s=false,l=null,c=false;for(i+=e[t++];t<e.length&&o>0;){let u=e[t];i+=u,c?c=false:u==="\\"?c=true:s?u===l&&(s=false,l=null):u==='"'||u==="'"||u==="`"?(s=true,l=u):u==="["?o++:u==="]"&&o--,t++;}if(o!==0)return null}else break}for(;t<e.length&&oe(e[t]);)i+=e[t++];if(t<e.length&&e[t]==="/")for(i+=e[t++];t<e.length&&oe(e[t]);)i+=e[t++];if(t>=e.length||e[t]!==">")return null;i+=e[t++];}return i||null}function Br(e,n){if(n>=e.length||e[n]!=="'"||n+1>=e.length||e[n+1].toLowerCase()!=="s")return false;if(n+2>=e.length)return true;let t=e[n+2];return oe(t)||t==="*"||!R(t)}function Lr(e,n){if(n>=e.length)return null;let r=e[n];if(!et(r)||r==="'"&&Br(e,n))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!i)return null;let a=n+1,o=r,s=false;for(;a<e.length;){let l=e[a];if(o+=l,s)s=false;else if(l==="\\")s=true;else if(l===i)return o;a++;}return o}function tt(e,n){if(n>=e.length)return false;let r=e[n],t=e[n+1]||"",i=e[n+2]||"";if(r==="/"&&t!=="/"&&/[a-zA-Z0-9._-]/.test(t)||r==="/"&&t==="/"&&/[a-zA-Z]/.test(i)||r==="."&&(t==="/"||t==="."&&i==="/"))return true;let a=e.slice(n,n+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function Fr(e,n){if(!tt(e,n))return null;let r=n,t="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<e.length;){let a=e[r];if(a==="#"){if(t.length>0&&/[a-zA-Z0-9/.]$/.test(t))for(t+=a,r++;r<e.length&&/[a-zA-Z0-9_-]/.test(e[r]);)t+=e[r++];break}if(i.test(a))t+=a,r++;else break}return t.length<2?null:t}function $r(e,n){if(n>=e.length)return null;let r=e[n];if(!q(r)&&r!=="-"&&r!=="+")return null;let t=n,i="";if((e[t]==="-"||e[t]==="+")&&(i+=e[t++]),t>=e.length||!q(e[t]))return null;for(;t<e.length&&q(e[t]);)i+=e[t++];if(t<e.length&&e[t]===".")for(i+=e[t++];t<e.length&&q(e[t]);)i+=e[t++];return t<e.length&&(e.slice(t,t+2)==="ms"?i+="ms":(e[t]==="s"||e[t]==="m"||e[t]==="h")&&(i+=e[t])),i}var rt=class nt{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(n,r,t){if(n[r]!==".")return false;let i=t[t.length-1],a=i&&i.position.end<r;if(i&&!a&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return t.push(x(".","operator",C(r,r+1))),true;let l=r+1;for(;l<n.length&&R(n[l]);)l++;return l<n.length&&n[l]==="("?(t.push(x(".","operator",C(r,r+1))),true):false}initializeKeywordsFromProfile(n,r=[]){let t=new Map;if(n.keywords){for(let[i,a]of Object.entries(n.keywords))if(t.set(a.primary,{native:a.primary,normalized:a.normalized||i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:a.normalized||i});}if(n.references){for(let[i,a]of Object.entries(n.references))t.set(a,{native:a,normalized:i});for(let i of Object.keys(n.references))t.has(i)||t.set(i,{native:i,normalized:i});}if(n.roleMarkers){for(let[i,a]of Object.entries(n.roleMarkers))if(a.primary&&t.set(a.primary,{native:a.primary,normalized:i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:i});}for(let i of r)t.set(i.native,i);this.profileKeywords=Array.from(t.values()).sort((i,a)=>a.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let a=this.removeDiacritics(i.native);a!==i.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),i);}}removeDiacritics(n){return n.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(n,r){for(let t of this.profileKeywords)if(n.slice(r).startsWith(t.native))return x(t.native,"keyword",C(r,r+t.native.length),t.normalized);return null}isKeywordStart(n,r){let t=n.slice(r);return this.profileKeywords.some(i=>t.startsWith(i.native))}lookupKeyword(n){return this.profileKeywordMap.get(n.toLowerCase())}isKeyword(n){return this.profileKeywordMap.has(n.toLowerCase())}setNormalizer(n){this.normalizer=n;}tryNormalize(n){if(!this.normalizer)return null;let r=this.normalizer.normalize(n);return r.stem!==n&&r.confidence>=.7?r:null}tryMorphKeywordMatch(n,r,t){let i=this.tryNormalize(n);if(!i)return null;let a=this.lookupKeyword(i.stem);if(!a)return null;let o={normalized:a.normalized,stem:i.stem,stemConfidence:i.confidence};return x(n,"keyword",C(r,t),o)}trySelector(n,r){let t=Dr(n,r);return t?x(t,"selector",C(r,r+t.length)):null}tryEventModifier(n,r){if(n[r]!==".")return null;let t=n.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!t)return null;let i=t[0].replace(/(\s|\.)$/,""),a=i.slice(1).split("(")[0],o=t[1];return {...x(i,"event-modifier",C(r,r+i.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(n,r){let t=Lr(n,r);return t?x(t,"literal",C(r,r+t.length)):null}tryNumber(n,r){let t=$r(n,r);return t?x(t,"literal",C(r,r+t.length)):null}tryMatchTimeUnit(n,r,t,i=false){let a=r;if(i)for(;a<n.length&&oe(n[a]);)a++;let o=n.slice(a);for(let s of t){let l=o.slice(0,s.length);if(s.caseInsensitive?l.toLowerCase()===s.pattern.toLowerCase():l===s.pattern){if(s.notFollowedBy&&(o[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let u=o[s.length]||"";if(R(u))continue}return {suffix:s.suffix,endPos:a+s.length}}}return null}parseBaseNumber(n,r,t=true){let i=r,a="";if(t&&(n[i]==="-"||n[i]==="+")&&(a+=n[i++]),i>=n.length||!q(n[i]))return null;for(;i<n.length&&q(n[i]);)a+=n[i++];if(i<n.length&&n[i]===".")for(a+=n[i++];i<n.length&&q(n[i]);)a+=n[i++];return !a||a==="-"||a==="+"?null:{number:a,endPos:i}}tryNumberWithTimeUnits(n,r,t,i={}){let{allowSign:a=true,skipWhitespace:o=false}=i,s=this.parseBaseNumber(n,r,a);if(!s)return null;let{number:l,endPos:c}=s,u=[...t,...nt.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(n,c,u,o);return d&&(l+=d.suffix,c=d.endPos),x(l,"literal",C(r,c))}tryUrl(n,r){let t=Fr(n,r);return t?x(t,"url",C(r,r+t.length)):null}tryVariableRef(n,r){if(n[r]!==":"||r+1>=n.length||!R(n[r+1]))return null;let t=r+1;for(;t<n.length&&R(n[t]);)t++;let i=n.slice(r,t);return x(i,"identifier",C(r,t))}tryOperator(n,r){let t=n.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(t))return x(t,"operator",C(r,r+2));let i=n[r];return ["<",">","!","+","-","*","/","="].includes(i)?x(i,"operator",C(r,r+1)):["(",")","{","}",",",";",":"].includes(i)?x(i,"punctuation",C(r,r+1)):null}tryMultiCharParticle(n,r,t){for(let i of t)if(n.slice(r,r+i.length)===i)return x(i,"particle",C(r,r+i.length));return null}};rt.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 Wr=rt,it={code:"tl",name:"Tagalog",nativeName:"Tagalog",direction:"ltr",wordOrder:"VSO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:true},references:{me:"ako",it:"ito",you:"ikaw",result:"resulta",event:"pangyayari",target:"target",body:"body"},possessive:{marker:"ng",markerPosition:"between",keywords:{ko:"me",akin:"me",aking:"me",mo:"you",iyo:"you",niya:"it",nito:"it",kaniya:"it"}},roleMarkers:{destination:{primary:"sa",position:"before"},source:{primary:"mula_sa",position:"before"},patient:{primary:"",position:"before"},style:{primary:"nang",position:"before"}},keywords:{toggle:{primary:"palitan",alternatives:["itoggle"],normalized:"toggle"},add:{primary:"idagdag",alternatives:["magdagdag"],normalized:"add"},remove:{primary:"alisin",alternatives:["tanggalin"],normalized:"remove"},put:{primary:"ilagay",alternatives:["maglagay"],normalized:"put"},append:{primary:"idagdag_sa_dulo",normalized:"append"},prepend:{primary:"idagdag_sa_simula",normalized:"prepend"},take:{primary:"kumuha",normalized:"take"},make:{primary:"gumawa",alternatives:["lumikha"],normalized:"make"},clone:{primary:"kopyahin",normalized:"clone"},swap:{primary:"palitan_pwesto",alternatives:["magpalit"],normalized:"swap"},morph:{primary:"baguhin",normalized:"morph"},set:{primary:"itakda",alternatives:["magtakda"],normalized:"set"},get:{primary:"kunin",alternatives:["kumuha"],normalized:"get"},increment:{primary:"dagdagan",alternatives:["taasan"],normalized:"increment"},decrement:{primary:"bawasan",alternatives:["ibaba"],normalized:"decrement"},log:{primary:"itala",normalized:"log"},show:{primary:"ipakita",alternatives:["magpakita"],normalized:"show"},hide:{primary:"itago",alternatives:["magtago"],normalized:"hide"},transition:{primary:"baguhin",alternatives:["lumipat"],normalized:"transition"},on:{primary:"kapag",alternatives:["kung","sa"],normalized:"on"},trigger:{primary:"palitawin",alternatives:["magpatugtog"],normalized:"trigger"},send:{primary:"ipadala",alternatives:["magpadala"],normalized:"send"},focus:{primary:"ituon",normalized:"focus"},blur:{primary:"alisin_tuon",normalized:"blur"},go:{primary:"pumunta",alternatives:["punta"],normalized:"go"},wait:{primary:"maghintay",alternatives:["hintay"],normalized:"wait"},fetch:{primary:"kuhanin_mula",alternatives:["kunin_mula"],normalized:"fetch"},settle:{primary:"magpatahimik",normalized:"settle"},if:{primary:"kung",alternatives:["kapag"],normalized:"if"},when:{primary:"kapag",normalized:"when"},where:{primary:"kung_saan",normalized:"where"},else:{primary:"kung_hindi",alternatives:["kundi"],normalized:"else"},repeat:{primary:"ulitin",alternatives:["paulit-ulit"],normalized:"repeat"},for:{primary:"para_sa",normalized:"for"},while:{primary:"habang",normalized:"while"},continue:{primary:"magpatuloy",normalized:"continue"},halt:{primary:"itigil",alternatives:["huminto"],normalized:"halt"},throw:{primary:"ihagis",alternatives:["itapon"],normalized:"throw"},call:{primary:"tawagin",alternatives:["tawagan","tumawag"],normalized:"call"},return:{primary:"ibalik",alternatives:["bumalik"],normalized:"return"},then:{primary:"pagkatapos",alternatives:["saka"],normalized:"then"},and:{primary:"at",normalized:"and"},end:{primary:"wakas",alternatives:["tapos"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",normalized:"async"},tell:{primary:"sabihin",alternatives:["magsabi"],normalized:"tell"},default:{primary:"pamantayan",alternatives:["default","unang_halaga"],normalized:"default"},init:{primary:"simulan",alternatives:["magsimula"],normalized:"init"},behavior:{primary:"ugali",alternatives:["kilos"],normalized:"behavior"},install:{primary:"ikabit",alternatives:["mag-install"],normalized:"install"},measure:{primary:"sukatin",normalized:"measure"},beep:{primary:"tunog",normalized:"beep"},break:{primary:"itigil",normalized:"break"},copy:{primary:"kopyahin",normalized:"copy"},exit:{primary:"lumabas",normalized:"exit"},pick:{primary:"pumili",normalized:"pick"},render:{primary:"ipakita",normalized:"render"},into:{primary:"sa",normalized:"into"},before:{primary:"bago",normalized:"before"},after:{primary:"matapos",alternatives:["pagkatapos"],normalized:"after"},until:{primary:"hanggang",normalized:"until"},event:{primary:"pangyayari",normalized:"event"},from:{primary:"mula",alternatives:["galing"],normalized:"from"}},eventHandler:{keyword:{primary:"kapag",normalized:"on"},sourceMarker:{primary:"mula_sa",alternatives:["galing_sa"],position:"before"},eventMarker:{primary:"kapag",alternatives:["kung","sa"],position:"before"}}},qr=[{native:"totoo",normalized:"true"},{native:"mali",normalized:"false"},{native:"wala",normalized:"null"},{native:"hindi_tinukoy",normalized:"undefined"},{native:"una",normalized:"first"},{native:"huli",normalized:"last"},{native:"susunod",normalized:"next"},{native:"nakaraan",normalized:"previous"},{native:"pinakamalapit",normalized:"closest"},{native:"magulang",normalized:"parent"},{native:"pindot",normalized:"click"},{native:"pagbabago",normalized:"change"},{native:"isumite",normalized:"submit"},{native:"input",normalized:"input"},{native:"karga",normalized:"load"},{native:"mag_scroll",normalized:"scroll"}],Vr=class extends Wr{constructor(){super(),this.language="tl",this.direction="ltr",this.initializeKeywordsFromProfile(it,qr);}tokenize(e){let n=[],r=0;for(;r<e.length;){if(oe(e[r])){r++;continue}if(Je(e[r])){let t=this.tryEventModifier(e,r);if(t){n.push(t),r=t.position.end;continue}if(this.tryPropertyAccess(e,r,n)){r++;continue}let i=this.trySelector(e,r);if(i){n.push(i),r=i.position.end;continue}}if(et(e[r])){let t=this.tryString(e,r);if(t){n.push(t),r=t.position.end;continue}}if(q(e[r])||e[r]==="-"&&r+1<e.length&&q(e[r+1])){let t=this.tryNumber(e,r);if(t){n.push(t),r=t.position.end;continue}}if(tt(e,r)){let t=this.tryUrl(e,r);if(t){n.push(t),r=t.position.end;continue}}if(e[r]===":"){let t=this.tryVariableRef(e,r);if(t){n.push(t),r=t.position.end;continue}}if("()[]{}:,;".includes(e[r])){n.push(x(e[r],"operator",C(r,r+1))),r++;continue}if(R(e[r])){let t=r,i=this.tryProfileKeyword(e,r);if(i){n.push(i),r=i.position.end;continue}let a="";for(;r<e.length&&R(e[r]);)a+=e[r],r++;a&&n.push(x(a,"identifier",C(t,r)));continue}r++;}return new Ir(n,"tl")}classifyToken(e){return this.isKeyword(e)?"keyword":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}},Kr=new Vr;Nr("tl",Kr,it);var jr=new Map,Ur=new Map,Gr=new Map;function Hr(e,n,r){jr.set(e,n),Ur.set(e,r),Gr.delete(e);}var Qr=class{constructor(e,n){this.pos=0,this.tokens=e,this.language=n;}peek(e=0){let n=this.pos+e;return n<0||n>=this.tokens.length?null:this.tokens[n]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(e){this.pos=e.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(e){let n=[];for(;!this.isAtEnd()&&e(this.peek());)n.push(this.advance());return n}skipWhile(e){for(;!this.isAtEnd()&&e(this.peek());)this.advance();}};function b(e,n){return {start:e,end:n}}function T(e,n,r,t){if(typeof t=="string")return {value:e,kind:n,position:r,normalized:t};if(t){let{normalized:i,stem:a,stemConfidence:o}=t;return {value:e,kind:n,position:r,...i!==void 0&&{normalized:i},...a!==void 0&&{stem:a},...o!==void 0&&{stemConfidence:o}}}return {value:e,kind:n,position:r}}function se(e){return /\s/.test(e)}function at(e){return e==="#"||e==="."||e==="["||e==="@"||e==="*"||e==="<"}function ot(e){return e==='"'||e==="'"||e==="`"||e==="\u300C"||e==="\u300D"}function V(e){return /\d/.test(e)}function Zr(e){return /[a-zA-Z]/.test(e)}function P(e){return /[a-zA-Z0-9_-]/.test(e)}function Xr(e){return n=>{let r=n.charCodeAt(0);return e.some(([t,i])=>r>=t&&r<=i)}}function Yr(e,n){if(n>=e.length)return null;let r=e[n];if(!at(r))return null;let t=n,i="";if(r==="#"||r==="."){for(i+=e[t++];t<e.length&&P(e[t]);)i+=e[t++];if(i.length<=1)return null;if(t<e.length&&e[t]==="."&&r==="#"){let o=t+1;for(;o<e.length&&P(e[o]);)o++;if(o<e.length&&e[o]==="(")return i}}else if(r==="["){let a=1,o=false,s=null,l=false;for(i+=e[t++];t<e.length&&a>0;){let c=e[t];i+=c,l?l=false:c==="\\"?l=true:o?c===s&&(o=false,s=null):c==='"'||c==="'"||c==="`"?(o=true,s=c):c==="["?a++:c==="]"&&a--,t++;}if(a!==0)return null}else if(r==="@"){for(i+=e[t++];t<e.length&&P(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="*"){for(i+=e[t++];t<e.length&&P(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="<"){if(i+=e[t++],t>=e.length||!Zr(e[t]))return null;for(;t<e.length&&P(e[t]);)i+=e[t++];for(;t<e.length;){let a=e[t];if(a==="."){if(i+=e[t++],t>=e.length||!P(e[t]))return null;for(;t<e.length&&P(e[t]);)i+=e[t++];}else if(a==="#"){if(i+=e[t++],t>=e.length||!P(e[t]))return null;for(;t<e.length&&P(e[t]);)i+=e[t++];}else if(a==="["){let o=1,s=false,l=null,c=false;for(i+=e[t++];t<e.length&&o>0;){let u=e[t];i+=u,c?c=false:u==="\\"?c=true:s?u===l&&(s=false,l=null):u==='"'||u==="'"||u==="`"?(s=true,l=u):u==="["?o++:u==="]"&&o--,t++;}if(o!==0)return null}else break}for(;t<e.length&&se(e[t]);)i+=e[t++];if(t<e.length&&e[t]==="/")for(i+=e[t++];t<e.length&&se(e[t]);)i+=e[t++];if(t>=e.length||e[t]!==">")return null;i+=e[t++];}return i||null}function Jr(e,n){if(n>=e.length||e[n]!=="'"||n+1>=e.length||e[n+1].toLowerCase()!=="s")return false;if(n+2>=e.length)return true;let t=e[n+2];return se(t)||t==="*"||!P(t)}function en(e,n){if(n>=e.length)return null;let r=e[n];if(!ot(r)||r==="'"&&Jr(e,n))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!i)return null;let a=n+1,o=r,s=false;for(;a<e.length;){let l=e[a];if(o+=l,s)s=false;else if(l==="\\")s=true;else if(l===i)return o;a++;}return o}function st(e,n){if(n>=e.length)return false;let r=e[n],t=e[n+1]||"",i=e[n+2]||"";if(r==="/"&&t!=="/"&&/[a-zA-Z0-9._-]/.test(t)||r==="/"&&t==="/"&&/[a-zA-Z]/.test(i)||r==="."&&(t==="/"||t==="."&&i==="/"))return true;let a=e.slice(n,n+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function tn(e,n){if(!st(e,n))return null;let r=n,t="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<e.length;){let a=e[r];if(a==="#"){if(t.length>0&&/[a-zA-Z0-9/.]$/.test(t))for(t+=a,r++;r<e.length&&/[a-zA-Z0-9_-]/.test(e[r]);)t+=e[r++];break}if(i.test(a))t+=a,r++;else break}return t.length<2?null:t}function rn(e,n){if(n>=e.length)return null;let r=e[n];if(!V(r)&&r!=="-"&&r!=="+")return null;let t=n,i="";if((e[t]==="-"||e[t]==="+")&&(i+=e[t++]),t>=e.length||!V(e[t]))return null;for(;t<e.length&&V(e[t]);)i+=e[t++];if(t<e.length&&e[t]===".")for(i+=e[t++];t<e.length&&V(e[t]);)i+=e[t++];return t<e.length&&(e.slice(t,t+2)==="ms"?i+="ms":(e[t]==="s"||e[t]==="m"||e[t]==="h")&&(i+=e[t])),i}var lt=class ut{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(n,r,t){if(n[r]!==".")return false;let i=t[t.length-1],a=i&&i.position.end<r;if(i&&!a&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return t.push(T(".","operator",b(r,r+1))),true;let l=r+1;for(;l<n.length&&P(n[l]);)l++;return l<n.length&&n[l]==="("?(t.push(T(".","operator",b(r,r+1))),true):false}initializeKeywordsFromProfile(n,r=[]){let t=new Map;if(n.keywords){for(let[i,a]of Object.entries(n.keywords))if(t.set(a.primary,{native:a.primary,normalized:a.normalized||i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:a.normalized||i});}if(n.references){for(let[i,a]of Object.entries(n.references))t.set(a,{native:a,normalized:i});for(let i of Object.keys(n.references))t.has(i)||t.set(i,{native:i,normalized:i});}if(n.roleMarkers){for(let[i,a]of Object.entries(n.roleMarkers))if(a.primary&&t.set(a.primary,{native:a.primary,normalized:i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:i});}for(let i of r)t.set(i.native,i);this.profileKeywords=Array.from(t.values()).sort((i,a)=>a.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let a=this.removeDiacritics(i.native);a!==i.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),i);}}removeDiacritics(n){return n.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(n,r){for(let t of this.profileKeywords)if(n.slice(r).startsWith(t.native))return T(t.native,"keyword",b(r,r+t.native.length),t.normalized);return null}isKeywordStart(n,r){let t=n.slice(r);return this.profileKeywords.some(i=>t.startsWith(i.native))}lookupKeyword(n){return this.profileKeywordMap.get(n.toLowerCase())}isKeyword(n){return this.profileKeywordMap.has(n.toLowerCase())}setNormalizer(n){this.normalizer=n;}tryNormalize(n){if(!this.normalizer)return null;let r=this.normalizer.normalize(n);return r.stem!==n&&r.confidence>=.7?r:null}tryMorphKeywordMatch(n,r,t){let i=this.tryNormalize(n);if(!i)return null;let a=this.lookupKeyword(i.stem);if(!a)return null;let o={normalized:a.normalized,stem:i.stem,stemConfidence:i.confidence};return T(n,"keyword",b(r,t),o)}trySelector(n,r){let t=Yr(n,r);return t?T(t,"selector",b(r,r+t.length)):null}tryEventModifier(n,r){if(n[r]!==".")return null;let t=n.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!t)return null;let i=t[0].replace(/(\s|\.)$/,""),a=i.slice(1).split("(")[0],o=t[1];return {...T(i,"event-modifier",b(r,r+i.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(n,r){let t=en(n,r);return t?T(t,"literal",b(r,r+t.length)):null}tryNumber(n,r){let t=rn(n,r);return t?T(t,"literal",b(r,r+t.length)):null}tryMatchTimeUnit(n,r,t,i=false){let a=r;if(i)for(;a<n.length&&se(n[a]);)a++;let o=n.slice(a);for(let s of t){let l=o.slice(0,s.length);if(s.caseInsensitive?l.toLowerCase()===s.pattern.toLowerCase():l===s.pattern){if(s.notFollowedBy&&(o[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let u=o[s.length]||"";if(P(u))continue}return {suffix:s.suffix,endPos:a+s.length}}}return null}parseBaseNumber(n,r,t=true){let i=r,a="";if(t&&(n[i]==="-"||n[i]==="+")&&(a+=n[i++]),i>=n.length||!V(n[i]))return null;for(;i<n.length&&V(n[i]);)a+=n[i++];if(i<n.length&&n[i]===".")for(a+=n[i++];i<n.length&&V(n[i]);)a+=n[i++];return !a||a==="-"||a==="+"?null:{number:a,endPos:i}}tryNumberWithTimeUnits(n,r,t,i={}){let{allowSign:a=true,skipWhitespace:o=false}=i,s=this.parseBaseNumber(n,r,a);if(!s)return null;let{number:l,endPos:c}=s,u=[...t,...ut.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(n,c,u,o);return d&&(l+=d.suffix,c=d.endPos),T(l,"literal",b(r,c))}tryUrl(n,r){let t=tn(n,r);return t?T(t,"url",b(r,r+t.length)):null}tryVariableRef(n,r){if(n[r]!==":"||r+1>=n.length||!P(n[r+1]))return null;let t=r+1;for(;t<n.length&&P(n[t]);)t++;let i=n.slice(r,t);return T(i,"identifier",b(r,t))}tryOperator(n,r){let t=n.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(t))return T(t,"operator",b(r,r+2));let i=n[r];return ["<",">","!","+","-","*","/","="].includes(i)?T(i,"operator",b(r,r+1)):["(",")","{","}",",",";",":"].includes(i)?T(i,"punctuation",b(r,r+1)):null}tryMultiCharParticle(n,r,t){for(let i of t)if(n.slice(r,r+i.length)===i)return T(i,"particle",b(r,r+i.length));return null}};lt.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 nn=lt,ct={code:"th",name:"Thai",nativeName:"\u0E44\u0E17\u0E22",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:false,defaultVerbForm:"base",verb:{position:"second",subjectDrop:true},references:{me:"\u0E09\u0E31\u0E19",it:"\u0E21\u0E31\u0E19",you:"\u0E04\u0E38\u0E13",result:"\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C",event:"\u0E40\u0E2B\u0E15\u0E38\u0E01\u0E32\u0E23\u0E13\u0E4C",target:"\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22",body:"\u0E1A\u0E2D\u0E14\u0E35\u0E49"},possessive:{marker:"\u0E02\u0E2D\u0E07",markerPosition:"between",keywords:{\u0E02\u0E2D\u0E07\u0E09\u0E31\u0E19:"me",\u0E02\u0E2D\u0E07\u0E1C\u0E21:"me",\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13:"you",\u0E02\u0E2D\u0E07\u0E21\u0E31\u0E19:"it",\u0E02\u0E2D\u0E07\u0E40\u0E02\u0E32:"it",\u0E02\u0E2D\u0E07\u0E40\u0E18\u0E2D:"it"}},roleMarkers:{patient:{primary:"",position:"before"},destination:{primary:"\u0E43\u0E19",alternatives:["\u0E44\u0E1B\u0E22\u0E31\u0E07"],position:"before"},source:{primary:"\u0E08\u0E32\u0E01",position:"before"},style:{primary:"\u0E14\u0E49\u0E27\u0E22",position:"before"},event:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",position:"before"}},keywords:{toggle:{primary:"\u0E2A\u0E25\u0E31\u0E1A",alternatives:[],normalized:"toggle"},add:{primary:"\u0E40\u0E1E\u0E34\u0E48\u0E21",alternatives:[],normalized:"add"},remove:{primary:"\u0E25\u0E1A",alternatives:["\u0E25\u0E1A\u0E2D\u0E2D\u0E01"],normalized:"remove"},put:{primary:"\u0E43\u0E2A\u0E48",alternatives:["\u0E27\u0E32\u0E07"],normalized:"put"},append:{primary:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E17\u0E49\u0E32\u0E22",alternatives:[],normalized:"append"},prepend:{primary:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E2B\u0E19\u0E49\u0E32",alternatives:[],normalized:"prepend"},take:{primary:"\u0E23\u0E31\u0E1A",alternatives:[],normalized:"take"},make:{primary:"\u0E2A\u0E23\u0E49\u0E32\u0E07",alternatives:[],normalized:"make"},clone:{primary:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01",alternatives:["\u0E2A\u0E33\u0E40\u0E19\u0E32"],normalized:"clone"},swap:{primary:"\u0E2A\u0E25\u0E31\u0E1A\u0E17\u0E35\u0E48",alternatives:[],normalized:"swap"},morph:{primary:"\u0E41\u0E1B\u0E25\u0E07\u0E23\u0E48\u0E32\u0E07",alternatives:[],normalized:"morph"},set:{primary:"\u0E15\u0E31\u0E49\u0E07",alternatives:["\u0E01\u0E33\u0E2B\u0E19\u0E14"],normalized:"set"},get:{primary:"\u0E23\u0E31\u0E1A\u0E04\u0E48\u0E32",alternatives:[],normalized:"get"},increment:{primary:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E48\u0E32",alternatives:[],normalized:"increment"},decrement:{primary:"\u0E25\u0E14\u0E04\u0E48\u0E32",alternatives:[],normalized:"decrement"},log:{primary:"\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01",alternatives:[],normalized:"log"},show:{primary:"\u0E41\u0E2A\u0E14\u0E07",alternatives:[],normalized:"show"},hide:{primary:"\u0E0B\u0E48\u0E2D\u0E19",alternatives:[],normalized:"hide"},transition:{primary:"\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19",alternatives:[],normalized:"transition"},on:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"],normalized:"on"},trigger:{primary:"\u0E17\u0E23\u0E34\u0E01\u0E40\u0E01\u0E2D\u0E23\u0E4C",alternatives:[],normalized:"trigger"},send:{primary:"\u0E2A\u0E48\u0E07",alternatives:[],normalized:"send"},focus:{primary:"\u0E42\u0E1F\u0E01\u0E31\u0E2A",alternatives:[],normalized:"focus"},blur:{primary:"\u0E40\u0E1A\u0E25\u0E2D",alternatives:[],normalized:"blur"},click:{primary:"\u0E04\u0E25\u0E34\u0E01",normalized:"click"},hover:{primary:"\u0E42\u0E2E\u0E40\u0E27\u0E2D\u0E23\u0E4C",alternatives:["\u0E27\u0E32\u0E07\u0E40\u0E21\u0E32\u0E2A\u0E4C"],normalized:"hover"},submit:{primary:"\u0E2A\u0E48\u0E07",alternatives:["\u0E2A\u0E48\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25"],normalized:"submit"},input:{primary:"\u0E1B\u0E49\u0E2D\u0E19",alternatives:["\u0E01\u0E23\u0E2D\u0E01"],normalized:"input"},change:{primary:"\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19",alternatives:["\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07"],normalized:"change"},go:{primary:"\u0E44\u0E1B",alternatives:["\u0E44\u0E1B\u0E17\u0E35\u0E48"],normalized:"go"},wait:{primary:"\u0E23\u0E2D",alternatives:[],normalized:"wait"},fetch:{primary:"\u0E14\u0E36\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",alternatives:[],normalized:"fetch"},settle:{primary:"\u0E04\u0E07\u0E17\u0E35\u0E48",alternatives:[],normalized:"settle"},if:{primary:"\u0E16\u0E49\u0E32",alternatives:["\u0E2B\u0E32\u0E01"],normalized:"if"},when:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",normalized:"when"},where:{primary:"\u0E17\u0E35\u0E48\u0E44\u0E2B\u0E19",normalized:"where"},else:{primary:"\u0E44\u0E21\u0E48\u0E07\u0E31\u0E49\u0E19",alternatives:["\u0E44\u0E21\u0E48\u0E40\u0E0A\u0E48\u0E19\u0E19\u0E31\u0E49\u0E19"],normalized:"else"},repeat:{primary:"\u0E17\u0E33\u0E0B\u0E49\u0E33",alternatives:[],normalized:"repeat"},for:{primary:"\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A",alternatives:[],normalized:"for"},while:{primary:"\u0E43\u0E19\u0E02\u0E13\u0E30\u0E17\u0E35\u0E48",alternatives:[],normalized:"while"},continue:{primary:"\u0E15\u0E48\u0E2D\u0E44\u0E1B",alternatives:[],normalized:"continue"},halt:{primary:"\u0E2B\u0E22\u0E38\u0E14",alternatives:[],normalized:"halt"},throw:{primary:"\u0E42\u0E22\u0E19",alternatives:[],normalized:"throw"},call:{primary:"\u0E40\u0E23\u0E35\u0E22\u0E01",alternatives:[],normalized:"call"},return:{primary:"\u0E04\u0E37\u0E19\u0E04\u0E48\u0E32",alternatives:["\u0E01\u0E25\u0E31\u0E1A"],normalized:"return"},then:{primary:"\u0E41\u0E25\u0E49\u0E27",alternatives:[],normalized:"then"},and:{primary:"\u0E41\u0E25\u0E30",alternatives:[],normalized:"and"},end:{primary:"\u0E08\u0E1A",alternatives:[],normalized:"end"},js:{primary:"\u0E40\u0E08\u0E40\u0E2D\u0E2A",alternatives:["js"],normalized:"js"},async:{primary:"\u0E2D\u0E30\u0E0B\u0E34\u0E07\u0E04\u0E4C",alternatives:[],normalized:"async"},tell:{primary:"\u0E1A\u0E2D\u0E01",alternatives:[],normalized:"tell"},default:{primary:"\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",alternatives:[],normalized:"default"},init:{primary:"\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",alternatives:[],normalized:"init"},behavior:{primary:"\u0E1E\u0E24\u0E15\u0E34\u0E01\u0E23\u0E23\u0E21",alternatives:[],normalized:"behavior"},install:{primary:"\u0E15\u0E34\u0E14\u0E15\u0E31\u0E49\u0E07",alternatives:[],normalized:"install"},measure:{primary:"\u0E27\u0E31\u0E14",alternatives:[],normalized:"measure"},beep:{primary:"\u0E1A\u0E35\u0E4A\u0E1A",alternatives:[],normalized:"beep"},break:{primary:"\u0E2B\u0E22\u0E38\u0E14",alternatives:[],normalized:"break"},copy:{primary:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01",alternatives:[],normalized:"copy"},exit:{primary:"\u0E2D\u0E2D\u0E01",alternatives:[],normalized:"exit"},pick:{primary:"\u0E40\u0E25\u0E37\u0E2D\u0E01",alternatives:[],normalized:"pick"},render:{primary:"\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25",alternatives:[],normalized:"render"},into:{primary:"\u0E43\u0E19",alternatives:[],normalized:"into"},before:{primary:"\u0E01\u0E48\u0E2D\u0E19",alternatives:[],normalized:"before"},after:{primary:"\u0E2B\u0E25\u0E31\u0E07",alternatives:[],normalized:"after"},until:{primary:"\u0E08\u0E19\u0E16\u0E36\u0E07",alternatives:[],normalized:"until"},event:{primary:"\u0E40\u0E2B\u0E15\u0E38\u0E01\u0E32\u0E23\u0E13\u0E4C",alternatives:[],normalized:"event"},from:{primary:"\u0E08\u0E32\u0E01",normalized:"from"}},tokenization:{boundaryStrategy:"character"},eventHandler:{keyword:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"],normalized:"on"},sourceMarker:{primary:"\u0E08\u0E32\u0E01",position:"before"},eventMarker:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"],position:"before"},temporalMarkers:["\u0E40\u0E21\u0E37\u0E48\u0E2D","\u0E15\u0E2D\u0E19"]}},ze=Xr([[3584,3711]]),an=[{native:"\u0E08\u0E23\u0E34\u0E07",normalized:"true"},{native:"\u0E40\u0E17\u0E47\u0E08",normalized:"false"},{native:"\u0E27\u0E48\u0E32\u0E07",normalized:"null"},{native:"\u0E44\u0E21\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14",normalized:"undefined"},{native:"\u0E41\u0E23\u0E01",normalized:"first"},{native:"\u0E2A\u0E38\u0E14\u0E17\u0E49\u0E32\u0E22",normalized:"last"},{native:"\u0E16\u0E31\u0E14\u0E44\u0E1B",normalized:"next"},{native:"\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",normalized:"previous"},{native:"\u0E43\u0E01\u0E25\u0E49\u0E2A\u0E38\u0E14",normalized:"closest"},{native:"\u0E15\u0E49\u0E19\u0E17\u0E32\u0E07",normalized:"parent"},{native:"\u0E04\u0E25\u0E34\u0E01",normalized:"click"},{native:"\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07",normalized:"change"},{native:"\u0E2A\u0E48\u0E07",normalized:"submit"},{native:"\u0E2D\u0E34\u0E19\u0E1E\u0E38\u0E15",normalized:"input"},{native:"\u0E42\u0E2B\u0E25\u0E14",normalized:"load"},{native:"\u0E40\u0E25\u0E37\u0E48\u0E2D\u0E19",normalized:"scroll"},{native:"\u0E40\u0E27\u0E25\u0E32",normalized:"when"},{native:"\u0E44\u0E1B\u0E22\u0E31\u0E07",normalized:"to"},{native:"\u0E14\u0E49\u0E27\u0E22",normalized:"with"},{native:"\u0E41\u0E25\u0E30",normalized:"and"}],on=class extends nn{constructor(){super(),this.language="th",this.direction="ltr",this.initializeKeywordsFromProfile(ct,an);}tokenize(e){let n=[],r=0;for(;r<e.length;){if(se(e[r])){r++;continue}if(at(e[r])){let i=this.tryEventModifier(e,r);if(i){n.push(i),r=i.position.end;continue}if(this.tryPropertyAccess(e,r,n)){r++;continue}let a=this.trySelector(e,r);if(a){n.push(a),r=a.position.end;continue}}if(ot(e[r])){let i=this.tryString(e,r);if(i){n.push(i),r=i.position.end;continue}}if(st(e,r)){let i=this.tryUrl(e,r);if(i){n.push(i),r=i.position.end;continue}}if(V(e[r])||e[r]==="-"&&r+1<e.length&&V(e[r+1])){let i=this.tryNumber(e,r);if(i){n.push(i),r=i.position.end;continue}}if(e[r]===":"){let i=r;r++;let a="";for(;r<e.length&&(P(e[r])||ze(e[r]));)a+=e[r],r++;if(a){n.push(T(":"+a,"identifier",b(i,r),":"+a));continue}r=i;}if(ze(e[r])){let i=r,a=this.tryProfileKeyword(e,r);if(a){n.push(a),r=a.position.end;continue}let o="";for(;r<e.length&&ze(e[r])&&!(o.length>0&&this.isKeywordStart(e,r));)o+=e[r],r++;o&&n.push(T(o,"identifier",b(i,r)));continue}if(P(e[r])){let i=r,a="";for(;r<e.length&&P(e[r]);)a+=e[r],r++;n.push(T(a,"identifier",b(i,r),a.toLowerCase()));continue}let t=r;n.push(T(e[r],"operator",b(t,r+1))),r++;}return new Qr(n,this.language)}classifyToken(e){return this.isKeyword(e)?"keyword":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}},sn=new on;Hr("th",sn,ct);var ln=new Map,un=new Map,cn=new Map;function dn(e,n,r){ln.set(e,n),un.set(e,r),cn.delete(e);}var mn=class{constructor(e,n){this.pos=0,this.tokens=e,this.language=n;}peek(e=0){let n=this.pos+e;return n<0||n>=this.tokens.length?null:this.tokens[n]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(e){this.pos=e.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(e){let n=[];for(;!this.isAtEnd()&&e(this.peek());)n.push(this.advance());return n}skipWhile(e){for(;!this.isAtEnd()&&e(this.peek());)this.advance();}};function E(e,n){return {start:e,end:n}}function g(e,n,r,t){if(typeof t=="string")return {value:e,kind:n,position:r,normalized:t};if(t){let{normalized:i,stem:a,stemConfidence:o}=t;return {value:e,kind:n,position:r,...i!==void 0&&{normalized:i},...a!==void 0&&{stem:a},...o!==void 0&&{stemConfidence:o}}}return {value:e,kind:n,position:r}}function ue(e){return /\s/.test(e)}function mt(e){return e==="#"||e==="."||e==="["||e==="@"||e==="*"||e==="<"}function ft(e){return e==='"'||e==="'"||e==="`"||e==="\u300C"||e==="\u300D"}function F(e){return /\d/.test(e)}function fn(e){return /[a-zA-Z]/.test(e)}function D(e){return /[a-zA-Z0-9_-]/.test(e)}function hn(e){let n=t=>e.test(t);return {isLetter:n,isIdentifierChar:t=>n(t)||/[0-9_-]/.test(t)}}function pn(e,n){if(n>=e.length)return null;let r=e[n];if(!mt(r))return null;let t=n,i="";if(r==="#"||r==="."){for(i+=e[t++];t<e.length&&D(e[t]);)i+=e[t++];if(i.length<=1)return null;if(t<e.length&&e[t]==="."&&r==="#"){let o=t+1;for(;o<e.length&&D(e[o]);)o++;if(o<e.length&&e[o]==="(")return i}}else if(r==="["){let a=1,o=false,s=null,l=false;for(i+=e[t++];t<e.length&&a>0;){let c=e[t];i+=c,l?l=false:c==="\\"?l=true:o?c===s&&(o=false,s=null):c==='"'||c==="'"||c==="`"?(o=true,s=c):c==="["?a++:c==="]"&&a--,t++;}if(a!==0)return null}else if(r==="@"){for(i+=e[t++];t<e.length&&D(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="*"){for(i+=e[t++];t<e.length&&D(e[t]);)i+=e[t++];if(i.length<=1)return null}else if(r==="<"){if(i+=e[t++],t>=e.length||!fn(e[t]))return null;for(;t<e.length&&D(e[t]);)i+=e[t++];for(;t<e.length;){let a=e[t];if(a==="."){if(i+=e[t++],t>=e.length||!D(e[t]))return null;for(;t<e.length&&D(e[t]);)i+=e[t++];}else if(a==="#"){if(i+=e[t++],t>=e.length||!D(e[t]))return null;for(;t<e.length&&D(e[t]);)i+=e[t++];}else if(a==="["){let o=1,s=false,l=null,c=false;for(i+=e[t++];t<e.length&&o>0;){let u=e[t];i+=u,c?c=false:u==="\\"?c=true:s?u===l&&(s=false,l=null):u==='"'||u==="'"||u==="`"?(s=true,l=u):u==="["?o++:u==="]"&&o--,t++;}if(o!==0)return null}else break}for(;t<e.length&&ue(e[t]);)i+=e[t++];if(t<e.length&&e[t]==="/")for(i+=e[t++];t<e.length&&ue(e[t]);)i+=e[t++];if(t>=e.length||e[t]!==">")return null;i+=e[t++];}return i||null}function yn(e,n){if(n>=e.length||e[n]!=="'"||n+1>=e.length||e[n+1].toLowerCase()!=="s")return false;if(n+2>=e.length)return true;let t=e[n+2];return ue(t)||t==="*"||!D(t)}function vn(e,n){if(n>=e.length)return null;let r=e[n];if(!ft(r)||r==="'"&&yn(e,n))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!i)return null;let a=n+1,o=r,s=false;for(;a<e.length;){let l=e[a];if(o+=l,s)s=false;else if(l==="\\")s=true;else if(l===i)return o;a++;}return o}function ht(e,n){if(n>=e.length)return false;let r=e[n],t=e[n+1]||"",i=e[n+2]||"";if(r==="/"&&t!=="/"&&/[a-zA-Z0-9._-]/.test(t)||r==="/"&&t==="/"&&/[a-zA-Z]/.test(i)||r==="."&&(t==="/"||t==="."&&i==="/"))return true;let a=e.slice(n,n+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function En(e,n){if(!ht(e,n))return null;let r=n,t="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<e.length;){let a=e[r];if(a==="#"){if(t.length>0&&/[a-zA-Z0-9/.]$/.test(t))for(t+=a,r++;r<e.length&&/[a-zA-Z0-9_-]/.test(e[r]);)t+=e[r++];break}if(i.test(a))t+=a,r++;else break}return t.length<2?null:t}function gn(e,n){if(n>=e.length)return null;let r=e[n];if(!F(r)&&r!=="-"&&r!=="+")return null;let t=n,i="";if((e[t]==="-"||e[t]==="+")&&(i+=e[t++]),t>=e.length||!F(e[t]))return null;for(;t<e.length&&F(e[t]);)i+=e[t++];if(t<e.length&&e[t]===".")for(i+=e[t++];t<e.length&&F(e[t]);)i+=e[t++];return t<e.length&&(e.slice(t,t+2)==="ms"?i+="ms":(e[t]==="s"||e[t]==="m"||e[t]==="h")&&(i+=e[t])),i}var pt=class yt{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(n,r,t){if(n[r]!==".")return false;let i=t[t.length-1],a=i&&i.position.end<r;if(i&&!a&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return t.push(g(".","operator",E(r,r+1))),true;let l=r+1;for(;l<n.length&&D(n[l]);)l++;return l<n.length&&n[l]==="("?(t.push(g(".","operator",E(r,r+1))),true):false}initializeKeywordsFromProfile(n,r=[]){let t=new Map;if(n.keywords){for(let[i,a]of Object.entries(n.keywords))if(t.set(a.primary,{native:a.primary,normalized:a.normalized||i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:a.normalized||i});}if(n.references){for(let[i,a]of Object.entries(n.references))t.set(a,{native:a,normalized:i});for(let i of Object.keys(n.references))t.has(i)||t.set(i,{native:i,normalized:i});}if(n.roleMarkers){for(let[i,a]of Object.entries(n.roleMarkers))if(a.primary&&t.set(a.primary,{native:a.primary,normalized:i}),a.alternatives)for(let o of a.alternatives)t.set(o,{native:o,normalized:i});}for(let i of r)t.set(i.native,i);this.profileKeywords=Array.from(t.values()).sort((i,a)=>a.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let a=this.removeDiacritics(i.native);a!==i.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),i);}}removeDiacritics(n){return n.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(n,r){for(let t of this.profileKeywords)if(n.slice(r).startsWith(t.native))return g(t.native,"keyword",E(r,r+t.native.length),t.normalized);return null}isKeywordStart(n,r){let t=n.slice(r);return this.profileKeywords.some(i=>t.startsWith(i.native))}lookupKeyword(n){return this.profileKeywordMap.get(n.toLowerCase())}isKeyword(n){return this.profileKeywordMap.has(n.toLowerCase())}setNormalizer(n){this.normalizer=n;}tryNormalize(n){if(!this.normalizer)return null;let r=this.normalizer.normalize(n);return r.stem!==n&&r.confidence>=.7?r:null}tryMorphKeywordMatch(n,r,t){let i=this.tryNormalize(n);if(!i)return null;let a=this.lookupKeyword(i.stem);if(!a)return null;let o={normalized:a.normalized,stem:i.stem,stemConfidence:i.confidence};return g(n,"keyword",E(r,t),o)}trySelector(n,r){let t=pn(n,r);return t?g(t,"selector",E(r,r+t.length)):null}tryEventModifier(n,r){if(n[r]!==".")return null;let t=n.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!t)return null;let i=t[0].replace(/(\s|\.)$/,""),a=i.slice(1).split("(")[0],o=t[1];return {...g(i,"event-modifier",E(r,r+i.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(n,r){let t=vn(n,r);return t?g(t,"literal",E(r,r+t.length)):null}tryNumber(n,r){let t=gn(n,r);return t?g(t,"literal",E(r,r+t.length)):null}tryMatchTimeUnit(n,r,t,i=false){let a=r;if(i)for(;a<n.length&&ue(n[a]);)a++;let o=n.slice(a);for(let s of t){let l=o.slice(0,s.length);if(s.caseInsensitive?l.toLowerCase()===s.pattern.toLowerCase():l===s.pattern){if(s.notFollowedBy&&(o[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let u=o[s.length]||"";if(D(u))continue}return {suffix:s.suffix,endPos:a+s.length}}}return null}parseBaseNumber(n,r,t=true){let i=r,a="";if(t&&(n[i]==="-"||n[i]==="+")&&(a+=n[i++]),i>=n.length||!F(n[i]))return null;for(;i<n.length&&F(n[i]);)a+=n[i++];if(i<n.length&&n[i]===".")for(a+=n[i++];i<n.length&&F(n[i]);)a+=n[i++];return !a||a==="-"||a==="+"?null:{number:a,endPos:i}}tryNumberWithTimeUnits(n,r,t,i={}){let{allowSign:a=true,skipWhitespace:o=false}=i,s=this.parseBaseNumber(n,r,a);if(!s)return null;let{number:l,endPos:c}=s,u=[...t,...yt.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(n,c,u,o);return d&&(l+=d.suffix,c=d.endPos),g(l,"literal",E(r,c))}tryUrl(n,r){let t=En(n,r);return t?g(t,"url",E(r,r+t.length)):null}tryVariableRef(n,r){if(n[r]!==":"||r+1>=n.length||!D(n[r+1]))return null;let t=r+1;for(;t<n.length&&D(n[t]);)t++;let i=n.slice(r,t);return g(i,"identifier",E(r,t))}tryOperator(n,r){let t=n.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(t))return g(t,"operator",E(r,r+2));let i=n[r];return ["<",">","!","+","-","*","/","="].includes(i)?g(i,"operator",E(r,r+1)):["(",")","{","}",",",";",":"].includes(i)?g(i,"punctuation",E(r,r+1)):null}tryMultiCharParticle(n,r,t){for(let i of t)if(n.slice(r,r+i.length)===i)return g(i,"particle",E(r,r+i.length));return null}};pt.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var kn=pt,vt={code:"vi",name:"Vietnamese",nativeName:"Ti\u1EBFng Vi\u1EC7t",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:true},references:{me:"t\xF4i",it:"n\xF3",you:"b\u1EA1n",result:"k\u1EBFt qu\u1EA3",event:"s\u1EF1 ki\u1EC7n",target:"m\u1EE5c ti\xEAu",body:"body"},possessive:{marker:"c\u1EE7a",markerPosition:"between",specialForms:{me:"c\u1EE7a t\xF4i",it:"c\u1EE7a n\xF3",you:"c\u1EE7a b\u1EA1n"},keywords:{"c\u1EE7a t\xF4i":"me","c\u1EE7a b\u1EA1n":"you","c\u1EE7a anh":"you","c\u1EE7a ch\u1ECB":"you","c\u1EE7a n\xF3":"it"}},roleMarkers:{destination:{primary:"v\xE0o",alternatives:["cho","\u0111\u1EBFn"],position:"before"},source:{primary:"t\u1EEB",alternatives:["kh\u1ECFi"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"v\u1EDBi",position:"before"}},keywords:{toggle:{primary:"chuy\u1EC3n \u0111\u1ED5i",alternatives:["b\u1EADt t\u1EAFt","chuy\u1EC3n"],normalized:"toggle"},add:{primary:"th\xEAm",alternatives:["b\u1ED5 sung"],normalized:"add"},remove:{primary:"x\xF3a",alternatives:["g\u1EE1 b\u1ECF","lo\u1EA1i b\u1ECF","b\u1ECF"],normalized:"remove"},put:{primary:"\u0111\u1EB7t",alternatives:["\u0111\u1EC3","\u0111\u01B0a"],normalized:"put"},append:{primary:"n\u1ED1i",normalized:"append"},prepend:{primary:"th\xEAm v\xE0o \u0111\u1EA7u",normalized:"prepend"},take:{primary:"l\u1EA5y",normalized:"take"},make:{primary:"t\u1EA1o",normalized:"make"},clone:{primary:"sao ch\xE9p",normalized:"clone"},swap:{primary:"ho\xE1n \u0111\u1ED5i",normalized:"swap"},morph:{primary:"bi\u1EBFn \u0111\u1ED5i",normalized:"morph"},set:{primary:"g\xE1n",alternatives:["thi\u1EBFt l\u1EADp","\u0111\u1EB7t"],normalized:"set"},get:{primary:"l\u1EA5y gi\xE1 tr\u1ECB",alternatives:["nh\u1EADn","l\u1EA5y"],normalized:"get"},increment:{primary:"t\u0103ng",alternatives:["t\u0103ng l\xEAn"],normalized:"increment"},decrement:{primary:"gi\u1EA3m",alternatives:["gi\u1EA3m \u0111i"],normalized:"decrement"},log:{primary:"in ra",normalized:"log"},show:{primary:"hi\u1EC3n th\u1ECB",alternatives:["hi\u1EC7n"],normalized:"show"},hide:{primary:"\u1EA9n",alternatives:["che","gi\u1EA5u"],normalized:"hide"},transition:{primary:"chuy\u1EC3n ti\u1EBFp",normalized:"transition"},on:{primary:"khi",alternatives:["l\xFAc","tr\xEAn"],normalized:"on"},trigger:{primary:"k\xEDch ho\u1EA1t",normalized:"trigger"},send:{primary:"g\u1EEDi",normalized:"send"},focus:{primary:"t\u1EADp trung",normalized:"focus"},blur:{primary:"m\u1EA5t t\u1EADp trung",normalized:"blur"},click:{primary:"nh\u1EA5p",alternatives:["b\u1EA5m"],normalized:"click"},hover:{primary:"di chu\u1ED9t",alternatives:["r\xEA chu\u1ED9t"],normalized:"hover"},submit:{primary:"g\u1EEDi",alternatives:["n\u1ED9p"],normalized:"submit"},input:{primary:"nh\u1EADp",alternatives:["nh\u1EADp li\u1EC7u"],normalized:"input"},change:{primary:"thay \u0111\u1ED5i",alternatives:["\u0111\u1ED5i"],normalized:"change"},go:{primary:"\u0111i \u0111\u1EBFn",alternatives:["\u0111i"],normalized:"go"},wait:{primary:"ch\u1EDD",alternatives:["\u0111\u1EE3i"],normalized:"wait"},fetch:{primary:"t\u1EA3i",normalized:"fetch"},settle:{primary:"\u1ED5n \u0111\u1ECBnh",normalized:"settle"},if:{primary:"n\u1EBFu",normalized:"if"},when:{primary:"khi",normalized:"when"},where:{primary:"\u1EDF_\u0111\xE2u",normalized:"where"},else:{primary:"kh\xF4ng th\xEC",alternatives:["n\u1EBFu kh\xF4ng"],normalized:"else"},repeat:{primary:"l\u1EB7p l\u1EA1i",normalized:"repeat"},for:{primary:"v\u1EDBi m\u1ED7i",normalized:"for"},while:{primary:"trong khi",normalized:"while"},continue:{primary:"ti\u1EBFp t\u1EE5c",normalized:"continue"},halt:{primary:"d\u1EEBng",alternatives:["d\u1EEBng l\u1EA1i"],normalized:"halt"},throw:{primary:"n\xE9m",normalized:"throw"},call:{primary:"g\u1ECDi",normalized:"call"},return:{primary:"tr\u1EA3 v\u1EC1",normalized:"return"},then:{primary:"r\u1ED3i",alternatives:["sau \u0111\xF3","th\xEC"],normalized:"then"},and:{primary:"v\xE0",normalized:"and"},end:{primary:"k\u1EBFt th\xFAc",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"b\u1EA5t \u0111\u1ED3ng b\u1ED9",normalized:"async"},tell:{primary:"n\xF3i v\u1EDBi",normalized:"tell"},default:{primary:"m\u1EB7c \u0111\u1ECBnh",normalized:"default"},init:{primary:"kh\u1EDFi t\u1EA1o",normalized:"init"},behavior:{primary:"h\xE0nh vi",normalized:"behavior"},install:{primary:"c\xE0i \u0111\u1EB7t",normalized:"install"},measure:{primary:"\u0111o l\u01B0\u1EDDng",normalized:"measure"},beep:{primary:"beep",normalized:"beep"},break:{primary:"d\u1EEBng",normalized:"break"},copy:{primary:"sao ch\xE9p",normalized:"copy"},exit:{primary:"tho\xE1t",normalized:"exit"},pick:{primary:"ch\u1ECDn",normalized:"pick"},render:{primary:"k\u1EBFt xu\u1EA5t",normalized:"render"},into:{primary:"v\xE0o",alternatives:["v\xE0o trong"],normalized:"into"},before:{primary:"tr\u01B0\u1EDBc",alternatives:["tr\u01B0\u1EDBc khi"],normalized:"before"},after:{primary:"sau",alternatives:["sau khi"],normalized:"after"},until:{primary:"cho \u0111\u1EBFn khi",normalized:"until"},event:{primary:"s\u1EF1 ki\u1EC7n",normalized:"event"},from:{primary:"t\u1EEB",alternatives:["kh\u1ECFi"],normalized:"from"}},eventHandler:{keyword:{primary:"khi",alternatives:["l\xFAc","tr\xEAn"],normalized:"on"},sourceMarker:{primary:"tr\xEAn",alternatives:["t\u1EA1i"],position:"before"},eventMarker:{primary:"khi",alternatives:["l\xFAc"],position:"before"},temporalMarkers:["khi","l\xFAc"]}},{isLetter:le,isIdentifierChar:wn}=hn(/[a-zA-ZàáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵđÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÈÉẺẼẸÊỀẾỂỄỆÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰỲÝỶỸỴĐ]/),dt=new Set(["trong","ngo\xE0i","tr\xEAn","d\u01B0\u1EDBi","v\xE0o","ra","\u0111\u1EBFn","t\u1EEB","v\u1EDBi","cho","b\u1EDFi","qua","tr\u01B0\u1EDBc","sau","gi\u1EEFa","b\xEAn","theo","v\u1EC1","t\u1EDBi","l\xEAn","xu\u1ED1ng"]),bn=[{native:"\u0111\xFAng",normalized:"true"},{native:"sai",normalized:"false"},{native:"null",normalized:"null"},{native:"kh\xF4ng x\xE1c \u0111\u1ECBnh",normalized:"undefined"},{native:"\u0111\u1EA7u ti\xEAn",normalized:"first"},{native:"cu\u1ED1i c\xF9ng",normalized:"last"},{native:"ti\u1EBFp theo",normalized:"next"},{native:"tr\u01B0\u1EDBc \u0111\xF3",normalized:"previous"},{native:"g\u1EA7n nh\u1EA5t",normalized:"closest"},{native:"cha",normalized:"parent"},{native:"nh\u1EA5p",normalized:"click"},{native:"nh\u1EA5p chu\u1ED9t",normalized:"click"},{native:"click",normalized:"click"},{native:"nh\u1EA5p \u0111\xFAp",normalized:"dblclick"},{native:"nh\u1EADp",normalized:"input"},{native:"thay \u0111\u1ED5i",normalized:"change"},{native:"g\u1EEDi bi\u1EC3u m\u1EABu",normalized:"submit"},{native:"ph\xEDm xu\u1ED1ng",normalized:"keydown"},{native:"ph\xEDm l\xEAn",normalized:"keyup"},{native:"chu\u1ED9t v\xE0o",normalized:"mouseover"},{native:"chu\u1ED9t ra",normalized:"mouseout"},{native:"t\u1EA3i trang",normalized:"load"},{native:"cu\u1ED9n",normalized:"scroll"},{native:"c\u1EE7a t\xF4i",normalized:"my"},{native:"c\u1EE7a n\xF3",normalized:"its"},{native:"gi\xE2y",normalized:"s"},{native:"mili gi\xE2y",normalized:"ms"},{native:"ph\xFAt",normalized:"m"},{native:"gi\u1EDD",normalized:"h"},{native:"th\xEAm v\xE0o cu\u1ED1i",normalized:"append"},{native:"nh\xE2n b\u1EA3n",normalized:"clone"},{native:"t\u1EA1o ra",normalized:"make"},{native:"\u0111\u1EB7t gi\xE1 tr\u1ECB",normalized:"set"},{native:"ghi nh\u1EADt k\xFD",normalized:"log"},{native:"chuy\u1EC3n t\u1EDBi",normalized:"go"},{native:"ng\u01B0\u1EE3c l\u1EA1i",normalized:"else"},{native:"l\u1EB7p",normalized:"repeat"},{native:"ho\u1EB7c",normalized:"or"},{native:"kh\xF4ng",normalized:"not"},{native:"l\xE0",normalized:"is"},{native:"t\u1ED3n t\u1EA1i",normalized:"exists"},{native:"r\u1ED7ng",normalized:"empty"},{native:"javascript",normalized:"js"}],Tn=class extends kn{constructor(){super(),this.language="vi",this.direction="ltr",this.initializeKeywordsFromProfile(vt,bn);}tokenize(e){let n=[],r=0;for(;r<e.length;){if(ue(e[r])){r++;continue}if(mt(e[r])){let o=this.tryEventModifier(e,r);if(o){n.push(o),r=o.position.end;continue}if(this.tryPropertyAccess(e,r,n)){r++;continue}let s=this.trySelector(e,r);if(s){n.push(s),r=s.position.end;continue}}if(ft(e[r])){let o=this.tryString(e,r);if(o){n.push(o),r=o.position.end;continue}}if(ht(e,r)){let o=this.tryUrl(e,r);if(o){n.push(o),r=o.position.end;continue}}if(F(e[r])){let o=this.extractVietnameseNumber(e,r);if(o){n.push(o),r=o.position.end;continue}}let t=this.tryVariableRef(e,r);if(t){n.push(t),r=t.position.end;continue}let i=this.tryOperator(e,r);if(i){n.push(i),r=i.position.end;continue}let a=this.tryMultiWordPhrase(e,r);if(a){n.push(a),r=a.position.end;continue}if(le(e[r])){let o=this.extractVietnameseWord(e,r);if(o){n.push(o),r=o.position.end;continue}}r++;}return new mn(n,"vi")}classifyToken(e){let n=e.toLowerCase();return dt.has(n)?"particle":this.isKeyword(n)?"keyword":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}tryMultiWordPhrase(e,n){for(let r of this.profileKeywords){if(!r.native.includes(" "))continue;let t=r.native;if(e.slice(n,n+t.length).toLowerCase()===t.toLowerCase()){let a=e[n+t.length];if(a&&le(a))continue;return g(e.slice(n,n+t.length),"keyword",E(n,n+t.length),r.normalized)}}return null}extractVietnameseWord(e,n){let r=n,t="";for(;r<e.length&&wn(e[r]);)t+=e[r++];if(!t)return null;let i=t.toLowerCase();if(dt.has(i))return g(t,"particle",E(n,r));let a=this.lookupKeyword(i);return a?g(t,"keyword",E(n,r),a.normalized):g(t,"identifier",E(n,r))}extractVietnameseNumber(e,n){let r=n,t="";for(;r<e.length&&F(e[r]);)t+=e[r++];if(r<e.length&&e[r]===".")for(t+=e[r++];r<e.length&&F(e[r]);)t+=e[r++];if(r<e.length){let i=e.slice(r).toLowerCase();i.startsWith(" mili gi\xE2y")||i.startsWith(" miligi\xE2y")?(t+="ms",r+=i.startsWith(" mili gi\xE2y")?10:9):i.startsWith(" gi\xE2y")?(t+="s",r+=5):i.startsWith(" ph\xFAt")?(t+="m",r+=5):i.startsWith(" gi\u1EDD")?(t+="h",r+=4):i.startsWith("ms")?(t+="ms",r+=2):i[0]==="s"&&!le(i[1]||"")?(t+="s",r+=1):i[0]==="m"&&i[1]!=="s"&&!le(i[1]||"")?(t+="m",r+=1):i[0]==="h"&&!le(i[1]||"")&&(t+="h",r+=1);}return t?g(t,"literal",E(n,r)):null}},zn=new Tn;dn("vi",zn,vt);var Sn=Object.defineProperty,An=Object.getOwnPropertyNames,At=(e,n)=>function(){return e&&(n=(0, e[An(e)[0]])(e=0)),n},Cn=(e,n)=>{for(var r in n)Sn(e,r,{get:n[r],enumerable:true});};function Et(e,n){return e.replace(/\{(\w+)\}/g,(r,t)=>String(n[t]??`{${t}}`))}function B(e,n,r={},t){let i=Ct[e],a=Et(i,r),o=xt[e],s=o?Et(o,r):void 0;return {code:e,message:a,severity:n,...t&&{role:t},...s&&{suggestion:s}}}var p,Ct,xt,xn=At({"src/generators/schema-error-codes.ts"(){p={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION"},Ct={[p.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[p.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[p.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[p.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[p.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[p.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[p.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[p.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[p.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[p.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[p.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[p.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[p.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition."},xt={[p.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[p.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[p.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[p.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[p.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[p.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[p.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[p.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[p.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[p.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition."};}}),Pt={};Cn(Pt,{SchemaErrorCodes:()=>p,formatValidationResults:()=>On,getValidationStats:()=>Dn,validateAllSchemas:()=>In,validateCommandSchema:()=>_t});function Pn(e,n){return {action:e,items:n,get notes(){return n.filter(r=>r.severity==="note").map(r=>r.message)},get warnings(){return n.filter(r=>r.severity==="warning").map(r=>r.message)},get errors(){return n.filter(r=>r.severity==="error").map(r=>r.message)}}}function _t(e){let n=[];for(let t of e.roles)t.expectedTypes.includes("literal")&&t.expectedTypes.includes("selector")&&(t.role==="patient"&&xe.has(e.action)?n.push(B(p.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:t.role,command:e.action},t.role)):n.push(B(p.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:t.role},t.role))),t.expectedTypes.length>3&&!xe.has(e.action)&&n.push(B(p.TOO_MANY_EXPECTED_TYPES,"warning",{role:t.role,count:t.expectedTypes.length},t.role));switch(e.action){case "transition":_n(e,n);break;case "on":Rn(e,n);break;case "if":case "unless":Mn(e,n);break;case "repeat":case "for":case "while":Nn(e,n);break}return e.roles.filter(t=>t.required).length===0&&(Rt.has(e.action)?n.push(B(p.NO_REQUIRED_ROLES_EXPECTED,"note",{command:e.action})):n.push(B(p.NO_REQUIRED_ROLES,"warning",{}))),Pn(e.action,n)}function _n(e,n){let r=e.roles.find(i=>i.role==="patient"),t=e.roles.find(i=>i.role==="goal");r&&r.expectedTypes.includes("selector")&&n.push(B(p.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),r&&!t&&n.push(B(p.TRANSITION_MISSING_GOAL,"error",{}));}function Rn(e,n){let r=e.roles.find(t=>t.role==="event");r||n.push(B(p.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&n.push(B(p.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function Mn(e,n){let r=e.roles.find(t=>t.role==="condition");r||n.push(B(p.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&n.push(B(p.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Nn(e,n){e.action==="for"?e.roles.find(t=>t.role==="source")||n.push(B(p.FOR_LOOP_MISSING_SOURCE,"warning",{})):e.action==="while"&&(e.roles.find(t=>t.role==="condition")||n.push(B(p.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function In(e,n={}){let r=new Map,{includeNotes:t=false}=n;for(let[i,a]of Object.entries(e)){let o=_t(a),s=o.items.some(c=>c.severity==="warning"||c.severity==="error"),l=t&&o.items.some(c=>c.severity==="note");(s||l)&&r.set(i,o);}return r}function On(e,n={}){let r=[],{showNotes:t=false,showCodes:i=true}=n;for(let[a,o]of e){let s=o.items.filter(u=>u.severity==="error"),l=o.items.filter(u=>u.severity==="warning"),c=o.items.filter(u=>u.severity==="note");if(s.length>0){r.push(` \u274C ${a}:`);for(let u of s){let d=i?` [${u.code}]`:"";r.push(` ERROR${d}: ${u.message}`),u.suggestion&&r.push(` \u{1F4A1} Suggestion: ${u.suggestion}`);}}if(l.length>0){r.push(` \u26A0\uFE0F ${a}:`);for(let u of l){let d=i?` [${u.code}]`:"";r.push(` ${d?`${u.code}: `:""}${u.message}`),u.suggestion&&r.push(` \u{1F4A1} ${u.suggestion}`);}}if(t&&c.length>0){r.push(` \u2139\uFE0F ${a}:`);for(let u of c){let d=i?` [${u.code}]`:"";r.push(` ${d?`${u.code}: `:""}${u.message}`);}}}return r.join(`
|
|
2
|
-
`)}function Dn(e){let n=0,r=0,t=0,i={};for(let a of e.values())for(let o of a.items)o.severity==="error"?n++:o.severity==="warning"?r++:o.severity==="note"&&t++,i[o.code]=(i[o.code]||0)+1;return {totalCommands:e.size,errors:n,warnings:r,notes:t,byCode:i}}var xe,Rt,Bn=At({"src/generators/schema-validator.ts"(){xn(),xe=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Rt=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function de(e){let n="complex";return e.startsWith("#")&&!e.includes(" ")?n="id":e.startsWith(".")&&!e.includes(" ")?n="class":e.startsWith("[")&&e.endsWith("]")?n="attribute":/^[a-z][a-z0-9]*$/i.test(e)&&(n="element"),{type:"selector",value:e,selectorKind:n}}function M(e,n){let r={type:"literal",value:e};return n!==void 0?{type:"literal",value:e,dataType:n}:r}var Ln=new Set(["me","you","it","result","event","target","body"]);function gt(e){return Ln.has(e)}function G(e){return {type:"reference",value:e}}function Se(e,n){return {type:"property-path",object:e,property:n}}function ve(e,n,r){let t={kind:"command",action:e,roles:new Map(Object.entries(n))};return r!==void 0?{...t,metadata:r}:t}function kt(e,n,r,t,i,a){let o=new Map;o.set("event",e);let s={kind:"event-handler",action:"on",roles:o,body:n};return r!==void 0&&(s.eventModifiers=r),t!==void 0&&(s.metadata=t),s}function wt(e,n="then",r){let t={kind:"compound",action:"compound",roles:new Map,statements:e,chainType:n};return r!==void 0&&(t.metadata=r),t}function bt(e,n){return !n||n.length===0||n.includes(e)||n.includes("expression")?true:e==="property-path"?n.some(r=>["selector","reference","expression"].includes(r)):false}function Fn(e,n){return e.possessive?.keywords?.[n]}var J=new Map,ee=new Map,Ee=new Map,Pe=null;function Mt(e,n){let r={...e};for(let t of Object.keys(n)){let i=n[t],a=e[t];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof a=="object"&&a!==null&&!Array.isArray(a)?r[t]=Mt(a,i):r[t]=i);}return r}function $n(e,n){return Mt(e,n)}function Re(e){if(!e.extends)return e;let n=ee.get(e.extends);if(!n)return console.warn(`[Registry] Profile '${e.code}' extends '${e.extends}' but base is not registered. Make sure to import the base language before the variant.`),e;let r=Re(n);return $n(r,e)}function Nt(e){Pe=e;}var Tt=new Map;function te(e){return e.split("-")[0]}function re(e){return e.includes("-")}function Wn(e){let n=J.get(e);if(!n&&re(e)){let r=te(e);n=J.get(r);}if(!n){let r=Array.from(J.keys()).join(", ");throw new Error(`Language '${e}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${e}';`)}return n}function qn(e){let n=ee.get(e);if(!n&&re(e)){let r=te(e);n=ee.get(r);}if(!n){let r=Array.from(ee.keys()).join(", ");throw new Error(`Language profile '${e}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${e}';`)}return Re(n)}function Vn(e){let n=J.get(e);return !n&&re(e)&&(n=J.get(te(e))),n}function H(e){let n=ee.get(e);return !n&&re(e)&&(n=ee.get(te(e))),n?Re(n):void 0}function It(){return Array.from(J.keys())}function Kn(e,n){return Wn(n).tokenize(e)}function Y(e){let n=Ee.get(e);if(!n&&re(e)&&(n=Ee.get(te(e))),n)return n;let r=Tt.get(e);if(!r&&re(e)&&(r=Tt.get(te(e))),r)return Ee.set(e,r),r;if(!Pe)throw new Error(`No patterns registered for language '${e}'. Either import the language module or set a pattern generator.`);let t=qn(e),i=Pe(t);return Ee.set(e,i),i}var ge=class ce{constructor(){this.stemMatchCount=0,this.totalKeywordMatches=0;}matchPattern(n,r){let t=n.mark(),i=new Map;if(this.currentProfile=H(r.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(n,r.template.tokens,i))return n.reset(t),null;let o=this.calculateConfidence(r,i);return this.applyExtractionRules(r,i),{pattern:r,captured:i,consumedTokens:n.position()-t.position,confidence:o}}matchBest(n,r){let t=[];for(let a of r){let o=n.mark(),s=this.matchPattern(n,a);s&&t.push(s),n.reset(o);}if(t.length===0)return null;t.sort((a,o)=>{let s=o.pattern.priority-a.pattern.priority;return s!==0?s:o.confidence-a.confidence});let i=t[0];return this.matchPattern(n,i.pattern),i}matchTokenSequence(n,r,t){let i=r[0],a=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!a)for(;n.peek()?.kind==="conjunction";)n.advance();for(let o of r)if(!this.matchPatternToken(n,o,t)){if(this.isOptional(o))continue;return false}return true}matchPatternToken(n,r,t){switch(r.type){case "literal":return this.matchLiteralToken(n,r);case "role":return this.matchRoleToken(n,r,t);case "group":return this.matchGroupToken(n,r,t);default:return false}}matchLiteralToken(n,r){let t=n.peek();if(!t)return false;let i=this.getMatchType(t,r.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,n.advance(),true;if(r.alternatives)for(let a of r.alternatives){let o=this.getMatchType(t,a);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,n.advance(),true}return false}matchRoleToken(n,r,t){this.skipNoiseWords(n);let i=n.peek();if(!i)return r.optional||false;let a=this.tryMatchPossessiveExpression(n);if(a)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(a.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,a),true);let o=this.tryMatchMethodCallExpression(n);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(o.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,o),true);let s=this.tryMatchPossessiveSelectorExpression(n);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!bt(s.type,r.expectedTypes)?r.optional||false:(t.set(r.role,s),true);let l=this.tryMatchPropertyAccessExpression(n);if(l)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(l.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,l),true);let c=this.tryMatchSelectorPropertyExpression(n);if(c)return r.expectedTypes&&r.expectedTypes.length>0&&!bt(c.type,r.expectedTypes)?r.optional||false:(t.set(r.role,c),true);let u=this.tokenToSemanticValue(i);return !u||r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(u.type)?r.optional||false:(t.set(r.role,u),n.advance(),true)}tryMatchPossessiveExpression(n){let r=n.peek();if(!r||!this.currentProfile)return null;let t=(r.normalized||r.value).toLowerCase(),i=Fn(this.currentProfile,t);if(!i)return null;let a=n.mark();n.advance();let o=n.peek();if(!o)return n.reset(a),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)){n.advance();let s=o.value;o.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1));let l=s;for(;n.peek()?.kind==="selector"&&n.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(n.peek().value);)l+=n.peek().value,n.advance();let c=n.peek();return c?.kind==="literal"&&c.value.startsWith("(")&&(l+=c.value,n.advance()),Se(G(i),l)}return n.reset(a),null}isStructuralKeyword(n){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(n.toLowerCase())}tryMatchMethodCallExpression(n){let r=n.peek();if(!r||r.kind!=="selector")return null;let t=n.mark();n.advance();let i=n.peek();if(!i||i.kind!=="operator"||i.value!==".")return n.reset(t),null;n.advance();let a=n.peek();if(!a||a.kind!=="identifier")return n.reset(t),null;n.advance();let o=n.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return n.reset(t),null;n.advance();let s=[];for(;!n.isAtEnd()&&s.length<ce.MAX_METHOD_ARGS;){let c=n.peek();if(!c)break;if(c.kind==="punctuation"&&c.value===")"){n.advance();break}if(c.kind==="punctuation"&&c.value===","){n.advance();continue}s.push(c.value),n.advance();}return {type:"expression",raw:`${r.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(n){let r=n.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let t=n.mark();n.advance();let i=n.peek();if(!i||i.kind!=="operator"||i.value!==".")return n.reset(t),null;n.advance();let a=n.peek();if(!a||a.kind!=="identifier")return n.reset(t),null;n.advance();let o=`${r.value}.${a.value}`,s=1;for(;!n.isAtEnd()&&s<ce.MAX_PROPERTY_DEPTH;){let c=n.peek();if(!c||c.kind!=="operator"||c.value!==".")break;n.advance();let u=n.peek();if(!u||u.kind!=="identifier")break;n.advance(),o+=`.${u.value}`,s++;}let l=n.peek();if(l&&l.kind==="punctuation"&&l.value==="("){n.advance();let c=[],u=0;for(;!n.isAtEnd()&&c.length<ce.MAX_METHOD_ARGS;){let m=n.peek();if(!m)break;if(m.kind==="punctuation"&&m.value===")"){if(u===0){n.advance();break}u--;}if(m.kind==="punctuation"&&m.value==="("&&u++,m.kind==="punctuation"&&m.value===","){n.advance();continue}c.push(m.value),n.advance();}return {type:"expression",raw:`${o}(${c.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(n){let r=n.peek();if(!r||r.kind!=="selector")return null;let t=n.mark();n.advance();let i=n.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return n.reset(t),null;n.advance();let a=n.peek();return !a||a.kind!=="selector"&&a.kind!=="identifier"?(n.reset(t),null):(n.advance(),Se(de(r.value),a.value))}tryMatchSelectorPropertyExpression(n){let r=n.peek();if(!r||r.kind!=="selector"||!r.value.startsWith("#"))return null;let t=n.mark();n.advance();let i=n.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return n.reset(t),null;let a=n.peek(1);a&&a.kind,n.advance();let o=i.value.slice(1);return Se(de(r.value),o)}matchGroupToken(n,r,t){let i=n.mark(),a=new Set(t.keys());if(!this.matchTokenSequence(n,r.tokens,t)){n.reset(i);for(let s of t.keys())a.has(s)||t.delete(s);return r.optional||false}return true}getMatchType(n,r){return n.value===r?"exact":n.normalized===r?"normalized":n.stem===r&&n.stemConfidence!==void 0&&n.stemConfidence>=.7?"stem":n.kind==="keyword"&&n.value.toLowerCase()===r.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(n){switch(n.kind){case "selector":return de(n.value);case "literal":return this.parseLiteralValue(n.value);case "keyword":let r=(n.normalized||n.value).toLowerCase();return gt(r)?G(r):M(n.normalized||n.value);case "identifier":if(n.value.startsWith(":"))return G(n.value);let t=n.value.toLowerCase();return gt(t)?G(t):{type:"expression",raw:n.value};case "url":return M(n.value,"string");default:return null}}parseLiteralValue(n){if(n.startsWith('"')||n.startsWith("'")||n.startsWith("`")||n.startsWith("\u300C")){let i=n.slice(1,-1);return M(i,"string")}if(n==="true")return M(true,"boolean");if(n==="false")return M(false,"boolean");let r=n.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let i=parseFloat(r[1]);return r[2]?M(n,"duration"):M(i,"number")}let t=parseFloat(n);return isNaN(t)?M(n,"string"):M(t,"number")}applyExtractionRules(n,r){for(let[t,i]of Object.entries(n.extraction))r.has(t)||(i.value!==void 0?r.set(t,{type:"literal",value:i.value}):i.default&&r.set(t,i.default));}isOptional(n){return n.type!=="literal"&&n.optional===true}calculateConfidence(n,r){let t=0,i=0,a=c=>n.extraction?.[c]?.default!==void 0;for(let c of n.template.tokens)if(c.type==="role")i+=1,r.has(c.role)&&(t+=1);else if(c.type==="group"){for(let u of c.tokens)if(u.type==="role"){let d=a(u.role),m=.8;i+=m,r.has(u.role)?t+=m:d&&(t+=m*.6);}}let o=i>0?t/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let c=this.stemMatchCount/this.totalKeywordMatches*.15;o=Math.max(.5,o-c);}let s=this.calculateVSOConfidenceBoost(n);o=Math.min(1,o+s);let l=this.arabicPrepositionDisambiguation(n,r);return o=Math.max(0,Math.min(1,o+l)),o}calculateVSOConfidenceBoost(n){if(n.language!=="ar")return 0;let r=n.template.tokens[0];if(!r||r.type!=="literal")return 0;let t=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(t.has(r.value))return .15;if(r.alternatives){for(let i of r.alternatives)if(t.has(i))return .15}return 0}arabicPrepositionDisambiguation(n,r){if(n.language!=="ar")return 0;let t=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[a,o]of r.entries()){let s=i[a];if(!s||s.length===0)continue;let l="metadata"in o?o.metadata:void 0;if(l&&typeof l.prepositionValue=="string"){let c=l.prepositionValue;s.includes(c)?t+=.1:t-=.1;}}return Math.max(-0.1,Math.min(.1,t))}skipNoiseWords(n){let r=n.peek();if(!r)return;let t=r.value.toLowerCase();if(ce.ENGLISH_NOISE_WORDS.has(t)){let i=n.mark();n.advance();let a=n.peek();if(a&&a.kind==="selector")return;n.reset(i);}t==="class"&&n.advance();}extractEventModifiers(n){let r={},t=false;for(;!n.isAtEnd();){let i=n.peek();if(!i||i.kind!=="event-modifier")break;let a=i.metadata;if(!a)break;switch(t=true,a.modifierName){case "once":r.once=true;break;case "debounce":typeof a.value=="number"&&(r.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(r.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(r.queue=a.value);break}n.advance();}return t?r:void 0}};ge.MAX_PROPERTY_DEPTH=10;ge.MAX_METHOD_ARGS=20;ge.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Ot=ge,X=new Ot,Ae=class{constructor(e,n){this.pos=0,this.tokens=e,this.language=n;}peek(e=0){let n=this.pos+e;return n<0||n>=this.tokens.length?null:this.tokens[n]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(e){this.pos=e.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(e){let n=[];for(;!this.isAtEnd()&&e(this.peek());)n.push(this.advance());return n}skipWhile(e){for(;!this.isAtEnd()&&e(this.peek());)this.advance();}};function Un(e){return Vn(e)}function Ce(e,n){return Kn(e,n)}function Dt(){return It()}var Gn={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 ne=class K{parse(n,r){let{modifiers:t,remainingInput:i}=this.extractStandaloneModifiers(n,r),a=i||n,o=Ce(a,r),s=Y(r);if(s.length===0)throw new Error(`No patterns available for language: ${r}`);let l=[...s].sort((y,N)=>N.priority-y.priority),c=l.filter(y=>y.command==="on"),u=X.matchBest(o,c);if(u){let y=this.buildEventHandler(u,o,r);return t?this.applyModifiers(y,t):y}let d=l.filter(y=>y.command!=="on"),m=X.matchBest(o,d);if(m)return this.buildCommand(m,r);let f=this.trySOVEventExtraction(a,r,l);if(f)return t?this.applyModifiers(f,t):f;let h=this.tryCompoundCommandParsing(o,d,r);if(h)return h;throw new Error(`Could not parse input in ${r}: ${a}`)}canParse(n,r){try{return this.parse(n,r),!0}catch{return false}}supportedLanguages(){return Dt()}buildCommand(n,r){if(!n)throw new Error("No match to build command from");let t={};for(let[i,a]of n.captured)t[i]=a;return ve(n.pattern.command,t,{sourceLanguage:r,patternId:n.pattern.id,confidence:n.confidence})}buildEventHandler(n,r,t){if(!n)throw new Error("No match to build event handler from");let i=n.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");let a=X.extractEventModifiers(r),o=this.extractOrConjunctionEvents(r,t),s=i;o.length>0&&i.type==="literal"&&(s={type:"literal",value:[String(i.value),...o.map(d=>String("value"in d?d.value:""))].join(" or ")});let l,c=n.captured.get("action");if(c&&c.type==="literal"){let u=c.value,d={};for(let[h,y]of n.captured)h!=="event"&&h!=="action"&&h!=="continues"&&(d[h]=y);let m=ve(u,d,{sourceLanguage:t,patternId:n.pattern.id,confidence:n.confidence}),f=n.captured.get("continues");if(f&&f.type==="literal"&&f.value==="then"){let h=Y(t).filter(z=>z.command!=="on").sort((z,$)=>$.priority-z.priority),y=Y(t).filter(z=>z.id.startsWith("grammar-")&&z.id.includes("-continuation")).sort((z,$)=>$.priority-z.priority),N=this.parseBodyWithGrammarPatterns(r,h,y,t);N.length>0?l=[m,...N]:l=[m];}else l=[m];}else {let u=Y(t).filter(d=>d.command!=="on").sort((d,m)=>m.priority-d.priority);l=this.parseBodyWithClauses(r,u,t);}return kt(s,l,a,{sourceLanguage:t,patternId:n.pattern.id,confidence:n.confidence})}parseBodyWithClauses(n,r,t){let i=[],a=[];for(;!n.isAtEnd();){let o=n.peek();if(!o)break;let s=o.kind==="conjunction"||o.kind==="keyword"&&this.isThenKeyword(o.value,t),l=o.kind==="keyword"&&this.isEndKeyword(o.value,t);if(s){if(a.length>0){let c=this.parseClause(a,r,t);i.push(...c),a.length=0;}n.advance();continue}if(l){if(a.length>0){let c=this.parseClause(a,r,t);i.push(...c);}n.advance();break}a.push(o),n.advance();}if(a.length>0){let o=this.parseClause(a,r,t);i.push(...o);}return i.length>1?[wt(i,"then",{sourceLanguage:t})]:i}parseClause(n,r,t){if(n.length===0)return [];let i=new Ae(n,t),a=[];for(;!i.isAtEnd();){let o=X.matchBest(i,r);o?a.push(this.buildCommand(o,t)):i.advance();}if(a.length===0){let o=this.parseSOVClauseByVerbAnchoring(n,t);if(o.length>0)return o}return a}static buildVerbLookup(n){let r=new Map;for(let[t,i]of Object.entries(n.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(t)&&(r.set(i.primary.toLowerCase(),t),i.alternatives))for(let a of i.alternatives)r.set(a.toLowerCase(),t);return r}static buildMarkerToRoleLookup(n){let r=new Map;for(let[t,i]of Object.entries(n.roleMarkers))if(i&&(r.set(i.primary,t),i.alternatives))for(let a of i.alternatives)r.has(a)||r.set(a,t);return r}parseSOVClauseByVerbAnchoring(n,r){let t=H(r);if(!t||t.wordOrder!=="SOV")return [];let i=K.buildVerbLookup(t),a=K.buildMarkerToRoleLookup(t),o=[],s=0;for(;s<n.length;){let l=-1,c="";for(let h=s;h<n.length;h++){let y=n[h],N=i.get(y.value.toLowerCase()),z=y.normalized?i.get(y.normalized.toLowerCase()):void 0,$=N||z;if($){l=h,c=$;break}}if(l===-1)break;let u=n.slice(s,l),d=n.length;for(let h=l+1;h<n.length;h++){let y=n[h];if(y.kind==="conjunction"||this.isThenKeyword(y.value,r)){d=h;break}if(h>l+1&&(i.get(y.value.toLowerCase())||(y.normalized?i.get(y.normalized.toLowerCase()):void 0))){d=h;break}}let m=n.slice(l+1,d),f=this.extractRolesFromMarkedTokens(u,m,a,c,r);if(o.push(ve(c,f,{sourceLanguage:r,confidence:.7})),s=d,s<n.length){let h=n[s];(h.kind==="conjunction"||this.isThenKeyword(h.value,r))&&s++;}}return o}extractRolesFromMarkedTokens(n,r,t,i,a){let o={},s=l=>{let c=[];for(let u of l){let d=t.get(u.value);if(d&&u.kind==="particle"&&c.length>0){let m=this.tokensToSemanticValue(c);if(m){let f=this.mapRoleForCommand(d,i,o);f&&(o[f]=m);}c=[];}else c.push(u);}if(c.length>0){let u=this.tokensToSemanticValue(c);u&&(o.patient?o.destination||(o.destination=u):o.patient=u);}};return s(n),s(r),o}mapRoleForCommand(n,r,t){return t[n]?n==="patient"&&!t.destination?"destination":n==="destination"&&!t.patient?"patient":n==="source"&&!t.source?"source":null:n}tokensToSemanticValue(n){if(n.length===0)return null;let r=n.filter(a=>a.kind!=="whitespace");if(r.length===0)return null;if(r.length===1)return this.tokenToSemanticValue(r[0]);let t=r.map(a=>a.value).join(""),i=r[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?de(t):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?M(t):i.kind==="reference"?G(t):M(t)}tokenToSemanticValue(n){let r=n.value;if(n.kind==="selector"||r.startsWith("#")||r.startsWith(".")||r.startsWith("@")||r.startsWith("*"))return de(r);if(r.startsWith('"')||r.startsWith("'"))return M(r);if(/^-?\d+(\.\d+)?$/.test(r))return M(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return M(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return M(false);let t=n.normalized?.toLowerCase();return t==="me"||t==="it"||t==="you"||t==="result"||t==="body"?G(t):n.kind==="reference"?G(n.normalized||"me"):M(r)}parseBodyWithGrammarPatterns(n,r,t,i){let a=[];for(;!n.isAtEnd();){let o=n.peek();if(o&&this.isThenKeyword(o.value,i)){n.advance();continue}if(o&&this.isEndKeyword(o.value,i)){n.advance();break}let s=false;if(t.length>0){let l=X.matchBest(n,t);if(l){let c=l.pattern.command,u={};for(let[f,h]of l.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(u[f]=h);let d=ve(c,u,{sourceLanguage:i,patternId:l.pattern.id});a.push(d),s=true;let m=l.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then")continue}}if(!s){let l=X.matchBest(n,r);l&&(a.push(this.buildCommand(l,i)),s=true);}s||n.advance();}return a}tryCompoundCommandParsing(n,r,t){let i=n.tokens;if(!i.some(l=>l.kind==="conjunction"||l.kind==="keyword"&&this.isThenKeyword(l.value,t)))return null;let o=new Ae(i,t),s=this.parseBodyWithClauses(o,r,t);return s.length===0?null:s.length===1?s[0]:wt(s,"then",{sourceLanguage:t,confidence:.65})}trySOVEventExtraction(n,r,t){let i=K.SOV_EVENT_MARKERS[r];if(!i)return null;let o=Ce(n,r).tokens,s=Gn[r],l=new Set;if(s)for(let v of Object.keys(s))l.add(v.toLowerCase());let c=K.SOV_SOURCE_MARKERS[r],u=-1,d="",m="",f=1;for(let v=0;v<o.length;v++){let I=o[v],j=I.value.toLowerCase(),U=j,Q="",we=j.indexOf("[");we>0&&(U=j.slice(0,we),Q=I.value.slice(we));let be=I.normalized?.toLowerCase(),Le=be&&K.KNOWN_EVENTS.has(be),Fe=l.has(j)||l.has(U),Zt=K.KNOWN_EVENTS.has(U);if(Le||Fe||Zt){let ie;if(Le?ie=be:Fe?ie=s?.[j]??s?.[U]??U:ie=U,i.size>0){let pe=1,Te=o[v+1];Te&&Te.kind==="selector"&&Te.value.startsWith("[")&&(pe=2);let ye=o[v+pe];if(ye&&(ye.kind==="particle"||ye.kind==="keyword")&&i.has(ye.value)){u=v,d=ie,m=Q||(pe===2?o[v+1].value:""),f=pe+1;break}}else {u=v,d=ie,m=Q,f=1;break}}}if(u===-1)return null;let h=new Set;for(let v=u;v<u+f;v++)h.add(v);if(c){let v=u+f;if(v<o.length){let I=o[v];(I.kind==="particle"||I.kind==="keyword")&&c.markers.has(I.value)&&h.add(v);}for(let I=0;I<u;I++){let j=o[I],U=j.value.toLowerCase(),Q=j.normalized?.toLowerCase();if(c.windowTokens.has(U)||Q&&c.windowTokens.has(Q)){h.add(I);break}}}let y=o.filter((v,I)=>!h.has(I));if(y.length===0)return null;let N=t.filter(v=>v.command!=="on"),z=new Ae(y,r),$=this.parseBodyWithClauses(z,N,r);if($.length===0)return null;let Be={sourceLanguage:r,confidence:.75};return m&&(Be.keyFilter=m),kt({type:"literal",value:d},$,void 0,Be)}isThenKeyword(n,r){let t={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (t[r]||t.en).has(n.toLowerCase())}isEndKeyword(n,r){let t={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (t[r]||t.en).has(n.toLowerCase())}extractStandaloneModifiers(n,r){let i=Ce(n,r).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let o=i[0].value.toLowerCase(),s=K.STANDALONE_MODIFIERS[o];if(!s)return {modifiers:null,remainingInput:null};let l={},c=1;if(s==="once")l.once=true;else {let f=1;if(f<i.length){let h=i[f];(h.kind==="keyword"||h.kind==="particle")&&(f++,c++);}if(f<i.length){let h=i[f];if(h.kind==="literal"){let y=h.value.match(/^(\d+)(ms|s|m)?$/);if(y){let N=parseInt(y[1],10),z=y[2]||"ms";z==="s"?N*=1e3:z==="m"&&(N*=6e4),l[s]=N,c=f+1;}}}l[s]||(l[s]=s==="debounce"?300:100);}let u=i.slice(c);if(u.length===0)return {modifiers:null,remainingInput:null};let d=u[0].position.start,m=n.slice(d);return {modifiers:l,remainingInput:m}}applyModifiers(n,r){return {...n,eventModifiers:{...n.eventModifiers,...r}}}extractOrConjunctionEvents(n,r){let t=[];for(;;){let i=n.mark(),a=n.peek();if(!a)break;let o=(a.normalized||a.value).toLowerCase();if(!K.OR_KEYWORDS.has(o)){n.reset(i);break}n.advance();let s=n.peek();if(!s){n.reset(i);break}let l=(s.normalized||s.value).toLowerCase();n.advance(),t.push({type:"literal",value:l});}return t}};ne.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);ne.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"])};ne.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"])}};ne.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};ne.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 Qn=ne,Zn=new Qn;function Me(e,n){return Zn.parse(e,n)}var _e=class{constructor(e={}){this.cache=new Map,this.config={maxSize:e.maxSize??1e3,ttlMs:e.ttlMs??0,enabled:e.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(e,n){return `${n}:${e}`}isExpired(e){return this.config.ttlMs===0?false:Date.now()-e.createdAt>this.config.ttlMs}evictLRU(){let e=this.cache.keys().next().value;e!==void 0&&(this.cache.delete(e),this.stats.evictions++);}get(e,n){if(!this.config.enabled){this.stats.misses++;return}let r=this.makeKey(e,n),t=this.cache.get(r);if(!t){this.stats.misses++;return}if(this.isExpired(t)){this.cache.delete(r),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(r),t.lastAccessed=Date.now(),this.cache.set(r,t),this.stats.hits++,t.result}set(e,n,r){if(!this.config.enabled||r.confidence===0)return;let t=this.makeKey(e,n),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(t,{result:r,createdAt:i,lastAccessed:i});}has(e,n){if(!this.config.enabled)return false;let r=this.makeKey(e,n),t=this.cache.get(r);return t?this.isExpired(t)?(this.cache.delete(r),this.stats.expirations++,false):true:false}delete(e,n){let r=this.makeKey(e,n);return this.cache.delete(r)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let e=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:e>0?this.stats.hits/e:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(e){if(e.maxSize!==void 0)for(this.config.maxSize=e.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();e.ttlMs!==void 0&&(this.config.ttlMs=e.ttlMs),e.enabled!==void 0&&(this.config.enabled=e.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},Xn=new _e;var Yn=class{constructor(e={}){this.patternMatcher=new Ot,this.languages=new Set(It()),e.cache===false?this.cache=new _e({enabled:false}):this.cache=e.cache?new _e(e.cache):Xn;}analyze(e,n){if(!this.supportsLanguage(n))return {confidence:0,errors:[`Language '${n}' is not supported for semantic parsing`]};let r=this.cache.get(e,n);if(r)return r;let t=this.analyzeUncached(e,n);return this.cache.set(e,n,t),t}analyzeUncached(e,n){try{try{let o=Me(e,n),s={confidence:o.metadata?.confidence??.8,node:o};return o.kind==="command"?{...s,command:{name:o.action,roles:o.roles}}:s}catch{}let r=Un(n);if(!r)return {confidence:0,errors:[`No tokenizer available for language '${n}'`]};let t=r.tokenize(e),i=Y(n);if(i.length===0)return {confidence:0,errors:[`No patterns available for language '${n}'`]};let a=this.patternMatcher.matchBest(t,i);if(a){let o=this.buildSemanticNode(a);return {confidence:a.confidence,command:{name:a.pattern.command,roles:a.captured},node:o,tokensConsumed:a.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(r){return {confidence:0,errors:[r instanceof Error?r.message:String(r)]}}}supportsLanguage(e){return this.languages.has(e)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(e){this.cache.configure(e);}buildSemanticNode(e){return {kind:"command",action:e.pattern.command,roles:e.captured,metadata:{patternId:e.pattern.id}}}};function Bt(e){return new Yn(e)}var Jn=.5;function Lt(e,n=Jn){return e.confidence>=n&&e.command!==void 0}var ei={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},ti={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"}},ri={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},ni={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},ii={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>"}},ai={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}]},oi={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}]},si={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}]},li={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}]},ui={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},ci={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},di={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"}}]},mi={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"}}]},fi={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"}}]},hi={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"}}]},pi={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}]},yi={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}]},vi={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}]},Ei={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}]},gi={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}]},ki={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}]},wi={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}]},bi={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"}}]},Ti={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}]},Si={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Ai={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"'},Ci={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"}}]},xi={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}]},Pi={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},_i={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:""}}]},Ri={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}]},Mi={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"}}]},Ni={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}]},Ii={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}]},Oi={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}]},Di={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}]},Bi={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}]},Li={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Fi={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:""}}]},$i={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:[]},qi={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}]},Vi={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}]},Ki={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"}}]},ji={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"}}]},Ui={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"}}]},Gi={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}]},Hi={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Qi={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}]},Zi={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Xi={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}]},Yi={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}]},Ft={toggle:ei,add:ti,remove:ri,put:ni,set:ii,show:ai,hide:oi,on:si,trigger:li,wait:ui,fetch:ci,increment:di,decrement:mi,append:fi,prepend:hi,log:pi,get:yi,take:vi,make:Ei,halt:gi,settle:ki,throw:wi,send:bi,if:Ti,unless:zi,else:Si,repeat:Ai,for:Ci,while:xi,continue:Pi,go:_i,transition:Ri,clone:Mi,focus:Ni,blur:Ii,call:Oi,return:Di,js:Bi,async:Li,tell:Fi,default:$i,init:Wi,behavior:qi,install:Vi,measure:Ki,swap:ji,morph:Ui,beep:Gi,break:Hi,copy:Qi,exit:Zi,pick:Xi,render:Yi,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Ji(){return Object.values(Ft).filter(e=>e.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(Bn(),Pt)).then(({validateAllSchemas:e,formatValidationResults:n})=>{let r=e(Ft);r.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(n(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(e=>{console.debug("Schema validation skipped:",e);});function $t(e,n){let r=n==="SOV"?"sovPosition":"svoPosition";return [...e].sort((t,i)=>{let a=t[r]??99,o=i[r]??99;return a-o})}function ea(e,n){let r=e.markerOverride?.[n.code],t=n.roleMarkers[e.role];if(r!==void 0)return {primary:r,position:t?.position??"before",isOverride:true};if(t&&t.primary){let i={primary:t.primary,position:t.position,isOverride:false};return t.alternatives&&(i.alternatives=t.alternatives),i}return null}function ta(e,n,r,t,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),t.position==="after"){let c=t.primary.split(/\s+/);if(c.length>1)for(let u of c)a.push({type:"literal",value:u});else {let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);}}let o=n.roleMarkers.destination;o&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),a.push({type:"role",role:"patient",optional:false});let s=n.roleMarkers.patient;if(s){let c=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};a.push(c);}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(l),{id:`${e.action}-event-${n.code}-sov`,language:n.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${t.primary} {destination?} {patient} ${s?.primary||""} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ra(e,n,r,t,i){let a=[];a.push({type:"role",role:"patient",optional:false});let o=n.roleMarkers.patient;if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(l);}if(a.push({type:"role",role:"event",optional:false}),t.position==="after"){let l=t.primary.split(/\s+/);if(l.length>1)for(let c of l)a.push({type:"literal",value:c});else {let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(c);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(s),{id:`${e.action}-event-${n.code}-sov-patient-first`,language:n.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${o?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function na(e,n,r,t,i){let a=[];a.push({type:"role",role:"patient",optional:false});let o=n.roleMarkers.patient;if(o){let c=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(c);}let s=n.roleMarkers.destination;if(s&&(a.push({type:"role",role:"destination",optional:false}),a.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),a.push({type:"role",role:"event",optional:false}),t.position==="after"){let c=t.primary.split(/\s+/);if(c.length>1)for(let u of c)a.push({type:"literal",value:u});else {let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);}}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(l),{id:`${e.action}-event-${n.code}-sov-patient-first-dest`,language:n.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${s?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function ia(e,n,r,t,i){let a=[];a.push({type:"role",role:"event",optional:false});let o=t.alternatives?.filter(u=>!u.includes(" ")&&u.length>1)||[];o.length>0&&a.push({type:"literal",value:o[0],alternatives:o.slice(1)});let s=n.roleMarkers.destination;s&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),a.push({type:"role",role:"patient",optional:false});let l=n.roleMarkers.patient;if(l){let u=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};a.push(u);}let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(c),{id:`${e.action}-event-${n.code}-sov-compact`,language:n.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function aa(e,n,r,t,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),t.position==="after"){let s=t.primary.split(/\s+/);if(s.length>1)for(let l of s)a.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(l);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(o),{id:`${e.action}-event-${n.code}-sov-simple`,language:n.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${t.primary} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function oa(e,n,r,t){let i=n.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let a=[];a.push({type:"role",role:"event",optional:false}),n.possessive?.marker&&a.push({type:"group",optional:true,tokens:[{type:"literal",value:n.possessive.marker}]}),a.push({type:"literal",value:i[0],alternatives:i.slice(1)}),a.push({type:"role",role:"patient",optional:false});let o=n.roleMarkers.patient;if(o?.primary){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(l);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(s),{id:`${e.action}-event-${n.code}-sov-temporal`,language:n.code,command:"on",priority:(t.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function sa(e,n,r,t,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),t.position==="after"){let u=t.primary.split(/\s+/);if(u.length>1)for(let d of u)a.push({type:"literal",value:d});else {let d=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(d);}}let s=[...e.roles.filter(u=>u.required)].sort((u,d)=>{let m=u.sovPosition??999,f=d.sovPosition??999;return m-f});for(let u of s){a.push({type:"role",role:u.role,optional:false});let d,m;if(u.markerOverride&&u.markerOverride[n.code]!==void 0)d=u.markerOverride[n.code];else {let f=n.roleMarkers[u.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(f);}}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(l);let c=s.map(u=>`{${u.role}}`).join(" ");return {id:`${e.action}-event-${n.code}-sov-2role`,language:n.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${t.primary} ${c} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(s.map(u=>[u.role,{fromRole:u.role}]))}}}function la(e,n,r,t,i){let a=[],s=[...e.roles.filter(h=>h.required)].sort((h,y)=>{let N=h.sovPosition??999,z=y.sovPosition??999;return N-z}),l=s[0];a.push({type:"role",role:l.role,optional:false});let c;if(l.markerOverride&&l.markerOverride[n.code]!==void 0)c=l.markerOverride[n.code];else {let h=n.roleMarkers[l.role];h&&(c=h.primary);}if(c&&a.push({type:"literal",value:c}),a.push({type:"role",role:"event",optional:false}),t.position==="after"){let h=t.primary.split(/\s+/);if(h.length>1)for(let y of h)a.push({type:"literal",value:y});else {let y=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(y);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u);let d=s[1];a.push({type:"role",role:d.role,optional:false});let m,f;if(d.markerOverride&&d.markerOverride[n.code]!==void 0)m=d.markerOverride[n.code];else {let h=n.roleMarkers[d.role];h&&(m=h.primary,f=h.alternatives);}if(m){let h=f?{type:"literal",value:m,alternatives:f}:{type:"literal",value:m};a.push(h);}return {id:`${e.action}-event-${n.code}-sov-2role-dest-first`,language:n.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${l.role}} {event} ${t.primary} ${r.primary} {${d.role}}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[d.role]:{fromRole:d.role}}}}function zt(e,n,r,t,i){let a=[];if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(l);}a.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(o),a.push({type:"role",role:"patient",optional:false});let s=n.roleMarkers.destination;return s&&a.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${e.action}-event-${n.code}-vso`,language:n.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${t.primary} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ua(e,n,r,t,i){let a=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(o),a.push({type:"role",role:"patient",optional:false});let s=n.roleMarkers.destination;if(s&&a.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(l);}return a.push({type:"role",role:"event",optional:false}),{id:`${e.action}-event-${n.code}-vso-verb-first`,language:n.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${r.primary} {patient} ${s?.primary||""} {destination?} ${t.primary} {event}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ca(e,n,r,t,i){let a=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(o);let l=[...e.roles.filter(u=>u.required)].sort((u,d)=>{let m=u.svoPosition??999,f=d.svoPosition??999;return m-f});for(let u of l){let d,m;if(u.markerOverride&&u.markerOverride[n.code]!==void 0)d=u.markerOverride[n.code];else {let f=n.roleMarkers[u.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(f);}a.push({type:"role",role:u.role,optional:false});}if(t.position==="before"){let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);}a.push({type:"role",role:"event",optional:false});let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${e.action}-event-${n.code}-vso-verb-first-2role`,language:n.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${c} ${t.primary} {event}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function St(e,n,r,t,i){let a=[];if(t.position==="before"){let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);}a.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(o);let l=[...e.roles.filter(u=>u.required)].sort((u,d)=>{let m=u.svoPosition??999,f=d.svoPosition??999;return m-f});for(let u of l){let d,m;if(u.markerOverride&&u.markerOverride[n.code]!==void 0)d=u.markerOverride[n.code];else {let f=n.roleMarkers[u.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(f);}a.push({type:"role",role:u.role,optional:false});}let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${e.action}-event-${n.code}-vso-2role`,language:n.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${t.primary} {event} ${r.primary} ${c}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function da(e,n,r,t,i){let a=[],o=n.eventHandler?.negationMarker;if(t.position==="before"){let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(c);}if(o){let c=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(c);}a.push({type:"role",role:"event",optional:false});let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(s),a.push({type:"role",role:"patient",optional:false});let l=n.roleMarkers.destination;return l&&a.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${e.action}-event-${n.code}-vso-negated`,language:n.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${o?.primary||""} {event} ${r.primary} {patient} ${l?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ma(e,n,r,t){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let o=n.roleMarkers.destination;return o&&i.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),{id:`${e.action}-event-${n.code}-vso-proclitic`,language:n.code,command:"on",priority:(t.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var me={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Wt(e,n,r=me){let t=`${e.action}-${n.code}-generated`,i=r.basePriority??100,a=n.keywords[e.action];if(!a)throw new Error(`No keyword translation for '${e.action}' in ${n.code}`);let o=ya(e,n,a),s=Vt(e,n),l=ka(e,n,a);return {id:t,language:n.code,command:e.action,priority:i,template:{format:l,tokens:o},extraction:s}}function fa(e,n,r=me){if(e.roles.filter(s=>!s.required).length===0)return null;let i=e.roles.filter(s=>s.required),a={...e,roles:i};return {...Wt(a,n,r),id:`${e.action}-${n.code}-simple`,priority:(r.basePriority??100)-5,extraction:Vt(e,n)}}function ha(e,n,r=me){let t=[];if(t.push(Wt(e,n,r)),r.generateSimpleVariants){let i=fa(e,n,r);i&&t.push(i);}return t}function qt(e,n=me){let r=[],t=Ji();for(let i of t){if(!e.keywords[i.action])continue;let a=ha(i,e,n);if(r.push(...a),e.eventHandler?.eventMarker){let o=pa(i,e,n);r.push(...o);}}return r}function pa(e,n,r=me){if(!n.eventHandler||!n.eventHandler.eventMarker)return [];let t=[],i=n.eventHandler.eventMarker,a=n.keywords[e.action];if(!a)return [];let s=e.roles.filter(l=>l.required).length===2;if(n.wordOrder==="SOV")if(s)t.push(sa(e,n,a,i,r)),t.push(la(e,n,a,i,r));else {t.push(ta(e,n,a,i,r)),t.push(ra(e,n,a,i,r));let l=n.roleMarkers.destination;l&&l.primary!==i.primary&&t.push(na(e,n,a,i,r));let c=i.primary.split(/\s+/),u=i.alternatives?.some(m=>!m.includes(" ")&&m.length>1);c.length>1&&u&&t.push(ia(e,n,a,i,r)),t.push(aa(e,n,a,i,r));let d=oa(e,n,a,r);d&&t.push(d);}else n.wordOrder==="VSO"?s?(t.push(St(e,n,a,i,r)),t.push(ca(e,n,a,i,r))):(t.push(zt(e,n,a,i,r)),t.push(ua(e,n,a,i,r)),n.eventHandler?.negationMarker&&t.push(da(e,n,a,i,r)),n.tokenization?.prefixes&&t.push(ma(e,n,a,r))):s?t.push(St(e,n,a,i,r)):t.push(zt(e,n,a,i,r));return t}function ya(e,n,r){let t=[],i=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},a=va(e,n);switch(n.wordOrder){case "SVO":t.push(i),t.push(...a);break;case "SOV":t.push(...a),t.push(i);break;case "VSO":t.push(i),t.push(...a);break;default:t.push(i),t.push(...a);}return t}function va(e,n){let r=[],t=$t(e.roles,n.wordOrder);for(let i of t){let a=Ea(i,n);i.required?r.push(...a):r.push({type:"group",optional:true,tokens:a});}return r}function Ea(e,n){let r=[],t=e.markerOverride?.[n.code],i=n.roleMarkers[e.role],a={type:"role",role:e.role,optional:!e.required,expectedTypes:e.expectedTypes};if(t!==void 0)(i?.position??"before")==="before"?(t&&r.push({type:"literal",value:t}),r.push(a)):(r.push(a),t&&r.push({type:"literal",value:t}));else if(i)if(i.position==="before"){if(i.primary){let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}r.push(a);}else {r.push(a);let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}else r.push(a);return r}function ga(e,n){let r={};for(let t of e.roles){let i=t.markerOverride?.[n.code],a=n.roleMarkers[t.role];i!==void 0?r[t.role]=i?{marker:i}:{}:a&&a.primary?r[t.role]=a.alternatives?{marker:a.primary,markerAlternatives:a.alternatives}:{marker:a.primary}:r[t.role]={};}return r}function Vt(e,n){let r=ga(e,n),t={};for(let i of e.roles){let a=r[i.role]||{};!i.required&&i.default?t[i.role]={...a,default:i.default}:t[i.role]=a;}return t}function ka(e,n,r){let t=[],a=$t(e.roles,n.wordOrder).map(o=>{let s=ea(o,n),l="";return s&&s.primary?s.position==="before"?l=`${s.primary} {${o.role}}`:l=`{${o.role}} ${s.primary}`:l=`{${o.role}}`,o.required?l:`[${l}]`});switch(n.wordOrder){case "SVO":case "VSO":t.push(r.primary,...a);break;case "SOV":t.push(...a,r.primary);break;default:t.push(r.primary,...a);}return t.join(" ")}function ke(e){let n=e.getAttribute("data-lang");if(n)return Ne(n);let r=e.getAttribute("data-hyperscript-lang")??e.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return Ne(r);let t=typeof document<"u"?document.documentElement?.lang:null;return t&&t!=="en"?Ne(t):null}function Ne(e){return e.split("-")[0].toLowerCase()}var Kt={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],call:[["patient",""]],clone:[["patient",""],["destination","into"]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],return:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["patient",""]],while:[["condition",""]]};function he(e){switch(e.kind){case "event-handler":return wa(e);case "compound":return ba(e);default:return Ta(e)}}function wa(e){let n=["on"],r=e.roles.get("event");r&&n.push(fe(r));let t=e.roles.get("source");if(t&&n.push("from",fe(t)),e.body&&e.body.length>0){let i=e.body.map(he);n.push(i.join(" then "));}return n.join(" ")}function ba(e){let n=e.chainType==="async"?"async":e.chainType;return e.statements.map(he).join(` ${n} `)}function Ta(e){let n=Kt[e.action];if(n){let t=[e.action];for(let[i,a]of n){let o=e.roles.get(i);o&&(i==="destination"&&o.type==="reference"&&o.value==="me"||(a&&t.push(a),t.push(fe(o))));}return t.join(" ")}let r=[e.action];for(let[,t]of e.roles)r.push(fe(t));return r.join(" ")}function fe(e){switch(e.type){case "literal":return typeof e.value=="string"&&e.dataType==="string"?`"${e.value}"`:String(e.value);case "selector":return e.value;case "reference":return e.value;case "property-path":return za(e);case "expression":return e.raw}}function za(e){let n=fe(e.object),r=e.property;if(e.object.type==="reference")switch(e.object.value){case "me":return `my ${r}`;case "it":return `its ${r}`;case "you":return `your ${r}`}return `${n}'s ${r}`}var Ut=.5,Sa={confidenceThreshold:Ut,strategy:"semantic",fallbackToOriginal:true};function Aa(e,n){return typeof e=="number"?e:e[n]??e["*"]??Ut}var Ie=null;function Ca(){return Ie||(Ie=Bt()),Ie}function Oe(e,n,r={}){let t={...Sa,...r},i=jt(e,n,t);if(i!==null)return i;let a=Pa(e);if(a){let o=jt(a.commands,n,t);if(o!==null)return a.prefix+o}return e}function jt(e,n,r){if(r.strategy==="semantic"||r.strategy==="auto"){let t=Aa(r.confidenceThreshold,n),i=Gt(e,n,t);if(i!==null)return i}if((r.strategy==="auto"||r.strategy==="i18n")&&r.i18nToEnglish){let t=_a(e,n,r.i18nToEnglish);if(t!==null)return t}return null}var xa=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Pa(e){let n=e.match(xa);if(!n)return null;let r=n[1],t=e.slice(r.length);return t?{prefix:r,commands:t}:null}function Gt(e,n,r){try{let t=Ma(e,n);if(t.length>1)return Na(t,n,r);let i=Ca();if(!i.supportsLanguage(n))return null;let a=i.analyze(e,n);if(!Lt(a,r))return null;if(a.node)return he(a.node);let o=Me(e,n);return he(o)}catch{return null}}function _a(e,n,r){try{let t=r(e,n);return t!==e?t:null}catch{return null}}function Ra(e){let n=["then"],r=H(e);if(r?.keywords?.then){let t=r.keywords.then;if(t.primary&&t.primary!=="then"&&n.push(t.primary),t.alternatives)for(let i of t.alternatives)n.includes(i)||n.push(i);}return n}function Ma(e,n){let t=Ra(n).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${t.join("|")})\\s+`,"i"),a=e.split(`
|
|
4
|
-
`).map(s=>s.trim()).filter(s=>s.length>0),o=[];for(let s of a){let l=s.split(i);o.push(...l);}return o}function
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function N(r,e){return e?{type:"literal",value:r,dataType:e}:{type:"literal",value:r}}function ye(r,e){return e?{type:"selector",value:r,selectorKind:e}:{type:"selector",value:r}}function se(r){return {type:"reference",value:r}}function ve(r,e){return {type:"property-path",object:r,property:e}}var Pt=class{constructor(r){this.namespace=r,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let r=process.env.DEBUG||"";return r==="*"||r.includes("framework:*")||r.includes(`framework:${this.namespace}`)}return false}log(r,e,...t){if(!this.enabled)return;let n=`[framework:${this.namespace}]`,i=new Date().toISOString();switch(r){case "debug":console.debug(`${i} ${n} DEBUG:`,e,...t);break;case "info":console.info(`${i} ${n} INFO:`,e,...t);break;case "warn":console.warn(`${i} ${n} WARN:`,e,...t);break;case "error":console.error(`${i} ${n} ERROR:`,e,...t);break}}debug(r,...e){this.log("debug",r,...e);}info(r,...e){this.log("info",r,...e);}warn(r,...e){this.log("warn",r,...e);}error(r,...e){this.log("error",r,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function _t(r){return new Pt(r)}function V(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Nt(r,e){return r?.possessive?.keywords?.[e]}var X=class W{constructor(){this.logger=_t("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,n){let i=e.mark(),a=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",t.id),this.logger.debug("Pattern command:",t.command),this.logger.debug("Pattern language:",t.language),this.logger.debug("Pattern template:",JSON.stringify(t.template,null,2)),this.logger.isEnabled()){let l=[];for(let u=0;u<10;u++){let c=e.peek(u);if(c)l.push({type:c.type,value:c.value,kind:c.kind});else break}this.logger.debug("Input tokens (first 10):",l),this.logger.debug("Profile code:",n?.code);}this.currentProfile=n,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(t.template.tokens,null,2));let o=this.matchTokenSequence(e,t.template.tokens,a);if(this.logger.debug("matchTokenSequence returned:",o),this.logger.debug("Captured roles:",Array.from(a.entries()).map(([l,u])=>[l,JSON.stringify(u)])),!o)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(i),null;let s=this.calculateConfidence(t,a);return this.applyExtractionRules(t,a),{pattern:t,captured:a,consumedTokens:e.position()-i.position,confidence:s}}matchBest(e,t,n){let i=[];for(let o of t){let s=e.mark(),l=this.matchPattern(e,o,n);l&&i.push(l),e.reset(s);}if(i.length===0)return null;i.sort((o,s)=>{let l=s.pattern.priority-o.pattern.priority;if(l!==0)return l;let u=s.confidence-o.confidence;return Math.abs(u)>.001?u:s.consumedTokens-o.consumedTokens});let a=i[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,n,i){let a=t[0],o=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();let s=null,l=null;for(let u=0;u<t.length;u++){let c=t[u];this.logger.debug(" >> Matching pattern token:",JSON.stringify(c,null,2));let d=e.peek();if(this.logger.debug(" >> Current input token:",d?JSON.stringify({type:d.type,value:d.value,kind:d.kind}):"EOF"),c.type==="role"&&c.greedy){let y=this.collectStopMarkers(t,u+1);if(i)for(let b of i)y.add(b);let g=[];for(;!e.isAtEnd();){let b=e.peek();if(!b||this.isStopMarker(b,y))break;g.push(b.value),e.advance();}if(g.length>0){n.set(c.role,{type:"expression",raw:g.join(" ")}),s=null,l=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let y=this.collectStopMarkers(t,u+1);if(i)for(let b of i)y.add(b);if(this.matchGroupToken(e,c,n,y)){s=null,l=null;continue}if(this.isOptional(c))continue;return false}let p=c.type==="role"&&c.optional===true,m=p?e.mark():null;if(c.type==="role"&&!p){let y=u+1<t.length?t[u+1]:null;if(y?.type==="literal"){let g=e.peek();if(g&&this.getMatchType(g,y.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(c))continue;if(s&&l){this.logger.debug(" >> BACKTRACKING: undoing optional role",l),e.reset(s),n.delete(l),s=null,l=null;let b=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Backtrack retry result:",b),b)continue}return false}}}let v=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Match result:",v),v){p?(s=m,l=c.role):(s=null,l=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(c)){if(s&&l){this.logger.debug(" >> BACKTRACKING: undoing optional role",l),e.reset(s),n.delete(l),s=null,l=null;let y=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Backtrack retry result:",y),y)continue}return false}}return true}matchPatternToken(e,t,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,n);case "group":return this.matchGroupToken(e,t,n);default:return false}}matchLiteralToken(e,t){let n=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",n?JSON.stringify({type:n.type,value:n.value,kind:n.kind}):"null"),!n)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let i=this.getMatchType(n,t.value);if(this.logger.debug(" >>> matchType for",n.value,"vs",t.value,":",i),i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let a of t.alternatives){let o=this.getMatchType(n,a);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,n){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",t.role),this.logger.debug(" >>> matchRoleToken: expected types",t.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",t.optional),this.skipNoiseWords(e);let i=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null"),!i)return t.optional||false;let a=this.tryMatchPossessiveExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!V(a.type,t.expectedTypes)?t.optional||false:(n.set(t.role,a),true);let o=this.tryMatchMethodCallExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!V(o.type,t.expectedTypes)?t.optional||false:(n.set(t.role,o),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!V(s.type,t.expectedTypes)?t.optional||false:(n.set(t.role,s),true);let l=this.tryMatchPropertyAccessExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!V(l.type,t.expectedTypes)?t.optional||false:(n.set(t.role,l),true);let u=this.tryMatchSelectorPropertyExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!V(u.type,t.expectedTypes)?t.optional||false:(n.set(t.role,u),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null");let c=this.tokenToSemanticValue(i);return this.logger.debug(" >>> tokenToSemanticValue returned:",c?JSON.stringify(c):"null"),c?(this.logger.debug(" >>> Validating type:",c.type,"against expected:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!V(c.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),n.set(t.role,c),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let n=t.normalized||t.value,i=this.safeToLowerCase(n),a=Nt(this.currentProfile,i);if(!a)return null;let o=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(o),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let l=s.value;s.kind==="selector"&&l.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(l)&&(l=l.substring(1));let u=l;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)u+=e.peek().value,e.advance();let c=e.peek();return c?.kind==="literal"&&c.value.startsWith("(")&&(u+=c.value,e.advance()),ve(se(a),u)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(n),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<W.MAX_METHOD_ARGS;){let u=e.peek();if(!u)break;if(u.kind==="punctuation"&&u.value===")"){e.advance();break}if(u.kind==="punctuation"&&u.value===","){e.advance();continue}s.push(u.value),e.advance();}return {type:"expression",raw:`${t.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(n),null;e.advance();let o=`${t.value}.${a.value}`,s=1;for(;!e.isAtEnd()&&s<W.MAX_PROPERTY_DEPTH;){let u=e.peek();if(!u||u.kind!=="operator"||u.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),o+=`.${c.value}`,s++;}let l=e.peek();if(l&&l.kind==="punctuation"&&l.value==="("){e.advance();let u=[],c=0;for(;!e.isAtEnd()&&u.length<W.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}u.push(p.value),e.advance();}return {type:"expression",raw:`${o}(${u.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"&&a.kind!=="identifier"?(e.reset(n),null):(e.advance(),ve(ye(t.value),a.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||typeof t.value!="string"||!t.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let a=e.peek(1);a&&a.kind,e.advance();let o=i.value.slice(1);return ve(ye(t.value),o)}matchGroupToken(e,t,n,i){let a=e.mark(),o=new Set(n.keys());if(this.matchTokenSequence(e,t.tokens,n,i))return true;e.reset(a);for(let u of n.keys())o.has(u)||n.delete(u);if(!t.optional)return false;let l=this.getGroupLeadingMarker(t);if(l)for(let u=1;u<=W.MAX_MARKER_SCAN;u++){let c=e.peek(u);if(!c)break;if((c.normalized||c.value).toLowerCase()===l){this.logger.debug(" >> MARKER SCAN: found",l,"at offset",u,"- skipping intervening tokens");for(let m=0;m<u;m++)e.advance();if(this.matchTokenSequence(e,t.tokens,n,i))return true;e.reset(a);for(let m of n.keys())o.has(m)||n.delete(m);break}}return true}getGroupLeadingMarker(e){let t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let n=new Set;for(let i=t;i<e.length;i++){let a=e[i];if(a.type==="literal"){if(n.add(a.value.toLowerCase()),a.alternatives)for(let o of a.alternatives)n.add(o.toLowerCase());break}if(a.type==="group"){for(let o of a.tokens)if(o.type==="literal"){if(n.add(o.value.toLowerCase()),o.alternatives)for(let s of o.alternatives)n.add(s.toLowerCase());break}if(!a.optional)break}}return n}isStopMarker(e,t){return t.size===0?false:!!(t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return ye(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return N(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return se(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return N(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return N(i,"string")}if(e==="true")return N(true,"boolean");if(e==="false")return N(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let i=parseFloat(t[1]);return t[2]?N(e,"duration"):N(i,"number")}let n=parseFloat(e);return isNaN(n)?N(e,"string"):N(n,"number")}applyExtractionRules(e,t){for(let[n,i]of Object.entries(e.extraction))t.has(n)||(i.value!==void 0?t.set(n,{type:"literal",value:i.value}):i.default&&t.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let n=0,i=0,a=u=>e.extraction?.[u]?.default!==void 0;for(let u of e.template.tokens)if(u.type==="role")i+=1,t.has(u.role)&&(n+=1);else if(u.type==="group"){for(let c of u.tokens)if(c.type==="role"){let d=a(c.role),p=.8;i+=p,t.has(c.role)?n+=p:d&&(n+=p*.6);}}let o=i>0?n/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let u=this.stemMatchCount/this.totalKeywordMatches*.15;o=Math.max(.5,o-u);}let s=this.calculateVSOConfidenceBoost(e);o=Math.min(1,o+s);let l=this.arabicPrepositionDisambiguation(e,t);return o=Math.max(0,Math.min(1,o+l)),o}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let n=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(n.has(t.value))return .15;if(t.alternatives){for(let i of t.alternatives)if(n.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let n=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[a,o]of t.entries()){let s=i[a];if(!s||s.length===0)continue;let l="metadata"in o?o.metadata:void 0;if(l&&typeof l.prepositionValue=="string"){let u=l.prepositionValue;s.includes(u)?n+=.1:n-=.1;}}return Math.max(-0.1,Math.min(.1,n))}skipNoiseWords(e){let t=e.peek();if(!t)return;let n=this.safeToLowerCase(t.value);if(W.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let a=e.peek();if(a&&a.kind==="selector")return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let t={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let a=i.metadata;if(!a)break;switch(n=true,a.modifierName){case "once":t.once=true;break;case "debounce":typeof a.value=="number"&&(t.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(t.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(t.queue=a.value);break}e.advance();}return n?t:void 0}};X.MAX_MARKER_SCAN=3;X.MAX_PROPERTY_DEPTH=10;X.MAX_METHOD_ARGS=20;X.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Ot=X;new Ot;var z=class{constructor(){this.name="string-literal";}canExtract(r,e){let t=r[e];return t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(r,e){let t=r[e];if(t==="\u201C"){let a=1;for(;e+a<r.length;){if(r[e+a]==="\u201D")return a++,{value:r.substring(e,e+a),length:a};a++;}return null}if(t==="\u2018"){let a=1;for(;e+a<r.length;){if(r[e+a]==="\u2019")return a++,{value:r.substring(e,e+a),length:a};a++;}return null}let n=1,i=false;for(;e+n<r.length;){let a=r[e+n];if(i){i=false,n++;continue}if(a==="\\"){i=true,n++;continue}if(a===t)return n++,{value:r.substring(e,e+n),length:n};n++;}return null}},R=class{constructor(){this.name="number";}canExtract(r,e){return /\d/.test(r[e])}extract(r,e){let t=0,n=false;for(;e+t<r.length;){let o=r[e+t];if(/\d/.test(o))t++;else if(o==="."&&!n)n=true,t++;else break}if(t===0)return null;let i=r.substring(e,e+t),a=e+t;if(a<r.length){let o=r.slice(a),s=[{pattern:"\u6BEB\u79D2",suffix:"ms"},{pattern:"\u5206\u949F",suffix:"m"},{pattern:"\u5C0F\u65F6",suffix:"h"},{pattern:"\u30DF\u30EA\u79D2",suffix:"ms"},{pattern:"\u6642\u9593",suffix:"h"}];for(let u of s)if(o.startsWith(u.pattern))return {value:i+u.suffix,length:t+u.pattern.length,metadata:{hasTimeUnit:true}};if(o.startsWith("ms"))return {value:i+"ms",length:t+2,metadata:{hasTimeUnit:true}};let l=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let u of l)if(o.startsWith(u.pattern))return {value:i+u.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(o))return {value:i+o[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:i,length:t}}};function It(r){return "setContext"in r&&typeof r.setContext=="function"}function Mt(r){let e={language:r.language,direction:r.direction,lookupKeyword:r.lookupKeyword.bind(r),isKeyword:r.isKeyword.bind(r),isKeywordStart:r.isKeywordStart.bind(r)};return r.normalizer?{...e,normalizer:r.normalizer}:e}var Lt=new Set(["me","you","it","result","event","target","body"]);function Me(r,e=Lt){return e.has(r)}var J=class{constructor(r,e){this.pos=0,this.tokens=r,this.language=e;}peek(r=0){let e=this.pos+r;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let e=[];for(;!this.isAtEnd()&&r(this.peek());)e.push(this.advance());return e}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function k(r,e){return {start:r,end:e}}function w(r,e,t,n){if(typeof r=="object"){let{value:a,kind:o,position:s,normalized:l,stem:u,stemConfidence:c,metadata:d}=r;return {value:a,kind:o,position:s,...l!==void 0&&{normalized:l},...u!==void 0&&{stem:u},...c!==void 0&&{stemConfidence:c},...d!==void 0&&{metadata:d}}}let i=r;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof n=="string")return {value:i,kind:e,position:t,normalized:n};if(n){let{normalized:a,stem:o,stemConfidence:s,metadata:l}=n;return {value:i,kind:e,position:t,...a!==void 0&&{normalized:a},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s},...l!==void 0&&{metadata:l}}}return {value:i,kind:e,position:t}}function Z(r){return /\s/.test(r)}function Bt(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function $t(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function L(r){return /\d/.test(r)}function Vt(r){return /[a-zA-Z]/.test(r)}function T(r){return /[a-zA-Z0-9_-]/.test(r)}function Wt(r,e){if(e>=r.length)return null;let t=r[e];if(!Bt(t))return null;let n=e,i="";if(t==="#"||t==="."){for(i+=r[n++];n<r.length&&T(r[n]);)i+=r[n++];if(i.length<=1)return null;if(n<r.length&&r[n]==="."&&t==="#"){let o=n+1;for(;o<r.length&&T(r[o]);)o++;if(o<r.length&&r[o]==="(")return i}}else if(t==="["){let a=1,o=false,s=null,l=false;for(i+=r[n++];n<r.length&&a>0;){let u=r[n];i+=u,l?l=false:u==="\\"?l=true:o?u===s&&(o=false,s=null):u==='"'||u==="'"||u==="`"?(o=true,s=u):u==="["?a++:u==="]"&&a--,n++;}if(a!==0)return null}else if(t==="@"){for(i+=r[n++];n<r.length&&T(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(t==="*"){for(i+=r[n++];n<r.length&&T(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(t==="<"){if(i+=r[n++],n>=r.length||!Vt(r[n]))return null;for(;n<r.length&&T(r[n]);)i+=r[n++];for(;n<r.length;){let a=r[n];if(a==="."){if(i+=r[n++],n>=r.length||!T(r[n]))return null;for(;n<r.length&&T(r[n]);)i+=r[n++];}else if(a==="#"){if(i+=r[n++],n>=r.length||!T(r[n]))return null;for(;n<r.length&&T(r[n]);)i+=r[n++];}else if(a==="["){let o=1,s=false,l=null,u=false;for(i+=r[n++];n<r.length&&o>0;){let c=r[n];i+=c,u?u=false:c==="\\"?u=true:s?c===l&&(s=false,l=null):c==='"'||c==="'"||c==="`"?(s=true,l=c):c==="["?o++:c==="]"&&o--,n++;}if(o!==0)return null}else break}for(;n<r.length&&Z(r[n]);)i+=r[n++];if(n<r.length&&r[n]==="/")for(i+=r[n++];n<r.length&&Z(r[n]);)i+=r[n++];if(n>=r.length||r[n]!==">")return null;i+=r[n++];}return i||null}function Ft(r,e){if(e>=r.length||r[e]!=="'"||e+1>=r.length||r[e+1].toLowerCase()!=="s")return false;if(e+2>=r.length)return true;let n=r[e+2];return Z(n)||n==="*"||!T(n)}function qt(r,e){if(e>=r.length)return null;let t=r[e];if(!$t(t)||t==="'"&&Ft(r,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!i)return null;let a=e+1,o=t,s=false;for(;a<r.length;){let l=r[a];if(o+=l,s)s=false;else if(l==="\\")s=true;else if(l===i)return o;a++;}return o}function jt(r,e){if(e>=r.length)return false;let t=r[e],n=r[e+1]||"",i=r[e+2]||"";if(t==="/"&&n!=="/"&&/[a-zA-Z0-9._-]/.test(n)||t==="/"&&n==="/"&&/[a-zA-Z]/.test(i)||t==="."&&(n==="/"||n==="."&&i==="/"))return true;let a=r.slice(e,e+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function Ut(r,e){if(!jt(r,e))return null;let t=e,n="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<r.length;){let a=r[t];if(a==="#"){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=a,t++;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)n+=r[t++];break}if(i.test(a))n+=a,t++;else break}return n.length<2?null:n}function Kt(r,e){if(e>=r.length)return null;let t=r[e];if(!L(t)&&t!=="-"&&t!=="+")return null;let n=e,i="";if((r[n]==="-"||r[n]==="+")&&(i+=r[n++]),n>=r.length||!L(r[n]))return null;for(;n<r.length&&L(r[n]);)i+=r[n++];if(n<r.length&&r[n]===".")for(i+=r[n++];n<r.length&&L(r[n]);)i+=r[n++];return n<r.length&&(r.slice(n,n+2)==="ms"?i+="ms":(r[n]==="s"||r[n]==="m"||r[n]==="h")&&(i+=r[n])),i}var Gt=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Gt);var De=class Be{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){It(e)&&e.setContext(Mt(this)),this.extractors.push(e);}registerExtractors(e){for(let t of e)this.registerExtractor(t);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&Z(e[n]);)n++;if(n>=e.length)break;let i=false;for(let a of this.extractors)if(a.canExtract(e,n)){let o=a.extract(e,n);if(o){let s=o.metadata?.normalized,l=o.metadata?.stem,u=o.metadata?.stemConfidence,c={};if(o.metadata)for(let[p,m]of Object.entries(o.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(c[p]=m);let d={};s&&(d.normalized=s),l&&(d.stem=l),u!==void 0&&(d.stemConfidence=u),Object.keys(c).length>0&&(d.metadata=c),t.push(w(o.value,this.classifyToken(o.value),k(n,n+o.length),Object.keys(d).length>0?d:void 0)),n+=o.length,i=true;break}}if(!i){let a=e[n],o=this.classifyUnknownChar(a);t.push(w(a,o,k(n,n+1))),n++;}}return new J(t,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,n){if(e[t]!==".")return false;let i=n[n.length-1],a=i&&i.position.end<t;if(i&&!a&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return n.push(w(".","operator",k(t,t+1))),true;let l=t+1;for(;l<e.length&&T(e[l]);)l++;return l<e.length&&e[l]==="("?(n.push(w(".","operator",k(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let n=new Map;if(e.keywords){for(let[i,a]of Object.entries(e.keywords))if(n.set(a.primary,{native:a.primary,normalized:a.normalized||i}),a.alternatives)for(let o of a.alternatives)n.set(o,{native:o,normalized:a.normalized||i});}if(e.references){for(let[i,a]of Object.entries(e.references))n.set(a,{native:a,normalized:i});for(let i of Object.keys(e.references))n.has(i)||n.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,a]of Object.entries(e.roleMarkers))if(a.primary&&n.set(a.primary,{native:a.primary,normalized:i}),a.alternatives)for(let o of a.alternatives)n.set(o,{native:o,normalized:i});}if(e.possessive?.keywords)for(let[i,a]of Object.entries(e.possessive.keywords))n.set(i,{native:i,normalized:a});for(let i of t)n.set(i.native,i);this.profileKeywords=Array.from(n.values()).sort((i,a)=>a.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let a=this.removeDiacritics(i.native);a!==i.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(let n of this.profileKeywords)if(e.slice(t).startsWith(n.native))return w(n.native,"keyword",k(t,t+n.native.length),n.normalized);return null}isKeywordStart(e,t){let n=e.slice(t);return this.profileKeywords.some(i=>n.startsWith(i.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,n){let i=this.tryNormalize(e);if(!i)return null;let a=this.lookupKeyword(i.stem);if(!a)return null;let o={normalized:a.normalized,stem:i.stem,stemConfidence:i.confidence};return w(e,"keyword",k(t,n),o)}trySelector(e,t){let n=Wt(e,t);return n?w(n,"selector",k(t,t+n.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let n=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!n)return null;let i=n[0].replace(/(\s|\.)$/,""),a=i.slice(1).split("(")[0],o=n[1];return {...w(i,"event-modifier",k(t,t+i.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(e,t){let n=qt(e,t);return n?w(n,"literal",k(t,t+n.length)):null}tryNumber(e,t){let n=Kt(e,t);return n?w(n,"literal",k(t,t+n.length)):null}tryMatchTimeUnit(e,t,n,i=false){let a=t;if(i)for(;a<e.length&&Z(e[a]);)a++;let o=e.slice(a);for(let s of n){let l=o.slice(0,s.length);if(s.caseInsensitive?l.toLowerCase()===s.pattern.toLowerCase():l===s.pattern){if(s.notFollowedBy&&(o[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let c=o[s.length]||"";if(T(c))continue}return {suffix:s.suffix,endPos:a+s.length}}}return null}parseBaseNumber(e,t,n=true){let i=t,a="";if(n&&(e[i]==="-"||e[i]==="+")&&(a+=e[i++]),i>=e.length||!L(e[i]))return null;for(;i<e.length&&L(e[i]);)a+=e[i++];if(i<e.length&&e[i]===".")for(a+=e[i++];i<e.length&&L(e[i]);)a+=e[i++];return !a||a==="-"||a==="+"?null:{number:a,endPos:i}}tryNumberWithTimeUnits(e,t,n,i={}){let{allowSign:a=true,skipWhitespace:o=false}=i,s=this.parseBaseNumber(e,t,a);if(!s)return null;let{number:l,endPos:u}=s,c=[...n,...Be.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,u,c,o);return d&&(l+=d.suffix,u=d.endPos),w(l,"literal",k(t,u))}tryUrl(e,t){let n=Ut(e,t);return n?w(n,"url",k(t,t+n.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!T(e[t+1]))return null;let n=t+1;for(;n<e.length&&T(e[n]);)n++;let i=e.slice(t,n);return w(i,"identifier",k(t,n))}tryOperator(e,t){let n=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(n))return w(n,"operator",k(t,t+2));let i=e[t];return ["<",">","!","+","-","*","/","="].includes(i)?w(i,"operator",k(t,t+1)):["(",")","{","}",",",";",":"].includes(i)?w(i,"punctuation",k(t,t+1)):null}tryMultiCharParticle(e,t,n){for(let i of n)if(e.slice(t,t+i.length)===i)return w(i,"particle",k(t,t+i.length));return null}};De.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 P=De;function $e(r){return {stem:r,confidence:1}}function Ve(r,e,t){return t?{stem:r,confidence:e,metadata:t}:{stem:r,confidence:e}}var Ht=new Map,Yt=new Map,Zt=new Map;function Xt(r,e,t){Ht.set(r,e),Yt.set(r,t),Zt.delete(r);}var We={code:"id",name:"Indonesian",nativeName:"Bahasa Indonesia",regions:["priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,verb:{position:"start",subjectDrop:true},references:{me:"saya",it:"itu",you:"anda",result:"hasil",event:"peristiwa",target:"target",body:"tubuh"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"saya",it:"nya",you:"anda"},keywords:{saya:"me",aku:"me",ku:"me",anda:"you",kamu:"you",mu:"you",nya:"it",dia:"it"}},roleMarkers:{destination:{primary:"pada",alternatives:["ke","di"],position:"before"},source:{primary:"dari",position:"before"},patient:{primary:"",position:"before"},style:{primary:"dengan",position:"before"}},keywords:{toggle:{primary:"alihkan",normalized:"toggle"},add:{primary:"tambah",alternatives:["tambahkan"],normalized:"add"},remove:{primary:"hapus",alternatives:["buang","hilangkan"],normalized:"remove"},put:{primary:"taruh",alternatives:["letakkan","masukkan"],normalized:"put"},append:{primary:"sisipkan",normalized:"append"},prepend:{primary:"awali",normalized:"prepend"},take:{primary:"ambil",normalized:"take"},make:{primary:"buat",alternatives:["bikin","ciptakan"],normalized:"make"},clone:{primary:"klon",alternatives:["tiru"],normalized:"clone"},swap:{primary:"tukar",alternatives:["ganti"],normalized:"swap"},morph:{primary:"ubah",alternatives:["transformasi"],normalized:"morph"},set:{primary:"atur",alternatives:["tetapkan"],normalized:"set"},get:{primary:"dapatkan",alternatives:["peroleh"],normalized:"get"},increment:{primary:"tingkatkan",alternatives:["naikkan"],normalized:"increment"},decrement:{primary:"turunkan",alternatives:["kurangi"],normalized:"decrement"},log:{primary:"catat",alternatives:["rekam","cetak"],normalized:"log"},show:{primary:"tampilkan",alternatives:["perlihatkan"],normalized:"show"},hide:{primary:"sembunyikan",alternatives:["tutup"],normalized:"hide"},transition:{primary:"transisi",alternatives:["animasikan"],normalized:"transition"},on:{primary:"pada",alternatives:["saat"],normalized:"on"},trigger:{primary:"picu",alternatives:["jalankan"],normalized:"trigger"},send:{primary:"kirim",alternatives:["kirimkan"],normalized:"send"},focus:{primary:"fokus",alternatives:["fokuskan"],normalized:"focus"},blur:{primary:"blur",normalized:"blur"},go:{primary:"pergi",alternatives:["pindah","navigasi"],normalized:"go"},wait:{primary:"tunggu",normalized:"wait"},fetch:{primary:"muat",normalized:"fetch"},settle:{primary:"stabilkan",normalized:"settle"},if:{primary:"jika",alternatives:["kalau","bila"],normalized:"if"},when:{primary:"ketika",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"selainnya",normalized:"else"},repeat:{primary:"ulangi",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selama",normalized:"while"},continue:{primary:"lanjutkan",alternatives:["terus"],normalized:"continue"},halt:{primary:"hentikan",alternatives:["berhenti"],normalized:"halt"},throw:{primary:"lempar",normalized:"throw"},call:{primary:"panggil",normalized:"call"},return:{primary:"kembalikan",alternatives:["kembali"],normalized:"return"},then:{primary:"lalu",alternatives:["kemudian","setelah itu"],normalized:"then"},and:{primary:"dan",alternatives:["juga","serta"],normalized:"and"},end:{primary:"selesai",alternatives:["akhir","tamat"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asinkron",normalized:"async"},tell:{primary:"katakan",alternatives:["beritahu"],normalized:"tell"},default:{primary:"bawaan",normalized:"default"},init:{primary:"inisialisasi",alternatives:["mulai"],normalized:"init"},behavior:{primary:"perilaku",normalized:"behavior"},install:{primary:"pasang",alternatives:["instal"],normalized:"install"},measure:{primary:"ukur",normalized:"measure"},beep:{primary:"bunyi",normalized:"beep"},break:{primary:"putuskan",normalized:"break"},copy:{primary:"salin",normalized:"copy"},exit:{primary:"keluar",normalized:"exit"},pick:{primary:"pilih",normalized:"pick"},render:{primary:"olah",normalized:"render"},into:{primary:"ke dalam",normalized:"into"},before:{primary:"sebelum",normalized:"before"},after:{primary:"sesudah",alternatives:["setelah"],normalized:"after"},click:{primary:"klik",alternatives:["tekan"],normalized:"click"},hover:{primary:"hover",alternatives:["arahkan"],normalized:"hover"},submit:{primary:"ajukan",normalized:"submit"},input:{primary:"masuk",alternatives:["input"],normalized:"input"},change:{primary:"berubah",normalized:"change"},until:{primary:"sampai",normalized:"until"},event:{primary:"peristiwa",alternatives:["event"],normalized:"event"},from:{primary:"dari",normalized:"from"}},eventHandler:{keyword:{primary:"pada",alternatives:["ketika","saat"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"},conditionalKeyword:{primary:"ketika",alternatives:["saat","waktu"]},eventMarker:{primary:"saat",alternatives:["ketika"],position:"before"},temporalMarkers:["ketika","saat"]}},Jt=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Qt=class{constructor(r=Jt){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},er="()[]{},:;",tr=class{constructor(r=er){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function rr(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var nr=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=rr(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},ir=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}};function ar(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var or=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=ar(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},sr=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}},lr=new Set(["di","ke","dari","pada","dengan","tanpa","untuk","oleh","antara","sebelum","sesudah","setelah","selama","sampai","hingga","sejak","menuju","tentang","terhadap","melalui","dalam","luar"]);function ur(){let r=/[a-zA-Z]/;return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:cr,isIdentifierChar:dr}=ur(),pr=class{constructor(){this.name="indonesian-keyword";}setContext(r){this.context=r;}canExtract(r,e){return cr(r[e])}extract(r,e){if(!this.context)throw new Error("IndonesianKeywordExtractor: context not set");let t=e,n="";for(;t<r.length&&dr(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),a=lr.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0,l;if(!o&&this.context.normalizer){let u=this.context.normalizer.normalize(n);if(u.stem!==n&&u.confidence>=.7){let c=this.context.lookupKeyword(u.stem);c&&(l=c.normalized);}}return {value:n,length:t-e,metadata:{normalized:s||l,isPreposition:a}}}};function mr(){return [new pr]}function fr(){return [new or,new ir,new sr,new nr]}var hr=new Set(["di","ke","dari","pada","dengan","tanpa","untuk","oleh","antara","sebelum","sesudah","setelah","selama","sampai","hingga","sejak","menuju","tentang","terhadap","melalui","dalam","luar"]),yr=[{native:"benar",normalized:"true"},{native:"salah",normalized:"false"},{native:"null",normalized:"null"},{native:"kosong",normalized:"null"},{native:"tidakdidefinisikan",normalized:"undefined"},{native:"pertama",normalized:"first"},{native:"terakhir",normalized:"last"},{native:"berikutnya",normalized:"next"},{native:"sebelumnya",normalized:"previous"},{native:"terdekat",normalized:"closest"},{native:"induk",normalized:"parent"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"ubah",normalized:"change"},{native:"kirim",normalized:"submit"},{native:"tekan",normalized:"keydown"},{native:"arahkan",normalized:"mouseover"},{native:"tinggalkan",normalized:"mouseout"},{native:"kabur",normalized:"blur"},{native:"muat",normalized:"load"},{native:"gulir",normalized:"scroll"},{native:"input",normalized:"input"},{native:"milik",normalized:"my"},{native:"detik",normalized:"s"},{native:"milidetik",normalized:"ms"},{native:"menit",normalized:"m"},{native:"jam",normalized:"h"},{native:"atau",normalized:"or"},{native:"tidak",normalized:"not"},{native:"adalah",normalized:"is"},{native:"ada",normalized:"exists"}],vr=class extends P{constructor(){super(),this.language="id",this.direction="ltr",this.initializeKeywordsFromProfile(We,yr),this.registerExtractors(fr()),this.registerExtractor(new z),this.registerExtractor(new R),this.registerExtractors(mr()),this.registerExtractor(new Qt),this.registerExtractor(new tr);}classifyToken(r){let e=r.toLowerCase();return hr.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":"identifier"}},gr=new vr;Xt("id",gr,We);var Er=new Map,br=new Map,kr=new Map;function wr(r,e,t){Er.set(r,e),br.set(r,t),kr.delete(r);}var Fe={code:"ms",name:"Malay",nativeName:"Melayu",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:true},references:{me:"saya",it:"ia",you:"kamu",result:"hasil",event:"peristiwa",target:"sasaran",body:"badan"},possessive:{marker:"",markerPosition:"after-object",keywords:{saya:"me",aku:"me",awak:"you",kamu:"you",anda:"you",dia:"it",ia:"it","-ku":"me","-mu":"you","-nya":"it"}},roleMarkers:{destination:{primary:"ke",alternatives:["pada"],position:"before"},source:{primary:"dari",position:"before"},patient:{primary:"",position:"before"},style:{primary:"dengan",position:"before"}},keywords:{toggle:{primary:"togol",alternatives:["tukar"],normalized:"toggle"},add:{primary:"tambah",normalized:"add"},remove:{primary:"buang",alternatives:["padam"],normalized:"remove"},put:{primary:"letak",alternatives:["letakkan"],normalized:"put"},append:{primary:"tambah_hujung",normalized:"append"},prepend:{primary:"tambah_mula",normalized:"prepend"},take:{primary:"ambil",normalized:"take"},make:{primary:"buat",alternatives:["cipta"],normalized:"make"},clone:{primary:"klon",alternatives:[],normalized:"clone"},swap:{primary:"tukar_tempat",normalized:"swap"},morph:{primary:"ubah_bentuk",normalized:"morph"},set:{primary:"tetapkan",alternatives:["setkan"],normalized:"set"},get:{primary:"dapatkan",alternatives:[],normalized:"get"},increment:{primary:"tambah_satu",normalized:"increment"},decrement:{primary:"kurang_satu",normalized:"decrement"},log:{primary:"catat",alternatives:["log"],normalized:"log"},show:{primary:"tunjuk",alternatives:[],normalized:"show"},hide:{primary:"sembunyi",alternatives:["sorok"],normalized:"hide"},transition:{primary:"peralihan",normalized:"transition"},on:{primary:"apabila",alternatives:["ketika"],normalized:"on"},trigger:{primary:"cetuskan",normalized:"trigger"},send:{primary:"hantar",normalized:"send"},focus:{primary:"fokus",normalized:"focus"},blur:{primary:"kabur",normalized:"blur"},go:{primary:"pergi",alternatives:["pindah"],normalized:"go"},wait:{primary:"tunggu",normalized:"wait"},fetch:{primary:"ambil_dari",alternatives:["muat"],normalized:"fetch"},settle:{primary:"selesai",normalized:"settle"},if:{primary:"jika",alternatives:["kalau"],normalized:"if"},when:{primary:"bila",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"kalau_tidak",alternatives:["jika_tidak"],normalized:"else"},repeat:{primary:"ulang",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selagi",alternatives:["semasa"],normalized:"while"},continue:{primary:"teruskan",normalized:"continue"},halt:{primary:"henti",alternatives:["berhenti"],normalized:"halt"},throw:{primary:"lempar",normalized:"throw"},call:{primary:"panggil",normalized:"call"},return:{primary:"pulang",alternatives:["kembali"],normalized:"return"},then:{primary:"kemudian",alternatives:["lepas_itu"],normalized:"then"},and:{primary:"dan",normalized:"and"},end:{primary:"tamat",alternatives:["habis"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"tak_segerak",normalized:"async"},tell:{primary:"beritahu",normalized:"tell"},default:{primary:"lalai",normalized:"default"},init:{primary:"mula",alternatives:["mulakan"],normalized:"init"},behavior:{primary:"kelakuan",normalized:"behavior"},install:{primary:"pasang",normalized:"install"},measure:{primary:"ukur",normalized:"measure"},beep:{primary:"bunyi",normalized:"beep"},break:{primary:"pecah",normalized:"break"},copy:{primary:"salin",normalized:"copy"},exit:{primary:"keluar",normalized:"exit"},pick:{primary:"pilih",normalized:"pick"},render:{primary:"papar",normalized:"render"},into:{primary:"ke_dalam",normalized:"into"},before:{primary:"sebelum",normalized:"before"},after:{primary:"selepas",alternatives:["lepas"],normalized:"after"},until:{primary:"sehingga",alternatives:["sampai"],normalized:"until"},event:{primary:"peristiwa",normalized:"event"},from:{primary:"dari",normalized:"from"}},eventHandler:{keyword:{primary:"apabila",alternatives:["ketika"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"}}},xr=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Sr=class{constructor(r=xr){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Tr="()[]{},:;",Ar=class{constructor(r=Tr){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Cr(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var zr=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=Cr(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Rr=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}};function Pr(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var _r=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=Pr(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Nr=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Or(r){return /[a-zA-Z_]/.test(r)}function Ir(r){return /[a-zA-Z0-9_]/.test(r)}var Mr=class{constructor(){this.name="malay-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Or(r[e])}extract(r,e){if(!this.context)throw new Error("MalayKeywordExtractor: context not set");let t=e,n="";for(;t<r.length&&Ir(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),a=this.context.lookupKeyword(i),o=a&&a.normalized!==a.native?a.normalized:void 0;return {value:n,length:n.length,metadata:{normalized:o}}}};function Lr(){return [new Mr]}function Dr(){return [new _r,new Rr,new Nr,new zr]}var Br=[{native:"benar",normalized:"true"},{native:"salah",normalized:"false"},{native:"kosong",normalized:"null"},{native:"tak_tentu",normalized:"undefined"},{native:"pertama",normalized:"first"},{native:"terakhir",normalized:"last"},{native:"seterusnya",normalized:"next"},{native:"sebelumnya",normalized:"previous"},{native:"terdekat",normalized:"closest"},{native:"induk",normalized:"parent"},{native:"klik",normalized:"click"},{native:"berubah",normalized:"change"},{native:"ubah",normalized:"change"},{native:"hantar",normalized:"submit"},{native:"input",normalized:"input"},{native:"masuk",normalized:"input"},{native:"muat",normalized:"load"},{native:"tatal",normalized:"scroll"},{native:"hover",normalized:"hover"}],$r=class extends P{constructor(){super(),this.language="ms",this.direction="ltr",this.initializeKeywordsFromProfile(Fe,Br),this.registerExtractors(Dr()),this.registerExtractor(new z),this.registerExtractor(new R),this.registerExtractors(Lr()),this.registerExtractor(new Sr),this.registerExtractor(new Ar);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith(".")||r.startsWith("#")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith(":")?"identifier":r.startsWith('"')||r.startsWith("'")||/^-?\d/.test(r)?"literal":"identifier"}},Vr=new $r;wr("ms",Vr,Fe);var Wr=new Map,Fr=new Map,qr=new Map;function jr(r,e,t){Wr.set(r,e),Fr.set(r,t),qr.delete(r);}var qe={code:"tl",name:"Tagalog",nativeName:"Tagalog",direction:"ltr",script:"latin",wordOrder:"VSO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:true},references:{me:"ako",it:"ito",you:"ikaw",result:"resulta",event:"pangyayari",target:"target",body:"body"},possessive:{marker:"ng",markerPosition:"between",keywords:{ko:"me",akin:"me",aking:"me",mo:"you",iyo:"you",niya:"it",nito:"it",kaniya:"it"}},roleMarkers:{destination:{primary:"sa",position:"before"},source:{primary:"mula_sa",position:"before"},patient:{primary:"",position:"before"},style:{primary:"nang",position:"before"}},keywords:{toggle:{primary:"palitan",alternatives:["itoggle"],normalized:"toggle"},add:{primary:"idagdag",alternatives:["magdagdag"],normalized:"add"},remove:{primary:"alisin",alternatives:["tanggalin"],normalized:"remove"},put:{primary:"ilagay",alternatives:["maglagay"],normalized:"put"},append:{primary:"idagdag_sa_dulo",normalized:"append"},prepend:{primary:"idagdag_sa_simula",normalized:"prepend"},take:{primary:"kumuha",normalized:"take"},make:{primary:"gumawa",alternatives:["lumikha"],normalized:"make"},clone:{primary:"i-clone",normalized:"clone"},swap:{primary:"palitan_pwesto",alternatives:["magpalit"],normalized:"swap"},morph:{primary:"baguhin",normalized:"morph"},set:{primary:"itakda",alternatives:["magtakda"],normalized:"set"},get:{primary:"kunin",normalized:"get"},increment:{primary:"dagdagan",alternatives:["taasan"],normalized:"increment"},decrement:{primary:"bawasan",alternatives:["ibaba"],normalized:"decrement"},log:{primary:"itala",normalized:"log"},show:{primary:"ipakita",alternatives:["magpakita"],normalized:"show"},hide:{primary:"itago",alternatives:["magtago"],normalized:"hide"},transition:{primary:"lumipat",normalized:"transition"},on:{primary:"kapag",normalized:"on"},trigger:{primary:"palitawin",alternatives:["magpatugtog"],normalized:"trigger"},send:{primary:"ipadala",alternatives:["magpadala"],normalized:"send"},focus:{primary:"ituon",normalized:"focus"},blur:{primary:"alisin_tuon",normalized:"blur"},go:{primary:"pumunta",alternatives:["punta"],normalized:"go"},wait:{primary:"maghintay",alternatives:["hintay"],normalized:"wait"},fetch:{primary:"kuhanin_mula",alternatives:["kunin_mula"],normalized:"fetch"},settle:{primary:"magpatahimik",normalized:"settle"},if:{primary:"kung",normalized:"if"},when:{primary:"tuwing",normalized:"when"},where:{primary:"kung_saan",normalized:"where"},else:{primary:"kung_hindi",alternatives:["kundi"],normalized:"else"},repeat:{primary:"ulitin",alternatives:["paulit-ulit"],normalized:"repeat"},for:{primary:"para_sa",normalized:"for"},while:{primary:"habang",normalized:"while"},continue:{primary:"magpatuloy",normalized:"continue"},halt:{primary:"itigil",alternatives:["huminto"],normalized:"halt"},throw:{primary:"ihagis",alternatives:["itapon"],normalized:"throw"},call:{primary:"tawagin",alternatives:["tawagan","tumawag"],normalized:"call"},return:{primary:"ibalik",alternatives:["bumalik"],normalized:"return"},then:{primary:"pagkatapos",alternatives:["saka"],normalized:"then"},and:{primary:"at",normalized:"and"},end:{primary:"wakas",alternatives:["tapos"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",normalized:"async"},tell:{primary:"sabihin",alternatives:["magsabi"],normalized:"tell"},default:{primary:"pamantayan",alternatives:["default","unang_halaga"],normalized:"default"},init:{primary:"simulan",alternatives:["magsimula"],normalized:"init"},behavior:{primary:"ugali",alternatives:["kilos"],normalized:"behavior"},install:{primary:"ikabit",alternatives:["mag-install"],normalized:"install"},measure:{primary:"sukatin",normalized:"measure"},beep:{primary:"tunog",normalized:"beep"},break:{primary:"putulin",normalized:"break"},copy:{primary:"kopyahin",normalized:"copy"},exit:{primary:"lumabas",normalized:"exit"},pick:{primary:"pumili",normalized:"pick"},render:{primary:"irender",normalized:"render"},into:{primary:"sa",normalized:"into"},before:{primary:"bago",normalized:"before"},after:{primary:"matapos",normalized:"after"},until:{primary:"hanggang",normalized:"until"},event:{primary:"pangyayari",normalized:"event"},from:{primary:"mula",alternatives:["galing"],normalized:"from"}},eventHandler:{keyword:{primary:"kapag",normalized:"on"},sourceMarker:{primary:"mula_sa",alternatives:["galing_sa"],position:"before"},eventMarker:{primary:"kapag",position:"before"}}};function Ur(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122?true:r==="\xF1"||r==="\xD1"}function Kr(r){for(let e of r)if(Ur(e))return true;return false}var Gr=[{pattern:"magpapa",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"magpa",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"ipang",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"ipag",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"nagpa",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3}],Hr=[{pattern:"mag",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"nag",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"mang",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"nang",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"ma",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"na",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"i",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"pa",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3}],Yr=["um","in"],Zr=[{pattern:"hin",confidencePenalty:.18,type:"patient-focus"},{pattern:"in",confidencePenalty:.18,type:"patient-focus"},{pattern:"han",confidencePenalty:.18,type:"locative-focus"},{pattern:"an",confidencePenalty:.18,type:"locative-focus"}];function Xr(r){let e=r.toLowerCase();if(e.length<5)return null;let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(!"aeiou".includes(i))t=n+1;else break}if(t===0)return null;for(let n of Yr){let i=t;if(e.slice(i,i+n.length)===n){let a=e.slice(0,t)+e.slice(i+n.length);if(a.length>=3)return {stem:a,infix:n}}}return null}function Jr(r){let e=r.toLowerCase();if(e.length<4)return {stem:e,reduplicated:false};let t=e[0],n=e[1];if(!"aeiou".includes(t)&&"aeiou".includes(n)){let i=e.slice(2);if(i.length>=2&&i[0]===t)return {stem:i,reduplicated:true}}return {stem:e,reduplicated:false}}var Qr=class{constructor(){this.language="tl";}isNormalizable(r){return !(!Kr(r)||r.length<2)}normalize(r){let e=r.toLowerCase(),t=1,n=[],i=[],a=[];for(let u of Gr)if(e.startsWith(u.pattern)){let c=e.slice(u.pattern.length),d=u.minRemaining??2;if(c.length>=d){e=c,t-=u.confidencePenalty,n.push(u.pattern),a.push(`prefix:${u.pattern}`);break}}if(n.length===0){for(let u of Hr)if(e.startsWith(u.pattern)){let c=e.slice(u.pattern.length),d=u.minRemaining??2;if(c.length>=d){e=c,t-=u.confidencePenalty,n.push(u.pattern),a.push(`prefix:${u.pattern}`);break}}}let o=Jr(e);o.reduplicated&&o.stem.length>=2&&(e=o.stem,t-=.1,a.push("reduplication:CV"));let s=Xr(e),l=false;if(s&&s.stem.length>=2&&(e=s.stem,t-=.18,a.push(`infix:${s.infix}`),l=true),!l){for(let u of Zr)if(e.endsWith(u.pattern)){let c=e.slice(0,-u.pattern.length);if(c.length>=2){e=c,t-=u.confidencePenalty,i.push(u.pattern),a.push(`suffix:${u.pattern}`);break}}}return t=Math.max(.5,t),n.length===0&&i.length===0&&a.length===0?$e(r):Ve(e,t,{removedPrefixes:n,removedSuffixes:i,appliedRules:a})}},en=new Qr,tn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],rn=class{constructor(r=tn){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},nn="()[]{},:;",an=class{constructor(r=nn){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function on(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var sn=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=on(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},ln=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}};function un(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var cn=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=un(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},dn=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function pn(r){return /[a-zA-Z_]/.test(r)}function mn(r){return /[a-zA-Z0-9_]/.test(r)}var fn=new Set(["sa","ng","para","mula","hanggang","gaya","tulad","kasama","para sa"]),hn=class{constructor(){this.name="tagalog-keyword";}setContext(r){this.context=r;}canExtract(r,e){return pn(r[e])}extract(r,e){if(!this.context)throw new Error("TagalogKeywordExtractor: context not set");let t=e,n="";for(;t<r.length&&mn(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),a=fn.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0,l;if(!o&&this.context.normalizer){let u=this.context.normalizer.normalize(n);if(u.stem!==n&&u.confidence>=.7){let c=this.context.lookupKeyword(u.stem);c&&(l=c.normalized);}}return {value:n,length:n.length,metadata:{normalized:s||l,isPreposition:a}}}};function yn(){return [new hn]}function vn(){return [new cn,new ln,new dn,new sn]}var gn=[{native:"totoo",normalized:"true"},{native:"mali",normalized:"false"},{native:"wala",normalized:"null"},{native:"hindi_tinukoy",normalized:"undefined"},{native:"una",normalized:"first"},{native:"huli",normalized:"last"},{native:"susunod",normalized:"next"},{native:"nakaraan",normalized:"previous"},{native:"pinakamalapit",normalized:"closest"},{native:"magulang",normalized:"parent"},{native:"pindot",normalized:"click"},{native:"pagbabago",normalized:"change"},{native:"isumite",normalized:"submit"},{native:"input",normalized:"input"},{native:"karga",normalized:"load"},{native:"mag_scroll",normalized:"scroll"}],En=class extends P{constructor(){super(),this.language="tl",this.direction="ltr",this.initializeKeywordsFromProfile(qe,gn),this.setNormalizer(en),this.registerExtractors(vn()),this.registerExtractor(new z),this.registerExtractor(new R),this.registerExtractors(yn()),this.registerExtractor(new rn),this.registerExtractor(new an);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith(".")||r.startsWith("#")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith(":")?"identifier":r.startsWith('"')||r.startsWith("'")||/^-?\d/.test(r)?"literal":"identifier"}},bn=new En;jr("tl",bn,qe);var kn=new Map,wn=new Map,xn=new Map;function Sn(r,e,t){kn.set(r,e),wn.set(r,t),xn.delete(r);}var je={code:"th",name:"Thai",nativeName:"\u0E44\u0E17\u0E22",direction:"ltr",script:"thai",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:false,defaultVerbForm:"base",verb:{position:"second",subjectDrop:true},references:{me:"\u0E09\u0E31\u0E19",it:"\u0E21\u0E31\u0E19",you:"\u0E04\u0E38\u0E13",result:"\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C",event:"\u0E40\u0E2B\u0E15\u0E38\u0E01\u0E32\u0E23\u0E13\u0E4C",target:"\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22",body:"\u0E1A\u0E2D\u0E14\u0E35\u0E49"},possessive:{marker:"\u0E02\u0E2D\u0E07",markerPosition:"between",keywords:{\u0E02\u0E2D\u0E07\u0E09\u0E31\u0E19:"me",\u0E02\u0E2D\u0E07\u0E1C\u0E21:"me",\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13:"you",\u0E02\u0E2D\u0E07\u0E21\u0E31\u0E19:"it",\u0E02\u0E2D\u0E07\u0E40\u0E02\u0E32:"it",\u0E02\u0E2D\u0E07\u0E40\u0E18\u0E2D:"it"}},roleMarkers:{patient:{primary:"",position:"before"},destination:{primary:"\u0E43\u0E19",alternatives:["\u0E44\u0E1B\u0E22\u0E31\u0E07"],position:"before"},source:{primary:"\u0E08\u0E32\u0E01",position:"before"},style:{primary:"\u0E14\u0E49\u0E27\u0E22",position:"before"},event:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",position:"before"}},keywords:{toggle:{primary:"\u0E2A\u0E25\u0E31\u0E1A",alternatives:[],normalized:"toggle"},add:{primary:"\u0E40\u0E1E\u0E34\u0E48\u0E21",alternatives:[],normalized:"add"},remove:{primary:"\u0E25\u0E1A",alternatives:["\u0E25\u0E1A\u0E2D\u0E2D\u0E01"],normalized:"remove"},put:{primary:"\u0E43\u0E2A\u0E48",alternatives:["\u0E27\u0E32\u0E07"],normalized:"put"},append:{primary:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E17\u0E49\u0E32\u0E22",alternatives:[],normalized:"append"},prepend:{primary:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E2B\u0E19\u0E49\u0E32",alternatives:[],normalized:"prepend"},take:{primary:"\u0E23\u0E31\u0E1A",alternatives:[],normalized:"take"},make:{primary:"\u0E2A\u0E23\u0E49\u0E32\u0E07",alternatives:[],normalized:"make"},clone:{primary:"\u0E42\u0E04\u0E25\u0E19",alternatives:["\u0E2A\u0E33\u0E40\u0E19\u0E32"],normalized:"clone"},swap:{primary:"\u0E2A\u0E25\u0E31\u0E1A\u0E17\u0E35\u0E48",alternatives:[],normalized:"swap"},morph:{primary:"\u0E41\u0E1B\u0E25\u0E07\u0E23\u0E48\u0E32\u0E07",alternatives:[],normalized:"morph"},set:{primary:"\u0E15\u0E31\u0E49\u0E07",alternatives:["\u0E01\u0E33\u0E2B\u0E19\u0E14"],normalized:"set"},get:{primary:"\u0E23\u0E31\u0E1A\u0E04\u0E48\u0E32",alternatives:[],normalized:"get"},increment:{primary:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E48\u0E32",alternatives:[],normalized:"increment"},decrement:{primary:"\u0E25\u0E14\u0E04\u0E48\u0E32",alternatives:[],normalized:"decrement"},log:{primary:"\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01",alternatives:[],normalized:"log"},show:{primary:"\u0E41\u0E2A\u0E14\u0E07",alternatives:[],normalized:"show"},hide:{primary:"\u0E0B\u0E48\u0E2D\u0E19",alternatives:[],normalized:"hide"},transition:{primary:"\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E1C\u0E48\u0E32\u0E19",alternatives:[],normalized:"transition"},on:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"],normalized:"on"},trigger:{primary:"\u0E17\u0E23\u0E34\u0E01\u0E40\u0E01\u0E2D\u0E23\u0E4C",alternatives:[],normalized:"trigger"},send:{primary:"\u0E2A\u0E48\u0E07",alternatives:[],normalized:"send"},focus:{primary:"\u0E42\u0E1F\u0E01\u0E31\u0E2A",alternatives:[],normalized:"focus"},blur:{primary:"\u0E40\u0E1A\u0E25\u0E2D",alternatives:[],normalized:"blur"},click:{primary:"\u0E04\u0E25\u0E34\u0E01",normalized:"click"},hover:{primary:"\u0E42\u0E2E\u0E40\u0E27\u0E2D\u0E23\u0E4C",alternatives:["\u0E27\u0E32\u0E07\u0E40\u0E21\u0E32\u0E2A\u0E4C"],normalized:"hover"},submit:{primary:"\u0E22\u0E37\u0E48\u0E19",alternatives:["\u0E2A\u0E48\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25"],normalized:"submit"},input:{primary:"\u0E1B\u0E49\u0E2D\u0E19",alternatives:["\u0E01\u0E23\u0E2D\u0E01"],normalized:"input"},change:{primary:"\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19",alternatives:["\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07"],normalized:"change"},go:{primary:"\u0E44\u0E1B",alternatives:["\u0E44\u0E1B\u0E17\u0E35\u0E48"],normalized:"go"},wait:{primary:"\u0E23\u0E2D",alternatives:[],normalized:"wait"},fetch:{primary:"\u0E14\u0E36\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",alternatives:[],normalized:"fetch"},settle:{primary:"\u0E04\u0E07\u0E17\u0E35\u0E48",alternatives:[],normalized:"settle"},if:{primary:"\u0E16\u0E49\u0E32",alternatives:["\u0E2B\u0E32\u0E01"],normalized:"if"},when:{primary:"\u0E02\u0E13\u0E30\u0E17\u0E35\u0E48",normalized:"when"},where:{primary:"\u0E17\u0E35\u0E48\u0E44\u0E2B\u0E19",normalized:"where"},else:{primary:"\u0E44\u0E21\u0E48\u0E07\u0E31\u0E49\u0E19",alternatives:["\u0E44\u0E21\u0E48\u0E40\u0E0A\u0E48\u0E19\u0E19\u0E31\u0E49\u0E19"],normalized:"else"},repeat:{primary:"\u0E17\u0E33\u0E0B\u0E49\u0E33",alternatives:[],normalized:"repeat"},for:{primary:"\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A",alternatives:[],normalized:"for"},while:{primary:"\u0E43\u0E19\u0E02\u0E13\u0E30\u0E17\u0E35\u0E48",alternatives:[],normalized:"while"},continue:{primary:"\u0E15\u0E48\u0E2D\u0E44\u0E1B",alternatives:[],normalized:"continue"},halt:{primary:"\u0E2B\u0E22\u0E38\u0E14",alternatives:[],normalized:"halt"},throw:{primary:"\u0E42\u0E22\u0E19",alternatives:[],normalized:"throw"},call:{primary:"\u0E40\u0E23\u0E35\u0E22\u0E01",alternatives:[],normalized:"call"},return:{primary:"\u0E04\u0E37\u0E19\u0E04\u0E48\u0E32",alternatives:["\u0E01\u0E25\u0E31\u0E1A"],normalized:"return"},then:{primary:"\u0E41\u0E25\u0E49\u0E27",alternatives:[],normalized:"then"},and:{primary:"\u0E41\u0E25\u0E30",alternatives:[],normalized:"and"},end:{primary:"\u0E08\u0E1A",alternatives:[],normalized:"end"},js:{primary:"\u0E40\u0E08\u0E40\u0E2D\u0E2A",alternatives:["js"],normalized:"js"},async:{primary:"\u0E2D\u0E30\u0E0B\u0E34\u0E07\u0E04\u0E4C",alternatives:[],normalized:"async"},tell:{primary:"\u0E1A\u0E2D\u0E01",alternatives:[],normalized:"tell"},default:{primary:"\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",alternatives:[],normalized:"default"},init:{primary:"\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",alternatives:[],normalized:"init"},behavior:{primary:"\u0E1E\u0E24\u0E15\u0E34\u0E01\u0E23\u0E23\u0E21",alternatives:[],normalized:"behavior"},install:{primary:"\u0E15\u0E34\u0E14\u0E15\u0E31\u0E49\u0E07",alternatives:[],normalized:"install"},measure:{primary:"\u0E27\u0E31\u0E14",alternatives:[],normalized:"measure"},beep:{primary:"\u0E1A\u0E35\u0E4A\u0E1A",alternatives:[],normalized:"beep"},break:{primary:"\u0E02\u0E31\u0E14\u0E08\u0E31\u0E07\u0E2B\u0E27\u0E30",alternatives:[],normalized:"break"},copy:{primary:"\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01",alternatives:[],normalized:"copy"},exit:{primary:"\u0E2D\u0E2D\u0E01",alternatives:[],normalized:"exit"},pick:{primary:"\u0E40\u0E25\u0E37\u0E2D\u0E01",alternatives:[],normalized:"pick"},render:{primary:"\u0E41\u0E2A\u0E14\u0E07\u0E1C\u0E25",alternatives:[],normalized:"render"},into:{primary:"\u0E43\u0E19",alternatives:[],normalized:"into"},before:{primary:"\u0E01\u0E48\u0E2D\u0E19",alternatives:[],normalized:"before"},after:{primary:"\u0E2B\u0E25\u0E31\u0E07",alternatives:[],normalized:"after"},until:{primary:"\u0E08\u0E19\u0E16\u0E36\u0E07",alternatives:[],normalized:"until"},event:{primary:"\u0E40\u0E2B\u0E15\u0E38\u0E01\u0E32\u0E23\u0E13\u0E4C",alternatives:[],normalized:"event"},from:{primary:"\u0E08\u0E32\u0E01",normalized:"from"}},tokenization:{boundaryStrategy:"character"},eventHandler:{keyword:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"],normalized:"on"},sourceMarker:{primary:"\u0E08\u0E32\u0E01",position:"before"},eventMarker:{primary:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"],position:"before"},temporalMarkers:["\u0E40\u0E21\u0E37\u0E48\u0E2D","\u0E15\u0E2D\u0E19"]}},Tn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],An=class{constructor(r=Tn){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Cn="()[]{},:;",zn=class{constructor(r=Cn){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Rn(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var Pn=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=Rn(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},_n=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}};function Nn(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var On=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=Nn(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},In=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Q(r){let e=r.charCodeAt(0);return e>=3584&&e<=3711}function ge(r){return /[a-zA-Z0-9_]/.test(r)}var Mn=class{constructor(){this.name="thai-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Q(r[e])||ge(r[e])}extract(r,e){if(!this.context)throw new Error("ThaiKeywordExtractor: context not set");let t=r[e];return Q(t)?this.extractThaiWord(r,e):ge(t)?this.extractAsciiWord(r,e):null}extractThaiWord(r,e){if(!this.context)return null;let t=null,n=e,i="";for(;n<r.length&&Q(r[n]);){i+=r[n],n++;let s=this.context.lookupKeyword(i);s&&(t={word:i,entry:s});}if(t){let s=t.entry.normalized!==t.entry.native?t.entry.normalized:void 0;return {value:t.word,length:t.word.length,metadata:{normalized:s}}}let a=e,o="";for(;a<r.length&&Q(r[a])&&!(o.length>0&&this.isKeywordStart(r,a));)o+=r[a],a++;return o?{value:o,length:o.length,metadata:{}}:null}extractAsciiWord(r,e){if(!this.context)return null;let t=e,n="";for(;t<r.length&&ge(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),a=this.context.lookupKeyword(i),o=a&&a.normalized!==a.native?a.normalized:void 0;return {value:n,length:n.length,metadata:{normalized:o}}}isKeywordStart(r,e){if(!this.context)return false;let t=e,n="";for(;t<r.length&&Q(r[t]);){if(n+=r[t],t++,this.context.lookupKeyword(n))return true;if(n.length>10)break}return false}};function Ln(){return [new Mn]}function Dn(){return [new On,new _n,new In,new Pn]}var Bn=[{native:"\u0E08\u0E23\u0E34\u0E07",normalized:"true"},{native:"\u0E40\u0E17\u0E47\u0E08",normalized:"false"},{native:"\u0E27\u0E48\u0E32\u0E07",normalized:"null"},{native:"\u0E44\u0E21\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14",normalized:"undefined"},{native:"\u0E41\u0E23\u0E01",normalized:"first"},{native:"\u0E2A\u0E38\u0E14\u0E17\u0E49\u0E32\u0E22",normalized:"last"},{native:"\u0E16\u0E31\u0E14\u0E44\u0E1B",normalized:"next"},{native:"\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",normalized:"previous"},{native:"\u0E43\u0E01\u0E25\u0E49\u0E2A\u0E38\u0E14",normalized:"closest"},{native:"\u0E15\u0E49\u0E19\u0E17\u0E32\u0E07",normalized:"parent"},{native:"\u0E04\u0E25\u0E34\u0E01",normalized:"click"},{native:"\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E41\u0E1B\u0E25\u0E07",normalized:"change"},{native:"\u0E2A\u0E48\u0E07",normalized:"submit"},{native:"\u0E2D\u0E34\u0E19\u0E1E\u0E38\u0E15",normalized:"input"},{native:"\u0E42\u0E2B\u0E25\u0E14",normalized:"load"},{native:"\u0E40\u0E25\u0E37\u0E48\u0E2D\u0E19",normalized:"scroll"},{native:"\u0E40\u0E27\u0E25\u0E32",normalized:"when"},{native:"\u0E44\u0E1B\u0E22\u0E31\u0E07",normalized:"to"},{native:"\u0E14\u0E49\u0E27\u0E22",normalized:"with"},{native:"\u0E41\u0E25\u0E30",normalized:"and"}],$n=class extends P{constructor(){super(),this.language="th",this.direction="ltr",this.initializeKeywordsFromProfile(je,Bn),this.registerExtractors(Dn()),this.registerExtractor(new z),this.registerExtractor(new R),this.registerExtractors(Ln()),this.registerExtractor(new An),this.registerExtractor(new zn);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith(".")||r.startsWith("#")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith(":")?"identifier":r.startsWith('"')||r.startsWith("'")||/^-?\d/.test(r)?"literal":"identifier"}},Vn=new $n;Sn("th",Vn,je);var Wn=new Map,Fn=new Map,qn=new Map;function jn(r,e,t){Wn.set(r,e),Fn.set(r,t),qn.delete(r);}var Ue={code:"vi",name:"Vietnamese",nativeName:"Ti\u1EBFng Vi\u1EC7t",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:true},references:{me:"t\xF4i",it:"n\xF3",you:"b\u1EA1n",result:"k\u1EBFt qu\u1EA3",event:"s\u1EF1 ki\u1EC7n",target:"m\u1EE5c ti\xEAu",body:"body"},possessive:{marker:"c\u1EE7a",markerPosition:"between",specialForms:{me:"c\u1EE7a t\xF4i",it:"c\u1EE7a n\xF3",you:"c\u1EE7a b\u1EA1n"},keywords:{"c\u1EE7a t\xF4i":"me","c\u1EE7a b\u1EA1n":"you","c\u1EE7a anh":"you","c\u1EE7a ch\u1ECB":"you","c\u1EE7a n\xF3":"it"}},roleMarkers:{destination:{primary:"v\xE0o",alternatives:["cho","\u0111\u1EBFn"],position:"before"},source:{primary:"t\u1EEB",alternatives:["kh\u1ECFi"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"v\u1EDBi",position:"before"}},keywords:{toggle:{primary:"chuy\u1EC3n \u0111\u1ED5i",alternatives:["b\u1EADt t\u1EAFt","chuy\u1EC3n"],normalized:"toggle"},add:{primary:"th\xEAm",alternatives:["b\u1ED5 sung"],normalized:"add"},remove:{primary:"x\xF3a",alternatives:["g\u1EE1 b\u1ECF","lo\u1EA1i b\u1ECF","b\u1ECF"],normalized:"remove"},put:{primary:"\u0111\u1EB7t",alternatives:["\u0111\u1EC3","\u0111\u01B0a"],normalized:"put"},append:{primary:"n\u1ED1i",normalized:"append"},prepend:{primary:"th\xEAm v\xE0o \u0111\u1EA7u",normalized:"prepend"},take:{primary:"l\u1EA5y",normalized:"take"},make:{primary:"t\u1EA1o",normalized:"make"},clone:{primary:"nh\xE2n b\u1EA3n",normalized:"clone"},swap:{primary:"ho\xE1n \u0111\u1ED5i",normalized:"swap"},morph:{primary:"bi\u1EBFn \u0111\u1ED5i",normalized:"morph"},set:{primary:"g\xE1n",alternatives:["thi\u1EBFt l\u1EADp"],normalized:"set"},get:{primary:"l\u1EA5y gi\xE1 tr\u1ECB",alternatives:["nh\u1EADn"],normalized:"get"},increment:{primary:"t\u0103ng",alternatives:["t\u0103ng l\xEAn"],normalized:"increment"},decrement:{primary:"gi\u1EA3m",alternatives:["gi\u1EA3m \u0111i"],normalized:"decrement"},log:{primary:"in ra",normalized:"log"},show:{primary:"hi\u1EC3n th\u1ECB",alternatives:["hi\u1EC7n"],normalized:"show"},hide:{primary:"\u1EA9n",alternatives:["che","gi\u1EA5u"],normalized:"hide"},transition:{primary:"chuy\u1EC3n ti\u1EBFp",normalized:"transition"},on:{primary:"khi",alternatives:["tr\xEAn"],normalized:"on"},trigger:{primary:"k\xEDch ho\u1EA1t",normalized:"trigger"},send:{primary:"g\u1EEDi",normalized:"send"},focus:{primary:"t\u1EADp trung",normalized:"focus"},blur:{primary:"m\u1EA5t t\u1EADp trung",normalized:"blur"},click:{primary:"nh\u1EA5p",alternatives:["b\u1EA5m"],normalized:"click"},hover:{primary:"di chu\u1ED9t",alternatives:["r\xEA chu\u1ED9t"],normalized:"hover"},submit:{primary:"n\u1ED9p",alternatives:[],normalized:"submit"},input:{primary:"nh\u1EADp",alternatives:["nh\u1EADp li\u1EC7u"],normalized:"input"},change:{primary:"thay \u0111\u1ED5i",alternatives:["\u0111\u1ED5i"],normalized:"change"},go:{primary:"\u0111i \u0111\u1EBFn",alternatives:["\u0111i"],normalized:"go"},wait:{primary:"ch\u1EDD",alternatives:["\u0111\u1EE3i"],normalized:"wait"},fetch:{primary:"t\u1EA3i",normalized:"fetch"},settle:{primary:"\u1ED5n \u0111\u1ECBnh",normalized:"settle"},if:{primary:"n\u1EBFu",normalized:"if"},when:{primary:"l\xFAc",normalized:"when"},where:{primary:"\u1EDF_\u0111\xE2u",normalized:"where"},else:{primary:"kh\xF4ng th\xEC",alternatives:["n\u1EBFu kh\xF4ng"],normalized:"else"},repeat:{primary:"l\u1EB7p l\u1EA1i",normalized:"repeat"},for:{primary:"v\u1EDBi m\u1ED7i",normalized:"for"},while:{primary:"trong khi",normalized:"while"},continue:{primary:"ti\u1EBFp t\u1EE5c",normalized:"continue"},halt:{primary:"d\u1EEBng",alternatives:["d\u1EEBng l\u1EA1i"],normalized:"halt"},throw:{primary:"n\xE9m",normalized:"throw"},call:{primary:"g\u1ECDi",normalized:"call"},return:{primary:"tr\u1EA3 v\u1EC1",normalized:"return"},then:{primary:"r\u1ED3i",alternatives:["sau \u0111\xF3","th\xEC"],normalized:"then"},and:{primary:"v\xE0",normalized:"and"},end:{primary:"k\u1EBFt th\xFAc",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"b\u1EA5t \u0111\u1ED3ng b\u1ED9",normalized:"async"},tell:{primary:"n\xF3i v\u1EDBi",normalized:"tell"},default:{primary:"m\u1EB7c \u0111\u1ECBnh",normalized:"default"},init:{primary:"kh\u1EDFi t\u1EA1o",normalized:"init"},behavior:{primary:"h\xE0nh vi",normalized:"behavior"},install:{primary:"c\xE0i \u0111\u1EB7t",normalized:"install"},measure:{primary:"\u0111o l\u01B0\u1EDDng",normalized:"measure"},beep:{primary:"beep",normalized:"beep"},break:{primary:"ng\u1EAFt",normalized:"break"},copy:{primary:"sao ch\xE9p",normalized:"copy"},exit:{primary:"tho\xE1t",normalized:"exit"},pick:{primary:"ch\u1ECDn",normalized:"pick"},render:{primary:"k\u1EBFt xu\u1EA5t",normalized:"render"},into:{primary:"v\xE0o",alternatives:["v\xE0o trong"],normalized:"into"},before:{primary:"tr\u01B0\u1EDBc",alternatives:["tr\u01B0\u1EDBc khi"],normalized:"before"},after:{primary:"sau",alternatives:["sau khi"],normalized:"after"},until:{primary:"cho \u0111\u1EBFn khi",normalized:"until"},event:{primary:"s\u1EF1 ki\u1EC7n",normalized:"event"},from:{primary:"t\u1EEB",alternatives:["kh\u1ECFi"],normalized:"from"}},eventHandler:{keyword:{primary:"khi",alternatives:["tr\xEAn"],normalized:"on"},sourceMarker:{primary:"tr\xEAn",alternatives:["t\u1EA1i"],position:"before"},eventMarker:{primary:"khi",alternatives:["l\xFAc"],position:"before"},temporalMarkers:["khi","l\xFAc"]}};function Un(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:Kn,isIdentifierChar:Gn}=Un(/[a-zA-ZàáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵđÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÈÉẺẼẸÊỀẾỂỄỆÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰỲÝỶỸỴĐ]/),Hn=new Set(["trong","ngo\xE0i","tr\xEAn","d\u01B0\u1EDBi","v\xE0o","ra","\u0111\u1EBFn","t\u1EEB","v\u1EDBi","cho","b\u1EDFi","qua","tr\u01B0\u1EDBc","sau","gi\u1EEFa","b\xEAn","theo","v\u1EC1","t\u1EDBi","l\xEAn","xu\u1ED1ng"]),Yn=class{constructor(){this.name="vietnamese-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Kn(r[e])}extract(r,e){if(!this.context)throw new Error("VietnameseKeywordExtractor: context not set");let t=this.tryMultiWordPhrase(r,e);if(t)return t;let n=e,i="";for(;n<r.length&&Gn(r[n]);)i+=r[n++];if(!i)return null;let a=i.toLowerCase(),o=Hn.has(a),s=this.context.lookupKeyword(a),l=s&&s.normalized!==s.native?s.normalized:void 0;return {value:i,length:n-e,metadata:{normalized:l,isPreposition:o}}}tryMultiWordPhrase(r,e){if(!this.context)return null;let t=["chuy\u1EC3n \u0111\u1ED5i","b\u1EADt t\u1EAFt","hi\u1EC3n th\u1ECB","g\u1EE1 b\u1ECF","lo\u1EA1i b\u1ECF","b\u1ED5 sung","th\xEAm v\xE0o \u0111\u1EA7u","ho\xE1n \u0111\u1ED5i","bi\u1EBFn \u0111\u1ED5i","thi\u1EBFt l\u1EADp","l\u1EA5y gi\xE1 tr\u1ECB","t\u0103ng l\xEAn","gi\u1EA3m \u0111i","in ra","chuy\u1EC3n ti\u1EBFp","k\xEDch ho\u1EA1t","t\u1EADp trung","m\u1EA5t t\u1EADp trung","nh\u1EA5p chu\u1ED9t","di chu\u1ED9t","r\xEA chu\u1ED9t","nh\u1EADp li\u1EC7u","thay \u0111\u1ED5i","\u0111i \u0111\u1EBFn","ch\u1EDD \u0111\u1EE3i","\u1ED5n \u0111\u1ECBnh","n\u1EBFu kh\xF4ng","kh\xF4ng th\xEC","l\u1EB7p l\u1EA1i","v\u1EDBi m\u1ED7i","trong khi","ti\u1EBFp t\u1EE5c","d\u1EEBng l\u1EA1i","tr\u1EA3 v\u1EC1","sau \u0111\xF3","k\u1EBFt th\xFAc","b\u1EA5t \u0111\u1ED3ng b\u1ED9","n\xF3i v\u1EDBi","m\u1EB7c \u0111\u1ECBnh","kh\u1EDFi t\u1EA1o","h\xE0nh vi","c\xE0i \u0111\u1EB7t","\u0111o l\u01B0\u1EDDng","sao ch\xE9p","tho\xE1t ra","k\u1EBFt xu\u1EA5t","v\xE0o trong","tr\u01B0\u1EDBc khi","sau khi","cho \u0111\u1EBFn khi","s\u1EF1 ki\u1EC7n","k\u1EBFt qu\u1EA3","m\u1EE5c ti\xEAu","c\u1EE7a t\xF4i","c\u1EE7a n\xF3","c\u1EE7a b\u1EA1n","c\u1EE7a anh","c\u1EE7a ch\u1ECB","kh\xF4ng x\xE1c \u0111\u1ECBnh","\u0111\u1EA7u ti\xEAn","cu\u1ED1i c\xF9ng","ti\u1EBFp theo","tr\u01B0\u1EDBc \u0111\xF3","g\u1EA7n nh\u1EA5t","nh\u1EA5p \u0111\xFAp","g\u1EEDi bi\u1EC3u m\u1EABu","ph\xEDm xu\u1ED1ng","ph\xEDm l\xEAn","chu\u1ED9t v\xE0o","chu\u1ED9t ra","t\u1EA3i trang","mili gi\xE2y","th\xEAm v\xE0o cu\u1ED1i","nh\xE2n b\u1EA3n","t\u1EA1o ra","\u0111\u1EB7t gi\xE1 tr\u1ECB","ghi nh\u1EADt k\xFD","chuy\u1EC3n t\u1EDBi","ng\u01B0\u1EE3c l\u1EA1i"];for(let n of t)if(r.slice(e,e+n.length).toLowerCase()===n.toLowerCase()){let a=e+n.length;if(a>=r.length||!/[a-zA-Zàáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵđ]/.test(r[a])){let o=this.context.lookupKeyword(n);return {value:r.slice(e,a),length:n.length,metadata:{normalized:o?.normalized,isPreposition:false}}}}return null}};function Zn(){return [new Yn]}var Xn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Jn=class{constructor(r=Xn){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Qn="()[]{},:;",ei=class{constructor(r=Qn){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function ti(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var ri=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=ti(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},ni=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}};function ii(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var ai=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=ii(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},oi=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function si(){return [new ai,new ni,new oi,new ri]}var li=[{native:"\u0111\xFAng",normalized:"true"},{native:"sai",normalized:"false"},{native:"null",normalized:"null"},{native:"kh\xF4ng x\xE1c \u0111\u1ECBnh",normalized:"undefined"},{native:"\u0111\u1EA7u ti\xEAn",normalized:"first"},{native:"cu\u1ED1i c\xF9ng",normalized:"last"},{native:"ti\u1EBFp theo",normalized:"next"},{native:"tr\u01B0\u1EDBc \u0111\xF3",normalized:"previous"},{native:"g\u1EA7n nh\u1EA5t",normalized:"closest"},{native:"cha",normalized:"parent"},{native:"nh\u1EA5p",normalized:"click"},{native:"nh\u1EA5p chu\u1ED9t",normalized:"click"},{native:"click",normalized:"click"},{native:"nh\u1EA5p \u0111\xFAp",normalized:"dblclick"},{native:"nh\u1EADp",normalized:"input"},{native:"thay \u0111\u1ED5i",normalized:"change"},{native:"g\u1EEDi bi\u1EC3u m\u1EABu",normalized:"submit"},{native:"ph\xEDm xu\u1ED1ng",normalized:"keydown"},{native:"ph\xEDm l\xEAn",normalized:"keyup"},{native:"chu\u1ED9t v\xE0o",normalized:"mouseover"},{native:"chu\u1ED9t ra",normalized:"mouseout"},{native:"t\u1EA3i trang",normalized:"load"},{native:"cu\u1ED9n",normalized:"scroll"},{native:"c\u1EE7a t\xF4i",normalized:"my"},{native:"c\u1EE7a n\xF3",normalized:"its"},{native:"gi\xE2y",normalized:"s"},{native:"mili gi\xE2y",normalized:"ms"},{native:"ph\xFAt",normalized:"m"},{native:"gi\u1EDD",normalized:"h"},{native:"th\xEAm v\xE0o cu\u1ED1i",normalized:"append"},{native:"nh\xE2n b\u1EA3n",normalized:"clone"},{native:"t\u1EA1o ra",normalized:"make"},{native:"\u0111\u1EB7t gi\xE1 tr\u1ECB",normalized:"set"},{native:"ghi nh\u1EADt k\xFD",normalized:"log"},{native:"chuy\u1EC3n t\u1EDBi",normalized:"go"},{native:"ng\u01B0\u1EE3c l\u1EA1i",normalized:"else"},{native:"l\u1EB7p",normalized:"repeat"},{native:"ho\u1EB7c",normalized:"or"},{native:"kh\xF4ng",normalized:"not"},{native:"l\xE0",normalized:"is"},{native:"t\u1ED3n t\u1EA1i",normalized:"exists"},{native:"r\u1ED7ng",normalized:"empty"},{native:"javascript",normalized:"js"}],ui=class extends P{constructor(){super(),this.language="vi",this.direction="ltr",this.initializeKeywordsFromProfile(Ue,li),this.registerExtractors(si()),this.registerExtractor(new z),this.registerExtractor(new R),this.registerExtractors(Zn()),this.registerExtractor(new Jn),this.registerExtractor(new ei);}classifyToken(r){let e=r.toLowerCase();return this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":"identifier"}},ci=new ui;jn("vi",ci,Ue);var di=Object.defineProperty,pi=Object.getOwnPropertyNames,it=(r,e)=>function(){return r&&(e=(0, r[pi(r)[0]])(r=0)),e},mi=(r,e)=>{for(var t in e)di(r,t,{get:e[t],enumerable:true});};function Ke(r,e){return r.replace(/\{(\w+)\}/g,(t,n)=>String(e[n]??`{${n}}`))}function A(r,e,t={},n){let i=at[r],a=Ke(i,t),o=ot[r],s=o?Ke(o,t):void 0;return {code:r,message:a,severity:e,...n&&{role:n},...s&&{suggestion:s}}}var h,at,ot,fi=it({"src/generators/schema-error-codes.ts"(){h={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},at={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[h.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[h.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[h.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[h.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[h.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[h.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[h.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[h.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[h.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[h.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[h.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},ot={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[h.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[h.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[h.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[h.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[h.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[h.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[h.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[h.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),st={};mi(st,{SchemaErrorCodes:()=>h,formatValidationResults:()=>ki,getValidationStats:()=>wi,validateAllKeywordCollisions:()=>Si,validateAllSchemas:()=>bi,validateCommandSchema:()=>lt,validateKeywordCollisions:()=>ut,validateRoleValues:()=>xi});function hi(r,e){return {action:r,items:e,get notes(){return e.filter(t=>t.severity==="note").map(t=>t.message)},get warnings(){return e.filter(t=>t.severity==="warning").map(t=>t.message)},get errors(){return e.filter(t=>t.severity==="error").map(t=>t.message)}}}function lt(r){let e=[];for(let n of r.roles)n.expectedTypes.includes("literal")&&n.expectedTypes.includes("selector")&&(n.role==="patient"&&we.has(r.action)?e.push(A(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:n.role,command:r.action},n.role)):e.push(A(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:n.role},n.role))),n.expectedTypes.length>3&&!we.has(r.action)&&e.push(A(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:n.role,count:n.expectedTypes.length},n.role));for(let n of r.roles)n.selectorKinds&&n.selectorKinds.length>0&&(n.expectedTypes.includes("selector")||e.push(A(h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:n.role},n.role)));switch(r.action){case "transition":yi(r,e);break;case "on":vi(r,e);break;case "if":case "unless":gi(r,e);break;case "repeat":case "for":case "while":Ei(r,e);break}return r.roles.filter(n=>n.required).length===0&&(ct.has(r.action)?e.push(A(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):e.push(A(h.NO_REQUIRED_ROLES,"warning",{}))),hi(r.action,e)}function yi(r,e){let t=r.roles.find(i=>i.role==="patient"),n=r.roles.find(i=>i.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(A(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!n&&e.push(A(h.TRANSITION_MISSING_GOAL,"error",{}));}function vi(r,e){let t=r.roles.find(n=>n.role==="event");t||e.push(A(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(A(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function gi(r,e){let t=r.roles.find(n=>n.role==="condition");t||e.push(A(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(A(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Ei(r,e){r.action==="for"?r.roles.find(n=>n.role==="source")||e.push(A(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(n=>n.role==="condition")||e.push(A(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function bi(r,e={}){let t=new Map,{includeNotes:n=false}=e;for(let[i,a]of Object.entries(r)){let o=lt(a),s=o.items.some(u=>u.severity==="warning"||u.severity==="error"),l=n&&o.items.some(u=>u.severity==="note");(s||l)&&t.set(i,o);}return t}function ki(r,e={}){let t=[],{showNotes:n=false,showCodes:i=true}=e;for(let[a,o]of r){let s=o.items.filter(c=>c.severity==="error"),l=o.items.filter(c=>c.severity==="warning"),u=o.items.filter(c=>c.severity==="note");if(s.length>0){t.push(` \u274C ${a}:`);for(let c of s){let d=i?` [${c.code}]`:"";t.push(` ERROR${d}: ${c.message}`),c.suggestion&&t.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(l.length>0){t.push(` \u26A0\uFE0F ${a}:`);for(let c of l){let d=i?` [${c.code}]`:"";t.push(` ${d?`${c.code}: `:""}${c.message}`),c.suggestion&&t.push(` \u{1F4A1} ${c.suggestion}`);}}if(n&&u.length>0){t.push(` \u2139\uFE0F ${a}:`);for(let c of u){let d=i?` [${c.code}]`:"";t.push(` ${d?`${c.code}: `:""}${c.message}`);}}}return t.join(`
|
|
2
|
+
`)}function wi(r){let e=0,t=0,n=0,i={};for(let a of r.values())for(let o of a.items)o.severity==="error"?e++:o.severity==="warning"?t++:o.severity==="note"&&n++,i[o.code]=(i[o.code]||0)+1;return {totalCommands:r.size,errors:e,warnings:t,notes:n,byCode:i}}function xi(r,e){let t=[];for(let n of e){let i=r.roles.find(a=>a.role===n.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(n.type)&&(i.expectedTypes.includes("expression")||t.push({level:"error",role:n.role,message:`${r.action}.${n.role} expects type [${i.expectedTypes.join(", ")}], got '${n.type}'`,code:h.VALUE_TYPE_MISMATCH})),n.type==="selector"&&n.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(n.selectorKind)||t.push({level:"error",role:n.role,message:`${r.action}.${n.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${n.selectorKind}'`,code:h.SELECTOR_KIND_MISMATCH})));}return t}function ut(r){let e=[];if(!r.keywords)return {language:r.code,collisions:e};let t=new Map;for(let[i,a]of Object.entries(r.keywords)){if(!a||!a.primary)continue;let o=t.get(a.primary)||[];if(o.push({command:i,isPrimary:true}),t.set(a.primary,o),a.alternatives)for(let s of a.alternatives){let l=t.get(s)||[];l.push({command:i,isPrimary:false}),t.set(s,l);}}for(let[i,a]of t){let o=[...new Set(a.map(u=>u.command))];if(o.length<=1)continue;let s=a.filter(u=>u.isPrimary).length,l;s>=2?l="primary-primary":s===1?l="primary-alternative":l="alternative-alternative",e.push({keyword:i,commands:o.sort(),type:l});}let n={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,a)=>n[i.type]-n[a.type]),{language:r.code,collisions:e}}function Si(r){let e=[];for(let[,t]of Object.entries(r)){let n=ut(t);n.collisions.length>0&&e.push(n);}return e.sort((t,n)=>t.language.localeCompare(n.language))}var we,ct,Ti=it({"src/generators/schema-validator.ts"(){fi(),we=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),ct=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function te(r){let e="complex";return r.startsWith("#")&&!r.includes(" ")?e="id":r.startsWith(".")&&!r.includes(" ")?e="class":r.startsWith("[")&&r.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(r)&&(e="element"),{type:"selector",value:r,selectorKind:e}}function x(r,e){let t={type:"literal",value:r};return e!==void 0?{type:"literal",value:r,dataType:e}:t}function Ge(r){return Me(r)}function D(r){return {type:"reference",value:r}}function Ee(r,e){return {type:"property-path",object:r,property:e}}function le(r,e,t){let n={kind:"command",action:r,roles:new Map(Object.entries(e))};return t!==void 0?{...n,metadata:t}:n}function He(r,e,t,n,i,a){let o=new Map;o.set("event",r);let s={kind:"event-handler",action:"on",roles:o,body:e};return t!==void 0&&(s.eventModifiers=t),n!==void 0&&(s.metadata=n),s}function Ye(r,e="then",t){let n={kind:"compound",action:"compound",roles:new Map,statements:r,chainType:e};return t!==void 0&&(n.metadata=t),n}function Ze(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Ai(r,e){return r.possessive?.keywords?.[e]}var j=new Map,U=new Map,ue=new Map,xe=null;function dt(r,e){let t={...r};for(let n of Object.keys(e)){let i=e[n],a=r[n];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof a=="object"&&a!==null&&!Array.isArray(a)?t[n]=dt(a,i):t[n]=i);}return t}function Ci(r,e){return dt(r,e)}function Te(r){if(!r.extends)return r;let e=U.get(r.extends);if(!e)return console.warn(`[Registry] Profile '${r.code}' extends '${r.extends}' but base is not registered. Make sure to import the base language before the variant.`),r;let t=Te(e);return Ci(t,r)}function pt(r){xe=r;}var Xe=new Map;function K(r){return r.split("-")[0]}function G(r){return r.includes("-")}function zi(r){let e=j.get(r);if(!e&&G(r)){let t=K(r);e=j.get(t);}if(!e){let t=Array.from(j.keys()).join(", ");throw new Error(`Language '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return e}function Ri(r){let e=U.get(r);if(!e&&G(r)){let t=K(r);e=U.get(t);}if(!e){let t=Array.from(U.keys()).join(", ");throw new Error(`Language profile '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return Te(e)}function Pi(r){let e=j.get(r);return !e&&G(r)&&(e=j.get(K(r))),e}function B(r){let e=U.get(r);return !e&&G(r)&&(e=U.get(K(r))),e?Te(e):void 0}function mt(){return Array.from(j.keys())}function _i(r,e){return zi(e).tokenize(r)}function q(r){let e=ue.get(r);if(!e&&G(r)&&(e=ue.get(K(r))),e)return e;let t=Xe.get(r);if(!t&&G(r)&&(t=Xe.get(K(r))),t)return ue.set(r,t),t;if(!xe)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let n=Ri(r),i=xe(n);return ue.set(r,i),i}var be=.8,Oi=.6,Ii=.15,Mi=.5,Je=.15,Qe=.1,et=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"]),Li={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"]},Di=class{calculate(r){return this.calculateWithBreakdown(r).final}calculateWithBreakdown(r){let e=this.scoreRoleCoverage(r),t=this.scoreStemPenalty(r),n=this.scoreLanguageBoost(r),i=this.scoreLanguageAdjustment(r),a=e;return a=Math.max(Mi,a+t),a=Math.min(1,a+n),a=Math.max(0,Math.min(1,a+i)),{roleCoverage:e,stemPenalty:t,languageBoost:n,languageAdjustment:i,final:a}}scoreRoleCoverage(r){let{pattern:e,captured:t}=r,n=0,i=0,a=o=>e.extraction?.[o]?.default!==void 0;for(let o of e.template.tokens)if(o.type==="role")i+=1,t.has(o.role)&&(n+=1);else if(o.type==="group")for(let s of o.tokens)s.type==="role"&&(i+=be,t.has(s.role)?n+=be:a(s.role)&&(n+=be*Oi));return i>0?n/i:1}scoreStemPenalty(r){let{stemMatchCount:e,totalKeywordMatches:t}=r;return e<=0||t<=0?0:-(e/t)*Ii}scoreLanguageBoost(r){let{pattern:e}=r;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:et.has(t.value)||t.alternatives?.some(n=>et.has(n))?Je:0}scoreLanguageAdjustment(r){let{pattern:e,captured:t}=r;if(e.language!=="ar")return 0;let n=0;for(let[i,a]of t.entries()){let o=Li[i];if(!o||o.length===0)continue;let s="metadata"in a?a.metadata:void 0;s&&typeof s.prepositionValue=="string"&&(o.includes(s.prepositionValue)?n+=.1:n-=.1);}return Math.max(-Qe,Math.min(Qe,n))}},Bi=new Di,de=class ee{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Bi;}matchPattern(e,t){let n=e.mark(),i=new Map;if(this.currentProfile=B(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,i))return e.reset(n),null;let o=this.confidenceModel.calculate({pattern:t,captured:i,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-n.position,confidence:o}}matchBest(e,t){this.matchCache.clear();let n=[],i=e.position();for(let o of t){let s=e.mark(),l=`${i}:${o.id}`,u;this.matchCache.has(l)?u=this.matchCache.get(l):(u=this.matchPattern(e,o),this.matchCache.set(l,u)),u&&n.push(u),e.reset(s);}if(n.length===0)return null;n.sort((o,s)=>{let l=s.pattern.priority-o.pattern.priority;return l!==0?l:s.confidence-o.confidence});let a=n[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,n){let i=t[0],a=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!a)for(;e.peek()?.kind==="conjunction";)e.advance();for(let o of t)if(!this.matchPatternToken(e,o,n)){if(this.isOptional(o))continue;return false}return true}matchPatternToken(e,t,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,n);case "group":return this.matchGroupToken(e,t,n);default:return false}}matchLiteralToken(e,t){let n=e.peek();if(!n)return false;let i=this.getMatchType(n,t.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let a of t.alternatives){let o=this.getMatchType(n,a);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,n){this.skipNoiseWords(e);let i=e.peek();if(!i)return t.optional||false;let a=this.tryMatchPossessiveExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(a.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,a),true);let o=this.tryMatchMethodCallExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(o.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,o),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(s.type,t.expectedTypes)?t.optional||false:(n.set(t.role,s),true);let l=this.tryMatchPropertyAccessExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(l.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,l),true);let u=this.tryMatchSelectorPropertyExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(u.type,t.expectedTypes)?t.optional||false:(n.set(t.role,u),true);let c=this.tokenToSemanticValue(i);return !c||t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(c.type)?t.optional||false:(n.set(t.role,c),e.advance(),true)}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let n=(t.normalized||t.value).toLowerCase(),i=Ai(this.currentProfile,n);if(!i)return null;let a=e.mark();e.advance();let o=e.peek();if(!o)return e.reset(a),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 l=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let u=e.peek();return u?.kind==="literal"&&u.value.startsWith("(")&&(l+=u.value,e.advance()),Ee(D(i),l)}return e.reset(a),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(n),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<ee.MAX_METHOD_ARGS;){let u=e.peek();if(!u)break;if(u.kind==="punctuation"&&u.value===")"){e.advance();break}if(u.kind==="punctuation"&&u.value===","){e.advance();continue}s.push(u.value),e.advance();}return {type:"expression",raw:`${t.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(n),null;e.advance();let o=`${t.value}.${a.value}`,s=1;for(;!e.isAtEnd()&&s<ee.MAX_PROPERTY_DEPTH;){let u=e.peek();if(!u||u.kind!=="operator"||u.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),o+=`.${c.value}`,s++;}let l=e.peek();if(l&&l.kind==="punctuation"&&l.value==="("){e.advance();let u=[],c=0;for(;!e.isAtEnd()&&u.length<ee.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}u.push(p.value),e.advance();}return {type:"expression",raw:`${o}(${u.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"&&a.kind!=="identifier"?(e.reset(n),null):(e.advance(),Ee(te(t.value),a.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let a=e.peek(1);a&&a.kind,e.advance();let o=i.value.slice(1);return Ee(te(t.value),o)}matchGroupToken(e,t,n){let i=e.mark(),a=new Set(n.keys());if(!this.matchTokenSequence(e,t.tokens,n)){e.reset(i);for(let s of n.keys())a.has(s)||n.delete(s);return t.optional||false}return true}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return te(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return Ge(t)?D(t):x(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return D(e.value);let n=e.value.toLowerCase();return Ge(n)?D(n):{type:"expression",raw:e.value};case "url":return x(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return x(i,"string")}if(e==="true")return x(true,"boolean");if(e==="false")return x(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let i=parseFloat(t[1]);return t[2]?x(e,"duration"):x(i,"number")}let n=parseFloat(e);return isNaN(n)?x(e,"string"):x(n,"number")}applyExtractionRules(e,t){for(let[n,i]of Object.entries(e.extraction))t.has(n)||(i.value!==void 0?t.set(n,{type:"literal",value:i.value}):i.default&&t.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let n=t.value.toLowerCase();if(ee.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let a=e.peek();if(a&&(a.kind==="selector"||a.kind==="identifier"))return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let t={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let a=i.metadata;if(!a)break;switch(n=true,a.modifierName){case "once":t.once=true;break;case "debounce":typeof a.value=="number"&&(t.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(t.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(t.queue=a.value);break}e.advance();}return n?t:void 0}};de.MAX_PROPERTY_DEPTH=10;de.MAX_METHOD_ARGS=20;de.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var ft=de,F=new ft;function $i(r){return Pi(r)}function ke(r,e){return _i(r,e)}function ht(){return mt()}var Vi={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 Fi={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)"}},qi={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"}},ji={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Ui={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},Ki={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>"}},Gi={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}]},Hi={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}]},Yi={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}]},Zi={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}]},Xi={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Ji={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},Qi={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"}}]},ea={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"}}]},ta={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"}}]},ra={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"}}]},na={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}]},ia={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}]},aa={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}]},oa={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}]},sa={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}]},la={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}]},ua={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}]},ca={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},da={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},pa={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}]},ma={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},fa={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"'},ha={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"}}]},ya={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}]},va={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},ga={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:""}}]},Ea={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}]},ba={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"}}]},ka={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}]},wa={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}]},xa={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}]},Sa={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}]},Ta={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}]},Aa={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Ca={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:""}}]},za={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"}}]},Ra={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Pa={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}]},_a={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}]},Na={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"}}]},Oa={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"}}]},Ia={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"}}]},Ma={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}]},La={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Da={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}]},Ba={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},$a={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}]},Va={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}]},yt={toggle:Fi,add:qi,remove:ji,put:Ui,set:Ki,show:Gi,hide:Hi,on:Yi,trigger:Zi,wait:Xi,fetch:Ji,increment:Qi,decrement:ea,append:ta,prepend:ra,log:na,get:ia,take:aa,make:oa,halt:sa,settle:la,throw:ua,send:ca,if:da,unless:pa,else:ma,repeat:fa,for:ha,while:ya,continue:va,go:ga,transition:Ea,clone:ba,focus:ka,blur:wa,call:xa,return:Sa,js:Ta,async:Aa,tell:Ca,default:za,init:Ra,behavior:Pa,install:_a,measure:Na,swap:Oa,morph:Ia,beep:Ma,break:La,copy:Da,exit:Ba,pick:$a,render:Va,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Wa(){return Object.values(yt).filter(r=>r.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(Ti(),st)).then(({validateAllSchemas:r,formatValidationResults:e})=>{let t=r(yt);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
|
|
3
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(r=>{console.debug("Schema validation skipped:",r);});var tt=class extends Error{constructor(r,e,t,n){super(r),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=n;}};function _(r,e,t){return {message:r,severity:e,source:"semantic-parser",...t&&{code:t}}}function ce(r,e){return e.length===0?r:{...r,diagnostics:e}}var H=class O{parse(e,t){let{modifiers:n,remainingInput:i}=this.extractStandaloneModifiers(e,t),a=i||e,o=[],s=ke(a,t),l=q(t);if(l.length===0)throw new tt(`No patterns available for language: ${t}`,t,a,[_(`No patterns registered for language '${t}'`,"error","no-patterns")]);let u=[...l].sort((y,g)=>g.priority-y.priority),c=u.filter(y=>y.command==="on"),d=F.matchBest(s,c);if(d){o.push(_(`event pattern matched: ${d.pattern.id} (confidence: ${d.confidence.toFixed(2)})`,"info","pattern-match"));let y=this.buildEventHandler(d,s,t),g=n?this.applyModifiers(y,n):y;return ce(g,o)}o.push(_(`event patterns: ${c.length} tried, no match`,"info","stage-event"));let p=u.filter(y=>y.command!=="on"),m=F.matchBest(s,p);if(m)return o.push(_(`command pattern matched: ${m.pattern.id} (confidence: ${m.confidence.toFixed(2)})`,"info","pattern-match")),ce(this.buildCommand(m,t),o);o.push(_(`command patterns: ${p.length} tried, no match`,"info","stage-command"));let f=this.trySOVEventExtraction(a,t,u);if(f){o.push(_("SOV event extraction succeeded","info","stage-sov"));let y=n?this.applyModifiers(f,n):f;return ce(y,o)}o.push(_("SOV event extraction: no event keyword found","info","stage-sov"));let v=this.tryCompoundCommandParsing(s,p,t);if(v)return o.push(_("compound command parsing succeeded","info","stage-compound")),ce(v,o);throw o.push(_("compound parsing: no then-keywords or no command matches","info","stage-compound")),o.push(_(`all parse stages exhausted for "${a}"`,"error","parse-failed")),new tt(`Could not parse input in ${t}: ${a}`,t,a,o)}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return ht()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let n={};for(let[i,a]of e.captured)n[i]=a;return le(e.pattern.command,n,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,n){if(!e)throw new Error("No match to build event handler from");let i=e.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");let a=F.extractEventModifiers(t),o=this.extractOrConjunctionEvents(t,n),s=i;o.length>0&&i.type==="literal"&&(s={type:"literal",value:[String(i.value),...o.map(d=>String("value"in d?d.value:""))].join(" or ")});let l,u=e.captured.get("action");if(u&&u.type==="literal"){let c=u.value,d={};for(let[f,v]of e.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(d[f]=v);let p=le(c,d,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence}),m=e.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then"){let f=q(n).filter(g=>g.command!=="on").sort((g,b)=>b.priority-g.priority),v=q(n).filter(g=>g.id.startsWith("grammar-")&&g.id.includes("-continuation")).sort((g,b)=>b.priority-g.priority),y=this.parseBodyWithGrammarPatterns(t,f,v,n);y.length>0?l=[p,...y]:l=[p];}else l=[p];}else {let c=q(n).filter(d=>d.command!=="on").sort((d,p)=>p.priority-d.priority);l=this.parseBodyWithClauses(t,c,n);}return He(s,l,a,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,n){let i=[],a=[];for(;!e.isAtEnd();){let o=e.peek();if(!o)break;let s=o.kind==="conjunction"||o.kind==="keyword"&&this.isThenKeyword(o.value,n),l=o.kind==="keyword"&&this.isEndKeyword(o.value,n);if(s){if(a.length>0){let u=this.parseClause(a,t,n);i.push(...u),a.length=0;}e.advance();continue}if(l){if(a.length>0){let u=this.parseClause(a,t,n);i.push(...u);}e.advance();break}a.push(o),e.advance();}if(a.length>0){let o=this.parseClause(a,t,n);i.push(...o);}return i.length>1?[Ye(i,"then",{sourceLanguage:n})]:i}parseClause(e,t,n){if(e.length===0)return [];let i=new J(e,n),a=[];for(;!i.isAtEnd();){let o=F.matchBest(i,t);o?a.push(this.buildCommand(o,n)):i.advance();}if(a.length===0){let o=this.parseSOVClauseByVerbAnchoring(e,n);if(o.length>0)return o}return a}static buildVerbLookup(e){let t=new Map;for(let[n,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(n)&&(t.set(i.primary.toLowerCase(),n),i.alternatives))for(let a of i.alternatives)t.set(a.toLowerCase(),n);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[n,i]of Object.entries(e.roleMarkers))if(i&&(t.set(i.primary,n),i.alternatives))for(let a of i.alternatives)t.has(a)||t.set(a,n);return t}parseSOVClauseByVerbAnchoring(e,t){let n=B(t);if(!n||n.wordOrder!=="SOV")return [];let i=O.buildVerbLookup(n),a=O.buildMarkerToRoleLookup(n),o=[],s=0;for(;s<e.length;){let l=-1,u="";for(let f=s;f<e.length;f++){let v=e[f],y=i.get(v.value.toLowerCase()),g=v.normalized?i.get(v.normalized.toLowerCase()):void 0,b=y||g;if(b){l=f,u=b;break}}if(l===-1)break;let c=e.slice(s,l),d=e.length;for(let f=l+1;f<e.length;f++){let v=e[f];if(v.kind==="conjunction"||this.isThenKeyword(v.value,t)){d=f;break}if(f>l+1&&(i.get(v.value.toLowerCase())||(v.normalized?i.get(v.normalized.toLowerCase()):void 0))){d=f;break}}let p=e.slice(l+1,d),m=this.extractRolesFromMarkedTokens(c,p,a,u,t);if(o.push(le(u,m,{sourceLanguage:t,confidence:.7})),s=d,s<e.length){let f=e[s];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&s++;}}return o}extractRolesFromMarkedTokens(e,t,n,i,a){let o={},s=l=>{let u=[];for(let c of l){let d=n.get(c.value);if(d&&c.kind==="particle"&&u.length>0){let p=this.tokensToSemanticValue(u);if(p){let m=this.mapRoleForCommand(d,i,o);m&&(o[m]=p);}u=[];}else u.push(c);}if(u.length>0){let c=this.tokensToSemanticValue(u);c&&(o.patient?o.destination||(o.destination=c):o.patient=c);}};return s(e),s(t),o}mapRoleForCommand(e,t,n){return n[e]?e==="patient"&&!n.destination?"destination":e==="destination"&&!n.patient?"patient":e==="source"&&!n.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let t=e.filter(a=>a.kind!=="whitespace");if(t.length===0)return null;if(t.length===1)return this.tokenToSemanticValue(t[0]);let n=t.map(a=>a.value).join(""),i=t[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?te(n):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?x(n):i.kind==="reference"?D(n):x(n)}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return te(t);if(t.startsWith('"')||t.startsWith("'"))return x(t);if(/^-?\d+(\.\d+)?$/.test(t))return x(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return x(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return x(false);let n=e.normalized?.toLowerCase();return n==="me"||n==="it"||n==="you"||n==="result"||n==="body"?D(n):e.kind==="reference"?D(e.normalized||"me"):x(t)}parseBodyWithGrammarPatterns(e,t,n,i){let a=[];for(;!e.isAtEnd();){let o=e.peek();if(o&&this.isThenKeyword(o.value,i)){e.advance();continue}if(o&&this.isEndKeyword(o.value,i)){e.advance();break}let s=false;if(n.length>0){let l=F.matchBest(e,n);if(l){let u=l.pattern.command,c={};for(let[m,f]of l.captured)m!=="event"&&m!=="action"&&m!=="continues"&&(c[m]=f);let d=le(u,c,{sourceLanguage:i,patternId:l.pattern.id});a.push(d),s=true;let p=l.captured.get("continues");if(p&&p.type==="literal"&&p.value==="then")continue}}if(!s){let l=F.matchBest(e,t);l&&(a.push(this.buildCommand(l,i)),s=true);}s||e.advance();}return a}tryCompoundCommandParsing(e,t,n){let i=e.tokens;if(!i.some(l=>l.kind==="conjunction"||l.kind==="keyword"&&this.isThenKeyword(l.value,n)))return null;let o=new J(i,n),s=this.parseBodyWithClauses(o,t,n);return s.length===0?null:s.length===1?s[0]:Ye(s,"then",{sourceLanguage:n,confidence:.65})}trySOVEventExtraction(e,t,n){let i=O.SOV_EVENT_MARKERS[t];if(!i)return null;let o=ke(e,t).tokens,s=Vi[t],l=new Set;if(s)for(let E of Object.keys(s))l.add(E.toLowerCase());let u=O.SOV_SOURCE_MARKERS[t],c=-1,d="",p="",m=1;for(let E=0;E<o.length;E++){let S=o[E],I=S.value.toLowerCase(),M=I,$="",me=I.indexOf("[");me>0&&(M=I.slice(0,me),$=S.value.slice(me));let fe=S.normalized?.toLowerCase(),Ne=fe&&O.KNOWN_EVENTS.has(fe),Oe=l.has(I)||l.has(M),Rt=O.KNOWN_EVENTS.has(M);if(Ne||Oe||Rt){let Y;if(Ne?Y=fe:Oe?Y=s?.[I]??s?.[M]??M:Y=M,i.size>0){let ae=1,he=o[E+1];he&&he.kind==="selector"&&he.value.startsWith("[")&&(ae=2);let oe=o[E+ae];if(oe&&(oe.kind==="particle"||oe.kind==="keyword")&&i.has(oe.value)){c=E,d=Y,p=$||(ae===2?o[E+1].value:""),m=ae+1;break}}else {c=E,d=Y,p=$,m=1;break}}}if(c===-1)return null;let f=new Set;for(let E=c;E<c+m;E++)f.add(E);if(u){let E=c+m;if(E<o.length){let S=o[E];(S.kind==="particle"||S.kind==="keyword")&&u.markers.has(S.value)&&f.add(E);}for(let S=0;S<c;S++){let I=o[S],M=I.value.toLowerCase(),$=I.normalized?.toLowerCase();if(u.windowTokens.has(M)||$&&u.windowTokens.has($)){f.add(S);break}}}let v=o.filter((E,S)=>!f.has(S));if(v.length===0)return null;let y=n.filter(E=>E.command!=="on"),g=new J(v,t),b=this.parseBodyWithClauses(g,y,t);if(b.length===0)return null;let _e={sourceLanguage:t,confidence:.75};return p&&(_e.keyFilter=p),He({type:"literal",value:d},b,void 0,_e)}isThenKeyword(e,t){let n={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (n[t]||n.en).has(e.toLowerCase())}isEndKeyword(e,t){let n={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (n[t]||n.en).has(e.toLowerCase())}extractStandaloneModifiers(e,t){let i=ke(e,t).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let o=i[0].value.toLowerCase(),s=O.STANDALONE_MODIFIERS[o];if(!s)return {modifiers:null,remainingInput:null};let l={},u=1;if(s==="once")l.once=true;else {let m=1;if(m<i.length){let f=i[m];(f.kind==="keyword"||f.kind==="particle")&&(m++,u++);}if(m<i.length){let f=i[m];if(f.kind==="literal"){let v=f.value.match(/^(\d+)(ms|s|m)?$/);if(v){let y=parseInt(v[1],10),g=v[2]||"ms";g==="s"?y*=1e3:g==="m"&&(y*=6e4),l[s]=y,u=m+1;}}}l[s]||(l[s]=s==="debounce"?300:100);}let c=i.slice(u);if(c.length===0)return {modifiers:null,remainingInput:null};let d=c[0].position.start,p=e.slice(d);return {modifiers:l,remainingInput:p}}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let n=[];for(;;){let i=e.mark(),a=e.peek();if(!a)break;let o=(a.normalized||a.value).toLowerCase();if(!O.OR_KEYWORDS.has(o)){e.reset(i);break}e.advance();let s=e.peek();if(!s){e.reset(i);break}let l=(s.normalized||s.value).toLowerCase();e.advance(),n.push({type:"literal",value:l});}return n}};H.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);H.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"])};H.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"])}};H.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};H.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 Fa=H,qa=new Fa;function Ae(r,e){return qa.parse(r,e)}var Se=class{constructor(r={}){this.cache=new Map,this.config={maxSize:r.maxSize??1e3,ttlMs:r.ttlMs??0,enabled:r.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(r,e){return `${e}:${r}`}isExpired(r){return this.config.ttlMs===0?false:Date.now()-r.createdAt>this.config.ttlMs}evictLRU(){let r=this.cache.keys().next().value;r!==void 0&&(this.cache.delete(r),this.stats.evictions++);}get(r,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(r,e),n=this.cache.get(t);if(!n){this.stats.misses++;return}if(this.isExpired(n)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),n.lastAccessed=Date.now(),this.cache.set(t,n),this.stats.hits++,n.result}set(r,e,t){if(!this.config.enabled||t.confidence===0)return;let n=this.makeKey(r,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(n,{result:t,createdAt:i,lastAccessed:i});}has(r,e){if(!this.config.enabled)return false;let t=this.makeKey(r,e),n=this.cache.get(t);return n?this.isExpired(n)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(r,e){let t=this.makeKey(r,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let r=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:r>0?this.stats.hits/r:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(r){if(r.maxSize!==void 0)for(this.config.maxSize=r.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();r.ttlMs!==void 0&&(this.config.ttlMs=r.ttlMs),r.enabled!==void 0&&(this.config.enabled=r.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},ja=new Se;var Ua=class{constructor(r={}){this.patternMatcher=new ft,this.languages=new Set(mt()),r.cache===false?this.cache=new Se({enabled:false}):this.cache=r.cache?new Se(r.cache):ja;}analyze(r,e){if(!this.supportsLanguage(e))return {confidence:0,errors:[`Language '${e}' is not supported for semantic parsing`]};let t=this.cache.get(r,e);if(t)return t;let n=this.analyzeUncached(r,e);return this.cache.set(r,e,n),n}analyzeUncached(r,e){try{try{let o=Ae(r,e),s={confidence:o.metadata?.confidence??.8,node:o};return o.kind==="command"?{...s,command:{name:o.action,roles:o.roles}}:s}catch{}let t=$i(e);if(!t)return {confidence:0,errors:[`No tokenizer available for language '${e}'`]};let n=t.tokenize(r),i=q(e);if(i.length===0)return {confidence:0,errors:[`No patterns available for language '${e}'`]};let a=this.patternMatcher.matchBest(n,i);if(a){let o=this.buildSemanticNode(a);return {confidence:a.confidence,command:{name:a.pattern.command,roles:a.captured},node:o,tokensConsumed:a.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(t){return {confidence:0,errors:[t instanceof Error?t.message:String(t)]}}}supportsLanguage(r){return this.languages.has(r)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(r){this.cache.configure(r);}buildSemanticNode(r){return {kind:"command",action:r.pattern.command,roles:r.captured,metadata:{patternId:r.pattern.id}}}};function vt(r){return new Ua(r)}var Ka=.5;function gt(r,e=Ka){return r.confidence>=e&&r.command!==void 0}function Et(r,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...r].sort((n,i)=>{let a=n[t]??99,o=i[t]??99;return a-o})}function Ga(r,e){let t=r.markerOverride?.[e.code],n=e.roleMarkers[r.role];if(t!==void 0)return {primary:t,position:n?.position??"before",isOverride:true};if(n&&n.primary){let i={primary:n.primary,position:n.position,isOverride:false};return n.alternatives&&(i.alternatives=n.alternatives),i}return null}function Ha(r,e,t,n,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),n.position==="after"){let u=n.primary.split(/\s+/);if(u.length>1)for(let c of u)a.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(c);}}let o=e.roleMarkers.destination;o&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),a.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};a.push(u);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(l),{id:`${r.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${n.primary} {destination?} {patient} ${s?.primary||""} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ya(r,e,t,n,i){let a=[];a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(l);}if(a.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let u of l)a.push({type:"literal",value:u});else {let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(u);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(s),{id:`${r.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${o?.primary||""} {event} ${n.primary} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Za(r,e,t,n,i){let a=[];a.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};a.push(u);}let s=e.roleMarkers.destination;if(s&&(a.push({type:"role",role:"destination",optional:false}),a.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),a.push({type:"role",role:"event",optional:false}),n.position==="after"){let u=n.primary.split(/\s+/);if(u.length>1)for(let c of u)a.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(c);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(l),{id:`${r.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${s?.primary||""} {event} ${n.primary} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Xa(r,e,t,n,i){let a=[];a.push({type:"role",role:"event",optional:false});let o=n.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];o.length>0&&a.push({type:"literal",value:o[0],alternatives:o.slice(1)});let s=e.roleMarkers.destination;s&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),a.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.patient;if(l){let c=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};a.push(c);}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(u),{id:`${r.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ja(r,e,t,n,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),n.position==="after"){let s=n.primary.split(/\s+/);if(s.length>1)for(let l of s)a.push({type:"literal",value:l});else {let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(l);}}let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(o),{id:`${r.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${n.primary} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Qa(r,e,t,n){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let a=[];a.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&a.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),a.push({type:"literal",value:i[0],alternatives:i.slice(1)}),a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o?.primary){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(s),{id:`${r.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(n.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function eo(r,e,t,n,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),n.position==="after"){let c=n.primary.split(/\s+/);if(c.length>1)for(let d of c)a.push({type:"literal",value:d});else {let d=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(d);}}let s=[...r.roles.filter(c=>c.required)].sort((c,d)=>{let p=c.sovPosition??999,m=d.sovPosition??999;return p-m});for(let c of s){a.push({type:"role",role:c.role,optional:false});let d,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(d=m.primary,p=m.alternatives);}if(d){let m=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(m);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(l);let u=s.map(c=>`{${c.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${n.primary} ${u} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(c=>[c.role,{fromRole:c.role}]))}}}function to(r,e,t,n,i){let a=[],s=[...r.roles.filter(f=>f.required)].sort((f,v)=>{let y=f.sovPosition??999,g=v.sovPosition??999;return y-g}),l=s[0];a.push({type:"role",role:l.role,optional:false});let u;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)u=l.markerOverride[e.code];else {let f=e.roleMarkers[l.role];f&&(u=f.primary);}if(u&&a.push({type:"literal",value:u}),a.push({type:"role",role:"event",optional:false}),n.position==="after"){let f=n.primary.split(/\s+/);if(f.length>1)for(let v of f)a.push({type:"literal",value:v});else {let v=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(v);}}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(c);let d=s[1];a.push({type:"role",role:d.role,optional:false});let p,m;if(d.markerOverride&&d.markerOverride[e.code]!==void 0)p=d.markerOverride[e.code];else {let f=e.roleMarkers[d.role];f&&(p=f.primary,m=f.alternatives);}if(p){let f=m?{type:"literal",value:p,alternatives:m}:{type:"literal",value:p};a.push(f);}return {id:`${r.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${l.role}} {event} ${n.primary} ${t.primary} {${d.role}}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[d.role]:{fromRole:d.role}}}}function rt(r,e,t,n,i){let a=[];if(n.position==="before"){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(l);}a.push({type:"role",role:"event",optional:false});let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o),a.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&a.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${n.primary} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ro(r,e,t,n,i){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o),a.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;if(s&&a.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),n.position==="before"){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(l);}return a.push({type:"role",role:"event",optional:false}),{id:`${r.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${t.primary} {patient} ${s?.primary||""} {destination?} ${n.primary} {event}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function no(r,e,t,n,i){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let l=[...r.roles.filter(c=>c.required)].sort((c,d)=>{let p=c.svoPosition??999,m=d.svoPosition??999;return p-m});for(let c of l){let d,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(d=m.primary,p=m.alternatives);}if(d){let m=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(m);}a.push({type:"role",role:c.role,optional:false});}if(n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(c);}a.push({type:"role",role:"event",optional:false});let u=l.map(c=>`{${c.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${u} ${n.primary} {event}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(l.map(c=>[c.role,{fromRole:c.role}]))}}}function nt(r,e,t,n,i){let a=[];if(n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(c);}a.push({type:"role",role:"event",optional:false});let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let l=[...r.roles.filter(c=>c.required)].sort((c,d)=>{let p=c.svoPosition??999,m=d.svoPosition??999;return p-m});for(let c of l){let d,p;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(d=m.primary,p=m.alternatives);}if(d){let m=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(m);}a.push({type:"role",role:c.role,optional:false});}let u=l.map(c=>`{${c.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${n.primary} {event} ${t.primary} ${u}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(l.map(c=>[c.role,{fromRole:c.role}]))}}}function io(r,e,t,n,i){let a=[],o=e.eventHandler?.negationMarker;if(n.position==="before"){let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(u);}if(o){let u=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(u);}a.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(s),a.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.destination;return l&&a.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${o?.primary||""} {event} ${t.primary} {patient} ${l?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ao(r,e,t,n){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&i.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${o?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var re={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function bt(r,e,t=re){let n=`${r.action}-${e.code}-generated`,i=t.basePriority??100,a=e.keywords[r.action];if(!a)throw new Error(`No keyword translation for '${r.action}' in ${e.code}`);let o=uo(r,e,a),s=wt(r,e),l=fo(r,e,a);return {id:n,language:e.code,command:r.action,priority:i,template:{format:l,tokens:o},extraction:s}}function oo(r,e,t=re){if(r.roles.filter(s=>!s.required).length===0)return null;let i=r.roles.filter(s=>s.required),a={...r,roles:i};return {...bt(a,e,t),id:`${r.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:wt(r,e)}}function so(r,e,t=re){let n=[];if(n.push(bt(r,e,t)),t.generateSimpleVariants){let i=oo(r,e,t);i&&n.push(i);}return n}function kt(r,e=re){let t=[],n=Wa();for(let i of n){if(!r.keywords[i.action])continue;let a=so(i,r,e);if(t.push(...a),r.eventHandler?.eventMarker){let o=lo(i,r,e);t.push(...o);}}return t}function lo(r,e,t=re){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let n=[],i=e.eventHandler.eventMarker,a=e.keywords[r.action];if(!a)return [];let s=r.roles.filter(l=>l.required).length===2;if(e.wordOrder==="SOV")if(s)n.push(eo(r,e,a,i,t)),n.push(to(r,e,a,i,t));else {n.push(Ha(r,e,a,i,t)),n.push(Ya(r,e,a,i,t));let l=e.roleMarkers.destination;l&&l.primary!==i.primary&&n.push(Za(r,e,a,i,t));let u=i.primary.split(/\s+/),c=i.alternatives?.some(p=>!p.includes(" ")&&p.length>1);u.length>1&&c&&n.push(Xa(r,e,a,i,t)),n.push(Ja(r,e,a,i,t));let d=Qa(r,e,a,t);d&&n.push(d);}else e.wordOrder==="VSO"?s?(n.push(nt(r,e,a,i,t)),n.push(no(r,e,a,i,t))):(n.push(rt(r,e,a,i,t)),n.push(ro(r,e,a,i,t)),e.eventHandler?.negationMarker&&n.push(io(r,e,a,i,t)),e.tokenization?.prefixes&&n.push(ao(r,e,a,t))):s?n.push(nt(r,e,a,i,t)):n.push(rt(r,e,a,i,t));return n}function uo(r,e,t){let n=[],i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},a=co(r,e);switch(e.wordOrder){case "SVO":n.push(i),n.push(...a);break;case "SOV":n.push(...a),n.push(i);break;case "VSO":n.push(i),n.push(...a);break;default:n.push(i),n.push(...a);}return n}function co(r,e){let t=[],n=Et(r.roles,e.wordOrder);for(let i of n){let a=po(i,e);i.required?t.push(...a):t.push({type:"group",optional:true,tokens:a});}return t}function po(r,e){let t=[],n=r.markerOverride?.[e.code],i=e.roleMarkers[r.role],a={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes};if(n!==void 0)(i?.position??"before")==="before"?(n&&t.push({type:"literal",value:n}),t.push(a)):(t.push(a),n&&t.push({type:"literal",value:n}));else if(i)if(i.position==="before"){if(i.primary){let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(o);}t.push(a);}else {t.push(a);let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(o);}else t.push(a);return t}function mo(r,e){let t={};for(let n of r.roles){let i=n.markerOverride?.[e.code],a=e.roleMarkers[n.role];i!==void 0?t[n.role]=i?{marker:i}:{}:a&&a.primary?t[n.role]=a.alternatives?{marker:a.primary,markerAlternatives:a.alternatives}:{marker:a.primary}:t[n.role]={};}return t}function wt(r,e){let t=mo(r,e),n={};for(let i of r.roles){let a=t[i.role]||{};!i.required&&i.default?n[i.role]={...a,default:i.default}:n[i.role]=a;}return n}function fo(r,e,t){let n=[],a=Et(r.roles,e.wordOrder).map(o=>{let s=Ga(o,e),l="";return s&&s.primary?s.position==="before"?l=`${s.primary} {${o.role}}`:l=`{${o.role}} ${s.primary}`:l=`{${o.role}}`,o.required?l:`[${l}]`});switch(e.wordOrder){case "SVO":case "VSO":n.push(t.primary,...a);break;case "SOV":n.push(...a,t.primary);break;default:n.push(t.primary,...a);}return n.join(" ")}function pe(r){let e=r.getAttribute("data-lang");if(e)return Ce(e);let t=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return Ce(t);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?Ce(n):null}function Ce(r){return r.split("-")[0].toLowerCase()}var xt={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],call:[["patient",""]],clone:[["patient",""],["destination","into"]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],return:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["patient",""]],while:[["condition",""]]};function ie(r){switch(r.kind){case "event-handler":return ho(r);case "compound":return yo(r);default:return vo(r)}}function ho(r){let e=["on"],t=r.roles.get("event");t&&e.push(ne(t));let n=r.roles.get("source");if(n&&e.push("from",ne(n)),r.body&&r.body.length>0){let i=r.body.map(ie);e.push(i.join(" then "));}return e.join(" ")}function yo(r){let e=r.chainType==="async"?"async":r.chainType;return r.statements.map(ie).join(` ${e} `)}function vo(r){let e=xt[r.action];if(e){let n=[r.action];for(let[i,a]of e){let o=r.roles.get(i);o&&(i==="destination"&&o.type==="reference"&&o.value==="me"||(a&&n.push(a),n.push(ne(o))));}return n.join(" ")}let t=[r.action];for(let[,n]of r.roles)t.push(ne(n));return t.join(" ")}function ne(r){switch(r.type){case "literal":return typeof r.value=="string"&&r.dataType==="string"?`"${r.value}"`:String(r.value);case "selector":return r.value;case "reference":return r.value;case "property-path":return go(r);case "expression":return r.raw;case "flag":return r.enabled?`+${r.name}`:`~${r.name}`}}function go(r){let e=ne(r.object),t=r.property;if(r.object.type==="reference")switch(r.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var Tt=.5,Eo={confidenceThreshold:Tt,strategy:"semantic",fallbackToOriginal:true};function bo(r,e){return typeof r=="number"?r:r[e]??r["*"]??Tt}var ze=null;function ko(){return ze||(ze=vt()),ze}function Re(r,e,t={}){let n={...Eo,...t},i=St(r,e,n);if(i!==null)return i;let a=xo(r);if(a){let o=St(a.commands,e,n);if(o!==null)return a.prefix+o}return r}function St(r,e,t){if(t.strategy==="semantic"||t.strategy==="auto"){let n=bo(t.confidenceThreshold,e),i=At(r,e,n);if(i!==null)return i}if((t.strategy==="auto"||t.strategy==="i18n")&&t.i18nToEnglish){let n=So(r,e,t.i18nToEnglish);if(n!==null)return n}return null}var wo=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function xo(r){let e=r.match(wo);if(!e)return null;let t=e[1],n=r.slice(t.length);return n?{prefix:t,commands:n}:null}function At(r,e,t){try{let n=Ao(r,e);if(n.length>1)return Co(n,e,t);let i=ko();if(!i.supportsLanguage(e))return null;let a=i.analyze(r,e);if(!gt(a,t))return null;if(a.node)return ie(a.node);let o=Ae(r,e);return ie(o)}catch{return null}}function So(r,e,t){try{let n=t(r,e);return n!==r?n:null}catch{return null}}function To(r){let e=["then"],t=B(r);if(t?.keywords?.then){let n=t.keywords.then;if(n.primary&&n.primary!=="then"&&e.push(n.primary),n.alternatives)for(let i of n.alternatives)e.includes(i)||e.push(i);}return e}function Ao(r,e){let n=To(e).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${n.join("|")})\\s+`,"i"),a=r.split(`
|
|
4
|
+
`).map(s=>s.trim()).filter(s=>s.length>0),o=[];for(let s of a){let l=s.split(i);o.push(...l);}return o}function Co(r,e,t){let n=[];for(let i of r){let a=At(i.trim(),e,t);if(a===null)return null;n.push(a);}return n.join(" then ")}function Pe(r={}){return function(t){let{internals:n}=t,i=n.runtime,a=i.getScript.bind(i);i.getScript=function(o){let s=a(o);if(!s)return null;let l=zo(o,r);if(!l||l==="en")return s;let u=Re(s,l,r);return r.debug&&u!==s&&console.log(`[hyperscript-i18n] ${l}: "${s}" \u2192 "${u}"`),u};}}function zo(r,e){if(e.languageAttribute){let n=r.getAttribute(e.languageAttribute);if(n)return n.split("-")[0].toLowerCase()}let t=pe(r);return t||(e.defaultLanguage??null)}function Ct(r,e,t={}){return e==="en"?r:Re(r,e,t)}pt(r=>kt(r));function zt(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Pe()),Ro());}function Ro(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let t=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(t).forEach(n=>{let i=e.getInternalData(n);i.initialized&&(i.initialized=false);}),e.processNode(document.body);}var Rl=["id","ms","tl","th","vi"];zt();exports.plugin=Pe;exports.preprocess=Ct;exports.resolveLanguage=pe;exports.supportedLanguages=Rl;return exports;})({});
|