tekivex-ui 2.5.16 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -8
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +14 -14
- package/dist/{chunk-B3ph66Zb.js → chunk-BHX35YDv.js} +1 -1
- package/dist/chunk-BpuJ3-K8.js +1 -0
- package/dist/{chunk-Bc16rJT-.js → chunk-C8Wy8P59.js} +1 -1
- package/dist/chunk-CDGrC2Wo.js +3 -0
- package/dist/chunk-D7-yknXg.js +1 -0
- package/dist/chunk-DcVMayoM.js +1 -0
- package/dist/chunk-DdHSYetV.js +1 -0
- package/dist/chunk-VUD-TF9j.js +1 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +1 -1
- package/dist/i18n.cjs +1 -1
- package/dist/i18n.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +22 -3
- package/dist/index.js +514 -419
- package/dist/quantum.cjs +1 -1
- package/dist/quantum.js +17 -17
- package/dist/realtime.cjs +1 -1
- package/dist/realtime.js +1 -1
- package/dist/src/components/TkxAadhaarInput.d.ts +22 -0
- package/dist/src/components/TkxAddressInput.d.ts +32 -0
- package/dist/src/components/TkxCalendarLunar.d.ts +25 -0
- package/dist/src/components/TkxCaptcha.d.ts +23 -0
- package/dist/src/components/TkxCheckout.d.ts +26 -0
- package/dist/src/components/TkxConfetti.d.ts +21 -0
- package/dist/src/components/TkxCurrencyInput.d.ts +20 -0
- package/dist/src/components/TkxFontProvider.d.ts +12 -0
- package/dist/src/components/TkxImageEditor.d.ts +44 -0
- package/dist/src/components/TkxInput.d.ts +1 -0
- package/dist/src/components/TkxKycInputs.d.ts +59 -0
- package/dist/src/components/TkxOTP.d.ts +2 -1
- package/dist/src/components/TkxOrgChart.d.ts +32 -0
- package/dist/src/components/TkxPaymentButton.d.ts +61 -0
- package/dist/src/components/TkxPhoneInput.d.ts +34 -0
- package/dist/src/components/TkxSEO.d.ts +58 -0
- package/dist/src/components/TkxSignaturePad.d.ts +21 -0
- package/dist/src/components/TkxSortable.d.ts +18 -0
- package/dist/src/components/TkxSubscription.d.ts +42 -0
- package/dist/src/components/TkxWatermark.d.ts +8 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/engine/security.d.ts +45 -0
- package/dist/src/i18n/index.d.ts +51 -0
- package/dist/src/themes/index.d.ts +6 -1
- package/dist/tekivex-ui.css +1 -1
- package/package.json +20 -4
- package/dist/chunk-BiHAhNbu.js +0 -3
- package/dist/chunk-CVRuGUFA.js +0 -1
- package/dist/chunk-Dc4_ud5s.js +0 -1
- package/dist/chunk-Dj40UFcz.js +0 -1
- package/dist/chunk-DjxOP8W4.js +0 -1
- package/dist/chunk-PJ50l0JC.js +0 -1
package/dist/quantum.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunk-DmRB1Blb.js"),t=require("./chunk-DjxOP8W4.js"),n=require("./chunk-Dc4_ud5s.js");let r=require("react");r=e.__toESM(r,1);let o=require("react/jsx-runtime");var i=class e{constructor(e,t){this.re=e,this.im=t}add(t){return new e(this.re+t.re,this.im+t.im)}sub(t){return new e(this.re-t.re,this.im-t.im)}mul(t){return new e(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)}scale(t){return new e(this.re*t,this.im*t)}conjugate(){return new e(this.re,-this.im)}magnitudeSquared(){return this.re*this.re+this.im*this.im}magnitude(){return Math.sqrt(this.magnitudeSquared())}static fromPolar(t,n){return new e(t*Math.cos(n),t*Math.sin(n))}static zero(){return new e(0,0)}static one(){return new e(1,0)}},a=class e{constructor(e=i.one(),t=i.zero()){this.alpha=e,this.beta=t,this.normalize()}normalize(){const e=Math.sqrt(this.alpha.magnitudeSquared()+this.beta.magnitudeSquared());e>0&&(this.alpha=this.alpha.scale(1/e),this.beta=this.beta.scale(1/e))}hadamard(){const t=1/Math.SQRT2;return new e(this.alpha.add(this.beta).scale(t),this.alpha.sub(this.beta).scale(t))}ry(t){const n=Math.cos(t/2),r=Math.sin(t/2);return new e(this.alpha.scale(n).sub(this.beta.scale(r)),this.alpha.scale(r).add(this.beta.scale(n)))}phase(t){const n=i.fromPolar(1,t);return new e(this.alpha,this.beta.mul(n))}measure(){const e=this.beta.magnitudeSquared();return Math.random()<e?1:0}expectation(){return this.beta.magnitudeSquared()}getAlpha(){return this.alpha}getBeta(){return this.beta}},l=class{constructor(e){this.qubits=Array.from({length:e},()=>new a)}get size(){return this.qubits.length}getQubit(e){return this.qubits[e]}superpose(){this.qubits=this.qubits.map(e=>e.hadamard())}cnot(e,t){const n=this.qubits[e],r=this.qubits[t],o=n.expectation();this.qubits[t]=r.ry(Math.PI*o)}rotate(e,t){this.qubits[e]=this.qubits[e].ry(t)}measure(){return this.qubits.map(e=>e.measure())}probs(){return this.qubits.map(e=>e.expectation())}},s=class{constructor(e=1,t=.995,n=.3,r=1e-6){this.temperature=e,this.coolingRate=t,this.tunnelingStrength=n,this.minTemp=r}anneal(e,t,n,r=1e3){let o=e,i=t(o),a=o,l=i,s=this.temperature,d=0,c=0;for(let p=0;p<r&&s>this.minTemp;p++){const e=n(o),r=t(e),p=r-i;let h=!1;if(p<=0)h=!0;else{const e=Math.exp(-p/s),t=Math.sqrt(2*Math.abs(p)),n=Math.abs(p),r=Math.exp(-2*t*Math.sqrt(n)*this.tunnelingStrength);Math.random()<e+r&&(h=!0,Math.random()<r/(e+r+1e-10)&&c++)}h&&(o=e,i=r,d++,i<l&&(a=o,l=i)),s*=this.coolingRate}return{state:a,energy:l,iterations:r,accepted:d,tunnels:c}}},d=class{constructor(e,t){const n=Math.sqrt(2/(e+t));this.weights=Array.from({length:e},()=>Array.from({length:t},()=>(2*Math.random()-1)*n)),this.visibleBias=Array.from({length:e},()=>0),this.hiddenBias=Array.from({length:t},()=>0)}sigmoid(e){const t=.1*(Math.random()-.5);return 1/(1+Math.exp(-(e+t)))}sample(e){return Math.random()<e?1:0}energy(e,t){const n=this.visibleBias.reduce((t,n,r)=>t+n*e[r],0),r=this.hiddenBias.reduce((e,n,r)=>e+n*t[r],0);let o=0;for(let i=0;i<e.length;i++)for(let n=0;n<t.length;n++)o+=e[i]*this.weights[i][n]*t[n];return-(n+r+o)}hiddenProbs(e){return this.hiddenBias.map((t,n)=>{const r=t+e.reduce((e,t,r)=>e+this.weights[r][n]*t,0);return this.sigmoid(r)})}visibleProbs(e){return this.visibleBias.map((t,n)=>{const r=t+e.reduce((e,t,r)=>e+this.weights[n][r]*t,0);return this.sigmoid(r)})}gibbs(e,t=1){let n=[...e],r=[];for(let o=0;o<t;o++)r=this.hiddenProbs(n).map(e=>this.sample(e)),n=this.visibleProbs(r).map(e=>this.sample(e));return{visible:n,hidden:r}}trainCD1(e,t=.01){const n=this.visibleBias.length,r=this.hiddenBias.length,o=Array.from({length:n},()=>Array(r).fill(0)),i=Array(n).fill(0),a=Array(r).fill(0);for(const s of e){const e=this.hiddenProbs(s),t=e.map(e=>this.sample(e)),l=this.visibleProbs(t).map(e=>this.sample(e)),d=this.hiddenProbs(l);for(let a=0;a<n;a++){for(let t=0;t<r;t++)o[a][t]+=s[a]*e[t]-l[a]*d[t];i[a]+=s[a]-l[a]}for(let n=0;n<r;n++)a[n]+=e[n]-d[n]}const l=e.length;for(let s=0;s<n;s++){for(let e=0;e<r;e++)this.weights[s][e]+=t*o[s][e]/l;this.visibleBias[s]+=t*i[s]/l}for(let s=0;s<r;s++)this.hiddenBias[s]+=t*a[s]/l}infer(e){const t=this.hiddenProbs(e),n=t.map(e=>this.sample(e));return{hidden:t,visible:this.visibleProbs(n),energy:this.energy(e,n),iterations:1}}},c=class{amplify(e,t,n=.5){const r=e.length;if(0===r)return[];const o=e.map(t),i=o.filter(e=>e>n).length,a=Math.max(1,i);let l=Array(r).fill(1/Math.sqrt(r));const s=Math.max(1,Math.floor(Math.PI/4*Math.sqrt(r/a)));for(let d=0;d<s;d++){for(let t=0;t<r;t++)o[t]>n&&(l[t]=-l[t]);const e=l.reduce((e,t)=>e+t,0)/r;l=l.map(t=>2*e-t)}return e.map((e,t)=>({index:t,amplitude:l[t],probability:l[t]*l[t],classicalSimilarity:o[t],combined:l[t]*l[t]*.6+.4*o[t]})).sort((e,t)=>t.combined-e.combined)}},p=[{keywords:["email","e-mail","mail"],type:"email",validations:[{rule:"required",message:"Email is required"},{rule:"pattern",value:"^[^@]+@[^@]+\\.[^@]+$",message:"Enter a valid email address"},{rule:"maxLength",value:254,message:"Email too long"}],placeholder:"you@example.com",label:"Email Address",confidence:.98},{keywords:["password","passwd","pwd","pass"],type:"password",validations:[{rule:"required",message:"Password is required"},{rule:"minLength",value:8,message:"Password must be at least 8 characters"},{rule:"pattern",value:"(?=.*[A-Z])(?=.*[0-9])",message:"Include uppercase and a number"}],placeholder:"••••••••",label:"Password",confidence:.97},{keywords:["confirm_password","confirmpassword","confirm_pass","repassword","password2","repeat_password"],type:"password",validations:[{rule:"required",message:"Please confirm your password"},{rule:"match",value:"password",message:"Passwords do not match"}],placeholder:"••••••••",label:"Confirm Password",confidence:.95},{keywords:["phone","mobile","cell","tel","telephone","contact_number"],type:"tel",validations:[{rule:"pattern",value:"^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$",message:"Enter a valid phone number"}],placeholder:"+1 (555) 000-0000",label:"Phone Number",confidence:.93},{keywords:["age"],type:"number",validations:[{rule:"min",value:0,message:"Age cannot be negative"},{rule:"max",value:150,message:"Enter a valid age"},{rule:"integer",message:"Age must be a whole number"}],placeholder:"25",label:"Age",confidence:.9},{keywords:["price","amount","cost","fee","payment","salary","wage","total"],type:"number",validations:[{rule:"min",value:0,message:"Amount cannot be negative"},{rule:"pattern",value:"^\\d+(\\.\\d{1,2})?$",message:"Enter a valid amount (e.g. 9.99)"}],placeholder:"0.00",label:"Amount",confidence:.88},{keywords:["url","website","site","link","homepage","web"],type:"url",validations:[{rule:"pattern",value:"https?://.+",message:"Enter a valid URL starting with http:// or https://"}],placeholder:"https://example.com",label:"Website URL",confidence:.92},{keywords:["zip","zipcode","postal","postcode","pin_code"],type:"text",validations:[{rule:"pattern",value:"^[0-9]{5}(-[0-9]{4})?$",message:"Enter a valid ZIP code (e.g. 12345)"}],placeholder:"12345",label:"ZIP / Postal Code",confidence:.91},{keywords:["date","dob","birthday","birth_date","birthdate","born"],type:"date",validations:[{rule:"required",message:"Date is required"}],placeholder:"YYYY-MM-DD",label:"Date of Birth",confidence:.89},{keywords:["first_name","firstname","fname","given_name"],type:"text",validations:[{rule:"minLength",value:2,message:"First name too short"},{rule:"maxLength",value:50,message:"First name too long"}],placeholder:"Jane",label:"First Name",confidence:.9},{keywords:["last_name","lastname","lname","surname","family_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Last name too short"},{rule:"maxLength",value:50,message:"Last name too long"}],placeholder:"Doe",label:"Last Name",confidence:.9},{keywords:["name","full_name","fullname","display_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Name too short"},{rule:"maxLength",value:100,message:"Name too long"}],placeholder:"Jane Doe",label:"Full Name",confidence:.85},{keywords:["username","user_name","handle","login","loginname"],type:"text",validations:[{rule:"minLength",value:3,message:"Username must be at least 3 characters"},{rule:"maxLength",value:32,message:"Username too long"},{rule:"pattern",value:"^[a-zA-Z0-9_.-]+$",message:"Only letters, numbers, _, - and . allowed"}],placeholder:"cooluser42",label:"Username",confidence:.94},{keywords:["bio","biography","about","description","summary","details"],type:"textarea",validations:[{rule:"maxLength",value:500,message:"Bio must be under 500 characters"}],placeholder:"Tell us about yourself...",label:"Bio",confidence:.87},{keywords:["message","comment","feedback","note","notes","remarks","body"],type:"textarea",validations:[{rule:"minLength",value:10,message:"Message too short"},{rule:"maxLength",value:2e3,message:"Message too long"}],placeholder:"Write your message here...",label:"Message",confidence:.86},{keywords:["search","query","q","keyword","find"],type:"search",validations:[],placeholder:"Search...",label:"Search",confidence:.9},{keywords:["otp","one_time_password","verification_code","pin","code"],type:"text",validations:[{rule:"minLength",value:4,message:"Code too short"},{rule:"maxLength",value:8,message:"Code too long"},{rule:"pattern",value:"^[0-9]+$",message:"Code must be numeric"}],placeholder:"123456",label:"Verification Code",confidence:.92},{keywords:["color","colour","hex_color","brand_color"],type:"color",validations:[],placeholder:"#3b82f6",label:"Color",confidence:.95},{keywords:["address","street","street_address","addr"],type:"text",validations:[{rule:"maxLength",value:200,message:"Address too long"}],placeholder:"123 Main Street",label:"Street Address",confidence:.87},{keywords:["city","town","municipality"],type:"text",validations:[{rule:"maxLength",value:100,message:"City name too long"}],placeholder:"San Francisco",label:"City",confidence:.89},{keywords:["country","nation","country_code"],type:"text",validations:[],placeholder:"United States",label:"Country",confidence:.88},{keywords:["company","organization","org","employer","company_name"],type:"text",validations:[{rule:"maxLength",value:200,message:"Company name too long"}],placeholder:"Acme Inc.",label:"Company",confidence:.87}];function h(e){const t=e.toLowerCase().replace(/[\s-]/g,"_"),n=(new c).amplify(p,e=>{let n=0;for(const r of e.keywords)t===r?n=Math.max(n,1):t.includes(r)||r.includes(t)?n=Math.max(n,.8):r.split("_").some(e=>t.includes(e))&&(n=Math.max(n,.5));return n},.3);if(n.length>0&&n[0].combined>.1){const e=p[n[0].index];return{type:e.type,validations:e.validations,placeholder:e.placeholder,confidence:Math.min(e.confidence*n[0].combined*2,.99),label:e.label}}return{type:"text",validations:[{rule:"maxLength",value:255,message:"Input too long"}],placeholder:e.replace(/_/g," "),confidence:.3,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}}function u(e,t,n){const r=n/100,o=t/100*Math.min(r,1-r),i=t=>{const n=(t+e/30)%12,i=r-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}function g(e){const[t,n,r]=function(e){const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]}(e).map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*r}function m(e,t){const n=g(e),r=g(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function f(e,t,n){return Math.max(t,Math.min(n,e))}function y(e,t,n=800){const r=t?{primary:{h:e,s:70,l:55},secondary:{h:(e+137.5)%360,s:65,l:50},bg:{h:e,s:10,l:8},surface:{h:e,s:10,l:13},text:{h:e,s:15,l:90},border:{h:e,s:15,l:22},accent:{h:(e+120)%360,s:75,l:60}}:{primary:{h:e,s:65,l:40},secondary:{h:(e+137.5)%360,s:55,l:38},bg:{h:e,s:15,l:97},surface:{h:e,s:12,l:100},text:{h:e,s:15,l:12},border:{h:e,s:12,l:85},accent:{h:(e+120)%360,s:70,l:42}};return function(e,t){const n=e=>u(e.h,e.s,e.l),r=t?e.text.l-20:e.text.l+15;return{primary:n(e.primary),secondary:n(e.secondary),background:n(e.bg),surface:n(e.surface),text:n(e.text),textMuted:u(e.text.h,Math.max(0,e.text.s-10),Math.max(20,Math.min(85,r))),border:n(e.border),error:t?"#f87171":"#dc2626",warning:t?"#fbbf24":"#d97706",success:t?"#34d399":"#059669",accent:n(e.accent)}}(new s(1.5,.994,.35,1e-5).anneal(r,e=>function(e,t){let n=0;const r=e=>u(e.h,e.s,e.l),o=r(e.text),i=r(e.bg),a=r(e.surface),l=r(e.primary),s=m(o,i),d=m(o,a),c=m(l,i);s<4.5&&(n+=10*(4.5-s)),d<4.5&&(n+=8*(4.5-d)),c<3&&(n+=5*(3-c)),n+=.05*Math.abs((e.secondary.h-e.primary.h+360)%360-137.508),n+=.03*Math.abs((e.accent.h-e.primary.h+360)%360-120);const p=(e.primary.s+e.secondary.s)/2;p<20&&(n+=.5*(20-p)),p>90&&(n+=.5*(p-90));const h=e.bg.l;t?(h>25&&(n+=2*(h-25)),h<3&&(n+=2*(3-h)),e.text.l<70&&(n+=1.5*(70-e.text.l))):(h<90&&(n+=2*(90-h)),h>100&&(n+=2*(h-100)),e.text.l>30&&(n+=1.5*(e.text.l-30)));const g=Math.abs(e.surface.l-e.bg.l);return g<2&&(n+=2*(2-g)),g>12&&(n+=1*(g-12)),n}(e,t),e=>{const t=["primary","secondary","bg","surface","text","border","accent"],n=t[Math.floor(Math.random()*t.length)],r=["h","s","l"],o=r[Math.floor(Math.random()*r.length)],i=(Math.random()-.5)*("h"===o?30:15),a={...e,[n]:{...e[n]}};return a[n]="h"===o?{...a[n],h:(e[n].h+i+360)%360}:"s"===o?{...a[n],s:f(e[n].s+i,0,100)}:{...a[n],l:f(e[n].l+i,0,100)},a},n).state,t)}var x={qubit:()=>new a,register:e=>new l(e),annealer:(e,t,n)=>new s(e,t,n),qbm:(e,t)=>new d(e,t),amplifier:()=>new c,inferField:h,optimizeTheme:y,contrast:m,hslToHex:u};function b(e,t,n,r){const o=n.trim();switch(e){case"required":return""!==o;case"email":case"pattern":if("string"==typeof t)try{return""===o||new RegExp(t).test(o)}catch{return!0}return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o);case"phone":return""===o||/^\+?[\d\s\-()]{7,15}$/.test(o);case"url":return""===o||/^https?:\/\/.+/.test(o);case"minLength":case"min":{const e=Number(t??0);return""===o||(isNaN(Number(o))?o.length>=e:Number(o)>=e)}case"maxLength":case"max":{const e=Number(t??1/0);return""===o||(isNaN(Number(o))?o.length<=e:Number(o)<=e)}case"integer":return""===o||/^\d+$/.test(o);case"alphanumeric":return""===o||/^[a-zA-Z0-9]+$/.test(o);case"match":return o===(r["string"==typeof t?t:"password"]??"");default:return!0}}function v({phase:e,collapsed:t,primaryColor:n,borderColor:r}){const i=12,a=t?0:e,l=t?0:1.618*e,s=i+10*Math.sin(a)*Math.cos(l),d=12-10*Math.cos(a);return(0,o.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",style:{flexShrink:0,opacity:t?.4:1,transition:"opacity 0.6s"},children:[(0,o.jsx)("circle",{cx:i,cy:12,r:10,fill:"none",stroke:r,strokeWidth:"0.8"}),(0,o.jsx)("ellipse",{cx:i,cy:12,rx:10,ry:3,fill:"none",stroke:r,strokeWidth:"0.5",strokeDasharray:"2 2"}),(0,o.jsx)("line",{x1:i,y1:2,x2:i,y2:22,stroke:r,strokeWidth:"0.5"}),(0,o.jsx)("line",{x1:i,y1:12,x2:s,y2:d,stroke:n,strokeWidth:"1.5",style:{transition:t?"all 0.6s ease-out":"none"}}),(0,o.jsx)("circle",{cx:s,cy:d,r:"2",fill:n,style:{transition:t?"all 0.6s ease-out":"none"}})]})}function k({confidence:e,theme:t}){const n=Math.round(100*e),r=n>=80?t.success:n>=60?t.warning:t.danger;return(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",fontSize:"10px",fontWeight:600,padding:"1px 5px",borderRadius:"999px",backgroundColor:`${r}22`,color:r,border:`1px solid ${r}44`,marginLeft:"6px",verticalAlign:"middle",letterSpacing:"0.03em"},children:["⚛ ",n,"%"]})}function w({config:e,intel:t,qubitPhase:r,value:i,error:a,touched:l,showConfidence:s,showQuantumState:d,collapsed:c,onChange:p,onBlur:h,theme:u,mounted:g,index:m}){const f=e.type??t.type,y=e.label??t.label,x=e.placeholder??t.placeholder,b=void 0!==e.required?e.required:t.validations.some(e=>"required"===e.rule),w=n.sanitizeString(y),S="textarea"===f,C=l&&""!==a,M=`qf-${e.name}`,z={width:"100%",padding:"9px 12px",border:`1.5px solid ${C?u.danger:u.border}`,borderRadius:"8px",backgroundColor:u.surface,color:u.text,fontSize:"14px",fontFamily:"inherit",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",resize:S?"vertical":void 0,minHeight:S?"80px":void 0};return(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",opacity:g?1:0,transform:g?"scaleY(1)":"scaleY(0.92)",transition:`opacity 0.35s ease ${60*m}ms, transform 0.35s ease ${60*m}ms`,transformOrigin:"top"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[d&&(0,o.jsx)(v,{phase:r,collapsed:c,primaryColor:u.primary,borderColor:u.border}),(0,o.jsxs)("label",{htmlFor:M,style:{fontSize:"13px",fontWeight:500,color:u.text,cursor:"pointer"},children:[w,b&&(0,o.jsx)("span",{"aria-hidden":"true",style:{color:u.danger,marginLeft:"3px"},children:"*"})]}),s&&(0,o.jsx)(k,{confidence:t.confidence,theme:u})]}),S?(0,o.jsx)("textarea",{id:M,value:i,onChange:e=>p(e.target.value),onBlur:h,placeholder:x,"aria-invalid":C,"aria-required":b,style:z}):(0,o.jsx)("input",{id:M,type:f,value:i,onChange:e=>p(e.target.value),onBlur:h,placeholder:x,"aria-invalid":C,"aria-required":b,style:z}),C&&(0,o.jsxs)("span",{role:"alert",style:{fontSize:"12px",color:u.danger,display:"flex",alignItems:"center",gap:"4px"},children:[(0,o.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),n.sanitizeString(a)]})]})}function S(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return(65535&t)/65535*Math.PI*2}function C({fields:e,onSubmit:i,submitLabel:a="Submit",layout:l="vertical",showConfidence:s=!0,showQuantumState:d=!1}){const c=t.useTheme(),p=e.map(e=>h(e.name)),[u,g]=(0,r.useState)(()=>Object.fromEntries(e.map(e=>[e.name,""]))),[m,f]=(0,r.useState)({}),[y,x]=(0,r.useState)({}),[v,k]=(0,r.useState)(!1),[C,M]=(0,r.useState)(!1),[z,T]=(0,r.useState)(!1);(0,r.useEffect)(()=>{const e=requestAnimationFrame(()=>M(!0));return()=>cancelAnimationFrame(e)},[]);const $=(0,r.useCallback)((t,n)=>{const r=e.find(e=>e.name===t),o=p[e.findIndex(e=>e.name===t)];if(!r||!o)return"";const i=n[t]??"";for(const{rule:e,value:a,message:l}of o.validations)if(("required"!==e||!1!==r.required)&&!b(e,a,i,n))return l;return""},[e]),A=(0,r.useCallback)(t=>{const n={};for(const r of e){const e=$(r.name,t);e&&(n[r.name]=e)}return n},[e,$]),W=(0,r.useCallback)((t,n)=>{g(r=>{const o={...r,[t]:n};if(y[t]&&(f(e=>({...e,[t]:$(t,o)})),"password"===t)){const t=e.find(e=>["confirmpassword","confirm_password","passwordconfirm"].includes(e.name.toLowerCase().replace(/[\s_-]/g,"")))?.name;t&&y[t]&&f(e=>({...e,[t]:$(t,o)}))}return o}),T(!0)},[e,y,$]),R=(0,r.useCallback)(e=>{x(t=>({...t,[e]:!0})),f(t=>({...t,[e]:$(e,u)}))},[u,$]),B=(0,r.useCallback)(async t=>{t.preventDefault(),x(Object.fromEntries(e.map(e=>[e.name,!0])));const n=A(u);if(f(n),!(Object.keys(n).length>0)){k(!0);try{await i(u)}finally{k(!1)}}},[e,u,A,i]),F=p.length>0?Math.round(p.reduce((e,t)=>e+t.confidence,0)/p.length*100):0,L=F>=80?c.success:F>=60?c.warning:c.danger,I="horizontal"===l;return(0,o.jsxs)("form",{onSubmit:B,noValidate:!0,className:n.tkx("w-full"),style:{backgroundColor:c.surface,border:`1px solid ${c.border}`,borderRadius:"12px",padding:"24px",position:"relative",boxSizing:"border-box"},children:[(0,o.jsx)("span",{"aria-label":"Powered by Quantum AI",style:{position:"absolute",top:"16px",right:"16px",fontSize:"10px",fontWeight:700,padding:"3px 8px",borderRadius:"999px",backgroundColor:`${c.primary}20`,color:c.primary,border:`1px solid ${c.primary}44`,letterSpacing:"0.04em",userSelect:"none"},children:"⚛ Quantum AI"}),s&&(0,o.jsxs)("div",{style:{marginBottom:"20px",paddingRight:"100px"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[(0,o.jsx)("span",{style:{fontSize:"11px",color:c.textMuted,fontWeight:500},children:"Form Intelligence Confidence"}),(0,o.jsxs)("span",{style:{fontSize:"11px",fontWeight:700,color:L},children:[F,"%"]})]}),(0,o.jsx)("div",{style:{height:"4px",borderRadius:"4px",backgroundColor:c.border,overflow:"hidden"},children:(0,o.jsx)("div",{style:{height:"100%",width:`${F}%`,backgroundColor:L,borderRadius:"4px",transition:"width 0.8s ease"}})})]}),(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:I?"repeat(auto-fill, minmax(260px, 1fr))":"1fr",gap:"16px",marginBottom:"20px"},children:e.map((e,t)=>(0,o.jsx)(w,{config:e,intel:p[t],qubitPhase:S(e.name),value:u[e.name]??"",error:m[e.name]??"",touched:y[e.name]??!1,showConfidence:s,showQuantumState:d,collapsed:z,onChange:t=>W(e.name,t),onBlur:()=>R(e.name),theme:c,mounted:C,index:t},e.name))}),(0,o.jsx)("button",{type:"submit",disabled:v,style:{width:"100%",padding:"10px 20px",borderRadius:"8px",border:"none",backgroundColor:v?`${c.primary}88`:c.primary,color:c.bg,fontSize:"14px",fontWeight:700,fontFamily:"inherit",cursor:v?"not-allowed":"pointer",transition:"background-color 0.15s, opacity 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:v?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{animation:"qf-spin 0.8s linear infinite"},"aria-hidden":"true",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),(0,o.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10"})]}),"Processing…"]}):n.sanitizeString(a)}),(0,o.jsx)("style",{children:"@keyframes qf-spin { to { transform: rotate(360deg); } }"})]})}function M(e){return e?{primary:"#00f5d4",secondary:"#7b2ff7",background:"#0a0a0f",surface:"#12121a",text:"#e8e8f4",textMuted:"#8888aa",border:"#2a2a3e",error:"#f87171",warning:"#fbbf24",success:"#34d399",accent:"#ff6b6b"}:{primary:"#0d7c5f",secondary:"#6930c3",background:"#f8f6f1",surface:"#ffffff",text:"#1a1815",textMuted:"#6b6560",border:"#ddd8cc",error:"#dc2626",warning:"#d97706",success:"#059669",accent:"#e05a00"}}function z({points:e,primary:t}){if(e.length<2)return(0,o.jsx)("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#888",fontSize:12},children:"Waiting for data..."});const n=Math.max(...e.map(e=>e.energy)),r=Math.min(...e.map(e=>e.energy)),i=n-r||1,a=e[e.length-1].iteration||1;return(0,o.jsxs)("svg",{width:280,height:48,style:{display:"block"},children:[(0,o.jsx)("polyline",{points:e.map(e=>{const t=e.iteration/a*280,n=48-(e.energy-r)/i*44-2;return`${t.toFixed(1)},${n.toFixed(1)}`}).join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",opacity:.9}),(0,o.jsxs)("text",{x:2,y:10,fontSize:9,fill:"#888",children:["E=",n.toFixed(1)]}),(0,o.jsxs)("text",{x:2,y:46,fontSize:9,fill:"#888",children:["E=",r.toFixed(1)]})]})}function T({label:e,value:t,onChange:n,text:r,border:i}){return(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,o.jsx)("input",{type:"color",value:t,onChange:e=>n(e.target.value),style:{width:32,height:32,border:`1px solid ${i}`,borderRadius:6,padding:2,cursor:"pointer",background:"transparent"}}),(0,o.jsx)("div",{style:{width:60,height:28,borderRadius:6,background:t,border:`1px solid ${i}`}}),(0,o.jsx)("span",{style:{flex:1,fontSize:13,color:r,fontFamily:"monospace"},children:e}),(0,o.jsx)("code",{style:{fontSize:12,color:r,opacity:.7,fontFamily:"monospace"},children:t})]})}function $({label:e,ratio:t}){const n=t>=4.5,r=t>=4.5,i=t>=7;return(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[(0,o.jsx)("span",{style:{fontSize:11,opacity:.8,minWidth:140},children:e}),(0,o.jsxs)("span",{style:{fontSize:12,fontWeight:600},children:[t.toFixed(2),":1"]}),(0,o.jsx)("span",{style:{fontSize:11,color:r?"#22c55e":"#ef4444"},children:r?"✓ AA":"✗ AA"}),(0,o.jsx)("span",{style:{fontSize:11,color:i?"#22c55e":"#888"},children:i?"✓ AAA":"— AAA"}),(0,o.jsx)("span",{style:{fontSize:13},children:n?"✅":"❌"})]})}C.displayName="TkxQuantumForm";var A=["fetch(","XMLHttpRequest","navigator.sendBeacon","document.cookie","localStorage","sessionStorage","indexedDB","WebSocket","EventSource","import(","eval(","new Function(","postMessage","window.open","location.href","location.replace","location.assign","document.write","crypto.subtle"],W=[{label:"Hello World",code:"<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>\n <h2 style={{ margin: 0 }}>👋 Hello, TkxPlayground!</h2>\n <p style={{ marginTop: 8, opacity: 0.7 }}>Edit the code on the left to see live updates.</p>\n</div>"},{label:"Button Styles",code:"<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>\n {['primary', 'success', 'danger', 'warning', 'info'].map(color => (\n <button\n key={color}\n style={{\n padding: '8px 18px',\n borderRadius: 8,\n border: 'none',\n background: color === 'primary' ? '#00f5d4' : color === 'success' ? '#06d6a0' : color === 'danger' ? '#f72585' : color === 'warning' ? '#ffbe0b' : '#3a86ff',\n color: '#0a0a0f',\n fontWeight: 700,\n cursor: 'pointer',\n textTransform: 'capitalize',\n }}\n >\n {color}\n </button>\n ))}\n</div>"},{label:"Card Grid",code:"<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>\n {['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta'].map(name => (\n <div key={name} style={{\n background: '#1a1a2e',\n borderRadius: 10,\n border: '1px solid #2a2a3e',\n padding: '16px',\n }}>\n <div style={{ fontWeight: 700, color: '#00f5d4', marginBottom: 4 }}>{name}</div>\n <div style={{ fontSize: 12, color: '#8888aa' }}>Quantum module {name.toLowerCase()}</div>\n </div>\n ))}\n</div>"},{label:"Animated Counter",code:"(() => {\n const [count, setCount] = React.useState(0);\n return (\n <div style={{ padding: 32, textAlign: 'center', fontFamily: 'sans-serif' }}>\n <div style={{ fontSize: 64, fontWeight: 900, color: '#00f5d4', marginBottom: 16 }}>\n {count}\n </div>\n <div style={{ display: 'flex', gap: 12, justifyContent: 'center' }}>\n <button onClick={() => setCount(c => c - 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>−</button>\n <button onClick={() => setCount(0)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#8888aa', cursor: 'pointer' }}>Reset</button>\n <button onClick={() => setCount(c => c + 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>+</button>\n </div>\n </div>\n );\n})()"},{label:"Data Table",code:"(() => {\n const rows = [\n { id: 1, name: 'Hydrogen', symbol: 'H', mass: 1.008 },\n { id: 2, name: 'Helium', symbol: 'He', mass: 4.003 },\n { id: 3, name: 'Lithium', symbol: 'Li', mass: 6.941 },\n { id: 4, name: 'Carbon', symbol: 'C', mass: 12.011 },\n { id: 5, name: 'Nitrogen', symbol: 'N', mass: 14.007 },\n ];\n const cell = { padding: '8px 14px', borderBottom: '1px solid #2a2a3e', color: '#e8e8f4', fontSize: 13 };\n const hcell = { ...cell, color: '#8888aa', fontWeight: 600, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.06em' };\n return (\n <div style={{ padding: 16 }}>\n <table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: 'sans-serif' }}>\n <thead>\n <tr>{['ID','Element','Symbol','Atomic Mass'].map(h => <th key={h} style={hcell}>{h}</th>)}</tr>\n </thead>\n <tbody>\n {rows.map(r => (\n <tr key={r.id} style={{ transition: 'background 0.15s' }}>\n <td style={cell}>{r.id}</td>\n <td style={cell}>{r.name}</td>\n <td style={{ ...cell, color: '#00f5d4', fontWeight: 700 }}>{r.symbol}</td>\n <td style={cell}>{r.mass}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n})()"}],R=class extends r.default.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){this.props.onError(e.message)}componentDidUpdate(e){e.children!==this.props.children&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?null:this.props.children}};function B({code:e,lineHeight:t}){const n=e.split("\n");return(0,o.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:"36px",padding:"12px 0",textAlign:"right",paddingRight:"8px",userSelect:"none",pointerEvents:"none",fontSize:"12px",lineHeight:`${t}px`,color:"#555577",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", monospace',boxSizing:"border-box"},children:n.map((e,t)=>(0,o.jsx)("div",{children:t+1},t))})}var F=["TkxButton","TkxInput","TkxCard","TkxModal","TkxTable","TkxSelect","TkxCheckbox","TkxRadio","TkxSwitch","TkxSlider","TkxBadge","TkxAlert","TkxToast","TkxTooltip","TkxPopover","TkxTabs","TkxAccordion","TkxDrawer","TkxDropdown","TkxMenu","TkxForm","TkxDataGrid","TkxChart","TkxSpinner","TkxSkeleton","TkxAvatar","TkxTag","TkxDivider","TkxProgress","TkxStatistic","TkxQuantumForm","TkxPlayground"],L=new c;function I(e){const t=e.match(/([A-Z][a-zA-Z0-9]*)$/);return t?t[1]:""}function P({defaultCode:e,examples:n,height:i=480,imports:a={},strictMode:l=!0,forbiddenTokens:s}){const d=t.useTheme(),c=[...W,...n??[]],p=e??W[0].code,[h,u]=(0,r.useState)(p),[g,m]=(0,r.useState)({element:null,error:null,renderMs:0}),[f,y]=(0,r.useState)(null),[x,b]=(0,r.useState)([]),[v,k]=(0,r.useState)(!1),[w,S]=(0,r.useState)(0),C=(0,r.useRef)(null),M=(0,r.useRef)(null),z=(0,r.useCallback)(e=>{y(null),m(function(e,t,n){const o=performance.now();try{const i=e.trim();if(!1!==n?.strictMode){const e=function(e,t){const n=[...A,...t??[]],r=e.toLowerCase();for(const o of n)if(r.includes(o.toLowerCase()))return o;return null}(i,n?.forbiddenTokens);if(e)return{element:null,error:`Blocked by playground strictMode: code contains "${e}". This token is disallowed because playground snippets run in the page's JavaScript context. If you trust the source, pass strictMode={false} to <TkxPlayground>.`,renderMs:parseFloat((performance.now()-o).toFixed(2))}}let a=`\n function PlaygroundRoot() {\n ${i.startsWith("<")||i.startsWith("(")?`return (${i});`:i}\n }\n `;const l="undefined"==typeof window?null:window.Babel??null;l&&(a=l.transform(a,{presets:["react"],filename:"playground.jsx"}).code??a);const s=new Function("React","imports",`\n "use strict";\n const { ${Object.keys(t).join(", ")} } = imports;\n ${a}\n return PlaygroundRoot;\n `)(r.default,t);return{element:r.default.createElement(s),error:null,renderMs:parseFloat((performance.now()-o).toFixed(2))}}catch(i){const e=parseFloat((performance.now()-o).toFixed(2));return{element:null,error:i instanceof Error?i.message:String(i),renderMs:e}}}(e,a,{strictMode:l,forbiddenTokens:s}))},[a,l,s]);(0,r.useEffect)(()=>(M.current&&clearTimeout(M.current),M.current=setTimeout(()=>z(h),300),()=>{M.current&&clearTimeout(M.current)}),[h,z]),(0,r.useEffect)(()=>{z(p)},[]);const T=(0,r.useCallback)(e=>{const t=e.target.value;u(t);const n=I(t);n.length>=2?b(function(e,t=4){if(!e||e.length<2)return[];const n=e.toLowerCase();return L.amplify(F,e=>{const t=e.toLowerCase();if(t.startsWith(n))return 1;if(t.includes(n))return.7;let r=0;for(let o=0;o<n.length-1;o++)t.includes(n.slice(o,o+2))&&(r+=.15);return Math.min(r,.5)},.1).slice(0,t).map(e=>({name:F[e.index]??"",amplitude:parseFloat(e.combined.toFixed(3))})).filter(e=>""!==e.name)}(n,4)):b([])},[]),$=(0,r.useCallback)(e=>{const t=c[e];t&&(S(e),u(t.code),b([]))},[c]),P=(0,r.useCallback)(async()=>{try{await navigator.clipboard.writeText(h),k(!0),setTimeout(()=>k(!1),1500)}catch{}},[h]),q=(0,r.useCallback)(()=>{u(p),S(0),b([])},[p]),_=(0,r.useCallback)(e=>{const t=I(h);t&&u(n=>n.slice(0,n.lastIndexOf(t))+e),b([])},[h]),E=null!==g.error||null!==f,D=g.error??f??"",j=d.bg,N=d.surfaceAlt,H=d.border,O=d.surface,Q={width:"50%",display:"flex",flexDirection:"column",borderRight:`1px solid ${H}`,position:"relative"},Z={display:"flex",alignItems:"center",gap:"6px",padding:"6px 10px",borderBottom:`1px solid ${H}`,backgroundColor:d.surface,flexWrap:"wrap"},U={padding:"3px 10px",borderRadius:"6px",border:`1px solid ${H}`,backgroundColor:"transparent",color:d.textMuted,fontSize:"11px",fontWeight:600,cursor:"pointer",fontFamily:"inherit",transition:"color 0.15s, border-color 0.15s"};return(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${H}`,borderRadius:"12px",overflow:"hidden",backgroundColor:j,fontFamily:"inherit",boxSizing:"border-box",position:"relative"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",borderBottom:`1px solid ${H}`,backgroundColor:d.surface},children:[(0,o.jsx)("span",{style:{fontSize:"12px",fontWeight:700,color:d.primary,letterSpacing:"0.05em"},children:"⚛ TkxPlayground"}),(0,o.jsx)("span",{style:{fontSize:"10px",color:d.textMuted},children:"Live JSX Preview"})]}),(0,o.jsx)("div",{style:{display:"flex",gap:"4px",padding:"6px 10px",borderBottom:`1px solid ${H}`,backgroundColor:d.surface,overflowX:"auto"},children:c.map((e,t)=>(0,o.jsx)("button",{onClick:()=>$(t),style:{padding:"3px 10px",borderRadius:"6px",border:`1px solid ${t===w?d.primary:H}`,backgroundColor:t===w?`${d.primary}20`:"transparent",color:t===w?d.primary:d.textMuted,fontSize:"11px",fontWeight:t===w?700:400,cursor:"pointer",whiteSpace:"nowrap",fontFamily:"inherit",transition:"all 0.15s"},children:e.label},t))}),(0,o.jsxs)("div",{style:{display:"flex",height:`${i}px`},children:[(0,o.jsxs)("div",{style:Q,children:[(0,o.jsxs)("div",{style:Z,children:[(0,o.jsx)("span",{style:{fontSize:"11px",color:d.textMuted,marginRight:"auto"},children:"editor.tsx"}),(0,o.jsx)("button",{onClick:P,style:U,title:"Copy code",children:v?"✓ Copied":"⎘ Copy"}),(0,o.jsx)("button",{onClick:q,style:U,title:"Reset to default",children:"↺ Reset"})]}),(0,o.jsxs)("div",{style:{position:"relative",flex:1,overflow:"hidden"},children:[(0,o.jsx)(B,{code:h,lineHeight:18}),(0,o.jsx)("textarea",{ref:C,value:h,onChange:T,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",padding:"12px 12px 12px 44px",margin:0,border:"none",outline:"none",resize:"none",backgroundColor:j,color:d.text,fontSize:"12px",lineHeight:"18px",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace',boxSizing:"border-box",overflowY:"auto",tabSize:2}})]}),x.length>0&&(0,o.jsxs)("div",{style:{position:"absolute",bottom:"40px",left:"44px",zIndex:10,backgroundColor:d.surface,border:`1px solid ${d.primary}44`,borderRadius:"8px",overflow:"hidden",boxShadow:"0 4px 16px rgba(0,0,0,0.3)",minWidth:"180px"},children:[(0,o.jsx)("div",{style:{padding:"4px 10px 4px",fontSize:"10px",color:d.primary,fontWeight:700,borderBottom:`1px solid ${H}`,letterSpacing:"0.05em"},children:"⚛ Quantum Suggestions"}),x.map(e=>(0,o.jsxs)("button",{onClick:()=>_(e.name),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",border:"none",backgroundColor:"transparent",color:d.text,fontSize:"12px",fontFamily:'"Fira Code", monospace',cursor:"pointer",textAlign:"left",gap:"12px"},children:[(0,o.jsx)("span",{children:e.name}),(0,o.jsxs)("span",{style:{fontSize:"10px",color:d.textMuted,flexShrink:0},children:[Math.round(100*e.amplitude),"%"]})]},e.name))]})]}),(0,o.jsxs)("div",{style:{width:"50%",display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{padding:"6px 10px",borderBottom:`1px solid ${H}`,backgroundColor:d.surface,fontSize:"11px",color:d.textMuted,fontWeight:600},children:"Preview"}),(0,o.jsx)("div",{style:{flex:1,overflow:"auto",backgroundColor:N,position:"relative"},children:E?(0,o.jsxs)("div",{style:{padding:"16px",color:d.danger,fontFamily:'"Fira Code", monospace',fontSize:"12px",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[(0,o.jsxs)("div",{style:{marginBottom:"8px",fontWeight:700,display:"flex",alignItems:"center",gap:"6px"},children:[(0,o.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),"Runtime Error"]}),D]}):(0,o.jsx)(R,{onError:y,children:(0,o.jsx)("div",{style:{minHeight:"100%"},children:g.element})})})]})]}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px 12px",backgroundColor:O,borderTop:`1px solid ${H}`,fontSize:"11px",color:d.textMuted},children:[(0,o.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"4px",color:E?d.danger:d.success,fontWeight:600},children:[(0,o.jsx)("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:E?d.danger:d.success,display:"inline-block"}}),E?"Error":"OK"]}),(0,o.jsxs)("span",{children:["⏱ ",g.renderMs," ms"]}),(0,o.jsxs)("span",{children:[h.split("\n").length," lines"]}),(0,o.jsxs)("span",{children:[h.length," chars"]}),x.length>0&&(0,o.jsxs)("span",{style:{marginLeft:"auto",color:d.primary,fontWeight:600},children:["⚛ ",x.length," suggestion",x.length>1?"s":""]})]})]})}P.displayName="TkxPlayground",exports.AmplitudeAmplifier=c,exports.QuantumAI=x,exports.QuantumAnnealer=s,exports.QuantumBoltzmannMachine=d,exports.QuantumRegister=l,exports.Qubit=a,exports.TkxPlayground=P,exports.TkxQuantumForm=C,exports.TkxThemeBuilder=function({onThemeChange:e,initialHue:i=210,initialMode:a="dark"}){const l=t.useTheme(),[s,d]=(0,r.useState)(a),[c,p]=(0,r.useState)(i),[h,u]=(0,r.useState)(()=>M("dark"===a)),[g,m]=(0,r.useState)(!1),[f,y]=(0,r.useState)([]),[b,v]=(0,r.useState)(!1),k=(0,r.useRef)(null),w="dark"===s,S=(0,r.useCallback)((t,n)=>{u(r=>{const o={...r,[t]:n};return e?.(o),o})},[e]),C=(0,r.useCallback)(()=>{if(g)return;m(!0),y([]);let t=0;const n=[],r=()=>{t+=60,x.optimizeTheme(c,w,t);const o=t/600,i=50*(1-o)+2,a=8*(Math.random()-.5)*(1-.8*o);if(n.push({iteration:t,energy:Math.max(0,i+a)}),y([...n]),t<600)k.current=window.setTimeout(r,40);else{const t=x.optimizeTheme(c,w,1e3);u(t),e?.(t),m(!1)}};k.current=window.setTimeout(r,16)},[c,w,g,e]),A=(0,r.useCallback)(()=>{const t="dark"===s?"light":"dark";d(t);const n=M("dark"===t);u(n),e?.(n)},[s,e]),W=(0,r.useCallback)(()=>{const e=`export const myTheme = {\n${Object.entries(h).map(([e,t])=>` ${e}: '${t}',`).join("\n")}\n};`;"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{v(!0),setTimeout(()=>v(!1),2e3)})},[h]),R=[{label:"Text on Background",fg:h.text,bg:h.background},{label:"Text on Surface",fg:h.text,bg:h.surface},{label:"Primary on Background",fg:h.primary,bg:h.background},{label:"TextMuted on Background",fg:h.textMuted,bg:h.background}],B="linear-gradient(to right,"+["hsl(0,80%,55%)","hsl(30,80%,55%)","hsl(60,80%,55%)","hsl(90,80%,55%)","hsl(120,80%,55%)","hsl(150,80%,55%)","hsl(180,80%,55%)","hsl(210,80%,55%)","hsl(240,80%,55%)","hsl(270,80%,55%)","hsl(300,80%,55%)","hsl(330,80%,55%)","hsl(360,80%,55%)"].join(",")+")",F={fontFamily:"system-ui, -apple-system, sans-serif",background:h.background,color:h.text,border:`1px solid ${h.border}`,borderRadius:12,padding:20,maxWidth:900,display:"grid",gridTemplateColumns:"1fr 1fr",gap:20},L={background:h.surface,border:`1px solid ${h.border}`,borderRadius:8,padding:16},I={fontSize:13,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:h.primary,marginBottom:12,marginTop:0},P={padding:"8px 16px",borderRadius:8,border:"none",cursor:"pointer",fontWeight:600,fontSize:13,transition:"opacity 0.15s"},q=n.tkx;return(0,o.jsxs)("div",{style:F,children:[(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gridColumn:"1/-1"},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{style:{margin:0,fontSize:18,fontWeight:700},children:"Theme Builder"}),(0,o.jsx)("p",{style:{margin:"2px 0 0",fontSize:12,color:h.textMuted},children:"Quantum-powered color optimization"})]}),(0,o.jsx)("button",{onClick:A,style:{...P,background:h.surface,color:h.text,border:`1px solid ${h.border}`},children:w?"☀ Light":"🌙 Dark"})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"Base Hue"}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,o.jsx)("div",{style:{width:24,height:24,borderRadius:"50%",background:`hsl(${c},70%,55%)`,border:`2px solid ${h.border}`,flexShrink:0}}),(0,o.jsx)("input",{type:"range",min:0,max:360,value:c,onChange:e=>p(Number(e.target.value)),style:{flex:1,height:16,borderRadius:8,background:B,outline:"none",border:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none"}}),(0,o.jsxs)("span",{style:{fontSize:13,fontFamily:"monospace",minWidth:32},children:[c,"°"]})]})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[(0,o.jsx)("button",{onClick:C,disabled:g,style:{...P,background:g?h.border:h.primary,color:w?"#000":"#fff",opacity:g?.7:1,flex:1},children:g?"⟳ Optimizing...":"⚛ Generate with Quantum Annealing"}),(0,o.jsx)("div",{style:{padding:"3px 8px",background:h.primary+"22",border:`1px solid ${h.primary}44`,borderRadius:20,fontSize:10,color:h.primary,fontWeight:700,whiteSpace:"nowrap"},children:"⚛ Quantum Annealing"})]}),(g||f.length>0)&&(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 4px"},children:"Energy landscape (lower = better palette)"}),(0,o.jsx)(z,{points:f,primary:h.primary})]})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"Color Tokens"}),Object.keys(h).map(e=>(0,o.jsx)(T,{label:e,value:h[e],onChange:t=>S(e,t),text:h.text,border:h.border},e))]}),(0,o.jsx)("button",{onClick:W,style:{...P,background:h.accent,color:"#fff",width:"100%"},children:b?"✓ Copied to Clipboard!":"⬇ Export Theme"})]}),(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"Live Preview"}),(0,o.jsxs)("div",{style:{marginBottom:12},children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Buttons"}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,o.jsx)("button",{style:{padding:"8px 16px",borderRadius:8,border:"none",background:h.primary,color:w?"#000":"#fff",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Primary"}),(0,o.jsx)("button",{style:{padding:"8px 16px",borderRadius:8,border:"none",background:h.secondary,color:"#fff",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Secondary"}),(0,o.jsx)("button",{style:{padding:"8px 16px",borderRadius:8,border:`1px solid ${h.border}`,background:"transparent",color:h.text,fontWeight:600,fontSize:13,cursor:"pointer"},children:"Outline"})]})]}),(0,o.jsxs)("div",{style:{marginBottom:12},children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Card"}),(0,o.jsxs)("div",{style:{background:h.surface,border:`1px solid ${h.border}`,borderRadius:8,padding:12},children:[(0,o.jsx)("div",{style:{fontSize:14,fontWeight:700,marginBottom:4},children:"Card Title"}),(0,o.jsx)("div",{style:{fontSize:12,color:h.textMuted,lineHeight:1.4},children:"Sample card with surface background and muted text content."}),(0,o.jsxs)("div",{style:{marginTop:8,display:"flex",gap:6},children:[(0,o.jsx)("span",{style:{padding:"2px 8px",borderRadius:20,background:h.primary+"33",color:h.primary,fontSize:11,fontWeight:600},children:"Tag"}),(0,o.jsx)("span",{style:{padding:"2px 8px",borderRadius:20,background:h.accent+"33",color:h.accent,fontSize:11,fontWeight:600},children:"Accent"})]})]})]}),(0,o.jsxs)("div",{style:{marginBottom:12},children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Input"}),(0,o.jsx)("input",{type:"text",placeholder:"Type something...",readOnly:!0,style:{width:"100%",padding:"8px 12px",borderRadius:8,border:`1px solid ${h.border}`,background:h.background,color:h.text,fontSize:13,outline:"none",boxSizing:"border-box"}})]}),(0,o.jsxs)("div",{style:{marginBottom:12},children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Progress"}),(0,o.jsx)("div",{style:{height:8,borderRadius:4,background:h.border,overflow:"hidden"},children:(0,o.jsx)("div",{style:{height:"100%",width:"68%",background:`linear-gradient(to right, ${h.primary}, ${h.accent})`,borderRadius:4,transition:"width 0.4s ease"}})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Status Badges"}),(0,o.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[{label:"Error",color:h.error},{label:"Warning",color:h.warning},{label:"Success",color:h.success}].map(({label:e,color:t})=>(0,o.jsx)("span",{style:{padding:"3px 10px",borderRadius:4,background:t+"22",color:t,border:`1px solid ${t}44`,fontSize:11,fontWeight:700},children:e},e))})]})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"WCAG Contrast Check"}),R.map(e=>(0,o.jsx)($,{label:e.label,ratio:x.contrast(e.fg,e.bg)},e.label)),(0,o.jsx)("p",{style:{fontSize:10,color:h.textMuted,marginTop:8,marginBottom:0},children:"AA requires 4.5:1 (normal text). AAA requires 7:1."})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"Color Palette"}),(0,o.jsx)("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:Object.entries(h).map(([e,t])=>(0,o.jsx)("div",{title:`${e}: ${t}`,style:{width:36,height:36,borderRadius:6,background:t,border:`2px solid ${h.border}`,cursor:"default",flexShrink:0}},e))})]})]}),"function"==typeof q&&null,"string"==typeof l.bg&&null]})},exports.hslToHex=u,exports.inferFieldIntelligence=h,exports.optimizeThemeColors=y;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunk-DmRB1Blb.js"),t=require("./chunk-BpuJ3-K8.js"),n=require("./chunk-D7-yknXg.js");let r=require("react");r=e.__toESM(r,1);let o=require("react/jsx-runtime");var i=class e{constructor(e,t){this.re=e,this.im=t}add(t){return new e(this.re+t.re,this.im+t.im)}sub(t){return new e(this.re-t.re,this.im-t.im)}mul(t){return new e(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)}scale(t){return new e(this.re*t,this.im*t)}conjugate(){return new e(this.re,-this.im)}magnitudeSquared(){return this.re*this.re+this.im*this.im}magnitude(){return Math.sqrt(this.magnitudeSquared())}static fromPolar(t,n){return new e(t*Math.cos(n),t*Math.sin(n))}static zero(){return new e(0,0)}static one(){return new e(1,0)}},a=class e{constructor(e=i.one(),t=i.zero()){this.alpha=e,this.beta=t,this.normalize()}normalize(){const e=Math.sqrt(this.alpha.magnitudeSquared()+this.beta.magnitudeSquared());e>0&&(this.alpha=this.alpha.scale(1/e),this.beta=this.beta.scale(1/e))}hadamard(){const t=1/Math.SQRT2;return new e(this.alpha.add(this.beta).scale(t),this.alpha.sub(this.beta).scale(t))}ry(t){const n=Math.cos(t/2),r=Math.sin(t/2);return new e(this.alpha.scale(n).sub(this.beta.scale(r)),this.alpha.scale(r).add(this.beta.scale(n)))}phase(t){const n=i.fromPolar(1,t);return new e(this.alpha,this.beta.mul(n))}measure(){const e=this.beta.magnitudeSquared();return Math.random()<e?1:0}expectation(){return this.beta.magnitudeSquared()}getAlpha(){return this.alpha}getBeta(){return this.beta}},l=class{constructor(e){this.qubits=Array.from({length:e},()=>new a)}get size(){return this.qubits.length}getQubit(e){return this.qubits[e]}superpose(){this.qubits=this.qubits.map(e=>e.hadamard())}cnot(e,t){const n=this.qubits[e],r=this.qubits[t],o=n.expectation();this.qubits[t]=r.ry(Math.PI*o)}rotate(e,t){this.qubits[e]=this.qubits[e].ry(t)}measure(){return this.qubits.map(e=>e.measure())}probs(){return this.qubits.map(e=>e.expectation())}},s=class{constructor(e=1,t=.995,n=.3,r=1e-6){this.temperature=e,this.coolingRate=t,this.tunnelingStrength=n,this.minTemp=r}anneal(e,t,n,r=1e3){let o=e,i=t(o),a=o,l=i,s=this.temperature,d=0,c=0;for(let p=0;p<r&&s>this.minTemp;p++){const e=n(o),r=t(e),p=r-i;let h=!1;if(p<=0)h=!0;else{const e=Math.exp(-p/s),t=Math.sqrt(2*Math.abs(p)),n=Math.abs(p),r=Math.exp(-2*t*Math.sqrt(n)*this.tunnelingStrength);Math.random()<e+r&&(h=!0,Math.random()<r/(e+r+1e-10)&&c++)}h&&(o=e,i=r,d++,i<l&&(a=o,l=i)),s*=this.coolingRate}return{state:a,energy:l,iterations:r,accepted:d,tunnels:c}}},d=class{constructor(e,t){const n=Math.sqrt(2/(e+t));this.weights=Array.from({length:e},()=>Array.from({length:t},()=>(2*Math.random()-1)*n)),this.visibleBias=Array.from({length:e},()=>0),this.hiddenBias=Array.from({length:t},()=>0)}sigmoid(e){const t=.1*(Math.random()-.5);return 1/(1+Math.exp(-(e+t)))}sample(e){return Math.random()<e?1:0}energy(e,t){const n=this.visibleBias.reduce((t,n,r)=>t+n*e[r],0),r=this.hiddenBias.reduce((e,n,r)=>e+n*t[r],0);let o=0;for(let i=0;i<e.length;i++)for(let n=0;n<t.length;n++)o+=e[i]*this.weights[i][n]*t[n];return-(n+r+o)}hiddenProbs(e){return this.hiddenBias.map((t,n)=>{const r=t+e.reduce((e,t,r)=>e+this.weights[r][n]*t,0);return this.sigmoid(r)})}visibleProbs(e){return this.visibleBias.map((t,n)=>{const r=t+e.reduce((e,t,r)=>e+this.weights[n][r]*t,0);return this.sigmoid(r)})}gibbs(e,t=1){let n=[...e],r=[];for(let o=0;o<t;o++)r=this.hiddenProbs(n).map(e=>this.sample(e)),n=this.visibleProbs(r).map(e=>this.sample(e));return{visible:n,hidden:r}}trainCD1(e,t=.01){const n=this.visibleBias.length,r=this.hiddenBias.length,o=Array.from({length:n},()=>Array(r).fill(0)),i=Array(n).fill(0),a=Array(r).fill(0);for(const s of e){const e=this.hiddenProbs(s),t=e.map(e=>this.sample(e)),l=this.visibleProbs(t).map(e=>this.sample(e)),d=this.hiddenProbs(l);for(let a=0;a<n;a++){for(let t=0;t<r;t++)o[a][t]+=s[a]*e[t]-l[a]*d[t];i[a]+=s[a]-l[a]}for(let n=0;n<r;n++)a[n]+=e[n]-d[n]}const l=e.length;for(let s=0;s<n;s++){for(let e=0;e<r;e++)this.weights[s][e]+=t*o[s][e]/l;this.visibleBias[s]+=t*i[s]/l}for(let s=0;s<r;s++)this.hiddenBias[s]+=t*a[s]/l}infer(e){const t=this.hiddenProbs(e),n=t.map(e=>this.sample(e));return{hidden:t,visible:this.visibleProbs(n),energy:this.energy(e,n),iterations:1}}},c=class{amplify(e,t,n=.5){const r=e.length;if(0===r)return[];const o=e.map(t),i=o.filter(e=>e>n).length,a=Math.max(1,i);let l=Array(r).fill(1/Math.sqrt(r));const s=Math.max(1,Math.floor(Math.PI/4*Math.sqrt(r/a)));for(let d=0;d<s;d++){for(let t=0;t<r;t++)o[t]>n&&(l[t]=-l[t]);const e=l.reduce((e,t)=>e+t,0)/r;l=l.map(t=>2*e-t)}return e.map((e,t)=>({index:t,amplitude:l[t],probability:l[t]*l[t],classicalSimilarity:o[t],combined:l[t]*l[t]*.6+.4*o[t]})).sort((e,t)=>t.combined-e.combined)}},p=[{keywords:["email","e-mail","mail"],type:"email",validations:[{rule:"required",message:"Email is required"},{rule:"pattern",value:"^[^@]+@[^@]+\\.[^@]+$",message:"Enter a valid email address"},{rule:"maxLength",value:254,message:"Email too long"}],placeholder:"you@example.com",label:"Email Address",confidence:.98},{keywords:["password","passwd","pwd","pass"],type:"password",validations:[{rule:"required",message:"Password is required"},{rule:"minLength",value:8,message:"Password must be at least 8 characters"},{rule:"pattern",value:"(?=.*[A-Z])(?=.*[0-9])",message:"Include uppercase and a number"}],placeholder:"••••••••",label:"Password",confidence:.97},{keywords:["confirm_password","confirmpassword","confirm_pass","repassword","password2","repeat_password"],type:"password",validations:[{rule:"required",message:"Please confirm your password"},{rule:"match",value:"password",message:"Passwords do not match"}],placeholder:"••••••••",label:"Confirm Password",confidence:.95},{keywords:["phone","mobile","cell","tel","telephone","contact_number"],type:"tel",validations:[{rule:"pattern",value:"^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$",message:"Enter a valid phone number"}],placeholder:"+1 (555) 000-0000",label:"Phone Number",confidence:.93},{keywords:["age"],type:"number",validations:[{rule:"min",value:0,message:"Age cannot be negative"},{rule:"max",value:150,message:"Enter a valid age"},{rule:"integer",message:"Age must be a whole number"}],placeholder:"25",label:"Age",confidence:.9},{keywords:["price","amount","cost","fee","payment","salary","wage","total"],type:"number",validations:[{rule:"min",value:0,message:"Amount cannot be negative"},{rule:"pattern",value:"^\\d+(\\.\\d{1,2})?$",message:"Enter a valid amount (e.g. 9.99)"}],placeholder:"0.00",label:"Amount",confidence:.88},{keywords:["url","website","site","link","homepage","web"],type:"url",validations:[{rule:"pattern",value:"https?://.+",message:"Enter a valid URL starting with http:// or https://"}],placeholder:"https://example.com",label:"Website URL",confidence:.92},{keywords:["zip","zipcode","postal","postcode","pin_code"],type:"text",validations:[{rule:"pattern",value:"^[0-9]{5}(-[0-9]{4})?$",message:"Enter a valid ZIP code (e.g. 12345)"}],placeholder:"12345",label:"ZIP / Postal Code",confidence:.91},{keywords:["date","dob","birthday","birth_date","birthdate","born"],type:"date",validations:[{rule:"required",message:"Date is required"}],placeholder:"YYYY-MM-DD",label:"Date of Birth",confidence:.89},{keywords:["first_name","firstname","fname","given_name"],type:"text",validations:[{rule:"minLength",value:2,message:"First name too short"},{rule:"maxLength",value:50,message:"First name too long"}],placeholder:"Jane",label:"First Name",confidence:.9},{keywords:["last_name","lastname","lname","surname","family_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Last name too short"},{rule:"maxLength",value:50,message:"Last name too long"}],placeholder:"Doe",label:"Last Name",confidence:.9},{keywords:["name","full_name","fullname","display_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Name too short"},{rule:"maxLength",value:100,message:"Name too long"}],placeholder:"Jane Doe",label:"Full Name",confidence:.85},{keywords:["username","user_name","handle","login","loginname"],type:"text",validations:[{rule:"minLength",value:3,message:"Username must be at least 3 characters"},{rule:"maxLength",value:32,message:"Username too long"},{rule:"pattern",value:"^[a-zA-Z0-9_.-]+$",message:"Only letters, numbers, _, - and . allowed"}],placeholder:"cooluser42",label:"Username",confidence:.94},{keywords:["bio","biography","about","description","summary","details"],type:"textarea",validations:[{rule:"maxLength",value:500,message:"Bio must be under 500 characters"}],placeholder:"Tell us about yourself...",label:"Bio",confidence:.87},{keywords:["message","comment","feedback","note","notes","remarks","body"],type:"textarea",validations:[{rule:"minLength",value:10,message:"Message too short"},{rule:"maxLength",value:2e3,message:"Message too long"}],placeholder:"Write your message here...",label:"Message",confidence:.86},{keywords:["search","query","q","keyword","find"],type:"search",validations:[],placeholder:"Search...",label:"Search",confidence:.9},{keywords:["otp","one_time_password","verification_code","pin","code"],type:"text",validations:[{rule:"minLength",value:4,message:"Code too short"},{rule:"maxLength",value:8,message:"Code too long"},{rule:"pattern",value:"^[0-9]+$",message:"Code must be numeric"}],placeholder:"123456",label:"Verification Code",confidence:.92},{keywords:["color","colour","hex_color","brand_color"],type:"color",validations:[],placeholder:"#3b82f6",label:"Color",confidence:.95},{keywords:["address","street","street_address","addr"],type:"text",validations:[{rule:"maxLength",value:200,message:"Address too long"}],placeholder:"123 Main Street",label:"Street Address",confidence:.87},{keywords:["city","town","municipality"],type:"text",validations:[{rule:"maxLength",value:100,message:"City name too long"}],placeholder:"San Francisco",label:"City",confidence:.89},{keywords:["country","nation","country_code"],type:"text",validations:[],placeholder:"United States",label:"Country",confidence:.88},{keywords:["company","organization","org","employer","company_name"],type:"text",validations:[{rule:"maxLength",value:200,message:"Company name too long"}],placeholder:"Acme Inc.",label:"Company",confidence:.87}];function h(e){const t=e.toLowerCase().replace(/[\s-]/g,"_"),n=(new c).amplify(p,e=>{let n=0;for(const r of e.keywords)t===r?n=Math.max(n,1):t.includes(r)||r.includes(t)?n=Math.max(n,.8):r.split("_").some(e=>t.includes(e))&&(n=Math.max(n,.5));return n},.3);if(n.length>0&&n[0].combined>.1){const e=p[n[0].index];return{type:e.type,validations:e.validations,placeholder:e.placeholder,confidence:Math.min(e.confidence*n[0].combined*2,.99),label:e.label}}return{type:"text",validations:[{rule:"maxLength",value:255,message:"Input too long"}],placeholder:e.replace(/_/g," "),confidence:.3,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}}function u(e,t,n){const r=n/100,o=t/100*Math.min(r,1-r),i=t=>{const n=(t+e/30)%12,i=r-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}function g(e){const[t,n,r]=function(e){const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]}(e).map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*r}function m(e,t){const n=g(e),r=g(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function f(e,t,n){return Math.max(t,Math.min(n,e))}function y(e,t,n=800){const r=t?{primary:{h:e,s:70,l:55},secondary:{h:(e+137.5)%360,s:65,l:50},bg:{h:e,s:10,l:8},surface:{h:e,s:10,l:13},text:{h:e,s:15,l:90},border:{h:e,s:15,l:22},accent:{h:(e+120)%360,s:75,l:60}}:{primary:{h:e,s:65,l:40},secondary:{h:(e+137.5)%360,s:55,l:38},bg:{h:e,s:15,l:97},surface:{h:e,s:12,l:100},text:{h:e,s:15,l:12},border:{h:e,s:12,l:85},accent:{h:(e+120)%360,s:70,l:42}};return function(e,t){const n=e=>u(e.h,e.s,e.l),r=t?e.text.l-20:e.text.l+15;return{primary:n(e.primary),secondary:n(e.secondary),background:n(e.bg),surface:n(e.surface),text:n(e.text),textMuted:u(e.text.h,Math.max(0,e.text.s-10),Math.max(20,Math.min(85,r))),border:n(e.border),error:t?"#f87171":"#dc2626",warning:t?"#fbbf24":"#d97706",success:t?"#34d399":"#059669",accent:n(e.accent)}}(new s(1.5,.994,.35,1e-5).anneal(r,e=>function(e,t){let n=0;const r=e=>u(e.h,e.s,e.l),o=r(e.text),i=r(e.bg),a=r(e.surface),l=r(e.primary),s=m(o,i),d=m(o,a),c=m(l,i);s<4.5&&(n+=10*(4.5-s)),d<4.5&&(n+=8*(4.5-d)),c<3&&(n+=5*(3-c)),n+=.05*Math.abs((e.secondary.h-e.primary.h+360)%360-137.508),n+=.03*Math.abs((e.accent.h-e.primary.h+360)%360-120);const p=(e.primary.s+e.secondary.s)/2;p<20&&(n+=.5*(20-p)),p>90&&(n+=.5*(p-90));const h=e.bg.l;t?(h>25&&(n+=2*(h-25)),h<3&&(n+=2*(3-h)),e.text.l<70&&(n+=1.5*(70-e.text.l))):(h<90&&(n+=2*(90-h)),h>100&&(n+=2*(h-100)),e.text.l>30&&(n+=1.5*(e.text.l-30)));const g=Math.abs(e.surface.l-e.bg.l);return g<2&&(n+=2*(2-g)),g>12&&(n+=1*(g-12)),n}(e,t),e=>{const t=["primary","secondary","bg","surface","text","border","accent"],n=t[Math.floor(Math.random()*t.length)],r=["h","s","l"],o=r[Math.floor(Math.random()*r.length)],i=(Math.random()-.5)*("h"===o?30:15),a={...e,[n]:{...e[n]}};return a[n]="h"===o?{...a[n],h:(e[n].h+i+360)%360}:"s"===o?{...a[n],s:f(e[n].s+i,0,100)}:{...a[n],l:f(e[n].l+i,0,100)},a},n).state,t)}var x={qubit:()=>new a,register:e=>new l(e),annealer:(e,t,n)=>new s(e,t,n),qbm:(e,t)=>new d(e,t),amplifier:()=>new c,inferField:h,optimizeTheme:y,contrast:m,hslToHex:u};function b(e,t,n,r){const o=n.trim();switch(e){case"required":return""!==o;case"email":case"pattern":if("string"==typeof t)try{return""===o||new RegExp(t).test(o)}catch{return!0}return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o);case"phone":return""===o||/^\+?[\d\s\-()]{7,15}$/.test(o);case"url":return""===o||/^https?:\/\/.+/.test(o);case"minLength":case"min":{const e=Number(t??0);return""===o||(isNaN(Number(o))?o.length>=e:Number(o)>=e)}case"maxLength":case"max":{const e=Number(t??1/0);return""===o||(isNaN(Number(o))?o.length<=e:Number(o)<=e)}case"integer":return""===o||/^\d+$/.test(o);case"alphanumeric":return""===o||/^[a-zA-Z0-9]+$/.test(o);case"match":return o===(r["string"==typeof t?t:"password"]??"");default:return!0}}function v({phase:e,collapsed:t,primaryColor:n,borderColor:r}){const i=12,a=t?0:e,l=t?0:1.618*e,s=i+10*Math.sin(a)*Math.cos(l),d=12-10*Math.cos(a);return(0,o.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",style:{flexShrink:0,opacity:t?.4:1,transition:"opacity 0.6s"},children:[(0,o.jsx)("circle",{cx:i,cy:12,r:10,fill:"none",stroke:r,strokeWidth:"0.8"}),(0,o.jsx)("ellipse",{cx:i,cy:12,rx:10,ry:3,fill:"none",stroke:r,strokeWidth:"0.5",strokeDasharray:"2 2"}),(0,o.jsx)("line",{x1:i,y1:2,x2:i,y2:22,stroke:r,strokeWidth:"0.5"}),(0,o.jsx)("line",{x1:i,y1:12,x2:s,y2:d,stroke:n,strokeWidth:"1.5",style:{transition:t?"all 0.6s ease-out":"none"}}),(0,o.jsx)("circle",{cx:s,cy:d,r:"2",fill:n,style:{transition:t?"all 0.6s ease-out":"none"}})]})}function k({confidence:e,theme:t}){const n=Math.round(100*e),r=n>=80?t.success:n>=60?t.warning:t.danger;return(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",fontSize:"10px",fontWeight:600,padding:"1px 5px",borderRadius:"999px",backgroundColor:`${r}22`,color:r,border:`1px solid ${r}44`,marginLeft:"6px",verticalAlign:"middle",letterSpacing:"0.03em"},children:["⚛ ",n,"%"]})}function w({config:e,intel:t,qubitPhase:r,value:i,error:a,touched:l,showConfidence:s,showQuantumState:d,collapsed:c,onChange:p,onBlur:h,theme:u,mounted:g,index:m}){const f=e.type??t.type,y=e.label??t.label,x=e.placeholder??t.placeholder,b=void 0!==e.required?e.required:t.validations.some(e=>"required"===e.rule),w=n.sanitizeString(y),S="textarea"===f,C=l&&""!==a,M=`qf-${e.name}`,z={width:"100%",padding:"9px 12px",border:`1.5px solid ${C?u.danger:u.border}`,borderRadius:"8px",backgroundColor:u.surface,color:u.text,fontSize:"14px",fontFamily:"inherit",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",resize:S?"vertical":void 0,minHeight:S?"80px":void 0};return(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px",opacity:g?1:0,transform:g?"scaleY(1)":"scaleY(0.92)",transition:`opacity 0.35s ease ${60*m}ms, transform 0.35s ease ${60*m}ms`,transformOrigin:"top"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[d&&(0,o.jsx)(v,{phase:r,collapsed:c,primaryColor:u.primary,borderColor:u.border}),(0,o.jsxs)("label",{htmlFor:M,style:{fontSize:"13px",fontWeight:500,color:u.text,cursor:"pointer"},children:[w,b&&(0,o.jsx)("span",{"aria-hidden":"true",style:{color:u.danger,marginLeft:"3px"},children:"*"})]}),s&&(0,o.jsx)(k,{confidence:t.confidence,theme:u})]}),S?(0,o.jsx)("textarea",{id:M,value:i,onChange:e=>p(e.target.value),onBlur:h,placeholder:x,"aria-invalid":C,"aria-required":b,style:z}):(0,o.jsx)("input",{id:M,type:f,value:i,onChange:e=>p(e.target.value),onBlur:h,placeholder:x,"aria-invalid":C,"aria-required":b,style:z}),C&&(0,o.jsxs)("span",{role:"alert",style:{fontSize:"12px",color:u.danger,display:"flex",alignItems:"center",gap:"4px"},children:[(0,o.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),n.sanitizeString(a)]})]})}function S(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return(65535&t)/65535*Math.PI*2}function C({fields:e,onSubmit:i,submitLabel:a="Submit",layout:l="vertical",showConfidence:s=!0,showQuantumState:d=!1}){const c=t.useTheme(),p=e.map(e=>h(e.name)),[u,g]=(0,r.useState)(()=>Object.fromEntries(e.map(e=>[e.name,""]))),[m,f]=(0,r.useState)({}),[y,x]=(0,r.useState)({}),[v,k]=(0,r.useState)(!1),[C,M]=(0,r.useState)(!1),[z,T]=(0,r.useState)(!1);(0,r.useEffect)(()=>{const e=requestAnimationFrame(()=>M(!0));return()=>cancelAnimationFrame(e)},[]);const $=(0,r.useCallback)((t,n)=>{const r=e.find(e=>e.name===t),o=p[e.findIndex(e=>e.name===t)];if(!r||!o)return"";const i=n[t]??"";for(const{rule:e,value:a,message:l}of o.validations)if(("required"!==e||!1!==r.required)&&!b(e,a,i,n))return l;return""},[e]),A=(0,r.useCallback)(t=>{const n={};for(const r of e){const e=$(r.name,t);e&&(n[r.name]=e)}return n},[e,$]),W=(0,r.useCallback)((t,n)=>{g(r=>{const o={...r,[t]:n};if(y[t]&&(f(e=>({...e,[t]:$(t,o)})),"password"===t)){const t=e.find(e=>["confirmpassword","confirm_password","passwordconfirm"].includes(e.name.toLowerCase().replace(/[\s_-]/g,"")))?.name;t&&y[t]&&f(e=>({...e,[t]:$(t,o)}))}return o}),T(!0)},[e,y,$]),R=(0,r.useCallback)(e=>{x(t=>({...t,[e]:!0})),f(t=>({...t,[e]:$(e,u)}))},[u,$]),B=(0,r.useCallback)(async t=>{t.preventDefault(),x(Object.fromEntries(e.map(e=>[e.name,!0])));const n=A(u);if(f(n),!(Object.keys(n).length>0)){k(!0);try{await i(u)}finally{k(!1)}}},[e,u,A,i]),F=p.length>0?Math.round(p.reduce((e,t)=>e+t.confidence,0)/p.length*100):0,L=F>=80?c.success:F>=60?c.warning:c.danger,I="horizontal"===l;return(0,o.jsxs)("form",{onSubmit:B,noValidate:!0,className:n.tkx("w-full"),style:{backgroundColor:c.surface,border:`1px solid ${c.border}`,borderRadius:"12px",padding:"24px",position:"relative",boxSizing:"border-box"},children:[(0,o.jsx)("span",{"aria-label":"Powered by Quantum AI",style:{position:"absolute",top:"16px",right:"16px",fontSize:"10px",fontWeight:700,padding:"3px 8px",borderRadius:"999px",backgroundColor:`${c.primary}20`,color:c.primary,border:`1px solid ${c.primary}44`,letterSpacing:"0.04em",userSelect:"none"},children:"⚛ Quantum AI"}),s&&(0,o.jsxs)("div",{style:{marginBottom:"20px",paddingRight:"100px"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[(0,o.jsx)("span",{style:{fontSize:"11px",color:c.textMuted,fontWeight:500},children:"Form Intelligence Confidence"}),(0,o.jsxs)("span",{style:{fontSize:"11px",fontWeight:700,color:L},children:[F,"%"]})]}),(0,o.jsx)("div",{style:{height:"4px",borderRadius:"4px",backgroundColor:c.border,overflow:"hidden"},children:(0,o.jsx)("div",{style:{height:"100%",width:`${F}%`,backgroundColor:L,borderRadius:"4px",transition:"width 0.8s ease"}})})]}),(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:I?"repeat(auto-fill, minmax(260px, 1fr))":"1fr",gap:"16px",marginBottom:"20px"},children:e.map((e,t)=>(0,o.jsx)(w,{config:e,intel:p[t],qubitPhase:S(e.name),value:u[e.name]??"",error:m[e.name]??"",touched:y[e.name]??!1,showConfidence:s,showQuantumState:d,collapsed:z,onChange:t=>W(e.name,t),onBlur:()=>R(e.name),theme:c,mounted:C,index:t},e.name))}),(0,o.jsx)("button",{type:"submit",disabled:v,style:{width:"100%",padding:"10px 20px",borderRadius:"8px",border:"none",backgroundColor:v?`${c.primary}88`:c.primary,color:c.bg,fontSize:"14px",fontWeight:700,fontFamily:"inherit",cursor:v?"not-allowed":"pointer",transition:"background-color 0.15s, opacity 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:v?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{animation:"qf-spin 0.8s linear infinite"},"aria-hidden":"true",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),(0,o.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10"})]}),"Processing…"]}):n.sanitizeString(a)}),(0,o.jsx)("style",{children:"@keyframes qf-spin { to { transform: rotate(360deg); } }"})]})}function M(e){return e?{primary:"#00f5d4",secondary:"#7b2ff7",background:"#0a0a0f",surface:"#12121a",text:"#e8e8f4",textMuted:"#8888aa",border:"#2a2a3e",error:"#f87171",warning:"#fbbf24",success:"#34d399",accent:"#ff6b6b"}:{primary:"#0d7c5f",secondary:"#6930c3",background:"#f8f6f1",surface:"#ffffff",text:"#1a1815",textMuted:"#6b6560",border:"#ddd8cc",error:"#dc2626",warning:"#d97706",success:"#059669",accent:"#e05a00"}}function z({points:e,primary:t}){if(e.length<2)return(0,o.jsx)("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#888",fontSize:12},children:"Waiting for data..."});const n=Math.max(...e.map(e=>e.energy)),r=Math.min(...e.map(e=>e.energy)),i=n-r||1,a=e[e.length-1].iteration||1;return(0,o.jsxs)("svg",{width:280,height:48,style:{display:"block"},children:[(0,o.jsx)("polyline",{points:e.map(e=>{const t=e.iteration/a*280,n=48-(e.energy-r)/i*44-2;return`${t.toFixed(1)},${n.toFixed(1)}`}).join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",opacity:.9}),(0,o.jsxs)("text",{x:2,y:10,fontSize:9,fill:"#888",children:["E=",n.toFixed(1)]}),(0,o.jsxs)("text",{x:2,y:46,fontSize:9,fill:"#888",children:["E=",r.toFixed(1)]})]})}function T({label:e,value:t,onChange:n,text:r,border:i}){return(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[(0,o.jsx)("input",{type:"color",value:t,onChange:e=>n(e.target.value),style:{width:32,height:32,border:`1px solid ${i}`,borderRadius:6,padding:2,cursor:"pointer",background:"transparent"}}),(0,o.jsx)("div",{style:{width:60,height:28,borderRadius:6,background:t,border:`1px solid ${i}`}}),(0,o.jsx)("span",{style:{flex:1,fontSize:13,color:r,fontFamily:"monospace"},children:e}),(0,o.jsx)("code",{style:{fontSize:12,color:r,opacity:.7,fontFamily:"monospace"},children:t})]})}function $({label:e,ratio:t}){const n=t>=4.5,r=t>=4.5,i=t>=7;return(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[(0,o.jsx)("span",{style:{fontSize:11,opacity:.8,minWidth:140},children:e}),(0,o.jsxs)("span",{style:{fontSize:12,fontWeight:600},children:[t.toFixed(2),":1"]}),(0,o.jsx)("span",{style:{fontSize:11,color:r?"#22c55e":"#ef4444"},children:r?"✓ AA":"✗ AA"}),(0,o.jsx)("span",{style:{fontSize:11,color:i?"#22c55e":"#888"},children:i?"✓ AAA":"— AAA"}),(0,o.jsx)("span",{style:{fontSize:13},children:n?"✅":"❌"})]})}C.displayName="TkxQuantumForm";var A=["fetch(","XMLHttpRequest","navigator.sendBeacon","document.cookie","localStorage","sessionStorage","indexedDB","WebSocket","EventSource","import(","eval(","new Function(","postMessage","window.open","location.href","location.replace","location.assign","document.write","crypto.subtle"],W=[{label:"Hello World",code:"<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>\n <h2 style={{ margin: 0 }}>👋 Hello, TkxPlayground!</h2>\n <p style={{ marginTop: 8, opacity: 0.7 }}>Edit the code on the left to see live updates.</p>\n</div>"},{label:"Button Styles",code:"<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>\n {['primary', 'success', 'danger', 'warning', 'info'].map(color => (\n <button\n key={color}\n style={{\n padding: '8px 18px',\n borderRadius: 8,\n border: 'none',\n background: color === 'primary' ? '#00f5d4' : color === 'success' ? '#06d6a0' : color === 'danger' ? '#f72585' : color === 'warning' ? '#ffbe0b' : '#3a86ff',\n color: '#0a0a0f',\n fontWeight: 700,\n cursor: 'pointer',\n textTransform: 'capitalize',\n }}\n >\n {color}\n </button>\n ))}\n</div>"},{label:"Card Grid",code:"<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>\n {['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta'].map(name => (\n <div key={name} style={{\n background: '#1a1a2e',\n borderRadius: 10,\n border: '1px solid #2a2a3e',\n padding: '16px',\n }}>\n <div style={{ fontWeight: 700, color: '#00f5d4', marginBottom: 4 }}>{name}</div>\n <div style={{ fontSize: 12, color: '#8888aa' }}>Quantum module {name.toLowerCase()}</div>\n </div>\n ))}\n</div>"},{label:"Animated Counter",code:"(() => {\n const [count, setCount] = React.useState(0);\n return (\n <div style={{ padding: 32, textAlign: 'center', fontFamily: 'sans-serif' }}>\n <div style={{ fontSize: 64, fontWeight: 900, color: '#00f5d4', marginBottom: 16 }}>\n {count}\n </div>\n <div style={{ display: 'flex', gap: 12, justifyContent: 'center' }}>\n <button onClick={() => setCount(c => c - 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>−</button>\n <button onClick={() => setCount(0)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#8888aa', cursor: 'pointer' }}>Reset</button>\n <button onClick={() => setCount(c => c + 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>+</button>\n </div>\n </div>\n );\n})()"},{label:"Data Table",code:"(() => {\n const rows = [\n { id: 1, name: 'Hydrogen', symbol: 'H', mass: 1.008 },\n { id: 2, name: 'Helium', symbol: 'He', mass: 4.003 },\n { id: 3, name: 'Lithium', symbol: 'Li', mass: 6.941 },\n { id: 4, name: 'Carbon', symbol: 'C', mass: 12.011 },\n { id: 5, name: 'Nitrogen', symbol: 'N', mass: 14.007 },\n ];\n const cell = { padding: '8px 14px', borderBottom: '1px solid #2a2a3e', color: '#e8e8f4', fontSize: 13 };\n const hcell = { ...cell, color: '#8888aa', fontWeight: 600, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.06em' };\n return (\n <div style={{ padding: 16 }}>\n <table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: 'sans-serif' }}>\n <thead>\n <tr>{['ID','Element','Symbol','Atomic Mass'].map(h => <th key={h} style={hcell}>{h}</th>)}</tr>\n </thead>\n <tbody>\n {rows.map(r => (\n <tr key={r.id} style={{ transition: 'background 0.15s' }}>\n <td style={cell}>{r.id}</td>\n <td style={cell}>{r.name}</td>\n <td style={{ ...cell, color: '#00f5d4', fontWeight: 700 }}>{r.symbol}</td>\n <td style={cell}>{r.mass}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n})()"}],R=class extends r.default.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){this.props.onError(e.message)}componentDidUpdate(e){e.children!==this.props.children&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?null:this.props.children}};function B({code:e,lineHeight:t}){const n=e.split("\n");return(0,o.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:"36px",padding:"12px 0",textAlign:"right",paddingRight:"8px",userSelect:"none",pointerEvents:"none",fontSize:"12px",lineHeight:`${t}px`,color:"#555577",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", monospace',boxSizing:"border-box"},children:n.map((e,t)=>(0,o.jsx)("div",{children:t+1},t))})}var F=["TkxButton","TkxInput","TkxCard","TkxModal","TkxTable","TkxSelect","TkxCheckbox","TkxRadio","TkxSwitch","TkxSlider","TkxBadge","TkxAlert","TkxToast","TkxTooltip","TkxPopover","TkxTabs","TkxAccordion","TkxDrawer","TkxDropdown","TkxMenu","TkxForm","TkxDataGrid","TkxChart","TkxSpinner","TkxSkeleton","TkxAvatar","TkxTag","TkxDivider","TkxProgress","TkxStatistic","TkxQuantumForm","TkxPlayground"],L=new c;function I(e){const t=e.match(/([A-Z][a-zA-Z0-9]*)$/);return t?t[1]:""}function P({defaultCode:e,examples:n,height:i=480,imports:a={},strictMode:l=!0,forbiddenTokens:s}){const d=t.useTheme(),c=[...W,...n??[]],p=e??W[0].code,[h,u]=(0,r.useState)(p),[g,m]=(0,r.useState)({element:null,error:null,renderMs:0}),[f,y]=(0,r.useState)(null),[x,b]=(0,r.useState)([]),[v,k]=(0,r.useState)(!1),[w,S]=(0,r.useState)(0),C=(0,r.useRef)(null),M=(0,r.useRef)(null),z=(0,r.useCallback)(e=>{y(null),m(function(e,t,n){const o=performance.now();try{const i=e.trim();if(!1!==n?.strictMode){const e=function(e,t){const n=[...A,...t??[]],r=e.toLowerCase();for(const o of n)if(r.includes(o.toLowerCase()))return o;return null}(i,n?.forbiddenTokens);if(e)return{element:null,error:`Blocked by playground strictMode: code contains "${e}". This token is disallowed because playground snippets run in the page's JavaScript context. If you trust the source, pass strictMode={false} to <TkxPlayground>.`,renderMs:parseFloat((performance.now()-o).toFixed(2))}}let a=`\n function PlaygroundRoot() {\n ${i.startsWith("<")||i.startsWith("(")?`return (${i});`:i}\n }\n `;const l="undefined"==typeof window?null:window.Babel??null;l&&(a=l.transform(a,{presets:["react"],filename:"playground.jsx"}).code??a);const s=new Function("React","imports",`\n "use strict";\n const { ${Object.keys(t).join(", ")} } = imports;\n ${a}\n return PlaygroundRoot;\n `)(r.default,t);return{element:r.default.createElement(s),error:null,renderMs:parseFloat((performance.now()-o).toFixed(2))}}catch(i){const e=parseFloat((performance.now()-o).toFixed(2));return{element:null,error:i instanceof Error?i.message:String(i),renderMs:e}}}(e,a,{strictMode:l,forbiddenTokens:s}))},[a,l,s]);(0,r.useEffect)(()=>(M.current&&clearTimeout(M.current),M.current=setTimeout(()=>z(h),300),()=>{M.current&&clearTimeout(M.current)}),[h,z]),(0,r.useEffect)(()=>{z(p)},[]);const T=(0,r.useCallback)(e=>{const t=e.target.value;u(t);const n=I(t);n.length>=2?b(function(e,t=4){if(!e||e.length<2)return[];const n=e.toLowerCase();return L.amplify(F,e=>{const t=e.toLowerCase();if(t.startsWith(n))return 1;if(t.includes(n))return.7;let r=0;for(let o=0;o<n.length-1;o++)t.includes(n.slice(o,o+2))&&(r+=.15);return Math.min(r,.5)},.1).slice(0,t).map(e=>({name:F[e.index]??"",amplitude:parseFloat(e.combined.toFixed(3))})).filter(e=>""!==e.name)}(n,4)):b([])},[]),$=(0,r.useCallback)(e=>{const t=c[e];t&&(S(e),u(t.code),b([]))},[c]),P=(0,r.useCallback)(async()=>{try{await navigator.clipboard.writeText(h),k(!0),setTimeout(()=>k(!1),1500)}catch{}},[h]),q=(0,r.useCallback)(()=>{u(p),S(0),b([])},[p]),_=(0,r.useCallback)(e=>{const t=I(h);t&&u(n=>n.slice(0,n.lastIndexOf(t))+e),b([])},[h]),E=null!==g.error||null!==f,D=g.error??f??"",j=d.bg,N=d.surfaceAlt,H=d.border,O=d.surface,Q={width:"50%",display:"flex",flexDirection:"column",borderRight:`1px solid ${H}`,position:"relative"},Z={display:"flex",alignItems:"center",gap:"6px",padding:"6px 10px",borderBottom:`1px solid ${H}`,backgroundColor:d.surface,flexWrap:"wrap"},U={padding:"3px 10px",borderRadius:"6px",border:`1px solid ${H}`,backgroundColor:"transparent",color:d.textMuted,fontSize:"11px",fontWeight:600,cursor:"pointer",fontFamily:"inherit",transition:"color 0.15s, border-color 0.15s"};return(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${H}`,borderRadius:"12px",overflow:"hidden",backgroundColor:j,fontFamily:"inherit",boxSizing:"border-box",position:"relative"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",borderBottom:`1px solid ${H}`,backgroundColor:d.surface},children:[(0,o.jsx)("span",{style:{fontSize:"12px",fontWeight:700,color:d.primary,letterSpacing:"0.05em"},children:"⚛ TkxPlayground"}),(0,o.jsx)("span",{style:{fontSize:"10px",color:d.textMuted},children:"Live JSX Preview"})]}),(0,o.jsx)("div",{style:{display:"flex",gap:"4px",padding:"6px 10px",borderBottom:`1px solid ${H}`,backgroundColor:d.surface,overflowX:"auto"},children:c.map((e,t)=>(0,o.jsx)("button",{onClick:()=>$(t),style:{padding:"3px 10px",borderRadius:"6px",border:`1px solid ${t===w?d.primary:H}`,backgroundColor:t===w?`${d.primary}20`:"transparent",color:t===w?d.primary:d.textMuted,fontSize:"11px",fontWeight:t===w?700:400,cursor:"pointer",whiteSpace:"nowrap",fontFamily:"inherit",transition:"all 0.15s"},children:e.label},t))}),(0,o.jsxs)("div",{style:{display:"flex",height:`${i}px`},children:[(0,o.jsxs)("div",{style:Q,children:[(0,o.jsxs)("div",{style:Z,children:[(0,o.jsx)("span",{style:{fontSize:"11px",color:d.textMuted,marginRight:"auto"},children:"editor.tsx"}),(0,o.jsx)("button",{onClick:P,style:U,title:"Copy code",children:v?"✓ Copied":"⎘ Copy"}),(0,o.jsx)("button",{onClick:q,style:U,title:"Reset to default",children:"↺ Reset"})]}),(0,o.jsxs)("div",{style:{position:"relative",flex:1,overflow:"hidden"},children:[(0,o.jsx)(B,{code:h,lineHeight:18}),(0,o.jsx)("textarea",{ref:C,value:h,onChange:T,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",padding:"12px 12px 12px 44px",margin:0,border:"none",outline:"none",resize:"none",backgroundColor:j,color:d.text,fontSize:"12px",lineHeight:"18px",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace',boxSizing:"border-box",overflowY:"auto",tabSize:2}})]}),x.length>0&&(0,o.jsxs)("div",{style:{position:"absolute",bottom:"40px",left:"44px",zIndex:10,backgroundColor:d.surface,border:`1px solid ${d.primary}44`,borderRadius:"8px",overflow:"hidden",boxShadow:"0 4px 16px rgba(0,0,0,0.3)",minWidth:"180px"},children:[(0,o.jsx)("div",{style:{padding:"4px 10px 4px",fontSize:"10px",color:d.primary,fontWeight:700,borderBottom:`1px solid ${H}`,letterSpacing:"0.05em"},children:"⚛ Quantum Suggestions"}),x.map(e=>(0,o.jsxs)("button",{onClick:()=>_(e.name),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",border:"none",backgroundColor:"transparent",color:d.text,fontSize:"12px",fontFamily:'"Fira Code", monospace',cursor:"pointer",textAlign:"left",gap:"12px"},children:[(0,o.jsx)("span",{children:e.name}),(0,o.jsxs)("span",{style:{fontSize:"10px",color:d.textMuted,flexShrink:0},children:[Math.round(100*e.amplitude),"%"]})]},e.name))]})]}),(0,o.jsxs)("div",{style:{width:"50%",display:"flex",flexDirection:"column"},children:[(0,o.jsx)("div",{style:{padding:"6px 10px",borderBottom:`1px solid ${H}`,backgroundColor:d.surface,fontSize:"11px",color:d.textMuted,fontWeight:600},children:"Preview"}),(0,o.jsx)("div",{style:{flex:1,overflow:"auto",backgroundColor:N,position:"relative"},children:E?(0,o.jsxs)("div",{style:{padding:"16px",color:d.danger,fontFamily:'"Fira Code", monospace',fontSize:"12px",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[(0,o.jsxs)("div",{style:{marginBottom:"8px",fontWeight:700,display:"flex",alignItems:"center",gap:"6px"},children:[(0,o.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),"Runtime Error"]}),D]}):(0,o.jsx)(R,{onError:y,children:(0,o.jsx)("div",{style:{minHeight:"100%"},children:g.element})})})]})]}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px 12px",backgroundColor:O,borderTop:`1px solid ${H}`,fontSize:"11px",color:d.textMuted},children:[(0,o.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"4px",color:E?d.danger:d.success,fontWeight:600},children:[(0,o.jsx)("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:E?d.danger:d.success,display:"inline-block"}}),E?"Error":"OK"]}),(0,o.jsxs)("span",{children:["⏱ ",g.renderMs," ms"]}),(0,o.jsxs)("span",{children:[h.split("\n").length," lines"]}),(0,o.jsxs)("span",{children:[h.length," chars"]}),x.length>0&&(0,o.jsxs)("span",{style:{marginLeft:"auto",color:d.primary,fontWeight:600},children:["⚛ ",x.length," suggestion",x.length>1?"s":""]})]})]})}P.displayName="TkxPlayground",exports.AmplitudeAmplifier=c,exports.QuantumAI=x,exports.QuantumAnnealer=s,exports.QuantumBoltzmannMachine=d,exports.QuantumRegister=l,exports.Qubit=a,exports.TkxPlayground=P,exports.TkxQuantumForm=C,exports.TkxThemeBuilder=function({onThemeChange:e,initialHue:i=210,initialMode:a="dark"}){const l=t.useTheme(),[s,d]=(0,r.useState)(a),[c,p]=(0,r.useState)(i),[h,u]=(0,r.useState)(()=>M("dark"===a)),[g,m]=(0,r.useState)(!1),[f,y]=(0,r.useState)([]),[b,v]=(0,r.useState)(!1),k=(0,r.useRef)(null),w="dark"===s,S=(0,r.useCallback)((t,n)=>{u(r=>{const o={...r,[t]:n};return e?.(o),o})},[e]),C=(0,r.useCallback)(()=>{if(g)return;m(!0),y([]);let t=0;const n=[],r=()=>{t+=60,x.optimizeTheme(c,w,t);const o=t/600,i=50*(1-o)+2,a=8*(Math.random()-.5)*(1-.8*o);if(n.push({iteration:t,energy:Math.max(0,i+a)}),y([...n]),t<600)k.current=window.setTimeout(r,40);else{const t=x.optimizeTheme(c,w,1e3);u(t),e?.(t),m(!1)}};k.current=window.setTimeout(r,16)},[c,w,g,e]),A=(0,r.useCallback)(()=>{const t="dark"===s?"light":"dark";d(t);const n=M("dark"===t);u(n),e?.(n)},[s,e]),W=(0,r.useCallback)(()=>{const e=`export const myTheme = {\n${Object.entries(h).map(([e,t])=>` ${e}: '${t}',`).join("\n")}\n};`;"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{v(!0),setTimeout(()=>v(!1),2e3)})},[h]),R=[{label:"Text on Background",fg:h.text,bg:h.background},{label:"Text on Surface",fg:h.text,bg:h.surface},{label:"Primary on Background",fg:h.primary,bg:h.background},{label:"TextMuted on Background",fg:h.textMuted,bg:h.background}],B="linear-gradient(to right,"+["hsl(0,80%,55%)","hsl(30,80%,55%)","hsl(60,80%,55%)","hsl(90,80%,55%)","hsl(120,80%,55%)","hsl(150,80%,55%)","hsl(180,80%,55%)","hsl(210,80%,55%)","hsl(240,80%,55%)","hsl(270,80%,55%)","hsl(300,80%,55%)","hsl(330,80%,55%)","hsl(360,80%,55%)"].join(",")+")",F={fontFamily:"system-ui, -apple-system, sans-serif",background:h.background,color:h.text,border:`1px solid ${h.border}`,borderRadius:12,padding:20,maxWidth:900,display:"grid",gridTemplateColumns:"1fr 1fr",gap:20},L={background:h.surface,border:`1px solid ${h.border}`,borderRadius:8,padding:16},I={fontSize:13,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:h.primary,marginBottom:12,marginTop:0},P={padding:"8px 16px",borderRadius:8,border:"none",cursor:"pointer",fontWeight:600,fontSize:13,transition:"opacity 0.15s"},q=n.tkx;return(0,o.jsxs)("div",{style:F,children:[(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gridColumn:"1/-1"},children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{style:{margin:0,fontSize:18,fontWeight:700},children:"Theme Builder"}),(0,o.jsx)("p",{style:{margin:"2px 0 0",fontSize:12,color:h.textMuted},children:"Quantum-powered color optimization"})]}),(0,o.jsx)("button",{onClick:A,style:{...P,background:h.surface,color:h.text,border:`1px solid ${h.border}`},children:w?"☀ Light":"🌙 Dark"})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"Base Hue"}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,o.jsx)("div",{style:{width:24,height:24,borderRadius:"50%",background:`hsl(${c},70%,55%)`,border:`2px solid ${h.border}`,flexShrink:0}}),(0,o.jsx)("input",{type:"range",min:0,max:360,value:c,onChange:e=>p(Number(e.target.value)),style:{flex:1,height:16,borderRadius:8,background:B,outline:"none",border:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none"}}),(0,o.jsxs)("span",{style:{fontSize:13,fontFamily:"monospace",minWidth:32},children:[c,"°"]})]})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[(0,o.jsx)("button",{onClick:C,disabled:g,style:{...P,background:g?h.border:h.primary,color:w?"#000":"#fff",opacity:g?.7:1,flex:1},children:g?"⟳ Optimizing...":"⚛ Generate with Quantum Annealing"}),(0,o.jsx)("div",{style:{padding:"3px 8px",background:h.primary+"22",border:`1px solid ${h.primary}44`,borderRadius:20,fontSize:10,color:h.primary,fontWeight:700,whiteSpace:"nowrap"},children:"⚛ Quantum Annealing"})]}),(g||f.length>0)&&(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 4px"},children:"Energy landscape (lower = better palette)"}),(0,o.jsx)(z,{points:f,primary:h.primary})]})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"Color Tokens"}),Object.keys(h).map(e=>(0,o.jsx)(T,{label:e,value:h[e],onChange:t=>S(e,t),text:h.text,border:h.border},e))]}),(0,o.jsx)("button",{onClick:W,style:{...P,background:h.accent,color:"#fff",width:"100%"},children:b?"✓ Copied to Clipboard!":"⬇ Export Theme"})]}),(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"Live Preview"}),(0,o.jsxs)("div",{style:{marginBottom:12},children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Buttons"}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,o.jsx)("button",{style:{padding:"8px 16px",borderRadius:8,border:"none",background:h.primary,color:w?"#000":"#fff",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Primary"}),(0,o.jsx)("button",{style:{padding:"8px 16px",borderRadius:8,border:"none",background:h.secondary,color:"#fff",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Secondary"}),(0,o.jsx)("button",{style:{padding:"8px 16px",borderRadius:8,border:`1px solid ${h.border}`,background:"transparent",color:h.text,fontWeight:600,fontSize:13,cursor:"pointer"},children:"Outline"})]})]}),(0,o.jsxs)("div",{style:{marginBottom:12},children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Card"}),(0,o.jsxs)("div",{style:{background:h.surface,border:`1px solid ${h.border}`,borderRadius:8,padding:12},children:[(0,o.jsx)("div",{style:{fontSize:14,fontWeight:700,marginBottom:4},children:"Card Title"}),(0,o.jsx)("div",{style:{fontSize:12,color:h.textMuted,lineHeight:1.4},children:"Sample card with surface background and muted text content."}),(0,o.jsxs)("div",{style:{marginTop:8,display:"flex",gap:6},children:[(0,o.jsx)("span",{style:{padding:"2px 8px",borderRadius:20,background:h.primary+"33",color:h.primary,fontSize:11,fontWeight:600},children:"Tag"}),(0,o.jsx)("span",{style:{padding:"2px 8px",borderRadius:20,background:h.accent+"33",color:h.accent,fontSize:11,fontWeight:600},children:"Accent"})]})]})]}),(0,o.jsxs)("div",{style:{marginBottom:12},children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Input"}),(0,o.jsx)("input",{type:"text",placeholder:"Type something...",readOnly:!0,style:{width:"100%",padding:"8px 12px",borderRadius:8,border:`1px solid ${h.border}`,background:h.background,color:h.text,fontSize:13,outline:"none",boxSizing:"border-box"}})]}),(0,o.jsxs)("div",{style:{marginBottom:12},children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Progress"}),(0,o.jsx)("div",{style:{height:8,borderRadius:4,background:h.border,overflow:"hidden"},children:(0,o.jsx)("div",{style:{height:"100%",width:"68%",background:`linear-gradient(to right, ${h.primary}, ${h.accent})`,borderRadius:4,transition:"width 0.4s ease"}})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{style:{fontSize:11,color:h.textMuted,margin:"0 0 6px"},children:"Status Badges"}),(0,o.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[{label:"Error",color:h.error},{label:"Warning",color:h.warning},{label:"Success",color:h.success}].map(({label:e,color:t})=>(0,o.jsx)("span",{style:{padding:"3px 10px",borderRadius:4,background:t+"22",color:t,border:`1px solid ${t}44`,fontSize:11,fontWeight:700},children:e},e))})]})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"WCAG Contrast Check"}),R.map(e=>(0,o.jsx)($,{label:e.label,ratio:x.contrast(e.fg,e.bg)},e.label)),(0,o.jsx)("p",{style:{fontSize:10,color:h.textMuted,marginTop:8,marginBottom:0},children:"AA requires 4.5:1 (normal text). AAA requires 7:1."})]}),(0,o.jsxs)("div",{style:L,children:[(0,o.jsx)("p",{style:I,children:"Color Palette"}),(0,o.jsx)("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:Object.entries(h).map(([e,t])=>(0,o.jsx)("div",{title:`${e}: ${t}`,style:{width:36,height:36,borderRadius:6,background:t,border:`2px solid ${h.border}`,cursor:"default",flexShrink:0}},e))})]})]}),"function"==typeof q&&null,"string"==typeof l.bg&&null]})},exports.hslToHex=u,exports.inferFieldIntelligence=h,exports.optimizeThemeColors=y;
|
package/dist/quantum.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import{f as e}from"./chunk-PJ50l0JC.js";import{a as t,m as n}from"./chunk-Dj40UFcz.js";import r,{useCallback as o,useEffect as i,useRef as a,useState as l}from"react";import{Fragment as s,jsx as d,jsxs as c}from"react/jsx-runtime";var p=class e{constructor(e,t){this.re=e,this.im=t}add(t){return new e(this.re+t.re,this.im+t.im)}sub(t){return new e(this.re-t.re,this.im-t.im)}mul(t){return new e(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)}scale(t){return new e(this.re*t,this.im*t)}conjugate(){return new e(this.re,-this.im)}magnitudeSquared(){return this.re*this.re+this.im*this.im}magnitude(){return Math.sqrt(this.magnitudeSquared())}static fromPolar(t,n){return new e(t*Math.cos(n),t*Math.sin(n))}static zero(){return new e(0,0)}static one(){return new e(1,0)}},h=class e{constructor(e=p.one(),t=p.zero()){this.alpha=e,this.beta=t,this.normalize()}normalize(){const e=Math.sqrt(this.alpha.magnitudeSquared()+this.beta.magnitudeSquared());e>0&&(this.alpha=this.alpha.scale(1/e),this.beta=this.beta.scale(1/e))}hadamard(){const t=1/Math.SQRT2;return new e(this.alpha.add(this.beta).scale(t),this.alpha.sub(this.beta).scale(t))}ry(t){const n=Math.cos(t/2),r=Math.sin(t/2);return new e(this.alpha.scale(n).sub(this.beta.scale(r)),this.alpha.scale(r).add(this.beta.scale(n)))}phase(t){const n=p.fromPolar(1,t);return new e(this.alpha,this.beta.mul(n))}measure(){const e=this.beta.magnitudeSquared();return Math.random()<e?1:0}expectation(){return this.beta.magnitudeSquared()}getAlpha(){return this.alpha}getBeta(){return this.beta}},u=class{constructor(e){this.qubits=Array.from({length:e},()=>new h)}get size(){return this.qubits.length}getQubit(e){return this.qubits[e]}superpose(){this.qubits=this.qubits.map(e=>e.hadamard())}cnot(e,t){const n=this.qubits[e],r=this.qubits[t],o=n.expectation();this.qubits[t]=r.ry(Math.PI*o)}rotate(e,t){this.qubits[e]=this.qubits[e].ry(t)}measure(){return this.qubits.map(e=>e.measure())}probs(){return this.qubits.map(e=>e.expectation())}},g=class{constructor(e=1,t=.995,n=.3,r=1e-6){this.temperature=e,this.coolingRate=t,this.tunnelingStrength=n,this.minTemp=r}anneal(e,t,n,r=1e3){let o=e,i=t(o),a=o,l=i,s=this.temperature,d=0,c=0;for(let p=0;p<r&&s>this.minTemp;p++){const e=n(o),r=t(e),p=r-i;let h=!1;if(p<=0)h=!0;else{const e=Math.exp(-p/s),t=Math.sqrt(2*Math.abs(p)),n=Math.abs(p),r=Math.exp(-2*t*Math.sqrt(n)*this.tunnelingStrength);Math.random()<e+r&&(h=!0,Math.random()<r/(e+r+1e-10)&&c++)}h&&(o=e,i=r,d++,i<l&&(a=o,l=i)),s*=this.coolingRate}return{state:a,energy:l,iterations:r,accepted:d,tunnels:c}}},m=class{constructor(e,t){const n=Math.sqrt(2/(e+t));this.weights=Array.from({length:e},()=>Array.from({length:t},()=>(2*Math.random()-1)*n)),this.visibleBias=Array.from({length:e},()=>0),this.hiddenBias=Array.from({length:t},()=>0)}sigmoid(e){const t=.1*(Math.random()-.5);return 1/(1+Math.exp(-(e+t)))}sample(e){return Math.random()<e?1:0}energy(e,t){const n=this.visibleBias.reduce((t,n,r)=>t+n*e[r],0),r=this.hiddenBias.reduce((e,n,r)=>e+n*t[r],0);let o=0;for(let i=0;i<e.length;i++)for(let n=0;n<t.length;n++)o+=e[i]*this.weights[i][n]*t[n];return-(n+r+o)}hiddenProbs(e){return this.hiddenBias.map((t,n)=>{const r=t+e.reduce((e,t,r)=>e+this.weights[r][n]*t,0);return this.sigmoid(r)})}visibleProbs(e){return this.visibleBias.map((t,n)=>{const r=t+e.reduce((e,t,r)=>e+this.weights[n][r]*t,0);return this.sigmoid(r)})}gibbs(e,t=1){let n=[...e],r=[];for(let o=0;o<t;o++)r=this.hiddenProbs(n).map(e=>this.sample(e)),n=this.visibleProbs(r).map(e=>this.sample(e));return{visible:n,hidden:r}}trainCD1(e,t=.01){const n=this.visibleBias.length,r=this.hiddenBias.length,o=Array.from({length:n},()=>Array(r).fill(0)),i=Array(n).fill(0),a=Array(r).fill(0);for(const s of e){const e=this.hiddenProbs(s),t=e.map(e=>this.sample(e)),l=this.visibleProbs(t).map(e=>this.sample(e)),d=this.hiddenProbs(l);for(let a=0;a<n;a++){for(let t=0;t<r;t++)o[a][t]+=s[a]*e[t]-l[a]*d[t];i[a]+=s[a]-l[a]}for(let n=0;n<r;n++)a[n]+=e[n]-d[n]}const l=e.length;for(let s=0;s<n;s++){for(let e=0;e<r;e++)this.weights[s][e]+=t*o[s][e]/l;this.visibleBias[s]+=t*i[s]/l}for(let s=0;s<r;s++)this.hiddenBias[s]+=t*a[s]/l}infer(e){const t=this.hiddenProbs(e),n=t.map(e=>this.sample(e));return{hidden:t,visible:this.visibleProbs(n),energy:this.energy(e,n),iterations:1}}},f=class{amplify(e,t,n=.5){const r=e.length;if(0===r)return[];const o=e.map(t),i=o.filter(e=>e>n).length,a=Math.max(1,i);let l=Array(r).fill(1/Math.sqrt(r));const s=Math.max(1,Math.floor(Math.PI/4*Math.sqrt(r/a)));for(let d=0;d<s;d++){for(let t=0;t<r;t++)o[t]>n&&(l[t]=-l[t]);const e=l.reduce((e,t)=>e+t,0)/r;l=l.map(t=>2*e-t)}return e.map((e,t)=>({index:t,amplitude:l[t],probability:l[t]*l[t],classicalSimilarity:o[t],combined:l[t]*l[t]*.6+.4*o[t]})).sort((e,t)=>t.combined-e.combined)}},y=[{keywords:["email","e-mail","mail"],type:"email",validations:[{rule:"required",message:"Email is required"},{rule:"pattern",value:"^[^@]+@[^@]+\\.[^@]+$",message:"Enter a valid email address"},{rule:"maxLength",value:254,message:"Email too long"}],placeholder:"you@example.com",label:"Email Address",confidence:.98},{keywords:["password","passwd","pwd","pass"],type:"password",validations:[{rule:"required",message:"Password is required"},{rule:"minLength",value:8,message:"Password must be at least 8 characters"},{rule:"pattern",value:"(?=.*[A-Z])(?=.*[0-9])",message:"Include uppercase and a number"}],placeholder:"••••••••",label:"Password",confidence:.97},{keywords:["confirm_password","confirmpassword","confirm_pass","repassword","password2","repeat_password"],type:"password",validations:[{rule:"required",message:"Please confirm your password"},{rule:"match",value:"password",message:"Passwords do not match"}],placeholder:"••••••••",label:"Confirm Password",confidence:.95},{keywords:["phone","mobile","cell","tel","telephone","contact_number"],type:"tel",validations:[{rule:"pattern",value:"^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$",message:"Enter a valid phone number"}],placeholder:"+1 (555) 000-0000",label:"Phone Number",confidence:.93},{keywords:["age"],type:"number",validations:[{rule:"min",value:0,message:"Age cannot be negative"},{rule:"max",value:150,message:"Enter a valid age"},{rule:"integer",message:"Age must be a whole number"}],placeholder:"25",label:"Age",confidence:.9},{keywords:["price","amount","cost","fee","payment","salary","wage","total"],type:"number",validations:[{rule:"min",value:0,message:"Amount cannot be negative"},{rule:"pattern",value:"^\\d+(\\.\\d{1,2})?$",message:"Enter a valid amount (e.g. 9.99)"}],placeholder:"0.00",label:"Amount",confidence:.88},{keywords:["url","website","site","link","homepage","web"],type:"url",validations:[{rule:"pattern",value:"https?://.+",message:"Enter a valid URL starting with http:// or https://"}],placeholder:"https://example.com",label:"Website URL",confidence:.92},{keywords:["zip","zipcode","postal","postcode","pin_code"],type:"text",validations:[{rule:"pattern",value:"^[0-9]{5}(-[0-9]{4})?$",message:"Enter a valid ZIP code (e.g. 12345)"}],placeholder:"12345",label:"ZIP / Postal Code",confidence:.91},{keywords:["date","dob","birthday","birth_date","birthdate","born"],type:"date",validations:[{rule:"required",message:"Date is required"}],placeholder:"YYYY-MM-DD",label:"Date of Birth",confidence:.89},{keywords:["first_name","firstname","fname","given_name"],type:"text",validations:[{rule:"minLength",value:2,message:"First name too short"},{rule:"maxLength",value:50,message:"First name too long"}],placeholder:"Jane",label:"First Name",confidence:.9},{keywords:["last_name","lastname","lname","surname","family_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Last name too short"},{rule:"maxLength",value:50,message:"Last name too long"}],placeholder:"Doe",label:"Last Name",confidence:.9},{keywords:["name","full_name","fullname","display_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Name too short"},{rule:"maxLength",value:100,message:"Name too long"}],placeholder:"Jane Doe",label:"Full Name",confidence:.85},{keywords:["username","user_name","handle","login","loginname"],type:"text",validations:[{rule:"minLength",value:3,message:"Username must be at least 3 characters"},{rule:"maxLength",value:32,message:"Username too long"},{rule:"pattern",value:"^[a-zA-Z0-9_.-]+$",message:"Only letters, numbers, _, - and . allowed"}],placeholder:"cooluser42",label:"Username",confidence:.94},{keywords:["bio","biography","about","description","summary","details"],type:"textarea",validations:[{rule:"maxLength",value:500,message:"Bio must be under 500 characters"}],placeholder:"Tell us about yourself...",label:"Bio",confidence:.87},{keywords:["message","comment","feedback","note","notes","remarks","body"],type:"textarea",validations:[{rule:"minLength",value:10,message:"Message too short"},{rule:"maxLength",value:2e3,message:"Message too long"}],placeholder:"Write your message here...",label:"Message",confidence:.86},{keywords:["search","query","q","keyword","find"],type:"search",validations:[],placeholder:"Search...",label:"Search",confidence:.9},{keywords:["otp","one_time_password","verification_code","pin","code"],type:"text",validations:[{rule:"minLength",value:4,message:"Code too short"},{rule:"maxLength",value:8,message:"Code too long"},{rule:"pattern",value:"^[0-9]+$",message:"Code must be numeric"}],placeholder:"123456",label:"Verification Code",confidence:.92},{keywords:["color","colour","hex_color","brand_color"],type:"color",validations:[],placeholder:"#3b82f6",label:"Color",confidence:.95},{keywords:["address","street","street_address","addr"],type:"text",validations:[{rule:"maxLength",value:200,message:"Address too long"}],placeholder:"123 Main Street",label:"Street Address",confidence:.87},{keywords:["city","town","municipality"],type:"text",validations:[{rule:"maxLength",value:100,message:"City name too long"}],placeholder:"San Francisco",label:"City",confidence:.89},{keywords:["country","nation","country_code"],type:"text",validations:[],placeholder:"United States",label:"Country",confidence:.88},{keywords:["company","organization","org","employer","company_name"],type:"text",validations:[{rule:"maxLength",value:200,message:"Company name too long"}],placeholder:"Acme Inc.",label:"Company",confidence:.87}];function x(e){const t=e.toLowerCase().replace(/[\s-]/g,"_"),n=(new f).amplify(y,e=>{let n=0;for(const r of e.keywords)t===r?n=Math.max(n,1):t.includes(r)||r.includes(t)?n=Math.max(n,.8):r.split("_").some(e=>t.includes(e))&&(n=Math.max(n,.5));return n},.3);if(n.length>0&&n[0].combined>.1){const e=y[n[0].index];return{type:e.type,validations:e.validations,placeholder:e.placeholder,confidence:Math.min(e.confidence*n[0].combined*2,.99),label:e.label}}return{type:"text",validations:[{rule:"maxLength",value:255,message:"Input too long"}],placeholder:e.replace(/_/g," "),confidence:.3,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}}function b(e,t,n){const r=n/100,o=t/100*Math.min(r,1-r),i=t=>{const n=(t+e/30)%12,i=r-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}function v(e){const[t,n,r]=function(e){const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]}(e).map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*r}function k(e,t){const n=v(e),r=v(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function w(e,t,n){return Math.max(t,Math.min(n,e))}function S(e,t,n=800){const r=t?{primary:{h:e,s:70,l:55},secondary:{h:(e+137.5)%360,s:65,l:50},bg:{h:e,s:10,l:8},surface:{h:e,s:10,l:13},text:{h:e,s:15,l:90},border:{h:e,s:15,l:22},accent:{h:(e+120)%360,s:75,l:60}}:{primary:{h:e,s:65,l:40},secondary:{h:(e+137.5)%360,s:55,l:38},bg:{h:e,s:15,l:97},surface:{h:e,s:12,l:100},text:{h:e,s:15,l:12},border:{h:e,s:12,l:85},accent:{h:(e+120)%360,s:70,l:42}};return function(e,t){const n=e=>b(e.h,e.s,e.l),r=t?e.text.l-20:e.text.l+15;return{primary:n(e.primary),secondary:n(e.secondary),background:n(e.bg),surface:n(e.surface),text:n(e.text),textMuted:b(e.text.h,Math.max(0,e.text.s-10),Math.max(20,Math.min(85,r))),border:n(e.border),error:t?"#f87171":"#dc2626",warning:t?"#fbbf24":"#d97706",success:t?"#34d399":"#059669",accent:n(e.accent)}}(new g(1.5,.994,.35,1e-5).anneal(r,e=>function(e,t){let n=0;const r=e=>b(e.h,e.s,e.l),o=r(e.text),i=r(e.bg),a=r(e.surface),l=r(e.primary),s=k(o,i),d=k(o,a),c=k(l,i);s<4.5&&(n+=10*(4.5-s)),d<4.5&&(n+=8*(4.5-d)),c<3&&(n+=5*(3-c)),n+=.05*Math.abs((e.secondary.h-e.primary.h+360)%360-137.508),n+=.03*Math.abs((e.accent.h-e.primary.h+360)%360-120);const p=(e.primary.s+e.secondary.s)/2;p<20&&(n+=.5*(20-p)),p>90&&(n+=.5*(p-90));const h=e.bg.l;t?(h>25&&(n+=2*(h-25)),h<3&&(n+=2*(3-h)),e.text.l<70&&(n+=1.5*(70-e.text.l))):(h<90&&(n+=2*(90-h)),h>100&&(n+=2*(h-100)),e.text.l>30&&(n+=1.5*(e.text.l-30)));const u=Math.abs(e.surface.l-e.bg.l);return u<2&&(n+=2*(2-u)),u>12&&(n+=1*(u-12)),n}(e,t),e=>{const t=["primary","secondary","bg","surface","text","border","accent"],n=t[Math.floor(Math.random()*t.length)],r=["h","s","l"],o=r[Math.floor(Math.random()*r.length)],i=(Math.random()-.5)*("h"===o?30:15),a={...e,[n]:{...e[n]}};return a[n]="h"===o?{...a[n],h:(e[n].h+i+360)%360}:"s"===o?{...a[n],s:w(e[n].s+i,0,100)}:{...a[n],l:w(e[n].l+i,0,100)},a},n).state,t)}var C={qubit:()=>new h,register:e=>new u(e),annealer:(e,t,n)=>new g(e,t,n),qbm:(e,t)=>new m(e,t),amplifier:()=>new f,inferField:x,optimizeTheme:S,contrast:k,hslToHex:b};function M(e,t,n,r){const o=n.trim();switch(e){case"required":return""!==o;case"email":case"pattern":if("string"==typeof t)try{return""===o||new RegExp(t).test(o)}catch{return!0}return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o);case"phone":return""===o||/^\+?[\d\s\-()]{7,15}$/.test(o);case"url":return""===o||/^https?:\/\/.+/.test(o);case"minLength":case"min":{const e=Number(t??0);return""===o||(isNaN(Number(o))?o.length>=e:Number(o)>=e)}case"maxLength":case"max":{const e=Number(t??1/0);return""===o||(isNaN(Number(o))?o.length<=e:Number(o)<=e)}case"integer":return""===o||/^\d+$/.test(o);case"alphanumeric":return""===o||/^[a-zA-Z0-9]+$/.test(o);case"match":return o===(r["string"==typeof t?t:"password"]??"");default:return!0}}function z({phase:e,collapsed:t,primaryColor:n,borderColor:r}){const o=12,i=t?0:e,a=t?0:1.618*e,l=o+10*Math.sin(i)*Math.cos(a),s=12-10*Math.cos(i);/* @__PURE__ */
|
|
1
|
+
import{p as e}from"./chunk-DdHSYetV.js";import{E as t,a as n}from"./chunk-DcVMayoM.js";import r,{useCallback as o,useEffect as i,useRef as a,useState as l}from"react";import{Fragment as s,jsx as d,jsxs as c}from"react/jsx-runtime";var p=class e{constructor(e,t){this.re=e,this.im=t}add(t){return new e(this.re+t.re,this.im+t.im)}sub(t){return new e(this.re-t.re,this.im-t.im)}mul(t){return new e(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)}scale(t){return new e(this.re*t,this.im*t)}conjugate(){return new e(this.re,-this.im)}magnitudeSquared(){return this.re*this.re+this.im*this.im}magnitude(){return Math.sqrt(this.magnitudeSquared())}static fromPolar(t,n){return new e(t*Math.cos(n),t*Math.sin(n))}static zero(){return new e(0,0)}static one(){return new e(1,0)}},h=class e{constructor(e=p.one(),t=p.zero()){this.alpha=e,this.beta=t,this.normalize()}normalize(){const e=Math.sqrt(this.alpha.magnitudeSquared()+this.beta.magnitudeSquared());e>0&&(this.alpha=this.alpha.scale(1/e),this.beta=this.beta.scale(1/e))}hadamard(){const t=1/Math.SQRT2;return new e(this.alpha.add(this.beta).scale(t),this.alpha.sub(this.beta).scale(t))}ry(t){const n=Math.cos(t/2),r=Math.sin(t/2);return new e(this.alpha.scale(n).sub(this.beta.scale(r)),this.alpha.scale(r).add(this.beta.scale(n)))}phase(t){const n=p.fromPolar(1,t);return new e(this.alpha,this.beta.mul(n))}measure(){const e=this.beta.magnitudeSquared();return Math.random()<e?1:0}expectation(){return this.beta.magnitudeSquared()}getAlpha(){return this.alpha}getBeta(){return this.beta}},u=class{constructor(e){this.qubits=Array.from({length:e},()=>new h)}get size(){return this.qubits.length}getQubit(e){return this.qubits[e]}superpose(){this.qubits=this.qubits.map(e=>e.hadamard())}cnot(e,t){const n=this.qubits[e],r=this.qubits[t],o=n.expectation();this.qubits[t]=r.ry(Math.PI*o)}rotate(e,t){this.qubits[e]=this.qubits[e].ry(t)}measure(){return this.qubits.map(e=>e.measure())}probs(){return this.qubits.map(e=>e.expectation())}},g=class{constructor(e=1,t=.995,n=.3,r=1e-6){this.temperature=e,this.coolingRate=t,this.tunnelingStrength=n,this.minTemp=r}anneal(e,t,n,r=1e3){let o=e,i=t(o),a=o,l=i,s=this.temperature,d=0,c=0;for(let p=0;p<r&&s>this.minTemp;p++){const e=n(o),r=t(e),p=r-i;let h=!1;if(p<=0)h=!0;else{const e=Math.exp(-p/s),t=Math.sqrt(2*Math.abs(p)),n=Math.abs(p),r=Math.exp(-2*t*Math.sqrt(n)*this.tunnelingStrength);Math.random()<e+r&&(h=!0,Math.random()<r/(e+r+1e-10)&&c++)}h&&(o=e,i=r,d++,i<l&&(a=o,l=i)),s*=this.coolingRate}return{state:a,energy:l,iterations:r,accepted:d,tunnels:c}}},m=class{constructor(e,t){const n=Math.sqrt(2/(e+t));this.weights=Array.from({length:e},()=>Array.from({length:t},()=>(2*Math.random()-1)*n)),this.visibleBias=Array.from({length:e},()=>0),this.hiddenBias=Array.from({length:t},()=>0)}sigmoid(e){const t=.1*(Math.random()-.5);return 1/(1+Math.exp(-(e+t)))}sample(e){return Math.random()<e?1:0}energy(e,t){const n=this.visibleBias.reduce((t,n,r)=>t+n*e[r],0),r=this.hiddenBias.reduce((e,n,r)=>e+n*t[r],0);let o=0;for(let i=0;i<e.length;i++)for(let n=0;n<t.length;n++)o+=e[i]*this.weights[i][n]*t[n];return-(n+r+o)}hiddenProbs(e){return this.hiddenBias.map((t,n)=>{const r=t+e.reduce((e,t,r)=>e+this.weights[r][n]*t,0);return this.sigmoid(r)})}visibleProbs(e){return this.visibleBias.map((t,n)=>{const r=t+e.reduce((e,t,r)=>e+this.weights[n][r]*t,0);return this.sigmoid(r)})}gibbs(e,t=1){let n=[...e],r=[];for(let o=0;o<t;o++)r=this.hiddenProbs(n).map(e=>this.sample(e)),n=this.visibleProbs(r).map(e=>this.sample(e));return{visible:n,hidden:r}}trainCD1(e,t=.01){const n=this.visibleBias.length,r=this.hiddenBias.length,o=Array.from({length:n},()=>Array(r).fill(0)),i=Array(n).fill(0),a=Array(r).fill(0);for(const s of e){const e=this.hiddenProbs(s),t=e.map(e=>this.sample(e)),l=this.visibleProbs(t).map(e=>this.sample(e)),d=this.hiddenProbs(l);for(let a=0;a<n;a++){for(let t=0;t<r;t++)o[a][t]+=s[a]*e[t]-l[a]*d[t];i[a]+=s[a]-l[a]}for(let n=0;n<r;n++)a[n]+=e[n]-d[n]}const l=e.length;for(let s=0;s<n;s++){for(let e=0;e<r;e++)this.weights[s][e]+=t*o[s][e]/l;this.visibleBias[s]+=t*i[s]/l}for(let s=0;s<r;s++)this.hiddenBias[s]+=t*a[s]/l}infer(e){const t=this.hiddenProbs(e),n=t.map(e=>this.sample(e));return{hidden:t,visible:this.visibleProbs(n),energy:this.energy(e,n),iterations:1}}},f=class{amplify(e,t,n=.5){const r=e.length;if(0===r)return[];const o=e.map(t),i=o.filter(e=>e>n).length,a=Math.max(1,i);let l=Array(r).fill(1/Math.sqrt(r));const s=Math.max(1,Math.floor(Math.PI/4*Math.sqrt(r/a)));for(let d=0;d<s;d++){for(let t=0;t<r;t++)o[t]>n&&(l[t]=-l[t]);const e=l.reduce((e,t)=>e+t,0)/r;l=l.map(t=>2*e-t)}return e.map((e,t)=>({index:t,amplitude:l[t],probability:l[t]*l[t],classicalSimilarity:o[t],combined:l[t]*l[t]*.6+.4*o[t]})).sort((e,t)=>t.combined-e.combined)}},y=[{keywords:["email","e-mail","mail"],type:"email",validations:[{rule:"required",message:"Email is required"},{rule:"pattern",value:"^[^@]+@[^@]+\\.[^@]+$",message:"Enter a valid email address"},{rule:"maxLength",value:254,message:"Email too long"}],placeholder:"you@example.com",label:"Email Address",confidence:.98},{keywords:["password","passwd","pwd","pass"],type:"password",validations:[{rule:"required",message:"Password is required"},{rule:"minLength",value:8,message:"Password must be at least 8 characters"},{rule:"pattern",value:"(?=.*[A-Z])(?=.*[0-9])",message:"Include uppercase and a number"}],placeholder:"••••••••",label:"Password",confidence:.97},{keywords:["confirm_password","confirmpassword","confirm_pass","repassword","password2","repeat_password"],type:"password",validations:[{rule:"required",message:"Please confirm your password"},{rule:"match",value:"password",message:"Passwords do not match"}],placeholder:"••••••••",label:"Confirm Password",confidence:.95},{keywords:["phone","mobile","cell","tel","telephone","contact_number"],type:"tel",validations:[{rule:"pattern",value:"^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$",message:"Enter a valid phone number"}],placeholder:"+1 (555) 000-0000",label:"Phone Number",confidence:.93},{keywords:["age"],type:"number",validations:[{rule:"min",value:0,message:"Age cannot be negative"},{rule:"max",value:150,message:"Enter a valid age"},{rule:"integer",message:"Age must be a whole number"}],placeholder:"25",label:"Age",confidence:.9},{keywords:["price","amount","cost","fee","payment","salary","wage","total"],type:"number",validations:[{rule:"min",value:0,message:"Amount cannot be negative"},{rule:"pattern",value:"^\\d+(\\.\\d{1,2})?$",message:"Enter a valid amount (e.g. 9.99)"}],placeholder:"0.00",label:"Amount",confidence:.88},{keywords:["url","website","site","link","homepage","web"],type:"url",validations:[{rule:"pattern",value:"https?://.+",message:"Enter a valid URL starting with http:// or https://"}],placeholder:"https://example.com",label:"Website URL",confidence:.92},{keywords:["zip","zipcode","postal","postcode","pin_code"],type:"text",validations:[{rule:"pattern",value:"^[0-9]{5}(-[0-9]{4})?$",message:"Enter a valid ZIP code (e.g. 12345)"}],placeholder:"12345",label:"ZIP / Postal Code",confidence:.91},{keywords:["date","dob","birthday","birth_date","birthdate","born"],type:"date",validations:[{rule:"required",message:"Date is required"}],placeholder:"YYYY-MM-DD",label:"Date of Birth",confidence:.89},{keywords:["first_name","firstname","fname","given_name"],type:"text",validations:[{rule:"minLength",value:2,message:"First name too short"},{rule:"maxLength",value:50,message:"First name too long"}],placeholder:"Jane",label:"First Name",confidence:.9},{keywords:["last_name","lastname","lname","surname","family_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Last name too short"},{rule:"maxLength",value:50,message:"Last name too long"}],placeholder:"Doe",label:"Last Name",confidence:.9},{keywords:["name","full_name","fullname","display_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Name too short"},{rule:"maxLength",value:100,message:"Name too long"}],placeholder:"Jane Doe",label:"Full Name",confidence:.85},{keywords:["username","user_name","handle","login","loginname"],type:"text",validations:[{rule:"minLength",value:3,message:"Username must be at least 3 characters"},{rule:"maxLength",value:32,message:"Username too long"},{rule:"pattern",value:"^[a-zA-Z0-9_.-]+$",message:"Only letters, numbers, _, - and . allowed"}],placeholder:"cooluser42",label:"Username",confidence:.94},{keywords:["bio","biography","about","description","summary","details"],type:"textarea",validations:[{rule:"maxLength",value:500,message:"Bio must be under 500 characters"}],placeholder:"Tell us about yourself...",label:"Bio",confidence:.87},{keywords:["message","comment","feedback","note","notes","remarks","body"],type:"textarea",validations:[{rule:"minLength",value:10,message:"Message too short"},{rule:"maxLength",value:2e3,message:"Message too long"}],placeholder:"Write your message here...",label:"Message",confidence:.86},{keywords:["search","query","q","keyword","find"],type:"search",validations:[],placeholder:"Search...",label:"Search",confidence:.9},{keywords:["otp","one_time_password","verification_code","pin","code"],type:"text",validations:[{rule:"minLength",value:4,message:"Code too short"},{rule:"maxLength",value:8,message:"Code too long"},{rule:"pattern",value:"^[0-9]+$",message:"Code must be numeric"}],placeholder:"123456",label:"Verification Code",confidence:.92},{keywords:["color","colour","hex_color","brand_color"],type:"color",validations:[],placeholder:"#3b82f6",label:"Color",confidence:.95},{keywords:["address","street","street_address","addr"],type:"text",validations:[{rule:"maxLength",value:200,message:"Address too long"}],placeholder:"123 Main Street",label:"Street Address",confidence:.87},{keywords:["city","town","municipality"],type:"text",validations:[{rule:"maxLength",value:100,message:"City name too long"}],placeholder:"San Francisco",label:"City",confidence:.89},{keywords:["country","nation","country_code"],type:"text",validations:[],placeholder:"United States",label:"Country",confidence:.88},{keywords:["company","organization","org","employer","company_name"],type:"text",validations:[{rule:"maxLength",value:200,message:"Company name too long"}],placeholder:"Acme Inc.",label:"Company",confidence:.87}];function x(e){const t=e.toLowerCase().replace(/[\s-]/g,"_"),n=(new f).amplify(y,e=>{let n=0;for(const r of e.keywords)t===r?n=Math.max(n,1):t.includes(r)||r.includes(t)?n=Math.max(n,.8):r.split("_").some(e=>t.includes(e))&&(n=Math.max(n,.5));return n},.3);if(n.length>0&&n[0].combined>.1){const e=y[n[0].index];return{type:e.type,validations:e.validations,placeholder:e.placeholder,confidence:Math.min(e.confidence*n[0].combined*2,.99),label:e.label}}return{type:"text",validations:[{rule:"maxLength",value:255,message:"Input too long"}],placeholder:e.replace(/_/g," "),confidence:.3,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}}function b(e,t,n){const r=n/100,o=t/100*Math.min(r,1-r),i=t=>{const n=(t+e/30)%12,i=r-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*i).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}function v(e){const[t,n,r]=function(e){const t=e.replace("#",""),n=3===t.length?t.split("").map(e=>e+e).join(""):t;return[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]}(e).map(e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return.2126*t+.7152*n+.0722*r}function k(e,t){const n=v(e),r=v(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function w(e,t,n){return Math.max(t,Math.min(n,e))}function S(e,t,n=800){const r=t?{primary:{h:e,s:70,l:55},secondary:{h:(e+137.5)%360,s:65,l:50},bg:{h:e,s:10,l:8},surface:{h:e,s:10,l:13},text:{h:e,s:15,l:90},border:{h:e,s:15,l:22},accent:{h:(e+120)%360,s:75,l:60}}:{primary:{h:e,s:65,l:40},secondary:{h:(e+137.5)%360,s:55,l:38},bg:{h:e,s:15,l:97},surface:{h:e,s:12,l:100},text:{h:e,s:15,l:12},border:{h:e,s:12,l:85},accent:{h:(e+120)%360,s:70,l:42}};return function(e,t){const n=e=>b(e.h,e.s,e.l),r=t?e.text.l-20:e.text.l+15;return{primary:n(e.primary),secondary:n(e.secondary),background:n(e.bg),surface:n(e.surface),text:n(e.text),textMuted:b(e.text.h,Math.max(0,e.text.s-10),Math.max(20,Math.min(85,r))),border:n(e.border),error:t?"#f87171":"#dc2626",warning:t?"#fbbf24":"#d97706",success:t?"#34d399":"#059669",accent:n(e.accent)}}(new g(1.5,.994,.35,1e-5).anneal(r,e=>function(e,t){let n=0;const r=e=>b(e.h,e.s,e.l),o=r(e.text),i=r(e.bg),a=r(e.surface),l=r(e.primary),s=k(o,i),d=k(o,a),c=k(l,i);s<4.5&&(n+=10*(4.5-s)),d<4.5&&(n+=8*(4.5-d)),c<3&&(n+=5*(3-c)),n+=.05*Math.abs((e.secondary.h-e.primary.h+360)%360-137.508),n+=.03*Math.abs((e.accent.h-e.primary.h+360)%360-120);const p=(e.primary.s+e.secondary.s)/2;p<20&&(n+=.5*(20-p)),p>90&&(n+=.5*(p-90));const h=e.bg.l;t?(h>25&&(n+=2*(h-25)),h<3&&(n+=2*(3-h)),e.text.l<70&&(n+=1.5*(70-e.text.l))):(h<90&&(n+=2*(90-h)),h>100&&(n+=2*(h-100)),e.text.l>30&&(n+=1.5*(e.text.l-30)));const u=Math.abs(e.surface.l-e.bg.l);return u<2&&(n+=2*(2-u)),u>12&&(n+=1*(u-12)),n}(e,t),e=>{const t=["primary","secondary","bg","surface","text","border","accent"],n=t[Math.floor(Math.random()*t.length)],r=["h","s","l"],o=r[Math.floor(Math.random()*r.length)],i=(Math.random()-.5)*("h"===o?30:15),a={...e,[n]:{...e[n]}};return a[n]="h"===o?{...a[n],h:(e[n].h+i+360)%360}:"s"===o?{...a[n],s:w(e[n].s+i,0,100)}:{...a[n],l:w(e[n].l+i,0,100)},a},n).state,t)}var C={qubit:()=>new h,register:e=>new u(e),annealer:(e,t,n)=>new g(e,t,n),qbm:(e,t)=>new m(e,t),amplifier:()=>new f,inferField:x,optimizeTheme:S,contrast:k,hslToHex:b};function M(e,t,n,r){const o=n.trim();switch(e){case"required":return""!==o;case"email":case"pattern":if("string"==typeof t)try{return""===o||new RegExp(t).test(o)}catch{return!0}return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o);case"phone":return""===o||/^\+?[\d\s\-()]{7,15}$/.test(o);case"url":return""===o||/^https?:\/\/.+/.test(o);case"minLength":case"min":{const e=Number(t??0);return""===o||(isNaN(Number(o))?o.length>=e:Number(o)>=e)}case"maxLength":case"max":{const e=Number(t??1/0);return""===o||(isNaN(Number(o))?o.length<=e:Number(o)<=e)}case"integer":return""===o||/^\d+$/.test(o);case"alphanumeric":return""===o||/^[a-zA-Z0-9]+$/.test(o);case"match":return o===(r["string"==typeof t?t:"password"]??"");default:return!0}}function z({phase:e,collapsed:t,primaryColor:n,borderColor:r}){const o=12,i=t?0:e,a=t?0:1.618*e,l=o+10*Math.sin(i)*Math.cos(a),s=12-10*Math.cos(i);/* @__PURE__ */
|
|
2
2
|
return c("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",style:{flexShrink:0,opacity:t?.4:1,transition:"opacity 0.6s"},children:[
|
|
3
3
|
/* @__PURE__ */d("circle",{cx:o,cy:12,r:10,fill:"none",stroke:r,strokeWidth:"0.8"}),
|
|
4
4
|
/* @__PURE__ */d("ellipse",{cx:o,cy:12,rx:10,ry:3,fill:"none",stroke:r,strokeWidth:"0.5",strokeDasharray:"2 2"}),
|
|
5
5
|
/* @__PURE__ */d("line",{x1:o,y1:2,x2:o,y2:22,stroke:r,strokeWidth:"0.5"}),
|
|
6
6
|
/* @__PURE__ */d("line",{x1:o,y1:12,x2:l,y2:s,stroke:n,strokeWidth:"1.5",style:{transition:t?"all 0.6s ease-out":"none"}}),
|
|
7
7
|
/* @__PURE__ */d("circle",{cx:l,cy:s,r:"2",fill:n,style:{transition:t?"all 0.6s ease-out":"none"}})]})}function T({confidence:e,theme:t}){const n=Math.round(100*e),r=n>=80?t.success:n>=60?t.warning:t.danger;/* @__PURE__ */
|
|
8
|
-
return c("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",fontSize:"10px",fontWeight:600,padding:"1px 5px",borderRadius:"999px",backgroundColor:`${r}22`,color:r,border:`1px solid ${r}44`,marginLeft:"6px",verticalAlign:"middle",letterSpacing:"0.03em"},children:["⚛ ",n,"%"]})}function $({config:e,intel:
|
|
8
|
+
return c("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",fontSize:"10px",fontWeight:600,padding:"1px 5px",borderRadius:"999px",backgroundColor:`${r}22`,color:r,border:`1px solid ${r}44`,marginLeft:"6px",verticalAlign:"middle",letterSpacing:"0.03em"},children:["⚛ ",n,"%"]})}function $({config:e,intel:n,qubitPhase:r,value:o,error:i,touched:a,showConfidence:l,showQuantumState:s,collapsed:p,onChange:h,onBlur:u,theme:g,mounted:m,index:f}){const y=e.type??n.type,x=e.label??n.label,b=e.placeholder??n.placeholder,v=void 0!==e.required?e.required:n.validations.some(e=>"required"===e.rule),k=t(x),w="textarea"===y,S=a&&""!==i,C=`qf-${e.name}`,M={width:"100%",padding:"9px 12px",border:`1.5px solid ${S?g.danger:g.border}`,borderRadius:"8px",backgroundColor:g.surface,color:g.text,fontSize:"14px",fontFamily:"inherit",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",resize:w?"vertical":void 0,minHeight:w?"80px":void 0};/* @__PURE__ */
|
|
9
9
|
return c("div",{style:{display:"flex",flexDirection:"column",gap:"4px",opacity:m?1:0,transform:m?"scaleY(1)":"scaleY(0.92)",transition:`opacity 0.35s ease ${60*f}ms, transform 0.35s ease ${60*f}ms`,transformOrigin:"top"},children:[
|
|
10
10
|
/* @__PURE__ */c("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[s&&/* @__PURE__ */d(z,{phase:r,collapsed:p,primaryColor:g.primary,borderColor:g.border}),
|
|
11
|
-
/* @__PURE__ */c("label",{htmlFor:C,style:{fontSize:"13px",fontWeight:500,color:g.text,cursor:"pointer"},children:[k,v&&/* @__PURE__ */d("span",{"aria-hidden":"true",style:{color:g.danger,marginLeft:"3px"},children:"*"})]}),l&&/* @__PURE__ */d(T,{confidence:
|
|
12
|
-
return c("form",{onSubmit:
|
|
13
|
-
/* @__PURE__ */d("span",{"aria-label":"Powered by Quantum AI",style:{position:"absolute",top:"16px",right:"16px",fontSize:"10px",fontWeight:700,padding:"3px 8px",borderRadius:"999px",backgroundColor:`${m.primary}20`,color:m.primary,border:`1px solid ${m.primary}44`,letterSpacing:"0.04em",userSelect:"none"},children:"⚛ Quantum AI"}),u&&/* @__PURE__ */c("div",{style:{marginBottom:"20px",paddingRight:"100px"},children:[/* @__PURE__ */c("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[/* @__PURE__ */d("span",{style:{fontSize:"11px",color:m.textMuted,fontWeight:500},children:"Form Intelligence Confidence"}),/* @__PURE__ */c("span",{style:{fontSize:"11px",fontWeight:700,color:q},children:[
|
|
11
|
+
/* @__PURE__ */c("label",{htmlFor:C,style:{fontSize:"13px",fontWeight:500,color:g.text,cursor:"pointer"},children:[k,v&&/* @__PURE__ */d("span",{"aria-hidden":"true",style:{color:g.danger,marginLeft:"3px"},children:"*"})]}),l&&/* @__PURE__ */d(T,{confidence:n.confidence,theme:g})]}),w?/* @__PURE__ */d("textarea",{id:C,value:o,onChange:e=>h(e.target.value),onBlur:u,placeholder:b,"aria-invalid":S,"aria-required":v,style:M}):/* @__PURE__ */d("input",{id:C,type:y,value:o,onChange:e=>h(e.target.value),onBlur:u,placeholder:b,"aria-invalid":S,"aria-required":v,style:M}),S&&/* @__PURE__ */c("span",{role:"alert",style:{fontSize:"12px",color:g.danger,display:"flex",alignItems:"center",gap:"4px"},children:[/* @__PURE__ */d("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */d("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),t(i)]})]})}function A(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return(65535&t)/65535*Math.PI*2}function W({fields:r,onSubmit:a,submitLabel:p="Submit",layout:h="vertical",showConfidence:u=!0,showQuantumState:g=!1}){const m=e(),f=r.map(e=>x(e.name)),[y,b]=l(()=>Object.fromEntries(r.map(e=>[e.name,""]))),[v,k]=l({}),[w,S]=l({}),[C,z]=l(!1),[T,W]=l(!1),[R,B]=l(!1);i(()=>{const e=requestAnimationFrame(()=>W(!0));return()=>cancelAnimationFrame(e)},[]);const F=o((e,t)=>{const n=r.find(t=>t.name===e),o=f[r.findIndex(t=>t.name===e)];if(!n||!o)return"";const i=t[e]??"";for(const{rule:r,value:a,message:l}of o.validations)if(("required"!==r||!1!==n.required)&&!M(r,a,i,t))return l;return""},[r]),L=o(e=>{const t={};for(const n of r){const r=F(n.name,e);r&&(t[n.name]=r)}return t},[r,F]),I=o((e,t)=>{b(n=>{const o={...n,[e]:t};if(w[e]&&(k(t=>({...t,[e]:F(e,o)})),"password"===e)){const e=r.find(e=>["confirmpassword","confirm_password","passwordconfirm"].includes(e.name.toLowerCase().replace(/[\s_-]/g,"")))?.name;e&&w[e]&&k(t=>({...t,[e]:F(e,o)}))}return o}),B(!0)},[r,w,F]),P=o(e=>{S(t=>({...t,[e]:!0})),k(t=>({...t,[e]:F(e,y)}))},[y,F]),E=o(async e=>{e.preventDefault(),S(Object.fromEntries(r.map(e=>[e.name,!0])));const t=L(y);if(k(t),!(Object.keys(t).length>0)){z(!0);try{await a(y)}finally{z(!1)}}},[r,y,L,a]),_=f.length>0?Math.round(f.reduce((e,t)=>e+t.confidence,0)/f.length*100):0,q=_>=80?m.success:_>=60?m.warning:m.danger,D="horizontal"===h;/* @__PURE__ */
|
|
12
|
+
return c("form",{onSubmit:E,noValidate:!0,className:n("w-full"),style:{backgroundColor:m.surface,border:`1px solid ${m.border}`,borderRadius:"12px",padding:"24px",position:"relative",boxSizing:"border-box"},children:[
|
|
13
|
+
/* @__PURE__ */d("span",{"aria-label":"Powered by Quantum AI",style:{position:"absolute",top:"16px",right:"16px",fontSize:"10px",fontWeight:700,padding:"3px 8px",borderRadius:"999px",backgroundColor:`${m.primary}20`,color:m.primary,border:`1px solid ${m.primary}44`,letterSpacing:"0.04em",userSelect:"none"},children:"⚛ Quantum AI"}),u&&/* @__PURE__ */c("div",{style:{marginBottom:"20px",paddingRight:"100px"},children:[/* @__PURE__ */c("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[/* @__PURE__ */d("span",{style:{fontSize:"11px",color:m.textMuted,fontWeight:500},children:"Form Intelligence Confidence"}),/* @__PURE__ */c("span",{style:{fontSize:"11px",fontWeight:700,color:q},children:[_,"%"]})]}),/* @__PURE__ */d("div",{style:{height:"4px",borderRadius:"4px",backgroundColor:m.border,overflow:"hidden"},children:/* @__PURE__ */d("div",{style:{height:"100%",width:`${_}%`,backgroundColor:q,borderRadius:"4px",transition:"width 0.8s ease"}})})]}),
|
|
14
14
|
/* @__PURE__ */d("div",{style:{display:"grid",gridTemplateColumns:D?"repeat(auto-fill, minmax(260px, 1fr))":"1fr",gap:"16px",marginBottom:"20px"},children:r.map((e,t)=>/* @__PURE__ */d($,{config:e,intel:f[t],qubitPhase:A(e.name),value:y[e.name]??"",error:v[e.name]??"",touched:w[e.name]??!1,showConfidence:u,showQuantumState:g,collapsed:R,onChange:t=>I(e.name,t),onBlur:()=>P(e.name),theme:m,mounted:T,index:t},e.name))}),
|
|
15
|
-
/* @__PURE__ */d("button",{type:"submit",disabled:C,style:{width:"100%",padding:"10px 20px",borderRadius:"8px",border:"none",backgroundColor:C?`${m.primary}88`:m.primary,color:m.bg,fontSize:"14px",fontWeight:700,fontFamily:"inherit",cursor:C?"not-allowed":"pointer",transition:"background-color 0.15s, opacity 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:C?/* @__PURE__ */c(s,{children:[/* @__PURE__ */c("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{animation:"qf-spin 0.8s linear infinite"},"aria-hidden":"true",children:[/* @__PURE__ */d("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),/* @__PURE__ */d("path",{d:"M12 2a10 10 0 0 1 10 10"})]}),"Processing…"]}):
|
|
15
|
+
/* @__PURE__ */d("button",{type:"submit",disabled:C,style:{width:"100%",padding:"10px 20px",borderRadius:"8px",border:"none",backgroundColor:C?`${m.primary}88`:m.primary,color:m.bg,fontSize:"14px",fontWeight:700,fontFamily:"inherit",cursor:C?"not-allowed":"pointer",transition:"background-color 0.15s, opacity 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:C?/* @__PURE__ */c(s,{children:[/* @__PURE__ */c("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{animation:"qf-spin 0.8s linear infinite"},"aria-hidden":"true",children:[/* @__PURE__ */d("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),/* @__PURE__ */d("path",{d:"M12 2a10 10 0 0 1 10 10"})]}),"Processing…"]}):t(p)}),
|
|
16
16
|
/* @__PURE__ */d("style",{children:"@keyframes qf-spin { to { transform: rotate(360deg); } }"})]})}function R(e){return e?{primary:"#00f5d4",secondary:"#7b2ff7",background:"#0a0a0f",surface:"#12121a",text:"#e8e8f4",textMuted:"#8888aa",border:"#2a2a3e",error:"#f87171",warning:"#fbbf24",success:"#34d399",accent:"#ff6b6b"}:{primary:"#0d7c5f",secondary:"#6930c3",background:"#f8f6f1",surface:"#ffffff",text:"#1a1815",textMuted:"#6b6560",border:"#ddd8cc",error:"#dc2626",warning:"#d97706",success:"#059669",accent:"#e05a00"}}function B({points:e,primary:t}){if(e.length<2)/* @__PURE__ */return d("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#888",fontSize:12},children:"Waiting for data..."});const n=Math.max(...e.map(e=>e.energy)),r=Math.min(...e.map(e=>e.energy)),o=n-r||1,i=e[e.length-1].iteration||1;/* @__PURE__ */
|
|
17
17
|
return c("svg",{width:280,height:48,style:{display:"block"},children:[
|
|
18
18
|
/* @__PURE__ */d("polyline",{points:e.map(e=>{const t=e.iteration/i*280,n=48-(e.energy-r)/o*44-2;return`${t.toFixed(1)},${n.toFixed(1)}`}).join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",opacity:.9}),
|
|
@@ -28,20 +28,20 @@ return c("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},
|
|
|
28
28
|
/* @__PURE__ */c("span",{style:{fontSize:12,fontWeight:600},children:[t.toFixed(2),":1"]}),
|
|
29
29
|
/* @__PURE__ */d("span",{style:{fontSize:11,color:r?"#22c55e":"#ef4444"},children:r?"✓ AA":"✗ AA"}),
|
|
30
30
|
/* @__PURE__ */d("span",{style:{fontSize:11,color:o?"#22c55e":"#888"},children:o?"✓ AAA":"— AAA"}),
|
|
31
|
-
/* @__PURE__ */d("span",{style:{fontSize:13},children:n?"✅":"❌"})]})}function I({onThemeChange:
|
|
31
|
+
/* @__PURE__ */d("span",{style:{fontSize:13},children:n?"✅":"❌"})]})}function I({onThemeChange:t,initialHue:r=210,initialMode:i="dark"}){const s=e(),[p,h]=l(i),[u,g]=l(r),[m,f]=l(()=>R("dark"===i)),[y,x]=l(!1),[b,v]=l([]),[k,w]=l(!1),S=a(null),M="dark"===p,z=o((e,n)=>{f(r=>{const o={...r,[e]:n};return t?.(o),o})},[t]),T=o(()=>{if(y)return;x(!0),v([]);let e=0;const n=[],r=()=>{e+=60,C.optimizeTheme(u,M,e);const o=e/600,i=50*(1-o)+2,a=8*(Math.random()-.5)*(1-.8*o);if(n.push({iteration:e,energy:Math.max(0,i+a)}),v([...n]),e<600)S.current=window.setTimeout(r,40);else{const e=C.optimizeTheme(u,M,1e3);f(e),t?.(e),x(!1)}};S.current=window.setTimeout(r,16)},[u,M,y,t]),$=o(()=>{const e="dark"===p?"light":"dark";h(e);const n=R("dark"===e);f(n),t?.(n)},[p,t]),A=o(()=>{const e=`export const myTheme = {\n${Object.entries(m).map(([e,t])=>` ${e}: '${t}',`).join("\n")}\n};`;"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{w(!0),setTimeout(()=>w(!1),2e3)})},[m]),W=[{label:"Text on Background",fg:m.text,bg:m.background},{label:"Text on Surface",fg:m.text,bg:m.surface},{label:"Primary on Background",fg:m.primary,bg:m.background},{label:"TextMuted on Background",fg:m.textMuted,bg:m.background}],I="linear-gradient(to right,"+["hsl(0,80%,55%)","hsl(30,80%,55%)","hsl(60,80%,55%)","hsl(90,80%,55%)","hsl(120,80%,55%)","hsl(150,80%,55%)","hsl(180,80%,55%)","hsl(210,80%,55%)","hsl(240,80%,55%)","hsl(270,80%,55%)","hsl(300,80%,55%)","hsl(330,80%,55%)","hsl(360,80%,55%)"].join(",")+")",P={fontFamily:"system-ui, -apple-system, sans-serif",background:m.background,color:m.text,border:`1px solid ${m.border}`,borderRadius:12,padding:20,maxWidth:900,display:"grid",gridTemplateColumns:"1fr 1fr",gap:20},E={background:m.surface,border:`1px solid ${m.border}`,borderRadius:8,padding:16},_={fontSize:13,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:m.primary,marginBottom:12,marginTop:0},q={padding:"8px 16px",borderRadius:8,border:"none",cursor:"pointer",fontWeight:600,fontSize:13,transition:"opacity 0.15s"},D=n;/* @__PURE__ */
|
|
32
32
|
return c("div",{style:P,children:[
|
|
33
33
|
/* @__PURE__ */c("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[
|
|
34
34
|
/* @__PURE__ */c("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gridColumn:"1/-1"},children:[/* @__PURE__ */c("div",{children:[/* @__PURE__ */d("h2",{style:{margin:0,fontSize:18,fontWeight:700},children:"Theme Builder"}),/* @__PURE__ */d("p",{style:{margin:"2px 0 0",fontSize:12,color:m.textMuted},children:"Quantum-powered color optimization"})]}),/* @__PURE__ */d("button",{onClick:$,style:{...q,background:m.surface,color:m.text,border:`1px solid ${m.border}`},children:M?"☀ Light":"🌙 Dark"})]}),
|
|
35
|
-
/* @__PURE__ */c("div",{style:
|
|
35
|
+
/* @__PURE__ */c("div",{style:E,children:[/* @__PURE__ */d("p",{style:_,children:"Base Hue"}),/* @__PURE__ */c("div",{style:{display:"flex",alignItems:"center",gap:10},children:[
|
|
36
36
|
/* @__PURE__ */d("div",{style:{width:24,height:24,borderRadius:"50%",background:`hsl(${u},70%,55%)`,border:`2px solid ${m.border}`,flexShrink:0}}),
|
|
37
37
|
/* @__PURE__ */d("input",{type:"range",min:0,max:360,value:u,onChange:e=>g(Number(e.target.value)),style:{flex:1,height:16,borderRadius:8,background:I,outline:"none",border:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none"}}),
|
|
38
38
|
/* @__PURE__ */c("span",{style:{fontSize:13,fontFamily:"monospace",minWidth:32},children:[u,"°"]})]})]}),
|
|
39
|
-
/* @__PURE__ */c("div",{style:
|
|
40
|
-
/* @__PURE__ */c("div",{style:
|
|
39
|
+
/* @__PURE__ */c("div",{style:E,children:[/* @__PURE__ */c("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[/* @__PURE__ */d("button",{onClick:T,disabled:y,style:{...q,background:y?m.border:m.primary,color:M?"#000":"#fff",opacity:y?.7:1,flex:1},children:y?"⟳ Optimizing...":"⚛ Generate with Quantum Annealing"}),/* @__PURE__ */d("div",{style:{padding:"3px 8px",background:m.primary+"22",border:`1px solid ${m.primary}44`,borderRadius:20,fontSize:10,color:m.primary,fontWeight:700,whiteSpace:"nowrap"},children:"⚛ Quantum Annealing"})]}),(y||b.length>0)&&/* @__PURE__ */c("div",{children:[/* @__PURE__ */d("p",{style:{fontSize:11,color:m.textMuted,margin:"0 0 4px"},children:"Energy landscape (lower = better palette)"}),/* @__PURE__ */d(B,{points:b,primary:m.primary})]})]}),
|
|
40
|
+
/* @__PURE__ */c("div",{style:E,children:[/* @__PURE__ */d("p",{style:_,children:"Color Tokens"}),Object.keys(m).map(e=>/* @__PURE__ */d(F,{label:e,value:m[e],onChange:t=>z(e,t),text:m.text,border:m.border},e))]}),
|
|
41
41
|
/* @__PURE__ */d("button",{onClick:A,style:{...q,background:m.accent,color:"#fff",width:"100%"},children:k?"✓ Copied to Clipboard!":"⬇ Export Theme"})]}),
|
|
42
42
|
/* @__PURE__ */c("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[
|
|
43
|
-
/* @__PURE__ */c("div",{style:
|
|
44
|
-
/* @__PURE__ */d("p",{style:
|
|
43
|
+
/* @__PURE__ */c("div",{style:E,children:[
|
|
44
|
+
/* @__PURE__ */d("p",{style:_,children:"Live Preview"}),
|
|
45
45
|
/* @__PURE__ */c("div",{style:{marginBottom:12},children:[/* @__PURE__ */d("p",{style:{fontSize:11,color:m.textMuted,margin:"0 0 6px"},children:"Buttons"}),/* @__PURE__ */c("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[
|
|
46
46
|
/* @__PURE__ */d("button",{style:{padding:"8px 16px",borderRadius:8,border:"none",background:m.primary,color:M?"#000":"#fff",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Primary"}),
|
|
47
47
|
/* @__PURE__ */d("button",{style:{padding:"8px 16px",borderRadius:8,border:"none",background:m.secondary,color:"#fff",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Secondary"}),
|
|
@@ -53,11 +53,11 @@ return c("div",{style:P,children:[
|
|
|
53
53
|
/* @__PURE__ */c("div",{style:{marginBottom:12},children:[/* @__PURE__ */d("p",{style:{fontSize:11,color:m.textMuted,margin:"0 0 6px"},children:"Input"}),/* @__PURE__ */d("input",{type:"text",placeholder:"Type something...",readOnly:!0,style:{width:"100%",padding:"8px 12px",borderRadius:8,border:`1px solid ${m.border}`,background:m.background,color:m.text,fontSize:13,outline:"none",boxSizing:"border-box"}})]}),
|
|
54
54
|
/* @__PURE__ */c("div",{style:{marginBottom:12},children:[/* @__PURE__ */d("p",{style:{fontSize:11,color:m.textMuted,margin:"0 0 6px"},children:"Progress"}),/* @__PURE__ */d("div",{style:{height:8,borderRadius:4,background:m.border,overflow:"hidden"},children:/* @__PURE__ */d("div",{style:{height:"100%",width:"68%",background:`linear-gradient(to right, ${m.primary}, ${m.accent})`,borderRadius:4,transition:"width 0.4s ease"}})})]}),
|
|
55
55
|
/* @__PURE__ */c("div",{children:[/* @__PURE__ */d("p",{style:{fontSize:11,color:m.textMuted,margin:"0 0 6px"},children:"Status Badges"}),/* @__PURE__ */d("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[{label:"Error",color:m.error},{label:"Warning",color:m.warning},{label:"Success",color:m.success}].map(({label:e,color:t})=>/* @__PURE__ */d("span",{style:{padding:"3px 10px",borderRadius:4,background:t+"22",color:t,border:`1px solid ${t}44`,fontSize:11,fontWeight:700},children:e},e))})]})]}),
|
|
56
|
-
/* @__PURE__ */c("div",{style:
|
|
57
|
-
/* @__PURE__ */d("p",{style:
|
|
56
|
+
/* @__PURE__ */c("div",{style:E,children:[
|
|
57
|
+
/* @__PURE__ */d("p",{style:_,children:"WCAG Contrast Check"}),W.map(e=>/* @__PURE__ */d(L,{label:e.label,ratio:C.contrast(e.fg,e.bg)},e.label)),
|
|
58
58
|
/* @__PURE__ */d("p",{style:{fontSize:10,color:m.textMuted,marginTop:8,marginBottom:0},children:"AA requires 4.5:1 (normal text). AAA requires 7:1."})]}),
|
|
59
|
-
/* @__PURE__ */c("div",{style:
|
|
60
|
-
return d("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:"36px",padding:"12px 0",textAlign:"right",paddingRight:"8px",userSelect:"none",pointerEvents:"none",fontSize:"12px",lineHeight:`${t}px`,color:"#555577",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", monospace',boxSizing:"border-box"},children:n.map((e,t)=>/* @__PURE__ */d("div",{children:t+1},t))})}var D=["TkxButton","TkxInput","TkxCard","TkxModal","TkxTable","TkxSelect","TkxCheckbox","TkxRadio","TkxSwitch","TkxSlider","TkxBadge","TkxAlert","TkxToast","TkxTooltip","TkxPopover","TkxTabs","TkxAccordion","TkxDrawer","TkxDropdown","TkxMenu","TkxForm","TkxDataGrid","TkxChart","TkxSpinner","TkxSkeleton","TkxAvatar","TkxTag","TkxDivider","TkxProgress","TkxStatistic","TkxQuantumForm","TkxPlayground"],N=new f;function j(e){const t=e.match(/([A-Z][a-zA-Z0-9]*)$/);return t?t[1]:""}function H({defaultCode:t,examples:n,height:s=480,imports:p={},strictMode:h=!0,forbiddenTokens:u}){const g=e(),m=[...
|
|
59
|
+
/* @__PURE__ */c("div",{style:E,children:[/* @__PURE__ */d("p",{style:_,children:"Color Palette"}),/* @__PURE__ */d("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:Object.entries(m).map(([e,t])=>/* @__PURE__ */d("div",{title:`${e}: ${t}`,style:{width:36,height:36,borderRadius:6,background:t,border:`2px solid ${m.border}`,cursor:"default",flexShrink:0}},e))})]})]}),"function"==typeof D&&null,"string"==typeof s.bg&&null]})}W.displayName="TkxQuantumForm";var P=["fetch(","XMLHttpRequest","navigator.sendBeacon","document.cookie","localStorage","sessionStorage","indexedDB","WebSocket","EventSource","import(","eval(","new Function(","postMessage","window.open","location.href","location.replace","location.assign","document.write","crypto.subtle"],E=[{label:"Hello World",code:"<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>\n <h2 style={{ margin: 0 }}>👋 Hello, TkxPlayground!</h2>\n <p style={{ marginTop: 8, opacity: 0.7 }}>Edit the code on the left to see live updates.</p>\n</div>"},{label:"Button Styles",code:"<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>\n {['primary', 'success', 'danger', 'warning', 'info'].map(color => (\n <button\n key={color}\n style={{\n padding: '8px 18px',\n borderRadius: 8,\n border: 'none',\n background: color === 'primary' ? '#00f5d4' : color === 'success' ? '#06d6a0' : color === 'danger' ? '#f72585' : color === 'warning' ? '#ffbe0b' : '#3a86ff',\n color: '#0a0a0f',\n fontWeight: 700,\n cursor: 'pointer',\n textTransform: 'capitalize',\n }}\n >\n {color}\n </button>\n ))}\n</div>"},{label:"Card Grid",code:"<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>\n {['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta'].map(name => (\n <div key={name} style={{\n background: '#1a1a2e',\n borderRadius: 10,\n border: '1px solid #2a2a3e',\n padding: '16px',\n }}>\n <div style={{ fontWeight: 700, color: '#00f5d4', marginBottom: 4 }}>{name}</div>\n <div style={{ fontSize: 12, color: '#8888aa' }}>Quantum module {name.toLowerCase()}</div>\n </div>\n ))}\n</div>"},{label:"Animated Counter",code:"(() => {\n const [count, setCount] = React.useState(0);\n return (\n <div style={{ padding: 32, textAlign: 'center', fontFamily: 'sans-serif' }}>\n <div style={{ fontSize: 64, fontWeight: 900, color: '#00f5d4', marginBottom: 16 }}>\n {count}\n </div>\n <div style={{ display: 'flex', gap: 12, justifyContent: 'center' }}>\n <button onClick={() => setCount(c => c - 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>−</button>\n <button onClick={() => setCount(0)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#8888aa', cursor: 'pointer' }}>Reset</button>\n <button onClick={() => setCount(c => c + 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>+</button>\n </div>\n </div>\n );\n})()"},{label:"Data Table",code:"(() => {\n const rows = [\n { id: 1, name: 'Hydrogen', symbol: 'H', mass: 1.008 },\n { id: 2, name: 'Helium', symbol: 'He', mass: 4.003 },\n { id: 3, name: 'Lithium', symbol: 'Li', mass: 6.941 },\n { id: 4, name: 'Carbon', symbol: 'C', mass: 12.011 },\n { id: 5, name: 'Nitrogen', symbol: 'N', mass: 14.007 },\n ];\n const cell = { padding: '8px 14px', borderBottom: '1px solid #2a2a3e', color: '#e8e8f4', fontSize: 13 };\n const hcell = { ...cell, color: '#8888aa', fontWeight: 600, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.06em' };\n return (\n <div style={{ padding: 16 }}>\n <table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: 'sans-serif' }}>\n <thead>\n <tr>{['ID','Element','Symbol','Atomic Mass'].map(h => <th key={h} style={hcell}>{h}</th>)}</tr>\n </thead>\n <tbody>\n {rows.map(r => (\n <tr key={r.id} style={{ transition: 'background 0.15s' }}>\n <td style={cell}>{r.id}</td>\n <td style={cell}>{r.name}</td>\n <td style={{ ...cell, color: '#00f5d4', fontWeight: 700 }}>{r.symbol}</td>\n <td style={cell}>{r.mass}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n})()"}],_=class extends r.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){this.props.onError(e.message)}componentDidUpdate(e){e.children!==this.props.children&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?null:this.props.children}};function q({code:e,lineHeight:t}){const n=e.split("\n");/* @__PURE__ */
|
|
60
|
+
return d("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:"36px",padding:"12px 0",textAlign:"right",paddingRight:"8px",userSelect:"none",pointerEvents:"none",fontSize:"12px",lineHeight:`${t}px`,color:"#555577",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", monospace',boxSizing:"border-box"},children:n.map((e,t)=>/* @__PURE__ */d("div",{children:t+1},t))})}var D=["TkxButton","TkxInput","TkxCard","TkxModal","TkxTable","TkxSelect","TkxCheckbox","TkxRadio","TkxSwitch","TkxSlider","TkxBadge","TkxAlert","TkxToast","TkxTooltip","TkxPopover","TkxTabs","TkxAccordion","TkxDrawer","TkxDropdown","TkxMenu","TkxForm","TkxDataGrid","TkxChart","TkxSpinner","TkxSkeleton","TkxAvatar","TkxTag","TkxDivider","TkxProgress","TkxStatistic","TkxQuantumForm","TkxPlayground"],N=new f;function j(e){const t=e.match(/([A-Z][a-zA-Z0-9]*)$/);return t?t[1]:""}function H({defaultCode:t,examples:n,height:s=480,imports:p={},strictMode:h=!0,forbiddenTokens:u}){const g=e(),m=[...E,...n??[]],f=t??E[0].code,[y,x]=l(f),[b,v]=l({element:null,error:null,renderMs:0}),[k,w]=l(null),[S,C]=l([]),[M,z]=l(!1),[T,$]=l(0),A=a(null),W=a(null),R=o(e=>{w(null),v(function(e,t,n){const o=performance.now();try{const i=e.trim();if(!1!==n?.strictMode){const e=function(e,t){const n=[...P,...t??[]],r=e.toLowerCase();for(const o of n)if(r.includes(o.toLowerCase()))return o;return null}(i,n?.forbiddenTokens);if(e)return{element:null,error:`Blocked by playground strictMode: code contains "${e}". This token is disallowed because playground snippets run in the page's JavaScript context. If you trust the source, pass strictMode={false} to <TkxPlayground>.`,renderMs:parseFloat((performance.now()-o).toFixed(2))}}let a=`\n function PlaygroundRoot() {\n ${i.startsWith("<")||i.startsWith("(")?`return (${i});`:i}\n }\n `;const l="undefined"==typeof window?null:window.Babel??null;l&&(a=l.transform(a,{presets:["react"],filename:"playground.jsx"}).code??a);const s=new Function("React","imports",`\n "use strict";\n const { ${Object.keys(t).join(", ")} } = imports;\n ${a}\n return PlaygroundRoot;\n `)(r,t);return{element:r.createElement(s),error:null,renderMs:parseFloat((performance.now()-o).toFixed(2))}}catch(i){const e=parseFloat((performance.now()-o).toFixed(2));return{element:null,error:i instanceof Error?i.message:String(i),renderMs:e}}}(e,p,{strictMode:h,forbiddenTokens:u}))},[p,h,u]);i(()=>(W.current&&clearTimeout(W.current),W.current=setTimeout(()=>R(y),300),()=>{W.current&&clearTimeout(W.current)}),[y,R]),i(()=>{R(f)},[]);const B=o(e=>{const t=e.target.value;x(t);const n=j(t);n.length>=2?C(function(e,t=4){if(!e||e.length<2)return[];const n=e.toLowerCase();return N.amplify(D,e=>{const t=e.toLowerCase();if(t.startsWith(n))return 1;if(t.includes(n))return.7;let r=0;for(let o=0;o<n.length-1;o++)t.includes(n.slice(o,o+2))&&(r+=.15);return Math.min(r,.5)},.1).slice(0,t).map(e=>({name:D[e.index]??"",amplitude:parseFloat(e.combined.toFixed(3))})).filter(e=>""!==e.name)}(n,4)):C([])},[]),F=o(e=>{const t=m[e];t&&($(e),x(t.code),C([]))},[m]),L=o(async()=>{try{await navigator.clipboard.writeText(y),z(!0),setTimeout(()=>z(!1),1500)}catch{}},[y]),I=o(()=>{x(f),$(0),C([])},[f]),H=o(e=>{const t=j(y);t&&x(n=>n.slice(0,n.lastIndexOf(t))+e),C([])},[y]),O=null!==b.error||null!==k,Q=b.error??k??"",Z=g.bg,U=g.surfaceAlt,Y=g.border,G=g.surface,J={width:"50%",display:"flex",flexDirection:"column",borderRight:`1px solid ${Y}`,position:"relative"},V={display:"flex",alignItems:"center",gap:"6px",padding:"6px 10px",borderBottom:`1px solid ${Y}`,backgroundColor:g.surface,flexWrap:"wrap"},X={padding:"3px 10px",borderRadius:"6px",border:`1px solid ${Y}`,backgroundColor:"transparent",color:g.textMuted,fontSize:"11px",fontWeight:600,cursor:"pointer",fontFamily:"inherit",transition:"color 0.15s, border-color 0.15s"};/* @__PURE__ */
|
|
61
61
|
return c("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${Y}`,borderRadius:"12px",overflow:"hidden",backgroundColor:Z,fontFamily:"inherit",boxSizing:"border-box",position:"relative"},children:[
|
|
62
62
|
/* @__PURE__ */c("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",borderBottom:`1px solid ${Y}`,backgroundColor:g.surface},children:[/* @__PURE__ */d("span",{style:{fontSize:"12px",fontWeight:700,color:g.primary,letterSpacing:"0.05em"},children:"⚛ TkxPlayground"}),/* @__PURE__ */d("span",{style:{fontSize:"10px",color:g.textMuted},children:"Live JSX Preview"})]}),
|
|
63
63
|
/* @__PURE__ */d("div",{style:{display:"flex",gap:"4px",padding:"6px 10px",borderBottom:`1px solid ${Y}`,backgroundColor:g.surface,overflowX:"auto"},children:m.map((e,t)=>/* @__PURE__ */d("button",{onClick:()=>F(t),style:{padding:"3px 10px",borderRadius:"6px",border:`1px solid ${t===T?g.primary:Y}`,backgroundColor:t===T?`${g.primary}20`:"transparent",color:t===T?g.primary:g.textMuted,fontSize:"11px",fontWeight:t===T?700:400,cursor:"pointer",whiteSpace:"nowrap",fontFamily:"inherit",transition:"all 0.15s"},children:e.label},t))}),
|
|
@@ -66,7 +66,7 @@ return c("div",{style:{display:"flex",flexDirection:"column",border:`1px solid $
|
|
|
66
66
|
/* @__PURE__ */d("span",{style:{fontSize:"11px",color:g.textMuted,marginRight:"auto"},children:"editor.tsx"}),
|
|
67
67
|
/* @__PURE__ */d("button",{onClick:L,style:X,title:"Copy code",children:M?"✓ Copied":"⎘ Copy"}),
|
|
68
68
|
/* @__PURE__ */d("button",{onClick:I,style:X,title:"Reset to default",children:"↺ Reset"})]}),
|
|
69
|
-
/* @__PURE__ */c("div",{style:{position:"relative",flex:1,overflow:"hidden"},children:[/* @__PURE__ */d(q,{code:y,lineHeight:18}),/* @__PURE__ */d("textarea",{ref:A,value:y,onChange:B,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",padding:"12px 12px 12px 44px",margin:0,border:"none",outline:"none",resize:"none",backgroundColor:Z,color:g.text,fontSize:"12px",lineHeight:"18px",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace',boxSizing:"border-box",overflowY:"auto",tabSize:2}})]}),S.length>0&&/* @__PURE__ */c("div",{style:{position:"absolute",bottom:"40px",left:"44px",zIndex:10,backgroundColor:g.surface,border:`1px solid ${g.primary}44`,borderRadius:"8px",overflow:"hidden",boxShadow:"0 4px 16px rgba(0,0,0,0.3)",minWidth:"180px"},children:[/* @__PURE__ */d("div",{style:{padding:"4px 10px 4px",fontSize:"10px",color:g.primary,fontWeight:700,borderBottom:`1px solid ${Y}`,letterSpacing:"0.05em"},children:"⚛ Quantum Suggestions"}),S.map(e=>/* @__PURE__ */c("button",{onClick:()=>H(e.name),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",border:"none",backgroundColor:"transparent",color:g.text,fontSize:"12px",fontFamily:'"Fira Code", monospace',cursor:"pointer",textAlign:"left",gap:"12px"},children:[/* @__PURE__ */d("span",{children:e.name}),/* @__PURE__ */c("span",{style:{fontSize:"10px",color:g.textMuted,flexShrink:0},children:[Math.round(100*e.amplitude),"%"]})]},e.name))]})]}),/* @__PURE__ */c("div",{style:{width:"50%",display:"flex",flexDirection:"column"},children:[/* @__PURE__ */d("div",{style:{padding:"6px 10px",borderBottom:`1px solid ${Y}`,backgroundColor:g.surface,fontSize:"11px",color:g.textMuted,fontWeight:600},children:"Preview"}),/* @__PURE__ */d("div",{style:{flex:1,overflow:"auto",backgroundColor:U,position:"relative"},children:O?/* @__PURE__ */c("div",{style:{padding:"16px",color:g.danger,fontFamily:'"Fira Code", monospace',fontSize:"12px",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[/* @__PURE__ */c("div",{style:{marginBottom:"8px",fontWeight:700,display:"flex",alignItems:"center",gap:"6px"},children:[/* @__PURE__ */d("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */d("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),"Runtime Error"]}),Q]}):/* @__PURE__ */d(
|
|
69
|
+
/* @__PURE__ */c("div",{style:{position:"relative",flex:1,overflow:"hidden"},children:[/* @__PURE__ */d(q,{code:y,lineHeight:18}),/* @__PURE__ */d("textarea",{ref:A,value:y,onChange:B,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",padding:"12px 12px 12px 44px",margin:0,border:"none",outline:"none",resize:"none",backgroundColor:Z,color:g.text,fontSize:"12px",lineHeight:"18px",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace',boxSizing:"border-box",overflowY:"auto",tabSize:2}})]}),S.length>0&&/* @__PURE__ */c("div",{style:{position:"absolute",bottom:"40px",left:"44px",zIndex:10,backgroundColor:g.surface,border:`1px solid ${g.primary}44`,borderRadius:"8px",overflow:"hidden",boxShadow:"0 4px 16px rgba(0,0,0,0.3)",minWidth:"180px"},children:[/* @__PURE__ */d("div",{style:{padding:"4px 10px 4px",fontSize:"10px",color:g.primary,fontWeight:700,borderBottom:`1px solid ${Y}`,letterSpacing:"0.05em"},children:"⚛ Quantum Suggestions"}),S.map(e=>/* @__PURE__ */c("button",{onClick:()=>H(e.name),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",border:"none",backgroundColor:"transparent",color:g.text,fontSize:"12px",fontFamily:'"Fira Code", monospace',cursor:"pointer",textAlign:"left",gap:"12px"},children:[/* @__PURE__ */d("span",{children:e.name}),/* @__PURE__ */c("span",{style:{fontSize:"10px",color:g.textMuted,flexShrink:0},children:[Math.round(100*e.amplitude),"%"]})]},e.name))]})]}),/* @__PURE__ */c("div",{style:{width:"50%",display:"flex",flexDirection:"column"},children:[/* @__PURE__ */d("div",{style:{padding:"6px 10px",borderBottom:`1px solid ${Y}`,backgroundColor:g.surface,fontSize:"11px",color:g.textMuted,fontWeight:600},children:"Preview"}),/* @__PURE__ */d("div",{style:{flex:1,overflow:"auto",backgroundColor:U,position:"relative"},children:O?/* @__PURE__ */c("div",{style:{padding:"16px",color:g.danger,fontFamily:'"Fira Code", monospace',fontSize:"12px",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[/* @__PURE__ */c("div",{style:{marginBottom:"8px",fontWeight:700,display:"flex",alignItems:"center",gap:"6px"},children:[/* @__PURE__ */d("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:/* @__PURE__ */d("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),"Runtime Error"]}),Q]}):/* @__PURE__ */d(_,{onError:w,children:/* @__PURE__ */d("div",{style:{minHeight:"100%"},children:b.element})})})]})]}),
|
|
70
70
|
/* @__PURE__ */c("div",{style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px 12px",backgroundColor:G,borderTop:`1px solid ${Y}`,fontSize:"11px",color:g.textMuted},children:[
|
|
71
71
|
/* @__PURE__ */c("span",{style:{display:"flex",alignItems:"center",gap:"4px",color:O?g.danger:g.success,fontWeight:600},children:[/* @__PURE__ */d("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:O?g.danger:g.success,display:"inline-block"}}),O?"Error":"OK"]}),
|
|
72
72
|
/* @__PURE__ */c("span",{children:["⏱ ",b.renderMs," ms"]}),
|