@lokascript/hyperscript-adapter 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +147 -0
- package/dist/hyperscript-i18n-ar.global.js +4 -0
- package/dist/hyperscript-i18n-bn.global.js +4 -0
- package/dist/hyperscript-i18n-de.global.js +4 -0
- package/dist/hyperscript-i18n-east-asian.global.js +4 -0
- package/dist/hyperscript-i18n-en.global.js +6 -0
- package/dist/hyperscript-i18n-es.global.js +4 -0
- package/dist/hyperscript-i18n-fr.global.js +4 -0
- package/dist/hyperscript-i18n-he.global.js +4 -0
- package/dist/hyperscript-i18n-hi.global.js +4 -0
- package/dist/hyperscript-i18n-id.global.js +4 -0
- package/dist/hyperscript-i18n-it.global.js +4 -0
- package/dist/hyperscript-i18n-ja.global.js +4 -0
- package/dist/hyperscript-i18n-ko.global.js +4 -0
- package/dist/hyperscript-i18n-lite.global.js +1 -0
- package/dist/hyperscript-i18n-ms.global.js +4 -0
- package/dist/hyperscript-i18n-pl.global.js +4 -0
- package/dist/hyperscript-i18n-pt.global.js +4 -0
- package/dist/hyperscript-i18n-qu.global.js +4 -0
- package/dist/hyperscript-i18n-ru.global.js +4 -0
- package/dist/hyperscript-i18n-slavic.global.js +4 -0
- package/dist/hyperscript-i18n-south-asian.global.js +4 -0
- package/dist/hyperscript-i18n-southeast-asian.global.js +4 -0
- package/dist/hyperscript-i18n-sw.global.js +4 -0
- package/dist/hyperscript-i18n-th.global.js +4 -0
- package/dist/hyperscript-i18n-tl.global.js +4 -0
- package/dist/hyperscript-i18n-tr.global.js +4 -0
- package/dist/hyperscript-i18n-uk.global.js +4 -0
- package/dist/hyperscript-i18n-vi.global.js +4 -0
- package/dist/hyperscript-i18n-western.global.js +4 -0
- package/dist/hyperscript-i18n-zh.global.js +4 -0
- package/dist/hyperscript-i18n.global.js +8 -0
- package/dist/hyperscript-i18n.global.js.map +1 -0
- package/dist/index.cjs +203 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +99 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.js +179 -0
- package/dist/index.js.map +1 -0
- package/package.json +169 -0
- package/src/browser-lite.ts +159 -0
- package/src/browser.ts +74 -0
- package/src/bundles/ar.ts +6 -0
- package/src/bundles/bn.ts +6 -0
- package/src/bundles/de.ts +6 -0
- package/src/bundles/east-asian.ts +8 -0
- package/src/bundles/en.ts +6 -0
- package/src/bundles/es.ts +6 -0
- package/src/bundles/fr.ts +6 -0
- package/src/bundles/he.ts +6 -0
- package/src/bundles/hi.ts +6 -0
- package/src/bundles/id.ts +6 -0
- package/src/bundles/it.ts +6 -0
- package/src/bundles/ja.ts +6 -0
- package/src/bundles/ko.ts +6 -0
- package/src/bundles/ms.ts +6 -0
- package/src/bundles/pl.ts +6 -0
- package/src/bundles/pt.ts +6 -0
- package/src/bundles/qu.ts +6 -0
- package/src/bundles/ru.ts +6 -0
- package/src/bundles/shared.ts +65 -0
- package/src/bundles/slavic.ts +8 -0
- package/src/bundles/south-asian.ts +7 -0
- package/src/bundles/southeast-asian.ts +10 -0
- package/src/bundles/sw.ts +6 -0
- package/src/bundles/th.ts +6 -0
- package/src/bundles/tl.ts +6 -0
- package/src/bundles/tr.ts +6 -0
- package/src/bundles/uk.ts +6 -0
- package/src/bundles/vi.ts +6 -0
- package/src/bundles/western.ts +9 -0
- package/src/bundles/zh.ts +6 -0
- package/src/derive-syntax.ts +126 -0
- package/src/generated/syntax-table.ts +61 -0
- package/src/hyperscript-renderer.ts +150 -0
- package/src/index.ts +27 -0
- package/src/language-resolver.ts +41 -0
- package/src/plugin.ts +119 -0
- package/src/preprocessor.ts +251 -0
- package/src/slim-plugin.ts +60 -0
- package/src/slim-preprocessor.ts +190 -0
|
@@ -0,0 +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 Na(e,n,r){let t=[];for(let i of e){let a=Gt(i.trim(),n,r);if(a===null)return null;t.push(a);}return t.join(" then ")}function De(e={}){return function(r){let{internals:t}=r,i=t.runtime,a=i.getScript.bind(i);i.getScript=function(o){let s=a(o);if(!s)return null;let l=Ia(o,e);if(!l||l==="en")return s;let c=Oe(s,l,e);return e.debug&&c!==s&&console.log(`[hyperscript-i18n] ${l}: "${s}" \u2192 "${c}"`),c};}}function Ia(e,n){if(n.languageAttribute){let t=e.getAttribute(n.languageAttribute);if(t)return t.split("-")[0].toLowerCase()}let r=ke(e);return r||(n.defaultLanguage??null)}function Ht(e,n,r={}){return n==="en"?e:Oe(e,n,r)}Nt(e=>qt(e));function Qt(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(De()),Oa());}function Oa(){if(typeof document>"u")return;let n=_hyperscript?.internals?.runtime;if(!n?.processNode||!n?.getInternalData)return;let r=n.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(r).forEach(t=>{let i=n.getInternalData(t);i.initialized&&(i.initialized=false);}),n.processNode(document.body);}var To=["id","ms","tl","th","vi"];Qt();exports.plugin=De;exports.preprocess=Ht;exports.resolveLanguage=ke;exports.supportedLanguages=To;return exports;})({});
|