json-schema-builder-react 0.0.4 → 0.0.5

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),k=require("react"),Ke=require("@radix-ui/react-slot"),v=require("lucide-react"),He=require("@radix-ui/react-tooltip"),Xe=require("@radix-ui/react-dialog"),Ze=require("@radix-ui/react-label"),Qe=require("@radix-ui/react-select"),Ye=require("@radix-ui/react-checkbox");function Z(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return r.default=e,Object.freeze(r)}const T=Z(k),se=Z(He),V=Z(Xe),Ie=Z(Ze),z=Z(Qe),ae=Z(Ye);function Pe(e){var r,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(r=0;r<o;r++)e[r]&&(s=Pe(e[r]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function ze(){for(var e,r,s=0,n="",o=arguments.length;s<o;s++)(e=arguments[s])&&(r=Pe(e))&&(n&&(n+=" "),n+=r);return n}const we=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ne=ze,Ae=(e,r)=>s=>{var n;if((r==null?void 0:r.variants)==null)return Ne(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:o,defaultVariants:a}=r,i=Object.keys(o).map(l=>{const f=s==null?void 0:s[l],w=a==null?void 0:a[l];if(f===null)return null;const y=we(f)||we(w);return o[l][y]}),d=s&&Object.entries(s).reduce((l,f)=>{let[w,y]=f;return y===void 0||(l[w]=y),l},{}),c=r==null||(n=r.compoundVariants)===null||n===void 0?void 0:n.reduce((l,f)=>{let{class:w,className:y,...S}=f;return Object.entries(S).every(x=>{let[m,p]=x;return Array.isArray(p)?p.includes({...a,...d}[m]):{...a,...d}[m]===p})?[...l,w,y]:l},[]);return Ne(e,i,c,s==null?void 0:s.class,s==null?void 0:s.className)},ge="-",et=e=>{const r=st(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{const d=i.split(ge);return d[0]===""&&d.length!==1&&d.shift(),Re(d,r)||tt(i)},getConflictingClassGroupIds:(i,d)=>{const c=s[i]||[];return d&&n[i]?[...c,...n[i]]:c}}},Re=(e,r)=>{var i;if(e.length===0)return r.classGroupId;const s=e[0],n=r.nextPart.get(s),o=n?Re(e.slice(1),n):void 0;if(o)return o;if(r.validators.length===0)return;const a=e.join(ge);return(i=r.validators.find(({validator:d})=>d(a)))==null?void 0:i.classGroupId},Ce=/^\[(.+)\]$/,tt=e=>{if(Ce.test(e)){const r=Ce.exec(e)[1],s=r==null?void 0:r.substring(0,r.indexOf(":"));if(s)return"arbitrary.."+s}},st=e=>{const{theme:r,prefix:s}=e,n={nextPart:new Map,validators:[]};return nt(Object.entries(e.classGroups),s).forEach(([a,i])=>{ie(i,n,a,r)}),n},ie=(e,r,s,n)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?r:ke(r,o);a.classGroupId=s;return}if(typeof o=="function"){if(rt(o)){ie(o(n),r,s,n);return}r.validators.push({validator:o,classGroupId:s});return}Object.entries(o).forEach(([a,i])=>{ie(i,ke(r,a),s,n)})})},ke=(e,r)=>{let s=e;return r.split(ge).forEach(n=>{s.nextPart.has(n)||s.nextPart.set(n,{nextPart:new Map,validators:[]}),s=s.nextPart.get(n)}),s},rt=e=>e.isThemeGetter,nt=(e,r)=>r?e.map(([s,n])=>{const o=n.map(a=>typeof a=="string"?r+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([i,d])=>[r+i,d])):a);return[s,o]}):e,ot=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,s=new Map,n=new Map;const o=(a,i)=>{s.set(a,i),r++,r>e&&(r=0,n=s,s=new Map)};return{get(a){let i=s.get(a);if(i!==void 0)return i;if((i=n.get(a))!==void 0)return o(a,i),i},set(a,i){s.has(a)?s.set(a,i):o(a,i)}}},qe="!",at=e=>{const{separator:r,experimentalParseClassName:s}=e,n=r.length===1,o=r[0],a=r.length,i=d=>{const c=[];let l=0,f=0,w;for(let p=0;p<d.length;p++){let b=d[p];if(l===0){if(b===o&&(n||d.slice(p,p+a)===r)){c.push(d.slice(f,p)),f=p+a;continue}if(b==="/"){w=p;continue}}b==="["?l++:b==="]"&&l--}const y=c.length===0?d:d.substring(f),S=y.startsWith(qe),x=S?y.substring(1):y,m=w&&w>f?w-f:void 0;return{modifiers:c,hasImportantModifier:S,baseClassName:x,maybePostfixModifierPosition:m}};return s?d=>s({className:d,parseClassName:i}):i},it=e=>{if(e.length<=1)return e;const r=[];let s=[];return e.forEach(n=>{n[0]==="["?(r.push(...s.sort(),n),s=[]):s.push(n)}),r.push(...s.sort()),r},lt=e=>({cache:ot(e.cacheSize),parseClassName:at(e),...et(e)}),dt=/\s+/,ct=(e,r)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:o}=r,a=[],i=e.trim().split(dt);let d="";for(let c=i.length-1;c>=0;c-=1){const l=i[c],{modifiers:f,hasImportantModifier:w,baseClassName:y,maybePostfixModifierPosition:S}=s(l);let x=!!S,m=n(x?y.substring(0,S):y);if(!m){if(!x){d=l+(d.length>0?" "+d:d);continue}if(m=n(y),!m){d=l+(d.length>0?" "+d:d);continue}x=!1}const p=it(f).join(":"),b=w?p+qe:p,I=b+m;if(a.includes(I))continue;a.push(I);const u=o(m,x);for(let A=0;A<u.length;++A){const D=u[A];a.push(b+D)}d=l+(d.length>0?" "+d:d)}return d};function ut(){let e=0,r,s,n="";for(;e<arguments.length;)(r=arguments[e++])&&(s=Le(r))&&(n&&(n+=" "),n+=s);return n}const Le=e=>{if(typeof e=="string")return e;let r,s="";for(let n=0;n<e.length;n++)e[n]&&(r=Le(e[n]))&&(s&&(s+=" "),s+=r);return s};function mt(e,...r){let s,n,o,a=i;function i(c){const l=r.reduce((f,w)=>w(f),e());return s=lt(l),n=s.cache.get,o=s.cache.set,a=d,d(c)}function d(c){const l=n(c);if(l)return l;const f=ct(c,s);return o(c,f),f}return function(){return a(ut.apply(null,arguments))}}const C=e=>{const r=s=>s[e]||[];return r.isThemeGetter=!0,r},Ee=/^\[(?:([a-z-]+):)?(.+)\]$/i,pt=/^\d+\/\d+$/,ht=new Set(["px","full","screen"]),ft=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,xt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,bt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,B=e=>X(e)||ht.has(e)||pt.test(e),U=e=>Q(e,"length",Tt),X=e=>!!e&&!Number.isNaN(Number(e)),oe=e=>Q(e,"number",X),ee=e=>!!e&&Number.isInteger(Number(e)),vt=e=>e.endsWith("%")&&X(e.slice(0,-1)),g=e=>Ee.test(e),W=e=>ft.test(e),jt=new Set(["length","size","percentage"]),wt=e=>Q(e,jt,Me),Nt=e=>Q(e,"position",Me),Ct=new Set(["image","url"]),kt=e=>Q(e,Ct,Pt),St=e=>Q(e,"",It),te=()=>!0,Q=(e,r,s)=>{const n=Ee.exec(e);return n?n[1]?typeof r=="string"?n[1]===r:r.has(n[1]):s(n[2]):!1},Tt=e=>gt.test(e)&&!xt.test(e),Me=()=>!1,It=e=>bt.test(e),Pt=e=>yt.test(e),zt=()=>{const e=C("colors"),r=C("spacing"),s=C("blur"),n=C("brightness"),o=C("borderColor"),a=C("borderRadius"),i=C("borderSpacing"),d=C("borderWidth"),c=C("contrast"),l=C("grayscale"),f=C("hueRotate"),w=C("invert"),y=C("gap"),S=C("gradientColorStops"),x=C("gradientColorStopPositions"),m=C("inset"),p=C("margin"),b=C("opacity"),I=C("padding"),u=C("saturate"),A=C("scale"),D=C("sepia"),$=C("skew"),O=C("space"),F=C("translate"),M=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto",g,r],j=()=>[g,r],h=()=>["",B,U],E=()=>["auto",X,g],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",g],je=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>[X,g];return{cacheSize:500,separator:":",theme:{colors:[te],spacing:[B,U],blur:["none","",W,g],brightness:G(),borderColor:[e],borderRadius:["none","","full",W,g],borderSpacing:j(),borderWidth:h(),contrast:G(),grayscale:Y(),hueRotate:G(),invert:Y(),gap:j(),gradientColorStops:[e],gradientColorStopPositions:[vt,U],inset:_(),margin:_(),opacity:G(),padding:j(),saturate:G(),scale:G(),sepia:Y(),skew:G(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",g]}],container:["container"],columns:[{columns:[W]}],"break-after":[{"break-after":je()}],"break-before":[{"break-before":je()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),g]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ee,g]}],basis:[{basis:_()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",g]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",ee,g]}],"grid-cols":[{"grid-cols":[te]}],"col-start-end":[{col:["auto",{span:["full",ee,g]},g]}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":[te]}],"row-start-end":[{row:["auto",{span:[ee,g]},g]}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",g]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",g]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...ne()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ne(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ne(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[I]}],px:[{px:[I]}],py:[{py:[I]}],ps:[{ps:[I]}],pe:[{pe:[I]}],pt:[{pt:[I]}],pr:[{pr:[I]}],pb:[{pb:[I]}],pl:[{pl:[I]}],m:[{m:[p]}],mx:[{mx:[p]}],my:[{my:[p]}],ms:[{ms:[p]}],me:[{me:[p]}],mt:[{mt:[p]}],mr:[{mr:[p]}],mb:[{mb:[p]}],ml:[{ml:[p]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",g,r]}],"min-w":[{"min-w":[g,r,"min","max","fit"]}],"max-w":[{"max-w":[g,r,"none","full","min","max","fit","prose",{screen:[W]},W]}],h:[{h:[g,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[g,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[g,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[g,r,"auto","min","max","fit"]}],"font-size":[{text:["base",W,U]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",oe]}],"font-family":[{font:[te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",g]}],"line-clamp":[{"line-clamp":["none",X,oe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",B,g]}],"list-image":[{"list-image":["none",g]}],"list-style-type":[{list:["none","disc","decimal",g]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",B,U]}],"underline-offset":[{"underline-offset":["auto",B,g]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",g]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",g]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),Nt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",wt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kt]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[S]}],"gradient-via":[{via:[S]}],"gradient-to":[{to:[S]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-s":[{"border-s":[d]}],"border-w-e":[{"border-e":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:K()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[B,g]}],"outline-w":[{outline:[B,U]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:h()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[B,U]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",W,St]}],"shadow-color":[{shadow:[te]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...ve(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ve()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",W,g]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[w]}],saturate:[{saturate:[u]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[u]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",g]}],duration:[{duration:G()}],ease:[{ease:["linear","in","out","in-out",g]}],delay:[{delay:G()}],animate:[{animate:["none","spin","ping","pulse","bounce",g]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[A]}],"scale-x":[{"scale-x":[A]}],"scale-y":[{"scale-y":[A]}],rotate:[{rotate:[ee,g]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",g]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",g]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",g]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[B,U,oe]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},At=mt(zt);function N(...e){return At(ze(e))}const Rt=Ae("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover-elevate active-elevate-2",{variants:{variant:{default:"bg-primary text-primary-foreground border border-primary-border",destructive:"bg-destructive text-destructive-foreground border border-destructive-border",outline:" border [border-color:var(--button-outline)] shadow-xs active:shadow-none ",secondary:"border bg-secondary text-secondary-foreground border border-secondary-border ",ghost:"border border-transparent"},size:{default:"min-h-9 px-4 py-2",sm:"min-h-8 rounded-md px-3 text-xs",lg:"min-h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),q=T.forwardRef(({className:e,variant:r,size:s,asChild:n=!1,...o},a)=>{const i=n?Ke.Slot:"button";return t.jsx(i,{className:N(Rt({variant:r,size:s,className:e})),ref:a,...o})});q.displayName="Button";const L=T.forwardRef(({className:e,type:r,...s},n)=>t.jsx("input",{type:r,className:N("flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...s}));L.displayName="Input";const qt=se.Provider,Lt=se.Root,Et=se.Trigger,Oe=T.forwardRef(({className:e,sideOffset:r=4,...s},n)=>t.jsx(se.Content,{ref:n,sideOffset:r,className:N("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...s}));Oe.displayName=se.Content.displayName;const Mt=V.Root,Ot=V.Portal,Fe=T.forwardRef(({className:e,...r},s)=>t.jsx(V.Overlay,{ref:s,className:N("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));Fe.displayName=V.Overlay.displayName;const De=T.forwardRef(({className:e,children:r,...s},n)=>t.jsxs(Ot,{children:[t.jsx(Fe,{}),t.jsxs(V.Content,{ref:n,className:N("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...s,children:[r,t.jsxs(V.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(v.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));De.displayName=V.Content.displayName;const Ve=({className:e,...r})=>t.jsx("div",{className:N("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});Ve.displayName="DialogHeader";const _e=({className:e,...r})=>t.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});_e.displayName="DialogFooter";const Ge=T.forwardRef(({className:e,...r},s)=>t.jsx(V.Title,{ref:s,className:N("text-lg font-semibold leading-none tracking-tight",e),...r}));Ge.displayName=V.Title.displayName;const Ft=T.forwardRef(({className:e,...r},s)=>t.jsx(V.Description,{ref:s,className:N("text-sm text-muted-foreground",e),...r}));Ft.displayName=V.Description.displayName;const Dt=Ae("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),P=T.forwardRef(({className:e,...r},s)=>t.jsx(Ie.Root,{ref:s,className:N(Dt(),e),...r}));P.displayName=Ie.Root.displayName;const Se=z.Root,Te=z.Value,le=T.forwardRef(({className:e,children:r,...s},n)=>t.jsxs(z.Trigger,{ref:n,className:N("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...s,children:[r,t.jsx(z.Icon,{asChild:!0,children:t.jsx(v.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));le.displayName=z.Trigger.displayName;const Be=T.forwardRef(({className:e,...r},s)=>t.jsx(z.ScrollUpButton,{ref:s,className:N("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(v.ChevronUp,{className:"h-4 w-4"})}));Be.displayName=z.ScrollUpButton.displayName;const $e=T.forwardRef(({className:e,...r},s)=>t.jsx(z.ScrollDownButton,{ref:s,className:N("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(v.ChevronDown,{className:"h-4 w-4"})}));$e.displayName=z.ScrollDownButton.displayName;const de=T.forwardRef(({className:e,children:r,position:s="popper",...n},o)=>t.jsx(z.Portal,{children:t.jsxs(z.Content,{ref:o,className:N("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...n,children:[t.jsx(Be,{}),t.jsx(z.Viewport,{className:N("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),t.jsx($e,{})]})}));de.displayName=z.Content.displayName;const Vt=T.forwardRef(({className:e,...r},s)=>t.jsx(z.Label,{ref:s,className:N("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...r}));Vt.displayName=z.Label.displayName;const R=T.forwardRef(({className:e,children:r,...s},n)=>t.jsxs(z.Item,{ref:n,className:N("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(z.ItemIndicator,{children:t.jsx(v.Check,{className:"h-4 w-4"})})}),t.jsx(z.ItemText,{children:r})]}));R.displayName=z.Item.displayName;const _t=T.forwardRef(({className:e,...r},s)=>t.jsx(z.Separator,{ref:s,className:N("-mx-1 my-1 h-px bg-muted",e),...r}));_t.displayName=z.Separator.displayName;const ce=T.forwardRef(({className:e,...r},s)=>t.jsx(ae.Root,{ref:s,className:N("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...r,children:t.jsx(ae.Indicator,{className:N("flex items-center justify-center text-current"),children:t.jsx(v.Check,{className:"h-4 w-4"})})}));ce.displayName=ae.Root.displayName;const xe=T.forwardRef(({className:e,...r},s)=>t.jsx("textarea",{className:N("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...r}));xe.displayName="Textarea";const Gt=e=>e.trim().toLowerCase().replace(/[^\w\s]/g,"").replace(/\s+/g,"_"),Bt=(e,r,s=!1)=>{const n=(c,l)=>{r({...e,[c]:l})};return{handleTitleChange:c=>{n("title",c)},handleTitleBlur:()=>{if(s&&e.title){const c=Gt(e.title);n("key",c)}},handleKeyChange:c=>{s&&n("key",c)},handleFieldChange:n,handleConstraintChange:(c,l)=>{r({...e,[c]:l})}}},ue={string:"String",number:"Number",integer:"Integer",boolean:"Boolean",object:"Object",array:"Array",null:"Null",file:"File"},Je=k.createContext({getTypeLabel:e=>ue[e],typeLabels:ue});function $t({children:e,customLabels:r={}}){const s={...ue,...r},n=o=>s[o]||o;return t.jsx(Je.Provider,{value:{getTypeLabel:n,typeLabels:s},children:e})}function Ue(){return k.useContext(Je)}function me({property:e,open:r,onOpenChange:s,onUpdate:n,isArrayItem:o=!1,isNewProperty:a=!1,propertyLabel:i={singular:"Property",plural:"Properties"},showRegex:d=!1}){var I;const{typeLabels:c}=Ue(),[l,f]=k.useState(e);k.useEffect(()=>{r&&f(e)},[e,r]);const{handleTitleChange:w,handleTitleBlur:y,handleKeyChange:S,handleFieldChange:x,handleConstraintChange:m}=Bt(l,f,a),p=()=>{var u;(u=l.title)!=null&&u.trim()&&(n(l),s(!1))},b=()=>{f(e),s(!1)};return t.jsx(Mt,{open:r,onOpenChange:s,children:t.jsxs(De,{className:"max-w-2xl max-h-[80vh] flex flex-col gap-0 p-0","data-testid":"dialog-edit-property",children:[t.jsx(Ve,{className:"px-6 pt-6 pb-4 shrink-0",children:t.jsx(Ge,{children:a?`Add ${i.singular}`:`Edit ${i.singular}`})}),t.jsxs("div",{className:"space-y-6 px-6 pb-4 overflow-y-auto flex-1 min-h-0",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(P,{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"Type"]}),t.jsxs(Se,{value:l.type,onValueChange:u=>x("type",u),"data-testid":"select-type-dialog",children:[t.jsx(le,{children:t.jsx(Te,{})}),t.jsxs(de,{children:[t.jsx(R,{value:"string",children:c.string}),t.jsx(R,{value:"number",children:c.number}),t.jsx(R,{value:"integer",children:c.integer}),t.jsx(R,{value:"boolean",children:c.boolean}),t.jsx(R,{value:"object",children:c.object}),t.jsx(R,{value:"array",children:c.array}),t.jsx(R,{value:"file",children:c.file}),t.jsx(R,{value:"null",children:c.null})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(P,{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"Title"]}),t.jsx(L,{value:l.title||"",onChange:u=>w(u.target.value),onBlur:y,placeholder:"Property Title","data-testid":"input-title-dialog",required:!0}),!a&&l.key&&t.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["Key: ",l.key]})]}),a&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{children:"Key"}),t.jsx(L,{value:l.key,onChange:u=>S(u.target.value),placeholder:"property_key","data-testid":"input-key-dialog"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{children:"Description"}),t.jsx(xe,{placeholder:"Optional description",value:l.description||"",onChange:u=>x("description",u.target.value),rows:2,"data-testid":"input-edit-description"})]}),l.type==="array"&&t.jsxs("div",{className:"space-y-2 border-l-2 border-border pl-4 mt-2",children:[t.jsxs(P,{className:"font-semibold text-xs text-muted-foreground",children:[c.array," Items"]}),l.items?t.jsxs("div",{className:"bg-muted/40 p-2 rounded",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{children:"Item Type"}),t.jsxs(Se,{value:l.items.type,onValueChange:u=>f({...l,items:{...l.items,type:u}}),children:[t.jsx(le,{children:t.jsx(Te,{})}),t.jsxs(de,{children:[t.jsx(R,{value:"string",children:c.string}),t.jsx(R,{value:"number",children:c.number}),t.jsx(R,{value:"integer",children:c.integer}),t.jsx(R,{value:"boolean",children:c.boolean}),t.jsx(R,{value:"object",children:c.object}),t.jsx(R,{value:"array",children:c.array}),t.jsx(R,{value:"file",children:c.file}),t.jsx(R,{value:"null",children:c.null})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{children:"Item Title"}),t.jsx(L,{value:l.items.title||"",onChange:u=>f({...l,items:{...l.items,title:u.target.value}}),placeholder:"Item Title"})]}),t.jsxs(q,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>f({...l,items:void 0}),children:["Remove ",c.array," Item Schema"]})]}):t.jsxs(q,{variant:"outline",size:"sm",onClick:()=>{f({...l,items:{id:Date.now().toString()+Math.random(),key:"item",type:"string",required:!1}})},children:["Add ",c.array," Item Schema"]})]}),!o&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ce,{id:"prop-required",checked:l.required,onCheckedChange:u=>x("required",u),"data-testid":"checkbox-edit-required"}),t.jsx(P,{htmlFor:"prop-required",className:"cursor-pointer",children:"Required field"})]}),l.type==="string"&&t.jsxs("details",{className:"border rounded-md",children:[t.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:t.jsxs("h4",{className:"text-sm font-medium inline",children:[c.string," Constraints"]})}),t.jsxs("div",{className:"space-y-4 p-4 pt-0",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"min-length",children:"Minimum Length"}),t.jsx(L,{id:"min-length",type:"number",placeholder:"0",value:l.minLength||"",onChange:u=>m("minLength",u.target.value?parseInt(u.target.value):void 0),"data-testid":"input-edit-minlength"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"max-length",children:"Maximum Length"}),t.jsx(L,{id:"max-length",type:"number",placeholder:"∞",value:l.maxLength||"",onChange:u=>m("maxLength",u.target.value?parseInt(u.target.value):void 0),"data-testid":"input-edit-maxlength"})]})]}),d&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"pattern",children:"Pattern (regex)"}),t.jsx(L,{id:"pattern",placeholder:"^[a-z]+$",value:l.pattern||"",onChange:u=>m("pattern",u.target.value),className:"font-mono text-sm","data-testid":"input-edit-pattern"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{children:"Enum Values"}),t.jsx("div",{className:"space-y-2",children:[...l.enum||[],""].map((u,A)=>{var D;return t.jsx(L,{placeholder:A===(((D=l.enum)==null?void 0:D.length)||0)?"Add new value...":"Enum value",value:u,onChange:$=>{const O=$.target.value,F=l.enum||[];if(A===F.length)O.trim()&&m("enum",[...F,O.trim()]);else if(O.trim()){const M=[...F];M[A]=O.trim(),m("enum",M)}else{const M=F.filter((J,_)=>_!==A);m("enum",M.length>0?M:void 0)}},"data-testid":`input-edit-enum-${A}`},A)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter allowed values (empty fields will be removed)"})]})]})]}),(l.type==="number"||l.type==="integer")&&t.jsxs("details",{className:"border rounded-md",children:[t.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:t.jsx("h4",{className:"text-sm font-medium inline",children:"Numeric Constraints"})}),t.jsx("div",{className:"space-y-4 p-4 pt-0",children:t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"minimum",children:"Minimum Value"}),t.jsx(L,{id:"minimum",type:"number",placeholder:"-∞",value:l.minimum??"",onChange:u=>m("minimum",u.target.value?parseFloat(u.target.value):void 0),"data-testid":"input-edit-minimum"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"maximum",children:"Maximum Value"}),t.jsx(L,{id:"maximum",type:"number",placeholder:"∞",value:l.maximum??"",onChange:u=>m("maximum",u.target.value?parseFloat(u.target.value):void 0),"data-testid":"input-edit-maximum"})]})]})})]}),l.type==="array"&&t.jsxs("details",{className:"border rounded-md",children:[t.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:t.jsxs("h4",{className:"text-sm font-medium inline",children:[c.array," Constraints"]})}),t.jsxs("div",{className:"space-y-4 p-4 pt-0",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"min-items",children:"Minimum Items"}),t.jsx(L,{id:"min-items",type:"number",placeholder:"0",value:l.minItems||"",onChange:u=>m("minItems",u.target.value?parseInt(u.target.value):void 0),"data-testid":"input-edit-minitems"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"max-items",children:"Maximum Items"}),t.jsx(L,{id:"max-items",type:"number",placeholder:"∞",value:l.maxItems||"",onChange:u=>m("maxItems",u.target.value?parseInt(u.target.value):void 0),"data-testid":"input-edit-maxitems"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ce,{id:"unique-items",checked:l.uniqueItems||!1,onCheckedChange:u=>m("uniqueItems",u),"data-testid":"checkbox-edit-unique"}),t.jsx(P,{htmlFor:"unique-items",className:"cursor-pointer",children:"All items must be unique"})]})]})]})]}),t.jsxs(_e,{className:"px-6 py-4 border-t bg-background shrink-0",children:[t.jsx(q,{variant:"outline",onClick:b,"data-testid":"button-cancel",children:"Cancel"}),t.jsx(q,{onClick:p,"data-testid":"button-save",disabled:!((I=l.title)!=null&&I.trim()),children:"Save Changes"})]})]})})}const be=()=>`${Date.now()}-${Math.random()}`;function pe({property:e,onUpdate:r,onDelete:s,level:n=1,isArrayItem:o=!1,showRegex:a=!1}){const{getTypeLabel:i}=Ue(),[d,c]=k.useState(!1),[l,f]=k.useState(null),[w,y]=k.useState(!1),[S,x]=k.useState(!1),[m,p]=k.useState(e.title||"");k.useEffect(()=>{S||p(e.title||"")},[e.title,S]);const b=`h${Math.min(n,6)}`,I=e.type==="object",u=I&&e.children&&e.children.length>0,A={1:"text-lg font-semibold",2:"text-base",3:"text-base",4:"text-base",5:"text-sm",6:"text-sm"}[n]||"text-sm",D=(h,E)=>{const H=e.children.map(K=>K.id===h?E:K);r({...e,children:H})},$=h=>{const E=e.children.filter(H=>H.id!==h);r({...e,children:E})},O=()=>{const h={id:be(),key:"",type:"string",required:!1};f(h),y(!0)},F=h=>{r({...e,children:[...e.children||[],h]}),y(!1),f(null)},M=()=>{y(!1),f(null)},J=()=>{const h=e.title||e.key||"";p(h),x(!0)},_=()=>{const h=m.trim();if(!h){p(e.title||""),x(!1);return}h!==e.title&&r({...e,title:h}),x(!1)},j=h=>{h.key==="Enter"?_():h.key==="Escape"&&(p(e.title||""),x(!1))};return t.jsxs("div",{className:"group",children:[t.jsxs("div",{className:"flex gap-4 items-center rounded-md -mx-2 px-2 py-1 transition-colors hover:bg-accent/50",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"flex items-start gap-3",children:[!o&&t.jsx("button",{onClick:()=>r({...e,required:!e.required}),className:"shrink-0 transition-all hover:scale-110 mt-0.5",title:e.required?"Required field - click to make optional":"Optional field - click to make required",children:e.required?t.jsx("span",{className:"block w-4 h-4 rounded-full bg-primary"}):t.jsx("span",{className:"block w-4 h-4 rounded-full border border-dashed border-gray-400"})}),S?t.jsx(L,{value:m,onChange:h=>p(h.target.value),onBlur:_,onKeyDown:j,autoFocus:!0,className:A,placeholder:"Enter title"}):t.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(b,{className:`${A} cursor-pointer hover:text-primary transition-colors leading-none`,onClick:J,children:e.title||e.key||t.jsx("span",{className:"text-muted-foreground italic",children:"unnamed"})}),t.jsx(qt,{children:t.jsxs(Lt,{children:[t.jsx(Et,{asChild:!0,children:t.jsxs("span",{children:[e.type==="string"&&t.jsx(v.Type,{className:"w-5 h-5 text-muted-foreground"}),e.type==="number"&&t.jsx(v.Hash,{className:"w-5 h-5 text-muted-foreground"}),e.type==="integer"&&t.jsx(v.Hash,{className:"w-5 h-5 text-muted-foreground"}),e.type==="boolean"&&t.jsx(v.CheckSquare,{className:"w-5 h-5 text-muted-foreground"}),e.type==="object"&&t.jsx(v.Braces,{className:"w-5 h-5 text-muted-foreground"}),e.type==="array"&&t.jsx(v.List,{className:"w-5 h-5 text-muted-foreground"}),e.type==="file"&&t.jsx(v.FileText,{className:"w-5 h-5 text-muted-foreground"})]})}),t.jsxs(Oe,{side:"top",children:[i(e.type),e.type==="array"&&e.items?` of ${i(e.items.type)}`:""]})]})}),e.type==="object"&&t.jsx(q,{variant:"ghost",size:"icon",className:"opacity-0 group-hover:opacity-100 h-6 w-6",onClick:O,"data-testid":`button-add-child-${e.id}`,children:t.jsx(v.Plus,{className:"!w-5 !h-5"})})]}),e.description&&t.jsx("p",{className:"text-sm text-muted-foreground flex-1 min-w-[200px]","data-testid":`text-description-${e.id}`,children:e.description})]})]})}),t.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[t.jsx(q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>c(!0),"data-testid":`button-edit-${e.id}`,children:t.jsx(v.Pencil,{className:"w-3 h-3"})}),I&&e.type!=="object"&&t.jsx(q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:O,"data-testid":`button-add-child-${e.id}`,children:t.jsx(v.Plus,{className:"w-3 h-3"})}),t.jsx(q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:s,"data-testid":`button-delete-${e.id}`,children:t.jsx(v.Trash2,{className:"w-3 h-3"})})]})]}),u&&t.jsx("div",{className:n===1?"ml-6 mt-1 border-l-2 border-border pl-6":"ml-4 mt-1 border-l border-border pl-4",children:e.children.map(h=>t.jsx(pe,{property:h,onUpdate:E=>D(h.id,E),onDelete:()=>$(h.id),level:n+1,showRegex:a},h.id))}),e.type==="array"&&e.items&&t.jsxs("div",{className:n===1?"ml-6 mt-1 border-l-2 border-border pl-6":"ml-4 mt-1 border-l border-border pl-4",children:[t.jsxs("div",{className:"mb-2 text-xs text-muted-foreground font-semibold uppercase",children:[i("array")," Items"]}),t.jsx(pe,{property:e.items,onUpdate:h=>r({...e,items:h}),onDelete:()=>r({...e,items:void 0}),level:n+1,isArrayItem:!0,showRegex:a})]}),t.jsx(me,{property:e,open:d,onOpenChange:c,onUpdate:r,isArrayItem:o,isNewProperty:!1,showRegex:a}),w&&l&&t.jsx(me,{property:l,open:w,isNewProperty:!0,onOpenChange:h=>{h||M()},onUpdate:F,showRegex:a})]})}const ye=T.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("shadcn-card rounded-xl border bg-card border-card-border text-card-foreground shadow-sm",e),...r}));ye.displayName="Card";const Jt=T.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("flex flex-col space-y-1.5 p-6",e),...r}));Jt.displayName="CardHeader";const Ut=T.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("text-2xl font-semibold leading-none tracking-tight",e),...r}));Ut.displayName="CardTitle";const Wt=T.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("text-sm text-muted-foreground",e),...r}));Wt.displayName="CardDescription";const Kt=T.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("p-6 pt-0",e),...r}));Kt.displayName="CardContent";const Ht=T.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("flex items-center p-6 pt-0",e),...r}));Ht.displayName="CardFooter";const Xt=()=>new Promise((e,r)=>{const s=document.createElement("input");s.type="file",s.accept=".json",s.onchange=n=>{var i;const o=(i=n.target.files)==null?void 0:i[0];if(!o){r(new Error("No file selected"));return}const a=new FileReader;a.onload=d=>{var c;try{const l=JSON.parse((c=d.target)==null?void 0:c.result);e(l)}catch{r(new Error("Invalid JSON file"))}},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(o)},s.click()}),We=(e,r="schema.json")=>{const s=JSON.stringify(e,null,2),n=new Blob([s],{type:"application/json"}),o=URL.createObjectURL(n),a=document.createElement("a");a.href=o,a.download=r,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)};function Zt({schema:e}){const[r,s]=k.useState(!1),n=JSON.stringify(e,null,2),o=async()=>{await navigator.clipboard.writeText(n),s(!0),setTimeout(()=>s(!1),2e3)},a=()=>{We(e,"schema.json")};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsx("h2",{className:"text-sm font-medium",children:"JSON Schema Output"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q,{variant:"outline",size:"sm",onClick:o,"data-testid":"button-copy",children:r?t.jsx(v.CheckCircle2,{className:"w-4 h-4"}):t.jsx(v.Copy,{className:"w-4 h-4"})}),t.jsx(q,{variant:"outline",size:"sm",onClick:a,"data-testid":"button-download",children:t.jsx(v.Download,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(ye,{className:"m-4 bg-muted/30",children:t.jsx("pre",{className:"p-6 text-xs font-mono overflow-auto","data-testid":"text-json-output",children:t.jsx("code",{children:n})})})})]})}function Qt({title:e,description:r,version:s,onUpdate:n}){const[o,a]=k.useState(!1);return t.jsxs(ye,{className:"p-4",children:[t.jsxs(q,{variant:"ghost",onClick:()=>a(!o),className:"w-full justify-between px-2 h-auto hover:bg-transparent","data-testid":"button-toggle-metadata",children:[t.jsx("h3",{className:"text-sm font-medium",children:"Schema Metadata"}),o?t.jsx(v.ChevronDown,{className:"w-4 h-4"}):t.jsx(v.ChevronRight,{className:"w-4 h-4"})]}),o&&t.jsxs("div",{className:"mt-4 space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"schema-title",className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(L,{id:"schema-title",placeholder:"My Schema",value:e,onChange:i=>n("title",i.target.value),"data-testid":"input-title"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"schema-description",className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(xe,{id:"schema-description",placeholder:"Describe your schema...",value:r,onChange:i=>n("description",i.target.value),className:"resize-none",rows:3,"data-testid":"input-schema-description"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(P,{htmlFor:"schema-version",className:"text-xs text-muted-foreground",children:"Version"}),t.jsx(L,{id:"schema-version",placeholder:"1.0.0",value:s,onChange:i=>n("version",i.target.value),"data-testid":"input-version"})]})]})]})}const re=(e,r,s=!0)=>{const n={type:"object"};s&&r&&(r.title&&(n.title=r.title),r.description&&(n.description=r.description));const o=he(e);Object.keys(o).length>0&&(n.properties=o);const a=e.filter(i=>i.required&&i.key).map(i=>i.key);return a.length>0&&(n.required=a),n},he=e=>{const r={};return e.forEach(s=>{if(!s.key)return;const o={type:s.type==="file"?"string":s.type};if(s.title&&(o.title=s.title),s.description&&(o.description=s.description),s.type==="file"&&(o.format="filename"),s.type==="string"&&(s.minLength!==void 0&&(o.minLength=s.minLength),s.maxLength!==void 0&&(o.maxLength=s.maxLength),s.pattern&&(o.pattern=s.pattern),s.enum&&s.enum.length>0&&(o.enum=s.enum)),(s.type==="number"||s.type==="integer")&&(s.minimum!==void 0&&(o.minimum=s.minimum),s.maximum!==void 0&&(o.maximum=s.maximum)),s.type==="array"&&(s.minItems!==void 0&&(o.minItems=s.minItems),s.maxItems!==void 0&&(o.maxItems=s.maxItems),s.uniqueItems&&(o.uniqueItems=s.uniqueItems),s.items&&(o.items=he([s.items])[s.items.key]||{type:s.items.type})),s.type==="object"&&s.children&&s.children.length>0){o.properties=he(s.children);const a=s.children.filter(i=>i.required&&i.key).map(i=>i.key);a.length>0&&(o.required=a)}r[s.key]=o}),r},Yt=e=>{const r={properties:[]};return(e.title||e.description)&&(r.metadata={title:typeof e.title=="string"?e.title:"",description:typeof e.description=="string"?e.description:"",version:"1.0.0"}),e.properties&&typeof e.properties=="object"&&(r.properties=fe(e.properties,Array.isArray(e.required)?e.required:[])),r},fe=(e,r=[])=>e?Object.entries(e).filter(([,s])=>typeof s=="object").map(([s,n])=>{const o=n;let a=typeof o.type=="string"?o.type:"string";a==="string"&&o.format==="filename"&&(a="file");const i={id:be(),key:s,title:typeof o.title=="string"?o.title:void 0,type:a,description:typeof o.description=="string"?o.description:void 0,required:r.includes(s)};return o.minLength!==void 0&&(i.minLength=o.minLength),o.maxLength!==void 0&&(i.maxLength=o.maxLength),o.pattern&&(i.pattern=o.pattern),o.enum&&Array.isArray(o.enum)&&(i.enum=o.enum),o.minimum!==void 0&&(i.minimum=o.minimum),o.maximum!==void 0&&(i.maximum=o.maximum),o.minItems!==void 0&&(i.minItems=o.minItems),o.maxItems!==void 0&&(i.maxItems=o.maxItems),o.uniqueItems&&(i.uniqueItems=o.uniqueItems),i.type==="array"&&o.items&&typeof o.items=="object"&&!Array.isArray(o.items)&&(i.items=fe({item:o.items},[]).find(d=>d.key==="item")),o.properties&&typeof o.properties=="object"&&(i.children=fe(o.properties,Array.isArray(o.required)?o.required:[])),i}):[],es=({schema:e,onChange:r,includeMetadata:s=!0})=>{const{properties:n,metadata:o}=k.useMemo(()=>Yt(e),[e]),a=n,i=o||{title:"",description:"",version:""},d=k.useCallback(()=>({id:be(),key:"",type:"string",required:!1}),[]),c=k.useCallback((x,m)=>{const p=a.some(u=>u.id===x);let b;p?b=a.map(u=>u.id===x?m:u):b=[...a,m];const I=re(b,i,s);r(I)},[a,i,s,r]),l=k.useCallback(x=>{const m=a.filter(b=>b.id!==x),p=re(m,i,s);r(p)},[a,i,s,r]),f=k.useCallback(()=>{const m=re([],{title:"",description:""},s);r(m)},[s,r]),w=k.useCallback((x,m)=>{const p={...i,[x]:m},b=re(a,p,s);r(b)},[a,i,s,r]),y=k.useCallback(async()=>{const x=await Xt();r(x)},[r]),S=k.useCallback(()=>{We(e,"schema.json")},[e]);return{properties:a,metadata:i,addProperty:d,updateProperty:c,deleteProperty:l,clearAll:f,updateMetadata:w,importSchema:y,downloadSchema:S}};function ts(){const[e,r]=k.useState("light");k.useEffect(()=>{const o=localStorage.getItem("theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");r(o),document.documentElement.classList.toggle("dark",o==="dark")},[]);const s=()=>{const n=e==="light"?"dark":"light";r(n),localStorage.setItem("theme",n),document.documentElement.classList.toggle("dark",n==="dark")};return t.jsx(q,{variant:"ghost",size:"icon",onClick:s,"data-testid":"button-theme-toggle",children:e==="light"?t.jsx(v.Moon,{className:"w-4 h-4"}):t.jsx(v.Sun,{className:"w-4 h-4"})})}function ss({schema:e,onChange:r,showMetadata:s=!1,showImport:n=!0,showClear:o=!0,showOutput:a=!0,showHeader:i=!0,className:d="",showSummary:c=!1,typeLabels:l,propertyLabel:f={singular:"property",plural:"properties"},showRegex:w=!1}){const[y,S]=k.useState(null),[x,m]=k.useState(!1),{properties:p,metadata:b,addProperty:I,updateProperty:u,deleteProperty:A,clearAll:D,updateMetadata:$,importSchema:O}=es({schema:e,onChange:r,includeMetadata:s}),F=()=>{const h=I();S(h),m(!0)},M=h=>{u(h.id,h),m(!1),S(null)},J=()=>{m(!1),S(null)},_=()=>{D()},j=async()=>{await O()};return t.jsx($t,{customLabels:l,children:t.jsxs("div",{className:`${d} flex flex-col json-schema-builder-react`,children:[i&&t.jsx("header",{className:"h-16 border-b flex items-center justify-between px-6",children:t.jsxs("div",{className:"flex items-center gap-3",children:[n&&t.jsx(q,{variant:"outline",size:"sm",onClick:j,"data-testid":"button-import",children:t.jsx(v.Upload,{className:"w-4 h-4"})}),o&&t.jsx(q,{variant:"outline",size:"sm",onClick:_,disabled:p.length===0,"data-testid":"button-clear",children:t.jsx(v.Trash2,{className:"w-4 h-4"})}),t.jsx(ts,{})]})}),t.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[t.jsx("div",{className:a?"w-3/5 border-r":"w-full",children:t.jsxs("div",{className:"h-full overflow-auto p-2 space-y-4",children:[s&&t.jsx(Qt,{title:b.title,description:b.description,version:b.version,onUpdate:(h,E)=>$(h,E)}),p.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4",children:t.jsx(v.Plus,{className:"w-8 h-8 text-muted-foreground"})}),t.jsxs("h2",{className:"text-lg font-medium mb-2",children:["No ",f.plural," yet"]}),t.jsxs("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm",children:["Start building your JSON schema by adding your first"," ",f.singular]}),t.jsxs(q,{onClick:F,"data-testid":"button-add-first",children:[t.jsx(v.Plus,{className:"w-4 h-4 mr-2"}),"Add ",f.singular]})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"space-y-1",children:p.map(h=>t.jsx(pe,{property:h,onUpdate:E=>u(h.id,E),onDelete:()=>A(h.id),showRegex:w},h.id))}),t.jsx("div",{className:"pt-6",children:t.jsxs(q,{onClick:F,className:"w-full",variant:"outline","data-testid":"button-add-property",children:[t.jsx(v.Plus,{className:"w-4 h-4 mr-2"}),"Add ",f.singular]})}),c&&t.jsxs("div",{className:"pt-4 border-t flex items-center justify-between text-sm text-muted-foreground",children:[t.jsxs("span",{children:[p.length," ",p.length===1?f.singular:f.plural]}),t.jsxs("span",{children:[p.filter(h=>h.required).length," required"]})]})]})]})}),a&&t.jsx("div",{className:"w-2/5",children:t.jsx(Zt,{schema:e})})]}),x&&y&&t.jsx(me,{property:y,open:x,isNewProperty:!0,onOpenChange:h=>{h||J()},propertyLabel:f,onUpdate:M,showRegex:w})]})})}exports.JsonSchemaBuilder=ss;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),S=require("react"),Xe=require("@radix-ui/react-slot"),w=require("lucide-react"),Ze=require("@radix-ui/react-tooltip"),Qe=require("@radix-ui/react-select"),Ye=require("@radix-ui/react-dialog"),et=require("@radix-ui/react-label"),tt=require("@radix-ui/react-checkbox");function U(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,a.get?a:{enumerable:!0,get:()=>e[s]})}}return r.default=e,Object.freeze(r)}const I=U(S),J=U(Ze),P=U(Qe),E=U(Ye),ze=U(et),oe=U(tt);function Re(e){var r,s,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(r=0;r<n;r++)e[r]&&(s=Re(e[r]))&&(a&&(a+=" "),a+=s)}else for(s in e)e[s]&&(a&&(a+=" "),a+=s);return a}function Ae(){for(var e,r,s=0,a="",n=arguments.length;s<n;s++)(e=arguments[s])&&(r=Re(e))&&(a&&(a+=" "),a+=r);return a}const ke=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Se=Ae,qe=(e,r)=>s=>{var a;if((r==null?void 0:r.variants)==null)return Se(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:n,defaultVariants:o}=r,i=Object.keys(n).map(c=>{const d=s==null?void 0:s[c],h=o==null?void 0:o[c];if(d===null)return null;const f=ke(d)||ke(h);return n[c][f]}),l=s&&Object.entries(s).reduce((c,d)=>{let[h,f]=d;return f===void 0||(c[h]=f),c},{}),p=r==null||(a=r.compoundVariants)===null||a===void 0?void 0:a.reduce((c,d)=>{let{class:h,className:f,...v}=d;return Object.entries(v).every(b=>{let[y,m]=b;return Array.isArray(m)?m.includes({...o,...l}[y]):{...o,...l}[y]===m})?[...c,h,f]:c},[]);return Se(e,i,p,s==null?void 0:s.class,s==null?void 0:s.className)},ge="-",st=e=>{const r=nt(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const l=i.split(ge);return l[0]===""&&l.length!==1&&l.shift(),Oe(l,r)||rt(i)},getConflictingClassGroupIds:(i,l)=>{const p=s[i]||[];return l&&a[i]?[...p,...a[i]]:p}}},Oe=(e,r)=>{var i;if(e.length===0)return r.classGroupId;const s=e[0],a=r.nextPart.get(s),n=a?Oe(e.slice(1),a):void 0;if(n)return n;if(r.validators.length===0)return;const o=e.join(ge);return(i=r.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},Ie=/^\[(.+)\]$/,rt=e=>{if(Ie.test(e)){const r=Ie.exec(e)[1],s=r==null?void 0:r.substring(0,r.indexOf(":"));if(s)return"arbitrary.."+s}},nt=e=>{const{theme:r,prefix:s}=e,a={nextPart:new Map,validators:[]};return ot(Object.entries(e.classGroups),s).forEach(([o,i])=>{ie(i,a,o,r)}),a},ie=(e,r,s,a)=>{e.forEach(n=>{if(typeof n=="string"){const o=n===""?r:Te(r,n);o.classGroupId=s;return}if(typeof n=="function"){if(at(n)){ie(n(a),r,s,a);return}r.validators.push({validator:n,classGroupId:s});return}Object.entries(n).forEach(([o,i])=>{ie(i,Te(r,o),s,a)})})},Te=(e,r)=>{let s=e;return r.split(ge).forEach(a=>{s.nextPart.has(a)||s.nextPart.set(a,{nextPart:new Map,validators:[]}),s=s.nextPart.get(a)}),s},at=e=>e.isThemeGetter,ot=(e,r)=>r?e.map(([s,a])=>{const n=a.map(o=>typeof o=="string"?r+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,l])=>[r+i,l])):o);return[s,n]}):e,it=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,s=new Map,a=new Map;const n=(o,i)=>{s.set(o,i),r++,r>e&&(r=0,a=s,s=new Map)};return{get(o){let i=s.get(o);if(i!==void 0)return i;if((i=a.get(o))!==void 0)return n(o,i),i},set(o,i){s.has(o)?s.set(o,i):n(o,i)}}},Le="!",lt=e=>{const{separator:r,experimentalParseClassName:s}=e,a=r.length===1,n=r[0],o=r.length,i=l=>{const p=[];let c=0,d=0,h;for(let m=0;m<l.length;m++){let j=l[m];if(c===0){if(j===n&&(a||l.slice(m,m+o)===r)){p.push(l.slice(d,m)),d=m+o;continue}if(j==="/"){h=m;continue}}j==="["?c++:j==="]"&&c--}const f=p.length===0?l:l.substring(d),v=f.startsWith(Le),b=v?f.substring(1):f,y=h&&h>d?h-d:void 0;return{modifiers:p,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:y}};return s?l=>s({className:l,parseClassName:i}):i},dt=e=>{if(e.length<=1)return e;const r=[];let s=[];return e.forEach(a=>{a[0]==="["?(r.push(...s.sort(),a),s=[]):s.push(a)}),r.push(...s.sort()),r},ct=e=>({cache:it(e.cacheSize),parseClassName:lt(e),...st(e)}),ut=/\s+/,mt=(e,r)=>{const{parseClassName:s,getClassGroupId:a,getConflictingClassGroupIds:n}=r,o=[],i=e.trim().split(ut);let l="";for(let p=i.length-1;p>=0;p-=1){const c=i[p],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:v}=s(c);let b=!!v,y=a(b?f.substring(0,v):f);if(!y){if(!b){l=c+(l.length>0?" "+l:l);continue}if(y=a(f),!y){l=c+(l.length>0?" "+l:l);continue}b=!1}const m=dt(d).join(":"),j=h?m+Le:m,g=j+y;if(o.includes(g))continue;o.push(g);const q=n(y,b);for(let u=0;u<q.length;++u){const z=q[u];o.push(j+z)}l=c+(l.length>0?" "+l:l)}return l};function pt(){let e=0,r,s,a="";for(;e<arguments.length;)(r=arguments[e++])&&(s=De(r))&&(a&&(a+=" "),a+=s);return a}const De=e=>{if(typeof e=="string")return e;let r,s="";for(let a=0;a<e.length;a++)e[a]&&(r=De(e[a]))&&(s&&(s+=" "),s+=r);return s};function ht(e,...r){let s,a,n,o=i;function i(p){const c=r.reduce((d,h)=>h(d),e());return s=ct(c),a=s.cache.get,n=s.cache.set,o=l,l(p)}function l(p){const c=a(p);if(c)return c;const d=mt(p,s);return n(p,d),d}return function(){return o(pt.apply(null,arguments))}}const k=e=>{const r=s=>s[e]||[];return r.isThemeGetter=!0,r},Ee=/^\[(?:([a-z-]+):)?(.+)\]$/i,ft=/^\d+\/\d+$/,gt=new Set(["px","full","screen"]),xt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,vt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,B=e=>K(e)||gt.has(e)||ft.test(e),_=e=>W(e,"length",Pt),K=e=>!!e&&!Number.isNaN(Number(e)),ae=e=>W(e,"number",K),X=e=>!!e&&Number.isInteger(Number(e)),wt=e=>e.endsWith("%")&&K(e.slice(0,-1)),x=e=>Ee.test(e),G=e=>xt.test(e),Nt=new Set(["length","size","percentage"]),Ct=e=>W(e,Nt,Me),kt=e=>W(e,"position",Me),St=new Set(["image","url"]),It=e=>W(e,St,Rt),Tt=e=>W(e,"",zt),Z=()=>!0,W=(e,r,s)=>{const a=Ee.exec(e);return a?a[1]?typeof r=="string"?a[1]===r:r.has(a[1]):s(a[2]):!1},Pt=e=>bt.test(e)&&!yt.test(e),Me=()=>!1,zt=e=>vt.test(e),Rt=e=>jt.test(e),At=()=>{const e=k("colors"),r=k("spacing"),s=k("blur"),a=k("brightness"),n=k("borderColor"),o=k("borderRadius"),i=k("borderSpacing"),l=k("borderWidth"),p=k("contrast"),c=k("grayscale"),d=k("hueRotate"),h=k("invert"),f=k("gap"),v=k("gradientColorStops"),b=k("gradientColorStopPositions"),y=k("inset"),m=k("margin"),j=k("opacity"),g=k("padding"),q=k("saturate"),u=k("scale"),z=k("sepia"),V=k("skew"),$=k("space"),R=k("translate"),D=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],Q=()=>["auto",x,r],C=()=>[x,r],je=()=>["",B,_],Y=()=>["auto",K,x],we=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ee=()=>["solid","dashed","dotted","double","none"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",x],Ce=()=>["auto","avoid","all","avoid-page","page","left","right","column"],F=()=>[K,x];return{cacheSize:500,separator:":",theme:{colors:[Z],spacing:[B,_],blur:["none","",G,x],brightness:F(),borderColor:[e],borderRadius:["none","","full",G,x],borderSpacing:C(),borderWidth:je(),contrast:F(),grayscale:H(),hueRotate:F(),invert:H(),gap:C(),gradientColorStops:[e],gradientColorStopPositions:[wt,_],inset:Q(),margin:Q(),opacity:F(),padding:C(),saturate:F(),scale:F(),sepia:H(),skew:F(),space:C(),translate:C()},classGroups:{aspect:[{aspect:["auto","square","video",x]}],container:["container"],columns:[{columns:[G]}],"break-after":[{"break-after":Ce()}],"break-before":[{"break-before":Ce()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...we(),x]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",X,x]}],basis:[{basis:Q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",x]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",X,x]}],"grid-cols":[{"grid-cols":[Z]}],"col-start-end":[{col:["auto",{span:["full",X,x]},x]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[Z]}],"row-start-end":[{row:["auto",{span:[X,x]},x]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",x]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",x]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ne()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ne(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ne(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",x,r]}],"min-w":[{"min-w":[x,r,"min","max","fit"]}],"max-w":[{"max-w":[x,r,"none","full","min","max","fit","prose",{screen:[G]},G]}],h:[{h:[x,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[x,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[x,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[x,r,"auto","min","max","fit"]}],"font-size":[{text:["base",G,_]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ae]}],"font-family":[{font:[Z]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",x]}],"line-clamp":[{"line-clamp":["none",K,ae]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",B,x]}],"list-image":[{"list-image":["none",x]}],"list-style-type":[{list:["none","disc","decimal",x]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",B,_]}],"underline-offset":[{"underline-offset":["auto",B,x]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",x]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",x]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...we(),kt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Ct]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},It]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[j]}],"border-style":[{border:[...ee(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[j]}],"divide-style":[{divide:ee()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...ee()]}],"outline-offset":[{"outline-offset":[B,x]}],"outline-w":[{outline:[B,_]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:je()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[B,_]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",G,Tt]}],"shadow-color":[{shadow:[Z]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ne()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[a]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",G,x]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[q]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[a]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",x]}],duration:[{duration:F()}],ease:[{ease:["linear","in","out","in-out",x]}],delay:[{delay:F()}],animate:[{animate:["none","spin","ping","pulse","bounce",x]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[u]}],"scale-x":[{"scale-x":[u]}],"scale-y":[{"scale-y":[u]}],rotate:[{rotate:[X,x]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[V]}],"skew-y":[{"skew-y":[V]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",x]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",x]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",x]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[B,_,ae]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},qt=ht(At);function N(...e){return qt(Ae(e))}const Ot=qe("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-full px-3 text-xs",lg:"h-10 rounded-full px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),O=I.forwardRef(({className:e,variant:r,size:s,asChild:a=!1,...n},o)=>{const i=a?Xe.Slot:"button";return t.jsx(i,{className:N(Ot({variant:r,size:s,className:e})),ref:o,...n})});O.displayName="Button";const L=I.forwardRef(({className:e,type:r,...s},a)=>t.jsx("input",{type:r,className:N("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...s}));L.displayName="Input";const Lt=J.Provider,Dt=J.Root,Et=J.Trigger,Fe=I.forwardRef(({className:e,sideOffset:r=4,...s},a)=>t.jsx(J.Portal,{children:t.jsx(J.Content,{ref:a,sideOffset:r,className:N("z-50 overflow-hidden rounded-md bg-popover px-3 py-1.5 text-xs text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...s})}));Fe.displayName=J.Content.displayName;const le=P.Root,de=P.Value,se=I.forwardRef(({className:e,children:r,...s},a)=>t.jsxs(P.Trigger,{ref:a,className:N("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...s,children:[r,t.jsx(P.Icon,{asChild:!0,children:t.jsx(w.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));se.displayName=P.Trigger.displayName;const Be=I.forwardRef(({className:e,...r},s)=>t.jsx(P.ScrollUpButton,{ref:s,className:N("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(w.ChevronUp,{className:"h-4 w-4"})}));Be.displayName=P.ScrollUpButton.displayName;const _e=I.forwardRef(({className:e,...r},s)=>t.jsx(P.ScrollDownButton,{ref:s,className:N("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(w.ChevronDown,{className:"h-4 w-4"})}));_e.displayName=P.ScrollDownButton.displayName;const re=I.forwardRef(({className:e,children:r,position:s="popper",...a},n)=>t.jsx(P.Portal,{children:t.jsxs(P.Content,{ref:n,className:N("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...a,children:[t.jsx(Be,{}),t.jsx(P.Viewport,{className:N("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),t.jsx(_e,{})]})}));re.displayName=P.Content.displayName;const Mt=I.forwardRef(({className:e,...r},s)=>t.jsx(P.Label,{ref:s,className:N("px-2 py-1.5 text-sm font-semibold",e),...r}));Mt.displayName=P.Label.displayName;const A=I.forwardRef(({className:e,children:r,...s},a)=>t.jsxs(P.Item,{ref:a,className:N("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[t.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(P.ItemIndicator,{children:t.jsx(w.Check,{className:"h-4 w-4"})})}),t.jsx(P.ItemText,{children:r})]}));A.displayName=P.Item.displayName;const Ft=I.forwardRef(({className:e,...r},s)=>t.jsx(P.Separator,{ref:s,className:N("-mx-1 my-1 h-px bg-muted",e),...r}));Ft.displayName=P.Separator.displayName;const Bt=E.Root,_t=E.Portal,Ge=I.forwardRef(({className:e,...r},s)=>t.jsx(E.Overlay,{ref:s,className:N("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));Ge.displayName=E.Overlay.displayName;const Ve=I.forwardRef(({className:e,children:r,...s},a)=>t.jsxs(_t,{children:[t.jsx(Ge,{}),t.jsxs(E.Content,{ref:a,className:N("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...s,children:[r,t.jsxs(E.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(w.X,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ve.displayName=E.Content.displayName;const $e=({className:e,...r})=>t.jsx("div",{className:N("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});$e.displayName="DialogHeader";const Ke=({className:e,...r})=>t.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});Ke.displayName="DialogFooter";const Je=I.forwardRef(({className:e,...r},s)=>t.jsx(E.Title,{ref:s,className:N("text-lg font-semibold leading-none tracking-tight",e),...r}));Je.displayName=E.Title.displayName;const Gt=I.forwardRef(({className:e,...r},s)=>t.jsx(E.Description,{ref:s,className:N("text-sm text-muted-foreground",e),...r}));Gt.displayName=E.Description.displayName;const Vt=qe("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=I.forwardRef(({className:e,...r},s)=>t.jsx(ze.Root,{ref:s,className:N(Vt(),e),...r}));T.displayName=ze.Root.displayName;const ce=I.forwardRef(({className:e,...r},s)=>t.jsx(oe.Root,{ref:s,className:N("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...r,children:t.jsx(oe.Indicator,{className:N("grid place-content-center text-current"),children:t.jsx(w.Check,{className:"h-4 w-4"})})}));ce.displayName=oe.Root.displayName;const xe=I.forwardRef(({className:e,...r},s)=>t.jsx("textarea",{className:N("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...r}));xe.displayName="Textarea";const $t=e=>e.trim().toLowerCase().replace(/[^\w\s]/g,"").replace(/\s+/g,"_"),Kt=(e,r,s=!1,a=!1)=>{const n=(c,d)=>{r({...e,[c]:d})};return{handleTitleChange:c=>{n("title",c)},handleTitleBlur:()=>{if(s&&e.title){const c=$t(e.title);n("key",c)}},handleKeyChange:c=>{(s||a)&&n("key",c)},handleFieldChange:n,handleConstraintChange:(c,d)=>{r({...e,[c]:d})}}},ue={string:"String",number:"Number",integer:"Integer",boolean:"Boolean",object:"Object",array:"Array",null:"Null",file:"File"},Ue=S.createContext({getTypeLabel:e=>ue[e],typeLabels:ue});function Jt({children:e,customLabels:r={}}){const s={...ue,...r},a=n=>s[n]||n;return t.jsx(Ue.Provider,{value:{getTypeLabel:a,typeLabels:s},children:e})}function We(){return S.useContext(Ue)}function me({property:e,open:r,onOpenChange:s,onUpdate:a,isArrayItem:n=!1,isNewProperty:o=!1,propertyLabel:i={singular:"Property",plural:"Properties"},showRegex:l=!1,keyEditable:p=!1}){var q;const{typeLabels:c}=We(),[d,h]=S.useState(e);S.useEffect(()=>{r&&h(e)},[e,r]);const{handleTitleChange:f,handleTitleBlur:v,handleKeyChange:b,handleFieldChange:y,handleConstraintChange:m}=Kt(d,h,o,p),j=()=>{var u;(u=d.title)!=null&&u.trim()&&(a(d),s(!1))},g=()=>{h(e),s(!1)};return t.jsx(Bt,{open:r,onOpenChange:s,children:t.jsxs(Ve,{className:"max-w-2xl max-h-[80vh] flex flex-col gap-0 p-0","data-testid":"dialog-edit-property",children:[t.jsx($e,{className:"px-6 pt-6 pb-4 shrink-0",children:t.jsx(Je,{children:o?`Add ${i.singular}`:`Edit ${i.singular}`})}),t.jsxs("div",{className:"space-y-6 px-6 pb-4 overflow-y-auto flex-1 min-h-0",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(T,{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"Type"]}),t.jsxs(le,{value:d.type,onValueChange:u=>y("type",u),"data-testid":"select-type-dialog",children:[t.jsx(se,{children:t.jsx(de,{})}),t.jsxs(re,{children:[t.jsx(A,{value:"string",children:c.string}),t.jsx(A,{value:"number",children:c.number}),t.jsx(A,{value:"integer",children:c.integer}),t.jsx(A,{value:"boolean",children:c.boolean}),t.jsx(A,{value:"object",children:c.object}),t.jsx(A,{value:"array",children:c.array}),t.jsx(A,{value:"file",children:c.file}),t.jsx(A,{value:"null",children:c.null})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(T,{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"Title"]}),t.jsx(L,{value:d.title||"",onChange:u=>f(u.target.value),onBlur:v,placeholder:"Property Title","data-testid":"input-title-dialog",required:!0}),!o&&d.key&&t.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["Key: ",d.key]})]}),(o||p)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{children:"Key"}),t.jsx(L,{value:d.key,onChange:u=>b(u.target.value),placeholder:"property_key","data-testid":"input-key-dialog"}),!o&&t.jsx("p",{className:"text-xs text-yellow-600 dark:text-yellow-500",children:"⚠️ Changing the key may break existing references to this property"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{children:"Description"}),t.jsx(xe,{placeholder:"Optional description",value:d.description||"",onChange:u=>y("description",u.target.value),rows:2,"data-testid":"input-edit-description"})]}),d.type==="array"&&t.jsxs("div",{className:"space-y-2 border-l-2 border-border pl-4 mt-2",children:[t.jsxs(T,{className:"font-semibold text-xs text-muted-foreground",children:[c.array," Items"]}),d.items?t.jsxs("div",{className:"bg-muted/40 p-2 rounded",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{children:"Item Type"}),t.jsxs(le,{value:d.items.type,onValueChange:u=>h({...d,items:{...d.items,type:u}}),children:[t.jsx(se,{children:t.jsx(de,{})}),t.jsxs(re,{children:[t.jsx(A,{value:"string",children:c.string}),t.jsx(A,{value:"number",children:c.number}),t.jsx(A,{value:"integer",children:c.integer}),t.jsx(A,{value:"boolean",children:c.boolean}),t.jsx(A,{value:"object",children:c.object}),t.jsx(A,{value:"array",children:c.array}),t.jsx(A,{value:"file",children:c.file}),t.jsx(A,{value:"null",children:c.null})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{children:"Item Title"}),t.jsx(L,{value:d.items.title||"",onChange:u=>h({...d,items:{...d.items,title:u.target.value}}),placeholder:"Item Title"})]}),t.jsxs(O,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>h({...d,items:void 0}),children:["Remove ",c.array," Item Schema"]})]}):t.jsxs(O,{variant:"outline",size:"sm",onClick:()=>{h({...d,items:{id:Date.now().toString()+Math.random(),key:"item",type:"string",required:!1}})},children:["Add ",c.array," Item Schema"]})]}),!n&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ce,{id:"prop-required",checked:d.required,onCheckedChange:u=>y("required",u),"data-testid":"checkbox-edit-required"}),t.jsx(T,{htmlFor:"prop-required",className:"cursor-pointer",children:"Required field"})]}),d.type==="string"&&t.jsxs("details",{className:"border rounded-md",children:[t.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:t.jsxs("h4",{className:"text-sm font-medium inline",children:[c.string," Constraints"]})}),t.jsxs("div",{className:"space-y-4 p-4 pt-0",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"min-length",children:"Minimum Length"}),t.jsx(L,{id:"min-length",type:"number",placeholder:"0",value:d.minLength||"",onChange:u=>m("minLength",u.target.value?parseInt(u.target.value):void 0),"data-testid":"input-edit-minlength"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"max-length",children:"Maximum Length"}),t.jsx(L,{id:"max-length",type:"number",placeholder:"∞",value:d.maxLength||"",onChange:u=>m("maxLength",u.target.value?parseInt(u.target.value):void 0),"data-testid":"input-edit-maxlength"})]})]}),l&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"pattern",children:"Pattern (regex)"}),t.jsx(L,{id:"pattern",placeholder:"^[a-z]+$",value:d.pattern||"",onChange:u=>m("pattern",u.target.value),className:"font-mono text-sm","data-testid":"input-edit-pattern"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{children:"Enum Values"}),t.jsx("div",{className:"space-y-2",children:[...d.enum||[],""].map((u,z)=>{var V;return t.jsx(L,{placeholder:z===(((V=d.enum)==null?void 0:V.length)||0)?"Add new value...":"Enum value",value:u,onChange:$=>{const R=$.target.value,D=d.enum||[];if(z===D.length)R.trim()&&m("enum",[...D,R.trim()]);else if(R.trim()){const M=[...D];M[z]=R.trim(),m("enum",M)}else{const M=D.filter((Q,C)=>C!==z);m("enum",M.length>0?M:void 0)}},"data-testid":`input-edit-enum-${z}`},z)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter allowed values (empty fields will be removed)"})]})]})]}),(d.type==="number"||d.type==="integer")&&t.jsxs("details",{className:"border rounded-md",children:[t.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:t.jsx("h4",{className:"text-sm font-medium inline",children:"Numeric Constraints"})}),t.jsx("div",{className:"space-y-4 p-4 pt-0",children:t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"minimum",children:"Minimum Value"}),t.jsx(L,{id:"minimum",type:"number",placeholder:"-∞",value:d.minimum??"",onChange:u=>m("minimum",u.target.value?parseFloat(u.target.value):void 0),"data-testid":"input-edit-minimum"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"maximum",children:"Maximum Value"}),t.jsx(L,{id:"maximum",type:"number",placeholder:"∞",value:d.maximum??"",onChange:u=>m("maximum",u.target.value?parseFloat(u.target.value):void 0),"data-testid":"input-edit-maximum"})]})]})})]}),d.type==="array"&&t.jsxs("details",{className:"border rounded-md",children:[t.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:t.jsxs("h4",{className:"text-sm font-medium inline",children:[c.array," Constraints"]})}),t.jsxs("div",{className:"space-y-4 p-4 pt-0",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"min-items",children:"Minimum Items"}),t.jsx(L,{id:"min-items",type:"number",placeholder:"0",value:d.minItems||"",onChange:u=>m("minItems",u.target.value?parseInt(u.target.value):void 0),"data-testid":"input-edit-minitems"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"max-items",children:"Maximum Items"}),t.jsx(L,{id:"max-items",type:"number",placeholder:"∞",value:d.maxItems||"",onChange:u=>m("maxItems",u.target.value?parseInt(u.target.value):void 0),"data-testid":"input-edit-maxitems"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ce,{id:"unique-items",checked:d.uniqueItems||!1,onCheckedChange:u=>m("uniqueItems",u),"data-testid":"checkbox-edit-unique"}),t.jsx(T,{htmlFor:"unique-items",className:"cursor-pointer",children:"All items must be unique"})]})]})]})]}),t.jsxs(Ke,{className:"px-6 py-4 border-t bg-background shrink-0",children:[t.jsx(O,{variant:"outline",onClick:g,"data-testid":"button-cancel",children:"Cancel"}),t.jsx(O,{onClick:j,"data-testid":"button-save",disabled:!((q=d.title)!=null&&q.trim()),children:"Save Changes"})]})]})})}function Pe(e,r,s={}){const{allowEmpty:a=!1,onEditStart:n,onEditCancel:o}=s,[i,l]=S.useState(!1),[p,c]=S.useState(e);S.useEffect(()=>{i||c(e)},[e,i]);const d=()=>{c(e),l(!0),n==null||n()},h=b=>{c(b)},f=()=>{const b=p.trim();if(!a&&!b){c(e),l(!1);return}b!==e&&r(b),l(!1)};return{isEditing:i,value:p,startEdit:d,handleChange:h,handleBlur:f,handleKeyDown:b=>{b.key==="Enter"?f():b.key==="Escape"&&(c(e),l(!1),o==null||o())}}}function Ut(e,r){const[s,a]=S.useState(!1);return{isChangingType:s,setIsChangingType:a,handleTypeChange:i=>{const l={...e,type:i};i!=="string"&&(delete l.minLength,delete l.maxLength,delete l.pattern,delete l.enum),i!=="number"&&i!=="integer"&&(delete l.minimum,delete l.maximum),i!=="array"&&(delete l.minItems,delete l.maxItems,delete l.uniqueItems,delete l.items),i!=="object"&&delete l.children,r(l),a(!1)},availableTypes:["string","number","integer","boolean","object","array","file"]}}const be=()=>`${Date.now()}-${Math.random()}`;function ye(e={}){const{onConfirm:r,onCancel:s,createInitialData:a}=e,[n,o]=S.useState(!1),[i,l]=S.useState(null),p=f=>{const v=f??(a?a():null);l(v),o(!0)},c=()=>{o(!1),l(null),s==null||s()};return{isOpen:n,data:i,open:p,close:c,confirm:f=>{r==null||r(f),o(!1),l(null)},setIsOpen:f=>{f?o(!0):c()}}}function Wt(e,r){const s=ye({createInitialData:()=>({id:be(),key:"",type:"string",required:!1}),onConfirm:o=>{r({...e,children:[...e.children||[],o]})}});return{addChild:()=>s.open(),updateChild:(o,i)=>{const l=e.children.map(p=>p.id===o?i:p);r({...e,children:l})},deleteChild:o=>{const i=e.children.filter(l=>l.id!==o);r({...e,children:i})},addChildDialog:{isOpen:s.isOpen,data:s.data,setIsOpen:s.setIsOpen,confirm:s.confirm}}}function pe({property:e,onUpdate:r,onDelete:s,level:a=1,isArrayItem:n=!1,showRegex:o=!1,keyEditable:i=!1}){const{getTypeLabel:l,typeLabels:p}=We(),c=ye(),d=Pe(e.title||e.key||"",g=>r({...e,title:g}),{allowEmpty:!1}),h=Pe(e.description||"",g=>r({...e,description:g||void 0}),{allowEmpty:!0}),f=Ut(e,r),v=Wt(e,r),b=`h${Math.min(a,6)}`,y=e.type==="object",m=y&&e.children&&e.children.length>0,j={1:"text-lg font-semibold",2:"text-base",3:"text-base",4:"text-base",5:"text-sm",6:"text-sm"}[a]||"text-sm";return t.jsxs("div",{className:"group",children:[t.jsxs("div",{className:"flex gap-4 items-center rounded-md -mx-2 px-2 py-1 transition-colors hover:bg-accent/50",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"flex items-start gap-3",children:[!n&&t.jsx("button",{onClick:()=>r({...e,required:!e.required}),className:"shrink-0 transition-all hover:scale-110 mt-0.5",title:e.required?"Required field - click to make optional":"Optional field - click to make required",children:e.required?t.jsx("span",{className:"block w-4 h-4 rounded-full bg-primary"}):t.jsx("span",{className:"block w-4 h-4 rounded-full border border-dashed border-gray-400"})}),d.isEditing?t.jsx(L,{value:d.value,onChange:g=>d.handleChange(g.target.value),onBlur:d.handleBlur,onKeyDown:d.handleKeyDown,autoFocus:!0,className:j,placeholder:"Enter title"}):t.jsxs("div",{className:"flex gap-2 flex-wrap flex-1",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(b,{className:`${j} cursor-pointer hover:text-primary transition-colors leading-none`,onClick:d.startEdit,children:e.title||e.key||t.jsx("span",{className:"text-muted-foreground italic",children:"unnamed"})}),f.isChangingType?t.jsxs(le,{value:e.type,onValueChange:g=>f.handleTypeChange(g),open:f.isChangingType,onOpenChange:f.setIsChangingType,children:[t.jsx(se,{className:"w-[140px] h-7",children:t.jsx(de,{})}),t.jsx(re,{children:f.availableTypes.map(g=>t.jsx(A,{value:g,children:p[g]},g))})]}):t.jsx(Lt,{children:t.jsxs(Dt,{children:[t.jsx(Et,{asChild:!0,children:t.jsxs("button",{onClick:()=>f.setIsChangingType(!0),className:"cursor-pointer hover:bg-accent rounded p-0.5 transition-colors",children:[e.type==="string"&&t.jsx(w.Type,{className:"w-5 h-5 text-muted-foreground"}),e.type==="number"&&t.jsx(w.Hash,{className:"w-5 h-5 text-muted-foreground"}),e.type==="integer"&&t.jsx(w.Hash,{className:"w-5 h-5 text-muted-foreground"}),e.type==="boolean"&&t.jsx(w.CheckSquare,{className:"w-5 h-5 text-muted-foreground"}),e.type==="object"&&t.jsx(w.Braces,{className:"w-5 h-5 text-muted-foreground"}),e.type==="array"&&t.jsx(w.List,{className:"w-5 h-5 text-muted-foreground"}),e.type==="file"&&t.jsx(w.FileText,{className:"w-5 h-5 text-muted-foreground"})]})}),t.jsxs(Fe,{children:[l(e.type),e.type==="array"&&e.items?` of ${l(e.items.type)}`:"",t.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Click to change type"})]})]})}),e.type==="object"&&t.jsx(O,{variant:"ghost",size:"icon",className:"opacity-0 group-hover:opacity-100 h-6 w-6",onClick:v.addChild,"data-testid":`button-add-child-${e.id}`,children:t.jsx(w.Plus,{className:"!w-5 !h-5"})})]}),t.jsx("div",{className:"flex-1",children:h.isEditing?t.jsx(L,{value:h.value,onChange:g=>h.handleChange(g.target.value),onBlur:h.handleBlur,onKeyDown:h.handleKeyDown,autoFocus:!0,className:"text-sm flex-1",placeholder:"Enter description"}):t.jsx(t.Fragment,{children:e.description?t.jsx("p",{className:"text-sm text-muted-foreground flex-1 min-w-[200px] cursor-pointer hover:text-foreground transition-colors","data-testid":`text-description-${e.id}`,onClick:h.startEdit,children:e.description}):t.jsx("p",{className:"text-sm text-muted-foreground/50 flex-1 min-w-[200px] cursor-pointer hover:text-muted-foreground italic transition-colors",onClick:h.startEdit,children:"Add description..."})})})]})]})}),t.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[t.jsx(O,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>c.open(e),"data-testid":`button-edit-${e.id}`,children:t.jsx(w.Pencil,{className:"w-3 h-3"})}),y&&e.type!=="object"&&t.jsx(O,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:v.addChild,"data-testid":`button-add-child-${e.id}`,children:t.jsx(w.Plus,{className:"w-3 h-3"})}),t.jsx(O,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:s,"data-testid":`button-delete-${e.id}`,children:t.jsx(w.Trash2,{className:"w-3 h-3"})})]})]}),m&&t.jsx("div",{className:a===1?"ml-6 mt-1 border-l-2 border-border pl-6":"ml-4 mt-1 border-l border-border pl-4",children:e.children.map(g=>t.jsx(pe,{property:g,onUpdate:q=>v.updateChild(g.id,q),onDelete:()=>v.deleteChild(g.id),level:a+1,showRegex:o,keyEditable:i},g.id))}),e.type==="array"&&e.items&&t.jsxs("div",{className:a===1?"ml-6 mt-1 border-l-2 border-border pl-6":"ml-4 mt-1 border-l border-border pl-4",children:[t.jsxs("div",{className:"mb-2 text-xs text-muted-foreground font-semibold uppercase",children:[l("array")," Items"]}),t.jsx(pe,{property:e.items,onUpdate:g=>r({...e,items:g}),onDelete:()=>r({...e,items:void 0}),level:a+1,isArrayItem:!0,showRegex:o,keyEditable:i})]}),t.jsx(me,{property:c.data||e,open:c.isOpen,onOpenChange:c.setIsOpen,onUpdate:g=>{r(g),c.close()},isArrayItem:n,isNewProperty:!1,showRegex:o,keyEditable:i}),v.addChildDialog.isOpen&&v.addChildDialog.data&&t.jsx(me,{property:v.addChildDialog.data,open:v.addChildDialog.isOpen,isNewProperty:!0,onOpenChange:v.addChildDialog.setIsOpen,onUpdate:v.addChildDialog.confirm,showRegex:o,keyEditable:i})]})}const ve=I.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("rounded-xl border bg-card text-card-foreground shadow",e),...r}));ve.displayName="Card";const Ht=I.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("flex flex-col space-y-1.5 p-6",e),...r}));Ht.displayName="CardHeader";const Xt=I.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("font-semibold leading-none tracking-tight",e),...r}));Xt.displayName="CardTitle";const Zt=I.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("text-sm text-muted-foreground",e),...r}));Zt.displayName="CardDescription";const Qt=I.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("p-6 pt-0",e),...r}));Qt.displayName="CardContent";const Yt=I.forwardRef(({className:e,...r},s)=>t.jsx("div",{ref:s,className:N("flex items-center p-6 pt-0",e),...r}));Yt.displayName="CardFooter";const es=()=>new Promise((e,r)=>{const s=document.createElement("input");s.type="file",s.accept=".json",s.onchange=a=>{var i;const n=(i=a.target.files)==null?void 0:i[0];if(!n){r(new Error("No file selected"));return}const o=new FileReader;o.onload=l=>{var p;try{const c=JSON.parse((p=l.target)==null?void 0:p.result);e(c)}catch{r(new Error("Invalid JSON file"))}},o.onerror=()=>r(new Error("Failed to read file")),o.readAsText(n)},s.click()}),He=(e,r="schema.json")=>{const s=JSON.stringify(e,null,2),a=new Blob([s],{type:"application/json"}),n=URL.createObjectURL(a),o=document.createElement("a");o.href=n,o.download=r,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)};function ts({schema:e}){const[r,s]=S.useState(!1),a=JSON.stringify(e,null,2),n=async()=>{await navigator.clipboard.writeText(a),s(!0),setTimeout(()=>s(!1),2e3)},o=()=>{He(e,"schema.json")};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsx("h2",{className:"text-sm font-medium",children:"JSON Schema Output"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(O,{variant:"outline",size:"sm",onClick:n,"data-testid":"button-copy",children:r?t.jsx(w.CheckCircle2,{className:"w-4 h-4"}):t.jsx(w.Copy,{className:"w-4 h-4"})}),t.jsx(O,{variant:"outline",size:"sm",onClick:o,"data-testid":"button-download",children:t.jsx(w.Download,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(ve,{className:"m-4 bg-muted/30",children:t.jsx("pre",{className:"p-6 text-xs font-mono overflow-auto","data-testid":"text-json-output",children:t.jsx("code",{children:a})})})})]})}function ss({title:e,description:r,version:s,onUpdate:a}){const[n,o]=S.useState(!1);return t.jsxs(ve,{className:"p-4",children:[t.jsxs(O,{variant:"ghost",onClick:()=>o(!n),className:"w-full justify-between px-2 h-auto hover:bg-transparent","data-testid":"button-toggle-metadata",children:[t.jsx("h3",{className:"text-sm font-medium",children:"Schema Metadata"}),n?t.jsx(w.ChevronDown,{className:"w-4 h-4"}):t.jsx(w.ChevronRight,{className:"w-4 h-4"})]}),n&&t.jsxs("div",{className:"mt-4 space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"schema-title",className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(L,{id:"schema-title",placeholder:"My Schema",value:e,onChange:i=>a("title",i.target.value),"data-testid":"input-title"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"schema-description",className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(xe,{id:"schema-description",placeholder:"Describe your schema...",value:r,onChange:i=>a("description",i.target.value),className:"resize-none",rows:3,"data-testid":"input-schema-description"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(T,{htmlFor:"schema-version",className:"text-xs text-muted-foreground",children:"Version"}),t.jsx(L,{id:"schema-version",placeholder:"1.0.0",value:s,onChange:i=>a("version",i.target.value),"data-testid":"input-version"})]})]})]})}const te=(e,r,s=!0)=>{const a={type:"object"};s&&r&&(r.title&&(a.title=r.title),r.description&&(a.description=r.description));const n=he(e);Object.keys(n).length>0&&(a.properties=n);const o=e.filter(i=>i.required&&i.key).map(i=>i.key);return o.length>0&&(a.required=o),a},he=e=>{const r={};return e.forEach(s=>{if(!s.key)return;const n={type:s.type==="file"?"string":s.type};if(s.title&&(n.title=s.title),s.description&&(n.description=s.description),s.type==="file"&&(n.format="filename"),s.type==="string"&&(s.minLength!==void 0&&(n.minLength=s.minLength),s.maxLength!==void 0&&(n.maxLength=s.maxLength),s.pattern&&(n.pattern=s.pattern),s.enum&&s.enum.length>0&&(n.enum=s.enum)),(s.type==="number"||s.type==="integer")&&(s.minimum!==void 0&&(n.minimum=s.minimum),s.maximum!==void 0&&(n.maximum=s.maximum)),s.type==="array"&&(s.minItems!==void 0&&(n.minItems=s.minItems),s.maxItems!==void 0&&(n.maxItems=s.maxItems),s.uniqueItems&&(n.uniqueItems=s.uniqueItems),s.items&&(n.items=he([s.items])[s.items.key]||{type:s.items.type})),s.type==="object"&&s.children&&s.children.length>0){n.properties=he(s.children);const o=s.children.filter(i=>i.required&&i.key).map(i=>i.key);o.length>0&&(n.required=o)}r[s.key]=n}),r},rs=e=>{const r={properties:[]};return(e.title||e.description)&&(r.metadata={title:typeof e.title=="string"?e.title:"",description:typeof e.description=="string"?e.description:"",version:"1.0.0"}),e.properties&&typeof e.properties=="object"&&(r.properties=fe(e.properties,Array.isArray(e.required)?e.required:[])),r},fe=(e,r=[])=>e?Object.entries(e).filter(([,s])=>typeof s=="object").map(([s,a])=>{const n=a;let o=typeof n.type=="string"?n.type:"string";o==="string"&&n.format==="filename"&&(o="file");const i={id:be(),key:s,title:typeof n.title=="string"?n.title:void 0,type:o,description:typeof n.description=="string"?n.description:void 0,required:r.includes(s)};return n.minLength!==void 0&&(i.minLength=n.minLength),n.maxLength!==void 0&&(i.maxLength=n.maxLength),n.pattern&&(i.pattern=n.pattern),n.enum&&Array.isArray(n.enum)&&(i.enum=n.enum),n.minimum!==void 0&&(i.minimum=n.minimum),n.maximum!==void 0&&(i.maximum=n.maximum),n.minItems!==void 0&&(i.minItems=n.minItems),n.maxItems!==void 0&&(i.maxItems=n.maxItems),n.uniqueItems&&(i.uniqueItems=n.uniqueItems),i.type==="array"&&n.items&&typeof n.items=="object"&&!Array.isArray(n.items)&&(i.items=fe({item:n.items},[]).find(l=>l.key==="item")),n.properties&&typeof n.properties=="object"&&(i.children=fe(n.properties,Array.isArray(n.required)?n.required:[])),i}):[],ns=({schema:e,onChange:r,includeMetadata:s=!0})=>{const{properties:a,metadata:n}=S.useMemo(()=>rs(e),[e]),o=a,i=n||{title:"",description:"",version:""},l=S.useCallback(()=>({id:be(),key:"",type:"string",required:!1}),[]),p=S.useCallback((b,y)=>{const m=o.some(q=>q.id===b);let j;m?j=o.map(q=>q.id===b?y:q):j=[...o,y];const g=te(j,i,s);r(g)},[o,i,s,r]),c=S.useCallback(b=>{const y=o.filter(j=>j.id!==b),m=te(y,i,s);r(m)},[o,i,s,r]),d=S.useCallback(()=>{const y=te([],{title:"",description:""},s);r(y)},[s,r]),h=S.useCallback((b,y)=>{const m={...i,[b]:y},j=te(o,m,s);r(j)},[o,i,s,r]),f=S.useCallback(async()=>{const b=await es();r(b)},[r]),v=S.useCallback(()=>{He(e,"schema.json")},[e]);return{properties:o,metadata:i,addProperty:l,updateProperty:p,deleteProperty:c,clearAll:d,updateMetadata:h,importSchema:f,downloadSchema:v}};function as(){const[e,r]=S.useState("light");S.useEffect(()=>{const n=localStorage.getItem("theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");r(n),document.documentElement.classList.toggle("dark",n==="dark")},[]);const s=()=>{const a=e==="light"?"dark":"light";r(a),localStorage.setItem("theme",a),document.documentElement.classList.toggle("dark",a==="dark")};return t.jsx(O,{variant:"ghost",size:"icon",onClick:s,"data-testid":"button-theme-toggle",children:e==="light"?t.jsx(w.Moon,{className:"w-4 h-4"}):t.jsx(w.Sun,{className:"w-4 h-4"})})}function os({schema:e,onChange:r,showMetadata:s=!1,showImport:a=!0,showClear:n=!0,showOutput:o=!0,showHeader:i=!0,className:l="",showSummary:p=!1,typeLabels:c,propertyLabel:d={singular:"property",plural:"properties"},showRegex:h=!1,keyEditable:f=!1}){const{properties:v,metadata:b,addProperty:y,updateProperty:m,deleteProperty:j,clearAll:g,updateMetadata:q,importSchema:u}=ns({schema:e,onChange:r,includeMetadata:s}),z=ye({createInitialData:()=>y(),onConfirm:R=>{m(R.id,R)}}),V=()=>{g()},$=async()=>{await u()};return t.jsx(Jt,{customLabels:c,children:t.jsxs("div",{className:`${l} flex flex-col json-schema-builder-react`,children:[i&&t.jsx("header",{className:"h-16 border-b flex items-center justify-between px-6",children:t.jsxs("div",{className:"flex items-center gap-3",children:[a&&t.jsx(O,{variant:"outline",size:"sm",onClick:$,"data-testid":"button-import",children:t.jsx(w.Upload,{className:"w-4 h-4"})}),n&&t.jsx(O,{variant:"outline",size:"sm",onClick:V,disabled:v.length===0,"data-testid":"button-clear",children:t.jsx(w.Trash2,{className:"w-4 h-4"})}),t.jsx(as,{})]})}),t.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[t.jsx("div",{className:o?"w-3/5 border-r":"w-full",children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex-1 overflow-auto p-2 space-y-4",children:[s&&t.jsx(ss,{title:b.title,description:b.description,version:b.version,onUpdate:(R,D)=>q(R,D)}),v.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4",children:t.jsx(w.Plus,{className:"w-8 h-8 text-muted-foreground"})}),t.jsxs("h2",{className:"text-lg font-medium mb-2",children:["No ",d.plural," yet"]}),t.jsxs("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm",children:["Start building your JSON schema by adding your first"," ",d.singular]}),t.jsxs(O,{onClick:()=>z.open(),"data-testid":"button-add-first",children:[t.jsx(w.Plus,{className:"w-4 h-4 mr-2"}),"Add ",d.singular]})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"space-y-1",children:v.map(R=>t.jsx(pe,{property:R,onUpdate:D=>m(R.id,D),onDelete:()=>j(R.id),showRegex:h,keyEditable:f},R.id))}),p&&t.jsxs("div",{className:"pt-4 border-t flex items-center justify-between text-sm text-muted-foreground",children:[t.jsxs("span",{children:[v.length," ",v.length===1?d.singular:d.plural]}),t.jsxs("span",{children:[v.filter(R=>R.required).length," required"]})]})]})]}),v.length>0&&t.jsx("div",{className:"border-t p-2 pt-4 bg-background",children:t.jsxs(O,{onClick:()=>z.open(),className:"w-full",variant:"outline","data-testid":"button-add-property",children:[t.jsx(w.Plus,{className:"w-4 h-4"}),"Add ",d.singular]})})]})}),o&&t.jsx("div",{className:"w-2/5",children:t.jsx(ts,{schema:e})})]}),z.isOpen&&z.data&&t.jsx(me,{property:z.data,open:z.isOpen,isNewProperty:!0,onOpenChange:z.setIsOpen,propertyLabel:d,onUpdate:z.confirm,showRegex:h,keyEditable:f})]})})}exports.JsonSchemaBuilder=os;
2
2
  //# sourceMappingURL=index.cjs.map