fscss 1.1.16 → 1.1.17

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.16/exec.min.js" defer></script>
96
+ <script src="https://cdn.jsdelivr.net/npm/fscss@1.1.17/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=10,c={};function i(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 a(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 f(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 a=i(e,c);if(0===a.length||"}"!==a[a.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+a.length);const f=l(a),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+a.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="",l=!1,a=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(a&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),a=!0),!l||"el"===e.type){if("el"===e.type){if(l)continue;l=!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}'.`),l=!0):l=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),l=isNaN(t)?t:Number(t);switch(s){case"==":return i==l;case"!=":return i!=l;case">":return i>l;case"<":return i<l;case">=":return i>=l;case"<=":return i<=l;default:return!1}}}))}if(l){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&&!l?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 u(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 d(e){let n=e.replace(/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g,((e,n,r,s,t,o,i)=>{const l=r.split(",").map((e=>e.trim())).filter((e=>e)),a=s??t??o??i??"";return c[n]={params:l,body:a},""}));return n=n.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=c[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let o=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 c=i[1]?i[1]:"",l=void 0!==t[n]?t[n]:c,a=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");o=o.replace(a,l)})),o})),n}function p(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 $(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 g(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 m(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const l=parseInt(c),a=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=l>=0?t.substring(0,l):t.substring(t.length+l),n.add(`--${a}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function b(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 w(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=[...e.matchAll(/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g)];let s=e;for(const e of r){const[r,t,o]=e;try{const e=t.replace(/["']/g,""),c=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(c))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 ${t}`);const l=h(await i.text(),o.trim());s=s.replace(r,l)}catch(e){console.error(`fscss[@import] Failed: ${t} `,e),s=s.replace(r,`/* Failed import: ${t} */`)}}return s}function h(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 v=[".fscss",".css",".txt",".scss",".less",".xfscss"];async function k(e,n=0,r=window.location.href){if(n>o)return console.warn("fscss[@import]\n Maximum import depth exceeded. Skipping further imports."),e;const s=Array.from(e.matchAll(/@import\s*\(\s*exec\s*\(\s*((?:'[^']*'|"[^"]*"|[^'")]\S*)\s*)\)\s*\)/g));if(0===s.length)return e;const t=await Promise.all(s.map((async e=>{const[s,t]=e;try{const e=t.replace(/^['"](.*)['"]$/,"$1").trim(),s=new URL(e,r).href,o=new URL(s).pathname,c=o.slice(o.lastIndexOf(".")).toLowerCase();if(s.trim().startsWith("_init")&&s.includes(" "))return void console.warn(`fscss[@import] library not found for: ${s}`);if(!v.includes(c))return console.warn(`fscss[@import] \n Invalid import URL extension "${c}" for "${s}". Only ${v.join(", ")} are allowed.`),`/* Invalid extension for "${s}" */`;const i=await fetch(s);if(!i.ok)throw new Error(`HTTP ${i.status} for ${s}`);return k(await i.text(),n+1,s)}catch(e){return console.warn(`fscss[@import]\n Failed to import "${t}" from "${r}":`,e),`/* Error importing "${t}": ${e.message} */`}})));let c=0,i="";return s.forEach(((n,r)=>{i+=e.slice(c,n.index),i+=t[r],c=n.index+n[0].length})),i+=e.slice(c),i}async function j(e){try{return await k(e)}catch(n){return console.warn("fscss[]\n Processing failed:",n),console.warn("fscss[@import] Warning: can't resolve imports"),e}}async function y(e){const n=[...e.matchAll(/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g)];let r=e;for(const e of n){let[n,s,t,o,c]=e;s=s.trim();const i=(t||o||c).trim();try{const e=await fetch(i);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${i}`);const t=await e.text();if("*"===s&&(r=r.replace(n,t)),"*"!==s&&s.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),r=r.replace(n,"/* syntax error: unexpected * */")),"*"!==s&&!s.includes("*")){const e=s.split(",").map((e=>e.trim())),o=await S(t,e);r=r.replace(n,o)}}catch(e){console.error(`fscss[@import] Failed: ${i} `,e),r=r.replace(n,`/* Failed import: ${i} */`)}}return r}async function S(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 l=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(l,((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(init lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(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=b(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=p(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*([^;]+);/,l=c.match(i);if(l){const[,e,s]=l;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const a=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(a,((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=g(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=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(arr)")||(s=$(s)),s.includes("exec.obj.block(event)")||(s=f(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=m(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=b(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=p(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=a(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=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();
package/e/xfscss.js CHANGED
@@ -1,3 +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=10,c={};function i(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 a(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 f(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 a=i(e,c);if(0===a.length||"}"!==a[a.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+a.length);const f=l(a),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+a.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="",l=!1,a=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(a&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),a=!0),!l||"el"===e.type){if("el"===e.type){if(l)continue;l=!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}'.`),l=!0):l=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),l=isNaN(t)?t:Number(t);switch(s){case"==":return i==l;case"!=":return i!=l;case">":return i>l;case"<":return i<l;case">=":return i>=l;case"<=":return i<=l;default:return!1}}}))}if(l){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&&!l?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 u(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 d(e){let n=e.replace(/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g,((e,n,r,s,t,o,i)=>{const l=r.split(",").map((e=>e.trim())).filter((e=>e)),a=s??t??o??i??"";return c[n]={params:l,body:a},""}));return n=n.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=c[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let o=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 c=i[1]?i[1]:"",l=void 0!==t[n]?t[n]:c,a=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");o=o.replace(a,l)})),o})),n}function p(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 $(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 g(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 m(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const l=parseInt(c),a=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=l>=0?t.substring(0,l):t.substring(t.length+l),n.add(`--${a}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function b(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 w(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=[...e.matchAll(/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g)];let s=e;for(const e of r){const[r,t,o]=e;try{const e=t.replace(/["']/g,""),c=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(c))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 ${t}`);const l=h(await i.text(),o.trim());s=s.replace(r,l)}catch(e){console.error(`fscss[@import] Failed: ${t} `,e),s=s.replace(r,`/* Failed import: ${t} */`)}}return s}function h(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 v=[".fscss",".css",".txt",".scss",".less",".xfscss"];async function k(e,n=0,r=window.location.href){if(n>o)return console.warn("fscss[@import]\n Maximum import depth exceeded. Skipping further imports."),e;const s=Array.from(e.matchAll(/@import\s*\(\s*exec\s*\(\s*((?:'[^']*'|"[^"]*"|[^'")]\S*)\s*)\)\s*\)/g));if(0===s.length)return e;const t=await Promise.all(s.map((async e=>{const[s,t]=e;try{const e=t.replace(/^['"](.*)['"]$/,"$1").trim(),s=new URL(e,r).href,o=new URL(s).pathname,c=o.slice(o.lastIndexOf(".")).toLowerCase();if(s.trim().startsWith("_init")&&s.includes(" "))return void console.warn(`fscss[@import] library not found for: ${s}`);if(!v.includes(c))return console.warn(`fscss[@import] \n Invalid import URL extension "${c}" for "${s}". Only ${v.join(", ")} are allowed.`),`/* Invalid extension for "${s}" */`;const i=await fetch(s);if(!i.ok)throw new Error(`HTTP ${i.status} for ${s}`);return k(await i.text(),n+1,s)}catch(e){return console.warn(`fscss[@import]\n Failed to import "${t}" from "${r}":`,e),`/* Error importing "${t}": ${e.message} */`}})));let c=0,i="";return s.forEach(((n,r)=>{i+=e.slice(c,n.index),i+=t[r],c=n.index+n[0].length})),i+=e.slice(c),i}async function j(e){try{return await k(e)}catch(n){return console.warn("fscss[]\n Processing failed:",n),console.warn("fscss[@import] Warning: can't resolve imports"),e}}async function y(e){const n=[...e.matchAll(/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g)];let r=e;for(const e of n){let[n,s,t,o,c]=e;s=s.trim();const i=(t||o||c).trim();try{const e=await fetch(i);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${i}`);const t=await e.text();if("*"===s&&(r=r.replace(n,t)),"*"!==s&&s.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),r=r.replace(n,"/* syntax error: unexpected * */")),"*"!==s&&!s.includes("*")){const e=s.split(",").map((e=>e.trim())),o=await S(t,e);r=r.replace(n,o)}}catch(e){console.error(`fscss[@import] Failed: ${i} `,e),r=r.replace(n,`/* Failed import: ${i} */`)}}return r}async function S(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 l=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(l,((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(init lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(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=b(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=p(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*([^;]+);/,l=c.match(i);if(l){const[,e,s]=l;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const a=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(a,((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=g(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=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(arr)")||(s=$(s)),s.includes("exec.obj.block(event)")||(s=f(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=m(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=b(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=p(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=a(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();
3
-
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();
package/example.css ADDED
@@ -0,0 +1,17 @@
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
+ }
package/example.fscss CHANGED
@@ -1,9 +1,9 @@
1
1
  @import((*) from "style.fscss")
2
2
  @import((
3
- flex-x,
4
- flex-wrap-center as fx-wc,
5
- flex-responsive as fx-r
6
- ) from flex-control/fscss)
3
+ flex-x,
4
+ flex-wrap-center as fx-wc,
5
+ flex-responsive as fx-r
6
+ ) from flex-control/fscss)
7
7
  @arr colors[#1E2783, #8C29B2, #C41348]
8
8
  .container{
9
9
  @fx-wc()
package/exec.js CHANGED
@@ -1,3 +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=10,c={};function i(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 a(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 f(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 a=i(e,c);if(0===a.length||"}"!==a[a.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+a.length);const f=l(a),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+a.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="",l=!1,a=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(a&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),a=!0),!l||"el"===e.type){if("el"===e.type){if(l)continue;l=!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}'.`),l=!0):l=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),l=isNaN(t)?t:Number(t);switch(s){case"==":return i==l;case"!=":return i!=l;case">":return i>l;case"<":return i<l;case">=":return i>=l;case"<=":return i<=l;default:return!1}}}))}if(l){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&&!l?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 u(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 d(e){let n=e.replace(/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g,((e,n,r,s,t,o,i)=>{const l=r.split(",").map((e=>e.trim())).filter((e=>e)),a=s??t??o??i??"";return c[n]={params:l,body:a},""}));return n=n.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=c[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let o=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 c=i[1]?i[1]:"",l=void 0!==t[n]?t[n]:c,a=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");o=o.replace(a,l)})),o})),n}function p(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 $(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 g(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 m(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const l=parseInt(c),a=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=l>=0?t.substring(0,l):t.substring(t.length+l),n.add(`--${a}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function b(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 w(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=[...e.matchAll(/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g)];let s=e;for(const e of r){const[r,t,o]=e;try{const e=t.replace(/["']/g,""),c=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(c))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 ${t}`);const l=h(await i.text(),o.trim());s=s.replace(r,l)}catch(e){console.error(`fscss[@import] Failed: ${t} `,e),s=s.replace(r,`/* Failed import: ${t} */`)}}return s}function h(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 v=[".fscss",".css",".txt",".scss",".less",".xfscss"];async function k(e,n=0,r=window.location.href){if(n>o)return console.warn("fscss[@import]\n Maximum import depth exceeded. Skipping further imports."),e;const s=Array.from(e.matchAll(/@import\s*\(\s*exec\s*\(\s*((?:'[^']*'|"[^"]*"|[^'")]\S*)\s*)\)\s*\)/g));if(0===s.length)return e;const t=await Promise.all(s.map((async e=>{const[s,t]=e;try{const e=t.replace(/^['"](.*)['"]$/,"$1").trim(),s=new URL(e,r).href,o=new URL(s).pathname,c=o.slice(o.lastIndexOf(".")).toLowerCase();if(s.trim().startsWith("_init")&&s.includes(" "))return void console.warn(`fscss[@import] library not found for: ${s}`);if(!v.includes(c))return console.warn(`fscss[@import] \n Invalid import URL extension "${c}" for "${s}". Only ${v.join(", ")} are allowed.`),`/* Invalid extension for "${s}" */`;const i=await fetch(s);if(!i.ok)throw new Error(`HTTP ${i.status} for ${s}`);return k(await i.text(),n+1,s)}catch(e){return console.warn(`fscss[@import]\n Failed to import "${t}" from "${r}":`,e),`/* Error importing "${t}": ${e.message} */`}})));let c=0,i="";return s.forEach(((n,r)=>{i+=e.slice(c,n.index),i+=t[r],c=n.index+n[0].length})),i+=e.slice(c),i}async function j(e){try{return await k(e)}catch(n){return console.warn("fscss[]\n Processing failed:",n),console.warn("fscss[@import] Warning: can't resolve imports"),e}}async function y(e){const n=[...e.matchAll(/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g)];let r=e;for(const e of n){let[n,s,t,o,c]=e;s=s.trim();const i=(t||o||c).trim();try{const e=await fetch(i);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${i}`);const t=await e.text();if("*"===s&&(r=r.replace(n,t)),"*"!==s&&s.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),r=r.replace(n,"/* syntax error: unexpected * */")),"*"!==s&&!s.includes("*")){const e=s.split(",").map((e=>e.trim())),o=await S(t,e);r=r.replace(n,o)}}catch(e){console.error(`fscss[@import] Failed: ${i} `,e),r=r.replace(n,`/* Failed import: ${i} */`)}}return r}async function S(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 l=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(l,((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(init lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(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=b(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=p(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*([^;]+);/,l=c.match(i);if(l){const[,e,s]=l;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const a=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(a,((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=g(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=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(arr)")||(s=$(s)),s.includes("exec.obj.block(event)")||(s=f(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=m(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=b(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=p(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=a(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();
3
-
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();
@@ -282,9 +282,10 @@ async function initlibraries(css){
282
282
  }
283
283
 
284
284
  function procDef(fscss) {
285
+ const pRegex = /@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g;
286
+
285
287
  // First, extract all @define blocks and store them in defExfscss. FIGSH-FSCSS
286
- let processed = fscss.replace(
287
- /@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g,
288
+ let processed = fscss.replace(pRegex,
288
289
  (match, name, paramsStr, body1, body2, body3, body4) => {
289
290
  const params = paramsStr.split(',').map(p =>p.trim()).filter(p =>p);
290
291
  const body = body1 ?? body2 ?? body3 ?? body4 ?? '';
@@ -324,9 +325,11 @@ const dfv = xfVal[1]?xfVal[1]:'';
324
325
  return result;
325
326
  }
326
327
  );
328
+ if(!pRegex.test(processed)) return processed;
327
329
 
328
- return processed;
330
+ return procDef(processed);
329
331
  }
332
+
330
333
  function procVar(vcss) {
331
334
  function processSCSS(scssCode) {
332
335
  const globalVars = {};
@@ -3,24 +3,41 @@
3
3
  import fs from "fs/promises";
4
4
  import path from "path";
5
5
 
6
+ import {initlibraries} from "./all.js";
7
+ const runnedSet = new Set();
6
8
 
7
9
  export async function impFrom(text, {inputDir=process.cwd()} = {}) {
8
-
10
+ text = await initlibraries(text);
9
11
  const regex = /\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g;
10
12
 
11
- const matches = [...text.matchAll(regex)]
13
+ const matches = [...text.matchAll(regex)];
14
+
15
+ let result = text;
16
+ let setFile = null;
17
+
18
+
19
+ for(const match of matches){
20
+ let [fullMatch, blocks, url1, url2, url3] = match;
21
+
22
+ blocks = blocks.trim();
12
23
 
13
- let result = text;
24
+ const impUrl = (url1||url2||url3).trim();
25
+ setFile = impUrl;
14
26
 
15
- for (const match of matches) {
16
- let [fullMatch, blocks, url1, url2, url3] = match;
17
-
18
- blocks = blocks.trim();
19
-
20
- const impUrl = (url1 || url2 || url3).trim();
27
+ if (runnedSet.has(setFile)) {
28
+ // Helper to escape special characters in the filename (like dots or dashes)
29
+ const escapedFile = setFile.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
30
+
31
+ // Simplified regex using \s* for zero-or-more whitespace
32
+ const fregex = new RegExp("\\@import\\((?:\\s+)?(?:exec)?\\(([\\w\\d\\.\\@\\—\\-_*\\#\\$\\s\\,]+)\\)(?:\\s+)?from(?:\\s+)?(?:\"((?:\\s+)?" + escapedFile + "(?:\\s+)?)\"|'((?:\\s+)?" + escapedFile + "(?:\\s+)?)'|`((?:\\s+)?" + escapedFile + "(?:\\s+)?)`)(?:\\s+)?\\)", 'g');
33
+
34
+
35
+ result = result.replace(fregex, `/* Can't import ${setFile} multiple times */`);
36
+
37
+ console.warn(`[FSCSS Warning] Can't import ${setFile} multiple times at `);
38
+ }
21
39
 
22
40
  try {
23
- let resRegex;
24
41
  let resText;
25
42
  if(/^https?:\/\//.test(impUrl)){
26
43
  // remote
@@ -55,7 +72,9 @@ export async function impFrom(text, {inputDir=process.cwd()} = {}) {
55
72
 
56
73
  }
57
74
  }
58
- return result;
75
+ if(!result.match(regex)) return result;
76
+ runnedSet.add(setFile);
77
+ return impFrom(result);
59
78
  }
60
79
 
61
80
  async function findBlock(text, blocks = []) {
@@ -99,3 +118,6 @@ async function findBlock(text, blocks = []) {
99
118
  })
100
119
  return resBlock.trim();
101
120
  }
121
+
122
+
123
+
@@ -1,16 +1,38 @@
1
1
  // lib/functions/impSel.js
2
2
  import fs from "fs/promises";
3
3
  import path from "path";
4
+ import { initlibraries } from "./all.js";
5
+ const runnedSetS = new Set();
4
6
 
5
7
  export async function impSel(text, { inputDir = process.cwd() } = {}) {
8
+ text = await initlibraries(text);
6
9
  const validImpExt = [".fscss", ".css", ".txt", ".scss", ".less", ".xfscss"];
7
10
  const regex = /@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g;
8
11
  const matches = [...text.matchAll(regex)];
9
12
 
13
+
10
14
  let result = text;
11
-
15
+ let setFile = null;
16
+
12
17
  for (const match of matches) {
13
18
  const [fullMatch, urlSrc, part] = match;
19
+
20
+ setFile = urlSrc;
21
+
22
+
23
+ if (runnedSetS.has(setFile)) {
24
+
25
+ // Helper to escape special characters in the filename (like dots or dashes)
26
+ const escapedFile = setFile.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
27
+
28
+ // Simplified regex using \s* for zero-or-more whitespace
29
+ const fregex = new RegExp("@import\\(exec\\(("+escapedFile+")\\)\\s*\\.\\s*(?:pick|find)\\(([^)]+)\\)\\)", 'g');
30
+
31
+
32
+ result = result.replace(fregex, `/* Can't import ${setFile} multiple times */`);
33
+
34
+ console.warn(`[FSCSS Warning] Can't import ${setFile} multiple times at `);
35
+ }
14
36
 
15
37
  try {
16
38
  const impUrl = urlSrc.replace(/["']/g, "");
@@ -49,7 +71,9 @@ export async function impSel(text, { inputDir = process.cwd() } = {}) {
49
71
  }
50
72
  }
51
73
 
52
- return result;
74
+ if(!result.match(regex)) return result;
75
+ runnedSetS.add(setFile);
76
+ return impSel(result);
53
77
  }
54
78
 
55
79
  function extractOnlyBlock(cssText, blockName) {
@@ -1,50 +1,70 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import https from "https";
4
- import http from "http";
5
-
6
- function fetchRemote(url) {
7
- return new Promise((resolve, reject) => {
8
- const client = url.startsWith("https") ? https : http;
9
- client.get(url, res => {
10
- if (res.statusCode !== 200) {
11
- reject(new Error(`Failed to fetch ${url}, status ${res.statusCode}`));
12
- return;
13
- }
14
- let data = "";
15
- res.on("data", chunk => (data += chunk));
16
- res.on("end", () => resolve(data));
17
- }).on("error", reject);
18
- });
19
- }
1
+ // lip/functions/procImp.js
20
2
 
21
- export async function procImp(css, { inputDir }) {
22
- // async replace: collect promises then resolve
23
- const matches = [...css.matchAll(/@import\(exec\(([^)]+)\)\)/g)];
3
+ import fs from "fs/promises";
4
+ import path from "path";
5
+ import { initlibraries } from "./all.js";
6
+ const runnedSetImp = new Set();
24
7
 
8
+ export async function procImp(text, {inputDir=process.cwd()} = {}) {
9
+ text = await initlibraries(text);
10
+ const regex = /\@import\((?:\s+)?exec\((?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`|([^\)]+)(?:\s+)?)\)(?:\s+)?\)/g;
11
+
12
+ const matches = [...text.matchAll(regex)];
13
+
14
+ let result = text;
15
+ let setFile = null;
16
+
17
+
25
18
  for (const match of matches) {
26
- const rawPath = match[1].trim();
27
- let importedContent = "";
28
-
29
- if (rawPath.startsWith("http://") || rawPath.startsWith("https://")) {
30
- // remote import
31
- importedContent = await fetchRemote(rawPath);
32
- } else {
33
- // local import
34
- const absPath = path.resolve(inputDir, rawPath);
35
- if (!fs.existsSync(absPath)) {
36
- throw new Error(`FSCSS import failed: file not found ${absPath}`);
19
+ let [fullMatch, url1, url2, url3, url4] = match;
20
+
21
+ const impUrl = (url1 || url2 || url3 || url4).trim();
22
+ setFile = impUrl;
23
+
24
+ if (runnedSetImp.has(setFile)) {
25
+ // Helper to escape special characters in the filename (like dots or dashes)
26
+ const escapedFile = setFile.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
27
+
28
+ // Simplified regex using \s* for zero-or-more whitespace
29
+ const fregex = new RegExp("\\@import\\((?:\\s+)?exec\\((?:\\s+)?(?:\"("+ escapedFile + ")\"|'("+ escapedFile + ")'|`("+ escapedFile + ")`|("+ escapedFile + ")(?:\\s+)?)\\)(?:\\s+)?\\)", 'g');
30
+
31
+
32
+ result = result.replace(fregex, `/* Can't import ${setFile} multiple times */`);
33
+
34
+ console.warn(`[FSCSS Warning] Can't import ${setFile} multiple times at `);
35
+ }
36
+
37
+
38
+ try {
39
+
40
+ let resText;
41
+ if(/^https?:\/\//.test(impUrl)){
42
+ // remote
43
+ const response = await fetch(impUrl);
44
+
45
+ if (!response.ok) throw new Error(`fscss[@import] HTTP ${response.status} for ${impUrl}`);
46
+
47
+ resText = await response.text();
37
48
  }
38
- importedContent = fs.readFileSync(absPath, "utf8");
39
-
40
- // recursive support (nested imports)
41
- importedContent = await procImp(importedContent, {
42
- inputDir: path.dirname(absPath),
43
- });
49
+ else{
50
+ // local
51
+ const fillPath = path.resolve(inputDir, impUrl);
52
+ resText = await fs.readFile(fillPath, 'utf8');
53
+ }
54
+
55
+ result = result.replace(fullMatch, resText);
56
+
57
+ } catch (error) {
58
+ console.error(`fscss[@import] Failed: ${impUrl} `, error);
59
+
60
+ result = result.replace(fullMatch, `/* Failed import: ${impUrl} */`);
61
+
44
62
  }
45
-
46
- css = css.replace(match[0], importedContent);
47
63
  }
48
-
49
- return css;
64
+
65
+ if (!result.match(regex)) return result;
66
+ runnedSetImp.add(setFile);
67
+ return procImp(result);
50
68
  }
69
+
70
+
package/lib/processor.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // lib/processor.js
2
2
  import {
3
- initlibraries,
4
3
  replaceRe,
5
4
  procExt,
6
5
  procVar,
@@ -25,34 +24,9 @@ export async function processFscss(css, options = {}) {
25
24
  const { inputDir = process.cwd() } = options;
26
25
 
27
26
  if (!css.includes("exec.obj.block(all)")) {
28
- if(!css.includes("exec.obj.block(init lab)"))css = await initlibraries(css);
29
27
  if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import pick)")){css = await impSel(css, {inputDir});}
30
28
  if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import from)")){css = await impFrom(css, {inputDir});}
31
29
  if(!css.includes("exec.obj.block(f import)")){css = await procImp(css, {inputDir});}
32
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
33
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import from)")){css = await impFrom(css, {inputDir});}
34
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
35
- if(!css.includes("exec.obj.block(f import)")){css = await procImp(css, {inputDir});}
36
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
37
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import pick)")){css = await impSel(css, {inputDir});}
38
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
39
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import from)")){css = await impFrom(css, {inputDir});}
40
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
41
- if(!css.includes("exec.obj.block(f import)")){css = await procImp(css, {inputDir});}
42
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
43
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import pick)")){css = await impSel(css, {inputDir});}
44
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
45
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import from)")){css = await impFrom(css, {inputDir});}
46
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
47
- if(!css.includes("exec.obj.block(f import)")){css = await procImp(css, {inputDir});}
48
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
49
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import pick)")){css = await impSel(css, {inputDir});}
50
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
51
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import from)")){css = await impFrom(css, {inputDir});}
52
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
53
- if(!css.includes("exec.obj.block(f import)")){css = await procImp(css, {inputDir});}
54
- if(!css.includes("exec.obj.block(init lab)")||css.includes("exec.obj.block(exInit lab)"))css =await initlibraries(css);
55
- if(!css.includes("exec.obj.block(f import)")||!css.includes("exec.obj.block(f import pick)")){css = await impSel(css, {inputDir});}
56
30
  if(!css.includes("exec.obj.block(vfc)")) css = vfc(css);
57
31
  if(!css.includes("exec.obj.block(store:before)")||!css.includes("exec.obj.block(store)"))css = replaceRe(css);
58
32
  if(!css.includes("exec.obj.block(ext:before)")||!css.includes("exec.obj.block(ext)"))css = procExt(css);
@@ -61,9 +35,6 @@ export async function processFscss(css, options = {}) {
61
35
  if(!css.includes("exec.obj.block(length)"))css = procChe(css);
62
36
  if(!css.includes("exec.obj.block(count)"))css = procCnt(css);
63
37
  if(!css.includes("exec.obj.block(define)"))css = procDef(css);
64
- if(!css.includes("exec.obj.block(define)"))css = procDef(css);
65
- if(!css.includes("exec.obj.block(define)"))css = procDef(css);
66
- if(!css.includes("exec.obj.block(define)"))css = procDef(css);
67
38
  if(!css.includes("exec.obj.block(arr)"))css = procArr(css);
68
39
  if(!css.includes("exec.obj.block(event)"))css = procEv(css);
69
40
  if(!css.includes("exec.obj.block(random)"))css = procRan(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.16",
4
+ "version": "1.1.17",
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#readme",
32
+ "homepage": "https://github.com/Figsh/xfscss#breadme",
33
33
  "dependencies": {
34
34
  "dotenv": "^16.0.3",
35
35
  "express": "^4.18.2"
package/style.fscss CHANGED
@@ -1,4 +1,4 @@
1
- @import((*) from themes)
1
+ @import(exec(_init themes))
2
2
 
3
3
  body{
4
4
  Background: @event.theme(light);
package/xfscss.js CHANGED
@@ -1 +1,2 @@
1
- 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=10,c={};function i(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 a(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 f(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 a=i(e,c);if(0===a.length||"}"!==a[a.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+a.length);const f=l(a),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+a.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="",l=!1,a=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(a&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),a=!0),!l||"el"===e.type){if("el"===e.type){if(l)continue;l=!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}'.`),l=!0):l=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),l=isNaN(t)?t:Number(t);switch(s){case"==":return i==l;case"!=":return i!=l;case">":return i>l;case"<":return i<l;case">=":return i>=l;case"<=":return i<=l;default:return!1}}}))}if(l){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&&!l?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 u(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 d(e){let n=e.replace(/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g,((e,n,r,s,t,o,i)=>{const l=r.split(",").map((e=>e.trim())).filter((e=>e)),a=s??t??o??i??"";return c[n]={params:l,body:a},""}));return n=n.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=c[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let o=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 c=i[1]?i[1]:"",l=void 0!==t[n]?t[n]:c,a=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");o=o.replace(a,l)})),o})),n}function p(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 $(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 g(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 m(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const l=parseInt(c),a=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=l>=0?t.substring(0,l):t.substring(t.length+l),n.add(`--${a}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function b(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 w(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=[...e.matchAll(/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g)];let s=e;for(const e of r){const[r,t,o]=e;try{const e=t.replace(/["']/g,""),c=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(c))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 ${t}`);const l=h(await i.text(),o.trim());s=s.replace(r,l)}catch(e){console.error(`fscss[@import] Failed: ${t} `,e),s=s.replace(r,`/* Failed import: ${t} */`)}}return s}function h(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 v=[".fscss",".css",".txt",".scss",".less",".xfscss"];async function k(e,n=0,r=window.location.href){if(n>o)return console.warn("fscss[@import]\n Maximum import depth exceeded. Skipping further imports."),e;const s=Array.from(e.matchAll(/@import\s*\(\s*exec\s*\(\s*((?:'[^']*'|"[^"]*"|[^'")]\S*)\s*)\)\s*\)/g));if(0===s.length)return e;const t=await Promise.all(s.map((async e=>{const[s,t]=e;try{const e=t.replace(/^['"](.*)['"]$/,"$1").trim(),s=new URL(e,r).href,o=new URL(s).pathname,c=o.slice(o.lastIndexOf(".")).toLowerCase();if(s.trim().startsWith("_init")&&s.includes(" "))return void console.warn(`fscss[@import] library not found for: ${s}`);if(!v.includes(c))return console.warn(`fscss[@import] \n Invalid import URL extension "${c}" for "${s}". Only ${v.join(", ")} are allowed.`),`/* Invalid extension for "${s}" */`;const i=await fetch(s);if(!i.ok)throw new Error(`HTTP ${i.status} for ${s}`);return k(await i.text(),n+1,s)}catch(e){return console.warn(`fscss[@import]\n Failed to import "${t}" from "${r}":`,e),`/* Error importing "${t}": ${e.message} */`}})));let c=0,i="";return s.forEach(((n,r)=>{i+=e.slice(c,n.index),i+=t[r],c=n.index+n[0].length})),i+=e.slice(c),i}async function j(e){try{return await k(e)}catch(n){return console.warn("fscss[]\n Processing failed:",n),console.warn("fscss[@import] Warning: can't resolve imports"),e}}async function y(e){const n=[...e.matchAll(/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g)];let r=e;for(const e of n){let[n,s,t,o,c]=e;s=s.trim();const i=(t||o||c).trim();try{const e=await fetch(i);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${i}`);const t=await e.text();if("*"===s&&(r=r.replace(n,t)),"*"!==s&&s.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),r=r.replace(n,"/* syntax error: unexpected * */")),"*"!==s&&!s.includes("*")){const e=s.split(",").map((e=>e.trim())),o=await S(t,e);r=r.replace(n,o)}}catch(e){console.error(`fscss[@import] Failed: ${i} `,e),r=r.replace(n,`/* Failed import: ${i} */`)}}return r}async function S(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 l=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(l,((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(init lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(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=b(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=p(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*([^;]+);/,l=c.match(i);if(l){const[,e,s]=l;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const a=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(a,((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=g(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=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(arr)")||(s=$(s)),s.includes("exec.obj.block(event)")||(s=f(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=m(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=b(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=p(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=a(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();
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();
package/e/index.js DELETED
@@ -1,3 +0,0 @@
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=10,c={};function i(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 a(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 f(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 a=i(e,c);if(0===a.length||"}"!==a[a.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+a.length);const f=l(a),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+a.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="",l=!1,a=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(a&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),a=!0),!l||"el"===e.type){if("el"===e.type){if(l)continue;l=!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}'.`),l=!0):l=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),l=isNaN(t)?t:Number(t);switch(s){case"==":return i==l;case"!=":return i!=l;case">":return i>l;case"<":return i<l;case">=":return i>=l;case"<=":return i<=l;default:return!1}}}))}if(l){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&&!l?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 u(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 d(e){let n=e.replace(/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g,((e,n,r,s,t,o,i)=>{const l=r.split(",").map((e=>e.trim())).filter((e=>e)),a=s??t??o??i??"";return c[n]={params:l,body:a},""}));return n=n.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=c[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let o=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 c=i[1]?i[1]:"",l=void 0!==t[n]?t[n]:c,a=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");o=o.replace(a,l)})),o})),n}function p(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 $(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 g(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 m(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const l=parseInt(c),a=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=l>=0?t.substring(0,l):t.substring(t.length+l),n.add(`--${a}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function b(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 w(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=[...e.matchAll(/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g)];let s=e;for(const e of r){const[r,t,o]=e;try{const e=t.replace(/["']/g,""),c=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(c))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 ${t}`);const l=h(await i.text(),o.trim());s=s.replace(r,l)}catch(e){console.error(`fscss[@import] Failed: ${t} `,e),s=s.replace(r,`/* Failed import: ${t} */`)}}return s}function h(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 v=[".fscss",".css",".txt",".scss",".less",".xfscss"];async function k(e,n=0,r=window.location.href){if(n>o)return console.warn("fscss[@import]\n Maximum import depth exceeded. Skipping further imports."),e;const s=Array.from(e.matchAll(/@import\s*\(\s*exec\s*\(\s*((?:'[^']*'|"[^"]*"|[^'")]\S*)\s*)\)\s*\)/g));if(0===s.length)return e;const t=await Promise.all(s.map((async e=>{const[s,t]=e;try{const e=t.replace(/^['"](.*)['"]$/,"$1").trim(),s=new URL(e,r).href,o=new URL(s).pathname,c=o.slice(o.lastIndexOf(".")).toLowerCase();if(s.trim().startsWith("_init")&&s.includes(" "))return void console.warn(`fscss[@import] library not found for: ${s}`);if(!v.includes(c))return console.warn(`fscss[@import] \n Invalid import URL extension "${c}" for "${s}". Only ${v.join(", ")} are allowed.`),`/* Invalid extension for "${s}" */`;const i=await fetch(s);if(!i.ok)throw new Error(`HTTP ${i.status} for ${s}`);return k(await i.text(),n+1,s)}catch(e){return console.warn(`fscss[@import]\n Failed to import "${t}" from "${r}":`,e),`/* Error importing "${t}": ${e.message} */`}})));let c=0,i="";return s.forEach(((n,r)=>{i+=e.slice(c,n.index),i+=t[r],c=n.index+n[0].length})),i+=e.slice(c),i}async function j(e){try{return await k(e)}catch(n){return console.warn("fscss[]\n Processing failed:",n),console.warn("fscss[@import] Warning: can't resolve imports"),e}}async function y(e){const n=[...e.matchAll(/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g)];let r=e;for(const e of n){let[n,s,t,o,c]=e;s=s.trim();const i=(t||o||c).trim();try{const e=await fetch(i);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${i}`);const t=await e.text();if("*"===s&&(r=r.replace(n,t)),"*"!==s&&s.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),r=r.replace(n,"/* syntax error: unexpected * */")),"*"!==s&&!s.includes("*")){const e=s.split(",").map((e=>e.trim())),o=await S(t,e);r=r.replace(n,o)}}catch(e){console.error(`fscss[@import] Failed: ${i} `,e),r=r.replace(n,`/* Failed import: ${i} */`)}}return r}async function S(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 l=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(l,((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(init lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(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=b(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=p(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*([^;]+);/,l=c.match(i);if(l){const[,e,s]=l;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const a=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(a,((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=g(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=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(arr)")||(s=$(s)),s.includes("exec.obj.block(event)")||(s=f(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=m(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=b(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=p(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=a(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();
3
-
package/index.js DELETED
@@ -1,4 +0,0 @@
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=10,c={};function i(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 a(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 f(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 a=i(e,c);if(0===a.length||"}"!==a[a.length-1]){console.warn(`fscss[parsing] Warning: Malformed block for @event '${r}'. Missing closing '}'.`);continue}e.slice(s.index,c+a.length);const f=l(a),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+a.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="",l=!1,a=!1;for(const e of t.conditionBlocks)if("el"===e.type&&(a&&console.warn(`fscss[logic] Warning: Multiple 'el' (else) blocks found in @event '${r}'. Only the first 'el' block will be considered.`),a=!0),!l||"el"===e.type){if("el"===e.type){if(l)continue;l=!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}'.`),l=!0):l=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),l=isNaN(t)?t:Number(t);switch(s){case"==":return i==l;case"!=":return i!=l;case">":return i>l;case"<":return i<l;case">=":return i>=l;case"<=":return i<=l;default:return!1}}}))}if(l){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&&!l?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 u(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 d(e){let n=e.replace(/@define\s+([\w\_\-\—]+)\s*\(([^)]*)\)\s*\$?\{\s*(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\}^\{]*?))\s*\}/g,((e,n,r,s,t,o,i)=>{const l=r.split(",").map((e=>e.trim())).filter((e=>e)),a=s??t??o??i??"";return c[n]={params:l,body:a},""}));return n=n.replace(/@([\w\_\-\—]+)\s*\(([\s\S]*?)\)/g,((e,n,r)=>{const s=c[n];if(!s)return e;const t=r?.split(",").map((e=>e.trim()));""===t[0]&&(t[0]=void 0);let o=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 c=i[1]?i[1]:"",l=void 0!==t[n]?t[n]:c,a=new RegExp(`@use\\(\\s*${e.replace(/(\s+)?(\:(\s+)?.*)/g,"")}\\s*\\)`,"g");o=o.replace(a,l)})),o})),n}function p(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 $(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 g(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 m(e){const n=new Set,r=e.replace(/(:\s*)(["']?)(.*?)(["']?)\s*copy\(([-]?\d+),\s*([^\;^\)^\(^,^ ]*)\)/g,((e,r,s,t,o,c,i)=>{const l=parseInt(c),a=i.replace(/[^a-zA-Z0-9_-]/g,"");let f="";return f=l>=0?t.substring(0,l):t.substring(t.length+l),n.add(`--${a}:${f};`),`${r}${s}${t}${o}`}));if(n.size>0){return r+`\n${`:root{${Array.from(n).join("\n")}\n}`}`}return r}function b(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 w(e){const n=[".fscss",".css",".txt",".scss",".less","xfscss"],r=[...e.matchAll(/@import\(exec\(([^)]+)\)\s*\.\s*(?:pick|find)\(([^)]+)\)\)/g)];let s=e;for(const e of r){const[r,t,o]=e;try{const e=t.replace(/["']/g,""),c=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(c))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 ${t}`);const l=h(await i.text(),o.trim());s=s.replace(r,l)}catch(e){console.error(`fscss[@import] Failed: ${t} `,e),s=s.replace(r,`/* Failed import: ${t} */`)}}return s}function h(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 v=[".fscss",".css",".txt",".scss",".less",".xfscss"];async function k(e,n=0,r=window.location.href){if(n>o)return console.warn("fscss[@import]\n Maximum import depth exceeded. Skipping further imports."),e;const s=Array.from(e.matchAll(/@import\s*\(\s*exec\s*\(\s*((?:'[^']*'|"[^"]*"|[^'")]\S*)\s*)\)\s*\)/g));if(0===s.length)return e;const t=await Promise.all(s.map((async e=>{const[s,t]=e;try{const e=t.replace(/^['"](.*)['"]$/,"$1").trim(),s=new URL(e,r).href,o=new URL(s).pathname,c=o.slice(o.lastIndexOf(".")).toLowerCase();if(s.trim().startsWith("_init")&&s.includes(" "))return void console.warn(`fscss[@import] library not found for: ${s}`);if(!v.includes(c))return console.warn(`fscss[@import] \n Invalid import URL extension "${c}" for "${s}". Only ${v.join(", ")} are allowed.`),`/* Invalid extension for "${s}" */`;const i=await fetch(s);if(!i.ok)throw new Error(`HTTP ${i.status} for ${s}`);return k(await i.text(),n+1,s)}catch(e){return console.warn(`fscss[@import]\n Failed to import "${t}" from "${r}":`,e),`/* Error importing "${t}": ${e.message} */`}})));let c=0,i="";return s.forEach(((n,r)=>{i+=e.slice(c,n.index),i+=t[r],c=n.index+n[0].length})),i+=e.slice(c),i}async function j(e){try{return await k(e)}catch(n){return console.warn("fscss[]\n Processing failed:",n),console.warn("fscss[@import] Warning: can't resolve imports"),e}}async function y(e){const n=[...e.matchAll(/\@import\((?:\s+)?(?:exec)?\(([\w\d\.\@\—\-_*\#\$\s\,]+)\)(?:\s+)?from(?:\s+)?(?:"([^"]+)"|'([^']+)'|`([^`]+)`)(?:\s+)?\)/g)];let r=e;for(const e of n){let[n,s,t,o,c]=e;s=s.trim();const i=(t||o||c).trim();try{const e=await fetch(i);if(!e.ok)throw new Error(`fscss[@import] HTTP ${e.status} for ${i}`);const t=await e.text();if("*"===s&&(r=r.replace(n,t)),"*"!==s&&s.includes("*")&&(console.warn(`[FSCSS Warning] syntax error at ${n}: unexpected *`),r=r.replace(n,"/* syntax error: unexpected * */")),"*"!==s&&!s.includes("*")){const e=s.split(",").map((e=>e.trim())),o=await S(t,e);r=r.replace(n,o)}}catch(e){console.error(`fscss[@import] Failed: ${i} `,e),r=r.replace(n,`/* Failed import: ${i} */`)}}return r}async function S(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 l=new RegExp("(@define\\s+)("+t+")(\\s*\\(([^)]*)\\)\\s*\\$?\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|([^\\}^\\{]*?))\\s*\\})","g");r+=i.join("\n").replace(l,((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(init lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")||(s=await j(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import from)")||(s=await y(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(s)),s.includes("exec.obj.block(f import)")&&s.includes("exec.obj.block(f import pick)")||(s=await w(s)),s.includes("exec.obj.block(init lab)")&&!s.includes("exec.obj.block(exInit lab)")||(s=await u(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=b(s)),s.includes("exec.obj.block(ext:before)")&&s.includes("exec.obj.block(ext)")||(s=p(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*([^;]+);/,l=c.match(i);if(l){const[,e,s]=l;t?o[e]=s.trim():(n[e]=s.trim(),r.push(c));continue}const a=/\$\/?([a-zA-Z0-9_-]+)(!)?/g;c=c.replace(a,((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=g(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=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(define)")||(s=d(s)),s.includes("exec.obj.block(arr)")||(s=$(s)),s.includes("exec.obj.block(event)")||(s=f(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=m(s)),s.includes("exec.obj.block(store:after)")&&s.includes("exec.obj.block(store)")||(s=b(s)),s.includes("exec.obj.block(num)")||(s=r(s)),s.includes("exec.obj.block(ext:after)")&&s.includes("exec.obj.block(ext)")||(s=p(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=a(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();
3
-
4
-