fscss 1.1.17 → 1.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -93,7 +93,7 @@ Or locally to your project:
93
93
 
94
94
  **Browser CDN**
95
95
  ```html
96
- <script src="https://cdn.jsdelivr.net/npm/fscss@1.1.17/exec.min.js" defer></script>
96
+ <script src="https://cdn.jsdelivr.net/npm/fscss@1.1.18/exec.min.js" defer></script>
97
97
  ```
98
98
  Usage
99
99
 
package/e/exec.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* Figsh-fscss light, source v3, fscss.devtem.org */
2
- function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e=e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e=e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return e=(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={};function r(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}const s=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;let t;for(;null!==(t=s.exec(e));){const e=t[1],s=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:s,props:r(s)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function h(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0;let o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function x(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),e=(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function b(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const e of s){const[r,s,c]=e;if(o=s,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=s.replace(/["']/g,""),o=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(o))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const i=await fetch(e);if(!i.ok)throw new Error(`fscss[@import] HTTP ${i.status} for ${s}`);const a=v(await i.text(),c.trim());t=t.replace(r,a)}catch(e){console.error(`fscss[@import] Failed: ${s} `,e),t=t.replace(r,`/* Failed import: ${s} */`)}}return t.match(r)?(i.add(o),b(t)):t}function v(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const S=new Set;async function y(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,c,i]=e;const a=(r||o||c||i).trim();if(t=a,S.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(a);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${a}`);const r=await e.text();s=s.replace(n,r)}catch(e){console.error(`fscss[@import] Failed: ${a} `,e),s=s.replace(n,`/* Failed import: ${a} */`)}}return s.match(n)?(S.add(t),y(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,i,a]=e;r=r.trim();const l=(o||i||a).trim();if(t=l,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const t=await e.text();if("*"===r&&(s=s.replace(n,t)),"*"!==r&&r.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),s=s.replace(n,"/* syntax error: unexpected * */")),"*"!==r&&!r.includes("*")){const e=j(t,r.split(",").map((e=>e.trim())));s=s.replace(n,e)}}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(n,`/* Failed import: ${l} */`)}}return s.match(n)?(c.add(t),k(s)):s}function j(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await b(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await y(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=w(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=x(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
2
+ function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={},r=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;function s(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}let t;for(;null!==(t=r.exec(e));){const e=t[1],r=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:r,props:s(r)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(r,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n={},r=/@obj\s+([\w\-\_\—0-9]+)\s*\{([\s\S]*?)\}\s*/g;function s(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@obj] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@obj] Empty property name in line: "${e}"`)}return n}let t;for(;null!==(t=r.exec(e));){const e=t[1],r=t[2].trim();n[e]&&console.warn(`fscss[@obj] Duplicate @obj variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:r,props:s(r)}}let o=e;return o=o.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@obj] Value extraction failed for "@obj.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@obj] Single property rule failed for "@obj.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@obj\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@obj] Full variable block replacement failed for "@obj.${r}". Variable not found.`),e))),o=o.replace(r,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function h(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));return n.size>0?r+`\n:root{${Array.from(n).join("\n")}\n}`:r}function x(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0,o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function b(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function v(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const r of s){const[s,c,a]=r;if(o=c,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=c.replace(/["']/g,""),r=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(r))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const o=await fetch(e);if(!o.ok)throw new Error(`fscss[@import] HTTP ${o.status} for ${c}`);const i=S(await o.text(),a.trim());t=t.replace(s,i)}catch(e){console.error(`fscss[@import] Failed: ${c} `,e),t=t.replace(s,`/* Failed import: ${c} */`)}}return t.match(r)?(i.add(o),v(t)):t}function S(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const y=new Set;async function j(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const n of r){let[r,o,c,i,a]=n;const l=(o||c||i||a).trim();if(t=l,y.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const n=await e.text();s=s.replace(r,n)}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(r,`/* Failed import: ${l} */`)}}return s.match(n)?(y.add(t),j(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const n of r){let[r,o,i,a,l]=n;o=o.trim();const f=(i||a||l).trim();if(t=f,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(f);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${f}`);const n=await e.text();if("*"===o&&(s=s.replace(r,n)),"*"!==o&&o.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${r}: unexpected *`),s=s.replace(r,"/* syntax error: unexpected * */")),"*"!==o&&!o.includes("*")){const e=_(n,o.split(",").map((e=>e.trim())));s=s.replace(r,e)}}catch(e){console.error(`fscss[@import] Failed: ${f} `,e),s=s.replace(r,`/* Failed import: ${f} */`)}}return s.match(n)?(c.add(t),k(s)):s}function _(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await v(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=x(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(obj)")||(s=w(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=h(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=x(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=b(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
package/e/xfscss.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* FIGSH-FSCSS light, source v3, fscss.devtem.org */
2
- export function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e=e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e=e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return e=(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={};function r(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}const s=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;let t;for(;null!==(t=s.exec(e));){const e=t[1],s=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:s,props:r(s)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function h(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0;let o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function x(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),e=(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function b(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const e of s){const[r,s,c]=e;if(o=s,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=s.replace(/["']/g,""),o=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(o))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const i=await fetch(e);if(!i.ok)throw new Error(`fscss[@import] HTTP ${i.status} for ${s}`);const a=v(await i.text(),c.trim());t=t.replace(r,a)}catch(e){console.error(`fscss[@import] Failed: ${s} `,e),t=t.replace(r,`/* Failed import: ${s} */`)}}return t.match(r)?(i.add(o),b(t)):t}function v(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const S=new Set;async function y(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,c,i]=e;const a=(r||o||c||i).trim();if(t=a,S.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(a);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${a}`);const r=await e.text();s=s.replace(n,r)}catch(e){console.error(`fscss[@import] Failed: ${a} `,e),s=s.replace(n,`/* Failed import: ${a} */`)}}return s.match(n)?(S.add(t),y(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,i,a]=e;r=r.trim();const l=(o||i||a).trim();if(t=l,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const t=await e.text();if("*"===r&&(s=s.replace(n,t)),"*"!==r&&r.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),s=s.replace(n,"/* syntax error: unexpected * */")),"*"!==r&&!r.includes("*")){const e=j(t,r.split(",").map((e=>e.trim())));s=s.replace(n,e)}}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(n,`/* Failed import: ${l} */`)}}return s.match(n)?(c.add(t),k(s)):s}function j(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await b(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await y(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=w(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=x(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}export function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
2
+ export function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={},r=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;function s(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}let t;for(;null!==(t=r.exec(e));){const e=t[1],r=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:r,props:s(r)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(r,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n={},r=/@obj\s+([\w\-\_\—0-9]+)\s*\{([\s\S]*?)\}\s*/g;function s(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@obj] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@obj] Empty property name in line: "${e}"`)}return n}let t;for(;null!==(t=r.exec(e));){const e=t[1],r=t[2].trim();n[e]&&console.warn(`fscss[@obj] Duplicate @obj variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:r,props:s(r)}}let o=e;return o=o.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@obj] Value extraction failed for "@obj.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@obj] Single property rule failed for "@obj.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@obj\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@obj] Full variable block replacement failed for "@obj.${r}". Variable not found.`),e))),o=o.replace(r,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function h(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));return n.size>0?r+`\n:root{${Array.from(n).join("\n")}\n}`:r}function x(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0,o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function b(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function v(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const r of s){const[s,c,a]=r;if(o=c,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=c.replace(/["']/g,""),r=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(r))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const o=await fetch(e);if(!o.ok)throw new Error(`fscss[@import] HTTP ${o.status} for ${c}`);const i=S(await o.text(),a.trim());t=t.replace(s,i)}catch(e){console.error(`fscss[@import] Failed: ${c} `,e),t=t.replace(s,`/* Failed import: ${c} */`)}}return t.match(r)?(i.add(o),v(t)):t}function S(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const y=new Set;async function j(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const n of r){let[r,o,c,i,a]=n;const l=(o||c||i||a).trim();if(t=l,y.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const n=await e.text();s=s.replace(r,n)}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(r,`/* Failed import: ${l} */`)}}return s.match(n)?(y.add(t),j(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const n of r){let[r,o,i,a,l]=n;o=o.trim();const f=(i||a||l).trim();if(t=f,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(f);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${f}`);const n=await e.text();if("*"===o&&(s=s.replace(r,n)),"*"!==o&&o.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${r}: unexpected *`),s=s.replace(r,"/* syntax error: unexpected * */")),"*"!==o&&!o.includes("*")){const e=_(n,o.split(",").map((e=>e.trim())));s=s.replace(r,e)}}catch(e){console.error(`fscss[@import] Failed: ${f} `,e),s=s.replace(r,`/* Failed import: ${f} */`)}}return s.match(n)?(c.add(t),k(s)):s}function _(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await v(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=x(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(obj)")||(s=w(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=h(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=x(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=b(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}export function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
package/example.fscss CHANGED
@@ -4,7 +4,7 @@ flex-x,
4
4
  flex-wrap-center as fx-wc,
5
5
  flex-responsive as fx-r
6
6
  ) from flex-control/fscss)
7
- @arr colors[#1E2783, #8C29B2, #C41348]
7
+ @arr colors[ #1E2783, #8C29B2, #C41348]
8
8
  .container{
9
9
  @fx-wc()
10
10
  background: @random(@arr.colors);
@@ -12,5 +12,4 @@ flex-responsive as fx-r
12
12
  .container .card{
13
13
  @flex-x()
14
14
  background: linear-gradient(40deg, @arr.colors!.list);
15
- }
16
-
15
+ }
package/exec.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* Figsh-fscss light, source v3, fscss.devtem.org */
2
- function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e=e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e=e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return e=(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={};function r(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}const s=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;let t;for(;null!==(t=s.exec(e));){const e=t[1],s=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:s,props:r(s)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function h(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0;let o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function x(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),e=(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function b(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const e of s){const[r,s,c]=e;if(o=s,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=s.replace(/["']/g,""),o=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(o))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const i=await fetch(e);if(!i.ok)throw new Error(`fscss[@import] HTTP ${i.status} for ${s}`);const a=v(await i.text(),c.trim());t=t.replace(r,a)}catch(e){console.error(`fscss[@import] Failed: ${s} `,e),t=t.replace(r,`/* Failed import: ${s} */`)}}return t.match(r)?(i.add(o),b(t)):t}function v(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const S=new Set;async function y(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,c,i]=e;const a=(r||o||c||i).trim();if(t=a,S.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(a);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${a}`);const r=await e.text();s=s.replace(n,r)}catch(e){console.error(`fscss[@import] Failed: ${a} `,e),s=s.replace(n,`/* Failed import: ${a} */`)}}return s.match(n)?(S.add(t),y(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,i,a]=e;r=r.trim();const l=(o||i||a).trim();if(t=l,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const t=await e.text();if("*"===r&&(s=s.replace(n,t)),"*"!==r&&r.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),s=s.replace(n,"/* syntax error: unexpected * */")),"*"!==r&&!r.includes("*")){const e=j(t,r.split(",").map((e=>e.trim())));s=s.replace(n,e)}}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(n,`/* Failed import: ${l} */`)}}return s.match(n)?(c.add(t),k(s)):s}function j(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await b(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await y(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=w(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=x(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
2
+ function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={},r=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;function s(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}let t;for(;null!==(t=r.exec(e));){const e=t[1],r=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:r,props:s(r)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(r,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n={},r=/@obj\s+([\w\-\_\—0-9]+)\s*\{([\s\S]*?)\}\s*/g;function s(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@obj] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@obj] Empty property name in line: "${e}"`)}return n}let t;for(;null!==(t=r.exec(e));){const e=t[1],r=t[2].trim();n[e]&&console.warn(`fscss[@obj] Duplicate @obj variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:r,props:s(r)}}let o=e;return o=o.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@obj] Value extraction failed for "@obj.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@obj] Single property rule failed for "@obj.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@obj\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@obj] Full variable block replacement failed for "@obj.${r}". Variable not found.`),e))),o=o.replace(r,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function h(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));return n.size>0?r+`\n:root{${Array.from(n).join("\n")}\n}`:r}function x(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0,o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function b(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function v(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const r of s){const[s,c,a]=r;if(o=c,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=c.replace(/["']/g,""),r=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(r))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const o=await fetch(e);if(!o.ok)throw new Error(`fscss[@import] HTTP ${o.status} for ${c}`);const i=S(await o.text(),a.trim());t=t.replace(s,i)}catch(e){console.error(`fscss[@import] Failed: ${c} `,e),t=t.replace(s,`/* Failed import: ${c} */`)}}return t.match(r)?(i.add(o),v(t)):t}function S(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const y=new Set;async function j(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const n of r){let[r,o,c,i,a]=n;const l=(o||c||i||a).trim();if(t=l,y.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const n=await e.text();s=s.replace(r,n)}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(r,`/* Failed import: ${l} */`)}}return s.match(n)?(y.add(t),j(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const n of r){let[r,o,i,a,l]=n;o=o.trim();const f=(i||a||l).trim();if(t=f,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(f);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${f}`);const n=await e.text();if("*"===o&&(s=s.replace(r,n)),"*"!==o&&o.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${r}: unexpected *`),s=s.replace(r,"/* syntax error: unexpected * */")),"*"!==o&&!o.includes("*")){const e=_(n,o.split(",").map((e=>e.trim())));s=s.replace(r,e)}}catch(e){console.error(`fscss[@import] Failed: ${f} `,e),s=s.replace(r,`/* Failed import: ${f} */`)}}return s.match(n)?(c.add(t),k(s)):s}function _(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await v(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=x(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(obj)")||(s=w(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=h(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=x(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=b(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
@@ -722,6 +722,7 @@ if (obj === "max") {
722
722
  }
723
723
  function procFun(code) {
724
724
  const variables = {};
725
+ const funRegex = /@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;
725
726
 
726
727
  function parseStyle(styleStr) {
727
728
  const props = {};
@@ -745,7 +746,7 @@ function procFun(code) {
745
746
  return props;
746
747
  }
747
748
 
748
- const funRegex = /@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;
749
+
749
750
  let funMatch;
750
751
  while ((funMatch = funRegex.exec(code)) !== null) {
751
752
  const varName = funMatch[1];
@@ -792,13 +793,94 @@ function procFun(code) {
792
793
  });
793
794
 
794
795
  // Clean up code
795
- processedCode = processedCode.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g, '');
796
+ processedCode = processedCode.replace(funRegex, '');
796
797
  processedCode = processedCode.replace(/^\s*[\r\n]/gm, '');
797
798
  processedCode = processedCode.trim();
798
799
 
799
800
  return processedCode;
800
801
  }
801
802
 
803
+
804
+
805
+ function procFunObj(code) {
806
+ const variables = {};
807
+ const funRegex = /@obj\s+([\w\-\_\—0-9]+)\s*\{([\s\S]*?)\}\s*/g;
808
+
809
+ function parseStyle(styleStr) {
810
+ const props = {};
811
+ const lines = styleStr.split(';');
812
+ for (let line of lines) {
813
+ line = line.trim();
814
+ if (!line) continue;
815
+ const colonIdx = line.indexOf(':');
816
+ if (colonIdx === -1) {
817
+ console.warn(`fscss[@obj] Invalid style line (missing colon): "${line}"`);
818
+ continue;
819
+ }
820
+ const prop = line.substring(0, colonIdx).trim();
821
+ const value = line.substring(colonIdx + 1).trim();
822
+ if (prop) {
823
+ props[prop] = value;
824
+ } else {
825
+ console.warn(`fscss[@obj] Empty property name in line: "${line}"`);
826
+ }
827
+ }
828
+ return props;
829
+ }
830
+
831
+
832
+ let funMatch;
833
+ while ((funMatch = funRegex.exec(code)) !== null) {
834
+ const varName = funMatch[1];
835
+ const rawStyles = funMatch[2].trim();
836
+ if (variables[varName]) {
837
+ console.warn(`fscss[@obj] Duplicate @obj variable declaration: "${varName}". The last one will overwrite previous declarations.`);
838
+ }
839
+ variables[varName] = {
840
+ raw: rawStyles,
841
+ props: parseStyle(rawStyles)
842
+ };
843
+ }
844
+
845
+ let processedCode = code;
846
+
847
+ // Handle value extraction (e.g., @fun.varname2.bg.value)
848
+ processedCode = processedCode.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g, (match, varName, prop) => {
849
+ if (variables[varName] && variables[varName].props[prop]) {
850
+ return variables[varName].props[prop];
851
+ } else {
852
+ console.warn(`fscss[@obj] Value extraction failed for "@obj.${varName}.${prop}.value". Variable or property not found.`);
853
+ }
854
+ return match;
855
+ });
856
+
857
+ // Handle single property rule (e.g., @fun.varname2.background)
858
+ processedCode = processedCode.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g, (match, varName, prop) => {
859
+ if (variables[varName] && variables[varName].props[prop]) {
860
+ return `${prop}: ${variables[varName].props[prop]};`;
861
+ } else {
862
+ console.warn(`fscss[@obj] Single property rule failed for "@obj.${varName}.${prop}". Variable or property not found.`);
863
+ }
864
+ return match;
865
+ });
866
+
867
+ // Handle full variable block (e.g., @fun.varname2)
868
+ processedCode = processedCode.replace(/@obj\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g, (match, varName) => {
869
+ if (variables[varName]) {
870
+ return variables[varName].raw;
871
+ } else {
872
+ console.warn(`[@obj] Full variable block replacement failed for "@obj.${varName}". Variable not found.`);
873
+ }
874
+ return match;
875
+ });
876
+
877
+ // Clean up code
878
+ processedCode = processedCode.replace(funRegex, '');
879
+ processedCode = processedCode.replace(/^\s*[\r\n]/gm, '');
880
+ processedCode = processedCode.trim();
881
+
882
+ return processedCode;
883
+ }
802
884
  // Extracts values using copy() and creates CSS custom properties
803
885
  function flattenNestedCSS(css, options = {}) {
804
886
  const {
@@ -1322,6 +1404,6 @@ function execObj(css){
1322
1404
  }
1323
1405
 
1324
1406
  export { initlibraries,
1325
- impSel, procImp, replaceRe, procExt, procVar,procFun, procArr, procEv, procRan, transformCssValues, procNum, vfc, applyFscssTransformations,procExC, procCnt, procDef, procChe, execObj
1407
+ impSel, procImp, replaceRe, procExt, procVar,procFun, procFunObj, procArr, procEv, procRan, transformCssValues, procNum, vfc, applyFscssTransformations,procExC, procCnt, procDef, procChe, execObj
1326
1408
  }
1327
1409
 
@@ -2,8 +2,7 @@
2
2
 
3
3
  import fs from "fs/promises";
4
4
  import path from "path";
5
-
6
- import {initlibraries} from "./all.js";
5
+ import { initlibraries } from "./all.js";
7
6
  const runnedSet = new Set();
8
7
 
9
8
  export async function impFrom(text, {inputDir=process.cwd()} = {}) {
@@ -35,8 +34,7 @@ for(const match of matches){
35
34
  result = result.replace(fregex, `/* Can't import ${setFile} multiple times */`);
36
35
 
37
36
  console.warn(`[FSCSS Warning] Can't import ${setFile} multiple times at `);
38
- }
39
-
37
+ }
40
38
  try {
41
39
  let resText;
42
40
  if(/^https?:\/\//.test(impUrl)){
@@ -38,6 +38,7 @@ export async function procImp(text, {inputDir=process.cwd()} = {}) {
38
38
  try {
39
39
 
40
40
  let resText;
41
+
41
42
  if(/^https?:\/\//.test(impUrl)){
42
43
  // remote
43
44
  const response = await fetch(impUrl);
package/lib/processor.js CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  procExt,
5
5
  procVar,
6
6
  procFun,
7
+ procFunObj,
7
8
  procArr,
8
9
  procEv,
9
10
  procRan,
@@ -32,6 +33,7 @@ export async function processFscss(css, options = {}) {
32
33
  if(!css.includes("exec.obj.block(ext:before)")||!css.includes("exec.obj.block(ext)"))css = procExt(css);
33
34
  if(!css.includes("exec.obj.block(f var)"))css = procVar(css);
34
35
  if(!css.includes("exec.obj.block(fun)"))css = procFun(css);
36
+ if(!css.includes("exec.obj.block(obj)"))css = procFunObj(css);
35
37
  if(!css.includes("exec.obj.block(length)"))css = procChe(css);
36
38
  if(!css.includes("exec.obj.block(count)"))css = procCnt(css);
37
39
  if(!css.includes("exec.obj.block(define)"))css = procDef(css);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fscss",
3
3
  "description": "Figured Shorthand Cascading Style Sheet",
4
- "version": "1.1.17",
4
+ "version": "1.1.18",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "bin": {
@@ -29,7 +29,7 @@
29
29
  "bugs": {
30
30
  "url": "https://github.com/Figsh/xfscss/issues"
31
31
  },
32
- "homepage": "https://github.com/Figsh/xfscss#breadme",
32
+ "homepage": "https://github.com/Figsh/xfscss#readme",
33
33
  "dependencies": {
34
34
  "dotenv": "^16.0.3",
35
35
  "express": "^4.18.2"
package/xfscss.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* FIGSH-FSCSS light, source v3, fscss.devtem.org */
2
- export function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e=e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e=e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return e=(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={};function r(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}const s=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;let t;for(;null!==(t=s.exec(e));){const e=t[1],s=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:s,props:r(s)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(/@fun\(([\w\-\_\d\—]+)\s*\{[\s\S]*?\}\s*/g,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function h(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0;let o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function x(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),e=(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function b(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const e of s){const[r,s,c]=e;if(o=s,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=s.replace(/["']/g,""),o=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(o))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const i=await fetch(e);if(!i.ok)throw new Error(`fscss[@import] HTTP ${i.status} for ${s}`);const a=v(await i.text(),c.trim());t=t.replace(r,a)}catch(e){console.error(`fscss[@import] Failed: ${s} `,e),t=t.replace(r,`/* Failed import: ${s} */`)}}return t.match(r)?(i.add(o),b(t)):t}function v(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const S=new Set;async function y(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,c,i]=e;const a=(r||o||c||i).trim();if(t=a,S.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(a);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${a}`);const r=await e.text();s=s.replace(n,r)}catch(e){console.error(`fscss[@import] Failed: ${a} `,e),s=s.replace(n,`/* Failed import: ${a} */`)}}return s.match(n)?(S.add(t),y(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const e of r){let[n,r,o,i,a]=e;r=r.trim();const l=(o||i||a).trim();if(t=l,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const t=await e.text();if("*"===r&&(s=s.replace(n,t)),"*"!==r&&r.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),s=s.replace(n,"/* syntax error: unexpected * */")),"*"!==r&&!r.includes("*")){const e=j(t,r.split(",").map((e=>e.trim())));s=s.replace(n,e)}}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(n,`/* Failed import: ${l} */`)}}return s.match(n)?(c.add(t),k(s)):s}function j(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await b(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await y(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=w(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=h(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=x(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}export function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
2
+ export function exec({type:e="text",content:n,onError:r,onSuccess:s}){if(!n){const e="No CSS content or URL provided.";return console.error(`[FSCSS] ${e}`),void(r&&r(e))}const t=document.createElement("style"),o=e=>{t.textContent=e,document.head.appendChild(t),s&&s(t),xfscssProcessorWrap()},c=["text","auto","text/fscss","text/css"].includes(e),i=["fromUrl","URL","fromURL","link"].includes(e);if(c)o(n);else if(i)fetch(n).then((e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.text()})).then(o).catch((e=>{const s=`Failed to load CSS from: ${n}. ${e.message}`;console.error(`[FSCSS] ${s}`),r&&r(s)}));else{const n=`Unsupported type "${e}". Use "text" or "fromUrl".`;console.error(`[FSCSS] ${n}`),r&&r(n)}}function xfscssProcessorWrap(){(async()=>{function e(e){return e.replace(/count\(\s*([\d\.]+)\s*(?:,\s*([\d\.]+)?)?\)/g,((e,n,r)=>{return null===r&&(r=1),s=parseInt(n),t=parseInt(r||1),`${Array(s).fill().map(((e,n)=>(n+1)*t))}`;var s,t}))}function n(e){return e.replace(/length\((?:([^\)]+)|\s*"([^"]*)"\s*|\s*'([^']*)'\s*)\)/g,((e,n,r,s)=>(n||r||s).length))}function r(e){return e.replace(/num\((.*?)\)/g,((e,n)=>function(e){try{return new Function(`return ${e}`)()}catch(n){return console.error("Invalid expression:",e),e}}(n)))}const s={},t={},o={},c=new Set,i=new Set;function a(e,n){let r=0,s=n;for(;s<e.length&&("{"===e[s]?r++:"}"===e[s]&&r--,0!==r);)s++;return e.slice(n,s+1)}function l(e){const n=[],r=/(if|el-if|el)\s*([^{}]*?)\s*\{([\s\S]*?)\}/g;let s;for(;null!==(s=r.exec(e));)n.push({type:s[1],condition:s[2].trim(),block:s[3].trim()});return n}function f(e){let n="";const r=e.replace(/exec\((_log|_error|_warn|_info),\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/g,((e,r,s,t,o)=>{const c=s||t||o;return["_log","_error","_warn","_info"].includes(r)?c?(n+=`console.${r.slice(1)}("${c.replace(/"/g,'\\"')}");\n`,""):(console.warn(`fscss[exec(console)]: Empty argument for method: ${r}`),""):(console.warn(`fscss[exec(console)]: Unsupported method: ${r}`),"")}));if(n)try{new Function(n)()}catch(e){console.error("fscss[exec(console)]: Error executing transformed code:",e)}return r}function u(e){const n={},r=/@event\s+([\w-]+)\(([^)]*)\)\s*:?{/g;let s,t=e;const o=[];for(;null!==(s=r.exec(e));){const r=s[1],t=s[2],c=s.index+s[0].length-1;if(c>=e.length){console.warn(`fscss[parsing] Warning: Unexpected end of CSS after @event ${r} definition.`);continue}const i=a(e,c);if(0===i.length||"}"!==i[i.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+i.length);const f=l(i),u=t.split(",").map((e=>e.trim())).filter((e=>""!==e));n[r]&&console.warn(`fscss[definition] Warning: Duplicate @event definition for '${r}'. The last one will be used.`),n[r]={args:u,conditionBlocks:f},o.push([s.index,c+i.length])}for(let e=o.length-1;e>=0;e--){const[n,r]=o[e];t=t.slice(0,n)+t.slice(r)}return t=t.replace(/@event\.([\w-]+)\(([^)]*)\)/g,((e,r,s)=>{const t=n[r];if(!t)return console.warn(`fscss[call] Warning: @event function '${r}' not found during call.`),e;const o={},c=s.split(",").map((e=>e.trim())).filter((e=>""!==e));c.length!==t.args.length&&console.warn(`fscss[call] Warning: Argument count mismatch for @event '${r}'. Expected ${t.args.length}, got ${c.length}.`),t.args.forEach(((e,n)=>{void 0!==c[n]?o[e]=c[n]:console.warn(`fscss[call] Warning: Missing value for argument '${e}' in @event '${r}' call.`)}));let i="",a=!1,l=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(l&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),l=!0),!a||"el"===e.type){if("el"===e.type){if(a)continue;a=!0}else{const n=e.condition.split(",").map((e=>e.trim())).filter((e=>""!==e));0===n.length?(console.warn(`fscss[logic] Warning: Empty condition in '${e.type}' block for @event '${r}'.`),a=!0):a=n.every((e=>{const n=e.match(/^(\w+)\s*(==|!=|>=|<=|>|<)\s*([^]+)$/);if(!n){const n=e.split(":").map((e=>e.trim()));if(2!==n.length)return console.warn(`fscss[logic] Warning: Malformed condition '${e}' in @event '${r}'. Expected 'variable operator value' or 'variable:value'.`),!1;const[s,t]=n;return s in o?o[s]===t:(console.warn(`fscss[logic] Warning: Condition variable '${s}' not provided in @event '${r}' context. Treating as false.`),!1)}{const[,e,s,t]=n;if(!(e in o))return console.warn(`fscss[logic] Warning: Condition variable '${e}' not provided in @event '${r}' context. Treating as false.`),!1;const c=o[e],i=isNaN(c)?c:Number(c),a=isNaN(t)?t:Number(t);switch(s){case"==":return i==a;case"!=":return i!=a;case">":return i>a;case"<":return i<a;case">=":return i>=a;case"<=":return i<=a;default:return!1}}}))}if(a){const n=e.block.match(/(\w+)\s*(?:\:\s*([^;]*);?|\|([^\|]+)\|?)/);n&&n[2]?i=n[2].trim():n&&n[3]?i=n[3].trim():console.warn(`fscss[logic] Warning: No valid CSS property assignment found in matched block for @event '${r}'. Block content: '${e.block}'.`);break}}return!i&&t.conditionBlocks.length>0&&!a?console.warn(`fscss[call] Warning: No condition matched for @event '${r}' with provided arguments. Returning original call string.`):i||0!==t.conditionBlocks.length||console.warn(`fscss[definition] Warning: @event '${r}' has no condition blocks defined. Returning original call string.`),i||e})),t.trim()}async function p(e){return(e=(e=(e=(e=e.replace(/exec\(\s*_init\sisjs\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/isjs.fscss)")).replace(/exec\(\s*_init\sthemes\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/trshapes.fthemes.fscss)")).replace(/exec\(_init\sarray1to500\s*\)/g,"exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/1to500.fscss)")).replace(/exec\(_init\s+([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?\s*\)/g,((e,n,r)=>r?`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.${r})`:`exec(https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${n}.fscss)`))).replace(/(\@import\((?:\s+)?(?:exec)?\((?:[\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?)([\w\d\._—\-\%\*\+\&\$\=]+)(?:\/([\w\-]+))?(?:\s+)?\)/g,((e,n,r,s)=>s?`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.${s}')`:`${n}'https://cdn.jsdelivr.net/gh/fscss-ttr/FSCSS@main/xf/styles/${r}.fscss')`))}function $(e){const n=/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;let r=e.replace(n,((e,n,r,s,t,c,i)=>{const a=r.split(",").map((e=>e.trim())).filter((e=>e)),l=s??t??c??i??"";return o[n]={params:a,body:l},""}));return r=r.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=o[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let c=s.body,i=[];return s.params.forEach(((e,n)=>{const r=s.params[n];r&&r.includes(":")&&(i=r?.split(":")?.map((e=>e.trim())).filter((e=>e)));const o=i[1]?i[1]:"",a=void 0!==t[n]?t[n]:o,l=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");c=c.replace(l,a)})),c})),n.test(r)?$(r):r}function d(e){let n={},r=e;return r=r.replace(/("(?:[^"\\]|\\.)*")|('(?:[^'\\]|\\.)*')/g,(function(e){let r=e[0],s=e.slice(1,-1);const t=/@ext\((-?\d+),(\d+):\s*([^)]+)\)/g;let o,c=[];for(;null!==(o=t.exec(s));)c.push({fullMatch:o[0],start:parseInt(o[1]),length:parseInt(o[2]),varName:o[3].trim(),index:o.index});for(let e=c.length-1;e>=0;e--){let r=c[e],t=r.start<0?s.length+r.start:r.start;t=Math.max(0,t);let o=s.substring(t,t+r.length);(t+r.length>s.length||t<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${r.varName}' in string literal specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[r.varName]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${r.varName}' found in string literal. The last extracted value will be used.`),n[r.varName]=o,s=s.slice(0,r.index)+s.slice(r.index+r.fullMatch.length)}return r+s+r})),r=r.replace(/([#.\w-]+)\s*@ext\((-?\d+),(\d+):\s*([^)]+)\)/g,(function(e,r,s,t,o){s=parseInt(s),t=parseInt(t),o=o.trim();let c=s<0?r.length+s:s;c=Math.max(0,c);let i=r.substring(c,c+t);return(c+t>r.length||c<0)&&console.warn(`fscss:[@ext]Warning: @ext directive for variable '${o}' on token '${r}' specifies an out-of-bounds range. Extraction may be incomplete or incorrect.`),void 0!==n[o]&&console.warn(`fscss:[@ext]Warning: Duplicate variable name '${o}' found outside string literals. The last extracted value will be used.`),n[o]=i,r})),r=r.replace(/@ext\.(\w+)\!?/g,(function(e,r){return void 0===n[r]?(console.warn(`fscss:[@ext]Warning: Reference to undefined variable '@ext.${r}'. It will not be replaced.`),e):n[r]})),r}function g(e){const n=/@arr\(?\s*([\w\-_—0-9]+)\)?\[([^\]]+)\]\)?/g;let r;for(;null!==(r=n.exec(e));){const e=r[1],n=r[2].split(",").map((e=>e.trim()));s[e]=n}let t=e;return t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\+\s*\[([^\]]+)?\])/g,((e,n,r)=>s[n]?r?(newItems=r.split(",").map((e=>e.trim())),s[n].push(...newItems),""):(console.warn(`[FSCSS Warning] @arr push failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e))),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\-\s*\[([\d\w\-_—\s]+)?\])/g,((e,n,r)=>{const t=s[n];return t?!(r=Number(r?.trim()))||r<1||!Number(r)?(console.warn(`[FSCSS Warning] @arr splice failed → Invalid or empty index at "${e}"`),e):r>t.length?(console.warn(`[FSCSS Warning] @arr → @arr.${n}[${r}] is undefined at "${e}"`),""):(r-=1,t.splice(r,1),""):(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:\!\s*\.(length|last|reverse|first|list|indices|randint|segment|sum|unique|sort|shuffle|min|max))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e;if(r){if("length"===r)return t.length;if("first"===r)return t[0];if("last"===r)return t.at(-1);if("indices"===r)return Array(t.length).fill().map(((e,n)=>1*(n+1)));if("list"===r)return t.join(",");if("reverse"===r)return t.toReversed().join(",");if("randint"===r)return t[Math.floor(Math.random()*t.length)];if("segment"===r)return t.map((e=>`[${e}]`)).join("");if("unique"===r)return[...new Set(t)].join(",");if("sort"===r)return t.slice().sort().join(",");if("shuffle"===r)return t.slice().sort((()=>Math.random()-.5)).join(",");if("sum"===r)return t.reduce(((e,n)=>e+Number(n)),0);if("min"===r)return Math.min(...t.map(Number));if("max"===r)return Math.max(...t.map(Number))}})),t=t.replace(/([^\{\}]+)\{\s*([^}]*@arr\.([\w\-_—0-9]+)\[\][^}]*)\s*\}/g,((e,n,r,t)=>{const o=s[t];return o?o.map(((e,s)=>{const o=n.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),s+1),c=r.replace(new RegExp(`@arr\\.${t}\\[\\]`,"g"),e);return`${o.trim()} {\n ${c.trim()}\n}`})).join("\n"):(console.warn(`fscss[@arr] Warning: Array '${t}' not found for loop processing.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)\[(\d+)\]/g,((e,n,r)=>{const t=parseInt(r)-1,o=s[n];return o?void 0!==o[t]?o[t]:e:(console.warn(`fscss[@arr] Warning: Array '${n}' not found.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.unit)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${e+o}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.prefix)(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.map((e=>`${o+e}`)).join(",")})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.surround)(?:\(([^)]+)\))/g,((e,n,r)=>{const t=s[n];return t?r&&void 0!==r&&""!==r&&r.includes(",")?(surArr=r.split(","),t.map((e=>`${surArr[0]+e+surArr.at(-1)}`)).join(" ")):(console.warn(`[FSCSS Warning] @arr surround failed → Invalid or empty value at "${e}"`),e):(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(?:!\s*\.join)?(?:\(([^)]*)\))/g,((e,n,r)=>{const t=s[n];if(!t)return console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e;const o=void 0!==r&&""!==r?r:" ";return t.join(o)})),t=t.replace(/@arr\.([\w\-_—0-9]+)(!)?/g,((e,n,r)=>{const t=s[n];return t?r?e:`[${t.join(",")}]`:(console.warn(`fscss[@arr] Warning: Array '${n}' not found for direct access.`),e)})),t.replace(n,"").replace(/\n{3,}/g,"\n\n").trim()}function m(e){const n={},r=/@fun\(([\w\-\_\—0-9]+)\)\s*\{([\s\S]*?)\}\s*/g;function s(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@fun] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@fun] Empty property name in line: "${e}"`)}return n}let t;for(;null!==(t=r.exec(e));){const e=t[1],r=t[2].trim();n[e]&&console.warn(`fscss[@fun] Duplicate @fun variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:r,props:s(r)}}let o=e;return o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@fun] Value extraction failed for "@fun.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@fun] Single property rule failed for "@fun.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@fun\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@fun] Full variable block replacement failed for "@fun.${r}". Variable not found.`),e))),o=o.replace(r,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function w(e){const n={},r=/@obj\s+([\w\-\_\—0-9]+)\s*\{([\s\S]*?)\}\s*/g;function s(e){const n={},r=e.split(";");for(let e of r){if(e=e.trim(),!e)continue;const r=e.indexOf(":");if(-1===r){console.warn(`fscss[@obj] Invalid style line (missing colon): "${e}"`);continue}const s=e.substring(0,r).trim(),t=e.substring(r+1).trim();s?n[s]=t:console.warn(`fscss[@obj] Empty property name in line: "${e}"`)}return n}let t;for(;null!==(t=r.exec(e));){const e=t[1],r=t[2].trim();n[e]&&console.warn(`fscss[@obj] Duplicate @obj variable declaration: "${e}". The last one will overwrite previous declarations.`),n[e]={raw:r,props:s(r)}}let o=e;return o=o.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\.value\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?n[r].props[s]:(console.warn(`fscss[@obj] Value extraction failed for "@obj.${r}.${s}.value". Variable or property not found.`),e))),o=o.replace(/@obj\.([\w\-\_\—0-9]+)\.([\w\-\_\—0-9]+)\!?/g,((e,r,s)=>n[r]&&n[r].props[s]?`${s}: ${n[r].props[s]};`:(console.warn(`fscss[@obj] Single property rule failed for "@obj.${r}.${s}". Variable or property not found.`),e))),o=o.replace(/@obj\.([\w\-\_\—0-9]+)(?=[\s;}])\!?/g,((e,r)=>n[r]?n[r].raw:(console.warn(`[@obj] Full variable block replacement failed for "@obj.${r}". Variable not found.`),e))),o=o.replace(r,""),o=o.replace(/^\s*[\r\n]/gm,""),o=o.trim(),o}function h(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const a=parseInt(c),l=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=a>=0?t.substring(0,a):t.substring(t.length+a),n.add(`--${l}:${f};`),`${r}${s}${t}${o}`}));return n.size>0?r+`\n:root{${Array.from(n).join("\n")}\n}`:r}function x(e){const n=new Map;let r,s=e.replace(/(?:store|str|re)\(\s*([^:,]+)\s*[,:]\s*(?:"([^"]*)"|'([^']*)')\s*\)/gi,((e,r,s,t)=>{const o=s||t;return r=r.trim(),n.set(r,o),""}));if(0===n.size)return s;let t=0,o=s;do{r=!1;for(const[e,s]of n.entries()){const n=new RegExp(`\\b${c=e,c.replace(/[.*+?^${}|[\]\\]/g,"\\$&")}\\b`,"g"),t=o.replace(n,s);t!==o&&(r=!0,o=t)}t++}while(r&&t<100);var c;return t>=100&&console.warn("Maximum iterations reached. Possible circular dependency."),o}function b(e){return e=e.replace(/(?:mxs|\$p)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2:$14$15;$4:$14$15;$6:$14$15;$8:$14$15;$10:$14$15;$12:$14$15;").replace(/(?:mx|\$m)\((([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,)?(([^\,]*)\,\s*)?("([^"]*)"|'([^']*)')\)/gi,"$2$14$15$4$14$15$6$14$15$8$14$15$10$14$15$12$14$15").replace(/rpt\((\d+)\,\s*("([^"]*)"|'([^']*)')\)/gi,((e,n,r)=>function(e,n){return e.replace(/^['"]|['"]$/g,"").repeat(Math.max(0,parseInt(n)))}(r,n))).replace(/\$(([\_\-\d\w]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,":root{--$1}").replace(/\$([^\!\s]+)!/gi,"var(--$1)").replace(/\$([\w\-\_\d]+)/gi,"var(--$1)").replace(/\-\*\-(([^\:]+)\:(\"[^\"]*\"|\'[^\']*\'|[^\;]*)\;)/gi,"-webkit-$1-moz-$1-ms-$1-o-$1").replace(/%i\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$21$4$21$6$21$8$21$10$21$12$21$14$21$16$21$18$21$20$21").replace(/%6\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$13$4$13$6$13$8$13$10$13$12$13").replace(/%5\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\]\[]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$11$4$11$6$11$8$11$10$11").replace(/%4\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$9$4$9$6$9$8$9").replace(/%3\((([^\,\[\]]*)\,)?(([^\,\[\]]*)\,)?(([^\,\[\]]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$7$4$7$6$7").replace(/%2\((([^\,\[\]]*)\,)?(([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$5$4$5").replace(/%1\((([^\,\]\[]*))?\s*\[([^\]\[]*)\]\)/gi,"$2$3"),(e=e.replace(/%(\d+)\(([^[]+)\[\s*([^\]]+)\]\)/g,((e,n,r,s)=>{const t=r.split(",").map((e=>e.trim()));return t.length!=n?(console.warn(`Number of properties ${t.length} does not match %${n}`),e):t.map((e=>`${e}${s}`)).join("")}))).replace(/\$\(\s*@keyframes\s*(\S+)\)/gi,"$1{animation-name:$1;}@keyframes $1").replace(/\$\(\s*(\@[\w\-\*]*)\s*([^\{\}\,&]*)(\s*,\s*[^\{\}&]*)?&?(\[([^\{\}]*)\])?\s*\)/gi,"$2$3{animation:$2 $5;}$1 $2").replace(/\$\(\s*--([^\{\}]*)\)/gi,"$1").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/g\(([^"'\s]*)\,\s*(("([^"]*)"|'([^']*)')\,\s*)?("([^"]*)"|'([^']*)')\s*\)/gi,"$1 $4$5$1 $7$8").replace(/\$\(([^\:]*):\s*([^\)\:]*)\)/gi,"[$1='$2']").replace(/\$\(([^\:^\)]*)\)/gi,"[$1]")}async function v(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g,s=[...(e=await p(e)).matchAll(r)];let t=e,o=null;for(const r of s){const[s,c,a]=r;if(o=c,i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("@import\\(exec\\(("+e+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)","g");t=t.replace(n,`/* Can't import ${o} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${o} multiple times at `)}try{const e=c.replace(/["']/g,""),r=e.slice(e.lastIndexOf(".")).toLowerCase();if(e.trim().startsWith("_init")&&e.includes(" "))return void console.warn(`fscss[@import] library not found for: ${e}`);if(!n.includes(r))return void console.warn(`fscss[@import] invalid extension for: ${e}`);const o=await fetch(e);if(!o.ok)throw new Error(`fscss[@import] HTTP ${o.status} for ${c}`);const i=S(await o.text(),a.trim());t=t.replace(s,i)}catch(e){console.error(`fscss[@import] Failed: ${c} `,e),t=t.replace(s,`/* Failed import: ${c} */`)}}return t.match(r)?(i.add(o),v(t)):t}function S(e,n){const r=new RegExp(`${n}\\s*{[^}]*}`,"g"),s=e.match(r);return s?s.join("\n"):console.warn(`fscss[@import pick] No block matches: ${n} `)}const y=new Set;async function j(e){const n=/\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const n of r){let[r,o,c,i,a]=n;const l=(o||c||i||a).trim();if(t=l,y.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:"('+e+")\"|'("+e+")'|`("+e+")`|("+e+")(?:\\s+)?)\\)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(l);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${l}`);const n=await e.text();s=s.replace(r,n)}catch(e){console.error(`fscss[@import] Failed: ${l} `,e),s=s.replace(r,`/* Failed import: ${l} */`)}}return s.match(n)?(y.add(t),j(s)):s}async function k(e){const n=/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g,r=[...(e=await p(e)).matchAll(n)];let s=e,t=null;for(const n of r){let[r,o,i,a,l]=n;o=o.trim();const f=(i||a||l).trim();if(t=f,c.has(t)){const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp('\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:"((?:\\s+)?'+e+"(?:\\s+)?)\"|'((?:\\s+)?"+e+"(?:\\s+)?)'|`((?:\\s+)?"+e+"(?:\\s+)?)`)(?:\\s+)?\\)","g");s=s.replace(n,`/* Can't import ${t} multiple times */`),console.warn(`[FSCSS Warning] Can't import ${t} multiple times at `)}try{const e=await fetch(f);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${f}`);const n=await e.text();if("*"===o&&(s=s.replace(r,n)),"*"!==o&&o.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${r}: unexpected *`),s=s.replace(r,"/* syntax error: unexpected * */")),"*"!==o&&!o.includes("*")){const e=_(n,o.split(",").map((e=>e.trim())));s=s.replace(r,e)}}catch(e){console.error(`fscss[@import] Failed: ${f} `,e),s=s.replace(r,`/* Failed import: ${f} */`)}}return s.match(n)?(c.add(t),k(s)):s}function _(e,n=[]){if(!e||""===e||"string"!=typeof e)return console.warn("FSCSS >Invalid input");if(!n||0===n.length)return console.warn("FSCSS >Invalid input");let r="";return n.forEach((n=>{let s="",t=n;const o=n.trim().match(/([^\s]+)(?:\s+as\s+([^\s]+))?/);if(o){const[e,r,c]=o;t=r,c?s=c:n.includes(" as")?(console.warn(`[FSCSS Warning] Can't assign @${r} to invalid or empty value`),s=r):s=r}const c=new RegExp("@define\\s+("+t+")\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\}","g"),i=e.match(c);if(!i)return console.warn(`[FSCSS Warning] @${t} is undefined for import`);const a=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(a,((e,n,r,t)=>`${n}${s}${t}`))+"\n"})),r.trim()}try{await async function(){const s=document.querySelectorAll("style");if(s.length)for(const o of s){let s=o.textContent;s.includes("exec.obj.block(all)")||(s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await v(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await k(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(vfc)")||(s=s.replace(/([\w-]+:\s*)(\$\/?[\w-]+!?)(\s*\|\|\s*([^\n\};]+))?/g,((e,n,r,s,t)=>/^\$\/[\w-]+!?$/.test(r)?(r.endsWith("!")&&t&&console.warn(`fscss[VFC]: Required variable "${r}" should not have fallback (${t})`),s&&!t?.trim()?(console.warn(`fscss[VFC]: Empty fallback in -> ${e}`),e):(t?.includes("$/")&&!/^\$\/[\w-]+!?$/.test(t.trim())&&console.warn(`fscss[VFC]: Invalid fallback variable syntax -> ${t}`),t?`${n}${t.trim()};${n}${r}`:`${n}${r}`)):(console.warn(`fscss[VFC]: Invalid variable escape syntax -> ${r} at ${e}`),e)))),s.includes("exec.obj.block(store:before)")&&s.includes("exec.obj.block(store)")||(s=x(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(f var)")||(s=function(e){const n={},r=[],s=e.split("\n");let t=!1;const o={};for(let e=0;e<s.length;e++){let c=s[e].trim();if(c.includes("{")){t=!0,r.push(c);continue}if(c.includes("}")){t=!1;for(const e in o)delete o[e];r.push(c);continue}const i=/^\s*\$([a-zA-Z0-9_-]+)\s*:\s*([^;]+);/,a=c.match(i);if(a){const[,e,s]=a;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const l=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(l,((e,r)=>void 0!==o[r]?o[r]:void 0!==n[r]?n[r]:e)),r.push(c)}return{css:r.join("\n"),getVariable:function(e){return n[e]||null}}}(s).css),s.includes("exec.obj.block(fun)")||(s=m(s)),s.includes("exec.obj.block(obj)")||(s=w(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(define)")||(s=$(s)),s.includes("exec.obj.block(arr)")||(s=g(s)),s.includes("exec.obj.block(event)")||(s=u(s)),s.includes("exec.obj.block(random)")||(s=s.replace(/@random\(\[([^\]]+)\](?:, *ordered)?\)/g,((e,n)=>{const r=/, *ordered\)/.test(e),s=n.split(",").map((e=>e.trim()));if(0===s.length)return console.warn("fscss[@random] Warning: Empty array provided for @random. Returning empty string."),"";if(r){const e=s.join(":");t[e]||(t[e]={values:s,index:0},console.warn(`fscss[@random] Warning: New ordered sequence created for [${n}].`));const r=t[e],o=r.values[r.index%r.values.length];return r.index>=r.values.length&&r.index%r.values.length==0&&console.warn(`fscss[@random] Warning: Ordered sequence [${n}] is looping back to the beginning.`),r.index++,o}return s[Math.floor(Math.random()*s.length)]}))),s.includes("exec.obj.block(copy)")||(s=h(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=x(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=d(s)),s.includes("exec.obj.block(t group)")||(s=b(s)),s.includes("exec.obj.block(length)")||(s=n(s)),s.includes("exec.obj.block(count)")||(s=e(s)),s.includes("exec.obj.block(debug)")||(s=f(s))),s=s.replace(/exec\.obj\.block\([^\)\n]*\)\;?/g,""),o.innerHTML=s}else console.warn("fscss[Obj]\n No <style> elements found.")}(),await void document.querySelectorAll(".draw").forEach((e=>{const n=e.style.color||"#000";e.style.color="transparent",e.style.webkitTextStroke=`2px ${n}`}))}catch(e){console.error("Error processing styles or draw elements:",e)}})()}function applyFscssStyles(){document.querySelectorAll('[type*="fscss"]').forEach((e=>{fetch(e.href).then((e=>e.text())).then((e=>{const n=document.createElement("style");n.textContent=e,document.head.appendChild(n),xfscssProcessorWrap()})).catch((n=>{console.error(`Failed to load FSCSS from ${e.href}`,n)}))}))}export function inf({host:e,path:n}){if(!e||!n)return void console.error("Both 'host' and 'path' are required.");const r=e.replace(/github/gi,"gh"),s=n.replace(/\s*->\s*/g,"/").replace(/\n/g,"");loadFScript(`https://cdn.jsdelivr.net/${r}/${s}`)}xfscssProcessorWrap(),applyFscssStyles();
package/example.css DELETED
@@ -1,17 +0,0 @@
1
- body{
2
- Background: #f8f8f8;
3
- color: #1a1a1a;
4
- }
5
-
6
- .container{
7
- display: flex;
8
- flex-wrap: wrap;
9
- justify-content: center;
10
- align-items: center;
11
- background: #8C29B2;
12
- }
13
- .container .card{
14
- display: flex;
15
- justify-content: center;
16
- background: linear-gradient(40deg, #1E2783,#8C29B2,#C41348);
17
- }