import{u as w}from"./store-7aRonVWq.js";import x from"./SchemaCanvas-BgHWwIOY.js";import z from"./SchemaSidebar-DbURj86H.js";import{_ as C}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{o as B,w as M,g as R,i as W,C as S,B as c,j as l,af as k,J as s,H as D,G as E,ag as L,r as t}from"./index-DOFLUERq.js";import"./SchemaTabs-B-YYDirE.js";import"./EditableInput-DQlgWBJl.js";import"./SchemaSections-BAEJPWaR.js";import"./vuedraggable.umd-CrsnNXKf.js";import"./_commonjsHelpers-CE1G-McA.js";import"./index-CRx3oDcD.js";import"./index-DuPUrsw1.js";const N=300,X=700,j={__name:"SchemaBuilder",props:{initialSchema:{type:Object,default:()=>({})},onSave:{type:Function,default:null}},setup(y,{expose:b}){const a=y;b({getSchemaData:()=>o.schema});const o=w(),n=t(300),i=t(!1),_=t(null),u=t(null),m=t(null),d=t(0),p=t(300);function g(e){e.preventDefault(),e.stopPropagation(),d.value=e.clientX,p.value=n.value,i.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",v),document.addEventListener("mouseup",f)}function v(e){if(!i.value)return;const h=d.value-e.clientX,r=p.value+h;r>=N&&r<=X&&(n.value=r)}function f(){i.value=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",f)}return B(()=>{u.value=document.body,m.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,h)=>(R(),W(l(L),{to:m.value},{default:S(()=>[c(l(k),{to:u.value},{default:S(()=>[s("div",{class:"schema-builder-container",ref_key:"containerRef",ref:_},[s("div",{class:D(["schema-main",[l(o).preview?"preview":""]])},[c(x)],2),s("div",{class:"resize-handle",onMousedown:g},null,32),s("div",{class:"schema-sidebar",style:E({width:n.value+"px"})},[c(z)],4)],512)]),_:1},8,["to"])]),_:1},8,["to"]))}},U=C(j,[["__scopeId","data-v-aa1da059"]]);export{U as default};
