text: async function htmlWidget(e,t,a){const r={colour:{add:async(e,t,a)=>{const r=t.split("-"),l=2==r.length?"Color.dynamic("+await w(r[0])+","+await w(r[1])+")":await w(r[0]);i+=`\n${a}.${e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())} = ${l}`},validate:()=>{}},posInt:{add:(e,t,a)=>{i+="refresh-after-date"==e?`\nlet date = new Date()\ndate.setMinutes(date.getMinutes() + ${/\d+/.exec(t)})\nwidget.refreshAfterDate = date`:`\n${a}.${e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())} = ${/\d+/.exec(t)}`},validate:(e,t,a)=>{/^\s*\d+\s*$/.test(a)||k(1,e,t?"attribute":"property",a)}},decimal:{add:(e,t,a)=>{(t=/\d*(?:\.\d*)?%?/.exec(t)[0]).endsWith("%")&&(t=Number(t.replace("%","")),t/=100),i+=`\n${a}.${e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())} = ${t}`},validate:(e,t,a)=>{let r=/^\s*(\d*(?:\.\d*)?)%?\s*$/;(!a.match(r)||a.match(r)&&["","."].includes(a.match(r)[1]))&&k(2,e,t?"attribute":"property",a)}},gradient:{add:async(e,t,a)=>{s++;let r,l=t;l=l.split(/,(?![^(]*\))(?![^"']*["'](?:[^"']*["'][^"']*["'])*[^"']*$)/).map(e=>e.trim());const n={"to left":90,"to right":270,"to top":180,"to bottom":0,"to top left":135,"to top right":225,"to bottom left":45,"to bottom right":315,"to left top":135,"to right top":225,"to left bottom":45,"to right bottom":315};r=Object.keys(n).includes(l[0])?n[l.shift()]:/\d+\s*deg/.test(l[0])?Number(l.shift().match(/(\d+)\s*deg/)[1]):0;let o=[];for(let e of l)2==(e=(e=e.replace(/\d*(\.\d+)?%?$/,"")).split("-")).length?o.push(Color.dynamic(await w(e[0]),await w(e[1]))):o.push(await w(e[0]));let d=l.map(e=>/\d*(\.\d+)?%?$/.test(e)?e.match(/\d*(\.\d+)?%?$/)[0]:null).map(e=>(e&&e.endsWith("%")&&(e=Number(e.replace("%",""))/100),!isNaN(e)&&!isNaN(parseFloat(e))||"number"==typeof e?Number(e):null));d[0]||(d[0]=0),d[d.length-1]||(d[d.length-1]=1);for(let e=0;e<d.length;e++){if(d[e]){let t=0,a=e;for(;null===d[a];)t++,a++;let r=(d[a]-d[e-1])/(t+1);for(let a=0;a<t;a++)d[a+e]=r*(a+1)+d[e-1]}}i+=`\nlet gradient${s} = new LinearGradient()\ngradient${s}.colors = [${o}]\ngradient${s}.locations = [${d}]\ngradient${s}.startPoint = ${`new Point(${1-(.5+.5*Math.cos(Math.PI*(r+90)/180))}, ${1-(.5+.5*Math.sin(Math.PI*(r+90)/180))})`}\ngradient${s}.endPoint = ${`new Point(${.5+.5*Math.cos(Math.PI*(r+90)/180)}, ${.5+.5*Math.sin(Math.PI*(r+90)/180)})`}\n${a}.backgroundGradient = gradient${s}`},validate:(e,t,a)=>{let r=a;r=r.split(/,(?![^(]*\))(?![^"']*["'](?:[^"']*["'][^"']*["'])*[^"']*$)/).map(e=>e.trim());["to left","to right","to top","to bottom","to top left","to top right","to bottom left","to bottom right","to left top","to right top","to left bottom","to right bottom"].includes(r[0])?r.shift():/\d+\s*deg/.test(r[0])&&r.shift();let l=r.map(e=>/\d*(\.\d+)?%?$/.test(e)?e.match(/\d*(\.\d+)?%?$/)[0]:null).map(e=>(e&&e.endsWith("%")&&(e=Number(e.replace("%",""))/100),!isNaN(e)&&!isNaN(parseFloat(e))||"number"==typeof e?Number(e):null));l[0]||(l[0]=0),l[l.length-1]||(l[l.length-1]=1);let n=0;for(let r=0;r<l.length;r++){let i=l[r];i&&(n>i&&k(3,e,t?"attribute":"property",a),i<0&&k(4,e,t?"attribute":"property",a),i>1&&k(5,e,t?"attribute":"property",a),n=i)}}},padding:{add:(e,t,a)=>{"default"==t?i+=`\n${a}.useDefaultPadding()`:(paddingArray=t.match(/\d+/g),1==paddingArray.length?paddingArray=[paddingArray[0],paddingArray[0],paddingArray[0],paddingArray[0]]:2==paddingArray.length&&(paddingArray=[paddingArray[0],paddingArray[1],paddingArray[0],paddingArray[1]]),i+=`\n${a}.setPadding(${paddingArray.join(",")})`)},validate:(e,t,a)=>{/^\s*\d+((\s*,\s*\d+){3}|(\s*,\s*\d+))?\s*$|^default$/g.test(a)||k(6,e,t?"attribute":"property",a)}},size:{add:(e,t,a)=>{i+=`\n${a}.${e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())} = new Size(${t.match(/\d+/g)[0]},${t.match(/\d+/g)[1]})`},validate:(e,t,a)=>{/^\s*\d+\s*,\s*\d+\s*$/.test(a)||k(7,e,t?"attribute":"property",a)}},font:{add:(e,t,a)=>{let r=/^\s*(((black|bold|medium|light|heavy|regular|semibold|thin|ultraLight)(MonospacedSystemFont|RoundedSystemFont|SystemFont)\s*,\s*(\d+))|(body|callout|caption1|caption2|footnote|subheadline|headline|largeTitle|title1|title2|title3)|((italicSystemFont)\s*,\s*(\d+)))\s*$/;r.test(t)?i+=`\n${a}.font = Font.${t.replace(r,"$3$4$6$8($5$9)")}`:i+=`\n${a}.font = new Font("${t.split(",")[0].replace(/"/g,"")}",${t.split(",")[1].match(/\d+/g)[0]})`},validate:(e,t,a)=>{/^\s*[^,]+,\s*\d+\s*$/.test(a)||["body","callout","caption1","caption2","footnote","subheadline","headline","italicSystemFont","largeTitle","title1","title2","title3"].includes(a)||k(8,e,t?"attribute":"property",a)}},point:{add:(e,t,a)=>{i+=`\n${a}.shadowOffset = new Point(${t.split(",")[0].match(/-?\d+/)[0]},${t.split(",")[1].match(/-?\d+/)[0]})`},validate:(e,t,a)=>{/^\s*-?\d+\s*,\s*-?\d+\s*$/.test(a)||k(9,e,t?"attribute":"property",a)}},bool:{add:(e,t,a)=>{"resizable"==e&&"false"!==t&&(i+=`\n${a}.resizable = false`),"container-relative-shape"==e&&"false"!==t&&(i+=`\n${a}.containerRelativeShape = true`)},validate:()=>{}},url:{add:(e,t,a)=>{i+=`\n${a}.url = "${t.replace(/"/g,"")}"`},validate:(e,t,a)=>{/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/.test(a)||k(10,e,t?"attribute":"property",a)}},image:{add:(e,t,a)=>{t.startsWith("data:image/")?i+=`\n${a}.backgroundImage = Image.fromData(Data.fromBase64String("${t.replace(/data:image\/\w+?;base64,/,"").replace(/"/g,"")}"))`:i+=`\n${a}.backgroundImage = await new Request("${t.replace(/"/g,"")}").loadImage()`},validate:(e,t,a)=>{/^(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))|(data:image\/\w+?;base64,[a-zA-Z0-9+/]+={0,2})$/.test(a)||k(26,e,t?"attribute":"property",a)}},layout:{add:(e,t,a)=>{i+=`\n${a}.layout${"vertically"==t?"Vertically":"Horizontally"}()`},validate:(e,t,a)=>{"vertically"!=a&&"horizontally"!=a&&k(11,e,t?"attribute":"property",a)}},alignText:{add:(e,t,a)=>{i+=`\n${a}.${t}AlignText()`},validate:(e,t,a)=>{["center","left","right"].includes(a)||k(12,e,t?"attribute":"property",a)}},alignImage:{add:(e,t,a)=>{i+=`\n${a}.${t}AlignImage()`},validate:(e,t,a)=>{["center","left","right"].includes(a)||k(12,e,t?"attribute":"property",a)}},alignContent:{add:(e,t,a)=>{i+=`\n${a}.${t}AlignContent()`},validate:(e,t,a)=>{["center","top","bottom"].includes(a)||k(13,e,t?"attribute":"property",a)}},applyStyle:{add:(e,t,a)=>{i+=`\n${a}.apply${t[0].toUpperCase()+t.slice(1)}Style()`},validate:(e,t,a)=>{["date","timer","offset","relative","time"].includes(a)||k(14,e,t?"attribute":"property",a)}},contentMode:{add:(e,t,a)=>{i+=`\n${a}.apply${t[0].toUpperCase()+t.slice(1)}ContentMode()`},validate:(e,t,a)=>{["filling","fitting"].includes(a)||k(15,e,t?"attribute":"property",a)}}};function l(e){let t=new XMLParser(e),a={isRoot:!0,name:"root",children:[]},r=a,l={};return t.didStartElement=((e,t)=>{let a=Symbol("unique");l[a]=r;let n={name:e,attrs:t,innerText:"",children:[],end:a};r.children.push(n),r=n}),t.foundCharacters=(e=>{r.innerText+=""===r.innerText?e:" "+e}),t.didEndElement=(e=>{sym=r.end,delete r.end,r=l[sym]}),t.parseErrorOccurred=(()=>{k(14)}),a.isRoot||k(25,a.name),t.parse(),a}let n,i="",o={},s=-1,d=l(e).children.filter(e=>{if("widget"==e.name)return e})[0];d||k(17);let c=d.children.filter(e=>"style"==e.name),g="";for(let e of c)g+="\n"+e.innerText;let p=[],u=g.match(/[\s\S]+?{[\s\S]*?}/g)||[];for(let e=0;e<u.length;e++){let t=u[e];/^\s*(\.?[\w\-]+|\*)(\s*[,>]\s*(\.?[\w\-]+|\*))*\s*\{(\s*[\w\-]+\s*:\s*[^\n]+?\s*;)*?\s*([\w\-]+\s*:\s*[^\n]+\s*;?)?\s*\}/.test(t)||k(18,t.trim());let a={};t.match(/\{([\s\S]*)\}/)[1].split(";").map(e=>e.trim()).filter(e=>e).forEach(e=>{a[e.split(/:/)[0].trim()]=e.substring(e.indexOf(":")+1).trim()});let r=t.match(/(\.?[\w\-]+|\*)(\s*[>,]\s*(\.?[\w\-]+|\*))*/)[0].split(",");for(let e of r)p.push({selector:f(e.trim()),css:a})}function f(e){e=e.trim();let t=0,a=[],r=a.push({classes:[]});for(;t<e.length;){let l=e[t];if("."===l){l=e[++t];let n=/[-a-zA-Z_0-9]/;if(!n.test(l))throw new Error("A css parse error: `"+e+"`");let i="";for(;l&&n.test(l);)i+=l,l=e[++t];a[r-1].classes.push(i)}let n=/ /;if(/>/.test(l)){for(l=e[++t];l&&n.test(l);)l=e[++t];r=a.push({classes:[]})}let i=/[a-z]/i;if(i.test(l)){let n="";for(;l&&i.test(l);)n+=l,l=e[++t];a[r-1].tag=n}/\*/.test(l)&&(l=e[++t],a[r-1].tag="*"),n.test(l)&&(l=e[++t])}return a}for(let e of p)m(d,e);function m(e,t){if("style"!=e.name&&(function e(t,a,r){if("style"==t.name)return;for(let e of a.selector[r].classes){if(!t.attrs.class)return;if(!t.attrs.class.split(" ").includes(e))return}if(a.selector[r].tag&&"*"!==a.selector[r].tag&&a.selector[r].tag!==t.name)return;if(a.selector.length-1===r)t.css||(t.css=[]),t.css.push(a);else if(t.children)for(let l of t.children)e(l,a,r+1)}(e,t,0),e.children))for(let a of e.children)m(a,t)}await async function e(t){if("Text"==t.type||"style"==t.name)return;"widget"==t.name&&i&&k(19);o[t.name]||0==o[t.name]?o[t.name]++:o[t.name]=0;let s=o[t.name];let d=t.innerText.replace(/&lt;/g,"<").replace(/&gt/g,">").replace(/&amp;/g,"&").replace(/\n\s+/g,"\\n");let c={};for(let e of Object.keys(t.attrs)){let a=t.attrs[e].trim();"class"!==e&&(c[e]=a)}let g={};if(t.css)for(let e of t.css)if(!Object.keys(t.attrs).includes("no-css"))for(let t of Object.keys(e.css))delete g[t],g[t]=e.css[t];for(let e of Object.keys(c))delete g[e],g[e]=c[e];let p,u,f;switch(t.name){case"spacer":return i+=`\nlet spacer${s} = ${n}.addSpacer(${c.space&&"null"!==c.space?c.space:""})`,void y(c,g,p={space:"posInt"});case"widget":i+="let widget = new ListWidget()",y(c,g,p={background:["gradient","image","colour"],"refresh-after-date":"posInt",spacing:"posInt",url:"url",padding:"padding"});for(let e of Object.keys(g)){let t=g[e],a="widget";if("background"==e&&"null"!==t&&"no-css"!=e&&"children"!=e)try{r.url.validate("background",!0,t),r.image.add(e,t,a)}catch(e){1===t.split(/,(?![^(]*\))(?![^"']*["'](?:[^"']*["'][^"']*["'])*[^"']*$)/).length?await r.colour.add("background-color",t,a):await r.gradient.add("background-gradient",t,a)}else"null"!=t&&"children"!=e&&"no-css"!=e&&await r[p[e]].add(e,t,a)}u=i.split("\n").length;for(let a of t.children)n="widget",await e(a);for(let e=(f=i.split("\n")).length-1;e>=0&&e!=u-1;e--)f[e]="  "+f[e];return void(i=f.join("\n"));case"stack":i+=`\nlet stack${s} = ${n}.addStack()`,y(c,g,p={background:["gradient","image","colour"],spacing:"posInt",url:"url",padding:"padding","border-color":"colour","border-width":"posInt",size:"size","corner-radius":"posInt","align-content":"alignContent",layout:"layout"});for(let e of Object.keys(g)){let t=g[e],a="stack"+s;if("background"==e&&"null"!==t&&"children"!=e&&"no-css"!=e)try{r.image.validate("background",!0,t),r.image.add(e,t,a)}catch(e){1===t.split(/,(?![^(]*\))(?![^"']*["'](?:[^"']*["'][^"']*["'])*[^"']*$)/).length?await r.colour.add("background-color",t,a):await r.gradient.add("background-gradient",t,a)}else"null"!=t&&"children"!=e&&"no-css"!=e&&await r[p[e]].add(e,t,a)}u=i.split("\n").length;let o="stack"+s;for(let a of t.children)n=o,await e(a);for(let e=(f=i.split("\n")).length-1;e>=0&&e!=u-1;e--)f[e]="  "+f[e];return void(i=f.join("\n"));case"img":let m;c.src&&"null"!=c.src||k(20),m=c.src.startsWith("data:image/")?`Image.fromData(Data.fromBase64String("${c.src.replace("data:image/png;base64,","").replace("data:image/jpeg;base64,","").replace(/"/g,"")}"))`:`await new Request("${c.src.replace(/"/g,"")}").loadImage()`,i+=`\nlet img${s} = ${n}.addImage(${m})`,y(c,g,p={src:"image",url:"url","border-color":"colour","border-width":"posInt","corner-radius":"posInt","image-size":"size","image-opacity":"decimal","tint-color":"colour",resizable:"bool","container-relative-shape":"bool","content-mode":"contentMode","align-image":"alignImage"});for(let e of Object.keys(g)){if("src"==e)continue;let t=g[e],a="img"+s;"null"!=t&&"children"!=e&&"no-css"!=e&&await r[p[e]].add(e,t,a)}return;case"text":i+=`\nlet text${s} = ${n}.addText("${d.replace(/"/g,"")}")`,y(c,g,p={url:"url",font:"font","line-limit":"posInt","minimum-scale-factor":"decimal","shadow-color":"colour","shadow-offset":"point","shadow-radius":"posInt","text-color":"colour","text-opacity":"decimal","align-text":"alignText"});for(let e of Object.keys(g)){let t=g[e],a="text"+s;"null"!=t&&"children"!=e&&"no-css"!=e&&await r[p[e]].add(e,t,a)}return;case"date":i+=`\nlet date${s} = ${n}.addDate(new Date("${d.replace(/"/g,"")}"))`,y(c,g,p={url:"url",font:"font","line-limit":"posInt","minimum-scale-factor":"decimal","shadow-color":"colour","shadow-offset":"point","shadow-radius":"posInt","text-color":"colour","text-opacity":"decimal","align-text":"alignText","apply-style":"applyStyle"});for(let e of Object.keys(g)){let t=g[e],a="date"+s;"null"!=t&&"children"!=e&&"no-css"!=e&&await r[p[e]].add(e,t,a)}return;default:return Object.keys(a).includes(t.name)||k(21,t.name),i+=`\n// <${t.name}>`,await a[t.name](y,async function(a){let r=l(a);r.children=r.children.map(e=>(function e(t,a){t.children&&t.children.map(t=>{e(t,a)});if(Object.keys(t.attrs).includes("children"))for(let e of a)t.children.push(e);t.attrs["no-css"]="";return t})(e,t.children));u=i.split("\n").length;for(let t of r.children){await e(t)}for(let e=(f=i.split("\n")).length-1;e>=0&&e!=u-1;e--)f[e]="  "+f[e];i=f.join("\n")},$,g,c,d),void(i+=`\n// </${t.name}>`)}}(d),1==t&&console.log(i);let h=new(0,Object.getPrototypeOf(async function(){}).constructor)(i+"\nreturn widget");return await h();async function b(e){if(e.type=="Text"||e.name=="style"){return}if(e.name=="widget"&&i){k(19)}if(o[e.name]||o[e.name]==0){o[e.name]++}else{o[e.name]=0}let t=o[e.name];let s=e.innerText.replace(/&lt;/g,"<").replace(/&gt/g,">").replace(/&amp;/g,"&").replace(/\n\s+/g,"\\n");let d={};for(let t of Object.keys(e.attrs)){let a=e.attrs[t].trim();if(t!=="class"){d[t]=a}}let c={};if(e.css){for(let t of e.css){if(!Object.keys(e.attrs).includes("no-css")){for(let e of Object.keys(t.css)){delete c[e];c[e]=t.css[e]}}}}for(let e of Object.keys(d)){delete c[e];c[e]=d[e]}let g,p,u;switch(e.name){case"spacer":i+=`\nlet spacer${t} = ${n}.addSpacer(${d.space&&d.space!=="null"?d.space:""})`;g={space:"posInt"};y(d,c,g);return;break;case"widget":i+=`let widget = new ListWidget()`;g={background:["gradient","image","colour"],"refresh-after-date":"posInt",spacing:"posInt",url:"url",padding:"padding"};y(d,c,g);for(let e of Object.keys(c)){let t=c[e];let a="widget";if(e=="background"&&t!=="null"&&e!="no-css"&&e!="children"){try{r.url.validate("background",true,t);r.image.add(e,t,a)}catch(e){if(t.split(/,(?![^(]*\))(?![^"']*["'](?:[^"']*["'][^"']*["'])*[^"']*$)/).length===1){await r.colour.add("background-color",t,a)}else{await r.gradient.add("background-gradient",t,a)}}}else if(t!="null"&&e!="children"&&e!="no-css"){await r[g[e]].add(e,t,a)}}p=i.split("\n").length;for(let t of e["children"]){n="widget";await b(t)}u=i.split("\n");for(let e=u.length-1;e>=0;e--){if(e==p-1){break}u[e]="  "+u[e]}i=u.join("\n");return;break;case"stack":i+=`\nlet stack${t} = ${n}.addStack()`;g={background:["gradient","image","colour"],spacing:"posInt",url:"url",padding:"padding","border-color":"colour","border-width":"posInt",size:"size","corner-radius":"posInt","align-content":"alignContent",layout:"layout"};y(d,c,g);for(let e of Object.keys(c)){let a=c[e];let l="stack"+t;if(e=="background"&&a!=="null"&&e!="children"&&e!="no-css"){try{r.image.validate("background",true,a);r.image.add(e,a,l)}catch(e){if(a.split(/,(?![^(]*\))(?![^"']*["'](?:[^"']*["'][^"']*["'])*[^"']*$)/).length===1){await r.colour.add("background-color",a,l)}else{await r.gradient.add("background-gradient",a,l)}}}else if(a!="null"&&e!="children"&&e!="no-css"){await r[g[e]].add(e,a,l)}}p=i.split("\n").length;let o="stack"+t;for(let t of e["children"]){n=o;await b(t)}u=i.split("\n");for(let e=u.length-1;e>=0;e--){if(e==p-1){break}u[e]="  "+u[e]}i=u.join("\n");return;break;case"img":let m;if(!d["src"]||d["src"]=="null"){k(20)}if(d["src"].startsWith("data:image/")){m=`Image.fromData(Data.fromBase64String("${d["src"].replace("data:image/png;base64,","").replace("data:image/jpeg;base64,","").replace(/"/g,"")}"))`}else{m=`await new Request("${d["src"].replace(/"/g,"")}").loadImage()`}i+=`\nlet img${t} = ${n}.addImage(${m})`;g={src:"image",url:"url","border-color":"colour","border-width":"posInt","corner-radius":"posInt","image-size":"size","image-opacity":"decimal","tint-color":"colour",resizable:"bool","container-relative-shape":"bool","content-mode":"contentMode","align-image":"alignImage"};y(d,c,g);for(let e of Object.keys(c)){if(e=="src"){continue}let a=c[e];let l="img"+t;if(a!="null"&&e!="children"&&e!="no-css"){await r[g[e]].add(e,a,l)}}return;break;case"text":i+=`\nlet text${t} = ${n}.addText("${s.replace(/"/g,"")}")`;g={url:"url",font:"font","line-limit":"posInt","minimum-scale-factor":"decimal","shadow-color":"colour","shadow-offset":"point","shadow-radius":"posInt","text-color":"colour","text-opacity":"decimal","align-text":"alignText"};y(d,c,g);for(let e of Object.keys(c)){let a=c[e];let l="text"+t;if(a!="null"&&e!="children"&&e!="no-css"){await r[g[e]].add(e,a,l)}}return;break;case"date":i+=`\nlet date${t} = ${n}.addDate(new Date("${s.replace(/"/g,"")}"))`;g={url:"url",font:"font","line-limit":"posInt","minimum-scale-factor":"decimal","shadow-color":"colour","shadow-offset":"point","shadow-radius":"posInt","text-color":"colour","text-opacity":"decimal","align-text":"alignText","apply-style":"applyStyle"};y(d,c,g);for(let e of Object.keys(c)){let a=c[e];let l="date"+t;if(a!="null"&&e!="children"&&e!="no-css"){await r[g[e]].add(e,a,l)}}return;break;default:if(!Object.keys(a).includes(e.name)){k(21,e["name"])}i+=`\n// <${e.name}>`;await a[e.name](y,f,$,c,d,s);i+=`\n// </${e.name}>`;return;async function f(t){let a=l(t);a.children=a.children.map(t=>o(t,e.children));let r=n;p=i.split("\n").length;for(let e of a.children){let t=r;await b(e)}for(let e=(u=i.split("\n")).length-1;e>=0;e--){if(e==p-1){break}u[e]="  "+u[e]}function o(e,t){if(e.children){e.children.map(e=>{o(e,t)})}if(Object.keys(e.attrs).includes("children")){for(let a of t){e.children.push(a)}}e.attrs["no-css"]="";return e}i=u.join("\n")}}}function y(e,t,a){for(let t of Object.keys(e))if("null"!=e[t]&&"children"!=t&&"no-css"!=t)if(a[t]||k(22,t),"string"==typeof a[t])r[a[t]].validate(t,!0,e[t]);else{let l=!1;for(let n of a[t])try{r[n].validate(t,!0,e[t]),l=!0}catch(e){}!1===l&&k(23,t,a[t].join(", ").replace(/,([^,]*?)$/," or$1"),e[t])}for(let e of Object.keys(t))if("null"!=t[e]&&"children"!=e&&"no-css"!=e)if(a[e])if("string"==typeof a[e])r[a[e]].validate(e,!1,t[e]);else{let l=!1;for(let n of a[e])try{r[n].validate(e,!1,t[e]),l=!0}catch(e){}!1===l&&k(24,attr,a[e].join(", ").replace(/,([^,]*?)$/," or$1"),t[e])}else delete t[e]}function $(e,t){for(let a of Object.keys(t))Object.keys(e).includes(a)||(e[a]="null");return e}async function w(e){let t=new WebView;return await t.loadHTML(`<div id="div"style="color:${e}"></div>`),function(e,t,a,r){e=e.toString(16),t=t.toString(16),a=a.toString(16),1==e.length&&(e="0"+e);1==t.length&&(t="0"+t);1==a.length&&(a="0"+a);r=r?1==r.length?",0"+r:","+r:"";return`new Color("${"#"+e+t+a}"${r})`}(...(await t.evaluateJavaScript('window.getComputedStyle(document.getElementById("div")).color')).match(/\d+(\.\d+)?/g).map(e=>Number(e)))}function k(e){let t={1:"`{}` {} must be a positive integer: `{}`",2:"`{}` {} must be a positive integer or float with an optional `%` at the end: `{}`",3:"`{}` {} locations must be in ascending order: `{}`",4:"`{}` {} locations must be equal or greater than `0`: `{}`",5:"`{}` {} locations must be equal or less than `1`: `{}`",6:"`{}` {} must be 1, 2 or 4 positive integers separated by commas or be `default`: `{}`",7:"`{}` {} must be 2 positive integers separated by commas: `{}`",8:"`{}` {} must be 1 font name and 1 positive integer separated by commas or be a content-based font: `{}`",9:"`{}` {} must be 2 integers separated by commas: `{}`",10:"`{}` {} must be a valid URL: `{}`",11:"`{}` {} must be `vertically` or `horizontally`: `{}`",12:"`{}` {} must be `left`, `right` or `center`: `{}`",13:"`{}` {} must be `top`, `bottom` or `center`: `{}`",15:"`{}` {} must be `date`, `timer` , `relative`, `time`, or `offset`: `{}`",16:"`{}` {} must be `filling` or `fitting`: `{}`",17:"`widget` tag must be the root tag",18:"Invalid CSS rule: `{}`",19:"`widget` tag must not be nestled",20:"`img` tag must have a `src` attribute",21:"Invalid tag name: `{}`",22:"Unknown attribute: `{}`",23:"`{}` attribute must be a {} type: `{}`",24:"`{}` property must be a {} type: `{}`",26:"`{}` {} must be a valid url or base encoded data link: `{}`",14:"A parse error occurred, ensure your widget is formatted properly.",25:"A parse error occurred, ensure all self closing tages are closed: <{}>"}[e],a=[...arguments];a.splice(0,1);for(let e of a)t=t.replace("{}",e);throw new Error(t)}}
  