import{u as x}from"./store-4494c957.js";import z from"./SchemaCanvas-64e590ef.js";import w from"./SchemaSidebar-ccc4f35c.js";import{_ as B}from"./_plugin-vue_export-helper-c27b6911.js";import{r as t,o as C,z as M,J as R,w as _,j as c,n as W,h as l,f as s,B as k,G as D,bu as E,bv as L}from"./index-a0da86f0.js";import"./SchemaTabs-2e6dd274.js";import"./EditableInput-59a19c62.js";import"./SchemaSections-5a65d0e0.js";import"./_commonjsHelpers-de833af9.js";import"./index-96e20e64.js";const N=300,X=700,j={__name:"SchemaBuilder",props:{initialSchema:{type:Object,default:()=>({})},onSave:{type:Function,default:null}},setup(S,{expose:y}){const a=S;y({getSchemaData:()=>o.schema});const o=x(),n=t(300),i=t(!1),b=t(null),u=t(null),d=t(null),m=t(0),v=t(300);function g(e){e.preventDefault(),e.stopPropagation(),m.value=e.clientX,v.value=n.value,i.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",p),document.addEventListener("mouseup",h)}function p(e){if(!i.value)return;const f=m.value-e.clientX,r=v.value+f;r>=N&&r<=X&&(n.value=r)}function h(){i.value=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h)}return C(()=>{u.value=document.body,d.value=document.body,a.initialSchema&&Object.keys(a.initialSchema).length>0&&o.loadSchema(a.initialSchema)}),M(()=>o.schema,e=>{a.onSave&&e&&a.onSave(e)},{deep:!0}),(e,f)=>(W(),R(c(L),{to:d.value},{default:_(()=>[l(c(E),{to:u.value},{default:_(()=>[s("div",{class:"schema-builder-container",ref_key:"containerRef",ref:b},[s("div",{class:k(["schema-main",[c(o).preview?"preview":""]])},[l(z)],2),s("div",{class:"resize-handle",onMousedown:g},null,32),s("div",{class:"schema-sidebar",style:D({width:n.value+"px"})},[l(w)],4)],512)]),_:1},8,["to"])]),_:1},8,["to"]))}},Q=B(j,[["__scopeId","data-v-aa1da059"]]);export{Q as default};
