admin08077/Githubgemini
0
1import{r as u,j as s}from"./react-DKy9e2uO.js";import{i as S}from"./index-Ykf-MVva.js";import"./bottleneck-Cpj98o6Y.js";import"./react-dom-CpxHE_eW.js";import"./scheduler-DYLXRpC5.js";import"./idb-Dob3nYDb.js";import"./@google-D80DdW2m.js";import"./marked-CesSW9Du.js";import"./jszip-s56H2EZ-.js";const h=`$primary-color: #0047AB;2$font-size: 16px;3 4.container {5 padding: 20px;6 background-color: #f0f0f0;7 8 .title {9 color: $primary-color;10 font-size: $font-size * 1.5;11 12 &:hover {13 text-decoration: underline;14 }15 }16 17 > p {18 margin-top: 10px;19 }20}`,g=c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),b=c=>{try{let e=c;e=e.replace(/\/\/.*$/gm,"");const i={};e=e.replace(/\$([\w-]+):\s*(.*?);/g,(t,r,o)=>(i[r]=o.trim(),""));for(let t=0;t<5;t++)Object.entries(i).forEach(([r,o])=>{e=e.replace(new RegExp(`\\$${g(r)}`,"g"),o)});e=e.replace(/([\d.]+)(px|rem|em|%)\s*([*\/])\s*([\d.]+)/g,(t,r,o,m,n)=>{const p=parseFloat(r),x=parseFloat(n);return`${m==="*"?p*x:p/x}${o}`});const a=(t,r="")=>{let o="",m="";const n=[],p=/((?:[\w-:.#&>+~*\s,]+|\([^)]*\))\s*\{[^{}]*\})|((?:[\w-]+\s*:[^;]+;))/g,x=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));let l;for(;(l=p.exec(x))!==null;)if(l[1]){const d=l[1].substring(0,l[1].indexOf("{")).trim(),f=d.includes("&")?d.replace(/&/g,r):`${r} ${d}`.trim();m+=a(l[1],f)}else l[2]&&n.push(` ${l[2].trim()}`);return n.length>0&&(o=`${r} {21${n.join(`22`)}23}24`),o+m};return a(`root{${e}}`,"").trim().replace(/root\s*\{\s*\}/,"").trim()}catch(e){return console.error("SCSS Compilation Error:",e),"/* Error compiling SCSS. Check console for details. */"}},O=()=>{const[c,e]=u.useState(h),i=u.useMemo(()=>b(c),[c]);return s.jsxs("div",{className:"h-full flex flex-col p-4 sm:p-6 lg:p-8 text-text-primary",children:[s.jsxs("header",{className:"mb-6",children:[s.jsxs("h1",{className:"text-3xl flex items-center",children:[s.jsx(S,{}),s.jsx("span",{className:"ml-3",children:"SASS/SCSS Compiler"})]}),s.jsx("p",{className:"text-text-secondary mt-1",children:"A real-time SASS/SCSS to CSS compiler."})]}),s.jsxs("div",{className:"flex-grow flex flex-col gap-4 min-h-0",children:[s.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[s.jsx("label",{htmlFor:"scss-input",className:"text-sm font-medium text-text-secondary mb-2",children:"SASS/SCSS Input"}),s.jsx("textarea",{id:"scss-input",value:c,onChange:a=>e(a.target.value),className:"flex-grow p-4 bg-surface border border-border rounded-md resize-y font-mono text-sm text-pink-600",spellCheck:"false"})]}),s.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[s.jsx("label",{className:"text-sm font-medium text-text-secondary mb-2",children:"Compiled CSS Output"}),s.jsx("pre",{className:"flex-grow p-4 bg-background border border-border rounded-md overflow-y-auto text-blue-700 font-mono text-sm whitespace-pre-wrap",children:i})]})]})]})};export{O as SassScssCompiler};25//# sourceMappingURL=SassScssCompiler-GXYTPJQa.js.map26 