@a2simcode/dui 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dui.umd.js CHANGED
@@ -1,9 +1,9 @@
1
- (function(me,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@a2simcode/ui")):typeof define=="function"&&define.amd?define(["exports","vue","@a2simcode/ui"],r):(me=typeof globalThis<"u"?globalThis:me||self,r(me.DuiUI={},me.Vue,me.SimCodeUI))})(this,function(me,r,Ke){Object.defineProperties(me,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var qe=(t,e)=>(t.install=n=>{n.component(t.name,t),e&&e.forEach(o=>{n.component(o.name,o)})},t),rt=(t="")=>{const e=Date.now(),n=Math.floor(Math.random()*1e9);return t===""?String(n)+String(e):t+"_"+n+String(e)},Sn=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Sn);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=Sn(t[n]));return e},Wr=t=>{if(Array.isArray(t))t.length=0;else if(t&&typeof t=="object")for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&delete t[e]},Dn={},Ur=(t,e,n)=>{n[t]=n[t]||{};const o=rt();return n[t][o]=e,o},Yr=(t,e,n)=>{const o=[],i=n[t]||{};return Object.keys(i).forEach(s=>{const a=i[s];try{a&&o.push(a(e))}catch(l){console.error(l)}}),o},Xr=(t,e,n)=>{if(e){const o=n[t];o&&delete o[e]}else delete n[t]},xo=(t,e)=>Ur(t,e,Dn),ye=(t,e)=>Yr(t,e,Dn),jr=(t,e)=>{Xr(t,e,Dn)},No=(t,e,n,o,i,s)=>{const a=e.id,l=e.level,{getDesignLocals:d,selectComponent:c,getComponent:u,isMyChildComponent:h,addComponent:f,deleteComponent:g,getParentComponents:m,removeComponentFromContainer:E,addComponentToContainer:S,copyComponent:D,activedComponent:B,top:w}=(0,r.inject)("d-drag-design-provide",{}),M=[],G=(0,r.ref)(!1),R=(0,r.ref)(!1),q=(0,r.ref)(!1),K=(0,r.ref)(!1),j=(0,r.ref)(!1),Z={id:"",type:""},F=(0,r.ref)(!1),k=(0,r.ref)(!1);let W="",b=null;const P=A=>{if(W===A)return b;W=A;const{top:U,left:te,width:ie,height:le}=t.value.getBoundingClientRect();return b=[{x:te,y:U},{x:te+ie,y:U},{x:te+ie,y:U+le},{x:te,y:U+le}],b},v=(A,U,te)=>{let ie=U-te[0].y;ie<0&&(ie=-ie);let le=U-te[3].y;le<0&&(le=-le);let J=A-te[0].x;J<0&&(J=-J);let re=A-te[1].x;return re<0&&(re=-re),{ly:ie>le?le:ie,typey:ie>le?"bottom":"top",lx:J>re?re:J,lallx:J+re}},N=(A,U,te)=>A>=te[0].x&&A<=te[1].x&&U>=te[0].y&&U<=te[3].y,I=()=>{if(i){ye("dragClick",{id:a});return}if(!R.value){if(c(a),l!==0){const A=t.value.getBoundingClientRect(),U=d();A.top-U.top<22?K.value=!0:K.value=!1}R.value=!0,ye("dragClick",{id:a})}},T=A=>{const U=g(A);U&&(0,r.nextTick)(()=>{ye("dragClick",{id:U})})},z=()=>{Z.id="",Z.type="",l===0&&(j.value=!1)},O=()=>{ye("mouseEnterOrLeave",{id:a,type:"enter"})},L=()=>{ye("mouseEnterOrLeave",{id:a,type:"leave"})},ee=A=>{ye("dragClick",{id:A})},se={mouseEnterOrLeave:({id:A,type:U})=>{U==="enter"?M.push(A):M.length>0&&M.splice(M.length-1,1);const te=M.length;te>0&&a===M[te-1]?G.value=!0:G.value=!1},dragAciveChild:({type:A,id:U})=>{U===a?A==="top"?(F.value=!0,k.value=!1):(k.value=!0,F.value=!1):(k.value=!1,F.value=!1)},dragClick({id:A,isAgain:U}){console.log("dragClick",A,a),A!==a?R.value=!1:(U&&(R.value=!1),I())}};se[`dragGetChildDistance_${a}`]=({dragX:A,dragY:U,moveId:te})=>v(A,U,P(te));const V={isInContainer({x:A,y:U,id:te,moveId:ie}){if(a===te||h(te,a))return q.value=!1,{isIn:!1,level:l,id:a,groupId:s};const le=P(ie);if(N(A,U,le))return l===0&&(j.value=!0),{isIn:!0,level:l,id:a,groupId:s};if(l===0){const{ly:J,lx:re}=v(A,U,le);if(J<20&&re<20)return j.value=!0,{isIn:!0,level:l,id:a,groupId:s};j.value=!1}return q.value=!1,{isIn:!1,level:l,id:a,groupId:s}},dragActiveContainer:({containerId:A,containerGroupId:U,dragX:te,dragY:ie,moveId:le})=>{if(A===a&&U===s)if(q.value=!0,o&&o.value.length>0){let J={ly:9999999,lx:0,lallx:0,id:"",typey:""};o?.value.forEach(re=>{if(s&&re.groupId!==s)return;const x=ye(`dragGetChildDistance_${re.id}`,{dragX:te,dragY:ie,moveId:le})[0];x&&(J.ly>x.ly||J.ly===x.ly&&(J.lx>x.lx||J.lx===x.lx&&J.lallx>x.lallx))&&(J=x,J.id=re.id)}),Z.id=J.id,Z.type=J.typey,ye("dragAciveChild",{id:J.id,type:J.typey})}else ye("dragAciveChild",{id:""});else q.value=!1},dragAdd:A=>{if(q.value){let U=o?.value.length||0;Z.id!==""&&Z.id!==void 0&&(U=o?.value.findIndex(te=>te.id===Z.id)||0,Z.type==="bottom"&&(U+=1)),f(A,a,U,s),q.value=!1}z()},dragAddByClick:A=>{if(!B.value&&a===w.id||B.value?.id===a||B.value?.containerId===a&&B.value?.dragType!=="container"){const U=f(A,a,o?.value.length||0,s,!0);U&&A.config&&Object.keys(A.config).forEach(te=>{U.config[te]=A.config[te]})}},dragUpdate(A){if(q.value){const U=u(A);if(U.level=l+1,Z.id!==U.id){E(U.containerId,A);let te=o?.value.findIndex(ie=>ie.id===Z.id)||0;Z.type==="bottom"&&(te+=1),S(U,a,te,s)}q.value=!1,(0,r.nextTick)(()=>{ye("dragClick",{id:U.id,isAgain:!0})})}z()}},X={};return(0,r.onMounted)(()=>{(!i||n!=="container")&&Object.keys(se).forEach(A=>{X[A]=xo(A,se[A])}),n==="container"&&Object.keys(V).forEach(A=>{X[A]=xo(A,V[A])}),e.isNewAdd&&(0,r.nextTick)(()=>{I(),delete e.isNewAdd})}),(0,r.onUnmounted)(()=>{Object.keys(X).forEach(A=>{jr(A,X[A])})}),{onMouseenter:O,onMouseleave:L,activeComponent:I,handleComponentClick:ee,deleteComponentByClick:T,copyComponent:D,getParentComponents:m,isBottomToolBar:K,isHover:G,isSelect:R,isToContainer:q,isMoveingInTopLevel:j,isTopActive:F,isBottomActive:k}},ko=(t,e)=>{const n={x:0,y:0,clientX:0,clientY:0,dragElement:null,dragElementId:"jcode-darg-move-id",toContainerLevel:-1,toContainerId:"",groupId:"",id:""};let o=!1;const i=(g,m)=>{o!==!0&&(o=!0,setTimeout(()=>{g(),o=!1},m))},s=(0,r.ref)(!1),a=(g,m,E)=>{const S=document.createElement("div");return S.id=n.dragElementId,S.innerText=g,S.className="d-drag-move",S.style.top=`${m}px`,S.style.left=`${E}px`,document.body.appendChild(S),S},l=()=>{document.onmousemove=null,document.onmouseup=null,s.value=!1,ye("dragAciveChild",{id:""})},d=()=>{l(),n.dragElement&&(n.dragElement.remove(),n.dragElement=null,e?ye("dragAdd",t):ye("dragUpdate",t.id))},c=g=>{const{clientY:m,clientX:E}=g;if(!n.dragElement){const S=Math.abs(n.x-E),D=Math.abs(n.y-m);if(S<=1&&D<=1)return;s.value=!0,n.dragElement=a(t.name,m-11,E-32)}n.dragElement.style.top=`${m-11}px`,n.dragElement.style.left=`${E-32}px`,n.clientX=E,n.clientY=m,i(()=>{if(!s.value)return;const S=ye("isInContainer",{x:E,y:m,id:t.id,moveId:n.id});n.toContainerLevel=-1,n.toContainerId="",n.groupId="",S.forEach(({level:D,id:B,isIn:w,groupId:M})=>{w&&n.toContainerLevel<D&&(n.toContainerLevel=D,n.toContainerId=B,n.groupId=M)}),n.toContainerId!==""?ye("dragActiveContainer",{containerId:n.toContainerId,containerGroupId:n.groupId,dragX:E,dragY:m,moveId:n.id}):ye("dragAciveChild",{id:""})},100)};return{onContextmenu:()=>{l()},onMousedown:g=>{n.x=g.clientX,n.y=g.clientY,n.id=rt(),document.onmouseup=d,document.onmousemove=c},onClick:()=>{ye("dragAddByClick",t)},moveActive:s}},Zr={class:"d-drag-btns-pname"},Kr={key:0,class:"d-drag-mask"},qr=(0,r.defineComponent)({name:"DDrag",__name:"drag",props:{componentData:{default:()=>({})},isContainer:{type:Boolean,default:!1}},setup(t){const e=t,n=(0,r.ref)(),{onMouseenter:o,onMouseleave:i,activeComponent:s,handleComponentClick:a,deleteComponentByClick:l,copyComponent:d,getParentComponents:c,isHover:u,isSelect:h,isTopActive:f,isBottomActive:g,isBottomToolBar:m}=No(n,e.componentData,"component"),{onContextmenu:E,onMousedown:S,moveActive:D}=ko(e.componentData,!1);return(B,w)=>{const M=(0,r.resolveComponent)("j-button"),G=(0,r.resolveComponent)("el-space");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{class:(0,r.normalizeClass)(["d-drag-component",{selected:(0,r.unref)(h),hovered:(0,r.unref)(u),isBottomToolBar:(0,r.unref)(m),active:(0,r.unref)(D),isTopActive:(0,r.unref)(f),isBottomActive:(0,r.unref)(g)}])},[w[11]||(w[11]=(0,r.createElementVNode)("div",{class:"d-drag-line"},null,-1)),(0,r.createElementVNode)("div",{class:"d-drag-btns",onMouseenter:w[4]||(w[4]=(...R)=>(0,r.unref)(o)&&(0,r.unref)(o)(...R)),onMouseleave:w[5]||(w[5]=(...R)=>(0,r.unref)(i)&&(0,r.unref)(i)(...R))},[(0,r.createVNode)(G,{size:4},{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",{class:"d-drag-btns-names",onClick:(0,r.withModifiers)(()=>{},["stop"])},[(0,r.createVNode)(M,{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"]),(0,r.createElementVNode)("div",Zr,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(c)(t.componentData.containerId),R=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:R.id},[(0,r.createVNode)(M,{class:"d-drag-btn",type:"primary",size:"small",label:R.name,onClick:q=>(0,r.unref)(a)(R.id)},null,8,["label","onClick"])]))),128))])]),(0,r.createVNode)(M,{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:content-copy",onClick:w[0]||(w[0]=(0,r.withModifiers)(R=>(0,r.unref)(d)(t.componentData.id),["stop"]))}),(0,r.createElementVNode)("div",{onContextmenu:w[1]||(w[1]=(0,r.withModifiers)((...R)=>(0,r.unref)(E)&&(0,r.unref)(E)(...R),["stop"])),onMousedown:w[2]||(w[2]=(0,r.withModifiers)((...R)=>(0,r.unref)(S)&&(0,r.unref)(S)(...R),["stop"])),style:{display:"flex"}},[(0,r.createVNode)(M,{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:drag"})],32),(0,r.createVNode)(M,{class:"d-drag-btn",danger:"",type:"primary",size:"small",icon:"mdi:delete",onClick:w[3]||(w[3]=(0,r.withModifiers)(R=>(0,r.unref)(l)(t.componentData.id),["stop"]))})]),_:1})],32),(0,r.createElementVNode)("div",{ref_key:"refDrag",ref:n,class:"d-drag-body",onClick:w[6]||(w[6]=(0,r.withModifiers)((...R)=>(0,r.unref)(s)&&(0,r.unref)(s)(...R),["stop"])),onContextmenu:w[7]||(w[7]=(0,r.withModifiers)((...R)=>(0,r.unref)(E)&&(0,r.unref)(E)(...R),["stop"])),onMousedown:w[8]||(w[8]=(0,r.withModifiers)((...R)=>(0,r.unref)(S)&&(0,r.unref)(S)(...R),["stop"])),onMouseenter:w[9]||(w[9]=(...R)=>(0,r.unref)(o)&&(0,r.unref)(o)(...R)),onMouseleave:w[10]||(w[10]=(...R)=>(0,r.unref)(i)&&(0,r.unref)(i)(...R))},[(0,r.renderSlot)(B.$slots,"default"),t.isContainer?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",Kr))],544)],2)}}}),Tn=qr,Jr=(0,r.defineComponent)({name:"DDragTool",__name:"tool",props:{config:{}},setup(t){const{onContextmenu:e,onMousedown:n,onClick:o}=ko(t.config??{name:"",id:""},!0);return(i,s)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"d-drag-tool",onClick:s[0]||(s[0]=(0,r.withModifiers)((...a)=>(0,r.unref)(o)&&(0,r.unref)(o)(...a),["stop"])),onContextmenu:s[1]||(s[1]=(0,r.withModifiers)((...a)=>(0,r.unref)(e)&&(0,r.unref)(e)(...a),["stop"])),onMousedown:s[2]||(s[2]=(0,r.withModifiers)((...a)=>(0,r.unref)(n)&&(0,r.unref)(n)(...a),["stop"]))},[(0,r.renderSlot)(i.$slots,"default")],32))}}),Mn=Jr,Qr={key:0,class:"d-drag-line"},es={key:1,class:"d-drag-btns"},ts=(0,r.defineComponent)({name:"DDragContainer",__name:"container",props:{componentData:{default:()=>({})},isComponentContainer:{type:Boolean,default:!0},groupId:{default:void 0}},setup(t){const e=t,n=(0,r.ref)(),o=(0,r.computed)(()=>e.componentData?.children||[]),{onMouseenter:i,onMouseleave:s,activeComponent:a,isHover:l,isSelect:d,isToContainer:c,isMoveingInTopLevel:u,isTopActive:h,isBottomActive:f}=No(n,e.componentData,"container",o,e.isComponentContainer,e.groupId),g=(0,r.computed)(()=>!!(o.value.findIndex(m=>m.groupId===e.groupId)===-1&&c.value));return(m,E)=>{const S=(0,r.resolveComponent)("j-button");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{ref_key:"refDrag",ref:n,class:(0,r.normalizeClass)(["d-drag-container",{selected:(0,r.unref)(d)&&!t.isComponentContainer,hovered:(0,r.unref)(l)&&!t.isComponentContainer,isTopLevel:t.componentData.level===0,active:g.value,isMoveingInTopLevel:(0,r.unref)(u),isTopActive:(0,r.unref)(h),isBottomActive:(0,r.unref)(f)}])},[t.isComponentContainer?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",Qr)),t.isComponentContainer?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",es,[(0,r.createElementVNode)("div",{class:"d-drag-btns-names",onClick:(0,r.withModifiers)(()=>{},["stop"])},[(0,r.createVNode)(S,{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"])])])),(0,r.createElementVNode)("div",{class:"d-drag-body",onClick:E[0]||(E[0]=(0,r.withModifiers)((...D)=>(0,r.unref)(a)&&(0,r.unref)(a)(...D),["stop"])),onMouseenter:E[1]||(E[1]=(...D)=>(0,r.unref)(i)&&(0,r.unref)(i)(...D)),onMouseleave:E[2]||(E[2]=(...D)=>(0,r.unref)(s)&&(0,r.unref)(s)(...D))},[(0,r.renderSlot)(m.$slots,"default")],32)],2)}}}),In=ts,ns=(0,r.defineComponent)({name:"DDragFormList",__name:"dragFormList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=(0,r.inject)("dui-design-provide",{});return(n,o)=>{const i=(0,r.resolveComponent)("el-col");return(0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(t.componentList,s=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:s.id},[s.type!="pkey"?((0,r.openBlock)(),(0,r.createBlock)(i,{key:0,span:s.config.span||24},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(Tn,{"is-container":s.dragType!=="component","component-data":s},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(e)),{"component-data":s,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["is-container","component-data"])]),_:2},1032,["span"])):(0,r.createCommentVNode)("",!0)],64))),128)}}}),Bn=ns,os=(0,r.defineComponent)({name:"DDragIndexList",__name:"dragIndexList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=(0,r.inject)("dui-design-provide",{}),n=o=>{if(o.flexWidth)return{width:o.flexWidth+"%"}};return(o,i)=>((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(t.componentList,s=>((0,r.openBlock)(),(0,r.createBlock)(Tn,{key:s.id,style:(0,r.normalizeStyle)(n(s.config)),"is-container":s.dragType!=="component","component-data":s},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(e)),{"component-data":s,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["style","is-container","component-data"]))),128))}}),zn=os,So=qe(Tn,[Mn,In,Bn,zn]);function _t(t){return(0,r.getCurrentScope)()?((0,r.onScopeDispose)(t),!0):!1}function Oe(t){return typeof t=="function"?t():(0,r.unref)(t)}var is=typeof window<"u"&&typeof document<"u",rs=t=>typeof t<"u",ss=Object.prototype.toString,as=t=>ss.call(t)==="[object Object]",ls=()=>{};function cs(t,e){function n(...o){return new Promise((i,s)=>{Promise.resolve(t(()=>e.apply(this,o),{fn:e,thisArg:this,args:o})).then(i).catch(s)})}return n}var Do=t=>t();function ds(t=Do){const e=(0,r.ref)(!0);function n(){e.value=!1}function o(){e.value=!0}const i=(...s)=>{e.value&&t(...s)};return{isActive:(0,r.readonly)(e),pause:n,resume:o,eventFilter:i}}function To(t,e=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(e?()=>i(n):o,t)})}function us(t,e,n={}){const{eventFilter:o=Do,...i}=n;return(0,r.watch)(t,cs(o,e),i)}function st(t,e,n={}){const{eventFilter:o,...i}=n,{eventFilter:s,pause:a,resume:l,isActive:d}=ds(o);return{stop:us(t,e,{...i,eventFilter:s}),pause:a,resume:l,isActive:d}}function fs(t,e={}){if(!(0,r.isRef)(t))return(0,r.toRefs)(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const o in t.value)n[o]=(0,r.customRef)(()=>({get(){return t.value[o]},set(i){var s;if((s=Oe(e.replaceRef))==null||s)if(Array.isArray(t.value)){const a=[...t.value];a[o]=i,t.value=a}else{const a={...t.value,[o]:i};Object.setPrototypeOf(a,Object.getPrototypeOf(t.value)),t.value=a}else t.value[o]=i}}));return n}function Rn(t,e=!1){function n(h,{flush:f="sync",deep:g=!1,timeout:m,throwOnTimeout:E}={}){let S=null;const D=[new Promise(B=>{S=(0,r.watch)(t,w=>{h(w)!==e&&(S?.(),B(w))},{flush:f,deep:g,immediate:!0})})];return m!=null&&D.push(To(m,E).then(()=>Oe(t)).finally(()=>S?.())),Promise.race(D)}function o(h,f){if(!(0,r.isRef)(h))return n(w=>w===h,f);const{flush:g="sync",deep:m=!1,timeout:E,throwOnTimeout:S}=f??{};let D=null;const B=[new Promise(w=>{D=(0,r.watch)([t,h],([M,G])=>{e!==(M===G)&&(D?.(),w(M))},{flush:g,deep:m,immediate:!0})})];return E!=null&&B.push(To(E,S).then(()=>Oe(t)).finally(()=>(D?.(),Oe(t)))),Promise.race(B)}function i(h){return n(f=>!!f,h)}function s(h){return o(null,h)}function a(h){return o(void 0,h)}function l(h){return n(Number.isNaN,h)}function d(h,f){return n(g=>{const m=Array.from(g);return m.includes(h)||m.includes(Oe(h))},f)}function c(h){return u(1,h)}function u(h=1,f){let g=-1;return n(()=>(g+=1,g>=h),f)}return Array.isArray(Oe(t))?{toMatch:n,toContains:d,changed:c,changedTimes:u,get not(){return Rn(t,!e)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:s,toBeNaN:l,toBeUndefined:a,changed:c,changedTimes:u,get not(){return Rn(t,!e)}}}function An(t){return Rn(t)}function hs(t){var e;const n=Oe(t);return(e=n?.$el)!=null?e:n}var Mo=is?window:void 0;function Io(...t){let e,n,o,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,o,i]=t,e=Mo):[e,n,o,i]=t,!e)return ls;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const s=[],a=()=>{s.forEach(u=>u()),s.length=0},l=(u,h,f,g)=>(u.addEventListener(h,f,g),()=>u.removeEventListener(h,f,g)),d=(0,r.watch)(()=>[hs(e),Oe(i)],([u,h])=>{if(a(),!u)return;const f=as(h)?{...h}:h;s.push(...n.flatMap(g=>o.map(m=>l(u,g,m,f))))},{immediate:!0,flush:"post"}),c=()=>{d(),a()};return _t(c),c}function gs(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function Bo(...t){let e,n,o={};t.length===3?(e=t[0],n=t[1],o=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],o=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:i=Mo,eventName:s="keydown",passive:a=!1,dedupe:l=!1}=o,d=gs(e);return Io(i,s,u=>{u.repeat&&Oe(l)||d(u)&&n(u)},a)}function ps(t){return JSON.parse(JSON.stringify(t))}function $n(t,e,n,o={}){var i,s,a;const{clone:l=!1,passive:d=!1,eventName:c,deep:u=!1,defaultValue:h,shouldEmit:f}=o,g=(0,r.getCurrentInstance)(),m=n||g?.emit||((i=g?.$emit)==null?void 0:i.bind(g))||((a=(s=g?.proxy)==null?void 0:s.$emit)==null?void 0:a.bind(g?.proxy));let E=c;e||(e="modelValue"),E=E||`update:${e.toString()}`;const S=w=>l?typeof l=="function"?l(w):ps(w):w,D=()=>rs(t[e])?S(t[e]):h,B=w=>{f?f(w)&&m(E,w):m(E,w)};if(d){const w=(0,r.ref)(D());let M=!1;return(0,r.watch)(()=>t[e],G=>{M||(M=!0,w.value=S(G),(0,r.nextTick)(()=>M=!1))}),(0,r.watch)(w,G=>{!M&&(G!==t[e]||u)&&B(G)},{deep:u}),w}else return(0,r.computed)({get(){return D()},set(w){B(w)}})}var ms={value:()=>{}};function Ht(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Lt(n)}function Lt(t){this._=t}function ys(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Lt.prototype=Ht.prototype={constructor:Lt,on:function(t,e){var n=this._,o=ys(t+"",n),i,s=-1,a=o.length;if(arguments.length<2){for(;++s<a;)if((i=(t=o[s]).type)&&(i=vs(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(i=(t=o[s]).type)n[i]=zo(n[i],t.name,e);else if(e==null)for(i in n)n[i]=zo(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Lt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,s;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],o=0,i=s.length;o<i;++o)s[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],i=0,s=o.length;i<s;++i)o[i].value.apply(e,n)}};function vs(t,e){for(var n=0,o=t.length,i;n<o;++n)if((i=t[n]).name===e)return i.value}function zo(t,e,n){for(var o=0,i=t.length;o<i;++o)if(t[o].name===e){t[o]=ms,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var Pn="http://www.w3.org/1999/xhtml",Ro={svg:"http://www.w3.org/2000/svg",xhtml:Pn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ft(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Ro.hasOwnProperty(e)?{space:Ro[e],local:t}:t}function _s(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Pn&&e.documentElement.namespaceURI===Pn?e.createElement(t):e.createElementNS(n,t)}}function ws(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ao(t){var e=Ft(t);return(e.local?ws:_s)(e)}function bs(){}function On(t){return t==null?bs:function(){return this.querySelector(t)}}function Cs(t){typeof t!="function"&&(t=On(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=o[i]=new Array(a),d,c,u=0;u<a;++u)(d=s[u])&&(c=t.call(d,d.__data__,u,s))&&("__data__"in d&&(c.__data__=d.__data__),l[u]=c);return new Ne(o,this._parents)}function Es(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function xs(){return[]}function $o(t){return t==null?xs:function(){return this.querySelectorAll(t)}}function Ns(t){return function(){return Es(t.apply(this,arguments))}}function ks(t){typeof t=="function"?t=Ns(t):t=$o(t);for(var e=this._groups,n=e.length,o=[],i=[],s=0;s<n;++s)for(var a=e[s],l=a.length,d,c=0;c<l;++c)(d=a[c])&&(o.push(t.call(d,d.__data__,c,a)),i.push(d));return new Ne(o,i)}function Po(t){return function(){return this.matches(t)}}function Oo(t){return function(e){return e.matches(t)}}var Ss=Array.prototype.find;function Ds(t){return function(){return Ss.call(this.children,t)}}function Ts(){return this.firstElementChild}function Ms(t){return this.select(t==null?Ts:Ds(typeof t=="function"?t:Oo(t)))}var Is=Array.prototype.filter;function Bs(){return Array.from(this.children)}function zs(t){return function(){return Is.call(this.children,t)}}function Rs(t){return this.selectAll(t==null?Bs:zs(typeof t=="function"?t:Oo(t)))}function As(t){typeof t!="function"&&(t=Po(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=o[i]=[],d,c=0;c<a;++c)(d=s[c])&&t.call(d,d.__data__,c,s)&&l.push(d);return new Ne(o,this._parents)}function Vo(t){return new Array(t.length)}function $s(){return new Ne(this._enter||this._groups.map(Vo),this._parents)}function Gt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Gt.prototype={constructor:Gt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Ps(t){return function(){return t}}function Os(t,e,n,o,i,s){for(var a=0,l,d=e.length,c=s.length;a<c;++a)(l=e[a])?(l.__data__=s[a],o[a]=l):n[a]=new Gt(t,s[a]);for(;a<d;++a)(l=e[a])&&(i[a]=l)}function Vs(t,e,n,o,i,s,a){var l,d,c=new Map,u=e.length,h=s.length,f=new Array(u),g;for(l=0;l<u;++l)(d=e[l])&&(f[l]=g=a.call(d,d.__data__,l,e)+"",c.has(g)?i[l]=d:c.set(g,d));for(l=0;l<h;++l)g=a.call(t,s[l],l,s)+"",(d=c.get(g))?(o[l]=d,d.__data__=s[l],c.delete(g)):n[l]=new Gt(t,s[l]);for(l=0;l<u;++l)(d=e[l])&&c.get(f[l])===d&&(i[l]=d)}function Hs(t){return t.__data__}function Ls(t,e){if(!arguments.length)return Array.from(this,Hs);var n=e?Vs:Os,o=this._parents,i=this._groups;typeof t!="function"&&(t=Ps(t));for(var s=i.length,a=new Array(s),l=new Array(s),d=new Array(s),c=0;c<s;++c){var u=o[c],h=i[c],f=h.length,g=Fs(t.call(u,u&&u.__data__,c,o)),m=g.length,E=l[c]=new Array(m),S=a[c]=new Array(m);n(u,h,E,S,d[c]=new Array(f),g,e);for(var D=0,B=0,w,M;D<m;++D)if(w=E[D]){for(D>=B&&(B=D+1);!(M=S[B])&&++B<m;);w._next=M||null}}return a=new Ne(a,o),a._enter=l,a._exit=d,a}function Fs(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Gs(){return new Ne(this._exit||this._groups.map(Vo),this._parents)}function Ws(t,e,n){var o=this.enter(),i=this,s=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?s.remove():n(s),o&&i?o.merge(i).order():i}function Us(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,i=n.length,s=o.length,a=Math.min(i,s),l=new Array(i),d=0;d<a;++d)for(var c=n[d],u=o[d],h=c.length,f=l[d]=new Array(h),g,m=0;m<h;++m)(g=c[m]||u[m])&&(f[m]=g);for(;d<i;++d)l[d]=n[d];return new Ne(l,this._parents)}function Ys(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],i=o.length-1,s=o[i],a;--i>=0;)(a=o[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function Xs(t){t||(t=js);function e(h,f){return h&&f?t(h.__data__,f.__data__):!h-!f}for(var n=this._groups,o=n.length,i=new Array(o),s=0;s<o;++s){for(var a=n[s],l=a.length,d=i[s]=new Array(l),c,u=0;u<l;++u)(c=a[u])&&(d[u]=c);d.sort(e)}return new Ne(i,this._parents).order()}function js(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Zs(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Ks(){return Array.from(this)}function qs(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,s=o.length;i<s;++i){var a=o[i];if(a)return a}return null}function Js(){let t=0;for(const e of this)++t;return t}function Qs(){return!this.node()}function ea(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],s=0,a=i.length,l;s<a;++s)(l=i[s])&&t.call(l,l.__data__,s,i);return this}function ta(t){return function(){this.removeAttribute(t)}}function na(t){return function(){this.removeAttributeNS(t.space,t.local)}}function oa(t,e){return function(){this.setAttribute(t,e)}}function ia(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ra(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function sa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function aa(t,e){var n=Ft(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?na:ta:typeof e=="function"?n.local?sa:ra:n.local?ia:oa)(n,e))}function Ho(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function la(t){return function(){this.style.removeProperty(t)}}function ca(t,e,n){return function(){this.style.setProperty(t,e,n)}}function da(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function ua(t,e,n){return arguments.length>1?this.each((e==null?la:typeof e=="function"?da:ca)(t,e,n??"")):at(this.node(),t)}function at(t,e){return t.style.getPropertyValue(e)||Ho(t).getComputedStyle(t,null).getPropertyValue(e)}function fa(t){return function(){delete this[t]}}function ha(t,e){return function(){this[t]=e}}function ga(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function pa(t,e){return arguments.length>1?this.each((e==null?fa:typeof e=="function"?ga:ha)(t,e)):this.node()[t]}function Lo(t){return t.trim().split(/^|\s+/)}function Vn(t){return t.classList||new Fo(t)}function Fo(t){this._node=t,this._names=Lo(t.getAttribute("class")||"")}Fo.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Go(t,e){for(var n=Vn(t),o=-1,i=e.length;++o<i;)n.add(e[o])}function Wo(t,e){for(var n=Vn(t),o=-1,i=e.length;++o<i;)n.remove(e[o])}function ma(t){return function(){Go(this,t)}}function ya(t){return function(){Wo(this,t)}}function va(t,e){return function(){(e.apply(this,arguments)?Go:Wo)(this,t)}}function _a(t,e){var n=Lo(t+"");if(arguments.length<2){for(var o=Vn(this.node()),i=-1,s=n.length;++i<s;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?va:e?ma:ya)(n,e))}function wa(){this.textContent=""}function ba(t){return function(){this.textContent=t}}function Ca(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ea(t){return arguments.length?this.each(t==null?wa:(typeof t=="function"?Ca:ba)(t)):this.node().textContent}function xa(){this.innerHTML=""}function Na(t){return function(){this.innerHTML=t}}function ka(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Sa(t){return arguments.length?this.each(t==null?xa:(typeof t=="function"?ka:Na)(t)):this.node().innerHTML}function Da(){this.nextSibling&&this.parentNode.appendChild(this)}function Ta(){return this.each(Da)}function Ma(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ia(){return this.each(Ma)}function Ba(t){var e=typeof t=="function"?t:Ao(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function za(){return null}function Ra(t,e){var n=typeof t=="function"?t:Ao(t),o=e==null?za:typeof e=="function"?e:On(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Aa(){var t=this.parentNode;t&&t.removeChild(this)}function $a(){return this.each(Aa)}function Pa(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Oa(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Va(t){return this.select(t?Oa:Pa)}function Ha(t){return arguments.length?this.property("__data__",t):this.node().__data__}function La(t){return function(e){t.call(this,e,this.__data__)}}function Fa(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function Ga(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,i=e.length,s;n<i;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++o]=s;++o?e.length=o:delete this.__on}}}function Wa(t,e,n){return function(){var o=this.__on,i,s=La(e);if(o){for(var a=0,l=o.length;a<l;++a)if((i=o[a]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=e;return}}this.addEventListener(t.type,s,n),i={type:t.type,name:t.name,value:e,listener:s,options:n},o?o.push(i):this.__on=[i]}}function Ua(t,e,n){var o=Fa(t+""),i,s=o.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var d=0,c=l.length,u;d<c;++d)for(i=0,u=l[d];i<s;++i)if((a=o[i]).type===u.type&&a.name===u.name)return u.value}return}for(l=e?Wa:Ga,i=0;i<s;++i)this.each(l(o[i],e,n));return this}function Uo(t,e,n){var o=Ho(t),i=o.CustomEvent;typeof i=="function"?i=new i(e,n):(i=o.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Ya(t,e){return function(){return Uo(this,t,e)}}function Xa(t,e){return function(){return Uo(this,t,e.apply(this,arguments))}}function ja(t,e){return this.each((typeof e=="function"?Xa:Ya)(t,e))}function*Za(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,s=o.length,a;i<s;++i)(a=o[i])&&(yield a)}var Yo=[null];function Ne(t,e){this._groups=t,this._parents=e}function wt(){return new Ne([[document.documentElement]],Yo)}function Ka(){return this}Ne.prototype=wt.prototype={constructor:Ne,select:Cs,selectAll:ks,selectChild:Ms,selectChildren:Rs,filter:As,data:Ls,enter:$s,exit:Gs,join:Ws,merge:Us,selection:Ka,order:Ys,sort:Xs,call:Zs,nodes:Ks,node:qs,size:Js,empty:Qs,each:ea,attr:aa,style:ua,property:pa,classed:_a,text:Ea,html:Sa,raise:Ta,lower:Ia,append:Ba,insert:Ra,remove:$a,clone:Va,datum:Ha,on:Ua,dispatch:ja,[Symbol.iterator]:Za};function Te(t){return typeof t=="string"?new Ne([[document.querySelector(t)]],[document.documentElement]):new Ne([[t]],Yo)}function qa(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ze(t,e){if(t=qa(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var Ja={passive:!1},bt={capture:!0,passive:!1};function Hn(t){t.stopImmediatePropagation()}function lt(t){t.preventDefault(),t.stopImmediatePropagation()}function Xo(t){var e=t.document.documentElement,n=Te(t).on("dragstart.drag",lt,bt);"onselectstart"in e?n.on("selectstart.drag",lt,bt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function jo(t,e){var n=t.document.documentElement,o=Te(t).on("dragstart.drag",null);e&&(o.on("click.drag",lt,bt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Wt=t=>()=>t;function Ln(t,{sourceEvent:e,subject:n,target:o,identifier:i,active:s,x:a,y:l,dx:d,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Ln.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Qa(t){return!t.ctrlKey&&!t.button}function el(){return this.parentNode}function tl(t,e){return e??{x:t.x,y:t.y}}function nl(){return navigator.maxTouchPoints||"ontouchstart"in this}function ol(){var t=Qa,e=el,n=tl,o=nl,i={},s=Ht("start","drag","end"),a=0,l,d,c,u,h=0;function f(M){M.on("mousedown.drag",g).filter(o).on("touchstart.drag",S).on("touchmove.drag",D,Ja).on("touchend.drag touchcancel.drag",B).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(M,G){if(!(u||!t.call(this,M,G))){var R=w(this,e.call(this,M,G),M,G,"mouse");R&&(Te(M.view).on("mousemove.drag",m,bt).on("mouseup.drag",E,bt),Xo(M.view),Hn(M),c=!1,l=M.clientX,d=M.clientY,R("start",M))}}function m(M){if(lt(M),!c){var G=M.clientX-l,R=M.clientY-d;c=G*G+R*R>h}i.mouse("drag",M)}function E(M){Te(M.view).on("mousemove.drag mouseup.drag",null),jo(M.view,c),lt(M),i.mouse("end",M)}function S(M,G){if(t.call(this,M,G)){var R=M.changedTouches,q=e.call(this,M,G),K=R.length,j,Z;for(j=0;j<K;++j)(Z=w(this,q,M,G,R[j].identifier,R[j]))&&(Hn(M),Z("start",M,R[j]))}}function D(M){var G=M.changedTouches,R=G.length,q,K;for(q=0;q<R;++q)(K=i[G[q].identifier])&&(lt(M),K("drag",M,G[q]))}function B(M){var G=M.changedTouches,R=G.length,q,K;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),q=0;q<R;++q)(K=i[G[q].identifier])&&(Hn(M),K("end",M,G[q]))}function w(M,G,R,q,K,j){var Z=s.copy(),F=ze(j||R,G),k,W,b;if((b=n.call(M,new Ln("beforestart",{sourceEvent:R,target:f,identifier:K,active:a,x:F[0],y:F[1],dx:0,dy:0,dispatch:Z}),q))!=null)return k=b.x-F[0]||0,W=b.y-F[1]||0,function P(v,N,I){var T=F,z;switch(v){case"start":i[K]=P,z=a++;break;case"end":delete i[K],--a;case"drag":F=ze(I||N,G),z=a;break}Z.call(v,M,new Ln(v,{sourceEvent:N,subject:b,target:f,identifier:K,active:z,x:F[0]+k,y:F[1]+W,dx:F[0]-T[0],dy:F[1]-T[1],dispatch:Z}),q)}}return f.filter=function(M){return arguments.length?(t=typeof M=="function"?M:Wt(!!M),f):t},f.container=function(M){return arguments.length?(e=typeof M=="function"?M:Wt(M),f):e},f.subject=function(M){return arguments.length?(n=typeof M=="function"?M:Wt(M),f):n},f.touchable=function(M){return arguments.length?(o=typeof M=="function"?M:Wt(!!M),f):o},f.on=function(){var M=s.on.apply(s,arguments);return M===s?f:M},f.clickDistance=function(M){return arguments.length?(h=(M=+M)*M,f):Math.sqrt(h)},f}function Fn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Zo(t,e){var n=Object.create(t.prototype);for(var o in e)n[o]=e[o];return n}function Ct(){}var Et=.7,Ut=1/Et,ct="\\s*([+-]?\\d+)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Re="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",il=/^#([0-9a-f]{3,8})$/,rl=new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`),sl=new RegExp(`^rgb\\(${Re},${Re},${Re}\\)$`),al=new RegExp(`^rgba\\(${ct},${ct},${ct},${xt}\\)$`),ll=new RegExp(`^rgba\\(${Re},${Re},${Re},${xt}\\)$`),cl=new RegExp(`^hsl\\(${xt},${Re},${Re}\\)$`),dl=new RegExp(`^hsla\\(${xt},${Re},${Re},${xt}\\)$`),Ko={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Fn(Ct,Je,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:qo,formatHex:qo,formatHex8:ul,formatHsl:fl,formatRgb:Jo,toString:Jo});function qo(){return this.rgb().formatHex()}function ul(){return this.rgb().formatHex8()}function fl(){return oi(this).formatHsl()}function Jo(){return this.rgb().formatRgb()}function Je(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=il.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Qo(e):n===3?new Ee(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Yt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Yt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=rl.exec(t))?new Ee(e[1],e[2],e[3],1):(e=sl.exec(t))?new Ee(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=al.exec(t))?Yt(e[1],e[2],e[3],e[4]):(e=ll.exec(t))?Yt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=cl.exec(t))?ni(e[1],e[2]/100,e[3]/100,1):(e=dl.exec(t))?ni(e[1],e[2]/100,e[3]/100,e[4]):Ko.hasOwnProperty(t)?Qo(Ko[t]):t==="transparent"?new Ee(NaN,NaN,NaN,0):null}function Qo(t){return new Ee(t>>16&255,t>>8&255,t&255,1)}function Yt(t,e,n,o){return o<=0&&(t=e=n=NaN),new Ee(t,e,n,o)}function hl(t){return t instanceof Ct||(t=Je(t)),t?(t=t.rgb(),new Ee(t.r,t.g,t.b,t.opacity)):new Ee}function Gn(t,e,n,o){return arguments.length===1?hl(t):new Ee(t,e,n,o??1)}function Ee(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}Fn(Ee,Gn,Zo(Ct,{brighter(t){return t=t==null?Ut:Math.pow(Ut,t),new Ee(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Et:Math.pow(Et,t),new Ee(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ee(Qe(this.r),Qe(this.g),Qe(this.b),Xt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ei,formatHex:ei,formatHex8:gl,formatRgb:ti,toString:ti}));function ei(){return`#${et(this.r)}${et(this.g)}${et(this.b)}`}function gl(){return`#${et(this.r)}${et(this.g)}${et(this.b)}${et((isNaN(this.opacity)?1:this.opacity)*255)}`}function ti(){const t=Xt(this.opacity);return`${t===1?"rgb(":"rgba("}${Qe(this.r)}, ${Qe(this.g)}, ${Qe(this.b)}${t===1?")":`, ${t})`}`}function Xt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Qe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function et(t){return t=Qe(t),(t<16?"0":"")+t.toString(16)}function ni(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Me(t,e,n,o)}function oi(t){if(t instanceof Me)return new Me(t.h,t.s,t.l,t.opacity);if(t instanceof Ct||(t=Je(t)),!t)return new Me;if(t instanceof Me)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,i=Math.min(e,n,o),s=Math.max(e,n,o),a=NaN,l=s-i,d=(s+i)/2;return l?(e===s?a=(n-o)/l+(n<o)*6:n===s?a=(o-e)/l+2:a=(e-n)/l+4,l/=d<.5?s+i:2-s-i,a*=60):l=d>0&&d<1?0:a,new Me(a,l,d,t.opacity)}function pl(t,e,n,o){return arguments.length===1?oi(t):new Me(t,e,n,o??1)}function Me(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}Fn(Me,pl,Zo(Ct,{brighter(t){return t=t==null?Ut:Math.pow(Ut,t),new Me(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Et:Math.pow(Et,t),new Me(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,i=2*n-o;return new Ee(Wn(t>=240?t-240:t+120,i,o),Wn(t,i,o),Wn(t<120?t+240:t-120,i,o),this.opacity)},clamp(){return new Me(ii(this.h),jt(this.s),jt(this.l),Xt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Xt(this.opacity);return`${t===1?"hsl(":"hsla("}${ii(this.h)}, ${jt(this.s)*100}%, ${jt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ii(t){return t=(t||0)%360,t<0?t+360:t}function jt(t){return Math.max(0,Math.min(1,t||0))}function Wn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}var Un=t=>()=>t;function ml(t,e){return function(n){return t+n*e}}function yl(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function vl(t){return(t=+t)==1?ri:function(e,n){return n-e?yl(e,n,t):Un(isNaN(e)?n:e)}}function ri(t,e){var n=e-t;return n?ml(t,n):Un(isNaN(t)?e:t)}var Zt=(function t(e){var n=vl(e);function o(i,s){var a=n((i=Gn(i)).r,(s=Gn(s)).r),l=n(i.g,s.g),d=n(i.b,s.b),c=ri(i.opacity,s.opacity);return function(u){return i.r=a(u),i.g=l(u),i.b=d(u),i.opacity=c(u),i+""}}return o.gamma=t,o})(1);function _l(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),i;return function(s){for(i=0;i<n;++i)o[i]=t[i]*(1-s)+e[i]*s;return o}}function wl(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function bl(t,e){var n=e?e.length:0,o=t?Math.min(n,t.length):0,i=new Array(o),s=new Array(n),a;for(a=0;a<o;++a)i[a]=Nt(t[a],e[a]);for(;a<n;++a)s[a]=e[a];return function(l){for(a=0;a<o;++a)s[a]=i[a](l);return s}}function Cl(t,e){var n=new Date;return t=+t,e=+e,function(o){return n.setTime(t*(1-o)+e*o),n}}function Ae(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function El(t,e){var n={},o={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Nt(t[i],e[i]):o[i]=e[i];return function(s){for(i in n)o[i]=n[i](s);return o}}var Yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xn=new RegExp(Yn.source,"g");function xl(t){return function(){return t}}function Nl(t){return function(e){return t(e)+""}}function si(t,e){var n=Yn.lastIndex=Xn.lastIndex=0,o,i,s,a=-1,l=[],d=[];for(t=t+"",e=e+"";(o=Yn.exec(t))&&(i=Xn.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),l[a]?l[a]+=s:l[++a]=s),(o=o[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,d.push({i:a,x:Ae(o,i)})),n=Xn.lastIndex;return n<e.length&&(s=e.slice(n),l[a]?l[a]+=s:l[++a]=s),l.length<2?d[0]?Nl(d[0].x):xl(e):(e=d.length,function(c){for(var u=0,h;u<e;++u)l[(h=d[u]).i]=h.x(c);return l.join("")})}function Nt(t,e){var n=typeof e,o;return e==null||n==="boolean"?Un(e):(n==="number"?Ae:n==="string"?(o=Je(e))?(e=o,Zt):si:e instanceof Je?Zt:e instanceof Date?Cl:wl(e)?_l:Array.isArray(e)?bl:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?El:Ae)(t,e)}var ai=180/Math.PI,jn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function li(t,e,n,o,i,s){var a,l,d;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(d=t*n+e*o)&&(n-=t*d,o-=e*d),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,d/=l),t*o<e*n&&(t=-t,e=-e,d=-d,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*ai,skewX:Math.atan(d)*ai,scaleX:a,scaleY:l}}var Kt;function kl(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?jn:li(e.a,e.b,e.c,e.d,e.e,e.f)}function Sl(t){return t==null||(Kt||(Kt=document.createElementNS("http://www.w3.org/2000/svg","g")),Kt.setAttribute("transform",t),!(t=Kt.transform.baseVal.consolidate()))?jn:(t=t.matrix,li(t.a,t.b,t.c,t.d,t.e,t.f))}function ci(t,e,n,o){function i(c){return c.length?c.pop()+" ":""}function s(c,u,h,f,g,m){if(c!==h||u!==f){var E=g.push("translate(",null,e,null,n);m.push({i:E-4,x:Ae(c,h)},{i:E-2,x:Ae(u,f)})}else(h||f)&&g.push("translate("+h+e+f+n)}function a(c,u,h,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:h.push(i(h)+"rotate(",null,o)-2,x:Ae(c,u)})):u&&h.push(i(h)+"rotate("+u+o)}function l(c,u,h,f){c!==u?f.push({i:h.push(i(h)+"skewX(",null,o)-2,x:Ae(c,u)}):u&&h.push(i(h)+"skewX("+u+o)}function d(c,u,h,f,g,m){if(c!==h||u!==f){var E=g.push(i(g)+"scale(",null,",",null,")");m.push({i:E-4,x:Ae(c,h)},{i:E-2,x:Ae(u,f)})}else(h!==1||f!==1)&&g.push(i(g)+"scale("+h+","+f+")")}return function(c,u){var h=[],f=[];return c=t(c),u=t(u),s(c.translateX,c.translateY,u.translateX,u.translateY,h,f),a(c.rotate,u.rotate,h,f),l(c.skewX,u.skewX,h,f),d(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,f),c=u=null,function(g){for(var m=-1,E=f.length,S;++m<E;)h[(S=f[m]).i]=S.x(g);return h.join("")}}}var Dl=ci(kl,"px, ","px)","deg)"),Tl=ci(Sl,", ",")",")"),Ml=1e-12;function di(t){return((t=Math.exp(t))+1/t)/2}function Il(t){return((t=Math.exp(t))-1/t)/2}function Bl(t){return((t=Math.exp(2*t))-1)/(t+1)}var qt=(function t(e,n,o){function i(s,a){var l=s[0],d=s[1],c=s[2],u=a[0],h=a[1],f=a[2],g=u-l,m=h-d,E=g*g+m*m,S,D;if(E<Ml)D=Math.log(f/c)/e,S=function(R){return[l+R*g,d+R*m,c*Math.exp(e*R*D)]};else{var B=Math.sqrt(E),w=(f*f-c*c+o*E)/(2*c*n*B),M=(f*f-c*c-o*E)/(2*f*n*B),G=Math.log(Math.sqrt(w*w+1)-w);D=(Math.log(Math.sqrt(M*M+1)-M)-G)/e,S=function(R){var q=R*D,K=di(G),j=c/(n*B)*(K*Bl(e*q+G)-Il(G));return[l+j*g,d+j*m,c*K/di(e*q+G)]}}return S.duration=D*1e3*e/Math.SQRT2,S}return i.rho=function(s){var a=Math.max(.001,+s),l=a*a;return t(a,l,l*l)},i})(Math.SQRT2,2,4),dt=0,kt=0,St=0,ui=1e3,Jt,Dt,Qt=0,tt=0,en=0,Tt=typeof performance=="object"&&performance.now?performance:Date,fi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Zn(){return tt||(fi(zl),tt=Tt.now()+en)}function zl(){tt=0}function tn(){this._call=this._time=this._next=null}tn.prototype=hi.prototype={constructor:tn,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Zn():+n)+(e==null?0:+e),!this._next&&Dt!==this&&(Dt?Dt._next=this:Jt=this,Dt=this),this._call=t,this._time=n,Kn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kn())}};function hi(t,e,n){var o=new tn;return o.restart(t,e,n),o}function Rl(){Zn(),++dt;for(var t=Jt,e;t;)(e=tt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--dt}function gi(){tt=(Qt=Tt.now())+en,dt=kt=0;try{Rl()}finally{dt=0,$l(),tt=0}}function Al(){var t=Tt.now(),e=t-Qt;e>ui&&(en-=e,Qt=t)}function $l(){for(var t,e=Jt,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Jt=n);Dt=t,Kn(o)}function Kn(t){dt||(kt&&(kt=clearTimeout(kt)),t-tt>24?(t<1/0&&(kt=setTimeout(gi,t-Tt.now()-en)),St&&(St=clearInterval(St))):(St||(Qt=Tt.now(),St=setInterval(Al,ui)),dt=1,fi(gi)))}function pi(t,e,n){var o=new tn;return e=e==null?0:+e,o.restart(i=>{o.stop(),t(i+e)},e,n),o}var Pl=Ht("start","end","cancel","interrupt"),Ol=[],mi=0,yi=1,qn=2,nn=3,vi=4,Jn=5,on=6;function rn(t,e,n,o,i,s){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Vl(t,n,{name:e,index:o,group:i,on:Pl,tween:Ol,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:mi})}function Qn(t,e){var n=Ie(t,e);if(n.state>mi)throw new Error("too late; already scheduled");return n}function $e(t,e){var n=Ie(t,e);if(n.state>nn)throw new Error("too late; already running");return n}function Ie(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Vl(t,e,n){var o=t.__transition,i;o[e]=n,n.timer=hi(s,0,n.time);function s(c){n.state=yi,n.timer.restart(a,n.delay,n.time),n.delay<=c&&a(c-n.delay)}function a(c){var u,h,f,g;if(n.state!==yi)return d();for(u in o)if(g=o[u],g.name===n.name){if(g.state===nn)return pi(a);g.state===vi?(g.state=on,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete o[u]):+u<e&&(g.state=on,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete o[u])}if(pi(function(){n.state===nn&&(n.state=vi,n.timer.restart(l,n.delay,n.time),l(c))}),n.state=qn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===qn){for(n.state=nn,i=new Array(f=n.tween.length),u=0,h=-1;u<f;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++h]=g);i.length=h+1}}function l(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(d),n.state=Jn,1),h=-1,f=i.length;++h<f;)i[h].call(t,u);n.state===Jn&&(n.on.call("end",t,t.__data__,n.index,n.group),d())}function d(){n.state=on,n.timer.stop(),delete o[e];for(var c in o)return;delete t.__transition}}function sn(t,e){var n=t.__transition,o,i,s=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((o=n[a]).name!==e){s=!1;continue}i=o.state>qn&&o.state<Jn,o.state=on,o.timer.stop(),o.on.call(i?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[a]}s&&delete t.__transition}}function Hl(t){return this.each(function(){sn(this,t)})}function Ll(t,e){var n,o;return function(){var i=$e(this,t),s=i.tween;if(s!==n){o=n=s;for(var a=0,l=o.length;a<l;++a)if(o[a].name===e){o=o.slice(),o.splice(a,1);break}}i.tween=o}}function Fl(t,e,n){var o,i;if(typeof n!="function")throw new Error;return function(){var s=$e(this,t),a=s.tween;if(a!==o){i=(o=a).slice();for(var l={name:e,value:n},d=0,c=i.length;d<c;++d)if(i[d].name===e){i[d]=l;break}d===c&&i.push(l)}s.tween=i}}function Gl(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=Ie(this.node(),n).tween,i=0,s=o.length,a;i<s;++i)if((a=o[i]).name===t)return a.value;return null}return this.each((e==null?Ll:Fl)(n,t,e))}function eo(t,e,n){var o=t._id;return t.each(function(){var i=$e(this,o);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return Ie(i,o).value[e]}}function _i(t,e){var n;return(typeof e=="number"?Ae:e instanceof Je?Zt:(n=Je(e))?(e=n,Zt):si)(t,e)}function Wl(t){return function(){this.removeAttribute(t)}}function Ul(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yl(t,e,n){var o,i=n+"",s;return function(){var a=this.getAttribute(t);return a===i?null:a===o?s:s=e(o=a,n)}}function Xl(t,e,n){var o,i=n+"",s;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===o?s:s=e(o=a,n)}}function jl(t,e,n){var o,i,s;return function(){var a,l=n(this),d;return l==null?void this.removeAttribute(t):(a=this.getAttribute(t),d=l+"",a===d?null:a===o&&d===i?s:(i=d,s=e(o=a,l)))}}function Zl(t,e,n){var o,i,s;return function(){var a,l=n(this),d;return l==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),d=l+"",a===d?null:a===o&&d===i?s:(i=d,s=e(o=a,l)))}}function Kl(t,e){var n=Ft(t),o=n==="transform"?Tl:_i;return this.attrTween(t,typeof e=="function"?(n.local?Zl:jl)(n,o,eo(this,"attr."+t,e)):e==null?(n.local?Ul:Wl)(n):(n.local?Xl:Yl)(n,o,e))}function ql(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Jl(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Ql(t,e){var n,o;function i(){var s=e.apply(this,arguments);return s!==o&&(n=(o=s)&&Jl(t,s)),n}return i._value=e,i}function ec(t,e){var n,o;function i(){var s=e.apply(this,arguments);return s!==o&&(n=(o=s)&&ql(t,s)),n}return i._value=e,i}function tc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=Ft(t);return this.tween(n,(o.local?Ql:ec)(o,e))}function nc(t,e){return function(){Qn(this,t).delay=+e.apply(this,arguments)}}function oc(t,e){return e=+e,function(){Qn(this,t).delay=e}}function ic(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?nc:oc)(e,t)):Ie(this.node(),e).delay}function rc(t,e){return function(){$e(this,t).duration=+e.apply(this,arguments)}}function sc(t,e){return e=+e,function(){$e(this,t).duration=e}}function ac(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?rc:sc)(e,t)):Ie(this.node(),e).duration}function lc(t,e){if(typeof e!="function")throw new Error;return function(){$e(this,t).ease=e}}function cc(t){var e=this._id;return arguments.length?this.each(lc(e,t)):Ie(this.node(),e).ease}function dc(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;$e(this,t).ease=n}}function uc(t){if(typeof t!="function")throw new Error;return this.each(dc(this._id,t))}function fc(t){typeof t!="function"&&(t=Po(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=o[i]=[],d,c=0;c<a;++c)(d=s[c])&&t.call(d,d.__data__,c,s)&&l.push(d);return new Ve(o,this._parents,this._name,this._id)}function hc(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,i=n.length,s=Math.min(o,i),a=new Array(o),l=0;l<s;++l)for(var d=e[l],c=n[l],u=d.length,h=a[l]=new Array(u),f,g=0;g<u;++g)(f=d[g]||c[g])&&(h[g]=f);for(;l<o;++l)a[l]=e[l];return new Ve(a,this._parents,this._name,this._id)}function gc(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function pc(t,e,n){var o,i,s=gc(e)?Qn:$e;return function(){var a=s(this,t),l=a.on;l!==o&&(i=(o=l).copy()).on(e,n),a.on=i}}function mc(t,e){var n=this._id;return arguments.length<2?Ie(this.node(),n).on.on(t):this.each(pc(n,t,e))}function yc(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function vc(){return this.on("end.remove",yc(this._id))}function _c(t){var e=this._name,n=this._id;typeof t!="function"&&(t=On(t));for(var o=this._groups,i=o.length,s=new Array(i),a=0;a<i;++a)for(var l=o[a],d=l.length,c=s[a]=new Array(d),u,h,f=0;f<d;++f)(u=l[f])&&(h=t.call(u,u.__data__,f,l))&&("__data__"in u&&(h.__data__=u.__data__),c[f]=h,rn(c[f],e,n,f,c,Ie(u,n)));return new Ve(s,this._parents,e,n)}function wc(t){var e=this._name,n=this._id;typeof t!="function"&&(t=$o(t));for(var o=this._groups,i=o.length,s=[],a=[],l=0;l<i;++l)for(var d=o[l],c=d.length,u,h=0;h<c;++h)if(u=d[h]){for(var f=t.call(u,u.__data__,h,d),g,m=Ie(u,n),E=0,S=f.length;E<S;++E)(g=f[E])&&rn(g,e,n,E,f,m);s.push(f),a.push(u)}return new Ve(s,a,e,n)}var bc=wt.prototype.constructor;function Cc(){return new bc(this._groups,this._parents)}function Ec(t,e){var n,o,i;return function(){var s=at(this,t),a=(this.style.removeProperty(t),at(this,t));return s===a?null:s===n&&a===o?i:i=e(n=s,o=a)}}function wi(t){return function(){this.style.removeProperty(t)}}function xc(t,e,n){var o,i=n+"",s;return function(){var a=at(this,t);return a===i?null:a===o?s:s=e(o=a,n)}}function Nc(t,e,n){var o,i,s;return function(){var a=at(this,t),l=n(this),d=l+"";return l==null&&(d=l=(this.style.removeProperty(t),at(this,t))),a===d?null:a===o&&d===i?s:(i=d,s=e(o=a,l))}}function kc(t,e){var n,o,i,s="style."+e,a="end."+s,l;return function(){var d=$e(this,t),c=d.on,u=d.value[s]==null?l||(l=wi(e)):void 0;(c!==n||i!==u)&&(o=(n=c).copy()).on(a,i=u),d.on=o}}function Sc(t,e,n){var o=(t+="")=="transform"?Dl:_i;return e==null?this.styleTween(t,Ec(t,o)).on("end.style."+t,wi(t)):typeof e=="function"?this.styleTween(t,Nc(t,o,eo(this,"style."+t,e))).each(kc(this._id,t)):this.styleTween(t,xc(t,o,e),n).on("end.style."+t,null)}function Dc(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function Tc(t,e,n){var o,i;function s(){var a=e.apply(this,arguments);return a!==i&&(o=(i=a)&&Dc(t,a,n)),o}return s._value=e,s}function Mc(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,Tc(t,e,n??""))}function Ic(t){return function(){this.textContent=t}}function Bc(t){return function(){var e=t(this);this.textContent=e??""}}function zc(t){return this.tween("text",typeof t=="function"?Bc(eo(this,"text",t)):Ic(t==null?"":t+""))}function Rc(t){return function(e){this.textContent=t.call(this,e)}}function Ac(t){var e,n;function o(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Rc(i)),e}return o._value=t,o}function $c(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Ac(t))}function Pc(){for(var t=this._name,e=this._id,n=bi(),o=this._groups,i=o.length,s=0;s<i;++s)for(var a=o[s],l=a.length,d,c=0;c<l;++c)if(d=a[c]){var u=Ie(d,e);rn(d,t,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ve(o,this._parents,t,n)}function Oc(){var t,e,n=this,o=n._id,i=n.size();return new Promise(function(s,a){var l={value:a},d={value:function(){--i===0&&s()}};n.each(function(){var c=$e(this,o),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(d)),c.on=e}),i===0&&s()})}var Vc=0;function Ve(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function bi(){return++Vc}var He=wt.prototype;Ve.prototype={constructor:Ve,select:_c,selectAll:wc,selectChild:He.selectChild,selectChildren:He.selectChildren,filter:fc,merge:hc,selection:Cc,transition:Pc,call:He.call,nodes:He.nodes,node:He.node,size:He.size,empty:He.empty,each:He.each,on:mc,attr:Kl,attrTween:tc,style:Sc,styleTween:Mc,text:zc,textTween:$c,remove:vc,tween:Gl,delay:ic,duration:ac,ease:cc,easeVarying:uc,end:Oc,[Symbol.iterator]:He[Symbol.iterator]};function Hc(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Lc={time:null,delay:0,duration:250,ease:Hc};function Fc(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Gc(t){var e,n;t instanceof Ve?(e=t._id,t=t._name):(e=bi(),(n=Lc).time=Zn(),t=t==null?null:t+"");for(var o=this._groups,i=o.length,s=0;s<i;++s)for(var a=o[s],l=a.length,d,c=0;c<l;++c)(d=a[c])&&rn(d,t,e,c,a,n||Fc(d,e));return new Ve(o,this._parents,t,e)}wt.prototype.interrupt=Hl,wt.prototype.transition=Gc;var an=t=>()=>t;function Wc(t,{sourceEvent:e,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function Le(t,e,n){this.k=t,this.x=e,this.y=n}Le.prototype={constructor:Le,scale:function(t){return t===1?this:new Le(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Le(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ut=new Le(1,0,0);Le.prototype;function to(t){t.stopImmediatePropagation()}function Mt(t){t.preventDefault(),t.stopImmediatePropagation()}function Uc(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Yc(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Ci(){return this.__zoom||ut}function Xc(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function jc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Zc(t,e,n){var o=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Kc(){var t=Uc,e=Yc,n=Zc,o=Xc,i=jc,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,d=qt,c=Ht("start","zoom","end"),u,h,f,g=500,m=150,E=0,S=10;function D(b){b.property("__zoom",Ci).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",Z).filter(i).on("touchstart.zoom",F).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}D.transform=function(b,P,v,N){var I=b.selection?b.selection():b;I.property("__zoom",Ci),b!==I?G(b,P,v,N):I.interrupt().each(function(){R(this,arguments).event(N).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},D.scaleBy=function(b,P,v,N){D.scaleTo(b,function(){return this.__zoom.k*(typeof P=="function"?P.apply(this,arguments):P)},v,N)},D.scaleTo=function(b,P,v,N){D.transform(b,function(){var I=e.apply(this,arguments),T=this.__zoom,z=v==null?M(I):typeof v=="function"?v.apply(this,arguments):v,O=T.invert(z),L=typeof P=="function"?P.apply(this,arguments):P;return n(w(B(T,L),z,O),I,a)},v,N)},D.translateBy=function(b,P,v,N){D.transform(b,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof v=="function"?v.apply(this,arguments):v),e.apply(this,arguments),a)},null,N)},D.translateTo=function(b,P,v,N,I){D.transform(b,function(){var T=e.apply(this,arguments),z=this.__zoom,O=N==null?M(T):typeof N=="function"?N.apply(this,arguments):N;return n(ut.translate(O[0],O[1]).scale(z.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof v=="function"?-v.apply(this,arguments):-v),T,a)},N,I)};function B(b,P){return P=Math.max(s[0],Math.min(s[1],P)),P===b.k?b:new Le(P,b.x,b.y)}function w(b,P,v){var N=P[0]-v[0]*b.k,I=P[1]-v[1]*b.k;return N===b.x&&I===b.y?b:new Le(b.k,N,I)}function M(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function G(b,P,v,N){b.on("start.zoom",function(){R(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(N).end()}).tween("zoom",function(){var I=this,T=arguments,z=R(I,T).event(N),O=e.apply(I,T),L=v==null?M(O):typeof v=="function"?v.apply(I,T):v,ee=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),se=I.__zoom,V=typeof P=="function"?P.apply(I,T):P,X=d(se.invert(L).concat(ee/se.k),V.invert(L).concat(ee/V.k));return function(A){if(A===1)A=V;else{var U=X(A),te=ee/U[2];A=new Le(te,L[0]-U[0]*te,L[1]-U[1]*te)}z.zoom(null,A)}})}function R(b,P,v){return!v&&b.__zooming||new q(b,P)}function q(b,P){this.that=b,this.args=P,this.active=0,this.sourceEvent=null,this.extent=e.apply(b,P),this.taps=0}q.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,P){return this.mouse&&b!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var P=Te(this.that).datum();c.call(b,this.that,new Wc(b,{sourceEvent:this.sourceEvent,target:D,type:b,transform:this.that.__zoom,dispatch:c}),P)}};function K(b,...P){if(!t.apply(this,arguments))return;var v=R(this,P).event(b),N=this.__zoom,I=Math.max(s[0],Math.min(s[1],N.k*Math.pow(2,o.apply(this,arguments)))),T=ze(b);if(v.wheel)(v.mouse[0][0]!==T[0]||v.mouse[0][1]!==T[1])&&(v.mouse[1]=N.invert(v.mouse[0]=T)),clearTimeout(v.wheel);else{if(N.k===I)return;v.mouse=[T,N.invert(T)],sn(this),v.start()}Mt(b),v.wheel=setTimeout(z,m),v.zoom("mouse",n(w(B(N,I),v.mouse[0],v.mouse[1]),v.extent,a));function z(){v.wheel=null,v.end()}}function j(b,...P){if(f||!t.apply(this,arguments))return;var v=b.currentTarget,N=R(this,P,!0).event(b),I=Te(b.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",ee,!0),T=ze(b,v),z=b.clientX,O=b.clientY;Xo(b.view),to(b),N.mouse=[T,this.__zoom.invert(T)],sn(this),N.start();function L(se){if(Mt(se),!N.moved){var V=se.clientX-z,X=se.clientY-O;N.moved=V*V+X*X>E}N.event(se).zoom("mouse",n(w(N.that.__zoom,N.mouse[0]=ze(se,v),N.mouse[1]),N.extent,a))}function ee(se){I.on("mousemove.zoom mouseup.zoom",null),jo(se.view,N.moved),Mt(se),N.event(se).end()}}function Z(b,...P){if(t.apply(this,arguments)){var v=this.__zoom,N=ze(b.changedTouches?b.changedTouches[0]:b,this),I=v.invert(N),T=v.k*(b.shiftKey?.5:2),z=n(w(B(v,T),N,I),e.apply(this,P),a);Mt(b),l>0?Te(this).transition().duration(l).call(G,z,N,b):Te(this).call(D.transform,z,N,b)}}function F(b,...P){if(t.apply(this,arguments)){var v=b.touches,N=v.length,I=R(this,P,b.changedTouches.length===N).event(b),T,z,O,L;for(to(b),z=0;z<N;++z)O=v[z],L=ze(O,this),L=[L,this.__zoom.invert(L),O.identifier],I.touch0?!I.touch1&&I.touch0[2]!==L[2]&&(I.touch1=L,I.taps=0):(I.touch0=L,T=!0,I.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(I.taps<2&&(h=L[0],u=setTimeout(function(){u=null},g)),sn(this),I.start())}}function k(b,...P){if(this.__zooming){var v=R(this,P).event(b),N=b.changedTouches,I=N.length,T,z,O,L;for(Mt(b),T=0;T<I;++T)z=N[T],O=ze(z,this),v.touch0&&v.touch0[2]===z.identifier?v.touch0[0]=O:v.touch1&&v.touch1[2]===z.identifier&&(v.touch1[0]=O);if(z=v.that.__zoom,v.touch1){var ee=v.touch0[0],se=v.touch0[1],V=v.touch1[0],X=v.touch1[1],A=(A=V[0]-ee[0])*A+(A=V[1]-ee[1])*A,U=(U=X[0]-se[0])*U+(U=X[1]-se[1])*U;z=B(z,Math.sqrt(A/U)),O=[(ee[0]+V[0])/2,(ee[1]+V[1])/2],L=[(se[0]+X[0])/2,(se[1]+X[1])/2]}else if(v.touch0)O=v.touch0[0],L=v.touch0[1];else return;v.zoom("touch",n(w(z,O,L),v.extent,a))}}function W(b,...P){if(this.__zooming){var v=R(this,P).event(b),N=b.changedTouches,I=N.length,T,z;for(to(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),T=0;T<I;++T)z=N[T],v.touch0&&v.touch0[2]===z.identifier?delete v.touch0:v.touch1&&v.touch1[2]===z.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(z=ze(z,this),Math.hypot(h[0]-z[0],h[1]-z[1])<S)){var O=Te(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return D.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:an(+b),D):o},D.filter=function(b){return arguments.length?(t=typeof b=="function"?b:an(!!b),D):t},D.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:an(!!b),D):i},D.extent=function(b){return arguments.length?(e=typeof b=="function"?b:an([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),D):e},D.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],D):[s[0],s[1]]},D.translateExtent=function(b){return arguments.length?(a[0][0]=+b[0][0],a[1][0]=+b[1][0],a[0][1]=+b[0][1],a[1][1]=+b[1][1],D):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},D.constrain=function(b){return arguments.length?(n=b,D):n},D.duration=function(b){return arguments.length?(l=+b,D):l},D.interpolate=function(b){return arguments.length?(d=b,D):d},D.on=function(){var b=c.on.apply(c,arguments);return b===c?D:b},D.clickDistance=function(b){return arguments.length?(E=(b=+b)*b,D):Math.sqrt(E)},D.tapDistance=function(b){return arguments.length?(S=+b,D):S},D}var ae=(t=>(t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom",t))(ae||{}),no=(t=>(t.Partial="partial",t.Full="full",t))(no||{}),nt=(t=>(t.Bezier="default",t.SimpleBezier="simple-bezier",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t))(nt||{}),Fe=(t=>(t.Strict="strict",t.Loose="loose",t))(Fe||{}),Ge=(t=>(t.Arrow="arrow",t.ArrowClosed="arrowclosed",t))(Ge||{}),It=(t=>(t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal",t))(It||{}),Ei=(t=>(t.TopLeft="top-left",t.TopCenter="top-center",t.TopRight="top-right",t.BottomLeft="bottom-left",t.BottomCenter="bottom-center",t.BottomRight="bottom-right",t))(Ei||{}),qc=["INPUT","SELECT","TEXTAREA"],Jc=typeof document<"u"?document:null;function oo(t){var e,n;const o=((n=(e=t.composedPath)==null?void 0:e.call(t))==null?void 0:n[0])||t.target,i=typeof o?.hasAttribute=="function"?o.hasAttribute("contenteditable"):!1,s=typeof o?.closest=="function"?o.closest(".nokey"):null;return qc.includes(o?.nodeName)||i||!!s}function Qc(t){return t.ctrlKey||t.metaKey||t.shiftKey||t.altKey}function xi(t,e,n,o){const i=e.replace("+",`
1
+ (function(me,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@a2simcode/ui")):typeof define=="function"&&define.amd?define(["exports","vue","@a2simcode/ui"],r):(me=typeof globalThis<"u"?globalThis:me||self,r(me.DuiUI={},me.Vue,me.SimCodeUI))})(this,function(me,r,qe){Object.defineProperties(me,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Je=(t,e)=>(t.install=n=>{n.component(t.name,t),e&&e.forEach(o=>{n.component(o.name,o)})},t),st=(t="")=>{const e=Date.now(),n=Math.floor(Math.random()*1e9);return t===""?String(n)+String(e):t+"_"+n+String(e)},Dn=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Dn);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=Dn(t[n]));return e},Xr=t=>{if(Array.isArray(t))t.length=0;else if(t&&typeof t=="object")for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&delete t[e]},Tn={},jr=(t,e,n)=>{n[t]=n[t]||{};const o=st();return n[t][o]=e,o},Zr=(t,e,n)=>{const o=[],i=n[t]||{};return Object.keys(i).forEach(s=>{const a=i[s];try{a&&o.push(a(e))}catch(l){console.error(l)}}),o},Kr=(t,e,n)=>{if(e){const o=n[t];o&&delete o[e]}else delete n[t]},No=(t,e)=>jr(t,e,Tn),ye=(t,e)=>Zr(t,e,Tn),qr=(t,e)=>{Kr(t,e,Tn)},ko=(t,e,n,o,i,s)=>{const a=e.id,l=e.level,{getDesignLocals:d,selectComponent:c,getComponent:u,isMyChildComponent:h,addComponent:f,deleteComponent:g,getParentComponents:p,removeComponentFromContainer:b,addComponentToContainer:S,copyComponent:D,activedComponent:z,top:v}=(0,r.inject)("d-drag-design-provide",{}),M=[],U=(0,r.ref)(!1),$=(0,r.ref)(!1),Q=(0,r.ref)(!1),q=(0,r.ref)(!1),j=(0,r.ref)(!1),K={id:"",type:""},G=(0,r.ref)(!1),k=(0,r.ref)(!1);let Y="",w=null;const V=P=>{if(Y===P)return w;Y=P;const{top:X,left:ne,width:ie,height:le}=t.value.getBoundingClientRect();return w=[{x:ne,y:X},{x:ne+ie,y:X},{x:ne+ie,y:X+le},{x:ne,y:X+le}],w},m=(P,X,ne)=>{let ie=X-ne[0].y;ie<0&&(ie=-ie);let le=X-ne[3].y;le<0&&(le=-le);let ee=P-ne[0].x;ee<0&&(ee=-ee);let re=P-ne[1].x;return re<0&&(re=-re),{ly:ie>le?le:ie,typey:ie>le?"bottom":"top",lx:ee>re?re:ee,lallx:ee+re}},E=(P,X,ne)=>P>=ne[0].x&&P<=ne[1].x&&X>=ne[0].y&&X<=ne[3].y,B=()=>{if(i){ye("dragClick",{id:a});return}if(!$.value){if(c(a),l!==0){const P=t.value.getBoundingClientRect(),X=d();P.top-X.top<22?q.value=!0:q.value=!1}$.value=!0,ye("dragClick",{id:a})}},T=P=>{const X=g(P);X&&(0,r.nextTick)(()=>{ye("dragClick",{id:X})})},A=()=>{K.id="",K.type="",l===0&&(j.value=!1)},H=()=>{ye("mouseEnterOrLeave",{id:a,type:"enter"})},F=()=>{ye("mouseEnterOrLeave",{id:a,type:"leave"})},te=P=>{ye("dragClick",{id:P})},se={mouseEnterOrLeave:({id:P,type:X})=>{X==="enter"?M.push(P):M.length>0&&M.splice(M.length-1,1);const ne=M.length;ne>0&&a===M[ne-1]?U.value=!0:U.value=!1},dragAciveChild:({type:P,id:X})=>{X===a?P==="top"?(G.value=!0,k.value=!1):(k.value=!0,G.value=!1):(k.value=!1,G.value=!1)},dragClick({id:P,isAgain:X}){console.log("dragClick",P,a),P!==a?$.value=!1:(X&&($.value=!1),B())}};se[`dragGetChildDistance_${a}`]=({dragX:P,dragY:X,moveId:ne})=>m(P,X,V(ne));const L={isInContainer({x:P,y:X,id:ne,moveId:ie}){if(a===ne||h(ne,a))return Q.value=!1,{isIn:!1,level:l,id:a,groupId:s};const le=V(ie);if(E(P,X,le))return l===0&&(j.value=!0),{isIn:!0,level:l,id:a,groupId:s};if(l===0){const{ly:ee,lx:re}=m(P,X,le);if(ee<20&&re<20)return j.value=!0,{isIn:!0,level:l,id:a,groupId:s};j.value=!1}return Q.value=!1,{isIn:!1,level:l,id:a,groupId:s}},dragActiveContainer:({containerId:P,containerGroupId:X,dragX:ne,dragY:ie,moveId:le})=>{if(P===a&&X===s)if(Q.value=!0,o&&o.value.length>0){let ee={ly:9999999,lx:0,lallx:0,id:"",typey:""};o?.value.forEach(re=>{if(s&&re.groupId!==s)return;const C=ye(`dragGetChildDistance_${re.id}`,{dragX:ne,dragY:ie,moveId:le})[0];C&&(ee.ly>C.ly||ee.ly===C.ly&&(ee.lx>C.lx||ee.lx===C.lx&&ee.lallx>C.lallx))&&(ee=C,ee.id=re.id)}),K.id=ee.id,K.type=ee.typey,ye("dragAciveChild",{id:ee.id,type:ee.typey})}else ye("dragAciveChild",{id:""});else Q.value=!1},dragAdd:P=>{if(Q.value){let X=o?.value.length||0;K.id!==""&&K.id!==void 0&&(X=o?.value.findIndex(ne=>ne.id===K.id)||0,K.type==="bottom"&&(X+=1)),f(P,a,X,s),Q.value=!1}A()},dragAddByClick:P=>{if(!z.value&&a===v.id||z.value?.id===a||z.value?.containerId===a&&z.value?.dragType!=="container"){const X=f(P,a,o?.value.length||0,s,!0);X&&P.config&&Object.keys(P.config).forEach(ne=>{X.config[ne]=P.config[ne]})}},dragUpdate(P){if(Q.value){const X=u(P);if(X.level=l+1,K.id!==X.id){b(X.containerId,P);let ne=o?.value.findIndex(ie=>ie.id===K.id)||0;K.type==="bottom"&&(ne+=1),S(X,a,ne,s)}Q.value=!1,(0,r.nextTick)(()=>{ye("dragClick",{id:X.id,isAgain:!0})})}A()}},Z={};return(0,r.onMounted)(()=>{(!i||n!=="container")&&Object.keys(se).forEach(P=>{Z[P]=No(P,se[P])}),n==="container"&&Object.keys(L).forEach(P=>{Z[P]=No(P,L[P])}),e.isNewAdd&&(0,r.nextTick)(()=>{B(),delete e.isNewAdd})}),(0,r.onUnmounted)(()=>{Object.keys(Z).forEach(P=>{qr(P,Z[P])})}),{onMouseenter:H,onMouseleave:F,activeComponent:B,handleComponentClick:te,deleteComponentByClick:T,copyComponent:D,getParentComponents:p,isBottomToolBar:q,isHover:U,isSelect:$,isToContainer:Q,isMoveingInTopLevel:j,isTopActive:G,isBottomActive:k}},So=(t,e)=>{const n={x:0,y:0,clientX:0,clientY:0,dragElement:null,dragElementId:"jcode-darg-move-id",toContainerLevel:-1,toContainerId:"",groupId:"",id:""};let o=!1;const i=(g,p)=>{o!==!0&&(o=!0,setTimeout(()=>{g(),o=!1},p))},s=(0,r.ref)(!1),a=(g,p,b)=>{const S=document.createElement("div");return S.id=n.dragElementId,S.innerText=g,S.className="d-drag-move",S.style.top=`${p}px`,S.style.left=`${b}px`,document.body.appendChild(S),S},l=()=>{document.onmousemove=null,document.onmouseup=null,s.value=!1,ye("dragAciveChild",{id:""})},d=()=>{l(),n.dragElement&&(n.dragElement.remove(),n.dragElement=null,e?ye("dragAdd",t):ye("dragUpdate",t.id))},c=g=>{const{clientY:p,clientX:b}=g;if(!n.dragElement){const S=Math.abs(n.x-b),D=Math.abs(n.y-p);if(S<=1&&D<=1)return;s.value=!0,n.dragElement=a(t.name,p-11,b-32)}n.dragElement.style.top=`${p-11}px`,n.dragElement.style.left=`${b-32}px`,n.clientX=b,n.clientY=p,i(()=>{if(!s.value)return;const S=ye("isInContainer",{x:b,y:p,id:t.id,moveId:n.id});n.toContainerLevel=-1,n.toContainerId="",n.groupId="",S.forEach(({level:D,id:z,isIn:v,groupId:M})=>{v&&n.toContainerLevel<D&&(n.toContainerLevel=D,n.toContainerId=z,n.groupId=M)}),n.toContainerId!==""?ye("dragActiveContainer",{containerId:n.toContainerId,containerGroupId:n.groupId,dragX:b,dragY:p,moveId:n.id}):ye("dragAciveChild",{id:""})},100)};return{onContextmenu:()=>{l()},onMousedown:g=>{n.x=g.clientX,n.y=g.clientY,n.id=st(),document.onmouseup=d,document.onmousemove=c},onClick:()=>{ye("dragAddByClick",t)},moveActive:s}},Jr={class:"d-drag-btns-pname"},Qr={key:0,class:"d-drag-mask"},es=(0,r.defineComponent)({name:"DDrag",__name:"drag",props:{componentData:{default:()=>({})},isContainer:{type:Boolean,default:!1}},setup(t){const e=t,n=(0,r.ref)(),{onMouseenter:o,onMouseleave:i,activeComponent:s,handleComponentClick:a,deleteComponentByClick:l,copyComponent:d,getParentComponents:c,isHover:u,isSelect:h,isTopActive:f,isBottomActive:g,isBottomToolBar:p}=ko(n,e.componentData,"component"),{onContextmenu:b,onMousedown:S,moveActive:D}=So(e.componentData,!1);return(z,v)=>{const M=(0,r.resolveComponent)("j-button"),U=(0,r.resolveComponent)("el-space");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{class:(0,r.normalizeClass)(["d-drag-component",{selected:(0,r.unref)(h),hovered:(0,r.unref)(u),isBottomToolBar:(0,r.unref)(p),active:(0,r.unref)(D),isTopActive:(0,r.unref)(f),isBottomActive:(0,r.unref)(g)}])},[v[11]||(v[11]=(0,r.createElementVNode)("div",{class:"d-drag-line"},null,-1)),(0,r.createElementVNode)("div",{class:"d-drag-btns",onMouseenter:v[4]||(v[4]=(...$)=>(0,r.unref)(o)&&(0,r.unref)(o)(...$)),onMouseleave:v[5]||(v[5]=(...$)=>(0,r.unref)(i)&&(0,r.unref)(i)(...$))},[(0,r.createVNode)(U,{size:4},{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",{class:"d-drag-btns-names",onClick:(0,r.withModifiers)(()=>{},["stop"])},[(0,r.createVNode)(M,{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"]),(0,r.createElementVNode)("div",Jr,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(c)(t.componentData.containerId),$=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:$.id},[(0,r.createVNode)(M,{class:"d-drag-btn",type:"primary",size:"small",label:$.name,onClick:Q=>(0,r.unref)(a)($.id)},null,8,["label","onClick"])]))),128))])]),(0,r.createVNode)(M,{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:content-copy",onClick:v[0]||(v[0]=(0,r.withModifiers)($=>(0,r.unref)(d)(t.componentData.id),["stop"]))}),(0,r.createElementVNode)("div",{onContextmenu:v[1]||(v[1]=(0,r.withModifiers)((...$)=>(0,r.unref)(b)&&(0,r.unref)(b)(...$),["stop"])),onMousedown:v[2]||(v[2]=(0,r.withModifiers)((...$)=>(0,r.unref)(S)&&(0,r.unref)(S)(...$),["stop"])),style:{display:"flex"}},[(0,r.createVNode)(M,{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:drag"})],32),(0,r.createVNode)(M,{class:"d-drag-btn",danger:"",type:"primary",size:"small",icon:"mdi:delete",onClick:v[3]||(v[3]=(0,r.withModifiers)($=>(0,r.unref)(l)(t.componentData.id),["stop"]))})]),_:1})],32),(0,r.createElementVNode)("div",{ref_key:"refDrag",ref:n,class:"d-drag-body",onClick:v[6]||(v[6]=(0,r.withModifiers)((...$)=>(0,r.unref)(s)&&(0,r.unref)(s)(...$),["stop"])),onContextmenu:v[7]||(v[7]=(0,r.withModifiers)((...$)=>(0,r.unref)(b)&&(0,r.unref)(b)(...$),["stop"])),onMousedown:v[8]||(v[8]=(0,r.withModifiers)((...$)=>(0,r.unref)(S)&&(0,r.unref)(S)(...$),["stop"])),onMouseenter:v[9]||(v[9]=(...$)=>(0,r.unref)(o)&&(0,r.unref)(o)(...$)),onMouseleave:v[10]||(v[10]=(...$)=>(0,r.unref)(i)&&(0,r.unref)(i)(...$))},[(0,r.renderSlot)(z.$slots,"default"),t.isContainer?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",Qr))],544)],2)}}}),Mn=es,ts=(0,r.defineComponent)({name:"DDragTool",__name:"tool",props:{config:{}},setup(t){const{onContextmenu:e,onMousedown:n,onClick:o}=So(t.config??{name:"",id:""},!0);return(i,s)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"d-drag-tool",onClick:s[0]||(s[0]=(0,r.withModifiers)((...a)=>(0,r.unref)(o)&&(0,r.unref)(o)(...a),["stop"])),onContextmenu:s[1]||(s[1]=(0,r.withModifiers)((...a)=>(0,r.unref)(e)&&(0,r.unref)(e)(...a),["stop"])),onMousedown:s[2]||(s[2]=(0,r.withModifiers)((...a)=>(0,r.unref)(n)&&(0,r.unref)(n)(...a),["stop"]))},[(0,r.renderSlot)(i.$slots,"default")],32))}}),In=ts,ns={key:0,class:"d-drag-line"},os={key:1,class:"d-drag-btns"},is=(0,r.defineComponent)({name:"DDragContainer",__name:"container",props:{componentData:{default:()=>({})},isComponentContainer:{type:Boolean,default:!0},groupId:{default:void 0}},setup(t){const e=t,n=(0,r.ref)(),o=(0,r.computed)(()=>e.componentData?.children||[]),{onMouseenter:i,onMouseleave:s,activeComponent:a,isHover:l,isSelect:d,isToContainer:c,isMoveingInTopLevel:u,isTopActive:h,isBottomActive:f}=ko(n,e.componentData,"container",o,e.isComponentContainer,e.groupId),g=(0,r.computed)(()=>!!(o.value.findIndex(p=>p.groupId===e.groupId)===-1&&c.value));return(p,b)=>{const S=(0,r.resolveComponent)("j-button");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{ref_key:"refDrag",ref:n,class:(0,r.normalizeClass)(["d-drag-container",{selected:(0,r.unref)(d)&&!t.isComponentContainer,hovered:(0,r.unref)(l)&&!t.isComponentContainer,isTopLevel:t.componentData.level===0,active:g.value,isMoveingInTopLevel:(0,r.unref)(u),isTopActive:(0,r.unref)(h),isBottomActive:(0,r.unref)(f)}])},[t.isComponentContainer?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",ns)),t.isComponentContainer?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",os,[(0,r.createElementVNode)("div",{class:"d-drag-btns-names",onClick:(0,r.withModifiers)(()=>{},["stop"])},[(0,r.createVNode)(S,{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"])])])),(0,r.createElementVNode)("div",{class:"d-drag-body",onClick:b[0]||(b[0]=(0,r.withModifiers)((...D)=>(0,r.unref)(a)&&(0,r.unref)(a)(...D),["stop"])),onMouseenter:b[1]||(b[1]=(...D)=>(0,r.unref)(i)&&(0,r.unref)(i)(...D)),onMouseleave:b[2]||(b[2]=(...D)=>(0,r.unref)(s)&&(0,r.unref)(s)(...D))},[(0,r.renderSlot)(p.$slots,"default")],32)],2)}}}),Bn=is,rs=(0,r.defineComponent)({name:"DDragFormList",__name:"dragFormList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=(0,r.inject)("dui-design-provide",{});return(n,o)=>{const i=(0,r.resolveComponent)("el-col");return(0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(t.componentList,s=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:s.id},[s.type!="pkey"?((0,r.openBlock)(),(0,r.createBlock)(i,{key:0,span:s.config.span||24},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(Mn,{"is-container":s.dragType!=="component","component-data":s},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(e)),{"component-data":s,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["is-container","component-data"])]),_:2},1032,["span"])):(0,r.createCommentVNode)("",!0)],64))),128)}}}),zn=rs,ss=(0,r.defineComponent)({name:"DDragIndexList",__name:"dragIndexList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=(0,r.inject)("dui-design-provide",{}),n=o=>{if(o.flexWidth)return{width:o.flexWidth+"%"}};return(o,i)=>((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(t.componentList,s=>((0,r.openBlock)(),(0,r.createBlock)(Mn,{key:s.id,style:(0,r.normalizeStyle)(n(s.config)),"is-container":s.dragType!=="component","component-data":s},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(e)),{"component-data":s,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["style","is-container","component-data"]))),128))}}),Rn=ss,Do=Je(Mn,[In,Bn,zn,Rn]);function wt(t){return(0,r.getCurrentScope)()?((0,r.onScopeDispose)(t),!0):!1}function He(t){return typeof t=="function"?t():(0,r.unref)(t)}var as=typeof window<"u"&&typeof document<"u",ls=t=>typeof t<"u",cs=Object.prototype.toString,ds=t=>cs.call(t)==="[object Object]",us=()=>{};function fs(t,e){function n(...o){return new Promise((i,s)=>{Promise.resolve(t(()=>e.apply(this,o),{fn:e,thisArg:this,args:o})).then(i).catch(s)})}return n}var To=t=>t();function hs(t=To){const e=(0,r.ref)(!0);function n(){e.value=!1}function o(){e.value=!0}const i=(...s)=>{e.value&&t(...s)};return{isActive:(0,r.readonly)(e),pause:n,resume:o,eventFilter:i}}function Mo(t,e=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(e?()=>i(n):o,t)})}function gs(t,e,n={}){const{eventFilter:o=To,...i}=n;return(0,r.watch)(t,fs(o,e),i)}function at(t,e,n={}){const{eventFilter:o,...i}=n,{eventFilter:s,pause:a,resume:l,isActive:d}=hs(o);return{stop:gs(t,e,{...i,eventFilter:s}),pause:a,resume:l,isActive:d}}function ps(t,e={}){if(!(0,r.isRef)(t))return(0,r.toRefs)(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const o in t.value)n[o]=(0,r.customRef)(()=>({get(){return t.value[o]},set(i){var s;if((s=He(e.replaceRef))==null||s)if(Array.isArray(t.value)){const a=[...t.value];a[o]=i,t.value=a}else{const a={...t.value,[o]:i};Object.setPrototypeOf(a,Object.getPrototypeOf(t.value)),t.value=a}else t.value[o]=i}}));return n}function An(t,e=!1){function n(h,{flush:f="sync",deep:g=!1,timeout:p,throwOnTimeout:b}={}){let S=null;const D=[new Promise(z=>{S=(0,r.watch)(t,v=>{h(v)!==e&&(S?.(),z(v))},{flush:f,deep:g,immediate:!0})})];return p!=null&&D.push(Mo(p,b).then(()=>He(t)).finally(()=>S?.())),Promise.race(D)}function o(h,f){if(!(0,r.isRef)(h))return n(v=>v===h,f);const{flush:g="sync",deep:p=!1,timeout:b,throwOnTimeout:S}=f??{};let D=null;const z=[new Promise(v=>{D=(0,r.watch)([t,h],([M,U])=>{e!==(M===U)&&(D?.(),v(M))},{flush:g,deep:p,immediate:!0})})];return b!=null&&z.push(Mo(b,S).then(()=>He(t)).finally(()=>(D?.(),He(t)))),Promise.race(z)}function i(h){return n(f=>!!f,h)}function s(h){return o(null,h)}function a(h){return o(void 0,h)}function l(h){return n(Number.isNaN,h)}function d(h,f){return n(g=>{const p=Array.from(g);return p.includes(h)||p.includes(He(h))},f)}function c(h){return u(1,h)}function u(h=1,f){let g=-1;return n(()=>(g+=1,g>=h),f)}return Array.isArray(He(t))?{toMatch:n,toContains:d,changed:c,changedTimes:u,get not(){return An(t,!e)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:s,toBeNaN:l,toBeUndefined:a,changed:c,changedTimes:u,get not(){return An(t,!e)}}}function $n(t){return An(t)}function ms(t){var e;const n=He(t);return(e=n?.$el)!=null?e:n}var Io=as?window:void 0;function Bo(...t){let e,n,o,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,o,i]=t,e=Io):[e,n,o,i]=t,!e)return us;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const s=[],a=()=>{s.forEach(u=>u()),s.length=0},l=(u,h,f,g)=>(u.addEventListener(h,f,g),()=>u.removeEventListener(h,f,g)),d=(0,r.watch)(()=>[ms(e),He(i)],([u,h])=>{if(a(),!u)return;const f=ds(h)?{...h}:h;s.push(...n.flatMap(g=>o.map(p=>l(u,g,p,f))))},{immediate:!0,flush:"post"}),c=()=>{d(),a()};return wt(c),c}function ys(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function zo(...t){let e,n,o={};t.length===3?(e=t[0],n=t[1],o=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],o=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:i=Io,eventName:s="keydown",passive:a=!1,dedupe:l=!1}=o,d=ys(e);return Bo(i,s,u=>{u.repeat&&He(l)||d(u)&&n(u)},a)}function vs(t){return JSON.parse(JSON.stringify(t))}function Pn(t,e,n,o={}){var i,s,a;const{clone:l=!1,passive:d=!1,eventName:c,deep:u=!1,defaultValue:h,shouldEmit:f}=o,g=(0,r.getCurrentInstance)(),p=n||g?.emit||((i=g?.$emit)==null?void 0:i.bind(g))||((a=(s=g?.proxy)==null?void 0:s.$emit)==null?void 0:a.bind(g?.proxy));let b=c;e||(e="modelValue"),b=b||`update:${e.toString()}`;const S=v=>l?typeof l=="function"?l(v):vs(v):v,D=()=>ls(t[e])?S(t[e]):h,z=v=>{f?f(v)&&p(b,v):p(b,v)};if(d){const v=(0,r.ref)(D());let M=!1;return(0,r.watch)(()=>t[e],U=>{M||(M=!0,v.value=S(U),(0,r.nextTick)(()=>M=!1))}),(0,r.watch)(v,U=>{!M&&(U!==t[e]||u)&&z(U)},{deep:u}),v}else return(0,r.computed)({get(){return D()},set(v){z(v)}})}var _s={value:()=>{}};function Ht(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Lt(n)}function Lt(t){this._=t}function ws(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Lt.prototype=Ht.prototype={constructor:Lt,on:function(t,e){var n=this._,o=ws(t+"",n),i,s=-1,a=o.length;if(arguments.length<2){for(;++s<a;)if((i=(t=o[s]).type)&&(i=bs(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(i=(t=o[s]).type)n[i]=Ro(n[i],t.name,e);else if(e==null)for(i in n)n[i]=Ro(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Lt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,s;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],o=0,i=s.length;o<i;++o)s[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],i=0,s=o.length;i<s;++i)o[i].value.apply(e,n)}};function bs(t,e){for(var n=0,o=t.length,i;n<o;++n)if((i=t[n]).name===e)return i.value}function Ro(t,e,n){for(var o=0,i=t.length;o<i;++o)if(t[o].name===e){t[o]=_s,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var On="http://www.w3.org/1999/xhtml",Ao={svg:"http://www.w3.org/2000/svg",xhtml:On,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ft(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Ao.hasOwnProperty(e)?{space:Ao[e],local:t}:t}function Cs(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===On&&e.documentElement.namespaceURI===On?e.createElement(t):e.createElementNS(n,t)}}function Es(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function $o(t){var e=Ft(t);return(e.local?Es:Cs)(e)}function xs(){}function Vn(t){return t==null?xs:function(){return this.querySelector(t)}}function Ns(t){typeof t!="function"&&(t=Vn(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=o[i]=new Array(a),d,c,u=0;u<a;++u)(d=s[u])&&(c=t.call(d,d.__data__,u,s))&&("__data__"in d&&(c.__data__=d.__data__),l[u]=c);return new Se(o,this._parents)}function ks(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Ss(){return[]}function Po(t){return t==null?Ss:function(){return this.querySelectorAll(t)}}function Ds(t){return function(){return ks(t.apply(this,arguments))}}function Ts(t){typeof t=="function"?t=Ds(t):t=Po(t);for(var e=this._groups,n=e.length,o=[],i=[],s=0;s<n;++s)for(var a=e[s],l=a.length,d,c=0;c<l;++c)(d=a[c])&&(o.push(t.call(d,d.__data__,c,a)),i.push(d));return new Se(o,i)}function Oo(t){return function(){return this.matches(t)}}function Vo(t){return function(e){return e.matches(t)}}var Ms=Array.prototype.find;function Is(t){return function(){return Ms.call(this.children,t)}}function Bs(){return this.firstElementChild}function zs(t){return this.select(t==null?Bs:Is(typeof t=="function"?t:Vo(t)))}var Rs=Array.prototype.filter;function As(){return Array.from(this.children)}function $s(t){return function(){return Rs.call(this.children,t)}}function Ps(t){return this.selectAll(t==null?As:$s(typeof t=="function"?t:Vo(t)))}function Os(t){typeof t!="function"&&(t=Oo(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=o[i]=[],d,c=0;c<a;++c)(d=s[c])&&t.call(d,d.__data__,c,s)&&l.push(d);return new Se(o,this._parents)}function Ho(t){return new Array(t.length)}function Vs(){return new Se(this._enter||this._groups.map(Ho),this._parents)}function Gt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Gt.prototype={constructor:Gt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Hs(t){return function(){return t}}function Ls(t,e,n,o,i,s){for(var a=0,l,d=e.length,c=s.length;a<c;++a)(l=e[a])?(l.__data__=s[a],o[a]=l):n[a]=new Gt(t,s[a]);for(;a<d;++a)(l=e[a])&&(i[a]=l)}function Fs(t,e,n,o,i,s,a){var l,d,c=new Map,u=e.length,h=s.length,f=new Array(u),g;for(l=0;l<u;++l)(d=e[l])&&(f[l]=g=a.call(d,d.__data__,l,e)+"",c.has(g)?i[l]=d:c.set(g,d));for(l=0;l<h;++l)g=a.call(t,s[l],l,s)+"",(d=c.get(g))?(o[l]=d,d.__data__=s[l],c.delete(g)):n[l]=new Gt(t,s[l]);for(l=0;l<u;++l)(d=e[l])&&c.get(f[l])===d&&(i[l]=d)}function Gs(t){return t.__data__}function Ws(t,e){if(!arguments.length)return Array.from(this,Gs);var n=e?Fs:Ls,o=this._parents,i=this._groups;typeof t!="function"&&(t=Hs(t));for(var s=i.length,a=new Array(s),l=new Array(s),d=new Array(s),c=0;c<s;++c){var u=o[c],h=i[c],f=h.length,g=Us(t.call(u,u&&u.__data__,c,o)),p=g.length,b=l[c]=new Array(p),S=a[c]=new Array(p);n(u,h,b,S,d[c]=new Array(f),g,e);for(var D=0,z=0,v,M;D<p;++D)if(v=b[D]){for(D>=z&&(z=D+1);!(M=S[z])&&++z<p;);v._next=M||null}}return a=new Se(a,o),a._enter=l,a._exit=d,a}function Us(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Ys(){return new Se(this._exit||this._groups.map(Ho),this._parents)}function Xs(t,e,n){var o=this.enter(),i=this,s=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?s.remove():n(s),o&&i?o.merge(i).order():i}function js(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,i=n.length,s=o.length,a=Math.min(i,s),l=new Array(i),d=0;d<a;++d)for(var c=n[d],u=o[d],h=c.length,f=l[d]=new Array(h),g,p=0;p<h;++p)(g=c[p]||u[p])&&(f[p]=g);for(;d<i;++d)l[d]=n[d];return new Se(l,this._parents)}function Zs(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],i=o.length-1,s=o[i],a;--i>=0;)(a=o[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function Ks(t){t||(t=qs);function e(h,f){return h&&f?t(h.__data__,f.__data__):!h-!f}for(var n=this._groups,o=n.length,i=new Array(o),s=0;s<o;++s){for(var a=n[s],l=a.length,d=i[s]=new Array(l),c,u=0;u<l;++u)(c=a[u])&&(d[u]=c);d.sort(e)}return new Se(i,this._parents).order()}function qs(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Js(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Qs(){return Array.from(this)}function ea(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,s=o.length;i<s;++i){var a=o[i];if(a)return a}return null}function ta(){let t=0;for(const e of this)++t;return t}function na(){return!this.node()}function oa(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],s=0,a=i.length,l;s<a;++s)(l=i[s])&&t.call(l,l.__data__,s,i);return this}function ia(t){return function(){this.removeAttribute(t)}}function ra(t){return function(){this.removeAttributeNS(t.space,t.local)}}function sa(t,e){return function(){this.setAttribute(t,e)}}function aa(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function la(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function ca(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function da(t,e){var n=Ft(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?ra:ia:typeof e=="function"?n.local?ca:la:n.local?aa:sa)(n,e))}function Lo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ua(t){return function(){this.style.removeProperty(t)}}function fa(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ha(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function ga(t,e,n){return arguments.length>1?this.each((e==null?ua:typeof e=="function"?ha:fa)(t,e,n??"")):lt(this.node(),t)}function lt(t,e){return t.style.getPropertyValue(e)||Lo(t).getComputedStyle(t,null).getPropertyValue(e)}function pa(t){return function(){delete this[t]}}function ma(t,e){return function(){this[t]=e}}function ya(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function va(t,e){return arguments.length>1?this.each((e==null?pa:typeof e=="function"?ya:ma)(t,e)):this.node()[t]}function Fo(t){return t.trim().split(/^|\s+/)}function Hn(t){return t.classList||new Go(t)}function Go(t){this._node=t,this._names=Fo(t.getAttribute("class")||"")}Go.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Wo(t,e){for(var n=Hn(t),o=-1,i=e.length;++o<i;)n.add(e[o])}function Uo(t,e){for(var n=Hn(t),o=-1,i=e.length;++o<i;)n.remove(e[o])}function _a(t){return function(){Wo(this,t)}}function wa(t){return function(){Uo(this,t)}}function ba(t,e){return function(){(e.apply(this,arguments)?Wo:Uo)(this,t)}}function Ca(t,e){var n=Fo(t+"");if(arguments.length<2){for(var o=Hn(this.node()),i=-1,s=n.length;++i<s;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?ba:e?_a:wa)(n,e))}function Ea(){this.textContent=""}function xa(t){return function(){this.textContent=t}}function Na(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function ka(t){return arguments.length?this.each(t==null?Ea:(typeof t=="function"?Na:xa)(t)):this.node().textContent}function Sa(){this.innerHTML=""}function Da(t){return function(){this.innerHTML=t}}function Ta(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ma(t){return arguments.length?this.each(t==null?Sa:(typeof t=="function"?Ta:Da)(t)):this.node().innerHTML}function Ia(){this.nextSibling&&this.parentNode.appendChild(this)}function Ba(){return this.each(Ia)}function za(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ra(){return this.each(za)}function Aa(t){var e=typeof t=="function"?t:$o(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function $a(){return null}function Pa(t,e){var n=typeof t=="function"?t:$o(t),o=e==null?$a:typeof e=="function"?e:Vn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Oa(){var t=this.parentNode;t&&t.removeChild(this)}function Va(){return this.each(Oa)}function Ha(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function La(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Fa(t){return this.select(t?La:Ha)}function Ga(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Wa(t){return function(e){t.call(this,e,this.__data__)}}function Ua(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function Ya(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,i=e.length,s;n<i;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++o]=s;++o?e.length=o:delete this.__on}}}function Xa(t,e,n){return function(){var o=this.__on,i,s=Wa(e);if(o){for(var a=0,l=o.length;a<l;++a)if((i=o[a]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=e;return}}this.addEventListener(t.type,s,n),i={type:t.type,name:t.name,value:e,listener:s,options:n},o?o.push(i):this.__on=[i]}}function ja(t,e,n){var o=Ua(t+""),i,s=o.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var d=0,c=l.length,u;d<c;++d)for(i=0,u=l[d];i<s;++i)if((a=o[i]).type===u.type&&a.name===u.name)return u.value}return}for(l=e?Xa:Ya,i=0;i<s;++i)this.each(l(o[i],e,n));return this}function Yo(t,e,n){var o=Lo(t),i=o.CustomEvent;typeof i=="function"?i=new i(e,n):(i=o.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Za(t,e){return function(){return Yo(this,t,e)}}function Ka(t,e){return function(){return Yo(this,t,e.apply(this,arguments))}}function qa(t,e){return this.each((typeof e=="function"?Ka:Za)(t,e))}function*Ja(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,s=o.length,a;i<s;++i)(a=o[i])&&(yield a)}var Xo=[null];function Se(t,e){this._groups=t,this._parents=e}function bt(){return new Se([[document.documentElement]],Xo)}function Qa(){return this}Se.prototype=bt.prototype={constructor:Se,select:Ns,selectAll:Ts,selectChild:zs,selectChildren:Ps,filter:Os,data:Ws,enter:Vs,exit:Ys,join:Xs,merge:js,selection:Qa,order:Zs,sort:Ks,call:Js,nodes:Qs,node:ea,size:ta,empty:na,each:oa,attr:da,style:ga,property:va,classed:Ca,text:ka,html:Ma,raise:Ba,lower:Ra,append:Aa,insert:Pa,remove:Va,clone:Fa,datum:Ga,on:ja,dispatch:qa,[Symbol.iterator]:Ja};function Ie(t){return typeof t=="string"?new Se([[document.querySelector(t)]],[document.documentElement]):new Se([[t]],Xo)}function el(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Ae(t,e){if(t=el(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var tl={passive:!1},Ct={capture:!0,passive:!1};function Ln(t){t.stopImmediatePropagation()}function ct(t){t.preventDefault(),t.stopImmediatePropagation()}function jo(t){var e=t.document.documentElement,n=Ie(t).on("dragstart.drag",ct,Ct);"onselectstart"in e?n.on("selectstart.drag",ct,Ct):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Zo(t,e){var n=t.document.documentElement,o=Ie(t).on("dragstart.drag",null);e&&(o.on("click.drag",ct,Ct),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Wt=t=>()=>t;function Fn(t,{sourceEvent:e,subject:n,target:o,identifier:i,active:s,x:a,y:l,dx:d,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Fn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function nl(t){return!t.ctrlKey&&!t.button}function ol(){return this.parentNode}function il(t,e){return e??{x:t.x,y:t.y}}function rl(){return navigator.maxTouchPoints||"ontouchstart"in this}function sl(){var t=nl,e=ol,n=il,o=rl,i={},s=Ht("start","drag","end"),a=0,l,d,c,u,h=0;function f(M){M.on("mousedown.drag",g).filter(o).on("touchstart.drag",S).on("touchmove.drag",D,tl).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(M,U){if(!(u||!t.call(this,M,U))){var $=v(this,e.call(this,M,U),M,U,"mouse");$&&(Ie(M.view).on("mousemove.drag",p,Ct).on("mouseup.drag",b,Ct),jo(M.view),Ln(M),c=!1,l=M.clientX,d=M.clientY,$("start",M))}}function p(M){if(ct(M),!c){var U=M.clientX-l,$=M.clientY-d;c=U*U+$*$>h}i.mouse("drag",M)}function b(M){Ie(M.view).on("mousemove.drag mouseup.drag",null),Zo(M.view,c),ct(M),i.mouse("end",M)}function S(M,U){if(t.call(this,M,U)){var $=M.changedTouches,Q=e.call(this,M,U),q=$.length,j,K;for(j=0;j<q;++j)(K=v(this,Q,M,U,$[j].identifier,$[j]))&&(Ln(M),K("start",M,$[j]))}}function D(M){var U=M.changedTouches,$=U.length,Q,q;for(Q=0;Q<$;++Q)(q=i[U[Q].identifier])&&(ct(M),q("drag",M,U[Q]))}function z(M){var U=M.changedTouches,$=U.length,Q,q;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),Q=0;Q<$;++Q)(q=i[U[Q].identifier])&&(Ln(M),q("end",M,U[Q]))}function v(M,U,$,Q,q,j){var K=s.copy(),G=Ae(j||$,U),k,Y,w;if((w=n.call(M,new Fn("beforestart",{sourceEvent:$,target:f,identifier:q,active:a,x:G[0],y:G[1],dx:0,dy:0,dispatch:K}),Q))!=null)return k=w.x-G[0]||0,Y=w.y-G[1]||0,function V(m,E,B){var T=G,A;switch(m){case"start":i[q]=V,A=a++;break;case"end":delete i[q],--a;case"drag":G=Ae(B||E,U),A=a;break}K.call(m,M,new Fn(m,{sourceEvent:E,subject:w,target:f,identifier:q,active:A,x:G[0]+k,y:G[1]+Y,dx:G[0]-T[0],dy:G[1]-T[1],dispatch:K}),Q)}}return f.filter=function(M){return arguments.length?(t=typeof M=="function"?M:Wt(!!M),f):t},f.container=function(M){return arguments.length?(e=typeof M=="function"?M:Wt(M),f):e},f.subject=function(M){return arguments.length?(n=typeof M=="function"?M:Wt(M),f):n},f.touchable=function(M){return arguments.length?(o=typeof M=="function"?M:Wt(!!M),f):o},f.on=function(){var M=s.on.apply(s,arguments);return M===s?f:M},f.clickDistance=function(M){return arguments.length?(h=(M=+M)*M,f):Math.sqrt(h)},f}function Gn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ko(t,e){var n=Object.create(t.prototype);for(var o in e)n[o]=e[o];return n}function Et(){}var xt=.7,Ut=1/xt,dt="\\s*([+-]?\\d+)\\s*",Nt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",$e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",al=/^#([0-9a-f]{3,8})$/,ll=new RegExp(`^rgb\\(${dt},${dt},${dt}\\)$`),cl=new RegExp(`^rgb\\(${$e},${$e},${$e}\\)$`),dl=new RegExp(`^rgba\\(${dt},${dt},${dt},${Nt}\\)$`),ul=new RegExp(`^rgba\\(${$e},${$e},${$e},${Nt}\\)$`),fl=new RegExp(`^hsl\\(${Nt},${$e},${$e}\\)$`),hl=new RegExp(`^hsla\\(${Nt},${$e},${$e},${Nt}\\)$`),qo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Gn(Et,Qe,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Jo,formatHex:Jo,formatHex8:gl,formatHsl:pl,formatRgb:Qo,toString:Qo});function Jo(){return this.rgb().formatHex()}function gl(){return this.rgb().formatHex8()}function pl(){return ii(this).formatHsl()}function Qo(){return this.rgb().formatRgb()}function Qe(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=al.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?ei(e):n===3?new xe(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Yt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Yt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ll.exec(t))?new xe(e[1],e[2],e[3],1):(e=cl.exec(t))?new xe(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=dl.exec(t))?Yt(e[1],e[2],e[3],e[4]):(e=ul.exec(t))?Yt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=fl.exec(t))?oi(e[1],e[2]/100,e[3]/100,1):(e=hl.exec(t))?oi(e[1],e[2]/100,e[3]/100,e[4]):qo.hasOwnProperty(t)?ei(qo[t]):t==="transparent"?new xe(NaN,NaN,NaN,0):null}function ei(t){return new xe(t>>16&255,t>>8&255,t&255,1)}function Yt(t,e,n,o){return o<=0&&(t=e=n=NaN),new xe(t,e,n,o)}function ml(t){return t instanceof Et||(t=Qe(t)),t?(t=t.rgb(),new xe(t.r,t.g,t.b,t.opacity)):new xe}function Wn(t,e,n,o){return arguments.length===1?ml(t):new xe(t,e,n,o??1)}function xe(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}Gn(xe,Wn,Ko(Et,{brighter(t){return t=t==null?Ut:Math.pow(Ut,t),new xe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?xt:Math.pow(xt,t),new xe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new xe(et(this.r),et(this.g),et(this.b),Xt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ti,formatHex:ti,formatHex8:yl,formatRgb:ni,toString:ni}));function ti(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}`}function yl(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function ni(){const t=Xt(this.opacity);return`${t===1?"rgb(":"rgba("}${et(this.r)}, ${et(this.g)}, ${et(this.b)}${t===1?")":`, ${t})`}`}function Xt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function et(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function tt(t){return t=et(t),(t<16?"0":"")+t.toString(16)}function oi(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Be(t,e,n,o)}function ii(t){if(t instanceof Be)return new Be(t.h,t.s,t.l,t.opacity);if(t instanceof Et||(t=Qe(t)),!t)return new Be;if(t instanceof Be)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,i=Math.min(e,n,o),s=Math.max(e,n,o),a=NaN,l=s-i,d=(s+i)/2;return l?(e===s?a=(n-o)/l+(n<o)*6:n===s?a=(o-e)/l+2:a=(e-n)/l+4,l/=d<.5?s+i:2-s-i,a*=60):l=d>0&&d<1?0:a,new Be(a,l,d,t.opacity)}function vl(t,e,n,o){return arguments.length===1?ii(t):new Be(t,e,n,o??1)}function Be(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}Gn(Be,vl,Ko(Et,{brighter(t){return t=t==null?Ut:Math.pow(Ut,t),new Be(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?xt:Math.pow(xt,t),new Be(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,i=2*n-o;return new xe(Un(t>=240?t-240:t+120,i,o),Un(t,i,o),Un(t<120?t+240:t-120,i,o),this.opacity)},clamp(){return new Be(ri(this.h),jt(this.s),jt(this.l),Xt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Xt(this.opacity);return`${t===1?"hsl(":"hsla("}${ri(this.h)}, ${jt(this.s)*100}%, ${jt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ri(t){return t=(t||0)%360,t<0?t+360:t}function jt(t){return Math.max(0,Math.min(1,t||0))}function Un(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}var Yn=t=>()=>t;function _l(t,e){return function(n){return t+n*e}}function wl(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function bl(t){return(t=+t)==1?si:function(e,n){return n-e?wl(e,n,t):Yn(isNaN(e)?n:e)}}function si(t,e){var n=e-t;return n?_l(t,n):Yn(isNaN(t)?e:t)}var Zt=(function t(e){var n=bl(e);function o(i,s){var a=n((i=Wn(i)).r,(s=Wn(s)).r),l=n(i.g,s.g),d=n(i.b,s.b),c=si(i.opacity,s.opacity);return function(u){return i.r=a(u),i.g=l(u),i.b=d(u),i.opacity=c(u),i+""}}return o.gamma=t,o})(1);function Cl(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),i;return function(s){for(i=0;i<n;++i)o[i]=t[i]*(1-s)+e[i]*s;return o}}function El(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function xl(t,e){var n=e?e.length:0,o=t?Math.min(n,t.length):0,i=new Array(o),s=new Array(n),a;for(a=0;a<o;++a)i[a]=kt(t[a],e[a]);for(;a<n;++a)s[a]=e[a];return function(l){for(a=0;a<o;++a)s[a]=i[a](l);return s}}function Nl(t,e){var n=new Date;return t=+t,e=+e,function(o){return n.setTime(t*(1-o)+e*o),n}}function Pe(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function kl(t,e){var n={},o={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=kt(t[i],e[i]):o[i]=e[i];return function(s){for(i in n)o[i]=n[i](s);return o}}var Xn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jn=new RegExp(Xn.source,"g");function Sl(t){return function(){return t}}function Dl(t){return function(e){return t(e)+""}}function ai(t,e){var n=Xn.lastIndex=jn.lastIndex=0,o,i,s,a=-1,l=[],d=[];for(t=t+"",e=e+"";(o=Xn.exec(t))&&(i=jn.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),l[a]?l[a]+=s:l[++a]=s),(o=o[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,d.push({i:a,x:Pe(o,i)})),n=jn.lastIndex;return n<e.length&&(s=e.slice(n),l[a]?l[a]+=s:l[++a]=s),l.length<2?d[0]?Dl(d[0].x):Sl(e):(e=d.length,function(c){for(var u=0,h;u<e;++u)l[(h=d[u]).i]=h.x(c);return l.join("")})}function kt(t,e){var n=typeof e,o;return e==null||n==="boolean"?Yn(e):(n==="number"?Pe:n==="string"?(o=Qe(e))?(e=o,Zt):ai:e instanceof Qe?Zt:e instanceof Date?Nl:El(e)?Cl:Array.isArray(e)?xl:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?kl:Pe)(t,e)}var li=180/Math.PI,Zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ci(t,e,n,o,i,s){var a,l,d;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(d=t*n+e*o)&&(n-=t*d,o-=e*d),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,d/=l),t*o<e*n&&(t=-t,e=-e,d=-d,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*li,skewX:Math.atan(d)*li,scaleX:a,scaleY:l}}var Kt;function Tl(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Zn:ci(e.a,e.b,e.c,e.d,e.e,e.f)}function Ml(t){return t==null||(Kt||(Kt=document.createElementNS("http://www.w3.org/2000/svg","g")),Kt.setAttribute("transform",t),!(t=Kt.transform.baseVal.consolidate()))?Zn:(t=t.matrix,ci(t.a,t.b,t.c,t.d,t.e,t.f))}function di(t,e,n,o){function i(c){return c.length?c.pop()+" ":""}function s(c,u,h,f,g,p){if(c!==h||u!==f){var b=g.push("translate(",null,e,null,n);p.push({i:b-4,x:Pe(c,h)},{i:b-2,x:Pe(u,f)})}else(h||f)&&g.push("translate("+h+e+f+n)}function a(c,u,h,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:h.push(i(h)+"rotate(",null,o)-2,x:Pe(c,u)})):u&&h.push(i(h)+"rotate("+u+o)}function l(c,u,h,f){c!==u?f.push({i:h.push(i(h)+"skewX(",null,o)-2,x:Pe(c,u)}):u&&h.push(i(h)+"skewX("+u+o)}function d(c,u,h,f,g,p){if(c!==h||u!==f){var b=g.push(i(g)+"scale(",null,",",null,")");p.push({i:b-4,x:Pe(c,h)},{i:b-2,x:Pe(u,f)})}else(h!==1||f!==1)&&g.push(i(g)+"scale("+h+","+f+")")}return function(c,u){var h=[],f=[];return c=t(c),u=t(u),s(c.translateX,c.translateY,u.translateX,u.translateY,h,f),a(c.rotate,u.rotate,h,f),l(c.skewX,u.skewX,h,f),d(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,f),c=u=null,function(g){for(var p=-1,b=f.length,S;++p<b;)h[(S=f[p]).i]=S.x(g);return h.join("")}}}var Il=di(Tl,"px, ","px)","deg)"),Bl=di(Ml,", ",")",")"),zl=1e-12;function ui(t){return((t=Math.exp(t))+1/t)/2}function Rl(t){return((t=Math.exp(t))-1/t)/2}function Al(t){return((t=Math.exp(2*t))-1)/(t+1)}var qt=(function t(e,n,o){function i(s,a){var l=s[0],d=s[1],c=s[2],u=a[0],h=a[1],f=a[2],g=u-l,p=h-d,b=g*g+p*p,S,D;if(b<zl)D=Math.log(f/c)/e,S=function($){return[l+$*g,d+$*p,c*Math.exp(e*$*D)]};else{var z=Math.sqrt(b),v=(f*f-c*c+o*b)/(2*c*n*z),M=(f*f-c*c-o*b)/(2*f*n*z),U=Math.log(Math.sqrt(v*v+1)-v);D=(Math.log(Math.sqrt(M*M+1)-M)-U)/e,S=function($){var Q=$*D,q=ui(U),j=c/(n*z)*(q*Al(e*Q+U)-Rl(U));return[l+j*g,d+j*p,c*q/ui(e*Q+U)]}}return S.duration=D*1e3*e/Math.SQRT2,S}return i.rho=function(s){var a=Math.max(.001,+s),l=a*a;return t(a,l,l*l)},i})(Math.SQRT2,2,4),ut=0,St=0,Dt=0,fi=1e3,Jt,Tt,Qt=0,nt=0,en=0,Mt=typeof performance=="object"&&performance.now?performance:Date,hi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Kn(){return nt||(hi($l),nt=Mt.now()+en)}function $l(){nt=0}function tn(){this._call=this._time=this._next=null}tn.prototype=gi.prototype={constructor:tn,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Kn():+n)+(e==null?0:+e),!this._next&&Tt!==this&&(Tt?Tt._next=this:Jt=this,Tt=this),this._call=t,this._time=n,qn()},stop:function(){this._call&&(this._call=null,this._time=1/0,qn())}};function gi(t,e,n){var o=new tn;return o.restart(t,e,n),o}function Pl(){Kn(),++ut;for(var t=Jt,e;t;)(e=nt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--ut}function pi(){nt=(Qt=Mt.now())+en,ut=St=0;try{Pl()}finally{ut=0,Vl(),nt=0}}function Ol(){var t=Mt.now(),e=t-Qt;e>fi&&(en-=e,Qt=t)}function Vl(){for(var t,e=Jt,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Jt=n);Tt=t,qn(o)}function qn(t){ut||(St&&(St=clearTimeout(St)),t-nt>24?(t<1/0&&(St=setTimeout(pi,t-Mt.now()-en)),Dt&&(Dt=clearInterval(Dt))):(Dt||(Qt=Mt.now(),Dt=setInterval(Ol,fi)),ut=1,hi(pi)))}function mi(t,e,n){var o=new tn;return e=e==null?0:+e,o.restart(i=>{o.stop(),t(i+e)},e,n),o}var Hl=Ht("start","end","cancel","interrupt"),Ll=[],yi=0,vi=1,Jn=2,nn=3,_i=4,Qn=5,on=6;function rn(t,e,n,o,i,s){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Fl(t,n,{name:e,index:o,group:i,on:Hl,tween:Ll,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:yi})}function eo(t,e){var n=ze(t,e);if(n.state>yi)throw new Error("too late; already scheduled");return n}function Oe(t,e){var n=ze(t,e);if(n.state>nn)throw new Error("too late; already running");return n}function ze(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Fl(t,e,n){var o=t.__transition,i;o[e]=n,n.timer=gi(s,0,n.time);function s(c){n.state=vi,n.timer.restart(a,n.delay,n.time),n.delay<=c&&a(c-n.delay)}function a(c){var u,h,f,g;if(n.state!==vi)return d();for(u in o)if(g=o[u],g.name===n.name){if(g.state===nn)return mi(a);g.state===_i?(g.state=on,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete o[u]):+u<e&&(g.state=on,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete o[u])}if(mi(function(){n.state===nn&&(n.state=_i,n.timer.restart(l,n.delay,n.time),l(c))}),n.state=Jn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Jn){for(n.state=nn,i=new Array(f=n.tween.length),u=0,h=-1;u<f;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++h]=g);i.length=h+1}}function l(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(d),n.state=Qn,1),h=-1,f=i.length;++h<f;)i[h].call(t,u);n.state===Qn&&(n.on.call("end",t,t.__data__,n.index,n.group),d())}function d(){n.state=on,n.timer.stop(),delete o[e];for(var c in o)return;delete t.__transition}}function sn(t,e){var n=t.__transition,o,i,s=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((o=n[a]).name!==e){s=!1;continue}i=o.state>Jn&&o.state<Qn,o.state=on,o.timer.stop(),o.on.call(i?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[a]}s&&delete t.__transition}}function Gl(t){return this.each(function(){sn(this,t)})}function Wl(t,e){var n,o;return function(){var i=Oe(this,t),s=i.tween;if(s!==n){o=n=s;for(var a=0,l=o.length;a<l;++a)if(o[a].name===e){o=o.slice(),o.splice(a,1);break}}i.tween=o}}function Ul(t,e,n){var o,i;if(typeof n!="function")throw new Error;return function(){var s=Oe(this,t),a=s.tween;if(a!==o){i=(o=a).slice();for(var l={name:e,value:n},d=0,c=i.length;d<c;++d)if(i[d].name===e){i[d]=l;break}d===c&&i.push(l)}s.tween=i}}function Yl(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=ze(this.node(),n).tween,i=0,s=o.length,a;i<s;++i)if((a=o[i]).name===t)return a.value;return null}return this.each((e==null?Wl:Ul)(n,t,e))}function to(t,e,n){var o=t._id;return t.each(function(){var i=Oe(this,o);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return ze(i,o).value[e]}}function wi(t,e){var n;return(typeof e=="number"?Pe:e instanceof Qe?Zt:(n=Qe(e))?(e=n,Zt):ai)(t,e)}function Xl(t){return function(){this.removeAttribute(t)}}function jl(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Zl(t,e,n){var o,i=n+"",s;return function(){var a=this.getAttribute(t);return a===i?null:a===o?s:s=e(o=a,n)}}function Kl(t,e,n){var o,i=n+"",s;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===o?s:s=e(o=a,n)}}function ql(t,e,n){var o,i,s;return function(){var a,l=n(this),d;return l==null?void this.removeAttribute(t):(a=this.getAttribute(t),d=l+"",a===d?null:a===o&&d===i?s:(i=d,s=e(o=a,l)))}}function Jl(t,e,n){var o,i,s;return function(){var a,l=n(this),d;return l==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),d=l+"",a===d?null:a===o&&d===i?s:(i=d,s=e(o=a,l)))}}function Ql(t,e){var n=Ft(t),o=n==="transform"?Bl:wi;return this.attrTween(t,typeof e=="function"?(n.local?Jl:ql)(n,o,to(this,"attr."+t,e)):e==null?(n.local?jl:Xl)(n):(n.local?Kl:Zl)(n,o,e))}function ec(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function tc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function nc(t,e){var n,o;function i(){var s=e.apply(this,arguments);return s!==o&&(n=(o=s)&&tc(t,s)),n}return i._value=e,i}function oc(t,e){var n,o;function i(){var s=e.apply(this,arguments);return s!==o&&(n=(o=s)&&ec(t,s)),n}return i._value=e,i}function ic(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=Ft(t);return this.tween(n,(o.local?nc:oc)(o,e))}function rc(t,e){return function(){eo(this,t).delay=+e.apply(this,arguments)}}function sc(t,e){return e=+e,function(){eo(this,t).delay=e}}function ac(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?rc:sc)(e,t)):ze(this.node(),e).delay}function lc(t,e){return function(){Oe(this,t).duration=+e.apply(this,arguments)}}function cc(t,e){return e=+e,function(){Oe(this,t).duration=e}}function dc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?lc:cc)(e,t)):ze(this.node(),e).duration}function uc(t,e){if(typeof e!="function")throw new Error;return function(){Oe(this,t).ease=e}}function fc(t){var e=this._id;return arguments.length?this.each(uc(e,t)):ze(this.node(),e).ease}function hc(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Oe(this,t).ease=n}}function gc(t){if(typeof t!="function")throw new Error;return this.each(hc(this._id,t))}function pc(t){typeof t!="function"&&(t=Oo(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var s=e[i],a=s.length,l=o[i]=[],d,c=0;c<a;++c)(d=s[c])&&t.call(d,d.__data__,c,s)&&l.push(d);return new Le(o,this._parents,this._name,this._id)}function mc(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,i=n.length,s=Math.min(o,i),a=new Array(o),l=0;l<s;++l)for(var d=e[l],c=n[l],u=d.length,h=a[l]=new Array(u),f,g=0;g<u;++g)(f=d[g]||c[g])&&(h[g]=f);for(;l<o;++l)a[l]=e[l];return new Le(a,this._parents,this._name,this._id)}function yc(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function vc(t,e,n){var o,i,s=yc(e)?eo:Oe;return function(){var a=s(this,t),l=a.on;l!==o&&(i=(o=l).copy()).on(e,n),a.on=i}}function _c(t,e){var n=this._id;return arguments.length<2?ze(this.node(),n).on.on(t):this.each(vc(n,t,e))}function wc(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function bc(){return this.on("end.remove",wc(this._id))}function Cc(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Vn(t));for(var o=this._groups,i=o.length,s=new Array(i),a=0;a<i;++a)for(var l=o[a],d=l.length,c=s[a]=new Array(d),u,h,f=0;f<d;++f)(u=l[f])&&(h=t.call(u,u.__data__,f,l))&&("__data__"in u&&(h.__data__=u.__data__),c[f]=h,rn(c[f],e,n,f,c,ze(u,n)));return new Le(s,this._parents,e,n)}function Ec(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Po(t));for(var o=this._groups,i=o.length,s=[],a=[],l=0;l<i;++l)for(var d=o[l],c=d.length,u,h=0;h<c;++h)if(u=d[h]){for(var f=t.call(u,u.__data__,h,d),g,p=ze(u,n),b=0,S=f.length;b<S;++b)(g=f[b])&&rn(g,e,n,b,f,p);s.push(f),a.push(u)}return new Le(s,a,e,n)}var xc=bt.prototype.constructor;function Nc(){return new xc(this._groups,this._parents)}function kc(t,e){var n,o,i;return function(){var s=lt(this,t),a=(this.style.removeProperty(t),lt(this,t));return s===a?null:s===n&&a===o?i:i=e(n=s,o=a)}}function bi(t){return function(){this.style.removeProperty(t)}}function Sc(t,e,n){var o,i=n+"",s;return function(){var a=lt(this,t);return a===i?null:a===o?s:s=e(o=a,n)}}function Dc(t,e,n){var o,i,s;return function(){var a=lt(this,t),l=n(this),d=l+"";return l==null&&(d=l=(this.style.removeProperty(t),lt(this,t))),a===d?null:a===o&&d===i?s:(i=d,s=e(o=a,l))}}function Tc(t,e){var n,o,i,s="style."+e,a="end."+s,l;return function(){var d=Oe(this,t),c=d.on,u=d.value[s]==null?l||(l=bi(e)):void 0;(c!==n||i!==u)&&(o=(n=c).copy()).on(a,i=u),d.on=o}}function Mc(t,e,n){var o=(t+="")=="transform"?Il:wi;return e==null?this.styleTween(t,kc(t,o)).on("end.style."+t,bi(t)):typeof e=="function"?this.styleTween(t,Dc(t,o,to(this,"style."+t,e))).each(Tc(this._id,t)):this.styleTween(t,Sc(t,o,e),n).on("end.style."+t,null)}function Ic(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function Bc(t,e,n){var o,i;function s(){var a=e.apply(this,arguments);return a!==i&&(o=(i=a)&&Ic(t,a,n)),o}return s._value=e,s}function zc(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,Bc(t,e,n??""))}function Rc(t){return function(){this.textContent=t}}function Ac(t){return function(){var e=t(this);this.textContent=e??""}}function $c(t){return this.tween("text",typeof t=="function"?Ac(to(this,"text",t)):Rc(t==null?"":t+""))}function Pc(t){return function(e){this.textContent=t.call(this,e)}}function Oc(t){var e,n;function o(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Pc(i)),e}return o._value=t,o}function Vc(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Oc(t))}function Hc(){for(var t=this._name,e=this._id,n=Ci(),o=this._groups,i=o.length,s=0;s<i;++s)for(var a=o[s],l=a.length,d,c=0;c<l;++c)if(d=a[c]){var u=ze(d,e);rn(d,t,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Le(o,this._parents,t,n)}function Lc(){var t,e,n=this,o=n._id,i=n.size();return new Promise(function(s,a){var l={value:a},d={value:function(){--i===0&&s()}};n.each(function(){var c=Oe(this,o),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(d)),c.on=e}),i===0&&s()})}var Fc=0;function Le(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function Ci(){return++Fc}var Fe=bt.prototype;Le.prototype={constructor:Le,select:Cc,selectAll:Ec,selectChild:Fe.selectChild,selectChildren:Fe.selectChildren,filter:pc,merge:mc,selection:Nc,transition:Hc,call:Fe.call,nodes:Fe.nodes,node:Fe.node,size:Fe.size,empty:Fe.empty,each:Fe.each,on:_c,attr:Ql,attrTween:ic,style:Mc,styleTween:zc,text:$c,textTween:Vc,remove:bc,tween:Yl,delay:ac,duration:dc,ease:fc,easeVarying:gc,end:Lc,[Symbol.iterator]:Fe[Symbol.iterator]};function Gc(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Wc={time:null,delay:0,duration:250,ease:Gc};function Uc(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Yc(t){var e,n;t instanceof Le?(e=t._id,t=t._name):(e=Ci(),(n=Wc).time=Kn(),t=t==null?null:t+"");for(var o=this._groups,i=o.length,s=0;s<i;++s)for(var a=o[s],l=a.length,d,c=0;c<l;++c)(d=a[c])&&rn(d,t,e,c,a,n||Uc(d,e));return new Le(o,this._parents,t,e)}bt.prototype.interrupt=Gl,bt.prototype.transition=Yc;var an=t=>()=>t;function Xc(t,{sourceEvent:e,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function Ge(t,e,n){this.k=t,this.x=e,this.y=n}Ge.prototype={constructor:Ge,scale:function(t){return t===1?this:new Ge(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Ge(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ft=new Ge(1,0,0);Ge.prototype;function no(t){t.stopImmediatePropagation()}function It(t){t.preventDefault(),t.stopImmediatePropagation()}function jc(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Zc(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Ei(){return this.__zoom||ft}function Kc(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function qc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Jc(t,e,n){var o=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Qc(){var t=jc,e=Zc,n=Jc,o=Kc,i=qc,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,d=qt,c=Ht("start","zoom","end"),u,h,f,g=500,p=150,b=0,S=10;function D(w){w.property("__zoom",Ei).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",K).filter(i).on("touchstart.zoom",G).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}D.transform=function(w,V,m,E){var B=w.selection?w.selection():w;B.property("__zoom",Ei),w!==B?U(w,V,m,E):B.interrupt().each(function(){$(this,arguments).event(E).start().zoom(null,typeof V=="function"?V.apply(this,arguments):V).end()})},D.scaleBy=function(w,V,m,E){D.scaleTo(w,function(){return this.__zoom.k*(typeof V=="function"?V.apply(this,arguments):V)},m,E)},D.scaleTo=function(w,V,m,E){D.transform(w,function(){var B=e.apply(this,arguments),T=this.__zoom,A=m==null?M(B):typeof m=="function"?m.apply(this,arguments):m,H=T.invert(A),F=typeof V=="function"?V.apply(this,arguments):V;return n(v(z(T,F),A,H),B,a)},m,E)},D.translateBy=function(w,V,m,E){D.transform(w,function(){return n(this.__zoom.translate(typeof V=="function"?V.apply(this,arguments):V,typeof m=="function"?m.apply(this,arguments):m),e.apply(this,arguments),a)},null,E)},D.translateTo=function(w,V,m,E,B){D.transform(w,function(){var T=e.apply(this,arguments),A=this.__zoom,H=E==null?M(T):typeof E=="function"?E.apply(this,arguments):E;return n(ft.translate(H[0],H[1]).scale(A.k).translate(typeof V=="function"?-V.apply(this,arguments):-V,typeof m=="function"?-m.apply(this,arguments):-m),T,a)},E,B)};function z(w,V){return V=Math.max(s[0],Math.min(s[1],V)),V===w.k?w:new Ge(V,w.x,w.y)}function v(w,V,m){var E=V[0]-m[0]*w.k,B=V[1]-m[1]*w.k;return E===w.x&&B===w.y?w:new Ge(w.k,E,B)}function M(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function U(w,V,m,E){w.on("start.zoom",function(){$(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(E).end()}).tween("zoom",function(){var B=this,T=arguments,A=$(B,T).event(E),H=e.apply(B,T),F=m==null?M(H):typeof m=="function"?m.apply(B,T):m,te=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),se=B.__zoom,L=typeof V=="function"?V.apply(B,T):V,Z=d(se.invert(F).concat(te/se.k),L.invert(F).concat(te/L.k));return function(P){if(P===1)P=L;else{var X=Z(P),ne=te/X[2];P=new Ge(ne,F[0]-X[0]*ne,F[1]-X[1]*ne)}A.zoom(null,P)}})}function $(w,V,m){return!m&&w.__zooming||new Q(w,V)}function Q(w,V){this.that=w,this.args=V,this.active=0,this.sourceEvent=null,this.extent=e.apply(w,V),this.taps=0}Q.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,V){return this.mouse&&w!=="mouse"&&(this.mouse[1]=V.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=V.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=V.invert(this.touch1[0])),this.that.__zoom=V,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var V=Ie(this.that).datum();c.call(w,this.that,new Xc(w,{sourceEvent:this.sourceEvent,target:D,type:w,transform:this.that.__zoom,dispatch:c}),V)}};function q(w,...V){if(!t.apply(this,arguments))return;var m=$(this,V).event(w),E=this.__zoom,B=Math.max(s[0],Math.min(s[1],E.k*Math.pow(2,o.apply(this,arguments)))),T=Ae(w);if(m.wheel)(m.mouse[0][0]!==T[0]||m.mouse[0][1]!==T[1])&&(m.mouse[1]=E.invert(m.mouse[0]=T)),clearTimeout(m.wheel);else{if(E.k===B)return;m.mouse=[T,E.invert(T)],sn(this),m.start()}It(w),m.wheel=setTimeout(A,p),m.zoom("mouse",n(v(z(E,B),m.mouse[0],m.mouse[1]),m.extent,a));function A(){m.wheel=null,m.end()}}function j(w,...V){if(f||!t.apply(this,arguments))return;var m=w.currentTarget,E=$(this,V,!0).event(w),B=Ie(w.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",te,!0),T=Ae(w,m),A=w.clientX,H=w.clientY;jo(w.view),no(w),E.mouse=[T,this.__zoom.invert(T)],sn(this),E.start();function F(se){if(It(se),!E.moved){var L=se.clientX-A,Z=se.clientY-H;E.moved=L*L+Z*Z>b}E.event(se).zoom("mouse",n(v(E.that.__zoom,E.mouse[0]=Ae(se,m),E.mouse[1]),E.extent,a))}function te(se){B.on("mousemove.zoom mouseup.zoom",null),Zo(se.view,E.moved),It(se),E.event(se).end()}}function K(w,...V){if(t.apply(this,arguments)){var m=this.__zoom,E=Ae(w.changedTouches?w.changedTouches[0]:w,this),B=m.invert(E),T=m.k*(w.shiftKey?.5:2),A=n(v(z(m,T),E,B),e.apply(this,V),a);It(w),l>0?Ie(this).transition().duration(l).call(U,A,E,w):Ie(this).call(D.transform,A,E,w)}}function G(w,...V){if(t.apply(this,arguments)){var m=w.touches,E=m.length,B=$(this,V,w.changedTouches.length===E).event(w),T,A,H,F;for(no(w),A=0;A<E;++A)H=m[A],F=Ae(H,this),F=[F,this.__zoom.invert(F),H.identifier],B.touch0?!B.touch1&&B.touch0[2]!==F[2]&&(B.touch1=F,B.taps=0):(B.touch0=F,T=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(B.taps<2&&(h=F[0],u=setTimeout(function(){u=null},g)),sn(this),B.start())}}function k(w,...V){if(this.__zooming){var m=$(this,V).event(w),E=w.changedTouches,B=E.length,T,A,H,F;for(It(w),T=0;T<B;++T)A=E[T],H=Ae(A,this),m.touch0&&m.touch0[2]===A.identifier?m.touch0[0]=H:m.touch1&&m.touch1[2]===A.identifier&&(m.touch1[0]=H);if(A=m.that.__zoom,m.touch1){var te=m.touch0[0],se=m.touch0[1],L=m.touch1[0],Z=m.touch1[1],P=(P=L[0]-te[0])*P+(P=L[1]-te[1])*P,X=(X=Z[0]-se[0])*X+(X=Z[1]-se[1])*X;A=z(A,Math.sqrt(P/X)),H=[(te[0]+L[0])/2,(te[1]+L[1])/2],F=[(se[0]+Z[0])/2,(se[1]+Z[1])/2]}else if(m.touch0)H=m.touch0[0],F=m.touch0[1];else return;m.zoom("touch",n(v(A,H,F),m.extent,a))}}function Y(w,...V){if(this.__zooming){var m=$(this,V).event(w),E=w.changedTouches,B=E.length,T,A;for(no(w),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),T=0;T<B;++T)A=E[T],m.touch0&&m.touch0[2]===A.identifier?delete m.touch0:m.touch1&&m.touch1[2]===A.identifier&&delete m.touch1;if(m.touch1&&!m.touch0&&(m.touch0=m.touch1,delete m.touch1),m.touch0)m.touch0[1]=this.__zoom.invert(m.touch0[0]);else if(m.end(),m.taps===2&&(A=Ae(A,this),Math.hypot(h[0]-A[0],h[1]-A[1])<S)){var H=Ie(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return D.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:an(+w),D):o},D.filter=function(w){return arguments.length?(t=typeof w=="function"?w:an(!!w),D):t},D.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:an(!!w),D):i},D.extent=function(w){return arguments.length?(e=typeof w=="function"?w:an([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),D):e},D.scaleExtent=function(w){return arguments.length?(s[0]=+w[0],s[1]=+w[1],D):[s[0],s[1]]},D.translateExtent=function(w){return arguments.length?(a[0][0]=+w[0][0],a[1][0]=+w[1][0],a[0][1]=+w[0][1],a[1][1]=+w[1][1],D):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},D.constrain=function(w){return arguments.length?(n=w,D):n},D.duration=function(w){return arguments.length?(l=+w,D):l},D.interpolate=function(w){return arguments.length?(d=w,D):d},D.on=function(){var w=c.on.apply(c,arguments);return w===c?D:w},D.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,D):Math.sqrt(b)},D.tapDistance=function(w){return arguments.length?(S=+w,D):S},D}var ae=(t=>(t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom",t))(ae||{}),oo=(t=>(t.Partial="partial",t.Full="full",t))(oo||{}),ot=(t=>(t.Bezier="default",t.SimpleBezier="simple-bezier",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t))(ot||{}),We=(t=>(t.Strict="strict",t.Loose="loose",t))(We||{}),Ue=(t=>(t.Arrow="arrow",t.ArrowClosed="arrowclosed",t))(Ue||{}),Bt=(t=>(t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal",t))(Bt||{}),xi=(t=>(t.TopLeft="top-left",t.TopCenter="top-center",t.TopRight="top-right",t.BottomLeft="bottom-left",t.BottomCenter="bottom-center",t.BottomRight="bottom-right",t))(xi||{}),ed=["INPUT","SELECT","TEXTAREA"],td=typeof document<"u"?document:null;function io(t){var e,n;const o=((n=(e=t.composedPath)==null?void 0:e.call(t))==null?void 0:n[0])||t.target,i=typeof o?.hasAttribute=="function"?o.hasAttribute("contenteditable"):!1,s=typeof o?.closest=="function"?o.closest(".nokey"):null;return ed.includes(o?.nodeName)||i||!!s}function nd(t){return t.ctrlKey||t.metaKey||t.shiftKey||t.altKey}function Ni(t,e,n,o){const i=e.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
5
5
  +`).split(`
6
- `).map(a=>a.trim().toLowerCase());if(i.length===1)return t.toLowerCase()===e.toLowerCase();o||n.add(t.toLowerCase());const s=i.every((a,l)=>n.has(a)&&Array.from(n.values())[l]===i[l]);return o&&n.delete(t.toLowerCase()),s}function ed(t,e){return n=>{if(!n.code&&!n.key)return!1;const o=td(n.code,t);return Array.isArray(t)?t.some(i=>xi(n[o],i,e,n.type==="keyup")):xi(n[o],t,e,n.type==="keyup")}}function td(t,e){return e.includes(t)?"code":"key"}function Bt(t,e){const n=(0,r.computed)(()=>(0,r.toValue)(e?.target)??Jc),o=(0,r.shallowRef)((0,r.toValue)(t)===!0);let i=!1;const s=new Set;let a=d((0,r.toValue)(t));(0,r.watch)(()=>(0,r.toValue)(t),(c,u)=>{typeof u=="boolean"&&typeof c!="boolean"&&l(),a=d(c)},{immediate:!0}),Io(["blur","contextmenu"],l),Bo((...c)=>a(...c),c=>{var u,h;const f=(0,r.toValue)(e?.actInsideInputWithModifier)??!0,g=(0,r.toValue)(e?.preventDefault)??!1;if(i=Qc(c),(!i||i&&!f)&&oo(c))return;const m=((h=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:h[0])||c.target,E=m?.nodeName==="BUTTON"||m?.nodeName==="A";!g&&(i||!E)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),Bo((...c)=>a(...c),c=>{const u=(0,r.toValue)(e?.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!u)&&oo(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function l(){i=!1,s.clear(),o.value=(0,r.toValue)(t)===!0}function d(c){return c===null?(l(),()=>!1):typeof c=="boolean"?(l(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?ed(c,s):c}return o}var Ni="vue-flow__node-desc",ki="vue-flow__edge-desc",nd="vue-flow__aria-live",Si=["Enter"," ","Escape"],ft={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function ln(t){return{...t.computedPosition||{x:0,y:0},width:t.dimensions.width||0,height:t.dimensions.height||0}}function cn(t,e){const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)}function dn(t){return{width:t.offsetWidth,height:t.offsetHeight}}function ot(t,e=0,n=1){return Math.min(Math.max(t,e),n)}function Di(t,e){return{x:ot(t.x,e[0][0],e[1][0]),y:ot(t.y,e[0][1],e[1][1])}}function Ti(t){const e=t.getRootNode();return"elementFromPoint"in e?e:window.document}function Ue(t){return t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t}function it(t){return t&&typeof t=="object"&&"id"in t&&"position"in t&&!Ue(t)}function zt(t){return it(t)&&"computedPosition"in t}function un(t){return!Number.isNaN(t)&&Number.isFinite(t)}function od(t){return un(t.width)&&un(t.height)&&un(t.x)&&un(t.y)}function id(t,e,n){const o={id:t.id.toString(),type:t.type??"default",dimensions:(0,r.markRaw)({width:0,height:0}),computedPosition:(0,r.markRaw)({z:0,...t.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:_e(t.data)?t.data:{},events:(0,r.markRaw)(_e(t.events)?t.events:{})};return Object.assign(e??o,t,{id:t.id.toString(),parentNode:n})}function Mi(t,e,n){var o,i;const s={id:t.id.toString(),type:t.type??e?.type??"default",source:t.source.toString(),target:t.target.toString(),sourceHandle:(o=t.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=t.targetHandle)==null?void 0:i.toString(),updatable:t.updatable??n?.updatable,selectable:t.selectable??n?.selectable,focusable:t.focusable??n?.focusable,data:_e(t.data)?t.data:{},events:(0,r.markRaw)(_e(t.events)?t.events:{}),label:t.label??"",interactionWidth:t.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(e??s,t,{id:t.id.toString()})}function Ii(t,e,n,o){const i=typeof t=="string"?t:t.id,s=new Set,a=o==="source"?"target":"source";for(const l of n)l[a]===i&&s.add(l[o]);return e.filter(l=>s.has(l.id))}function rd(...t){if(t.length===3){const[i,s,a]=t;return Ii(i,s,a,"target")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(i=>Ue(i)&&i.source===o).map(i=>n.find(s=>it(s)&&s.id===i.target))}function sd(...t){if(t.length===3){const[i,s,a]=t;return Ii(i,s,a,"source")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(i=>Ue(i)&&i.target===o).map(i=>n.find(s=>it(s)&&s.id===i.source))}function Bi({source:t,sourceHandle:e,target:n,targetHandle:o}){return`vueflow__edge-${t}${e??""}-${n}${o??""}`}function ad(t,e){return e.some(n=>Ue(n)&&n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle))}function Rt({x:t,y:e},{x:n,y:o,zoom:i}){return{x:t*i+n,y:e*i+o}}function At({x:t,y:e},{x:n,y:o,zoom:i},s=!1,a=[1,1]){const l={x:(t-n)/i,y:(e-o)/i};return s?hn(l,a):l}function ld(t,e){return{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}}function zi({x:t,y:e,width:n,height:o}){return{x:t,y:e,x2:t+n,y2:e+o}}function cd({x:t,y:e,x2:n,y2:o}){return{x:t,y:e,width:n-t,height:o-e}}function Ri(t){let e={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<t.length;n++){const o=t[n];e=ld(e,zi({...o.computedPosition,...o.dimensions}))}return cd(e)}function Ai(t,e,n={x:0,y:0,zoom:1},o=!1,i=!1){const s={...At(e,n),width:e.width/n.zoom,height:e.height/n.zoom},a=[];for(const l of t){const{dimensions:d,selectable:c=!0,hidden:u=!1}=l,h=d.width??l.width??null,f=d.height??l.height??null;if(i&&!c||u)continue;const g=cn(s,ln(l)),m=h===null||f===null,E=o&&g>0,S=(h??0)*(f??0);(m||E||g>=S||l.dragging)&&a.push(l)}return a}function $i(t,e){const n=new Set;if(typeof t=="string")n.add(t);else if(t.length>=1)for(const o of t)n.add(o.id);return e.filter(o=>n.has(o.source)||n.has(o.target))}function ht(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=Number.parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=Number.parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return Pt(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function dd(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=ht(t,n),i=ht(t,e);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof t=="object"){const o=ht(t.top??t.y??0,n),i=ht(t.bottom??t.y??0,n),s=ht(t.left??t.x??0,e),a=ht(t.right??t.x??0,e);return{top:o,right:a,bottom:i,left:s,x:s+a,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ud(t,e,n,o,i,s){const{x:a,y:l}=Rt(t,{x:e,y:n,zoom:o}),{x:d,y:c}=Rt({x:t.x+t.width,y:t.y+t.height},{x:e,y:n,zoom:o}),u=i-d,h=s-c;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(u),bottom:Math.floor(h)}}function Pi(t,e,n,o,i,s=.1){const a=dd(s,e,n),l=(e-a.x)/t.width,d=(n-a.y)/t.height,c=ot(Math.min(l,d),o,i),u=t.x+t.width/2,h=t.y+t.height/2,f=e/2-u*c,g=n/2-h*c,m=ud(t,f,g,c,e,n),E={left:Math.min(m.left-a.left,0),top:Math.min(m.top-a.top,0),right:Math.min(m.right-a.right,0),bottom:Math.min(m.bottom-a.bottom,0)};return{x:f-E.left+E.right,y:g-E.top+E.bottom,zoom:c}}function fd(t,e){return{x:e.x+t.x,y:e.y+t.y,z:(t.z>e.z?t.z:e.z)+1}}function Oi(t,e){if(!t.parentNode)return!1;const n=e.get(t.parentNode);return n?n.selected?!0:Oi(n,e):!1}function $t(t,e){return typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`}function Vi(t){const e=t.ctrlKey&&fn()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e}function Hi(t,e,n){return t<e?ot(Math.abs(t-e),1,e)/e:t>n?-ot(Math.abs(t-n),1,e)/e:0}function Li(t,e,n=15,o=40){return[Hi(t.x,o,e.width-o)*n,Hi(t.y,o,e.height-o)*n]}function io(t,e){if(e){const n=t.position.x+t.dimensions.width-e.dimensions.width,o=t.position.y+t.dimensions.height-e.dimensions.height;if(n>0||o>0||t.position.x<0||t.position.y<0){let i={};if(typeof e.style=="function"?i={...e.style(e)}:e.style&&(i={...e.style}),i.width=i.width??`${e.dimensions.width}px`,i.height=i.height??`${e.dimensions.height}px`,n>0)if(typeof i.width=="string"){const s=Number(i.width.replace("px",""));i.width=`${s+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const s=Number(i.height.replace("px",""));i.height=`${s+o}px`}else i.height+=o;if(t.position.x<0){const s=Math.abs(t.position.x);if(e.position.x=e.position.x-s,typeof i.width=="string"){const a=Number(i.width.replace("px",""));i.width=`${a+s}px`}else i.width+=s;t.position.x=0}if(t.position.y<0){const s=Math.abs(t.position.y);if(e.position.y=e.position.y-s,typeof i.height=="string"){const a=Number(i.height.replace("px",""));i.height=`${a+s}px`}else i.height+=s;t.position.y=0}e.dimensions.width=Number(i.width.toString().replace("px","")),e.dimensions.height=Number(i.height.toString().replace("px","")),typeof e.style=="function"?e.style=s=>{const a=e.style;return{...a(s),...i}}:e.style={...e.style,...i}}}}function Fi(t,e){var n,o;const i=t.filter(a=>a.type==="add"||a.type==="remove");for(const a of i)if(a.type==="add")e.findIndex(l=>l.id===a.item.id)===-1&&e.push(a.item);else if(a.type==="remove"){const l=e.findIndex(d=>d.id===a.id);l!==-1&&e.splice(l,1)}const s=e.map(a=>a.id);for(const a of e)for(const l of t)if(l.id===a.id)switch(l.type){case"select":a.selected=l.selected;break;case"position":if(zt(a)&&(typeof l.position<"u"&&(a.position=l.position),typeof l.dragging<"u"&&(a.dragging=l.dragging),a.expandParent&&a.parentNode)){const d=e[s.indexOf(a.parentNode)];d&&zt(d)&&io(a,d)}break;case"dimensions":if(zt(a)&&(typeof l.dimensions<"u"&&(a.dimensions=l.dimensions),typeof l.updateStyle<"u"&&l.updateStyle&&(a.style={...a.style||{},width:`${(n=l.dimensions)==null?void 0:n.width}px`,height:`${(o=l.dimensions)==null?void 0:o.height}px`}),typeof l.resizing<"u"&&(a.resizing=l.resizing),a.expandParent&&a.parentNode)){const d=e[s.indexOf(a.parentNode)];d&&zt(d)&&(d.dimensions.width&&d.dimensions.height?io(a,d):(0,r.nextTick)(()=>{io(a,d)}))}break}return e}function Ye(t,e){return{id:t,type:"select",selected:e}}function Gi(t){return{item:t,type:"add"}}function Wi(t){return{id:t,type:"remove"}}function Ui(t,e,n,o,i){return{id:t,source:e,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function Xe(t,e=new Set,n=!1){const o=[];for(const[i,s]of t){const a=e.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),o.push(Ye(s.id,a)))}return o}var Yi=()=>{};function ne(t){const e=new Set;let n=Yi,o=()=>!1;const i=()=>e.size>0||o(),s=f=>{n=f},a=()=>{n=Yi},l=f=>{o=f},d=()=>{o=()=>!1},c=f=>{e.delete(f)};return{on:f=>{e.add(f);const g=()=>c(f);return _t(g),{off:g}},off:c,trigger:f=>{const g=[n];return i()?g.push(...e):t&&g.push(t),Promise.allSettled(g.map(m=>m(f)))},hasListeners:i,listeners:e,setEmitter:s,removeEmitter:a,setHasEmitListeners:l,removeHasEmitListeners:d}}function Xi(t,e,n){let o=t;do{if(o&&o.matches(e))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function hd(t,e,n,o){var i,s;const a=new Map;for(const[l,d]of t)(d.selected||d.id===o)&&(!d.parentNode||!Oi(d,t))&&(d.draggable||e&&typeof d.draggable>"u")&&t.get(l)&&a.set(l,{id:d.id,position:d.position||{x:0,y:0},distance:{x:n.x-((i=d.computedPosition)==null?void 0:i.x)||0,y:n.y-((s=d.computedPosition)==null?void 0:s.y)||0},from:{x:d.computedPosition.x,y:d.computedPosition.y},extent:d.extent,parentNode:d.parentNode,dimensions:{...d.dimensions},expandParent:d.expandParent});return Array.from(a.values())}function ro({id:t,dragItems:e,findNode:n}){const o=[];for(const i of e){const s=n(i.id);s&&o.push(s)}return[t?o.find(i=>i.id===t):o[0],o]}function ji(t){if(Array.isArray(t))switch(t.length){case 1:return[t[0],t[0],t[0],t[0]];case 2:return[t[0],t[1],t[0],t[1]];case 3:return[t[0],t[1],t[2],t[1]];case 4:return t;default:return[0,0,0,0]}return[t,t,t,t]}function gd(t,e,n){const[o,i,s,a]=typeof t!="string"?ji(t.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+a,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-s]]:!1}function pd(t,e,n,o){let i=t.extent||n;if((i==="parent"||!Array.isArray(i)&&i?.range==="parent")&&!t.expandParent)if(t.parentNode&&o&&t.dimensions.width&&t.dimensions.height){const s=gd(i,t,o);s&&(i=s)}else e(new we(ve.NODE_EXTENT_INVALID,t.id)),i=n;else if(Array.isArray(i)){const s=o?.computedPosition.x||0,a=o?.computedPosition.y||0;i=[[i[0][0]+s,i[0][1]+a],[i[1][0]+s,i[1][1]+a]]}else if(i!=="parent"&&i?.range&&Array.isArray(i.range)){const[s,a,l,d]=ji(i.padding),c=o?.computedPosition.x||0,u=o?.computedPosition.y||0;i=[[i.range[0][0]+c+d,i.range[0][1]+u+s],[i.range[1][0]+c-a,i.range[1][1]+u-l]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function md({width:t,height:e},n){return[n[0],[n[1][0]-(t||0),n[1][1]-(e||0)]]}function so(t,e,n,o,i){const s=Di(e,md(t.dimensions,pd(t,n,o,i)));return{position:{x:s.x-(i?.computedPosition.x||0),y:s.y-(i?.computedPosition.y||0)},computedPosition:s}}function gt(t,e,n=ae.Left,o=!1){const i=(e?.x??0)+t.computedPosition.x,s=(e?.y??0)+t.computedPosition.y,{width:a,height:l}=e??wd(t);if(o)return{x:i+a/2,y:s+l/2};switch(e?.position??n){case ae.Top:return{x:i+a/2,y:s};case ae.Right:return{x:i+a,y:s+l/2};case ae.Bottom:return{x:i+a/2,y:s+l};case ae.Left:return{x:i,y:s+l/2}}}function Zi(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function yd({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:s,width:a,height:l,viewport:d}){const c={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+i),y2:Math.max(t.y+o,e.y+s)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const u=zi({x:(0-d.x)/d.zoom,y:(0-d.y)/d.zoom,width:a/d.zoom,height:l/d.zoom}),h=Math.max(0,Math.min(u.x2,c.x2)-Math.max(u.x,c.x)),f=Math.max(0,Math.min(u.y2,c.y2)-Math.max(u.y,c.y));return Math.ceil(h*f)>0}function vd(t,e,n=!1){const o=typeof t.zIndex=="number";let i=o?t.zIndex:0;const s=e(t.source),a=e(t.target);return!s||!a?0:(n&&(i=o?t.zIndex:Math.max(s.computedPosition.z||0,a.computedPosition.z||0)),i)}var ve=(t=>(t.MISSING_STYLES="MISSING_STYLES",t.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",t.NODE_INVALID="NODE_INVALID",t.NODE_NOT_FOUND="NODE_NOT_FOUND",t.NODE_MISSING_PARENT="NODE_MISSING_PARENT",t.NODE_TYPE_MISSING="NODE_TYPE_MISSING",t.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",t.EDGE_INVALID="EDGE_INVALID",t.EDGE_NOT_FOUND="EDGE_NOT_FOUND",t.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",t.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",t.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",t.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",t.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",t.EDGE_ORPHANED="EDGE_ORPHANED",t.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",t))(ve||{}),Ki={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:t=>`Node is invalid
6
+ `).map(a=>a.trim().toLowerCase());if(i.length===1)return t.toLowerCase()===e.toLowerCase();o||n.add(t.toLowerCase());const s=i.every((a,l)=>n.has(a)&&Array.from(n.values())[l]===i[l]);return o&&n.delete(t.toLowerCase()),s}function od(t,e){return n=>{if(!n.code&&!n.key)return!1;const o=id(n.code,t);return Array.isArray(t)?t.some(i=>Ni(n[o],i,e,n.type==="keyup")):Ni(n[o],t,e,n.type==="keyup")}}function id(t,e){return e.includes(t)?"code":"key"}function zt(t,e){const n=(0,r.computed)(()=>(0,r.toValue)(e?.target)??td),o=(0,r.shallowRef)((0,r.toValue)(t)===!0);let i=!1;const s=new Set;let a=d((0,r.toValue)(t));(0,r.watch)(()=>(0,r.toValue)(t),(c,u)=>{typeof u=="boolean"&&typeof c!="boolean"&&l(),a=d(c)},{immediate:!0}),Bo(["blur","contextmenu"],l),zo((...c)=>a(...c),c=>{var u,h;const f=(0,r.toValue)(e?.actInsideInputWithModifier)??!0,g=(0,r.toValue)(e?.preventDefault)??!1;if(i=nd(c),(!i||i&&!f)&&io(c))return;const p=((h=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:h[0])||c.target,b=p?.nodeName==="BUTTON"||p?.nodeName==="A";!g&&(i||!b)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),zo((...c)=>a(...c),c=>{const u=(0,r.toValue)(e?.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!u)&&io(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function l(){i=!1,s.clear(),o.value=(0,r.toValue)(t)===!0}function d(c){return c===null?(l(),()=>!1):typeof c=="boolean"?(l(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?od(c,s):c}return o}var ki="vue-flow__node-desc",Si="vue-flow__edge-desc",rd="vue-flow__aria-live",Di=["Enter"," ","Escape"],ht={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function ln(t){return{...t.computedPosition||{x:0,y:0},width:t.dimensions.width||0,height:t.dimensions.height||0}}function cn(t,e){const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)}function dn(t){return{width:t.offsetWidth,height:t.offsetHeight}}function it(t,e=0,n=1){return Math.min(Math.max(t,e),n)}function Ti(t,e){return{x:it(t.x,e[0][0],e[1][0]),y:it(t.y,e[0][1],e[1][1])}}function Mi(t){const e=t.getRootNode();return"elementFromPoint"in e?e:window.document}function Xe(t){return t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t}function rt(t){return t&&typeof t=="object"&&"id"in t&&"position"in t&&!Xe(t)}function Rt(t){return rt(t)&&"computedPosition"in t}function un(t){return!Number.isNaN(t)&&Number.isFinite(t)}function sd(t){return un(t.width)&&un(t.height)&&un(t.x)&&un(t.y)}function ad(t,e,n){const o={id:t.id.toString(),type:t.type??"default",dimensions:(0,r.markRaw)({width:0,height:0}),computedPosition:(0,r.markRaw)({z:0,...t.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:_e(t.data)?t.data:{},events:(0,r.markRaw)(_e(t.events)?t.events:{})};return Object.assign(e??o,t,{id:t.id.toString(),parentNode:n})}function Ii(t,e,n){var o,i;const s={id:t.id.toString(),type:t.type??e?.type??"default",source:t.source.toString(),target:t.target.toString(),sourceHandle:(o=t.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=t.targetHandle)==null?void 0:i.toString(),updatable:t.updatable??n?.updatable,selectable:t.selectable??n?.selectable,focusable:t.focusable??n?.focusable,data:_e(t.data)?t.data:{},events:(0,r.markRaw)(_e(t.events)?t.events:{}),label:t.label??"",interactionWidth:t.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(e??s,t,{id:t.id.toString()})}function Bi(t,e,n,o){const i=typeof t=="string"?t:t.id,s=new Set,a=o==="source"?"target":"source";for(const l of n)l[a]===i&&s.add(l[o]);return e.filter(l=>s.has(l.id))}function ld(...t){if(t.length===3){const[i,s,a]=t;return Bi(i,s,a,"target")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(i=>Xe(i)&&i.source===o).map(i=>n.find(s=>rt(s)&&s.id===i.target))}function cd(...t){if(t.length===3){const[i,s,a]=t;return Bi(i,s,a,"source")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(i=>Xe(i)&&i.target===o).map(i=>n.find(s=>rt(s)&&s.id===i.source))}function zi({source:t,sourceHandle:e,target:n,targetHandle:o}){return`vueflow__edge-${t}${e??""}-${n}${o??""}`}function dd(t,e){return e.some(n=>Xe(n)&&n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle))}function At({x:t,y:e},{x:n,y:o,zoom:i}){return{x:t*i+n,y:e*i+o}}function $t({x:t,y:e},{x:n,y:o,zoom:i},s=!1,a=[1,1]){const l={x:(t-n)/i,y:(e-o)/i};return s?hn(l,a):l}function ud(t,e){return{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}}function Ri({x:t,y:e,width:n,height:o}){return{x:t,y:e,x2:t+n,y2:e+o}}function fd({x:t,y:e,x2:n,y2:o}){return{x:t,y:e,width:n-t,height:o-e}}function Ai(t){let e={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<t.length;n++){const o=t[n];e=ud(e,Ri({...o.computedPosition,...o.dimensions}))}return fd(e)}function $i(t,e,n={x:0,y:0,zoom:1},o=!1,i=!1){const s={...$t(e,n),width:e.width/n.zoom,height:e.height/n.zoom},a=[];for(const l of t){const{dimensions:d,selectable:c=!0,hidden:u=!1}=l,h=d.width??l.width??null,f=d.height??l.height??null;if(i&&!c||u)continue;const g=cn(s,ln(l)),p=h===null||f===null,b=o&&g>0,S=(h??0)*(f??0);(p||b||g>=S||l.dragging)&&a.push(l)}return a}function Pi(t,e){const n=new Set;if(typeof t=="string")n.add(t);else if(t.length>=1)for(const o of t)n.add(o.id);return e.filter(o=>n.has(o.source)||n.has(o.target))}function gt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=Number.parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=Number.parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return Ot(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function hd(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=gt(t,n),i=gt(t,e);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof t=="object"){const o=gt(t.top??t.y??0,n),i=gt(t.bottom??t.y??0,n),s=gt(t.left??t.x??0,e),a=gt(t.right??t.x??0,e);return{top:o,right:a,bottom:i,left:s,x:s+a,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function gd(t,e,n,o,i,s){const{x:a,y:l}=At(t,{x:e,y:n,zoom:o}),{x:d,y:c}=At({x:t.x+t.width,y:t.y+t.height},{x:e,y:n,zoom:o}),u=i-d,h=s-c;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(u),bottom:Math.floor(h)}}function Oi(t,e,n,o,i,s=.1){const a=hd(s,e,n),l=(e-a.x)/t.width,d=(n-a.y)/t.height,c=it(Math.min(l,d),o,i),u=t.x+t.width/2,h=t.y+t.height/2,f=e/2-u*c,g=n/2-h*c,p=gd(t,f,g,c,e,n),b={left:Math.min(p.left-a.left,0),top:Math.min(p.top-a.top,0),right:Math.min(p.right-a.right,0),bottom:Math.min(p.bottom-a.bottom,0)};return{x:f-b.left+b.right,y:g-b.top+b.bottom,zoom:c}}function pd(t,e){return{x:e.x+t.x,y:e.y+t.y,z:(t.z>e.z?t.z:e.z)+1}}function Vi(t,e){if(!t.parentNode)return!1;const n=e.get(t.parentNode);return n?n.selected?!0:Vi(n,e):!1}function Pt(t,e){return typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`}function Hi(t){const e=t.ctrlKey&&fn()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e}function Li(t,e,n){return t<e?it(Math.abs(t-e),1,e)/e:t>n?-it(Math.abs(t-n),1,e)/e:0}function Fi(t,e,n=15,o=40){return[Li(t.x,o,e.width-o)*n,Li(t.y,o,e.height-o)*n]}function ro(t,e){if(e){const n=t.position.x+t.dimensions.width-e.dimensions.width,o=t.position.y+t.dimensions.height-e.dimensions.height;if(n>0||o>0||t.position.x<0||t.position.y<0){let i={};if(typeof e.style=="function"?i={...e.style(e)}:e.style&&(i={...e.style}),i.width=i.width??`${e.dimensions.width}px`,i.height=i.height??`${e.dimensions.height}px`,n>0)if(typeof i.width=="string"){const s=Number(i.width.replace("px",""));i.width=`${s+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const s=Number(i.height.replace("px",""));i.height=`${s+o}px`}else i.height+=o;if(t.position.x<0){const s=Math.abs(t.position.x);if(e.position.x=e.position.x-s,typeof i.width=="string"){const a=Number(i.width.replace("px",""));i.width=`${a+s}px`}else i.width+=s;t.position.x=0}if(t.position.y<0){const s=Math.abs(t.position.y);if(e.position.y=e.position.y-s,typeof i.height=="string"){const a=Number(i.height.replace("px",""));i.height=`${a+s}px`}else i.height+=s;t.position.y=0}e.dimensions.width=Number(i.width.toString().replace("px","")),e.dimensions.height=Number(i.height.toString().replace("px","")),typeof e.style=="function"?e.style=s=>{const a=e.style;return{...a(s),...i}}:e.style={...e.style,...i}}}}function Gi(t,e){var n,o;const i=t.filter(a=>a.type==="add"||a.type==="remove");for(const a of i)if(a.type==="add")e.findIndex(l=>l.id===a.item.id)===-1&&e.push(a.item);else if(a.type==="remove"){const l=e.findIndex(d=>d.id===a.id);l!==-1&&e.splice(l,1)}const s=e.map(a=>a.id);for(const a of e)for(const l of t)if(l.id===a.id)switch(l.type){case"select":a.selected=l.selected;break;case"position":if(Rt(a)&&(typeof l.position<"u"&&(a.position=l.position),typeof l.dragging<"u"&&(a.dragging=l.dragging),a.expandParent&&a.parentNode)){const d=e[s.indexOf(a.parentNode)];d&&Rt(d)&&ro(a,d)}break;case"dimensions":if(Rt(a)&&(typeof l.dimensions<"u"&&(a.dimensions=l.dimensions),typeof l.updateStyle<"u"&&l.updateStyle&&(a.style={...a.style||{},width:`${(n=l.dimensions)==null?void 0:n.width}px`,height:`${(o=l.dimensions)==null?void 0:o.height}px`}),typeof l.resizing<"u"&&(a.resizing=l.resizing),a.expandParent&&a.parentNode)){const d=e[s.indexOf(a.parentNode)];d&&Rt(d)&&(d.dimensions.width&&d.dimensions.height?ro(a,d):(0,r.nextTick)(()=>{ro(a,d)}))}break}return e}function je(t,e){return{id:t,type:"select",selected:e}}function Wi(t){return{item:t,type:"add"}}function Ui(t){return{id:t,type:"remove"}}function Yi(t,e,n,o,i){return{id:t,source:e,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function Ze(t,e=new Set,n=!1){const o=[];for(const[i,s]of t){const a=e.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),o.push(je(s.id,a)))}return o}var Xi=()=>{};function oe(t){const e=new Set;let n=Xi,o=()=>!1;const i=()=>e.size>0||o(),s=f=>{n=f},a=()=>{n=Xi},l=f=>{o=f},d=()=>{o=()=>!1},c=f=>{e.delete(f)};return{on:f=>{e.add(f);const g=()=>c(f);return wt(g),{off:g}},off:c,trigger:f=>{const g=[n];return i()?g.push(...e):t&&g.push(t),Promise.allSettled(g.map(p=>p(f)))},hasListeners:i,listeners:e,setEmitter:s,removeEmitter:a,setHasEmitListeners:l,removeHasEmitListeners:d}}function ji(t,e,n){let o=t;do{if(o&&o.matches(e))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function md(t,e,n,o){var i,s;const a=new Map;for(const[l,d]of t)(d.selected||d.id===o)&&(!d.parentNode||!Vi(d,t))&&(d.draggable||e&&typeof d.draggable>"u")&&t.get(l)&&a.set(l,{id:d.id,position:d.position||{x:0,y:0},distance:{x:n.x-((i=d.computedPosition)==null?void 0:i.x)||0,y:n.y-((s=d.computedPosition)==null?void 0:s.y)||0},from:{x:d.computedPosition.x,y:d.computedPosition.y},extent:d.extent,parentNode:d.parentNode,dimensions:{...d.dimensions},expandParent:d.expandParent});return Array.from(a.values())}function so({id:t,dragItems:e,findNode:n}){const o=[];for(const i of e){const s=n(i.id);s&&o.push(s)}return[t?o.find(i=>i.id===t):o[0],o]}function Zi(t){if(Array.isArray(t))switch(t.length){case 1:return[t[0],t[0],t[0],t[0]];case 2:return[t[0],t[1],t[0],t[1]];case 3:return[t[0],t[1],t[2],t[1]];case 4:return t;default:return[0,0,0,0]}return[t,t,t,t]}function yd(t,e,n){const[o,i,s,a]=typeof t!="string"?Zi(t.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+a,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-s]]:!1}function vd(t,e,n,o){let i=t.extent||n;if((i==="parent"||!Array.isArray(i)&&i?.range==="parent")&&!t.expandParent)if(t.parentNode&&o&&t.dimensions.width&&t.dimensions.height){const s=yd(i,t,o);s&&(i=s)}else e(new we(ve.NODE_EXTENT_INVALID,t.id)),i=n;else if(Array.isArray(i)){const s=o?.computedPosition.x||0,a=o?.computedPosition.y||0;i=[[i[0][0]+s,i[0][1]+a],[i[1][0]+s,i[1][1]+a]]}else if(i!=="parent"&&i?.range&&Array.isArray(i.range)){const[s,a,l,d]=Zi(i.padding),c=o?.computedPosition.x||0,u=o?.computedPosition.y||0;i=[[i.range[0][0]+c+d,i.range[0][1]+u+s],[i.range[1][0]+c-a,i.range[1][1]+u-l]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function _d({width:t,height:e},n){return[n[0],[n[1][0]-(t||0),n[1][1]-(e||0)]]}function ao(t,e,n,o,i){const s=Ti(e,_d(t.dimensions,vd(t,n,o,i)));return{position:{x:s.x-(i?.computedPosition.x||0),y:s.y-(i?.computedPosition.y||0)},computedPosition:s}}function pt(t,e,n=ae.Left,o=!1){const i=(e?.x??0)+t.computedPosition.x,s=(e?.y??0)+t.computedPosition.y,{width:a,height:l}=e??Ed(t);if(o)return{x:i+a/2,y:s+l/2};switch(e?.position??n){case ae.Top:return{x:i+a/2,y:s};case ae.Right:return{x:i+a,y:s+l/2};case ae.Bottom:return{x:i+a/2,y:s+l};case ae.Left:return{x:i,y:s+l/2}}}function Ki(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function wd({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:s,width:a,height:l,viewport:d}){const c={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+i),y2:Math.max(t.y+o,e.y+s)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const u=Ri({x:(0-d.x)/d.zoom,y:(0-d.y)/d.zoom,width:a/d.zoom,height:l/d.zoom}),h=Math.max(0,Math.min(u.x2,c.x2)-Math.max(u.x,c.x)),f=Math.max(0,Math.min(u.y2,c.y2)-Math.max(u.y,c.y));return Math.ceil(h*f)>0}function bd(t,e,n=!1){const o=typeof t.zIndex=="number";let i=o?t.zIndex:0;const s=e(t.source),a=e(t.target);return!s||!a?0:(n&&(i=o?t.zIndex:Math.max(s.computedPosition.z||0,a.computedPosition.z||0)),i)}var ve=(t=>(t.MISSING_STYLES="MISSING_STYLES",t.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",t.NODE_INVALID="NODE_INVALID",t.NODE_NOT_FOUND="NODE_NOT_FOUND",t.NODE_MISSING_PARENT="NODE_MISSING_PARENT",t.NODE_TYPE_MISSING="NODE_TYPE_MISSING",t.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",t.EDGE_INVALID="EDGE_INVALID",t.EDGE_NOT_FOUND="EDGE_NOT_FOUND",t.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",t.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",t.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",t.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",t.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",t.EDGE_ORPHANED="EDGE_ORPHANED",t.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",t))(ve||{}),qi={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:t=>`Node is invalid
7
7
  Node: ${t}`,NODE_NOT_FOUND:t=>`Node not found
8
8
  Node: ${t}`,NODE_MISSING_PARENT:(t,e)=>`Node is missing a parent
9
9
  Node: ${t}
@@ -23,6 +23,6 @@ Edge: ${t}
23
23
  Source: ${e}
24
24
  Target: ${n}`,EDGE_ORPHANED:t=>`Edge was orphaned (suddenly missing source or target) and has been removed
25
25
  Edge: ${t}`,EDGE_NOT_FOUND:t=>`Edge not found
26
- Edge: ${t}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"},we=class extends Error{constructor(t,...e){var n;super((n=Ki[t])==null?void 0:n.call(Ki,...e)),this.name="VueFlowError",this.code=t,this.args=e}};function ao(t){return"clientX"in t}function _d(t){return"sourceEvent"in t}function Pe(t,e){const n=ao(t);let o,i;return n?(o=t.clientX,i=t.clientY):"touches"in t&&t.touches.length>0?(o=t.touches[0].clientX,i=t.touches[0].clientY):"changedTouches"in t&&t.changedTouches.length>0?(o=t.changedTouches[0].clientX,i=t.changedTouches[0].clientY):(o=0,i=0),{x:o-(e?.left??0),y:i-(e?.top??0)}}var fn=()=>{var t;return typeof navigator<"u"&&((t=navigator?.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function wd(t){var e,n;return{width:((e=t.dimensions)==null?void 0:e.width)??t.width??0,height:((n=t.dimensions)==null?void 0:n.height)??t.height??0}}function hn(t,e=[1,1]){return{x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}}var bd=()=>!0;function lo(t){t?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Cd(t,e,n){const o=[],i={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const s of e.values())cn(i,ln(s))>0&&o.push(s);return o}var Ed=250;function xd(t,e,n,o){var i,s;let a=[],l=Number.POSITIVE_INFINITY;const d=Cd(t,n,e+Ed);for(const c of d){const u=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((s=c.handleBounds)==null?void 0:s.target)??[]];for(const h of u){if(o.nodeId===h.nodeId&&o.type===h.type&&o.id===h.id)continue;const{x:f,y:g}=gt(c,h,h.position,!0),m=Math.sqrt((f-t.x)**2+(g-t.y)**2);m>e||(m<l?(a=[{...h,x:f,y:g}],l=m):m===l&&a.push({...h,x:f,y:g}))}}if(!a.length)return null;if(a.length>1){const c=o.type==="source"?"target":"source";return a.find(u=>u.type===c)??a[0]}return a[0]}function qi(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:d,isValidConnection:c=bd},u,h,f,g){const m=s==="target",E=e?a.querySelector(`.${l}-flow__handle[data-id="${d}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:S,y:D}=Pe(t),B=a.elementFromPoint(S,D),w=B?.classList.contains(`${l}-flow__handle`)?B:E,M={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const G=Ji(void 0,w),R=w.getAttribute("data-nodeid"),q=w.getAttribute("data-handleid"),K=w.classList.contains("connectable"),j=w.classList.contains("connectableend");if(!R||!G)return M;const Z={source:m?R:o,sourceHandle:m?q:i,target:m?o:R,targetHandle:m?i:q};M.connection=Z,M.isValid=K&&j&&(n===Fe.Strict?m&&G==="source"||!m&&G==="target":R!==o||q!==i)&&c(Z,{nodes:h,edges:u,sourceNode:f(Z.source),targetNode:f(Z.target)}),M.toHandle=Qi(R,G,q,g,n,!0)}return M}function Ji(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function Nd(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function kd(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}function Qi(t,e,n,o,i,s=!1){var a,l,d;const c=o.get(t);if(!c)return null;const u=i===Fe.Strict?(a=c.handleBounds)==null?void 0:a[e]:[...((l=c.handleBounds)==null?void 0:l.source)??[],...((d=c.handleBounds)==null?void 0:d.target)??[]],h=(n?u?.find(f=>f.id===n):u?.[0])??null;return h&&s?{...h,...gt(c,h,h.position,!0)}:h}var co={[ae.Left]:ae.Right,[ae.Right]:ae.Left,[ae.Top]:ae.Bottom,[ae.Bottom]:ae.Top},Sd=["production","prod"];function Pt(t,...e){er()&&console.warn(`[Vue Flow]: ${t}`,...e)}function er(){return!Sd.includes(process.env.NODE_ENV||"")}function tr(t,e,n,o,i){const s=e.querySelectorAll(`.vue-flow__handle.${t}`);return s?.length?Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:t,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/o,y:(l.top-n.top)/o,...dn(a)}}):null}function uo(t,e,n,o,i,s=!1,a){i.value=!1,t.selected?(s||t.selected&&e)&&(o([t]),(0,r.nextTick)(()=>{a.blur()})):n([t])}function _e(t){return typeof(0,r.unref)(t)<"u"}function Dd(t,e,n,o){if(!t||!t.source||!t.target)return n(new we(ve.EDGE_INVALID,t?.id??"[ID UNKNOWN]")),!1;let i;return Ue(t)?i=t:i={...t,id:Bi(t)},i=Mi(i,void 0,o),ad(i,e)?!1:i}function Td(t,e,n,o,i){if(!e.source||!e.target)return i(new we(ve.EDGE_INVALID,t.id)),!1;if(!n)return i(new we(ve.EDGE_NOT_FOUND,t.id)),!1;const{id:s,...a}=t;return{...a,id:o?Bi(e):s,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle}}function nr(t,e,n){const o={},i=[];for(let s=0;s<t.length;++s){const a=t[s];if(!it(a)){n(new we(ve.NODE_INVALID,a?.id));continue}const l=id(a,e(a.id),a.parentNode);a.parentNode&&(o[a.parentNode]=!0),i[s]=l}for(const s of i){const a=e(s.parentNode)||i.find(l=>l.id===s.parentNode);s.parentNode&&!a&&n(new we(ve.NODE_MISSING_PARENT,s.id,s.parentNode)),(s.parentNode||o[s.id])&&(o[s.id]&&(s.isParent=!0),a&&(a.isParent=!0))}return i}function or(t,e,n,o,i,s){let a=i;const l=o.get(a)||new Map;o.set(a,l.set(n,e)),a=`${i}-${t}`;const d=o.get(a)||new Map;if(o.set(a,d.set(n,e)),s){a=`${i}-${t}-${s}`;const c=o.get(a)||new Map;o.set(a,c.set(n,e))}}function fo(t,e,n){t.clear();for(const o of n){const{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=o,d={edgeId:o.id,source:i,target:s,sourceHandle:a,targetHandle:l},c=`${i}-${a}--${s}-${l}`;or("source",d,`${s}-${l}--${i}-${a}`,t,i,a),or("target",d,c,t,s,l)}}function ir(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function ho(t,e,n,o,i,s,a,l){const d=[];for(const c of t){const u=Ue(c)?c:Dd(c,l,i,s);if(!u)continue;const h=n(u.source),f=n(u.target);if(!h||!f){i(new we(ve.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!h){i(new we(ve.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!f){i(new we(ve.EDGE_TARGET_MISSING,u.id,u.target));continue}if(e&&!e(u,{edges:l,nodes:a,sourceNode:h,targetNode:f})){i(new we(ve.EDGE_INVALID,u.id));continue}const g=o(u.id);d.push({...Mi(u,g,s),sourceNode:h,targetNode:f})}return d}var rr=Symbol("vueFlow"),sr=Symbol("nodeId"),ar=Symbol("nodeRef"),Md=Symbol("edgeId"),Id=Symbol("edgeRef"),gn=Symbol("slots");function lr(t){const{vueFlowRef:e,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:s,nodeExtent:a,nodeDragThreshold:l,viewport:d,autoPanOnNodeDrag:c,autoPanSpeed:u,nodesDraggable:h,panBy:f,findNode:g,multiSelectionActive:m,nodesSelectionActive:E,selectNodesOnDrag:S,removeSelectedElements:D,addSelectedNodes:B,updateNodePositions:w,emits:M}=pe(),{onStart:G,onDrag:R,onStop:q,onClick:K,el:j,disabled:Z,id:F,selectable:k,dragHandle:W}=t,b=(0,r.shallowRef)(!1);let P=[],v,N=null,I={x:void 0,y:void 0},T={x:0,y:0},z=null,O=!1,L=!1,ee=0,se=!1;const V=Rd(),X=({x:J,y:re})=>{I={x:J,y:re};let x=!1;if(P=P.map(p=>{const y={x:J-p.distance.x,y:re-p.distance.y},{computedPosition:C}=so(p,n.value?hn(y,o.value):y,M.error,a.value,p.parentNode?g(p.parentNode):void 0);return x=x||p.position.x!==C.x||p.position.y!==C.y,p.position=C,p}),L=L||x,!!x&&(w(P,!0,!0),b.value=!0,z)){const[p,y]=ro({id:F,dragItems:P,findNode:g});R({event:z,node:p,nodes:y})}},A=()=>{if(!N)return;const[J,re]=Li(T,N,u.value);if(J!==0||re!==0){const x={x:(I.x??0)-J/d.value.zoom,y:(I.y??0)-re/d.value.zoom};f({x:J,y:re})&&X(x)}ee=requestAnimationFrame(A)},U=(J,re)=>{O=!0;const x=g(F);!S.value&&!m.value&&x&&(x.selected||D()),x&&(0,r.toValue)(k)&&S.value&&uo(x,m.value,B,D,E,!1,re);const p=V(J.sourceEvent);if(I=p,P=hd(s.value,h.value,p,F),P.length){const[y,C]=ro({id:F,dragItems:P,findNode:g});G({event:J.sourceEvent,node:y,nodes:C})}},te=(J,re)=>{var x;J.sourceEvent.type==="touchmove"&&J.sourceEvent.touches.length>1||(L=!1,l.value===0&&U(J,re),I=V(J.sourceEvent),N=((x=e.value)==null?void 0:x.getBoundingClientRect())||null,T=Pe(J.sourceEvent,N))},ie=(J,re)=>{const x=V(J.sourceEvent);if(!se&&O&&c.value&&(se=!0,A()),!O){const p=x.xSnapped-(I.x??0),y=x.ySnapped-(I.y??0);Math.sqrt(p*p+y*y)>l.value&&U(J,re)}(I.x!==x.xSnapped||I.y!==x.ySnapped)&&P.length&&O&&(z=J.sourceEvent,T=Pe(J.sourceEvent,N),X(x))},le=J=>{let re=!1;if(!O&&!b.value&&!m.value){const x=J.sourceEvent,p=V(x),y=p.xSnapped-(I.x??0),C=p.ySnapped-(I.y??0),_=Math.sqrt(y*y+C*C);_!==0&&_<=l.value&&(K?.(x),re=!0)}if(P.length&&!re){L&&(w(P,!1,!1),L=!1);const[x,p]=ro({id:F,dragItems:P,findNode:g});q({event:J.sourceEvent,node:x,nodes:p})}P=[],b.value=!1,se=!1,O=!1,I={x:void 0,y:void 0},cancelAnimationFrame(ee)};return(0,r.watch)([()=>(0,r.toValue)(Z),j],([J,re],x,p)=>{if(re){const y=Te(re);J||(v=ol().on("start",C=>te(C,re)).on("drag",C=>ie(C,re)).on("end",C=>le(C)).filter(C=>{const _=C.target,Y=(0,r.toValue)(W);return!C.button&&(!i.value||!Xi(_,`.${i.value}`,re)&&(!Y||Xi(_,Y,re)))}),y.call(v)),p(()=>{y.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),b}function Bd(){return{doubleClick:ne(),click:ne(),mouseEnter:ne(),mouseMove:ne(),mouseLeave:ne(),contextMenu:ne(),updateStart:ne(),update:ne(),updateEnd:ne()}}function zd(t,e){const n=Bd();return n.doubleClick.on(o=>{var i,s;e.edgeDoubleClick(o),(s=(i=t.events)==null?void 0:i.doubleClick)==null||s.call(i,o)}),n.click.on(o=>{var i,s;e.edgeClick(o),(s=(i=t.events)==null?void 0:i.click)==null||s.call(i,o)}),n.mouseEnter.on(o=>{var i,s;e.edgeMouseEnter(o),(s=(i=t.events)==null?void 0:i.mouseEnter)==null||s.call(i,o)}),n.mouseMove.on(o=>{var i,s;e.edgeMouseMove(o),(s=(i=t.events)==null?void 0:i.mouseMove)==null||s.call(i,o)}),n.mouseLeave.on(o=>{var i,s;e.edgeMouseLeave(o),(s=(i=t.events)==null?void 0:i.mouseLeave)==null||s.call(i,o)}),n.contextMenu.on(o=>{var i,s;e.edgeContextMenu(o),(s=(i=t.events)==null?void 0:i.contextMenu)==null||s.call(i,o)}),n.updateStart.on(o=>{var i,s;e.edgeUpdateStart(o),(s=(i=t.events)==null?void 0:i.updateStart)==null||s.call(i,o)}),n.update.on(o=>{var i,s;e.edgeUpdate(o),(s=(i=t.events)==null?void 0:i.update)==null||s.call(i,o)}),n.updateEnd.on(o=>{var i,s;e.edgeUpdateEnd(o),(s=(i=t.events)==null?void 0:i.updateEnd)==null||s.call(i,o)}),Object.entries(n).reduce((o,[i,s])=>(o.emit[i]=s.trigger,o.on[i]=s.on,o),{emit:{},on:{}})}function Rd(){const{viewport:t,snapGrid:e,snapToGrid:n,vueFlowRef:o}=pe();return i=>{var s;const a=((s=o.value)==null?void 0:s.getBoundingClientRect())??{left:0,top:0},{x:l,y:d}=Pe(_d(i)?i.sourceEvent:i,a),c=At({x:l,y:d},t.value),{x:u,y:h}=n.value?hn(c,e.value):c;return{xSnapped:u,ySnapped:h,...c}}}function pn(){return!0}function cr({handleId:t,nodeId:e,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:s,onEdgeUpdateEnd:a}){const{id:l,vueFlowRef:d,connectionMode:c,connectionRadius:u,connectOnClick:h,connectionClickStartHandle:f,nodesConnectable:g,autoPanOnConnect:m,autoPanSpeed:E,findNode:S,panBy:D,startConnection:B,updateConnection:w,endConnection:M,emits:G,viewport:R,edges:q,nodes:K,isValidConnection:j,nodeLookup:Z}=pe();let F=null,k=!1,W=null;function b(v){var N;const I=(0,r.toValue)(n)==="target",T=ao(v),z=Ti(v.target),O=v.currentTarget;if(O&&(T&&v.button===0||!T)){let L=function(oe){x=Pe(oe,le),X=xd(At(x,R.value,!1,[1,1]),u.value,Z.value,C),p||(y(),p=!0);const Q=qi(oe,{handle:X,connectionMode:c.value,fromNodeId:(0,r.toValue)(e),fromHandleId:(0,r.toValue)(t),fromType:I?"target":"source",isValidConnection:V,doc:z,lib:"vue",flowId:l,nodeLookup:Z.value},q.value,K.value,S,Z.value);W=Q.handleDomNode,F=Q.connection,k=kd(!!X,Q.isValid);const ue={...H,isValid:k,to:Q.toHandle&&k?Rt({x:Q.toHandle.x,y:Q.toHandle.y},R.value):x,toHandle:Q.toHandle,toPosition:k&&Q.toHandle?Q.toHandle.position:co[C.position],toNode:Q.toHandle?Z.value.get(Q.toHandle.nodeId):null};if(k&&X&&H?.toHandle&&ue.toHandle&&H.toHandle.type===ue.toHandle.type&&H.toHandle.nodeId===ue.toHandle.nodeId&&H.toHandle.id===ue.toHandle.id&&H.to.x===ue.to.x&&H.to.y===ue.to.y)return;const fe=X??Q.toHandle;if(w(fe&&k?Rt({x:fe.x,y:fe.y},R.value):x,fe,Nd(!!fe,k)),H=ue,!X&&!k&&!W)return lo(re);F&&F.source!==F.target&&W&&(lo(re),re=W,W.classList.add("connecting","vue-flow__handle-connecting"),W.classList.toggle("valid",!!k),W.classList.toggle("vue-flow__handle-valid",!!k))},ee=function(oe){"touches"in oe&&oe.touches.length>0||((X||W)&&F&&k&&(s?s(oe,F):G.connect(F)),G.connectEnd(oe),i&&a?.(oe),lo(re),cancelAnimationFrame(A),M(oe),p=!1,k=!1,F=null,W=null,z.removeEventListener("mousemove",L),z.removeEventListener("mouseup",ee),z.removeEventListener("touchmove",L),z.removeEventListener("touchend",ee))};const se=S((0,r.toValue)(e));let V=(0,r.toValue)(o)||j.value||pn;!V&&se&&(V=(I?se.isValidSourcePos:se.isValidTargetPos)||pn);let X,A=0;const{x:U,y:te}=Pe(v),ie=Ji((0,r.toValue)(i),O),le=(N=d.value)==null?void 0:N.getBoundingClientRect();if(!le||!ie)return;const J=Qi((0,r.toValue)(e),ie,(0,r.toValue)(t),Z.value,c.value);if(!J)return;let re,x=Pe(v,le),p=!1;const y=()=>{if(!m.value)return;const[oe,Q]=Li(x,le,E.value);D({x:oe,y:Q}),A=requestAnimationFrame(y)},C={...J,nodeId:(0,r.toValue)(e),type:ie,position:J.position},_=Z.value.get((0,r.toValue)(e)),Y={inProgress:!0,isValid:null,from:gt(_,C,ae.Left,!0),fromHandle:C,fromPosition:C.position,fromNode:_,to:x,toHandle:null,toPosition:co[C.position],toNode:null};B({nodeId:(0,r.toValue)(e),id:(0,r.toValue)(t),type:ie,position:O?.getAttribute("data-handlepos")||ae.Top,...x},{x:U-le.left,y:te-le.top}),G.connectStart({event:v,nodeId:(0,r.toValue)(e),handleId:(0,r.toValue)(t),handleType:ie});let H=Y;z.addEventListener("mousemove",L),z.addEventListener("mouseup",ee),z.addEventListener("touchmove",L),z.addEventListener("touchend",ee)}}function P(v){var N,I;if(!h.value)return;const T=(0,r.toValue)(n)==="target";if(!f.value){G.clickConnectStart({event:v,nodeId:(0,r.toValue)(e),handleId:(0,r.toValue)(t)}),B({nodeId:(0,r.toValue)(e),type:(0,r.toValue)(n),id:(0,r.toValue)(t),position:ae.Top,...Pe(v)},void 0,!0);return}let z=(0,r.toValue)(o)||j.value||pn;const O=S((0,r.toValue)(e));if(!z&&O&&(z=(T?O.isValidSourcePos:O.isValidTargetPos)||pn),O&&(typeof O.connectable>"u"?g.value:O.connectable)===!1)return;const L=Ti(v.target),ee=qi(v,{handle:{nodeId:(0,r.toValue)(e),id:(0,r.toValue)(t),type:(0,r.toValue)(n),position:ae.Top,...Pe(v)},connectionMode:c.value,fromNodeId:f.value.nodeId,fromHandleId:f.value.id??null,fromType:f.value.type,isValidConnection:z,doc:L,lib:"vue",flowId:l,nodeLookup:Z.value},q.value,K.value,S,Z.value),se=((N=ee.connection)==null?void 0:N.source)===((I=ee.connection)==null?void 0:I.target);ee.isValid&&ee.connection&&!se&&G.connect(ee.connection),G.clickConnectEnd(v),M(v,!0)}return{handlePointerDown:b,handleClick:P}}function Ad(){return(0,r.inject)(sr,"")}function dr(t){const e=t??Ad()??"",n=(0,r.inject)(ar,(0,r.ref)(null)),{findNode:o,edges:i,emits:s}=pe(),a=o(e);return a||s.error(new we(ve.NODE_NOT_FOUND,e)),{id:e,nodeEl:n,node:a,parentNode:(0,r.computed)(()=>o(a.parentNode)),connectedEdges:(0,r.computed)(()=>$i([a],i.value))}}function $d(){return{doubleClick:ne(),click:ne(),mouseEnter:ne(),mouseMove:ne(),mouseLeave:ne(),contextMenu:ne(),dragStart:ne(),drag:ne(),dragStop:ne()}}function Pd(t,e){const n=$d();return n.doubleClick.on(o=>{var i,s;e.nodeDoubleClick(o),(s=(i=t.events)==null?void 0:i.doubleClick)==null||s.call(i,o)}),n.click.on(o=>{var i,s;e.nodeClick(o),(s=(i=t.events)==null?void 0:i.click)==null||s.call(i,o)}),n.mouseEnter.on(o=>{var i,s;e.nodeMouseEnter(o),(s=(i=t.events)==null?void 0:i.mouseEnter)==null||s.call(i,o)}),n.mouseMove.on(o=>{var i,s;e.nodeMouseMove(o),(s=(i=t.events)==null?void 0:i.mouseMove)==null||s.call(i,o)}),n.mouseLeave.on(o=>{var i,s;e.nodeMouseLeave(o),(s=(i=t.events)==null?void 0:i.mouseLeave)==null||s.call(i,o)}),n.contextMenu.on(o=>{var i,s;e.nodeContextMenu(o),(s=(i=t.events)==null?void 0:i.contextMenu)==null||s.call(i,o)}),n.dragStart.on(o=>{var i,s;e.nodeDragStart(o),(s=(i=t.events)==null?void 0:i.dragStart)==null||s.call(i,o)}),n.drag.on(o=>{var i,s;e.nodeDrag(o),(s=(i=t.events)==null?void 0:i.drag)==null||s.call(i,o)}),n.dragStop.on(o=>{var i,s;e.nodeDragStop(o),(s=(i=t.events)==null?void 0:i.dragStop)==null||s.call(i,o)}),Object.entries(n).reduce((o,[i,s])=>(o.emit[i]=s.trigger,o.on[i]=s.on,o),{emit:{},on:{}})}function ur(){const{getSelectedNodes:t,nodeExtent:e,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:s,nodesDraggable:a,emits:l}=pe();return(d,c=!1)=>{const u=s.value?i.value[0]:5,h=s.value?i.value[1]:5,f=c?4:1,g=d.x*u*f,m=d.y*h*f,E=[];for(const S of t.value)if(S.draggable||a&&typeof S.draggable>"u"){const{position:D}=so(S,{x:S.computedPosition.x+g,y:S.computedPosition.y+m},l.error,e.value,S.parentNode?o(S.parentNode):void 0);E.push({id:S.id,position:D,from:S.position,distance:{x:d.x,y:d.y},dimensions:S.dimensions})}n(E,!0,!1)}}var mn=.1,Od=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2;function je(){return Pt("Viewport not initialized yet."),Promise.resolve(!1)}var Vd={zoomIn:je,zoomOut:je,zoomTo:je,fitView:je,setCenter:je,fitBounds:je,project:t=>t,screenToFlowCoordinate:t=>t,flowToScreenCoordinate:t=>t,setViewport:je,setTransform:je,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Hd(t){function e(o,i){return new Promise(s=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(i?.interpolate==="linear"?Nt:qt).scaleBy(go(t.d3Selection,i?.duration,i?.ease,()=>{s(!0)}),o):s(!1)})}function n(o,i,s,a){return new Promise(l=>{var d;const{x:c,y:u}=Di({x:-o,y:-i},t.translateExtent),h=ut.translate(-c,-u).scale(s);t.d3Selection&&t.d3Zoom?(d=t.d3Zoom)==null||d.interpolate(a?.interpolate==="linear"?Nt:qt).transform(go(t.d3Selection,a?.duration,a?.ease,()=>{l(!0)}),h):l(!1)})}return(0,r.computed)(()=>t.d3Zoom&&t.d3Selection&&t.dimensions.width&&t.dimensions.height?{viewportInitialized:!0,zoomIn:o=>e(1.2,o),zoomOut:o=>e(1/1.2,o),zoomTo:(o,i)=>new Promise(s=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(i?.interpolate==="linear"?Nt:qt).scaleTo(go(t.d3Selection,i?.duration,i?.ease,()=>{s(!0)}),o):s(!1)}),setViewport:(o,i)=>n(o.x,o.y,o.zoom,i),setTransform:(o,i)=>n(o.x,o.y,o.zoom,i),getViewport:()=>({x:t.viewport.x,y:t.viewport.y,zoom:t.viewport.zoom}),getTransform:()=>({x:t.viewport.x,y:t.viewport.y,zoom:t.viewport.zoom}),fitView:(o={padding:mn,includeHiddenNodes:!1,duration:0})=>{var i,s;const a=[];for(const u of t.nodes)u.dimensions.width&&u.dimensions.height&&(o?.includeHiddenNodes||!u.hidden)&&(!((i=o.nodes)!=null&&i.length)||(s=o.nodes)!=null&&s.length&&o.nodes.includes(u.id))&&a.push(u);if(!a.length)return Promise.resolve(!1);const{x:l,y:d,zoom:c}=Pi(Ri(a),t.dimensions.width,t.dimensions.height,o.minZoom??t.minZoom,o.maxZoom??t.maxZoom,o.padding??mn);return n(l,d,c,o)},setCenter:(o,i,s)=>{const a=typeof s?.zoom<"u"?s.zoom:t.maxZoom;return n(t.dimensions.width/2-o*a,t.dimensions.height/2-i*a,a,s)},fitBounds:(o,i={padding:mn})=>{const{x:s,y:a,zoom:l}=Pi(o,t.dimensions.width,t.dimensions.height,t.minZoom,t.maxZoom,i.padding??mn);return n(s,a,l,i)},project:o=>At(o,t.viewport,t.snapToGrid,t.snapGrid),screenToFlowCoordinate:o=>{if(t.vueFlowRef){const{x:i,y:s}=t.vueFlowRef.getBoundingClientRect();return At({x:o.x-i,y:o.y-s},t.viewport,t.snapToGrid,t.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:o=>{if(t.vueFlowRef){const{x:i,y:s}=t.vueFlowRef.getBoundingClientRect();return Rt({x:o.x+i,y:o.y+s},t.viewport)}return{x:0,y:0}}}:Vd)}function go(t,e=0,n=Od,o=()=>{}){const i=typeof e=="number"&&e>0;return i||o(),i?t.transition().duration(e).ease(n).on("end",o):t}function Ld(t,e,n){const o=(0,r.effectScope)(!0);return o.run(()=>{const i=()=>{o.run(()=>{let E,S,D=!!(n.nodes.value.length||n.edges.value.length);E=st([t.modelValue,()=>{var B,w;return(w=(B=t.modelValue)==null?void 0:B.value)==null?void 0:w.length}],([B])=>{B&&Array.isArray(B)&&(S?.pause(),n.setElements(B),!S&&!D&&B.length?D=!0:S?.resume())}),S=st([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([B,w])=>{var M;(M=t.modelValue)!=null&&M.value&&Array.isArray(t.modelValue.value)&&(E?.pause(),t.modelValue.value=[...B,...w],(0,r.nextTick)(()=>{E?.resume()}))},{immediate:D}),(0,r.onScopeDispose)(()=>{E?.stop(),S?.stop()})})},s=()=>{o.run(()=>{let E,S,D=!!n.nodes.value.length;E=st([t.nodes,()=>{var B,w;return(w=(B=t.nodes)==null?void 0:B.value)==null?void 0:w.length}],([B])=>{B&&Array.isArray(B)&&(S?.pause(),n.setNodes(B),!S&&!D&&B.length?D=!0:S?.resume())}),S=st([n.nodes,()=>n.nodes.value.length],([B])=>{var w;(w=t.nodes)!=null&&w.value&&Array.isArray(t.nodes.value)&&(E?.pause(),t.nodes.value=[...B],(0,r.nextTick)(()=>{E?.resume()}))},{immediate:D}),(0,r.onScopeDispose)(()=>{E?.stop(),S?.stop()})})},a=()=>{o.run(()=>{let E,S,D=!!n.edges.value.length;E=st([t.edges,()=>{var B,w;return(w=(B=t.edges)==null?void 0:B.value)==null?void 0:w.length}],([B])=>{B&&Array.isArray(B)&&(S?.pause(),n.setEdges(B),!S&&!D&&B.length?D=!0:S?.resume())}),S=st([n.edges,()=>n.edges.value.length],([B])=>{var w;(w=t.edges)!=null&&w.value&&Array.isArray(t.edges.value)&&(E?.pause(),t.edges.value=[...B],(0,r.nextTick)(()=>{E?.resume()}))},{immediate:D}),(0,r.onScopeDispose)(()=>{E?.stop(),S?.stop()})})},l=()=>{o.run(()=>{(0,r.watch)(()=>e.maxZoom,()=>{e.maxZoom&&_e(e.maxZoom)&&n.setMaxZoom(e.maxZoom)},{immediate:!0})})},d=()=>{o.run(()=>{(0,r.watch)(()=>e.minZoom,()=>{e.minZoom&&_e(e.minZoom)&&n.setMinZoom(e.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{(0,r.watch)(()=>e.translateExtent,()=>{e.translateExtent&&_e(e.translateExtent)&&n.setTranslateExtent(e.translateExtent)},{immediate:!0})})},u=()=>{o.run(()=>{(0,r.watch)(()=>e.nodeExtent,()=>{e.nodeExtent&&_e(e.nodeExtent)&&n.setNodeExtent(e.nodeExtent)},{immediate:!0})})},h=()=>{o.run(()=>{(0,r.watch)(()=>e.applyDefault,()=>{_e(e.applyDefault)&&(n.applyDefault.value=e.applyDefault)},{immediate:!0})})},f=()=>{o.run(()=>{const E=async S=>{let D=S;typeof e.autoConnect=="function"&&(D=await e.autoConnect(S)),D!==!1&&n.addEdges([D])};(0,r.watch)(()=>e.autoConnect,()=>{_e(e.autoConnect)&&(n.autoConnect.value=e.autoConnect)},{immediate:!0}),(0,r.watch)(n.autoConnect,(S,D,B)=>{S?n.onConnect(E):n.hooks.value.connect.off(E),B(()=>{n.hooks.value.connect.off(E)})},{immediate:!0})})},g=()=>{const E=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const S of Object.keys(e)){const D=S;if(!E.includes(D)){const B=(0,r.toRef)(()=>e[D]),w=n[D];(0,r.isRef)(w)&&o.run(()=>{(0,r.watch)(B,M=>{_e(M)&&(w.value=M)},{immediate:!0})})}}};i(),s(),a(),d(),l(),c(),u(),h(),f(),g()}),()=>o.stop()}function Fd(){return{edgesChange:ne(),nodesChange:ne(),nodeDoubleClick:ne(),nodeClick:ne(),nodeMouseEnter:ne(),nodeMouseMove:ne(),nodeMouseLeave:ne(),nodeContextMenu:ne(),nodeDragStart:ne(),nodeDrag:ne(),nodeDragStop:ne(),nodesInitialized:ne(),miniMapNodeClick:ne(),miniMapNodeDoubleClick:ne(),miniMapNodeMouseEnter:ne(),miniMapNodeMouseMove:ne(),miniMapNodeMouseLeave:ne(),connect:ne(),connectStart:ne(),connectEnd:ne(),clickConnectStart:ne(),clickConnectEnd:ne(),paneReady:ne(),init:ne(),move:ne(),moveStart:ne(),moveEnd:ne(),selectionDragStart:ne(),selectionDrag:ne(),selectionDragStop:ne(),selectionContextMenu:ne(),selectionStart:ne(),selectionEnd:ne(),viewportChangeStart:ne(),viewportChange:ne(),viewportChangeEnd:ne(),paneScroll:ne(),paneClick:ne(),paneContextMenu:ne(),paneMouseEnter:ne(),paneMouseMove:ne(),paneMouseLeave:ne(),edgeContextMenu:ne(),edgeMouseEnter:ne(),edgeMouseMove:ne(),edgeMouseLeave:ne(),edgeDoubleClick:ne(),edgeClick:ne(),edgeUpdateStart:ne(),edgeUpdate:ne(),edgeUpdateEnd:ne(),updateNodeInternals:ne(),error:ne(t=>Pt(t.message))}}function Gd(t,e){const n=(0,r.getCurrentInstance)();(0,r.onBeforeMount)(()=>{for(const[i,s]of Object.entries(e.value)){const a=l=>{t(i,l)};s.setEmitter(a),_t(s.removeEmitter),s.setHasEmitListeners(()=>o(i)),_t(s.removeHasEmitListeners)}});function o(i){var s;const a=Wd(i);return!!((s=n?.vnode.props)!=null&&s[a])}}function Wd(t){const[e,...n]=t.split(":");return`on${e.replace(/(?:^|-)(\w)/g,(o,i)=>i.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function fr(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:no.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:It.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:nt.Bezier,style:{}},connectionMode:Fe.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:fn()?"Meta":"Control",zoomActivationKeyCode:fn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Fd(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}var Ud=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Yd(t,e,n){const o=Hd(t),i=x=>{const p=x??[];t.hooks.updateNodeInternals.trigger(p)},s=x=>sd(x,t.nodes,t.edges),a=x=>rd(x,t.nodes,t.edges),l=x=>$i(x,t.edges),d=({id:x,type:p,nodeId:y})=>{var C;const _=x?`-${p}-${x}`:`-${p}`;return Array.from(((C=t.connectionLookup.get(`${y}${_}`))==null?void 0:C.values())??[])},c=x=>{if(x)return e.value.get(x)},u=x=>{if(x)return n.value.get(x)},h=(x,p,y)=>{var C,_;const Y=[];for(const H of x){const oe={id:H.id,type:"position",dragging:y,from:H.from};if(p&&(oe.position=H.position,H.parentNode)){const Q=c(H.parentNode);oe.position={x:oe.position.x-(((C=Q?.computedPosition)==null?void 0:C.x)??0),y:oe.position.y-(((_=Q?.computedPosition)==null?void 0:_.y)??0)}}Y.push(oe)}Y?.length&&t.hooks.nodesChange.trigger(Y)},f=x=>{if(!t.vueFlowRef)return;const p=t.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!p)return;const y=window.getComputedStyle(p),{m22:C}=new window.DOMMatrixReadOnly(y.transform),_=[];for(const Y of x){const H=Y,oe=c(H.id);if(oe){const Q=dn(H.nodeElement);if(Q.width&&Q.height&&(oe.dimensions.width!==Q.width||oe.dimensions.height!==Q.height||H.forceUpdate)){const ue=H.nodeElement.getBoundingClientRect();oe.dimensions=Q,oe.handleBounds.source=tr("source",H.nodeElement,ue,C,oe.id),oe.handleBounds.target=tr("target",H.nodeElement,ue,C,oe.id),_.push({id:oe.id,type:"dimensions",dimensions:Q})}}}!t.fitViewOnInitDone&&t.fitViewOnInit&&o.value.fitView().then(()=>{t.fitViewOnInitDone=!0}),_.length&&t.hooks.nodesChange.trigger(_)},g=(x,p)=>{const y=new Set,C=new Set;for(const H of x)it(H)?y.add(H.id):Ue(H)&&C.add(H.id);const _=Xe(e.value,y,!0),Y=Xe(n.value,C);if(t.multiSelectionActive){for(const H of y)_.push(Ye(H,p));for(const H of C)Y.push(Ye(H,p))}_.length&&t.hooks.nodesChange.trigger(_),Y.length&&t.hooks.edgesChange.trigger(Y)},m=x=>{if(t.multiSelectionActive){const p=x.map(y=>Ye(y.id,!0));t.hooks.nodesChange.trigger(p);return}t.hooks.nodesChange.trigger(Xe(e.value,new Set(x.map(p=>p.id)),!0)),t.hooks.edgesChange.trigger(Xe(n.value))},E=x=>{if(t.multiSelectionActive){const p=x.map(y=>Ye(y.id,!0));t.hooks.edgesChange.trigger(p);return}t.hooks.edgesChange.trigger(Xe(n.value,new Set(x.map(p=>p.id)))),t.hooks.nodesChange.trigger(Xe(e.value,new Set,!0))},S=x=>{g(x,!0)},D=x=>{const p=(x||t.nodes).map(y=>(y.selected=!1,Ye(y.id,!1)));t.hooks.nodesChange.trigger(p)},B=x=>{const p=(x||t.edges).map(y=>(y.selected=!1,Ye(y.id,!1)));t.hooks.edgesChange.trigger(p)},w=x=>{if(!x||!x.length)return g([],!1);const p=x.reduce((y,C)=>{const _=Ye(C.id,!1);return it(C)?y.nodes.push(_):y.edges.push(_),y},{nodes:[],edges:[]});p.nodes.length&&t.hooks.nodesChange.trigger(p.nodes),p.edges.length&&t.hooks.edgesChange.trigger(p.edges)},M=x=>{var p;(p=t.d3Zoom)==null||p.scaleExtent([x,t.maxZoom]),t.minZoom=x},G=x=>{var p;(p=t.d3Zoom)==null||p.scaleExtent([t.minZoom,x]),t.maxZoom=x},R=x=>{var p;(p=t.d3Zoom)==null||p.translateExtent(x),t.translateExtent=x},q=x=>{t.nodeExtent=x,i()},K=x=>{var p;(p=t.d3Zoom)==null||p.clickDistance(x)},j=x=>{t.nodesDraggable=x,t.nodesConnectable=x,t.elementsSelectable=x},Z=x=>{const p=x instanceof Function?x(t.nodes):x;!t.initialized&&!p.length||(t.nodes=nr(p,c,t.hooks.error.trigger))},F=x=>{const p=x instanceof Function?x(t.edges):x;if(!t.initialized&&!p.length)return;const y=ho(p,t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);fo(t.connectionLookup,n.value,y),t.edges=y},k=x=>{const p=x instanceof Function?x([...t.nodes,...t.edges]):x;!t.initialized&&!p.length||(Z(p.filter(it)),F(p.filter(Ue)))},W=x=>{let p=x instanceof Function?x(t.nodes):x;p=Array.isArray(p)?p:[p];const y=nr(p,c,t.hooks.error.trigger),C=[];for(const _ of y)C.push(Gi(_));C.length&&t.hooks.nodesChange.trigger(C)},b=x=>{let p=x instanceof Function?x(t.edges):x;p=Array.isArray(p)?p:[p];const y=ho(p,t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges),C=[];for(const _ of y)C.push(Gi(_));C.length&&t.hooks.edgesChange.trigger(C)},P=(x,p=!0,y=!1)=>{const C=x instanceof Function?x(t.nodes):x,_=Array.isArray(C)?C:[C],Y=[],H=[];function oe(ue){const fe=l(ue);for(const ge of fe)(!_e(ge.deletable)||ge.deletable)&&H.push(Ui(ge.id,ge.source,ge.target,ge.sourceHandle,ge.targetHandle))}function Q(ue){const fe=[];for(const ge of t.nodes)ge.parentNode===ue&&fe.push(ge);if(fe.length){for(const ge of fe)Y.push(Wi(ge.id));p&&oe(fe);for(const ge of fe)Q(ge.id)}}for(const ue of _){const fe=typeof ue=="string"?c(ue):ue;fe&&(_e(fe.deletable)&&!fe.deletable||(Y.push(Wi(fe.id)),p&&oe([fe]),y&&Q(fe.id)))}H.length&&t.hooks.edgesChange.trigger(H),Y.length&&t.hooks.nodesChange.trigger(Y)},v=x=>{const p=x instanceof Function?x(t.edges):x,y=Array.isArray(p)?p:[p],C=[];for(const _ of y){const Y=typeof _=="string"?u(_):_;Y&&(_e(Y.deletable)&&!Y.deletable||C.push(Ui(typeof _=="string"?_:_.id,Y.source,Y.target,Y.sourceHandle,Y.targetHandle)))}t.hooks.edgesChange.trigger(C)},N=(x,p,y=!0)=>{const C=u(x.id);if(!C)return!1;const _=t.edges.indexOf(C),Y=Td(x,p,C,y,t.hooks.error.trigger);if(Y){const[H]=ho([Y],t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);return t.edges=t.edges.map((oe,Q)=>Q===_?H:oe),fo(t.connectionLookup,n.value,[H]),H}return!1},I=(x,p,y={replace:!1})=>{const C=u(x);if(!C)return;const _=typeof p=="function"?p(C):p;C.data=y.replace?_:{...C.data,..._}},T=x=>Fi(x,t.nodes),z=x=>{const p=Fi(x,t.edges);return fo(t.connectionLookup,n.value,p),p},O=(x,p,y={replace:!1})=>{const C=c(x);if(!C)return;const _=typeof p=="function"?p(C):p;y.replace?t.nodes.splice(t.nodes.indexOf(C),1,_):Object.assign(C,_)},L=(x,p,y={replace:!1})=>{const C=c(x);if(!C)return;const _=typeof p=="function"?p(C):p;C.data=y.replace?_:{...C.data,..._}},ee=(x,p,y=!1)=>{y?t.connectionClickStartHandle=x:t.connectionStartHandle=x,t.connectionEndHandle=null,t.connectionStatus=null,p&&(t.connectionPosition=p)},se=(x,p=null,y=null)=>{t.connectionStartHandle&&(t.connectionPosition=x,t.connectionEndHandle=p,t.connectionStatus=y)},V=(x,p)=>{t.connectionPosition={x:NaN,y:NaN},t.connectionEndHandle=null,t.connectionStatus=null,p?t.connectionClickStartHandle=null:t.connectionStartHandle=null},X=x=>{const p=od(x),y=p?null:zt(x)?x:c(x.id);return!p&&!y?[null,null,p]:[p?x:ln(y),y,p]},A=(x,p=!0,y=t.nodes)=>{const[C,_,Y]=X(x);if(!C)return[];const H=[];for(const oe of y||t.nodes){if(!Y&&(oe.id===_.id||!oe.computedPosition))continue;const Q=ln(oe),ue=cn(Q,C);(p&&ue>0||ue>=Q.width*Q.height||ue>=Number(C.width)*Number(C.height))&&H.push(oe)}return H},U=(x,p,y=!0)=>{const[C]=X(x);if(!C)return!1;const _=cn(C,p);return y&&_>0||_>=Number(C.width)*Number(C.height)},te=x=>{const{viewport:p,dimensions:y,d3Zoom:C,d3Selection:_,translateExtent:Y}=t;if(!C||!_||!x.x&&!x.y)return!1;const H=ut.translate(p.x+x.x,p.y+x.y).scale(p.zoom),oe=[[0,0],[y.width,y.height]],Q=C.constrain()(H,oe,Y),ue=t.viewport.x!==Q.x||t.viewport.y!==Q.y||t.viewport.zoom!==Q.k;return C.transform(_,Q),ue},ie=x=>{const p=x instanceof Function?x(t):x,y=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];_e(p.defaultEdgeOptions)&&(t.defaultEdgeOptions=p.defaultEdgeOptions);const C=p.modelValue||p.nodes||p.edges?[]:void 0;C&&(p.modelValue&&C.push(...p.modelValue),p.nodes&&C.push(...p.nodes),p.edges&&C.push(...p.edges),k(C));const _=()=>{_e(p.maxZoom)&&G(p.maxZoom),_e(p.minZoom)&&M(p.minZoom),_e(p.translateExtent)&&R(p.translateExtent)};for(const Y of Object.keys(p)){const H=Y,oe=p[H];![...Ud,...y].includes(H)&&_e(oe)&&(t[H]=oe)}An(()=>t.d3Zoom).not.toBeNull().then(_),t.initialized||(t.initialized=!0)};return{updateNodePositions:h,updateNodeDimensions:f,setElements:k,setNodes:Z,setEdges:F,addNodes:W,addEdges:b,removeNodes:P,removeEdges:v,findNode:c,findEdge:u,updateEdge:N,updateEdgeData:I,updateNode:O,updateNodeData:L,applyEdgeChanges:z,applyNodeChanges:T,addSelectedElements:S,addSelectedNodes:m,addSelectedEdges:E,setMinZoom:M,setMaxZoom:G,setTranslateExtent:R,setNodeExtent:q,setPaneClickDistance:K,removeSelectedElements:w,removeSelectedNodes:D,removeSelectedEdges:B,startConnection:ee,updateConnection:se,endConnection:V,setInteractive:j,setState:ie,getIntersectingNodes:A,getIncomers:s,getOutgoers:a,getConnectedEdges:l,getHandleConnections:d,isNodeIntersecting:U,panBy:te,fitView:x=>o.value.fitView(x),zoomIn:x=>o.value.zoomIn(x),zoomOut:x=>o.value.zoomOut(x),zoomTo:(x,p)=>o.value.zoomTo(x,p),setViewport:(x,p)=>o.value.setViewport(x,p),setTransform:(x,p)=>o.value.setTransform(x,p),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(x,p,y)=>o.value.setCenter(x,p,y),fitBounds:(x,p)=>o.value.fitBounds(x,p),project:x=>o.value.project(x),screenToFlowCoordinate:x=>o.value.screenToFlowCoordinate(x),flowToScreenCoordinate:x=>o.value.flowToScreenCoordinate(x),toObject:()=>{const x=[],p=[];for(const y of t.nodes){const{computedPosition:C,handleBounds:_,selected:Y,dimensions:H,isParent:oe,resizing:Q,dragging:ue,events:fe,...ge}=y;x.push(ge)}for(const y of t.edges){const{selected:C,sourceNode:_,targetNode:Y,events:H,...oe}=y;p.push(oe)}return JSON.parse(JSON.stringify({nodes:x,edges:p,position:[t.viewport.x,t.viewport.y],zoom:t.viewport.zoom,viewport:t.viewport}))},fromObject:x=>new Promise(p=>{const{nodes:y,edges:C,position:_,zoom:Y,viewport:H}=x;y&&Z(y),C&&F(C);const[oe,Q]=H?.x&&H?.y?[H.x,H.y]:_??[null,null];if(oe&&Q){const ue=H?.zoom||Y||t.viewport.zoom;return An(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:oe,y:Q,zoom:ue}).then(()=>{p(!0)})})}else p(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const x=fr();if(t.edges=[],t.nodes=[],t.d3Zoom&&t.d3Selection){const p=ut.translate(x.defaultViewport.x??0,x.defaultViewport.y??0).scale(ot(x.defaultViewport.zoom??1,x.minZoom,x.maxZoom)),y=t.viewportRef.getBoundingClientRect(),C=[[0,0],[y.width,y.height]],_=t.d3Zoom.constrain()(p,C,x.translateExtent);t.d3Zoom.transform(t.d3Selection,_)}ie(x)},$destroy:()=>{}}}var Xd=["data-id","data-handleid","data-nodeid","data-handlepos"],pt=(0,r.defineComponent)({name:"Handle",compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>ae.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(t,{expose:e}){const n=(0,r.createPropsRestProxy)(t,["position","connectable","connectableStart","connectableEnd","id"]),o=(0,r.toRef)(()=>n.type??"source"),i=(0,r.toRef)(()=>n.isValidConnection??null),{id:s,connectionStartHandle:a,connectionClickStartHandle:l,connectionEndHandle:d,vueFlowRef:c,nodesConnectable:u,noDragClassName:h,noPanClassName:f}=pe(),{id:g,node:m,nodeEl:E,connectedEdges:S}=dr(),D=(0,r.ref)(),B=(0,r.toRef)(()=>typeof t.connectableStart<"u"?t.connectableStart:!0),w=(0,r.toRef)(()=>typeof t.connectableEnd<"u"?t.connectableEnd:!0),M=(0,r.toRef)(()=>{var F,k,W,b,P,v;return((F=a.value)==null?void 0:F.nodeId)===g&&((k=a.value)==null?void 0:k.id)===t.id&&((W=a.value)==null?void 0:W.type)===o.value||((b=d.value)==null?void 0:b.nodeId)===g&&((P=d.value)==null?void 0:P.id)===t.id&&((v=d.value)==null?void 0:v.type)===o.value}),G=(0,r.toRef)(()=>{var F,k,W;return((F=l.value)==null?void 0:F.nodeId)===g&&((k=l.value)==null?void 0:k.id)===t.id&&((W=l.value)==null?void 0:W.type)===o.value}),{handlePointerDown:R,handleClick:q}=cr({nodeId:g,handleId:t.id,isValidConnection:i,type:o}),K=(0,r.computed)(()=>typeof t.connectable=="string"&&t.connectable==="single"?!S.value.some(F=>{const k=F[`${o.value}Handle`];return F[o.value]!==g?!1:k?k===t.id:!0}):typeof t.connectable=="number"?S.value.filter(F=>{const k=F[`${o.value}Handle`];return F[o.value]!==g?!1:k?k===t.id:!0}).length<t.connectable:typeof t.connectable=="function"?t.connectable(m,S.value):_e(t.connectable)?t.connectable:u.value);(0,r.onMounted)(()=>{var F;if(!m.dimensions.width||!m.dimensions.height)return;const k=(F=m.handleBounds[o.value])==null?void 0:F.find(T=>T.id===t.id);if(!c.value||k)return;const W=c.value.querySelector(".vue-flow__transformationpane");if(!E.value||!D.value||!W||!t.id)return;const b=E.value.getBoundingClientRect(),P=D.value.getBoundingClientRect(),v=window.getComputedStyle(W),{m22:N}=new window.DOMMatrixReadOnly(v.transform),I={id:t.id,position:t.position,x:(P.left-b.left)/N,y:(P.top-b.top)/N,type:o.value,nodeId:g,...dn(D.value)};m.handleBounds[o.value]=[...m.handleBounds[o.value]??[],I]});function j(F){const k=ao(F);K.value&&B.value&&(k&&F.button===0||!k)&&R(F)}function Z(F){!g||!l.value&&!B.value||K.value&&q(F)}return e({handleClick:q,handlePointerDown:R,onClick:Z,onPointerDown:j}),(F,k)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{ref_key:"handle",ref:D,"data-id":`${(0,r.unref)(s)}-${(0,r.unref)(g)}-${t.id}-${o.value}`,"data-handleid":t.id,"data-nodeid":(0,r.unref)(g),"data-handlepos":F.position,class:(0,r.normalizeClass)(["vue-flow__handle",[`vue-flow__handle-${F.position}`,`vue-flow__handle-${t.id}`,(0,r.unref)(h),(0,r.unref)(f),o.value,{connectable:K.value,connecting:G.value,connectablestart:B.value,connectableend:w.value,connectionindicator:K.value&&(B.value&&!M.value||w.value&&M.value)}]]),onMousedown:j,onTouchstartPassive:j,onClick:Z},[(0,r.renderSlot)(F.$slots,"default",{id:F.id})],42,Xd))}}),yn=function({sourcePosition:t=ae.Bottom,targetPosition:e=ae.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:s,data:a}){const l=a.label??n;return[(0,r.h)(pt,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?(0,r.h)(l):(0,r.h)(r.Fragment,[l]),(0,r.h)(pt,{type:"source",position:t,connectable:o,isValidConnection:s})]};yn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],yn.inheritAttrs=!1,yn.compatConfig={MODE:3};var jd=yn,vn=function({targetPosition:t=ae.Top,label:e,connectable:n=!0,isValidTargetPos:o,data:i}){const s=i.label??e;return[(0,r.h)(pt,{type:"target",position:t,connectable:n,isValidConnection:o}),typeof s!="string"&&s?(0,r.h)(s):(0,r.h)(r.Fragment,[s])]};vn.props=["targetPosition","label","isValidTargetPos","connectable","data"],vn.inheritAttrs=!1,vn.compatConfig={MODE:3};var Zd=vn,_n=function({sourcePosition:t=ae.Bottom,label:e,connectable:n=!0,isValidSourcePos:o,data:i}){const s=i.label??e;return[typeof s!="string"&&s?(0,r.h)(s):(0,r.h)(r.Fragment,[s]),(0,r.h)(pt,{type:"source",position:t,connectable:n,isValidConnection:o})]};_n.props=["sourcePosition","label","isValidSourcePos","connectable","data"],_n.inheritAttrs=!1,_n.compatConfig={MODE:3};var Kd=_n,qd=["transform"],Jd=["width","height","x","y","rx","ry"],Qd=["y"],eu=(0,r.defineComponent)({name:"EdgeText",compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(t){const e=(0,r.ref)({x:0,y:0,width:0,height:0}),n=(0,r.ref)(null),o=(0,r.computed)(()=>`translate(${t.x-e.value.width/2} ${t.y-e.value.height/2})`);(0,r.onMounted)(i),(0,r.watch)([()=>t.x,()=>t.y,n,()=>t.label],i);function i(){if(!n.value)return;const s=n.value.getBBox();(s.width!==e.value.width||s.height!==e.value.height)&&(e.value=s)}return(s,a)=>((0,r.openBlock)(),(0,r.createElementBlock)("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[s.labelShowBg?((0,r.openBlock)(),(0,r.createElementBlock)("rect",{key:0,class:"vue-flow__edge-textbg",width:`${e.value.width+2*s.labelBgPadding[0]}px`,height:`${e.value.height+2*s.labelBgPadding[1]}px`,x:-s.labelBgPadding[0],y:-s.labelBgPadding[1],style:(0,r.normalizeStyle)(s.labelBgStyle),rx:s.labelBgBorderRadius,ry:s.labelBgBorderRadius},null,12,Jd)):(0,r.createCommentVNode)("",!0),(0,r.createElementVNode)("text",(0,r.mergeProps)(s.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:e.value.height/2,dy:"0.3em",style:s.labelStyle}),[(0,r.renderSlot)(s.$slots,"default",{},()=>[typeof s.label!="string"?((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(s.label),{key:0})):((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[(0,r.createTextVNode)((0,r.toDisplayString)(s.label),1)],64))])],16,Qd)],8,qd))}}),tu=["id","d","marker-end","marker-start"],nu=["d","stroke-width"],Ot=(0,r.defineComponent)({name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(t,{expose:e}){const n=(0,r.ref)(null),o=(0,r.ref)(null),i=(0,r.ref)(null),s=(0,r.useAttrs)();return e({pathEl:n,interactionEl:o,labelEl:i}),(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createElementVNode)("path",(0,r.mergeProps)((0,r.unref)(s),{id:a.id,ref_key:"pathEl",ref:n,d:a.path,class:"vue-flow__edge-path","marker-end":a.markerEnd,"marker-start":a.markerStart}),null,16,tu),a.interactionWidth?((0,r.openBlock)(),(0,r.createElementBlock)("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:a.path,"stroke-width":a.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,nu)):(0,r.createCommentVNode)("",!0),a.label&&a.labelX&&a.labelY?((0,r.openBlock)(),(0,r.createBlock)(eu,{key:1,ref_key:"labelEl",ref:i,x:a.labelX,y:a.labelY,label:a.label,"label-show-bg":a.labelShowBg,"label-bg-style":a.labelBgStyle,"label-bg-padding":a.labelBgPadding,"label-bg-border-radius":a.labelBgBorderRadius,"label-style":a.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):(0,r.createCommentVNode)("",!0)],64))}});function hr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const i=Math.abs(n-t)/2,s=n<t?n+i:n-i,a=Math.abs(o-e)/2;return[s,o<e?o+a:o-a,i,a]}function gr({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){const d=t*.125+i*.375+a*.375+n*.125,c=e*.125+s*.375+l*.375+o*.125;return[d,c,Math.abs(d-t),Math.abs(c-e)]}function wn(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function pr({pos:t,x1:e,y1:n,x2:o,y2:i,c:s}){let a,l;switch(t){case ae.Left:a=e-wn(e-o,s),l=n;break;case ae.Right:a=e+wn(o-e,s),l=n;break;case ae.Top:a=e,l=n-wn(n-i,s);break;case ae.Bottom:a=e,l=n+wn(i-n,s);break}return[a,l]}function po(t){const{sourceX:e,sourceY:n,sourcePosition:o=ae.Bottom,targetX:i,targetY:s,targetPosition:a=ae.Top,curvature:l=.25}=t,[d,c]=pr({pos:o,x1:e,y1:n,x2:i,y2:s,c:l}),[u,h]=pr({pos:a,x1:i,y1:s,x2:e,y2:n,c:l}),[f,g,m,E]=gr({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:d,sourceControlY:c,targetControlX:u,targetControlY:h});return[`M${e},${n} C${d},${c} ${u},${h} ${i},${s}`,f,g,m,E]}function mr({pos:t,x1:e,y1:n,x2:o,y2:i}){let s,a;switch(t){case ae.Left:case ae.Right:s=.5*(e+o),a=n;break;case ae.Top:case ae.Bottom:s=e,a=.5*(n+i);break}return[s,a]}function yr(t){const{sourceX:e,sourceY:n,sourcePosition:o=ae.Bottom,targetX:i,targetY:s,targetPosition:a=ae.Top}=t,[l,d]=mr({pos:o,x1:e,y1:n,x2:i,y2:s}),[c,u]=mr({pos:a,x1:i,y1:s,x2:e,y2:n}),[h,f,g,m]=gr({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:l,sourceControlY:d,targetControlX:c,targetControlY:u});return[`M${e},${n} C${l},${d} ${c},${u} ${i},${s}`,h,f,g,m]}var vr={[ae.Left]:{x:-1,y:0},[ae.Right]:{x:1,y:0},[ae.Top]:{x:0,y:-1},[ae.Bottom]:{x:0,y:1}};function ou({source:t,sourcePosition:e=ae.Bottom,target:n}){return e===ae.Left||e===ae.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1}}function _r(t,e){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function iu({source:t,sourcePosition:e=ae.Bottom,target:n,targetPosition:o=ae.Top,center:i,offset:s}){const a=vr[e],l=vr[o],d={x:t.x+a.x*s,y:t.y+a.y*s},c={x:n.x+l.x*s,y:n.y+l.y*s},u=ou({source:d,sourcePosition:e,target:c}),h=u.x!==0?"x":"y",f=u[h];let g,m,E;const S={x:0,y:0},D={x:0,y:0},[B,w,M,G]=hr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[h]*l[h]===-1){m=i.x??B,E=i.y??w;const R=[{x:m,y:d.y},{x:m,y:c.y}],q=[{x:d.x,y:E},{x:c.x,y:E}];a[h]===f?g=h==="x"?R:q:g=h==="x"?q:R}else{const R=[{x:d.x,y:c.y}],q=[{x:c.x,y:d.y}];if(h==="x"?g=a.x===f?q:R:g=a.y===f?R:q,e===o){const Z=Math.abs(t[h]-n[h]);if(Z<=s){const F=Math.min(s-1,s-Z);a[h]===f?S[h]=(d[h]>t[h]?-1:1)*F:D[h]=(c[h]>n[h]?-1:1)*F}}if(e!==o){const Z=h==="x"?"y":"x",F=a[h]===l[Z],k=d[Z]>c[Z],W=d[Z]<c[Z];(a[h]===1&&(!F&&k||F&&W)||a[h]!==1&&(!F&&W||F&&k))&&(g=h==="x"?R:q)}const K={x:d.x+S.x,y:d.y+S.y},j={x:c.x+D.x,y:c.y+D.y};Math.max(Math.abs(K.x-g[0].x),Math.abs(j.x-g[0].x))>=Math.max(Math.abs(K.y-g[0].y),Math.abs(j.y-g[0].y))?(m=(K.x+j.x)/2,E=g[0].y):(m=g[0].x,E=(K.y+j.y)/2)}return[[t,{x:d.x+S.x,y:d.y+S.y},...g,{x:c.x+D.x,y:c.y+D.y},n],m,E,M,G]}function ru(t,e,n,o){const i=Math.min(_r(t,e)/2,_r(e,n)/2,o),{x:s,y:a}=e;if(t.x===s&&s===n.x||t.y===a&&a===n.y)return`L${s} ${a}`;if(t.y===a){const d=t.x<n.x?-1:1,c=t.y<n.y?1:-1;return`L ${s+i*d},${a}Q ${s},${a} ${s},${a+i*c}`}const l=t.x<n.x?1:-1;return`L ${s},${a+i*(t.y<n.y?-1:1)}Q ${s},${a} ${s+i*l},${a}`}function mo(t){const{sourceX:e,sourceY:n,sourcePosition:o=ae.Bottom,targetX:i,targetY:s,targetPosition:a=ae.Top,borderRadius:l=5,centerX:d,centerY:c,offset:u=20}=t,[h,f,g,m,E]=iu({source:{x:e,y:n},sourcePosition:o,target:{x:i,y:s},targetPosition:a,center:{x:d,y:c},offset:u});return[h.reduce((S,D,B)=>{let w;return B>0&&B<h.length-1?w=ru(h[B-1],D,h[B+1],l):w=`${B===0?"M":"L"}${D.x} ${D.y}`,S+=w,S},""),f,g,m,E]}function su(t){const{sourceX:e,sourceY:n,targetX:o,targetY:i}=t,[s,a,l,d]=hr({sourceX:e,sourceY:n,targetX:o,targetY:i});return[`M ${e},${n}L ${o},${i}`,s,a,l,d]}var au=(0,r.defineComponent)({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=su(t);return(0,r.h)(Ot,{path:n,labelX:o,labelY:i,...e,...t})}}}),wr=(0,r.defineComponent)({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=mo({...t,sourcePosition:t.sourcePosition??ae.Bottom,targetPosition:t.targetPosition??ae.Top});return(0,r.h)(Ot,{path:n,labelX:o,labelY:i,...e,...t})}}}),lu=(0,r.defineComponent)({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(t,{attrs:e}){return()=>(0,r.h)(wr,{...t,...e,borderRadius:0})}}),cu=(0,r.defineComponent)({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=po({...t,sourcePosition:t.sourcePosition??ae.Bottom,targetPosition:t.targetPosition??ae.Top});return(0,r.h)(Ot,{path:n,labelX:o,labelY:i,...e,...t})}}}),du=(0,r.defineComponent)({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=yr({...t,sourcePosition:t.sourcePosition??ae.Bottom,targetPosition:t.targetPosition??ae.Top});return(0,r.h)(Ot,{path:n,labelX:o,labelY:i,...e,...t})}}}),uu={input:Kd,default:jd,output:Zd},fu={default:cu,straight:au,step:lu,smoothstep:wr,simplebezier:du};function hu(t,e,n){const o=(0,r.computed)(()=>m=>e.value.get(m)),i=(0,r.computed)(()=>m=>n.value.get(m)),s=(0,r.computed)(()=>{const m={...fu,...t.edgeTypes},E=Object.keys(m);for(const S of t.edges)S.type&&!E.includes(S.type)&&(m[S.type]=S.type);return m}),a=(0,r.computed)(()=>{const m={...uu,...t.nodeTypes},E=Object.keys(m);for(const S of t.nodes)S.type&&!E.includes(S.type)&&(m[S.type]=S.type);return m}),l=(0,r.computed)(()=>t.onlyRenderVisibleElements?Ai(t.nodes,{x:0,y:0,width:t.dimensions.width,height:t.dimensions.height},t.viewport,!0):t.nodes),d=(0,r.computed)(()=>{if(t.onlyRenderVisibleElements){const m=[];for(const E of t.edges){const S=e.value.get(E.source),D=e.value.get(E.target);yd({sourcePos:S.computedPosition||{x:0,y:0},targetPos:D.computedPosition||{x:0,y:0},sourceWidth:S.dimensions.width,sourceHeight:S.dimensions.height,targetWidth:D.dimensions.width,targetHeight:D.dimensions.height,width:t.dimensions.width,height:t.dimensions.height,viewport:t.viewport})&&m.push(E)}return m}return t.edges}),c=(0,r.computed)(()=>[...l.value,...d.value]),u=(0,r.computed)(()=>{const m=[];for(const E of t.nodes)E.selected&&m.push(E);return m}),h=(0,r.computed)(()=>{const m=[];for(const E of t.edges)E.selected&&m.push(E);return m}),f=(0,r.computed)(()=>[...u.value,...h.value]),g=(0,r.computed)(()=>{const m=[];for(const E of t.nodes)E.dimensions.width&&E.dimensions.height&&E.handleBounds!==void 0&&m.push(E);return m});return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:s,getNodeTypes:a,getEdges:d,getNodes:l,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:h,getNodesInitialized:g,areNodesInitialized:(0,r.computed)(()=>l.value.length>0&&g.value.length===l.value.length)}}var gu=class yt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var e;const n=(e=(0,r.getCurrentInstance)())==null?void 0:e.appContext.app;return yt.instance=n?.config.globalProperties.$vueFlowStorage??yt.instance??new yt,n&&(n.config.globalProperties.$vueFlowStorage=yt.instance),yt.instance}set(e,n){return this.flows.set(e,n)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,n){const o=(0,r.reactive)(fr()),i={};for(const[h,f]of Object.entries(o.hooks)){const g=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;i[g]=f.on}const s={};for(const[h,f]of Object.entries(o.hooks))s[h]=f.trigger;const a=(0,r.computed)(()=>{const h=new Map;for(const f of o.nodes)h.set(f.id,f);return h}),l=(0,r.computed)(()=>{const h=new Map;for(const f of o.edges)h.set(f.id,f);return h}),d=hu(o,a,l),c=Yd(o,a,l);c.setState({...o,...n});const u={...i,...d,...c,...fs(o),nodeLookup:a,edgeLookup:l,emits:s,id:e,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(e)}};return this.set(e,u),u}getId(){return`vue-flow-${this.currentId++}`}};function pe(t){const e=gu.getInstance(),n=(0,r.getCurrentScope)(),o=typeof t=="object",i=o?t:{id:t},s=i.id,a=s??n?.vueFlowId;let l;if(n){const d=(0,r.inject)(rr,null);typeof d<"u"&&d!==null&&(!a||d.id===a)&&(l=d)}if(l||a&&(l=e.get(a)),!l||a&&l.id!==a){const d=s??e.getId(),c=e.create(d,i);l=c,(n??(0,r.effectScope)(!0)).run(()=>{(0,r.watch)(c.applyDefault,(u,h,f)=>{const g=E=>{c.applyNodeChanges(E)},m=E=>{c.applyEdgeChanges(E)};u?(c.onNodesChange(g),c.onEdgesChange(m)):(c.hooks.value.nodesChange.off(g),c.hooks.value.edgesChange.off(m)),f(()=>{c.hooks.value.nodesChange.off(g),c.hooks.value.edgesChange.off(m)})},{immediate:!0}),_t(()=>{if(l){const u=e.get(l.id);u?u.$destroy():Pt(`No store instance found for id ${l.id} in storage.`)}})})}else o&&l.setState(i);if(n&&((0,r.provide)(rr,l),n.vueFlowId=l.id),o){const d=(0,r.getCurrentInstance)();d?.type.name!=="VueFlow"&&l.emits.error(new we(ve.USEVUEFLOW_OPTIONS))}return l}function pu(t){const{emits:e,dimensions:n}=pe();let o;(0,r.onMounted)(()=>{const i=()=>{var s,a;if(!t.value||!(((a=(s=t.value).checkVisibility)==null?void 0:a.call(s))??!0))return;const l=dn(t.value);(l.width===0||l.height===0)&&e.error(new we(ve.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:l.width||500,height:l.height||500}};i(),window.addEventListener("resize",i),t.value&&(o=new ResizeObserver(()=>i()),o.observe(t.value)),(0,r.onBeforeUnmount)(()=>{window.removeEventListener("resize",i),o&&t.value&&o.unobserve(t.value)})})}var mu=(0,r.defineComponent)({name:"UserSelection",compatConfig:{MODE:3},props:{userSelectionRect:{}},setup(t){return(e,n)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"vue-flow__selection vue-flow__container",style:(0,r.normalizeStyle)({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),yu=["tabIndex"],vu=(0,r.defineComponent)({name:"NodesSelection",compatConfig:{MODE:3},setup(t){const{emits:e,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:s,userSelectionActive:a}=pe(),l=ur(),d=(0,r.ref)(null),c=lr({el:d,onStart(m){e.selectionDragStart(m),e.nodeDragStart(m)},onDrag(m){e.selectionDrag(m),e.nodeDrag(m)},onStop(m){e.selectionDragStop(m),e.nodeDragStop(m)}});(0,r.onMounted)(()=>{var m;s.value||(m=d.value)==null||m.focus({preventScroll:!0})});const u=(0,r.computed)(()=>Ri(o.value)),h=(0,r.computed)(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function f(m){e.selectionContextMenu({event:m,nodes:o.value})}function g(m){s.value||ft[m.key]&&(m.preventDefault(),l({x:ft[m.key].x,y:ft[m.key].y},m.shiftKey))}return(m,E)=>!(0,r.unref)(a)&&u.value.width&&u.value.height?((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:0,class:(0,r.normalizeClass)(["vue-flow__nodesselection vue-flow__container",(0,r.unref)(i)]),style:(0,r.normalizeStyle)({transform:`translate(${(0,r.unref)(n).x}px,${(0,r.unref)(n).y}px) scale(${(0,r.unref)(n).zoom})`})},[(0,r.createElementVNode)("div",{ref_key:"el",ref:d,class:(0,r.normalizeClass)([{dragging:(0,r.unref)(c)},"vue-flow__nodesselection-rect"]),style:(0,r.normalizeStyle)(h.value),tabIndex:(0,r.unref)(s)?void 0:-1,onContextmenu:f,onKeydown:g},null,46,yu)],6)):(0,r.createCommentVNode)("",!0)}});function _u(t,e){return{x:t.clientX-e.left,y:t.clientY-e.top}}var wu=(0,r.defineComponent)({name:"Pane",compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(t){const{vueFlowRef:e,nodes:n,viewport:o,emits:i,userSelectionActive:s,removeSelectedElements:a,userSelectionRect:l,elementsSelectable:d,nodesSelectionActive:c,getSelectedEdges:u,getSelectedNodes:h,removeNodes:f,removeEdges:g,selectionMode:m,deleteKeyCode:E,multiSelectionKeyCode:S,multiSelectionActive:D,edgeLookup:B,nodeLookup:w,connectionLookup:M,defaultEdgeOptions:G,connectionStartHandle:R,panOnDrag:q}=pe(),K=(0,r.shallowRef)(null),j=(0,r.shallowRef)(new Set),Z=(0,r.shallowRef)(new Set),F=(0,r.shallowRef)(null),k=(0,r.toRef)(()=>d.value&&(t.isSelecting||s.value)),W=(0,r.toRef)(()=>R.value!==null);let b=!1,P=!1;const v=Bt(E,{actInsideInputWithModifier:!1}),N=Bt(S);(0,r.watch)(v,V=>{V&&(f(h.value),g(u.value),c.value=!1)}),(0,r.watch)(N,V=>{D.value=V});function I(V,X){return A=>{A.target===X&&V?.(A)}}function T(V){if(b||W.value){b=!1;return}i.paneClick(V),a(),c.value=!1}function z(V){var X;if(Array.isArray(q.value)&&((X=q.value)!=null&&X.includes(2))){V.preventDefault();return}i.paneContextMenu(V)}function O(V){i.paneScroll(V)}function L(V){var X,A,U;if(F.value=((X=e.value)==null?void 0:X.getBoundingClientRect())??null,!d.value||!t.isSelecting||V.button!==0||V.target!==K.value||!F.value)return;(U=(A=V.target)==null?void 0:A.setPointerCapture)==null||U.call(A,V.pointerId);const{x:te,y:ie}=_u(V,F.value);P=!0,b=!1,a(),l.value={width:0,height:0,startX:te,startY:ie,x:te,y:ie},i.selectionStart(V)}function ee(V){var X;if(!F.value||!l.value)return;b=!0;const{x:A,y:U}=Pe(V,F.value),{startX:te=0,startY:ie=0}=l.value,le={startX:te,startY:ie,x:A<te?A:te,y:U<ie?U:ie,width:Math.abs(A-te),height:Math.abs(U-ie)},J=j.value,re=Z.value;j.value=new Set(Ai(n.value,le,o.value,m.value===no.Partial,!0).map(p=>p.id)),Z.value=new Set;const x=((X=G.value)==null?void 0:X.selectable)??!0;for(const p of j.value){const y=M.value.get(p);if(y)for(const{edgeId:C}of y.values()){const _=B.value.get(C);_&&(_.selectable??x)&&Z.value.add(C)}}if(!ir(J,j.value)){const p=Xe(w.value,j.value,!0);i.nodesChange(p)}if(!ir(re,Z.value)){const p=Xe(B.value,Z.value);i.edgesChange(p)}l.value=le,s.value=!0,c.value=!1}function se(V){var X;V.button!==0||!P||((X=V.target)==null||X.releasePointerCapture(V.pointerId),!s.value&&l.value&&V.target===K.value&&T(V),s.value=!1,l.value=null,c.value=j.value.size>0,i.selectionEnd(V),t.selectionKeyPressed&&(b=!1),P=!1)}return(V,X)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{ref_key:"container",ref:K,class:(0,r.normalizeClass)(["vue-flow__pane vue-flow__container",{selection:V.isSelecting}]),onClick:X[0]||(X[0]=A=>k.value?void 0:I(T,K.value)(A)),onContextmenu:X[1]||(X[1]=A=>I(z,K.value)(A)),onWheelPassive:X[2]||(X[2]=A=>I(O,K.value)(A)),onPointerenter:X[3]||(X[3]=A=>k.value?void 0:(0,r.unref)(i).paneMouseEnter(A)),onPointerdown:X[4]||(X[4]=A=>k.value?L(A):(0,r.unref)(i).paneMouseMove(A)),onPointermove:X[5]||(X[5]=A=>k.value?ee(A):(0,r.unref)(i).paneMouseMove(A)),onPointerup:X[6]||(X[6]=A=>k.value?se(A):void 0),onPointerleave:X[7]||(X[7]=A=>(0,r.unref)(i).paneMouseLeave(A))},[(0,r.renderSlot)(V.$slots,"default"),(0,r.unref)(s)&&(0,r.unref)(l)?((0,r.openBlock)(),(0,r.createBlock)(mu,{key:0,"user-selection-rect":(0,r.unref)(l)},null,8,["user-selection-rect"])):(0,r.createCommentVNode)("",!0),(0,r.unref)(c)&&(0,r.unref)(h).length?((0,r.openBlock)(),(0,r.createBlock)(vu,{key:1})):(0,r.createCommentVNode)("",!0)],34))}}),bu=(0,r.defineComponent)({name:"Transform",compatConfig:{MODE:3},setup(t){const{viewport:e,fitViewOnInit:n,fitViewOnInitDone:o}=pe(),i=(0,r.computed)(()=>n.value?!o.value:!1),s=(0,r.computed)(()=>`translate(${e.value.x}px,${e.value.y}px) scale(${e.value.zoom})`);return(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"vue-flow__transformationpane vue-flow__container",style:(0,r.normalizeStyle)({transform:s.value,opacity:i.value?0:void 0})},[(0,r.renderSlot)(a.$slots,"default")],4))}}),Cu=(0,r.defineComponent)({name:"Viewport",compatConfig:{MODE:3},setup(t){const{minZoom:e,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:s,selectionKeyCode:a,panActivationKeyCode:l,panOnScroll:d,panOnScrollMode:c,panOnScrollSpeed:u,panOnDrag:h,zoomOnDoubleClick:f,zoomOnPinch:g,zoomOnScroll:m,preventScrolling:E,noWheelClassName:S,noPanClassName:D,emits:B,connectionStartHandle:w,userSelectionActive:M,paneDragging:G,d3Zoom:R,d3Selection:q,d3ZoomHandler:K,viewport:j,viewportRef:Z,paneClickDistance:F}=pe();pu(Z);const k=(0,r.shallowRef)(!1),W=(0,r.shallowRef)(!1);let b=null,P=!1,v=0,N={x:0,y:0,zoom:0};const I=Bt(l),T=Bt(a),z=Bt(s),O=(0,r.toRef)(()=>(!T.value||T.value&&a.value===!0)&&(I.value||h.value)),L=(0,r.toRef)(()=>I.value||d.value),ee=(0,r.toRef)(()=>a.value===!0&&O.value!==!0),se=(0,r.toRef)(()=>T.value&&a.value!==!0||M.value||ee.value),V=(0,r.toRef)(()=>w.value!==null);(0,r.onMounted)(()=>{if(!Z.value){Pt("Viewport element is missing");return}const ie=Z.value,le=ie.getBoundingClientRect(),J=Kc().clickDistance(F.value).scaleExtent([e.value,n.value]).translateExtent(i.value),re=Te(ie).call(J),x=re.on("wheel.zoom"),p=ut.translate(o.value.x??0,o.value.y??0).scale(ot(o.value.zoom??1,e.value,n.value)),y=[[0,0],[le.width,le.height]],C=J.constrain()(p,y,i.value);J.transform(re,C),J.wheelDelta(Vi),R.value=J,q.value=re,K.value=x,j.value={x:C.x,y:C.y,zoom:C.k},J.on("start",_=>{var Y;if(!_.sourceEvent)return null;v=_.sourceEvent.button,k.value=!0;const H=U(_.transform);((Y=_.sourceEvent)==null?void 0:Y.type)==="mousedown"&&(G.value=!0),N=H,B.viewportChangeStart(H),B.moveStart({event:_,flowTransform:H})}),J.on("end",_=>{if(!_.sourceEvent)return null;if(k.value=!1,G.value=!1,X(O.value,v??0)&&!P&&B.paneContextMenu(_.sourceEvent),P=!1,A(N,_.transform)){const Y=U(_.transform);N=Y,B.viewportChangeEnd(Y),B.moveEnd({event:_,flowTransform:Y})}}),J.filter(_=>{var Y;const H=z.value||m.value,oe=g.value&&_.ctrlKey,Q=_.button,ue=_.type==="wheel";if(Q===1&&_.type==="mousedown"&&(te(_,"vue-flow__node")||te(_,"vue-flow__edge")))return!0;if(!O.value&&!H&&!L.value&&!f.value&&!g.value||M.value||V.value&&!ue||!f.value&&_.type==="dblclick"||te(_,S.value)&&ue||te(_,D.value)&&(!ue||L.value&&ue&&!z.value)||!g.value&&_.ctrlKey&&ue||!H&&!L.value&&!oe&&ue)return!1;if(!g&&_.type==="touchstart"&&((Y=_.touches)==null?void 0:Y.length)>1)return _.preventDefault(),!1;if(!O.value&&(_.type==="mousedown"||_.type==="touchstart")||ee.value&&Array.isArray(h.value)&&h.value.includes(0)&&Q===0||Array.isArray(h.value)&&!h.value.includes(Q)&&(_.type==="mousedown"||_.type==="touchstart"))return!1;const fe=Array.isArray(h.value)&&h.value.includes(Q)||a.value===!0&&Array.isArray(h.value)&&!h.value.includes(0)||!Q||Q<=1;return(!_.ctrlKey||I.value||ue)&&fe}),(0,r.watch)([M,O],()=>{M.value&&!k.value?J.on("zoom",null):M.value||J.on("zoom",_=>{j.value={x:_.transform.x,y:_.transform.y,zoom:_.transform.k};const Y=U(_.transform);P=X(O.value,v??0),B.viewportChange(Y),B.move({event:_,flowTransform:Y})})},{immediate:!0}),(0,r.watch)([M,L,c,z,g,E,S],()=>{L.value&&!z.value&&!M.value?re.on("wheel.zoom",_=>{if(te(_,S.value))return!1;const Y=z.value||m.value,H=g.value&&_.ctrlKey;if(!(!E.value||L.value||Y||H))return!1;_.preventDefault(),_.stopImmediatePropagation();const oe=re.property("__zoom").k||1,Q=fn();if(!I.value&&_.ctrlKey&&g.value&&Q){const Ze=ze(_),Vt=oe*2**Vi(_);J.scaleTo(re,Vt,Ze,_);return}const ue=_.deltaMode===1?20:1;let fe=c.value===It.Vertical?0:_.deltaX*ue,ge=c.value===It.Horizontal?0:_.deltaY*ue;!Q&&_.shiftKey&&c.value!==It.Vertical&&!fe&&ge&&(fe=ge,ge=0),J.translateBy(re,-(fe/oe)*u.value,-(ge/oe)*u.value);const he=U(re.property("__zoom"));b&&clearTimeout(b),W.value?(B.move({event:_,flowTransform:he}),B.viewportChange(he),b=setTimeout(()=>{B.moveEnd({event:_,flowTransform:he}),B.viewportChangeEnd(he),W.value=!1},150)):(W.value=!0,B.moveStart({event:_,flowTransform:he}),B.viewportChangeStart(he))},{passive:!1}):typeof x<"u"&&re.on("wheel.zoom",function(_,Y){const H=!E.value&&_.type==="wheel"&&!_.ctrlKey,oe=z.value||m.value,Q=g.value&&_.ctrlKey;if(!oe&&!d.value&&!Q&&_.type==="wheel"||H||te(_,S.value))return null;_.preventDefault(),x.call(this,_,Y)},{passive:!1})},{immediate:!0})});function X(ie,le){return le===2&&Array.isArray(ie)&&ie.includes(2)}function A(ie,le){return ie.x!==le.x&&!Number.isNaN(le.x)||ie.y!==le.y&&!Number.isNaN(le.y)||ie.zoom!==le.k&&!Number.isNaN(le.k)}function U(ie){return{x:ie.x,y:ie.y,zoom:ie.k}}function te(ie,le){return ie.target.closest(`.${le}`)}return(ie,le)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{ref_key:"viewportRef",ref:Z,class:"vue-flow__viewport vue-flow__container"},[(0,r.createVNode)(wu,{"is-selecting":se.value,"selection-key-pressed":(0,r.unref)(T),class:(0,r.normalizeClass)({connecting:V.value,dragging:(0,r.unref)(G),draggable:(0,r.unref)(h)===!0||Array.isArray((0,r.unref)(h))&&(0,r.unref)(h).includes(0)})},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(bu,null,{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(ie.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Eu=["id"],xu=["id"],Nu=["id"],ku=(0,r.defineComponent)({name:"A11yDescriptions",compatConfig:{MODE:3},setup(t){const{id:e,disableKeyboardA11y:n,ariaLiveMessage:o}=pe();return(i,s)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createElementVNode)("div",{id:`${(0,r.unref)(Ni)}-${(0,r.unref)(e)}`,style:{display:"none"}}," Press enter or space to select a node. "+(0,r.toDisplayString)((0,r.unref)(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,Eu),(0,r.createElementVNode)("div",{id:`${(0,r.unref)(ki)}-${(0,r.unref)(e)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,xu),(0,r.unref)(n)?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:0,id:`${(0,r.unref)(nd)}-${(0,r.unref)(e)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},(0,r.toDisplayString)((0,r.unref)(o)),9,Nu))],64))}});function Su(){const t=pe();(0,r.watch)(()=>t.viewportHelper.value.viewportInitialized,e=>{e&&setTimeout(()=>{t.emits.init(t),t.emits.paneReady(t)},1)})}function Du(t,e,n){return n===ae.Left?t-e:n===ae.Right?t+e:t}function Tu(t,e,n){return n===ae.Top?t-e:n===ae.Bottom?t+e:t}var yo=function({radius:t=10,centerX:e=0,centerY:n=0,position:o=ae.Top,type:i}){return(0,r.h)("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Du(e,t,o),cy:Tu(n,t,o),r:t,stroke:"transparent",fill:"transparent"})};yo.props=["radius","centerX","centerY","position","type"],yo.compatConfig={MODE:3};var br=yo,Mu=(0,r.defineComponent)({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(t){const{id:e,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:s,nodesSelectionActive:a,noPanClassName:l,getEdgeTypes:d,removeSelectedEdges:c,findEdge:u,findNode:h,isValidConnection:f,multiSelectionActive:g,disableKeyboardA11y:m,elementsSelectable:E,edgesUpdatable:S,edgesFocusable:D,hooks:B}=pe(),w=(0,r.computed)(()=>u(t.id)),{emit:M,on:G}=zd(w.value,s),R=(0,r.inject)(gn),q=(0,r.getCurrentInstance)(),K=(0,r.ref)(!1),j=(0,r.ref)(!1),Z=(0,r.ref)(""),F=(0,r.ref)(null),k=(0,r.ref)("source"),W=(0,r.ref)(null),b=(0,r.toRef)(()=>typeof w.value.selectable>"u"?E.value:w.value.selectable),P=(0,r.toRef)(()=>typeof w.value.updatable>"u"?S.value:w.value.updatable),v=(0,r.toRef)(()=>typeof w.value.focusable>"u"?D.value:w.value.focusable);(0,r.provide)(Md,t.id),(0,r.provide)(Id,W);const N=(0,r.computed)(()=>w.value.class instanceof Function?w.value.class(w.value):w.value.class),I=(0,r.computed)(()=>w.value.style instanceof Function?w.value.style(w.value):w.value.style),T=(0,r.computed)(()=>{const p=w.value.type||"default",y=R?.[`edge-${p}`];if(y)return y;let C=w.value.template??d.value[p];if(typeof C=="string"&&q){const _=Object.keys(q.appContext.components);_&&_.includes(p)&&(C=(0,r.resolveComponent)(p,!1))}return C&&typeof C!="string"?C:(s.error(new we(ve.EDGE_TYPE_MISSING,C)),!1)}),{handlePointerDown:z}=cr({nodeId:Z,handleId:F,type:k,isValidConnection:f,edgeUpdaterType:k,onEdgeUpdate:ee,onEdgeUpdateEnd:se});return()=>{const p=h(w.value.source),y=h(w.value.target),C="pathOptions"in w.value?w.value.pathOptions:{};if(!p&&!y)return s.error(new we(ve.EDGE_SOURCE_TARGET_MISSING,w.value.id,w.value.source,w.value.target)),null;if(!p)return s.error(new we(ve.EDGE_SOURCE_MISSING,w.value.id,w.value.source)),null;if(!y)return s.error(new we(ve.EDGE_TARGET_MISSING,w.value.id,w.value.target)),null;if(!w.value||w.value.hidden||p.hidden||y.hidden)return null;let _;o.value===Fe.Strict?_=p.handleBounds.source:_=[...p.handleBounds.source||[],...p.handleBounds.target||[]];const Y=Zi(_,w.value.sourceHandle);let H;o.value===Fe.Strict?H=y.handleBounds.target:H=[...y.handleBounds.target||[],...y.handleBounds.source||[]];const oe=Zi(H,w.value.targetHandle),Q=Y?.position||ae.Bottom,ue=oe?.position||ae.Top,{x:fe,y:ge}=gt(p,Y,Q),{x:he,y:Ze}=gt(y,oe,ue);return w.value.sourceX=fe,w.value.sourceY=ge,w.value.targetX=he,w.value.targetY=Ze,(0,r.h)("g",{ref:W,key:t.id,"data-id":t.id,class:["vue-flow__edge",`vue-flow__edge-${T.value===!1?"default":w.value.type||"default"}`,l.value,N.value,{updating:K.value,selected:w.value.selected,animated:w.value.animated,inactive:!b.value&&!B.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":w.value.ariaLabel===null?void 0:w.value.ariaLabel??`Edge from ${w.value.source} to ${w.value.target}`,"aria-describedby":v.value?`${ki}-${e}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...w.value.domAttributes,onClick:X,onContextmenu:A,onDblclick:U,onMouseenter:te,onMousemove:ie,onMouseleave:le,onKeyDown:v.value?x:void 0},[j.value?null:(0,r.h)(T.value===!1?d.value.default:T.value,{id:t.id,sourceNode:p,targetNode:y,source:w.value.source,target:w.value.target,type:w.value.type,updatable:P.value,selected:w.value.selected,animated:w.value.animated,label:w.value.label,labelStyle:w.value.labelStyle,labelShowBg:w.value.labelShowBg,labelBgStyle:w.value.labelBgStyle,labelBgPadding:w.value.labelBgPadding,labelBgBorderRadius:w.value.labelBgBorderRadius,data:w.value.data,events:{...w.value.events,...G},style:I.value,markerStart:`url('#${$t(w.value.markerStart,e)}')`,markerEnd:`url('#${$t(w.value.markerEnd,e)}')`,sourcePosition:Q,targetPosition:ue,sourceX:fe,sourceY:ge,targetX:he,targetY:Ze,sourceHandleId:w.value.sourceHandle,targetHandleId:w.value.targetHandle,interactionWidth:w.value.interactionWidth,...C}),[P.value==="source"||P.value===!0?[(0,r.h)("g",{onMousedown:J,onMouseenter:O,onMouseout:L},(0,r.h)(br,{position:Q,centerX:fe,centerY:ge,radius:i.value,type:"source","data-type":"source"}))]:null,P.value==="target"||P.value===!0?[(0,r.h)("g",{onMousedown:re,onMouseenter:O,onMouseout:L},(0,r.h)(br,{position:ue,centerX:he,centerY:Ze,radius:i.value,type:"target","data-type":"target"}))]:null]])};function O(){K.value=!0}function L(){K.value=!1}function ee(p,y){M.update({event:p,edge:w.value,connection:y})}function se(p){M.updateEnd({event:p,edge:w.value}),j.value=!1}function V(p,y){p.button===0&&(j.value=!0,Z.value=y?w.value.target:w.value.source,F.value=(y?w.value.targetHandle:w.value.sourceHandle)??null,k.value=y?"target":"source",M.updateStart({event:p,edge:w.value}),z(p))}function X(p){var y;const C={event:p,edge:w.value};b.value&&(a.value=!1,w.value.selected&&g.value?(c([w.value]),(y=W.value)==null||y.blur()):n([w.value])),M.click(C)}function A(p){M.contextMenu({event:p,edge:w.value})}function U(p){M.doubleClick({event:p,edge:w.value})}function te(p){M.mouseEnter({event:p,edge:w.value})}function ie(p){M.mouseMove({event:p,edge:w.value})}function le(p){M.mouseLeave({event:p,edge:w.value})}function J(p){V(p,!0)}function re(p){V(p,!1)}function x(p){var y;!m.value&&Si.includes(p.key)&&b.value&&(p.key==="Escape"?((y=W.value)==null||y.blur(),c([u(t.id)])):n([u(t.id)]))}}}),Iu=(0,r.defineComponent)({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var t;const{id:e,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:s,connectionLineType:a,connectionLineStyle:l,connectionLineOptions:d,connectionStatus:c,viewport:u,findNode:h}=pe(),f=(t=(0,r.inject)(gn))==null?void 0:t["connection-line"],g=(0,r.computed)(()=>{var B;return h((B=o.value)==null?void 0:B.nodeId)}),m=(0,r.computed)(()=>{var B;return h((B=i.value)==null?void 0:B.nodeId)??null}),E=(0,r.computed)(()=>({x:(s.value.x-u.value.x)/u.value.zoom,y:(s.value.y-u.value.y)/u.value.zoom})),S=(0,r.computed)(()=>d.value.markerStart?`url(#${$t(d.value.markerStart,e)})`:""),D=(0,r.computed)(()=>d.value.markerEnd?`url(#${$t(d.value.markerEnd,e)})`:"");return()=>{var B,w,M;if(!g.value||!o.value)return null;const G=o.value.id,R=o.value.type,q=g.value.handleBounds;let K=q?.[R]??[];if(n.value===Fe.Loose){const I=q?.[R==="source"?"target":"source"]??[];K=[...K,...I]}if(!K)return null;const j=(G?K.find(I=>I.id===G):K[0])??null,Z=j?.position??ae.Top,{x:F,y:k}=gt(g.value,j,Z);let W=null;m.value&&(n.value===Fe.Strict?W=((B=m.value.handleBounds[R==="source"?"target":"source"])==null?void 0:B.find(I=>{var T;return I.id===((T=i.value)==null?void 0:T.id)}))||null:W=((w=[...m.value.handleBounds.source??[],...m.value.handleBounds.target??[]])==null?void 0:w.find(I=>{var T;return I.id===((T=i.value)==null?void 0:T.id)}))||null);const b=((M=i.value)==null?void 0:M.position)??(Z?co[Z]:null);if(!Z||!b)return null;const P=a.value??d.value.type??nt.Bezier;let v="";const N={sourceX:F,sourceY:k,sourcePosition:Z,targetX:E.value.x,targetY:E.value.y,targetPosition:b};return P===nt.Bezier?[v]=po(N):P===nt.Step?[v]=mo({...N,borderRadius:0}):P===nt.SmoothStep?[v]=mo(N):P===nt.SimpleBezier?[v]=yr(N):v=`M${F},${k} ${E.value.x},${E.value.y}`,(0,r.h)("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},(0,r.h)("g",{class:"vue-flow__connection"},f?(0,r.h)(f,{sourceX:F,sourceY:k,sourcePosition:Z,targetX:E.value.x,targetY:E.value.y,targetPosition:b,sourceNode:g.value,sourceHandle:j,targetNode:m.value,targetHandle:W,markerEnd:D.value,markerStart:S.value,connectionStatus:c.value}):(0,r.h)("path",{d:v,class:[d.value.class,c.value,"vue-flow__connection-path"],style:{...l.value,...d.value.style},"marker-end":D.value,"marker-start":S.value})))}}}),Bu=["id","markerWidth","markerHeight","markerUnits","orient"],zu=(0,r.defineComponent)({name:"MarkerType",compatConfig:{MODE:3},props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(t){return(e,n)=>((0,r.openBlock)(),(0,r.createElementBlock)("marker",{id:e.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===(0,r.unref)(Ge).ArrowClosed?((0,r.openBlock)(),(0,r.createElementBlock)("polyline",{key:0,style:(0,r.normalizeStyle)({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):(0,r.createCommentVNode)("",!0),e.type===(0,r.unref)(Ge).Arrow?((0,r.openBlock)(),(0,r.createElementBlock)("polyline",{key:1,style:(0,r.normalizeStyle)({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):(0,r.createCommentVNode)("",!0)],8,Bu))}}),Ru={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Au=(0,r.defineComponent)({name:"MarkerDefinitions",compatConfig:{MODE:3},setup(t){const{id:e,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=pe(),s=(0,r.computed)(()=>{const a=new Set,l=[],d=c=>{if(c){const u=$t(c,e);a.has(u)||(typeof c=="object"?l.push({...c,id:u,color:c.color||i.value}):l.push({id:u,color:i.value,type:c}),a.add(u))}};for(const c of[o.value.markerEnd,o.value.markerStart])d(c);for(const c of n.value)for(const u of[c.markerStart,c.markerEnd])d(u);return l.sort((c,u)=>c.id.localeCompare(u.id))});return(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)("svg",Ru,[(0,r.createElementVNode)("defs",null,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(s.value,d=>((0,r.openBlock)(),(0,r.createBlock)(zu,{id:d.id,key:d.id,type:d.type,color:d.color,width:d.width,height:d.height,markerUnits:d.markerUnits,"stroke-width":d.strokeWidth,orient:d.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),$u=(0,r.defineComponent)({name:"Edges",compatConfig:{MODE:3},setup(t){const{findNode:e,getEdges:n,elevateEdgesOnSelect:o}=pe();return(i,s)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createVNode)(Au),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(n),a=>((0,r.openBlock)(),(0,r.createElementBlock)("svg",{key:a.id,class:"vue-flow__edges vue-flow__container",style:(0,r.normalizeStyle)({zIndex:(0,r.unref)(vd)(a,(0,r.unref)(e),(0,r.unref)(o))})},[(0,r.createVNode)((0,r.unref)(Mu),{id:a.id},null,8,["id"])],4))),128)),(0,r.createVNode)((0,r.unref)(Iu))],64))}}),Pu=(0,r.defineComponent)({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(t){const{id:e,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:s,emits:a,removeSelectedNodes:l,addSelectedNodes:d,updateNodeDimensions:c,onUpdateNodeInternals:u,getNodeTypes:h,nodeExtent:f,elevateNodesOnSelect:g,disableKeyboardA11y:m,ariaLiveMessage:E,snapToGrid:S,snapGrid:D,nodeDragThreshold:B,nodesDraggable:w,elementsSelectable:M,nodesConnectable:G,nodesFocusable:R,hooks:q}=pe(),K=(0,r.ref)(null);(0,r.provide)(ar,K),(0,r.provide)(sr,t.id);const j=(0,r.inject)(gn),Z=(0,r.getCurrentInstance)(),F=ur(),{node:k,parentNode:W}=dr(t.id),{emit:b,on:P}=Pd(k,a),v=(0,r.toRef)(()=>typeof k.draggable>"u"?w.value:k.draggable),N=(0,r.toRef)(()=>typeof k.selectable>"u"?M.value:k.selectable),I=(0,r.toRef)(()=>typeof k.connectable>"u"?G.value:k.connectable),T=(0,r.toRef)(()=>typeof k.focusable>"u"?R.value:k.focusable),z=(0,r.computed)(()=>N.value||v.value||q.value.nodeClick.hasListeners()||q.value.nodeDoubleClick.hasListeners()||q.value.nodeMouseEnter.hasListeners()||q.value.nodeMouseMove.hasListeners()||q.value.nodeMouseLeave.hasListeners()),O=(0,r.toRef)(()=>!!k.dimensions.width&&!!k.dimensions.height),L=(0,r.computed)(()=>{const y=k.type||"default",C=j?.[`node-${y}`];if(C)return C;let _=k.template||h.value[y];if(typeof _=="string"&&Z){const Y=Object.keys(Z.appContext.components);Y&&Y.includes(y)&&(_=(0,r.resolveComponent)(y,!1))}return _&&typeof _!="string"?_:(a.error(new we(ve.NODE_TYPE_MISSING,_)),!1)}),ee=lr({id:t.id,el:K,disabled:()=>!v.value,selectable:N,dragHandle:()=>k.dragHandle,onStart(y){b.dragStart(y)},onDrag(y){b.drag(y)},onStop(y){b.dragStop(y)},onClick(y){x(y)}}),se=(0,r.computed)(()=>k.class instanceof Function?k.class(k):k.class),V=(0,r.computed)(()=>{const y=(k.style instanceof Function?k.style(k):k.style)||{},C=k.width instanceof Function?k.width(k):k.width,_=k.height instanceof Function?k.height(k):k.height;return!y.width&&C&&(y.width=typeof C=="string"?C:`${C}px`),!y.height&&_&&(y.height=typeof _=="string"?_:`${_}px`),y}),X=(0,r.toRef)(()=>Number(k.zIndex??V.value.zIndex??0));return u(y=>{(y.includes(t.id)||!y.length)&&U()}),(0,r.onMounted)(()=>{(0,r.watch)(()=>k.hidden,(y=!1,C,_)=>{!y&&K.value&&(t.resizeObserver.observe(K.value),_(()=>{K.value&&t.resizeObserver.unobserve(K.value)}))},{immediate:!0,flush:"post"})}),(0,r.watch)([()=>k.type,()=>k.sourcePosition,()=>k.targetPosition],()=>{(0,r.nextTick)(()=>{c([{id:t.id,nodeElement:K.value,forceUpdate:!0}])})}),(0,r.watch)([()=>k.position.x,()=>k.position.y,()=>{var y;return(y=W.value)==null?void 0:y.computedPosition.x},()=>{var y;return(y=W.value)==null?void 0:y.computedPosition.y},()=>{var y;return(y=W.value)==null?void 0:y.computedPosition.z},X,()=>k.selected,()=>k.dimensions.height,()=>k.dimensions.width,()=>{var y;return(y=W.value)==null?void 0:y.dimensions.height},()=>{var y;return(y=W.value)==null?void 0:y.dimensions.width}],([y,C,_,Y,H,oe])=>{const Q={x:y,y:C,z:oe+(g.value&&k.selected?1e3:0)};typeof _<"u"&&typeof Y<"u"?k.computedPosition=fd({x:_,y:Y,z:H},Q):k.computedPosition=Q},{flush:"post",immediate:!0}),(0,r.watch)([()=>k.extent,f],([y,C],[_,Y])=>{(y!==_||C!==Y)&&A()}),k.extent==="parent"||typeof k.extent=="object"&&"range"in k.extent&&k.extent.range==="parent"?An(()=>O).toBe(!0).then(A):A(),()=>k.hidden?null:(0,r.h)("div",{ref:K,"data-id":k.id,class:["vue-flow__node",`vue-flow__node-${L.value===!1?"default":k.type||"default"}`,{[n.value]:v.value,dragging:ee?.value,draggable:v.value,selected:k.selected,selectable:N.value,parent:k.isParent},se.value],style:{visibility:O.value?"visible":"hidden",zIndex:k.computedPosition.z??X.value,transform:`translate(${k.computedPosition.x}px,${k.computedPosition.y}px)`,pointerEvents:z.value?"all":"none",...V.value},tabIndex:T.value?0:void 0,role:T.value?"group":void 0,"aria-describedby":m.value?void 0:`${Ni}-${e}`,"aria-label":k.ariaLabel,"aria-roledescription":"node",...k.domAttributes,onMouseenter:te,onMousemove:ie,onMouseleave:le,onContextmenu:J,onClick:x,onDblclick:re,onKeydown:p},[(0,r.h)(L.value===!1?h.value.default:L.value,{id:k.id,type:k.type,data:k.data,events:{...k.events,...P},selected:k.selected,resizing:k.resizing,dragging:ee.value,connectable:I.value,position:k.computedPosition,dimensions:k.dimensions,isValidTargetPos:k.isValidTargetPos,isValidSourcePos:k.isValidSourcePos,parent:k.parentNode,parentNodeId:k.parentNode,zIndex:k.computedPosition.z??X.value,targetPosition:k.targetPosition,sourcePosition:k.sourcePosition,label:k.label,dragHandle:k.dragHandle,onUpdateNodeInternals:U})]);function A(){const y=k.computedPosition,{computedPosition:C,position:_}=so(k,S.value?hn(y,D.value):y,a.error,f.value,W.value);(k.computedPosition.x!==C.x||k.computedPosition.y!==C.y)&&(k.computedPosition={...k.computedPosition,...C}),(k.position.x!==_.x||k.position.y!==_.y)&&(k.position=_)}function U(){K.value&&c([{id:t.id,nodeElement:K.value,forceUpdate:!0}])}function te(y){ee?.value||b.mouseEnter({event:y,node:k})}function ie(y){ee?.value||b.mouseMove({event:y,node:k})}function le(y){ee?.value||b.mouseLeave({event:y,node:k})}function J(y){return b.contextMenu({event:y,node:k})}function re(y){return b.doubleClick({event:y,node:k})}function x(y){N.value&&(!o.value||!v.value||B.value>0)&&uo(k,s.value,d,l,i,!1,K.value),b.click({event:y,node:k})}function p(y){if(!(oo(y)||m.value))if(Si.includes(y.key)&&N.value){const C=y.key==="Escape";uo(k,s.value,d,l,i,C,K.value)}else v.value&&k.selected&&ft[y.key]&&(y.preventDefault(),E.value=`Moved selected node ${y.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~k.position.x}, y: ${~~k.position.y}`,F({x:ft[y.key].x,y:ft[y.key].y},y.shiftKey))}}}),Ou={height:"0",width:"0"},Vu=(0,r.defineComponent)({name:"EdgeLabelRenderer",compatConfig:{MODE:3},setup(t){const{viewportRef:e}=pe(),n=(0,r.toRef)(()=>{var o;return(o=e.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>((0,r.openBlock)(),(0,r.createElementBlock)("svg",null,[((0,r.openBlock)(),(0,r.createElementBlock)("foreignObject",Ou,[((0,r.openBlock)(),(0,r.createBlock)(r.Teleport,{to:n.value,disabled:!n.value},[(0,r.renderSlot)(o.$slots,"default")],8,["to","disabled"]))]))]))}});function Hu(t={includeHiddenNodes:!1}){const{nodes:e}=pe();return(0,r.computed)(()=>{if(e.value.length===0)return!1;for(const n of e.value)if((t.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}var Lu={class:"vue-flow__nodes vue-flow__container"},Fu=(0,r.defineComponent)({name:"Nodes",compatConfig:{MODE:3},setup(t){const{getNodes:e,updateNodeDimensions:n,emits:o}=pe(),i=Hu(),s=(0,r.ref)();return(0,r.watch)(i,a=>{a&&(0,r.nextTick)(()=>{o.nodesInitialized(e.value)})},{immediate:!0}),(0,r.onMounted)(()=>{s.value=new ResizeObserver(a=>{const l=a.map(d=>({id:d.target.getAttribute("data-id"),nodeElement:d.target,forceUpdate:!0}));(0,r.nextTick)(()=>n(l))})}),(0,r.onBeforeUnmount)(()=>{var a;return(a=s.value)==null?void 0:a.disconnect()}),(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",Lu,[s.value?((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,{key:0},(0,r.renderList)((0,r.unref)(e),(d,c,u,h)=>{const f=[d.id];if(h&&h.key===d.id&&(0,r.isMemoSame)(h,f))return h;const g=((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Pu),{id:d.id,key:d.id,"resize-observer":s.value},null,8,["id","resize-observer"]));return g.memo=f,g},l,0),128)):(0,r.createCommentVNode)("",!0)]))}});function Gu(){const{emits:t}=pe();(0,r.onMounted)(()=>{if(er()){const e=document.querySelector(".vue-flow__pane");e&&window.getComputedStyle(e).zIndex!=="1"&&t.error(new we(ve.MISSING_STYLES))}})}var Wu=(0,r.createElementVNode)("div",{class:"vue-flow__edge-labels"},null,-1),Uu=(0,r.defineComponent)({name:"VueFlow",compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(t,{expose:e,emit:n}){const o=t,i=(0,r.useSlots)(),s=$n(o,"modelValue",n),a=$n(o,"nodes",n),l=$n(o,"edges",n),d=pe(o),c=Ld({modelValue:s,nodes:a,edges:l},o,d);return Gd(n,d.hooks),Su(),Gu(),(0,r.provide)(gn,i),(0,r.onUnmounted)(c),e(d),(u,h)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{ref:(0,r.unref)(d).vueFlowRef,class:"vue-flow"},[(0,r.createVNode)(Cu,null,{default:(0,r.withCtx)(()=>[(0,r.createVNode)($u),Wu,(0,r.createVNode)(Fu),(0,r.renderSlot)(u.$slots,"zoom-pane")]),_:3}),(0,r.renderSlot)(u.$slots,"default"),(0,r.createVNode)(ku)],512))}}),Yu=(0,r.defineComponent)({name:"Panel",compatConfig:{MODE:3},props:{position:{}},setup(t){const e=t,{userSelectionActive:n}=pe(),o=(0,r.computed)(()=>`${e.position}`.split("-"));return(i,s)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:(0,r.normalizeClass)(["vue-flow__panel",o.value]),style:(0,r.normalizeStyle)({pointerEvents:(0,r.unref)(n)?"none":"all"})},[(0,r.renderSlot)(i.$slots,"default")],6))}}),We=(t=>(t.Lines="lines",t.Dots="dots",t))(We||{}),Xu=function({dimensions:t,size:e,color:n}){return(0,r.h)("path",{stroke:n,"stroke-width":e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})},ju=function({radius:t,color:e}){return(0,r.h)("circle",{cx:t,cy:t,r:t,fill:e})};We.Lines,We.Dots;var Zu={[We.Dots]:"#81818a",[We.Lines]:"#eee"},Ku=["id","x","y","width","height","patternTransform"],qu={key:2,height:"100",width:"100"},Ju=["fill"],Qu=["x","y","fill"],ef=(0,r.defineComponent)({name:"Background",compatConfig:{MODE:3},props:{id:{},variant:{default:()=>We.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(t){const{id:e,viewport:n}=pe(),o=(0,r.computed)(()=>{const a=n.value.zoom,[l,d]=Array.isArray(t.gap)?t.gap:[t.gap,t.gap],c=[l*a||1,d*a||1],u=t.size*a,[h,f]=Array.isArray(t.offset)?t.offset:[t.offset,t.offset];return{scaledGap:c,offset:[h*a||1+c[0]/2,f*a||1+c[1]/2],size:u}}),i=(0,r.toRef)(()=>`pattern-${e}${t.id?`-${t.id}`:""}`),s=(0,r.toRef)(()=>t.color||t.patternColor||Zu[t.variant||We.Dots]);return(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)("svg",{class:"vue-flow__background vue-flow__container",style:(0,r.normalizeStyle)({height:`${a.height>100?100:a.height}%`,width:`${a.width>100?100:a.width}%`})},[(0,r.renderSlot)(a.$slots,"pattern-container",{id:i.value},()=>[(0,r.createElementVNode)("pattern",{id:i.value,x:(0,r.unref)(n).x%o.value.scaledGap[0],y:(0,r.unref)(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[(0,r.renderSlot)(a.$slots,"pattern",{},()=>[a.variant===(0,r.unref)(We).Lines?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Xu),{key:0,size:a.lineWidth,color:s.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):a.variant===(0,r.unref)(We).Dots?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ju),{key:1,color:s.value,radius:o.value.size/2},null,8,["color","radius"])):(0,r.createCommentVNode)("",!0),a.bgColor?((0,r.openBlock)(),(0,r.createElementBlock)("svg",qu,[(0,r.createElementVNode)("rect",{width:"100%",height:"100%",fill:a.bgColor},null,8,Ju)])):(0,r.createCommentVNode)("",!0)])],8,Ku)]),(0,r.createElementVNode)("rect",{x:a.x,y:a.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,Qu),(0,r.renderSlot)(a.$slots,"default",{id:i.value})],4))}}),tf={name:"ControlButton",compatConfig:{MODE:3}},nf=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n},of={type:"button",class:"vue-flow__controls-button"};function rf(t,e,n,o,i,s){return(0,r.openBlock)(),(0,r.createElementBlock)("button",of,[(0,r.renderSlot)(t.$slots,"default")])}var bn=nf(tf,[["render",rf]]),sf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},af=[(0,r.createElementVNode)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function lf(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",sf,af)}var cf={render:lf},df={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},uf=[(0,r.createElementVNode)("path",{d:"M0 0h32v4.2H0z"},null,-1)];function ff(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",df,uf)}var hf={render:ff},gf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},pf=[(0,r.createElementVNode)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function mf(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",gf,pf)}var yf={render:mf},vf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},_f=[(0,r.createElementVNode)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function wf(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",vf,_f)}var bf={render:wf},Cf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Ef=[(0,r.createElementVNode)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function xf(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",Cf,Ef)}var Nf={render:xf},kf=(0,r.defineComponent)({name:"Controls",compatConfig:{MODE:3},props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Ei.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(t,{emit:e}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:i,setInteractive:s,zoomIn:a,zoomOut:l,fitView:d,viewport:c,minZoom:u,maxZoom:h}=pe(),f=(0,r.toRef)(()=>n.value||o.value||i.value),g=(0,r.toRef)(()=>c.value.zoom<=u.value),m=(0,r.toRef)(()=>c.value.zoom>=h.value);function E(){a(),e("zoomIn")}function S(){l(),e("zoomOut")}function D(){d(t.fitViewParams),e("fitView")}function B(){s(!f.value),e("interactionChange",!f.value)}return(w,M)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Yu),{class:"vue-flow__controls",position:w.position},{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(w.$slots,"top"),w.showZoom?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:0},[(0,r.renderSlot)(w.$slots,"control-zoom-in",{},()=>[(0,r.createVNode)(bn,{class:"vue-flow__controls-zoomin",disabled:m.value,onClick:E},{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(w.$slots,"icon-zoom-in",{},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(cf))))])]),_:3},8,["disabled"])]),(0,r.renderSlot)(w.$slots,"control-zoom-out",{},()=>[(0,r.createVNode)(bn,{class:"vue-flow__controls-zoomout",disabled:g.value,onClick:S},{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(w.$slots,"icon-zoom-out",{},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(hf))))])]),_:3},8,["disabled"])])],64)):(0,r.createCommentVNode)("",!0),w.showFitView?(0,r.renderSlot)(w.$slots,"control-fit-view",{key:1},()=>[(0,r.createVNode)(bn,{class:"vue-flow__controls-fitview",onClick:D},{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(w.$slots,"icon-fit-view",{},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(yf))))])]),_:3})]):(0,r.createCommentVNode)("",!0),w.showInteractive?(0,r.renderSlot)(w.$slots,"control-interactive",{key:2},()=>[w.showInteractive?((0,r.openBlock)(),(0,r.createBlock)(bn,{key:0,class:"vue-flow__controls-interactive",onClick:B},{default:(0,r.withCtx)(()=>[f.value?(0,r.renderSlot)(w.$slots,"icon-unlock",{key:0},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(Nf))))]):(0,r.createCommentVNode)("",!0),f.value?(0,r.createCommentVNode)("",!0):(0,r.renderSlot)(w.$slots,"icon-lock",{key:1},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(bf))))])]),_:3})):(0,r.createCommentVNode)("",!0)]):(0,r.createCommentVNode)("",!0),(0,r.renderSlot)(w.$slots,"default")]),_:3},8,["position"]))}}),Sf=["onClick"],Df={class:"d-flow-node-menus-item-name"},Tf=(0,r.defineComponent)({name:"DNodeMenus",__name:"nodeMenus",props:{fromNodeId:{},handleId:{}},emits:["addNode"],setup(t,{emit:e}){const n=t,o=e,i=(0,r.inject)("d_flow_design_provide",{}),s=i.getFlowComponents?.()||[],a=l=>{o("addNode",l.type),(0,r.nextTick)(()=>{n.handleId==="line"?i.addNodeByLine?.(l.type,n.fromNodeId||""):i.addNode?.(l.type,n.fromNodeId||"",n.handleId||"")})};return(l,d)=>{const c=(0,r.resolveComponent)("j-icon");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"d-flow-node-menus",onClick:(0,r.withModifiers)(()=>{},["stop"])},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(s),(u,h)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:h,class:"d-flow-node-menus-item",onClick:f=>a(u)},[(0,r.createElementVNode)("div",{class:"d-flow-node-menus-item-icon",style:(0,r.normalizeStyle)({backgroundColor:u.iconColor||"var(--j-color-primary)"})},[(0,r.createVNode)(c,{icon:u.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,r.createElementVNode)("div",Df,(0,r.toDisplayString)(u.name),1)],8,Sf))),128))])}}}),vo=Tf,Mf={class:"d-flow-step-name"},If={key:0,style:{color:"var(--j-color-text-2)"}},Bf={style:{color:"var(--j-color-text)"}},zf=(0,r.defineComponent)({name:"DStepNode",__name:"stepNode",props:{id:{},data:{}},setup(t){const e=t,{onNodeClick:n,onEdgeClick:o,onMoveStart:i,onConnectStart:s,onNodeDragStart:a,removeNodes:l,getEdges:d,getNodes:c,onNodesChange:u}=pe(),h=(0,r.inject)("d_flow_design_provide",{}),f=(0,r.computed)(()=>h.getFlowComponentMap?.value?.[e.data.type]||{}),g=()=>{l(e.id),h.onRemoveNode?.(e.id)},m=(0,r.ref)({});u(W=>{if(e.data.isInit&&W.findIndex(b=>b.type==="select"&&b.id===e.id&&b.id==="start"&&b.selected)!==-1){const b=c.value.find(P=>P.id==="start");b&&(b.data.isInit=!1),m.value.s1=!0}});const E=(0,r.ref)(!1),S=W=>{W.indexOf("t")!==-1&&!D.value||(E.value=!0,m.value[W]=!0)},D=(0,r.computed)(()=>d.value.findIndex(W=>W.target===e.id)===-1),B=(0,r.ref)(!1),w=()=>{B.value=!0},M=(W,b)=>{if(d.value.find(v=>v.source===b&&v.target===W))return!0;const P=d.value.filter(v=>v.target===W);for(let v=0;v<P.length;v++)if(M(P[v].source,b))return!0;return!1},G=W=>B.value?(B.value=!1,!1):M(W.source,W.target)?!1:W.source!==W.target&&W.sourceHandle!==W.targetHandle&&W.sourceHandle.indexOf("s")!==-1&&W.targetHandle.indexOf("t")!==-1,R=()=>{F(),Object.keys(m.value).forEach(W=>{m.value[W]=!1})},q=()=>{R()};n(()=>{console.log("onNodeClick"),E.value?E.value=!1:R()}),o(()=>{R()}),i(()=>{R()}),s(()=>{R()}),a(()=>{R()});const K=(0,r.ref)(),j=(0,r.ref)({top:0,left:0,bottom:0,right:0}),Z=(0,r.ref)({getBoundingClientRect:()=>j.value}),F=()=>{K.value?.handleClose()},k=W=>{const{clientX:b,clientY:P}=W;j.value=DOMRect.fromRect({x:b,y:P}),W.preventDefault(),K.value?.handleOpen()};return(W,b)=>{const P=(0,r.resolveComponent)("j-icon"),v=(0,r.resolveComponent)("el-popover"),N=(0,r.resolveComponent)("el-tooltip"),I=(0,r.resolveComponent)("el-dropdown-item"),T=(0,r.resolveComponent)("el-dropdown-menu"),z=(0,r.resolveComponent)("el-dropdown");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"d-flow-step",onContextmenu:(0,r.withModifiers)(k,["stop"])},[(0,r.createElementVNode)("div",{class:"d-flow-step-icon",style:(0,r.normalizeStyle)({backgroundColor:f.value.iconColor||"var(--j-color-primary)"})},[(0,r.createVNode)(P,{icon:f.value.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,r.createElementVNode)("div",Mf,(0,r.toDisplayString)(f.value.name),1),t.data.type!=="start"?((0,r.openBlock)(),(0,r.createBlock)(N,{key:0,placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:(0,r.withCtx)(()=>[D.value?((0,r.openBlock)(),(0,r.createElementBlock)("div",If,[...b[4]||(b[4]=[(0,r.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击",-1),(0,r.createTextVNode)("添加节点 ",-1)])])):(0,r.createCommentVNode)("",!0),b[5]||(b[5]=(0,r.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,r.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),(0,r.createTextVNode)("连接节点 ")],-1))]),default:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(pt),{onClick:b[1]||(b[1]=O=>S("t1")),onMousedown:w,id:"t1",class:(0,r.normalizeClass)(["d-flow-step-target-handle",{"d-flow-step-target-handle-notadd":!D.value}]),type:"target",position:(0,r.unref)(ae).Left,"is-valid-connection":G},{default:(0,r.withCtx)(()=>[D.value?((0,r.openBlock)(),(0,r.createBlock)(v,{key:0,visible:m.value.t1,"onUpdate:visible":b[0]||(b[0]=O=>m.value.t1=O),placement:"left","popper-class":"d-flow-step-popper",trigger:"click","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:(0,r.withCtx)(()=>[(0,r.createVNode)(P,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:(0,r.withCtx)(()=>[(0,r.createVNode)(vo,{"handle-id":"t1","from-node-id":t.id,onAddNode:q},null,8,["from-node-id"])]),_:1},8,["visible"])):(0,r.createCommentVNode)("",!0)]),_:1},8,["class","position"])]),_:1})):(0,r.createCommentVNode)("",!0),(0,r.createVNode)(N,{placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:(0,r.withCtx)(()=>[...b[6]||(b[6]=[(0,r.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,r.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击"),(0,r.createTextVNode)("添加节点 ")],-1),(0,r.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,r.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),(0,r.createTextVNode)("连接节点 ")],-1)])]),default:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(pt),{onClick:b[3]||(b[3]=O=>S("s1")),onMousedown:w,id:"s1",class:"d-flow-step-source-handle",type:"source",position:(0,r.unref)(ae).Right,"is-valid-connection":G},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(v,{visible:m.value.s1,"onUpdate:visible":b[2]||(b[2]=O=>m.value.s1=O),placement:"right",trigger:"click","popper-class":"d-flow-step-popper","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:(0,r.withCtx)(()=>[(0,r.createVNode)(P,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:(0,r.withCtx)(()=>[(0,r.createVNode)(vo,{"handle-id":"s1","from-node-id":t.id,onAddNode:q},null,8,["from-node-id"])]),_:1},8,["visible"])]),_:1},8,["position"])]),_:1}),(0,r.createVNode)(z,{ref_key:"dropdownRef",ref:K,"popper-class":"d-flow-step-dropdown","virtual-ref":Z.value,"show-arrow":!1,"popper-options":{modifiers:[{name:"offset",options:{offset:[0,0]}}]},"virtual-triggering":"",trigger:"contextmenu",placement:"bottom-start"},{dropdown:(0,r.withCtx)(()=>[(0,r.createVNode)(T,null,{default:(0,r.withCtx)(()=>[t.data.type!="start"?((0,r.openBlock)(),(0,r.createBlock)(I,{key:0,onClick:g},{default:(0,r.withCtx)(()=>[...b[7]||(b[7]=[(0,r.createTextVNode)("删除",-1)])]),_:1})):(0,r.createCommentVNode)("",!0),f.value.des?((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:1,style:(0,r.normalizeStyle)({width:"160px",padding:"4px 16px 0 16px","font-size":"12px","border-top":t.data.type!="start"?"1px solid var(--j-color-border)":void 0,"margin-top":t.data.type!="start"?"4px":void 0})},[b[8]||(b[8]=(0,r.createElementVNode)("div",{style:{"margin-bottom":"4px",color:"var(--j-color-text-2)"}},"关于",-1)),(0,r.createElementVNode)("div",Bf,(0,r.toDisplayString)(f.value.des),1)],4)):(0,r.createCommentVNode)("",!0)]),_:1})]),_:1},8,["virtual-ref"])],32)}}}),Rf=zf,Af=(0,r.defineComponent)({name:"DEdgeWithButton",__name:"edgeWithButton",props:{id:{},sourceX:{},sourceY:{},targetX:{},targetY:{},sourcePosition:{},targetPosition:{},markerEnd:{},style:{}},setup(t){const e=t,{onEdgeMouseEnter:n,onEdgeMouseLeave:o,onNodeClick:i,onEdgeClick:s,onMoveStart:a,onConnectStart:l,onNodeDragStart:d}=pe(),c=(0,r.computed)(()=>po(e)),u=(0,r.ref)(!1),h=(0,r.ref)(!1);n(({edge:S})=>{S.id===e.id&&(u.value=!0)}),o(()=>{u.value=!1});const f=(0,r.ref)(!1),g=()=>{f.value=!1,(0,r.nextTick)(()=>{h.value=!1})},m=()=>{h.value=!0,f.value=!0},E=()=>{g()};return i(()=>{g()}),s(()=>{g()}),a(()=>{g()}),l(()=>{g()}),d(()=>{g()}),(S,D)=>{const B=(0,r.resolveComponent)("j-icon"),w=(0,r.resolveComponent)("el-popover");return(0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createVNode)((0,r.unref)(Ot),{id:t.id,style:(0,r.normalizeStyle)(t.style),path:c.value[0],"marker-end":t.markerEnd},null,8,["id","style","path","marker-end"]),(0,r.createVNode)((0,r.unref)(Vu),null,{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${c.value[1]}px,${c.value[2]}px)`}),class:"nodrag nopan"},[(0,r.createVNode)(w,{visible:f.value,"show-arrow":!1,placement:"right","popper-class":"d-flow-step-popper"},{reference:(0,r.withCtx)(()=>[(0,r.withDirectives)((0,r.createElementVNode)("div",{onClick:(0,r.withModifiers)(m,["stop"]),class:"d-flow-edge-button"},[(0,r.createVNode)(B,{icon:"mdi:plus-circle"})],512),[[r.vShow,u.value||h.value]])]),default:(0,r.withCtx)(()=>[(0,r.createVNode)(vo,{"handle-id":"line","from-node-id":t.id,onAddNode:E},null,8,["from-node-id"])]),_:1},8,["visible"])],4)]),_:1})],64)}}}),$f=Af,Pf=(0,r.defineComponent)({name:"DFlow",__name:"flow",props:{nodes:{default:()=>[]},edges:{default:()=>[]}},setup(t){return(e,n)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Uu),{"min-zoom":.2,"max-zoom":4,"default-viewport":{zoom:1},"connection-mode":(0,r.unref)(Fe).Strict,nodes:t.nodes,edges:t.edges},{"edge-button":(0,r.withCtx)(o=>[(0,r.createVNode)($f,{id:o.id,"source-x":o.sourceX,"source-y":o.sourceY,"target-x":o.targetX,"target-y":o.targetY,"source-position":o.sourcePosition,"target-position":o.targetPosition,"marker-end":o.markerEnd,style:(0,r.normalizeStyle)(o.style)},null,8,["id","source-x","source-y","target-x","target-y","source-position","target-position","marker-end","style"])]),"node-step":(0,r.withCtx)(o=>[(0,r.createVNode)(Rf,(0,r.normalizeProps)((0,r.guardReactiveProps)(o)),null,16)]),default:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(kf),{position:"bottom-left"}),(0,r.createVNode)((0,r.unref)(ef))]),_:1},8,["connection-mode","nodes","edges"]))}}),Of=Pf,Vf={class:"d-flow-design"},Hf={class:"d-flow-design-canvas"},Lf={class:"d-flow-design-right"},Ff={class:"d-flow-design-title"},Gf={class:"d-flow-design-title-name"},Wf={class:"d-flow-design-panel"},Uf=(0,r.defineComponent)({name:"DFlowDesign",__name:"flowDesign",props:{components:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["nodeClick","edgeClick","paneClick","connect"],setup(t,{expose:e,emit:n}){const o=t,i=n,{addNodes:s,addEdges:a,removeEdges:l,addSelectedNodes:d,removeSelectedNodes:c,onConnect:u,onNodeClick:h,onPaneClick:f,onEdgeClick:g,getNodes:m,getEdges:E}=pe(),S=(0,r.computed)(()=>{const T={};return o.components.forEach(z=>{T[z.type]=z}),T.start={name:"开始",type:"start",icon:"ant-design:play-circle-outlined",des:"执行开始节点"},T}),D={id:"start",type:"step",data:{type:"start",isInit:!1},position:{x:80,y:160}},B=(0,r.ref)([D]),w=(0,r.ref)([]),M=(T,z)=>{if(z.indexOf("t")===-1){const O=E.value.filter(L=>L.source===T.id);if(O.length>0){let L=-1e6,ee=0;return O.forEach(se=>{L=Math.max(L,se.targetNode.position.y+se.targetNode.dimensions.height+32),ee=se.targetNode.position.x||0}),{x:ee,y:L}}return{x:T.position.x+T.dimensions.width+100,y:T.position.y}}return{x:T.position.x-100-T.dimensions.width,y:T.position.y}},G=(T,z,O)=>{const L=m.value.find(se=>se.id===z);if(!L)return;const ee={id:rt(),type:"step",data:{type:T},position:M(L,O)};if(o.flowInit){const se=o.flowInit(ee.data.type);se&&Object.keys(se).forEach(V=>{ee.data[V]=se[V]})}s(ee),O.indexOf("t")===-1?a({id:`${z}-${ee.id}`,source:z,target:ee.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Ge.Arrow}):a({id:`${z}-${ee.id}`,source:ee.id,target:z,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Ge.Arrow}),k(ee.id)},R=T=>{const z=m.value.find(O=>O.id===T);z&&(z.position.x+=100+z.dimensions.width,E.value.filter(O=>O.source===T).forEach(O=>{R(O.target)}))},q=(T,z)=>{const O=E.value.find(ee=>ee.id===z);if(!O)return;const L={id:rt(),type:"step",data:{type:T},position:{x:O.targetNode.position.x,y:O.targetNode.position.y}};if(o.flowInit){const ee=o.flowInit(L.data.type);ee&&Object.keys(ee).forEach(se=>{L.data[se]=ee[se]})}s(L),a({id:`${O.sourceNode.id}-${L.id}`,source:O.sourceNode.id,target:L.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Ge.Arrow}),a({id:`${L.id}-${O.targetNode.id}`,source:L.id,target:O.targetNode.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Ge.Arrow}),l(z),R(O.target),k(L.id)};u(T=>{console.log("onConnect",T),T.type="button",T.markerEnd=Ge.Arrow,a(T),i("connect",T)});const K=()=>o.components||[],j=(0,r.ref)(),Z=(0,r.computed)(()=>j.value?S.value[j.value.data.type]:void 0);h(T=>{j.value?.id!==T.node.id&&(j.value=T.node,P()),i("nodeClick",T.node)}),f(()=>{j.value=void 0,i("paneClick")}),g(T=>{j.value=void 0,i("edgeClick",T.edge)});const F=T=>{j.value?.id===T&&(j.value=void 0)},k=T=>{j.value&&c([j.value]),j.value=m.value.find(z=>z.id===T),j.value&&(P(),setTimeout(()=>{j.value&&d([j.value])},100))},W=(0,r.ref)(),b={};Object.keys(o.flowComponentConfigs).forEach(T=>{const z={type:"j-collapse",config:{defaultValue:[]},children:[]};o.flowComponentConfigs[T].forEach((O,L)=>{const ee=`_collapse${L}`;z.config?.defaultValue.push(ee),z.children?.push(O)}),b[T]=[z]});const P=()=>{const T=b[j.value?.data.type||""];T&&W.value?(W.value.init&&W.value.init(T,j.value?.data),o.flowComponentConfigInit&&o.flowComponentConfigInit({configRef:W,inputParams:o.inputParams,components:m.value,configData:j.value?.data})):W.value&&W.value.init&&W.value.init([])},v=(T,z)=>{j.value&&o.flowComponentConfigChange&&o.flowComponentConfigChange(j.value.data.type,{configRef:W,component:T,configData:j.value.data,...z,isFlowNode:!0})};return(0,r.provide)("d_flow_design_provide",{getFlowComponents:K,addNode:G,addNodeByLine:q,onRemoveNode:F,getFlowComponentMap:S}),e({getData:()=>{const T=[];return m.value.forEach(z=>{T.push({config:z.data,id:z.id,position:z.position,type:z.type})}),E.value.forEach(z=>{T.push({id:z.id,source:z.source,target:z.target,sourceHandle:z.sourceHandle,targetHandle:z.targetHandle,type:"line",config:{},position:{x:0,y:0}})}),T},setData:T=>{if(!T||T.length===0)D.data.isInit=!0,B.value=[D],k(D.id);else{D.data.isInit=!1;const z=[],O=[];T.forEach(L=>{if(L.type==="line")L.type="button",L.markerEnd=Ge.Arrow,O.push(L);else{const ee={id:L.id,type:L.type,data:L.config,position:L.position};z.push(ee)}}),B.value=z,w.value=O}}}),(T,z)=>{const O=(0,r.resolveComponent)("j-icon"),L=(0,r.resolveComponent)("j-form");return(0,r.openBlock)(),(0,r.createElementBlock)("div",Vf,[(0,r.createElementVNode)("div",Hf,[(0,r.createVNode)(Of,{nodes:B.value,edges:w.value},null,8,["nodes","edges"])]),(0,r.withDirectives)((0,r.createElementVNode)("div",Lf,[(0,r.createElementVNode)("div",Ff,[(0,r.createElementVNode)("div",{class:"d-flow-design-title-icon",style:(0,r.normalizeStyle)({backgroundColor:Z.value?.iconColor||"var(--j-color-primary)"})},[(0,r.createVNode)(O,{icon:Z.value?.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,r.createElementVNode)("div",Gf,(0,r.toDisplayString)(Z.value?.name||""),1)]),(0,r.createElementVNode)("div",Wf,[(0,r.createVNode)(L,{config:{labelPosition:"top"},style:{padding:"0"},ref_key:"configRef",ref:W,onChange:v},null,512)])],512),[[r.vShow,j.value&&b[j.value.data.type]]])])}}}),Yf=Uf,Cr=qe(Yf),Xf={class:"d-input-flow j-block"},jf=(0,r.defineComponent)({name:"DInputFlow",__name:"inputFlow",props:{modelValue:{},type:{},btnText:{default:"事件"},title:{},size:{default:"default"},width:{default:1200},height:{default:800},beforeClose:{},flowComponents:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["update:modelValue","change"],setup(t,{emit:e}){const n=t,o=e,i=(0,r.ref)(),s=(0,r.computed)({get(){return n.modelValue},set(h){o("update:modelValue",h)}}),a=(0,r.computed)(()=>(n.modelValue?.trim(),n.btnText)),l=h=>{const f=typeof h=="string"?h:void 0;try{i.value?.setData(JSON.parse(f||"[]"))}catch{i.value?.setData([])}},d=async()=>{const h=i.value?.getData();return h?JSON.stringify(h):void 0},c=h=>{if(n.beforeClose){const f=typeof h=="string"?h:void 0;return n.beforeClose(f)}return!0},u=h=>{const f=h.value;o("change",{value:typeof f=="string"?f:void 0})};return(h,f)=>{const g=(0,r.resolveComponent)("d-flow-design"),m=(0,r.resolveComponent)("j-input-button");return(0,r.openBlock)(),(0,r.createBlock)(m,(0,r.mergeProps)(h.$attrs,{type:t.type,"btn-text":a.value,title:t.title,size:t.size,width:t.width,height:t.height,"before-close":c,ok:d,open:l,"destroy-on-close":"",modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=E=>s.value=E),onChange:u}),{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",Xf,[(0,r.createVNode)(g,{ref_key:"flowRef",ref:i,components:t.flowComponents,"flow-init":t.flowInit,"flow-component-config-init":t.flowComponentConfigInit,"flow-component-configs":t.flowComponentConfigs,"flow-component-config-change":t.flowComponentConfigChange,"input-params":t.inputParams},null,8,["components","flow-init","flow-component-config-init","flow-component-configs","flow-component-config-change","input-params"])])]),_:1},16,["type","btn-text","title","size","width","height","modelValue"])}}}),Zf=jf,Er=qe(Zf),$=class De{static getElements(e,n=document){if(typeof e=="string"){const o="getElementById"in n?n:void 0;if(o&&!isNaN(+e[0])){const s=o.getElementById(e);return s?[s]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const s=n.querySelector(`[gs-id="${e}"]`);return s?[s]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const o="getElementById"in n?n:void 0;if(!e.length)return null;if(o&&e[0]==="#")return o.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(o&&!isNaN(+e[0]))return o.getElementById(e);let i=n.querySelector(e);return o&&!i&&(i=o.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,n){const o=document.createElement("div");return e.forEach(i=>{i&&o.classList.add(i)}),n?.appendChild(o),o}static shouldSizeToContent(e,n=!1){return e?.grid&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return De.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const o=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=o)return 0;const s=e.y>n.y?e.y:n.y,a=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return a<=s?0:(i-o)*(a-s)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,s)=>{const a=n*((i.y??1e4)-(s.y??1e4));return a===0?n*((i.x??1e4)-(s.x??1e4)):a})}static find(e,n){return n?e.find(o=>o.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,o="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);o=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:o}}static defaults(e,...n){return n.forEach(o=>{for(const i in o){if(!o.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=o[i]:typeof o[i]=="object"&&typeof e[i]=="object"&&De.defaults(e[i],o[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const o in e)if(e[o]!==n[o])return!1;return!0}static copyPos(e,n,o=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),o&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let o in e){const i=e[o],s=n[o];o[0]==="_"||i===s?delete e[o]:i&&typeof i=="object"&&s!==void 0&&(De.removeInternalAndSame(i,s),Object.keys(i).length||delete e[o])}}static removeInternalForSave(e,n=!0){for(let o in e)(o[0]==="_"||e[o]===null||e[o]===void 0)&&delete e[o];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let o=!1;return(...i)=>{o||(o=!0,setTimeout(()=>{e(...i),o=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e);return/(auto|scroll)/.test(n.overflow+n.overflowY)?e:De.getScrollElement(e.parentElement)}static updateScrollPosition(e,n,o){const i=De.getScrollElement(e);if(!i)return;const s=e.getBoundingClientRect(),a=i.getBoundingClientRect(),l=window.innerHeight||document.documentElement.clientHeight,d=s.bottom-Math.min(a.bottom,l),c=s.top-Math.max(a.top,0),u=i.scrollTop;c<0&&o<0?e.offsetHeight>a.height?i.scrollTop+=o:i.scrollTop+=Math.abs(c)>Math.abs(o)?o:c:d>0&&o>0&&(e.offsetHeight>a.height?i.scrollTop+=o:i.scrollTop+=d>o?o:d),n.top+=i.scrollTop-u}static updateScrollResize(e,n,o){const i=De.getScrollElement(n),s=i.clientHeight,a=i===De.getScrollElement()?0:i.getBoundingClientRect().top,l=e.clientY-a,d=l<o,c=l>s-o;d?i.scrollBy({behavior:"smooth",top:l-o}):c&&i.scrollBy({behavior:"smooth",top:o-(s-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],o=De.clone(e);for(const i in o)o.hasOwnProperty(i)&&typeof o[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(s=>s===i)&&(o[i]=De.cloneDeep(e[i]));return o}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let o;typeof n=="string"?o=De.getElement(n):o=n,o&&o.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const o in n)n.hasOwnProperty(o)&&(Array.isArray(n[o])?n[o].forEach(i=>{e.style[o]=i}):e.style[o]=n[o])}static initEvent(e,n){const o={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>o[s]=e[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>o[s]=e[s]),{...o,...i}}static simulateMouseEvent(e,n,o){const i=e,s=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(o||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const n=document.createElement("div");De.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const o=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/o.width,yScale:1/o.height,xOffset:o.left,yOffset:o.top}}static swap(e,n,o){if(!e)return;const i=e[n];e[n]=e[o],e[o]=i}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}},_o=class vt{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,o,i={}){if(this.sortNodes(-1),o=o||this.collide(e,n),!o)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,o))return!0;let s=n;!this._loading&&this._useEntireRowArea(e,n)&&(s={x:0,w:this.column,y:n.y,h:n.h},o=this.collide(e,s,i.skip));let a=!1;const l={nested:!0,pack:!1};let d=0;for(;o=o||this.collide(e,s,i.skip);){if(d++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(o.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(o,{...o,y:e.y},e)||!this.collide(o,{...o,y:n.y-o.h},e))){e._skipDown=e._skipDown||n.y>e.y;const u={...n,y:o.y+o.h,...l};c=this._loading&&$.samePos(e,u)?!0:this.moveNode(e,u),(o.locked||this._loading)&&c?$.copyPos(n,e):!o.locked&&c&&i.pack&&(this._packNodes(),n.y=o.y+o.h,$.copyPos(e,n)),a=a||c}else c=this.moveNode(o,{...o,y:n.y+n.h,skip:e,...l});if(!c)return a;o=void 0}return a}collide(e,n=e,o){const i=e._id,s=o?._id;return this.nodes.find(a=>a._id!==i&&a._id!==s&&$.isIntercepted(a,n))}collideAll(e,n=e,o){const i=e._id,s=o?._id;return this.nodes.filter(a=>a._id!==i&&a._id!==s&&$.isIntercepted(a,n))}directionCollideCoverage(e,n,o){if(!n.rect||!e._rect)return;const i=e._rect,s={...n.rect};s.y>i.y?(s.h+=s.y-i.y,s.y=i.y):s.h+=i.y-s.y,s.x>i.x?(s.w+=s.x-i.x,s.x=i.x):s.w+=i.x-s.x;let a,l=.5;for(let d of o){if(d.locked||!d._rect)break;const c=d._rect;let u=Number.MAX_VALUE,h=Number.MAX_VALUE;i.y<c.y?u=(s.y+s.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(u=(c.y+c.h-s.y)/c.h),i.x<c.x?h=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(h=(c.x+c.w-s.x)/c.w);const f=Math.min(h,u);f>l&&(l=f,a=d)}return n.collide=a,a}cacheRects(e,n,o,i,s,a){return this.nodes.forEach(l=>l._rect={y:l.y*n+o,x:l.x*e+a,w:l.w*e-a-i,h:l.h*n-o-s}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function o(){const s=n.x,a=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=s,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=a):(e.x=s,e.y=a),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=$.isTouching(e,n)))return o();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=$.isTouching(e,n)))){if(n.y<e.y){const s=e;e=n,n=s}return o()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=$.isTouching(e,n)))){if(n.x<e.x){const s=e;e=n,n=s}return o()}return!1}}}isAreaEmpty(e,n,o,i){const s={x:e||0,y:n||0,w:o||1,h:i||1};return!this.collide(s)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const o=this.batchMode;o||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const s=this.nodes;return this.nodes=[],s.forEach((a,l,d)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=d[l-1])),this.addNode(a,!1,c)}),i||delete this._inColumnResize,o||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=$.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const o=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:o,w:e.w,h:e.h})))break;e._dirty=e.y!==o,e.y=o}}),this)}prepareNode(e,n){e._id=e._id??vt._idSeq++;const o=e.id;if(o){let s=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=o+"_"+s++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return $.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,$.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const o=e._orig||$.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const i={...e};i.autoPosition||i.x===void 0?(delete i.x,delete i.y):i.x=Math.min(this.defaultColumn-1,i.x),i.w=Math.min(this.defaultColumn,i.w||1),this.cacheOneLayout(i,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),$.samePos(e,o)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!$.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=$.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||$.samePos(e,e._orig)||($.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,o=this.column,i){const s=i?i.y*o+(i.x+i.w):0;let a=!1;for(let l=s;!a;++l){const d=l%o,c=Math.floor(l/o);if(d+e.w>o)continue;const u={x:d,y:c,w:e.w,h:e.h};n.find(h=>$.isIntercepted(u,h))||((e.x!==d||e.y!==c)&&(e._dirty=!0),e.x=d,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,n=!1,o){const i=this.nodes.find(a=>a._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let s;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,o)&&(delete e.autoPosition,s=!0),this.nodes.push(e),n&&this.addedNodes.push(e),s||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,o=!1){return this.nodes.find(i=>i._id===e._id)?(o&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const o=this.nodes;return this.removedNodes=n?o:[],this.nodes=[],this._notify(o)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let o;const i=new vt({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(o={...a},o):{...a})});if(!o)return!1;const s=i.moveNode(o,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!s&&!n.resizing&&n.collide){const a=n.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return s?(i.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(d=>d._id===a._id);l&&($.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new vt({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),o={...e};return this.cleanupNode(o),delete o.el,delete o._id,delete o.content,delete o.grid,n.addNode(o),n.getRow()<=this.maxRow?(e._willFitPos=$.copyPos({},o),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){if(!e||!n)return!1;let o;n.pack===void 0&&!this.batchMode&&(o=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,s=$.copyPos({},e,!0);if($.copyPos(s,n),this.nodeBoundFix(s,i),$.copyPos(n,s),!n.forceCollide&&$.samePos(e,n))return!1;const a=$.copyPos({},e),l=this.collideAll(e,s,n.skip);let d=!0;if(l.length){const c=e._moving&&!n.nested;let u=c?this.directionCollideCoverage(e,n,l):l[0];if(c&&u&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const h=$.areaIntercept(n.rect,u._rect),f=$.area(n.rect),g=$.area(u._rect);h/(f<g?f:g)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?d=!this._fixCollisions(e,s,u,n):(d=!1,o&&delete n.pack)}return d&&!$.samePos(e,s)&&(e._dirty=!0,$.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!$.samePos(e,a)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,o){const i=this._layouts?.length||0;let s;i&&(o?o!==this.column&&(s=this._layouts[o]):this.column!==i-1&&(s=this._layouts[i-1]));const a=[];return this.sortNodes(),this.nodes.forEach(l=>{const d=s?.find(u=>u._id===l._id),c={...l,...d||{}};$.removeInternalForSave(c,!e),n&&n(l,c),a.push(c)}),a}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,o)=>{if(!n||o===this.column)return this;if(o<this.column)this._layouts[o]=void 0;else{const i=o/this.column;e.forEach(s=>{if(!s._orig)return;const a=n.find(l=>l._id===s._id);a&&(a.y>=0&&s.y!==s._orig.y&&(a.y+=s.y-s._orig.y,a.y<0&&(a.y=0)),s.x!==s._orig.x&&(a.x=Math.round(s.x*i),a.x<0&&(a.x=0)),s.w!==s._orig.w&&(a.w=Math.round(s.w*i),a.w<1&&(a.w=1)))})}}),this)}columnChanged(e,n,o="moveScale"){if(!this.nodes.length||!n||e===n)return this;const i=o==="compact"||o==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let s=[],a=i?this.nodes:$.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],d=this._layouts.length-1;!l.length&&e!==d&&this._layouts[d]?.length&&(e=d,this._layouts[d].forEach(c=>{const u=a.find(h=>h._id===c._id);u&&(!i&&!c.autoPosition&&(u.x=c.x??u.x,u.y=c.y??u.y),u.w=c.w??u.w,(c.x==null||c.y===void 0)&&(u.autoPosition=!0))})),l.forEach(c=>{const u=a.findIndex(h=>h._id===c._id);if(u!==-1){const h=a[u];if(i){h.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,s),c.autoPosition||(h.x=c.x??h.x,h.y=c.y??h.y,h.w=c.w??h.w,s.push(h)),a.splice(u,1)}})}if(i)this.compact(o,!1);else{if(a.length)if(typeof o=="function")o(n,e,s,a);else{const l=i||o==="none"?1:n/e,d=o==="move"||o==="moveScale",c=o==="scale"||o==="moveScale";a.forEach(u=>{u.x=n===1?0:d?Math.round(u.x*l):Math.min(u.x,n-1),u.w=n===1||e===1?1:c?Math.round(u.w*l)||1:Math.min(u.w,n),s.push(u)}),a=[]}s=$.sort(s,-1),this._inColumnResize=!0,this.nodes=[],s.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,o=!1){const i=[];return e.forEach((s,a)=>{s._id===void 0&&(s._id=(s.id?this.nodes.find(l=>l.id===s.id):void 0)?._id??vt._idSeq++),i[a]={x:s.x,y:s.y,w:s.w,_id:s._id}}),this._layouts=o?[]:this._layouts||[],this._layouts[n]=i,this}cacheOneLayout(e,n){e._id=e._id??vt._idSeq++;const o={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete o.x,delete o.y,e.autoPosition&&(o.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[n]=this._layouts[n]||[];const i=this.findCacheLayout(e,n);return i===-1?this._layouts[n].push(o):this._layouts[n][i]=o,this}findCacheLayout(e,n){return this._layouts?.[n]?.findIndex(o=>o._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let n=0;n<this._layouts.length;n++){const o=this.findCacheLayout(e,n);o!==-1&&this._layouts[n].splice(o,1)}}cleanupNode(e){for(const n in e)n[0]==="_"&&n!=="_id"&&delete e[n];return this}};_o._idSeq=0;var ke={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"},de=class{},Be=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),Se=class{};function Cn(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),$.simulateMouseEvent(t.changedTouches[0],e))}function xr(t,e){t.cancelable&&t.preventDefault(),$.simulateMouseEvent(t,e)}function En(t){Se.touchHandled||(Se.touchHandled=!0,Cn(t,"mousedown"))}function xn(t){Se.touchHandled&&Cn(t,"mousemove")}function Nn(t){if(!Se.touchHandled)return;Se.pointerLeaveTimeout&&(window.clearTimeout(Se.pointerLeaveTimeout),delete Se.pointerLeaveTimeout);const e=!!de.dragElement;Cn(t,"mouseup"),e||Cn(t,"click"),Se.touchHandled=!1}function kn(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function Nr(t){de.dragElement&&t.pointerType!=="mouse"&&xr(t,"mouseenter")}function kr(t){de.dragElement&&t.pointerType!=="mouse"&&(Se.pointerLeaveTimeout=window.setTimeout(()=>{delete Se.pointerLeaveTimeout,xr(t,"mouseleave")},10))}var Sr=class Fr{constructor(e,n,o){this.host=e,this.dir=n,this.option=o,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${Fr.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),Be&&(this.el.addEventListener("touchstart",En),this.el.addEventListener("pointerdown",kn)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Be&&(this.el.removeEventListener("touchstart",En),this.el.removeEventListener("pointerdown",kn)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Be&&(this.el.addEventListener("touchmove",xn),this.el.addEventListener("touchend",Nn)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const n=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Be&&(this.el.removeEventListener("touchmove",xn),this.el.removeEventListener("touchend",Nn)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,n){return this.option[e]&&this.option[e](n),this}};Sr.prefix="ui-resizable-";var wo=class{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,e){this._eventRegister[t]=e}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,e){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](e)}},Dr=class Co extends wo{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},s=this.temporalRect||i;return{position:{left:(s.left-o.left)*this.rectScale.x,top:(s.top-o.top)*this.rectScale.y},size:{width:s.width*this.rectScale.x,height:s.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const n=e.handles&&e.handles!==this.option.handles,o=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(i=>this.option[i]=e[i]),n&&(this._removeHandlers(),this._setupHandlers()),o&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),de.overResizeElement===this&&delete de.overResizeElement),this}_mouseOver(e){de.overResizeElement||de.dragElement||(de.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){de.overResizeElement===this&&(delete de.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Sr(this.el,e,{element:this.option.element,start:n=>this._resizeStart(n),stop:n=>this._resizeStop(n),move:n=>this._resizing(n,e)})),this}_resizeStart(e){this.sizeToContent=$.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=$.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=$.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(n,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",n),this}_resizing(e,n){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,n),this._applyChange();const o=$.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(o,this._ui()),this.triggerEvent("resize",o),this}_resizeStop(e){const n=$.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(n),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",n),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=Co._originStyleProp.map(o=>this.el.style[o]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=$.getValuesFromTransformedElement(e);return this.rectScale={x:n.xScale,y:n.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return Co._originStyleProp.forEach((e,n)=>{this.el.style[e]=this.elOriginStyleVal[n]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,n){const o=this.startEvent,i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},s=e.clientX-o.clientX,a=this.sizeToContent?0:e.clientY-o.clientY;let l,d;n.indexOf("e")>-1?i.width+=s:n.indexOf("w")>-1&&(i.width-=s,i.left+=s,l=!0),n.indexOf("s")>-1?i.height+=a:n.indexOf("n")>-1&&(i.height-=a,i.top+=a,d=!0);const c=this._constrainSize(i.width,i.height,l,d);return Math.round(i.width)!==Math.round(c.width)&&(n.indexOf("w")>-1&&(i.left+=i.width-c.width),i.width=c.width),Math.round(i.height)!==Math.round(c.height)&&(n.indexOf("n")>-1&&(i.top+=i.height-c.height),i.height=c.height),i}_constrainSize(e,n,o,i){const s=this.option,a=(o?s.maxWidthMoveLeft:s.maxWidth)||Number.MAX_SAFE_INTEGER,l=s.minWidth/this.rectScale.x||e,d=(i?s.maxHeightMoveUp:s.maxHeight)||Number.MAX_SAFE_INTEGER,c=s.minHeight/this.rectScale.y||n;return{width:Math.min(a,Math.max(l,e)),height:Math.min(d,Math.max(c,n))}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const{left:n,top:o}=this.el.parentElement.getBoundingClientRect();e={left:n,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(n=>{const o=this.temporalRect[n],i=n==="width"||n==="left"?this.rectScale.x:n==="height"||n==="top"?this.rectScale.y:1;this.el.style[n]=(o-e[n])*i+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}};Dr._originStyleProp=["width","height","position","left","top","opacity","zIndex"];var Kf='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle',Tr=class Eo extends wo{constructor(e,n={}){super(),this.el=e,this.option=n,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const o=n?.handle?.substring(1),i=e.gridstackNode;this.dragEls=!o||e.classList.contains(o)?[e]:i?.subGrid?[e.querySelector(n.handle)||e]:Array.from(e.querySelectorAll(n.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),Be&&(e.addEventListener("touchstart",En),e.addEventListener("pointerdown",kn))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),Be&&(n.removeEventListener("touchstart",En),n.removeEventListener("pointerdown",kn))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this}_mouseDown(e){if(Se.touchHandled&&e.isTrusted&&(Se.touchHandled=!1),!de.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(Kf)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete de.dragElement,delete de.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Be&&(e.currentTarget.addEventListener("touchmove",xn),e.currentTarget.addEventListener("touchend",Nn)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),de.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=$.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(n,this.ui()),this.triggerEvent("drag",n)}_mouseMove(e){const n=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),de.pauseDrag){const o=Number.isInteger(de.pauseDrag)?de.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),o)}else this._callDrag(e);else if(Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>3){this.dragging=!0,de.dragElement=this;const o=this.el.gridstackNode?.grid;o?de.dropElement=o.el.ddElement.ddDroppable:delete de.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=$.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const i=$.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(i,this.ui()),this.triggerEvent("dragstart",i),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Be&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",xn,!0),e.currentTarget.removeEventListener("touchend",Nn,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),de.dropElement?.el===this.el.parentElement&&delete de.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const n=$.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(n),this.triggerEvent("dragstop",n),de.dropElement&&de.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete de.dragElement,delete de.dropElement,delete de.mouseHandled,e.preventDefault()}_keyEvent(e){const n=this.el.gridstackNode,o=n?.grid||de.dropElement?.el?.gridstack;if(e.key==="Escape")n&&n._origRotate&&(n._orig=n._origRotate,delete n._origRotate),o?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(n&&o&&(e.key==="r"||e.key==="R")){if(!$.canBeRotated(n))return;n._origRotate=n._origRotate||{...n._orig},delete n._moving,o.setAnimation(!1).rotate(n.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),n._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,n.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",$.swap(n._orig,"w","h"),delete n._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=$.cloneNode(this.el)),e.parentElement||$.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Eo.originStyleProp.map(n=>this.el.style[n]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const n=this.helper.style;return n.pointerEvents="none",n.width=this.dragOffset.width+"px",n.height=this.dragOffset.height+"px",n.willChange="left, top",n.position="fixed",this._dragFollow(e),n.transition="none",setTimeout(()=>{this.helper&&(n.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const e=this.helper,n=this.dragElementOriginStyle.transition||null;e.style.transition=this.dragElementOriginStyle.transition="none",Eo.originStyleProp.forEach(o=>e.style[o]=this.dragElementOriginStyle[o]||null),setTimeout(()=>e.style.transition=n,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const n={left:0,top:0},o=this.helper.style,i=this.dragOffset;o.left=(e.clientX+i.offsetLeft-n.left)*this.dragTransform.xScale+"px",o.top=(e.clientY+i.offsetTop-n.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,n,o){let i=0,s=0;o&&(i=this.dragTransform.xOffset,s=this.dragTransform.yOffset);const a=n.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-i,offsetTop:-e.clientY+a.top-s,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const e=this.el.parentElement.getBoundingClientRect(),n=this.helper.getBoundingClientRect();return{position:{top:(n.top-e.top)*this.dragTransform.yScale,left:(n.left-e.left)*this.dragTransform.xScale}}}};Tr.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];var qf=class extends wo{constructor(t,e={}){super(),this.el=t,this.option=e,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,e){super.on(t,e)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Be&&(this.el.addEventListener("pointerenter",Nr),this.el.addEventListener("pointerleave",kr)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Be&&(this.el.removeEventListener("pointerenter",Nr),this.el.removeEventListener("pointerleave",kr)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(e=>this.option[e]=t[e]),this._setupAccept(),this}_mouseEnter(t){if(!de.dragElement||Se.touchHandled&&t.isTrusted||!this._canDrop(de.dragElement.el))return;t.preventDefault(),t.stopPropagation(),de.dropElement&&de.dropElement!==this&&de.dropElement._mouseLeave(t,!0),de.dropElement=this;const e=$.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(e,this._ui(de.dragElement)),this.triggerEvent("dropover",e),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,e=!1){if(!de.dragElement||de.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const n=$.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(n,this._ui(de.dragElement)),this.triggerEvent("dropout",n),de.dropElement===this&&(delete de.dropElement,!e)){let o,i=this.el.parentElement;for(;!o&&i;)o=i.ddElement?.ddDroppable,i=i.parentElement;o&&o._mouseEnter(t)}}drop(t){t.preventDefault();const e=$.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(e,this._ui(de.dragElement)),this.triggerEvent("drop",e)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}},Jf=class Gr{static init(e){return e.ddElement||(e.ddElement=new Gr(e)),e.ddElement}constructor(e){this.el=e}on(e,n){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,n):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,n):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,n),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Tr(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new Dr(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new qf(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}},Qf=class{resizable(t,e,n,o){return this._getDDElements(t,e).forEach(i=>{if(e==="disable"||e==="enable")i.ddResizable&&i.ddResizable[e]();else if(e==="destroy")i.ddResizable&&i.cleanResizable();else if(e==="option")i.setupResizable({[n]:o});else{const s=i.el.gridstackNode.grid;let a=i.el.getAttribute("gs-resize-handles")||s.opts.resizable.handles||"e,s,se";a==="all"&&(a="n,e,s,w,se,sw,ne,nw");const l=!s.opts.alwaysShowResizeHandle;i.setupResizable({...s.opts.resizable,handles:a,autoHide:l,start:e.start,stop:e.stop,resize:e.resize})}}),this}draggable(t,e,n,o){return this._getDDElements(t,e).forEach(i=>{if(e==="disable"||e==="enable")i.ddDraggable&&i.ddDraggable[e]();else if(e==="destroy")i.ddDraggable&&i.cleanDraggable();else if(e==="option")i.setupDraggable({[n]:o});else{const s=i.el.gridstackNode.grid;i.setupDraggable({...s.opts.draggable,start:e.start,stop:e.stop,drag:e.drag})}}),this}dragIn(t,e){return this._getDDElements(t).forEach(n=>n.setupDraggable(e)),this}droppable(t,e,n,o){return typeof e.accept=="function"&&!e._accept&&(e._accept=e.accept,e.accept=i=>e._accept(i)),this._getDDElements(t,e).forEach(i=>{e==="disable"||e==="enable"?i.ddDroppable&&i.ddDroppable[e]():e==="destroy"?i.ddDroppable&&i.cleanDroppable():e==="option"?i.setupDroppable({[n]:o}):i.setupDroppable(e)}),this}isDroppable(t){return!!(t?.ddElement?.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){return!!(t?.ddElement?.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){return!!(t?.ddElement?.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,e,n){return this._getDDElements(t).forEach(o=>o.on(e,i=>{n(i,de.dragElement?de.dragElement.el:i.target,de.dragElement?de.dragElement.helper:null)})),this}off(t,e){return this._getDDElements(t).forEach(n=>n.off(e)),this}_getDDElements(t,e){const n=t.gridstack||e!=="destroy"&&e!=="disable",o=$.getElements(t);return o.length?o.map(i=>i.ddElement||(n?Jf.init(i):null)).filter(i=>i):[]}},Ce=new Qf,mt=class ce{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const o=ce.getGridElement(n);return o?(o.gridstack||(o.gridstack=new ce(o,$.cloneDeep(e))),o.gridstack):(console.error(typeof n=="string"?'GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
27
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},n=".grid-stack"){const o=[];return typeof document>"u"||(ce.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new ce(i,$.cloneDeep(e))),o.push(i.gridstack)}),o.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
28
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),o}static addGrid(e,n={}){if(!e)return null;let o=e;if(o.gridstack){const i=o.gridstack;return n&&(i.opts={...i.opts,...n}),n.children!==void 0&&i.load(n.children),i}return(!e.classList.contains("grid-stack")||ce.addRemoveCB)&&(ce.addRemoveCB?o=ce.addRemoveCB(e,n,!0,!0):o=$.createDiv(["grid-stack",n.class],e)),ce.init(n,o)}static registerEngine(e){ce.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=$.createDiv([this.opts.placeholderClass,ke.itemClass,this.opts.itemClass]);const e=$.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,n={}){this.el=e,this.opts=n,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=n=n||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),n.row&&(n.minRow=n.maxRow=n.row,delete n.row);const o=$.toNumber(e.getAttribute("gs-row"));n.column==="auto"&&delete n.column,n.alwaysShowResizeHandle!==void 0&&(n._alwaysShowResizeHandle=n.alwaysShowResizeHandle);const i=n.columnOpts;if(i){const d=i.breakpoints;!i.columnWidth&&!d?.length?delete n.columnOpts:(i.columnMax=i.columnMax||12,d?.length>1&&d.sort((c,u)=>(u.w||0)-(c.w||0)))}const s={...$.cloneDeep(ke),column:$.toNumber(e.getAttribute("gs-column"))||ke.column,minRow:o||$.toNumber(e.getAttribute("gs-min-row"))||ke.minRow,maxRow:o||$.toNumber(e.getAttribute("gs-max-row"))||ke.maxRow,staticGrid:$.toBool(e.getAttribute("gs-static"))||ke.staticGrid,sizeToContent:$.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||ke.draggable.handle},removableOptions:{accept:n.itemClass||ke.removableOptions.accept,decline:ke.removableOptions.decline}};e.getAttribute("gs-animate")&&(s.animate=$.toBool(e.getAttribute("gs-animate"))),n=$.defaults(n,s),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(n),n.rtl==="auto"&&(n.rtl=e.style.direction==="rtl"),n.rtl&&this.el.classList.add("grid-stack-rtl");const a=this.el.closest("."+ke.itemClass)?.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=n.cellHeight==="auto",this._isAutoCellHeight||n.cellHeight==="initial")this.cellHeight(void 0);else{typeof n.cellHeight=="number"&&n.cellHeightUnit&&n.cellHeightUnit!==ke.cellHeightUnit&&(n.cellHeight=n.cellHeight+n.cellHeightUnit,delete n.cellHeightUnit);const d=n.cellHeight;delete n.cellHeight,this.cellHeight(d)}n.alwaysShowResizeHandle==="mobile"&&(n.alwaysShowResizeHandle=Be),this._setStaticClass();const l=n.engineClass||ce.engineClass||_o;if(this.engine=new l({column:this.getColumn(),float:n.float,maxRow:n.maxRow,onChange:d=>{d.forEach(c=>{const u=c.el;u&&(c._removeDOM?(u&&u.remove(),delete c._removeDOM):this._writePosAttr(u,c))}),this._updateContainerHeight()}}),n.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(d=>this._prepareElement(d)),delete this.engine._loading,this.batchUpdate(!1)),n.children){const d=n.children;delete n.children,d.length&&this.load(d)}this.setAnimation(),n.subGridDynamic&&!de.pauseDrag&&(de.pauseDrag=!0),n.draggable?.pause!==void 0&&(de.pauseDrag=n.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let n,o=e;if(o.grid=this,o.el?n=o.el:ce.addRemoveCB?n=ce.addRemoveCB(this.el,e,!0,!1):n=this.createWidgetDivs(o),!n)return;if(o=n.gridstackNode,o&&n.parentElement===this.el&&this.engine.nodes.find(s=>s._id===o._id))return n;const i=this._readAttr(n);return $.defaults(e,i),this.engine.prepareNode(e),this.el.appendChild(n),this.makeWidget(n,e),n}createWidgetDivs(e){const n=$.createDiv(["grid-stack-item",this.opts.itemClass]),o=$.createDiv(["grid-stack-item-content"],n);return $.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([i])=>{i.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,ce.renderCB(o,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(n))):ce.renderCB(o,e),n}makeSubGrid(e,n,o,i=!0){let s=e.gridstackNode;if(s||(s=this.makeWidget(e).gridstackNode),s.subGrid?.el)return s.subGrid;let a,l=this;for(;l&&!a;)a=l.opts?.subGridOpts,l=l.parentGridNode?.grid;n=$.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...n||s.subGridOpts||{}}),s.subGridOpts=n;let d;n.column==="auto"&&(d=!0,n.column=Math.max(s.w||1,o?.w||1),delete n.columnOpts);let c=s.el.querySelector(".grid-stack-item-content"),u,h;if(i&&(this._removeDD(s.el),h={...s,x:0,y:0},$.removeInternalForSave(h),delete h.subGridOpts,s.content&&(h.content=s.content,delete s.content),ce.addRemoveCB?u=ce.addRemoveCB(this.el,h,!0,!1):(u=$.createDiv(["grid-stack-item"]),u.appendChild(c),c=$.createDiv(["grid-stack-item-content"],s.el)),this.prepareDragDrop(s.el)),o){const g=d?n.column:s.w,m=s.h+o.h,E=s.el.style;E.transition="none",this.update(s.el,{w:g,h:m}),setTimeout(()=>E.transition=null)}const f=s.subGrid=ce.addGrid(c,n);return o?._moving&&(f._isTemp=!0),d&&(f._autoColumn=!0),i&&f.makeWidget(u,h),o&&(o._moving?window.setTimeout(()=>$.simulateMouseEvent(o._event,"mouseenter",f.el),0):f.makeWidget(s.el,s)),this.resizeToContentCheck(!1,s),f}removeAsSubGrid(e){const n=this.parentGridNode?.grid;n&&(n.batchUpdate(),n.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,n.makeWidget(o.el,o)}),n.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>$.simulateMouseEvent(e._event,"mouseenter",n.el),0))}save(e=!0,n=!1,o=ce.saveCB,i){const s=this.engine.save(e,o,i);if(s.forEach(a=>{if(e&&a.el&&!a.subGrid&&!o)a.content=a.el.querySelector(".grid-stack-item-content")?.innerHTML,a.content||delete a.content;else if(!e&&!o&&delete a.content,a.subGrid?.el){const l=a.w||a.subGrid.getColumn(),d=a.subGrid.save(e,n,o,l);a.subGridOpts=n?d:{children:d},delete a.subGrid}delete a.el}),n){const a=$.cloneDeep(this.opts);a.marginBottom===a.marginTop&&a.marginRight===a.marginLeft&&a.marginTop===a.marginRight&&(a.margin=a.marginTop,delete a.marginTop,delete a.marginRight,delete a.marginBottom,delete a.marginLeft),a.rtl===(this.el.style.direction==="rtl")&&(a.rtl="auto"),this._isAutoCellHeight&&(a.cellHeight="auto"),this._autoColumn&&(a.column="auto");const l=a._alwaysShowResizeHandle;return delete a._alwaysShowResizeHandle,l!==void 0?a.alwaysShowResizeHandle=l:delete a.alwaysShowResizeHandle,$.removeInternalAndSame(a,ke),a.children=s,a}return s}load(e,n=ce.addRemoveCB||!0){e=$.cloneDeep(e);const o=this.getColumn();e.forEach(u=>{u.w=u.w||u.minW||1,u.h=u.h||u.minH||1}),e=$.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let i=0;e.forEach(u=>{i=Math.max(i,(u.x||0)+u.w)}),i>this.engine.defaultColumn&&(this.engine.defaultColumn=i),i>o&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(i,o,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,i,!0));const s=ce.addRemoveCB;typeof n=="function"&&(ce.addRemoveCB=n);const a=[];this.batchUpdate();const l=!this.engine.nodes.length,d=l&&this.opts.animate;d&&this.setAnimation(!1),!l&&n&&[...this.engine.nodes].forEach(u=>{u.id&&($.find(e,u.id)||(ce.addRemoveCB&&ce.addRemoveCB(this.el,u,!1,!1),a.push(u),this.removeWidget(u.el,!0,!1)))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(u=>$.find(e,u.id)?(c.push(u),!1):!0),e.forEach(u=>{const h=$.find(c,u.id);if(h){if($.shouldSizeToContent(h)&&(u.h=h.h),this.engine.nodeBoundFix(u),(u.autoPosition||u.x===void 0||u.y===void 0)&&(u.w=u.w||h.w,u.h=u.h||h.h,this.engine.findEmptyPosition(u)),this.engine.nodes.push(h),$.samePos(h,u)&&this.engine.nodes.length>1&&(this.moveNode(h,{...u,forceCollide:!0}),$.copyPos(u,h)),this.update(h.el,u),u.subGridOpts?.children){const f=h.el.querySelector(".grid-stack");f&&f.gridstack&&f.gridstack.load(u.subGridOpts.children)}}else n&&this.addWidget(u)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,s?ce.addRemoveCB=s:delete ce.addRemoveCB,d&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const n=this.el.querySelector("."+this.opts.itemClass);if(n){const i=$.toNumber(n.getAttribute("gs-h"))||1;return Math.round(n.offsetHeight/i)}const o=parseInt(this.el.getAttribute("gs-current-row"));return o?Math.round(this.el.getBoundingClientRect().height/o):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+o}const n=$.parseHeight(e);return this.opts.cellHeightUnit===n.unit&&this.opts.cellHeight===n.h?this:(this.opts.cellHeightUnit=n.unit,this.opts.cellHeight=n.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const n=this.getColumn();let o=n;const i=this._widthOrContainer(!0);if(e.columnWidth)o=Math.min(Math.round(i/e.columnWidth)||1,e.columnMax);else{o=e.columnMax;let s=0;for(;s<e.breakpoints.length&&i<=e.breakpoints[s].w;)o=e.breakpoints[s++].c||n}if(o!==n){const s=e.breakpoints?.find(a=>a.c===o);return this.column(o,s?.layout||e.layout),!0}return!1}compact(e="compact",n=!0){return this.engine.compact(e,n),this._triggerChangeEvent(),this}column(e,n="moveScale"){if(!e||e<1||this.opts.column===e)return this;const o=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+o),this._updateColumnVar(),this.engine.columnChanged(o,e,n),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=n,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,n=!1){const o=this.el.getBoundingClientRect();let i;n?i={top:o.top+document.documentElement.scrollTop,left:o.left}:i={top:this.el.offsetTop,left:this.el.offsetLeft};const s=e.left-i.left,a=e.top-i.top,l=o.width/this.getColumn(),d=o.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(s/l),y:Math.floor(a/d)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,n,o,i){return this.engine.isAreaEmpty(e,n,o,i)}makeWidget(e,n){const o=ce.getElement(e);if(!o||o.gridstackNode)return o;o.parentElement||this.el.appendChild(o),this._prepareElement(o,!0,n);const i=o.gridstackNode;this._updateContainerHeight(),i.subGridOpts&&this.makeSubGrid(o,i.subGridOpts,void 0,!1);let s;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(s=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),s&&delete this._ignoreLayoutsNodeChange,o}on(e,n){return e.indexOf(" ")!==-1?(e.split(" ").forEach(o=>this.on(o,n)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=o=>n(o):this._gsEventHandler[e]=o=>{o.detail&&n(o,o.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=n:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(n=>this.off(n)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,n=!0,o=!0){return e?(ce.getElements(e).forEach(i=>{if(i.parentElement&&i.parentElement!==this.el)return;let s=i.gridstackNode;s||(s=this.engine.nodes.find(a=>i===a.el)),s&&(n&&ce.addRemoveCB&&ce.addRemoveCB(this.el,s,!1,!1),delete i.gridstackNode,this._removeDD(i),this.engine.removeNode(s,n,o),n&&i.parentElement&&i.remove())}),o&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,n=!0){return this.engine.nodes.forEach(o=>{e&&ce.addRemoveCB&&ce.addRemoveCB(this.el,o,!1,!1),delete o.el.gridstackNode,this.opts.staticGrid||this._removeDD(o.el)}),this.engine.removeAll(e,n),n&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,n){return n?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,n=!0,o=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&o&&i.subGrid.setStatic(e,n,o)}),n&&this._setStaticClass(),this)}updateOptions(e){const n=this.opts;return e===n?this:(e.acceptWidgets!==void 0&&(n.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==n.class&&(n.class&&this.el.classList.remove(n.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(n.minRow=n.maxRow=n.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(n.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(n.maxRow=e.maxRow)),e.lazyLoad!==void 0&&(n.lazyLoad=e.lazyLoad),e.children?.length&&this.load(e.children),this)}update(e,n){return ce.getElements(e).forEach(o=>{const i=o?.gridstackNode;if(!i)return;const s={...$.copyPos({},i),...$.cloneDeep(n)};this.engine.nodeBoundFix(s),delete s.autoPosition;const a=["x","y","w","h"];let l;if(a.some(u=>s[u]!==void 0&&s[u]!==i[u])&&(l={},a.forEach(u=>{l[u]=s[u]!==void 0?s[u]:i[u],delete s[u]})),!l&&(s.minW||s.minH||s.maxW||s.maxH)&&(l={}),s.content!==void 0){const u=o.querySelector(".grid-stack-item-content");u&&u.textContent!==s.content&&(i.content=s.content,ce.renderCB(u,s),i.subGrid?.el&&(u.appendChild(i.subGrid.el),i.subGrid._updateContainerHeight())),delete s.content}let d=!1,c=!1;for(const u in s)u[0]!=="_"&&i[u]!==s[u]&&(i[u]=s[u],d=!0,c=c||!this.opts.staticGrid&&(u==="noResize"||u==="noMove"||u==="locked"));if($.sanitizeMinMax(i),l){const u=l.w!==void 0&&l.w!==i.w;this.moveNode(i,l),u&&i.subGrid?i.subGrid.onResize(this.hasAnimationCSS()?i.w:void 0):this.resizeToContentCheck(u,i),delete i._orig}(l||d)&&this._writeAttr(o,i),c&&this.prepareDragDrop(i.el),ce.updateCB&&ce.updateCB(i)}),this}moveNode(e,n){const o=e._updating;o||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,n),this._updateContainerHeight(),o||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const n=e.gridstackNode;if(!n)return;const o=n.grid;if(!o||e.parentElement!==o.el)return;const i=o.getCellHeight(!0);if(!i)return;let s=n.h?n.h*i:e.clientHeight,a;if(n.resizeToContentParent&&(a=e.querySelector(n.resizeToContentParent)),a||(a=e.querySelector(ce.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,d=n.h?n.h*i-l:a.clientHeight;let c;if(n.subGrid){c=n.subGrid.getRow()*n.subGrid.getCellHeight(!0);const f=n.subGrid.el.getBoundingClientRect(),g=e.getBoundingClientRect();c+=f.top-g.top}else{if(n.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${n.id} '${ce.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||d}}if(d===c)return;s+=c-d;let u=Math.ceil(s/i);const h=Number.isInteger(n.sizeToContent)?n.sizeToContent:0;h&&u>h&&(u=h,e.classList.add("size-to-content-max")),n.minH&&u<n.minH?u=n.minH:n.maxH&&u>n.maxH&&(u=n.maxH),u!==n.h&&(o._ignoreLayoutsNodeChange=!0,o.moveNode(n,{h:u}),delete o._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){ce.resizeToContentCB?ce.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return ce.getElements(e).forEach(o=>{const i=o.gridstackNode;if(!$.canBeRotated(i))return;const s={w:i.h,h:i.w,minH:i.minW,minW:i.minH,maxH:i.maxW,maxW:i.maxH};if(n){const l=n.left>0?Math.floor(n.left/this.cellWidth()):0,d=n.top>0?Math.floor(n.top/this.opts.cellHeight):0;s.x=i.x+l-(i.h-(d+1)),s.y=i.y+d-l}Object.keys(s).forEach(l=>{s[l]===void 0&&delete s[l]});const a=i._orig;this.update(o,s),i._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const n=$.parseHeight(e);if(this.opts.marginUnit===n.unit&&this.opts.margin===n.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(n=>{delete n._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,n){const o=n?new CustomEvent(e,{bubbles:!1,detail:n}):new Event(e);let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;return i.el.dispatchEvent(o),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let n=this.getRow()+this._extraDragRow;const o=this.opts.cellHeight,i=this.opts.cellHeightUnit;if(!o)return this;if(!e&&!this.opts.minRow){const s=$.parseHeight(getComputedStyle(this.el).minHeight);if(s.h>0&&s.unit===i){const a=Math.floor(s.h/o);n<a&&(n=a)}}return this.el.setAttribute("gs-current-row",String(n)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),n&&(this.el.style[e?"minHeight":"height"]=n*o+i),e&&$.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,n=!1,o){o=o||this._readAttr(e),e.gridstackNode=o,o.el=e,o.grid=this,o=this.engine.addNode(o,n),this._writeAttr(e,o),e.classList.add(ke.itemClass,this.opts.itemClass);const i=$.shouldSizeToContent(o);return i?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),i&&this.resizeToContentCheck(!1,o),$.lazyLoad(o)||this.prepareDragDrop(o.el),this}_writePosAttr(e,n){return(!n._moving&&!n._resizing||this._placeholder===e)&&(e.style.top=n.y?n.y===1?"var(--gs-cell-height)":`calc(${n.y} * var(--gs-cell-height))`:null,e.style.left=n.x?n.x===1?"var(--gs-column-width)":`calc(${n.x} * var(--gs-column-width))`:null,e.style.width=n.w>1?`calc(${n.w} * var(--gs-column-width))`:null,e.style.height=n.h>1?`calc(${n.h} * var(--gs-cell-height))`:null),e.setAttribute("gs-x",String(n.x)),e.setAttribute("gs-y",String(n.y)),n.w>1?e.setAttribute("gs-w",String(n.w)):e.removeAttribute("gs-w"),n.h>1?e.setAttribute("gs-h",String(n.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,n){if(!n)return this;this._writePosAttr(e,n);const o={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const i in o)n[i]?e.setAttribute(o[i],String(n[i])):e.removeAttribute(o[i]);return this}_readAttr(e,n=!0){const o={};o.x=$.toNumber(e.getAttribute("gs-x")),o.y=$.toNumber(e.getAttribute("gs-y")),o.w=$.toNumber(e.getAttribute("gs-w")),o.h=$.toNumber(e.getAttribute("gs-h")),o.autoPosition=$.toBool(e.getAttribute("gs-auto-position")),o.noResize=$.toBool(e.getAttribute("gs-no-resize")),o.noMove=$.toBool(e.getAttribute("gs-no-move")),o.locked=$.toBool(e.getAttribute("gs-locked"));const i=e.getAttribute("gs-size-to-content");i&&(i==="true"||i==="false"?o.sizeToContent=$.toBool(i):o.sizeToContent=parseInt(i,10)),o.id=e.getAttribute("gs-id"),o.maxW=$.toNumber(e.getAttribute("gs-max-w")),o.minW=$.toNumber(e.getAttribute("gs-min-w")),o.maxH=$.toNumber(e.getAttribute("gs-max-h")),o.minH=$.toNumber(e.getAttribute("gs-min-h")),n&&(o.w===1&&e.removeAttribute("gs-w"),o.h===1&&e.removeAttribute("gs-h"),o.maxW&&e.removeAttribute("gs-max-w"),o.minW&&e.removeAttribute("gs-min-w"),o.maxH&&e.removeAttribute("gs-max-h"),o.minH&&e.removeAttribute("gs-min-h"));for(const s in o){if(!o.hasOwnProperty(s))return;!o[s]&&o[s]!==0&&s!=="sizeToContent"&&delete o[s]}return o}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let n=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),n=!0):n=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(n),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,n=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,n),this.animationDelay);if(n)$.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.el);else if(this.engine.nodes.some(o=>$.shouldSizeToContent(o))){const o=[...this.engine.nodes];this.batchUpdate(),o.forEach(i=>{$.shouldSizeToContent(i)&&this.resizeToContentCBCheck(i.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,n?[n]:this.engine.nodes)}}_updateResizeEvent(e=!1){const n=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(o=>o.sizeToContent));return!e&&n&&!this.resizeObserver?(this._sizeThrottle=$.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!n)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return $.getElement(e)}static getElements(e=".grid-stack-item"){return $.getElements(e)}static getGridElement(e){return ce.getElement(e)}static getGridElements(e){return $.getElements(e)}_initMargin(){let e,n=0,o=[];typeof this.opts.margin=="string"&&(o=this.opts.margin.split(" ")),o.length===2?(this.opts.marginTop=this.opts.marginBottom=o[0],this.opts.marginLeft=this.opts.marginRight=o[1]):o.length===4?(this.opts.marginTop=o[0],this.opts.marginRight=o[1],this.opts.marginBottom=o[2],this.opts.marginLeft=o[3]):(e=$.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,n=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(s=>{this.opts[s]===void 0?this.opts[s]=n:(e=$.parseHeight(this.opts[s]),this.opts[s]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const i=this.el.style;return i.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),i.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),i.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),i.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Ce}static setupDragIn(e,n,o,i=document){n?.pause!==void 0&&(de.pauseDrag=n.pause),n={appendTo:"body",helper:"clone",...n||{}},(typeof e=="string"?$.getElements(e,i):e).forEach((s,a)=>{Ce.isDraggable(s)||Ce.dragIn(s,n),o?.[a]&&(s.gridstackNode=o[a])})}movable(e,n){return this.opts.staticGrid?this:(ce.getElements(e).forEach(o=>{const i=o.gridstackNode;i&&(n?delete i.noMove:i.noMove=!0,this.prepareDragDrop(i.el))}),this)}resizable(e,n){return this.opts.staticGrid?this:(ce.getElements(e).forEach(o=>{const i=o.gridstackNode;i&&(n?delete i.noResize:i.noResize=!0,this.prepareDragDrop(i.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&n&&o.subGrid.enableMove(e,n)}),this)}enableResize(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&n&&o.subGrid.enableResize(e,n)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&ce._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Ce.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Ce.droppable(this.el,"destroy"),this;let e,n;const o=(i,s,a)=>{a=a||s;const l=a.gridstackNode;if(!l)return;if(!l.grid?.el){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=a.getBoundingClientRect();a.style.left=f.x+(this.dragTransform.xScale-1)*(i.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(i.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:d,left:c}=a.getBoundingClientRect();const u=this.el.getBoundingClientRect();c-=u.left,d-=u.top;const h={position:{top:d*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/n)),l.y=Math.max(0,Math.round(d/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){Ce.off(s,"drag");return}l._willFitPos&&($.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,i,h,l,n,e)}else this._dragOrResize(a,i,h,l,n,e)};return Ce.droppable(this.el,{accept:i=>{const s=i.gridstackNode||this._readAttr(i,!1);if(s?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let a=!0;if(typeof this.opts.acceptWidgets=="function")a=this.opts.acceptWidgets(i);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=i.matches(l)}if(a&&s&&this.opts.maxRow){const l={w:s.w,h:s.h,minW:s.minW,minH:s.minH};a=this.engine.willItFit(l)}return a}}).on(this.el,"dropover",(i,s,a)=>{let l=a?.gridstackNode||s.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(s,a),a=a||s,n=this.cellWidth(),e=this.getCellHeight(!0),!l){const u=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(u){try{l=JSON.parse(u)}catch{console.error("Gridstack dropover: Bad JSON format: ",u)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const d=l.w||Math.round(a.offsetWidth/n)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(s._gridstackNodeOrig||(s._gridstackNodeOrig=l),s.gridstackNode=l={...l,w:d,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=d,l.h=c,l._temporaryRemoved=!0),ce._itemRemoving(l.el,!1),Ce.on(s,"drag",o),o(i,s,a),!1}).on(this.el,"dropout",(i,s,a)=>{const l=a?.gridstackNode||s.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(s,a),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(i,s,a)=>{const l=a?.gridstackNode||s.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const d=!!this.placeholder.parentElement,c=s!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode,d&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const u=s._gridstackNodeOrig;if(delete s._gridstackNodeOrig,d&&u?.grid&&u.grid!==this){const f=u.grid;f.engine.removeNodeFromLayoutCache(u),f.engine.removedNodes.push(u),f._triggerRemoveEvent()._triggerChangeEvent(),f.parentGridNode&&!f.engine.nodes.length&&f.opts.subGridDynamic&&f.removeAsSubGrid()}if(!l||(d&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,Ce.off(s,"drag"),a!==s?(a.remove(),s=a):s.remove(),this._removeDD(s),!d))return!1;const h=l.subGrid?.el?.gridstack;return $.copyPos(l,this._readAttr(this.placeholder)),$.removePositioningStyles(s),c&&(l.content||l.subGridOpts||ce.addRemoveCB)?(delete l.el,s=this.addWidget(l)):(this._prepareElement(s,!0,l),this.el.appendChild(s),this.resizeToContentCheck(!1,l),h&&(h.parentGridNode=l),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...i,type:"dropped"},u&&u.grid?u:void 0,l),!1}),this}static _itemRemoving(e,n){if(!e)return;const o=e?e.gridstackNode:void 0;!o?.grid||e.classList.contains(o.grid.opts.removableOptions.decline)||(n?o._isAboutToRemove=!0:delete o._isAboutToRemove,n?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Ce.isDroppable(e)&&Ce.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,o)=>ce._itemRemoving(o,!0)).on(e,"dropout",(n,o)=>ce._itemRemoving(o,!1)),this):this}prepareDragDrop(e,n=!1){const o=e?.gridstackNode;if(!o)return;const i=o.noMove||this.opts.disableDrag,s=o.noResize||this.opts.disableResize,a=this.opts.staticGrid||i&&s;if((n||a)&&(o._initDD&&(this._removeDD(e),delete o._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!n))return this;if(!o._initDD){let l,d;const c=(f,g)=>{this.triggerEvent(f,f.target),l=this.cellWidth(),d=this.getCellHeight(!0),this._onStartMoving(e,f,g,o,l,d)},u=(f,g)=>{this._dragOrResize(e,f,g,o,l,d)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete o._moving,delete o._resizing,delete o._event,delete o._lastTried;const g=o.w!==o._orig.w,m=f.target;if(!(!m.gridstackNode||m.gridstackNode.grid!==this)){if(o.el=m,o._isAboutToRemove){const E=e.gridstackNode.grid;E._gsEventHandler[f.type]&&E._gsEventHandler[f.type](f,m),E.engine.nodes.push(o),E.removeWidget(e,!0,!0)}else $.removePositioningStyles(m),o._temporaryRemoved?(this._writePosAttr(m,o),this.engine.addNode(o)):this._writePosAttr(m,o),this.triggerEvent(f,m);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),f.type==="resizestop"&&(Number.isInteger(o.sizeToContent)&&(o.sizeToContent=o.h),this.resizeToContentCheck(g,o))}};Ce.draggable(e,{start:c,stop:h,drag:u}).resizable(e,{start:c,stop:h,resize:u}),o._initDD=!0}return Ce.draggable(e,i?"disable":"enable").resizable(e,s?"disable":"enable"),this}_onStartMoving(e,n,o,i,s,a){if(this.engine.cleanNodes().beginUpdate(i),this._writePosAttr(this.placeholder,i),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=i,i.grid?.el)this.dragTransform=$.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=$.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(i.el=this.placeholder,i._lastUiPosition=o.position,i._prevYPix=o.position.top,i._moving=n.type==="dragstart",i._resizing=n.type==="resizestart",delete i._lastTried,n.type==="dropover"&&i._temporaryRemoved&&(this.engine.addNode(i),i._moving=!0),this.engine.cacheRects(s,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),n.type==="resizestart"){const l=this.getColumn()-i.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-i.y;Ce.resizable(e,"option","minWidth",s*Math.min(i.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(i.minH||1,d)).resizable(e,"option","maxWidth",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,i.x+i.w)).resizable(e,"option","maxHeight",a*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",a*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,i.y+i.h))}}_dragOrResize(e,n,o,i,s,a){const l={...i._orig};let d,c=this.opts.marginLeft,u=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const g=Math.round(a*.1),m=Math.round(s*.1);if(c=Math.min(c,m),u=Math.min(u,m),h=Math.min(h,g),f=Math.min(f,g),n.type==="drag"){if(i._temporaryRemoved)return;const S=o.position.top-i._prevYPix;i._prevYPix=o.position.top,this.opts.draggable.scroll!==!1&&$.updateScrollPosition(e,o.position,S);const D=o.position.left+(o.position.left>i._lastUiPosition.left?-u:c),B=o.position.top+(o.position.top>i._lastUiPosition.top?-f:h);l.x=Math.round(D/s),l.y=Math.round(B/a);const w=this._extraDragRow;if(this.engine.collide(i,l)){const M=this.getRow();let G=Math.max(0,l.y+i.h-M);this.opts.maxRow&&M+G>this.opts.maxRow&&(G=Math.max(0,this.opts.maxRow-M)),this._extraDragRow=G}else this._extraDragRow=0;if(this._extraDragRow!==w&&this._updateContainerHeight(),i.x===l.x&&i.y===l.y)return}else if(n.type==="resize"){if(l.x<0||($.updateScrollResize(n,e,a),l.w=Math.round((o.size.width-c)/s),l.h=Math.round((o.size.height-h)/a),i.w===l.w&&i.h===l.h)||i._lastTried&&i._lastTried.w===l.w&&i._lastTried.h===l.h)return;const S=o.position.left+c,D=o.position.top+h;l.x=Math.round(S/s),l.y=Math.round(D/a),d=!0}i._event=n,i._lastTried=l;const E={x:o.position.left+c,y:o.position.top+h,w:(o.size?o.size.width:i.w*s)-c-u,h:(o.size?o.size.height:i.h*a)-h-f};if(this.engine.moveNodeCheck(i,{...l,cellWidth:s,cellHeight:a,rect:E,resizing:d})){i._lastUiPosition=o.position,this.engine.cacheRects(s,a,h,u,f,c),delete i._skipDown,d&&i.subGrid&&i.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const S=n.target;i._sidebarOrig||this._writePosAttr(S,i),this.triggerEvent(n,S)}}triggerEvent(e,n){let o=this;for(;o.parentGridNode;)o=o.parentGridNode.grid;o._gsEventHandler[e.type]&&o._gsEventHandler[e.type](e,n)}_leave(e,n){n=n||e;const o=n.gridstackNode;if(!o||(n.style.transform=n.style.transformOrigin=null,Ce.off(e,"drag"),o._temporaryRemoved))return;o._temporaryRemoved=!0,this.engine.removeNode(o),o.el=o._isExternal&&n?n:e;const i=o._sidebarOrig;o._isExternal&&this.engine.cleanupNode(o),o._sidebarOrig=i,this.opts.removable===!0&&ce._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):o._isExternal&&this.engine.restoreInitial()}};mt.renderCB=(t,e)=>{t&&e?.content&&(t.textContent=e.content)},mt.resizeToContentParent=".grid-stack-item-content",mt.Utils=$,mt.Engine=_o,mt.GDRev="12.4.2";var eh={class:"d-layout"},th=["gs-id","gs-x","gs-y","gs-w","gs-h","gs-locked","gs-no-resize","gs-no-move","gs-min-w","gs-min-h","gs-max-w","gs-max-h"],nh=(0,r.defineComponent)({name:"DLayout",__name:"layout",props:{modelValue:{default:()=>[]},column:{default:24},cellHeight:{default:60},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},disable:{type:Boolean,default:!1},animate:{type:Boolean,default:!0},float:{type:Boolean,default:!0},removable:{type:Boolean,default:!1},removableOptions:{}},emits:["update:modelValue","added","removed","changed","dragStart","dragStop","resizeStart","resizeStop"],setup(t,{expose:e,emit:n}){const o=t,i=n,s=(0,r.ref)();let a=null;const l=async()=>{s.value&&(await(0,r.nextTick)(),a&&a.destroy(!1),a=mt.init({column:o.column,cellHeight:o.cellHeight,disableDrag:!(o.draggable&&!o.disable),disableResize:!(o.resizable&&!o.disable),animate:o.animate,float:o.float,removable:o.removable,removableOptions:o.removableOptions},s.value),a.on("added",(f,g)=>{const m=g[0];m&&(i("added",d(m)),u())}),a.on("removed",(f,g)=>{const m=g[0];m&&(i("removed",d(m)),u())}),a.on("change",()=>{u(),i("changed",(a?.save()||[]).map(f=>d(f)))}),a.on("dragstart",(f,g)=>{g&&i("dragStart",f,d(g.gridstackNode||g))}),a.on("dragstop",(f,g)=>{g&&i("dragStop",f,d(g.gridstackNode||g))}),a.on("resizestart",(f,g)=>{g&&i("resizeStart",f,d(g.gridstackNode||g))}),a.on("resizestop",(f,g)=>{g&&i("resizeStop",f,d(g.gridstackNode||g))}))},d=f=>({id:f.id||f.el?.getAttribute("gs-id")||"",x:f.x||0,y:f.y||0,w:f.w||1,h:f.h||1,locked:f.locked||!1,noResize:f.noResize||!1,noMove:f.noMove||!1,minW:f.minW,minH:f.minH,maxW:f.maxW,maxH:f.maxH}),c=async()=>{if(!a||!s.value)return;await(0,r.nextTick)();const f=a.engine.nodes;new Set(f.map(m=>m.id));const g=new Set(o.modelValue.map(m=>m.id));f.forEach(m=>{if(!g.has(m.id||"")){const E=m.el;E&&a&&a.removeWidget(E,!1)}}),o.modelValue.forEach(m=>{const E=f.find(S=>S.id===m.id);if(E)E.el&&a&&a.update(E.el,{x:m.x,y:m.y,w:m.w,h:m.h,locked:m.locked,noResize:m.noResize,noMove:m.noMove,minW:m.minW,minH:m.minH,maxW:m.maxW,maxH:m.maxH});else{if(!s.value||!a)return;const S=s.value.querySelector(`[gs-id="${m.id}"]`);S&&a.makeWidget(S)}})},u=()=>{a&&i("update:modelValue",a.save().map(f=>{const g={id:f.id||"",x:f.x||0,y:f.y||0,w:f.w||1,h:f.h||1},m=o.modelValue.find(E=>E.id===g.id);return m&&Object.keys(m).forEach(E=>{["id","x","y","w","h"].includes(E)||(g[E]=m[E])}),g}))},h=(0,r.computed)(()=>o.modelValue);return(0,r.watch)(()=>o.modelValue,async()=>{a&&(await(0,r.nextTick)(),c())},{deep:!0}),(0,r.watch)(()=>[o.column,o.cellHeight,o.draggable,o.resizable,o.disable,o.animate,o.float,o.removable],()=>{l()}),(0,r.onMounted)(()=>{l()}),(0,r.onBeforeUnmount)(()=>{a&&(a.destroy(!1),a=null)}),e({addItem:async f=>{if(a&&s.value){await(0,r.nextTick)();const g=s.value.querySelector(`[gs-id="${f.id}"]`);g&&(a.makeWidget(g),a.update(g,{x:f.x,y:f.y,w:f.w,h:f.h,locked:f.locked,noResize:f.noResize,noMove:f.noMove,minW:f.minW,minH:f.minH,maxW:f.maxW,maxH:f.maxH}))}},removeItem:f=>{if(a&&s.value){const g=s.value.querySelector(`[gs-id="${f}"]`);g&&a.removeWidget(g,!1)}},clear:()=>{a&&a.removeAll(!1)},getGrid:()=>a}),(f,g)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",eh,[(0,r.createElementVNode)("div",{ref_key:"gridContainerRef",ref:s},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(h.value,m=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:m.id,"gs-id":m.id,"gs-x":m.x,"gs-y":m.y,"gs-w":m.w,"gs-h":m.h,"gs-locked":m.locked,"gs-no-resize":m.noResize,"gs-no-move":m.noMove,"gs-min-w":m.minW,"gs-min-h":m.minH,"gs-max-w":m.maxW,"gs-max-h":m.maxH,class:"d-layout-item"},[(0,r.renderSlot)(f.$slots,"item",{item:m})],8,th))),128))],512)]))}}),oh=nh,Mr=qe(oh),be=(t,e="",n=!1)=>n?`${t}pt`:e?`${t}${e}`:`${t}px`,xe=(t,e=0)=>t==null||isNaN(t)?0:Number(Number(t).toFixed(e)),ih=t=>t*3/4,rh=t=>t*4/3,sh=["onMousedown"],ah={key:2,class:"d-draggable__mask"},lh=(0,r.defineComponent)({name:"DDraggable",__name:"draggable",props:{index:{},mask:{type:Boolean,default:!0},scale:{default:1},readonly:{type:Boolean,default:!1},resize:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},step:{default:1},zIndex:{default:1},isActiveBgTransparent:{type:Boolean,default:!1},left:{default:0},top:{default:0},width:{},height:{},activeFlag:{type:Boolean,default:!1},isPt:{type:Boolean,default:!1}},emits:["focus","blur","over","out"],setup(t,{expose:e,emit:n}){const o=t,i=n,s=(0,r.ref)(),a=(0,r.ref)(),l=(0,r.ref)(0),d=(0,r.ref)(0),c=(0,r.ref)(0),u=(0,r.ref)(0),h=(0,r.ref)(null),f=(0,r.ref)(!1),g=(0,r.ref)(!1),m=(0,r.ref)(!1),E=(0,r.ref)(!1),S=(0,r.ref)([{classname:"left"},{classname:"right"},{classname:"top"},{classname:"bottom"},{classname:"top-left"},{classname:"top-right"},{classname:"bottom-left"},{classname:"bottom-right"}]),D=(0,r.computed)(()=>o.scale),B=(0,r.computed)(()=>({left:be(D.value,"",o.isPt)})),w=(0,r.computed)(()=>({left:be(-D.value,"",o.isPt)})),M=(0,r.computed)(()=>({left:"auto",right:be(-D.value,"",o.isPt)})),G=(0,r.computed)(()=>({top:be(-D.value,"",o.isPt)})),R=(0,r.computed)(()=>({top:"auto",bottom:be(-D.value,"",o.isPt)})),q=(0,r.computed)(()=>{const V=8*D.value;return{width:be(V,"",o.isPt),height:be(V,"",o.isPt)}}),K=(0,r.computed)(()=>({fontSize:be(16*D.value,"",o.isPt)})),j=(0,r.computed)(()=>Object.assign((()=>{if(E.value){const V={zIndex:9999,...B.value};return o.isActiveBgTransparent&&(E.value||g.value)&&!o.readonly&&!o.disabled&&(V.backgroundColor="color-mix(in srgb, var(--j-color-primary-bg) 60%, transparent)"),V}return{zIndex:o.zIndex}})(),{top:be(u.value,"",o.isPt),width:be(l.value,"",o.isPt),height:be(d.value,"",o.isPt),padding:be(8*D.value,"",o.isPt),...B.value,left:be(c.value,"",o.isPt)}));(0,r.watch)(()=>o.width,V=>{l.value=xe(F(V))||(h.value?.offsetWidth??0)}),(0,r.watch)(()=>o.height,V=>{d.value=xe(F(V))||(h.value?.offsetHeight??0)},{deep:!0}),(0,r.watch)(()=>o.left,V=>{c.value=xe(F(V))}),(0,r.watch)(()=>o.top,V=>{u.value=xe(F(V))}),(0,r.watch)(l,V=>{s.value&&(s.value.style.width=be(V,"",o.isPt),o.resize&&h.value?.style&&(h.value.style.width=be(V,"",o.isPt)))}),(0,r.watch)(d,V=>{s.value&&(s.value.style.height=be(V,"",o.isPt),o.resize&&h.value?.style&&(h.value.style.height=be(V,"",o.isPt)))}),(0,r.watch)(()=>o.activeFlag,V=>{Z(V)});const Z=V=>{E.value=V},F=V=>V===void 0?0:o.isPt?rh(V):V,k=()=>{a.value&&a.value.firstChild&&(h.value=a.value.firstChild,l.value=xe(F(o.width))||(h.value?.offsetWidth??0),d.value=xe(F(o.height))||(h.value?.offsetHeight??0),c.value=xe(F(o.left)),u.value=xe(F(o.top)),Z(o.activeFlag))},W=V=>{c.value=V},b=V=>{u.value=V},P=V=>{const X=8*D.value/2,A={};return V.split("-").forEach(U=>{A[U]=be(-X,"",o.isPt)}),A},v=V=>{g.value=V},N=V=>o.isPt?ih(V):V,I=()=>{f.value=!0,i("focus",{index:o.index,width:N(l.value),height:N(d.value),left:N(c.value),top:N(u.value)})},T=()=>{f.value=!1,m.value=!1,i("blur",{index:o.index,width:N(l.value),height:N(d.value),left:N(c.value),top:N(u.value)})},z=()=>{document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,T()}},O=(V,X)=>{if(o.disabled||o.readonly)return;let A,U,te,ie,le,J;m.value=!0,I();let re=V.clientX,x=V.clientY;document.onmousemove=p=>{f.value=!0,X==="right"?(A=!0,U=!1):X==="left"?(A=!0,te=!0,le=!0,U=!1):X==="top"?(A=!1,U=!0,ie=!0,J=!0):X==="bottom"?(A=!1,U=!0):X==="bottom-right"?(A=!0,U=!0):X==="bottom-left"?(A=!0,U=!0,te=!0,le=!0):X==="top-right"?(A=!0,U=!0,ie=!0,J=!0):X==="top-left"&&(A=!0,U=!0,te=!0,le=!0,ie=!0,J=!0);const y=p.clientX-re,C=p.clientY-x;if(re=p.clientX,x=p.clientY,A){let _=y*o.step;le&&(_=-_),te&&(c.value=xe(c.value-_)),l.value=xe(l.value+_)}if(U){let _=C*o.step;J&&(_=-_),ie&&(u.value=xe(u.value-_)),d.value=xe(d.value+_)}},z()},L=()=>{g.value=!1,i("out",{index:o.index,width:N(l.value),height:N(d.value),left:N(c.value),top:N(u.value)})},ee=()=>{o.disabled||o.readonly||(g.value=!0,i("over",{index:o.index,width:N(l.value),height:N(d.value),left:N(c.value),top:N(u.value)}))},se=V=>{if(o.disabled||o.readonly)return;E.value=!0,I();let X=V.clientX,A=V.clientY;document.onmousemove=U=>{const te=U.clientX-X,ie=U.clientY-A;X=U.clientX,A=U.clientY,c.value=xe(c.value+te*o.step),u.value=xe(u.value+ie*o.step)},z()};return(0,r.onMounted)(()=>{k()}),e({setActive:Z,setLeft:W,setTop:b,setOverActive:v}),(V,X)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:(0,r.normalizeClass)(["d-draggable",{"d-draggable--active":(E.value||g.value)&&!t.readonly&&!t.disabled},{"d-draggable--pt":t.isPt&&!t.readonly&&!t.disabled},{"d-draggable--move":f.value},{"d-draggable--click":t.disabled}]),onMousedown:(0,r.withModifiers)(se,["stop"]),onMouseover:(0,r.withModifiers)(ee,["stop"]),onMouseout:(0,r.withModifiers)(L,["stop"]),style:(0,r.normalizeStyle)(j.value)},[(0,r.createElementVNode)("div",{class:"d-draggable__wrapper",ref_key:"wrapper",ref:s},[(E.value||g.value||f.value)&&!t.readonly&&!t.disabled?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:0},[(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...B.value,...G.value}),class:"d-draggable__line d-draggable__line--left"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...B.value,...w.value}),class:"d-draggable__line d-draggable__line--top"},null,4),t.isPt?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...B.value,...G.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...B.value,...w.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...B.value,...R.value}),class:"d-draggable__line d-draggable__line--left"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...B.value,...M.value}),class:"d-draggable__line d-draggable__line--top"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...B.value,...R.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...B.value,...M.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4)],64)):((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:0,class:"d-draggable__line d-draggable__line--label",style:(0,r.normalizeStyle)(K.value)},(0,r.toDisplayString)(c.value)+","+(0,r.toDisplayString)(u.value),5))],64)):(0,r.createCommentVNode)("",!0),!t.readonly&&!t.disabled?((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,{key:1},(0,r.renderList)(S.value,(A,U)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:U},[E.value?((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:0,class:(0,r.normalizeClass)(["d-draggable__range",`d-draggable__range--${A.classname}`]),style:(0,r.normalizeStyle)([q.value,P(A.classname)]),onMousedown:(0,r.withModifiers)(te=>O(te,A.classname),["stop"])},null,46,sh)):(0,r.createCommentVNode)("",!0)],64))),128)):(0,r.createCommentVNode)("",!0),(0,r.createElementVNode)("div",{class:"d-draggable__item",ref_key:"item",ref:a},[(0,r.renderSlot)(V.$slots,"default")],512),!t.disabled&&t.mask?((0,r.openBlock)(),(0,r.createElementBlock)("div",ah)):(0,r.createCommentVNode)("",!0)],512)],38))}}),ch=lh,Ir=qe(ch),dh=t=>{const e=uh(t.components);return{formConfig:t.form,componentList:e}},Br=(t,e)=>{let n={},o=[];const i={};if(t.ver==="V3"){const s=t;n=s.form;const a={};s.components.forEach(l=>{const d=e[l.type];a[l.containerId]=a[l.containerId]||[];const c={id:l.id,name:l.name,type:l.type,dragType:d?.dragType||"component",componentName:d?.componentName||"",runtimeType:d?.runtimeType,groupId:l.groupId,config:l.config,isInput:d?.isInput!==!1,containerId:l.containerId,level:l.level};d?.dragType==="container"&&(c.children=[]),i[c.id]=c,a[l.containerId].push(c)}),Object.keys(a).forEach(l=>{i[l]&&(i[l].children=a[l])}),o=a.form||[]}return{formConfig:n,componentList:o,componentDic:i}},bo=(t,e)=>{const n={ver:"V3",form:{...t},components:[],db:{}};return zr(e||[],n.components),n},zr=(t,e)=>{t.forEach(n=>{if(n.type==="pkey")return;const o={id:n.id,name:n.name,type:n.type,runtimeType:n.runtimeType||n.componentName||n.type,groupId:n.groupId||"",config:n.config,containerId:n.containerId,level:n.level};n.dragType==="container"&&zr(n.children||[],e),e.push(o)})},uh=t=>{const e={},n={};return t.forEach(o=>{e[o.containerId]=e[o.containerId]||[];const i={id:o.id,type:o.runtimeType,slot:o.groupId,config:{rule:[]}};o.config&&Object.keys(o.config).forEach(s=>{if(s==="required"){o.config.required&&i.config?.rule?.push({required:!0,message:o.config.requiredMsg||"请输入"});return}if(s==="patterns"){o.config.patterns.forEach(a=>{a.reg&&a.msg&&i.config?.rule?.push({pattern:new RegExp(a.reg),message:`请输入${a.msg||""}`})});return}i.config[s]=o.config[s]}),o.type==="pkey"&&(i.config.isPkey=!0),e[o.containerId].push(i),n[o.id]=i}),Object.keys(e).forEach(o=>{const i=n[o];if(i){const s=e[o];if(["j-tabs","j-collapse"].includes(i.type||"")&&i.config?.groups){const a={};s.forEach(l=>{if(l.slot!==void 0&&l.slot!==null){const d=l.slot.toString();a[d]||(a[d]=[]),delete l.slot,a[d].push(l)}}),i.children=i.config.groups.map(l=>{const d=a[l._i]||[],c={label:l.label};l.active&&i.type==="j-collapse"&&(c.active=l.active);let u;if(i.type==="j-tabs"&&i.config?.tabKey&&i.config?.options.length>0){const f=i.config.options.find(g=>g.label===l._i);f&&(u=({formData:g})=>({display:f.value.includes(g[i.config?.tabKey||""])?f.display:!f.display}))}const h={config:c,children:d};return u&&(h.getCompConfig=u),h}),delete i.config.groups}else i.children=s}}),e.form},Rr=(t,e,n,o,i,s,a,l)=>{const d=(0,r.ref)(),c=(0,r.reactive)({}),u=(0,r.computed)(()=>{const v=[];return Object.keys(c).forEach(N=>{const I=c[N];I.dragType==="component"&&I.type!=="pkey"&&v.push(I)}),v}),h=(v=[],N)=>{const I=e?.value?.init;typeof I=="function"&&I(v,N)},f=v=>i?i(v,{componentDic:c,components:u.value,configData:d.value.config}):{},g=(v,N)=>{if(d.value?.id===v)return;const I=c[v]||N;if(I?d.value=I:v===n.id?d.value=n:d.value=null,d.value){const T=s[d.value.type];T?(h(T,d.value.config),f(d.value.type)):h([])}else h([]);N&&ye("dragClick",{id:N.id})},m=()=>t.value.$el.getBoundingClientRect(),E=v=>v===n.id?n:c[v]||{},S=v=>{const N=[];if(v===n.id)N.push({id:v,name:n.name});else{const I=c[v];if(I){N.push({id:v,name:I.name});const T=S(I.containerId);N.push(...T)}}return N},D=(v,N)=>{const I=c[N];if(I===void 0)return!1;const T=I.containerId;return v===T?!0:T===n.id?!1:D(v,T)},B=v=>o?o(v)||{}:{},w=(v,N,I,T)=>{if(l){const z=E(v);return l(I.componentType,{container:z,groupId:N,configData:I},T)}return!1},M=({name:v,type:N,dragType:I,isInput:T,componentName:z,runtimeType:O},L,ee,se,V=!1)=>{const X=B(N);if(X.id=rt(),X.span=24,X.componentType=N,G(L,X.componentType))return;w(L,se,X,!0);const A={id:X.id,name:v,type:N,runtimeType:O,componentName:z||"",dragType:I||"component",containerId:L,isInput:!!T,level:c[L]?c[L].level+1:1,config:X,isNewAdd:!V,groupId:se};return A.dragType==="container"&&(A.children=[]),c[A.id]=A,E(L).children?.splice(ee,0,A),A},G=(v,N)=>!!(E(v).config.componentType==="gridtable"&&["divider","label","text","textEditor","viewTable","card","collapse","tabs","qrcode","barcode","tableLayout"].includes(N)),R=(v,N,I=!1)=>{let T=null;const z=E(v).children,O=z?.findIndex(L=>L.id===N)||0;if(I&&z&&z.length>1){let L=O+1;O>0&&(L=O-1),T=z[L]}return z?.splice(O,1),T?.id},q=(v,N,I,T)=>{const z=E(N).children,O=v.containerId!==N;v.containerId=N,v.groupId=T,z?.splice(I,0,v),w(N,T,v.config,O)&&(W(),g(v.id))},K=v=>{let N="";const I=E(v);return I&&(I.children&&I.children.length>0&&I.children.forEach(T=>{K(T.id)}),N=R(I.containerId,v,!0)||"",delete c[v]),d.value&&d.value.id===v&&(d.value=null,e.value.init([])),N},j=(v,N=[])=>{const I=E(v);if(I&&I.children&&I.children.length>0){const T=[];I.children.forEach(z=>{z.groupId&&N.includes(z.groupId)&&T.push(z.id)}),T.forEach(z=>{K(z),delete c[z]})}},Z=(v,N)=>{const I=E(v);I&&(I.children&&I.children.length>0&&I.children.forEach(T=>{T.groupId===N&&K(T.id)}),delete c[v])},F=v=>{const N=Sn(E(v));N.id=rt(),N.config.id=N.id,c[N.id]=N;const I=E(N.containerId).children,T=I?.findIndex(z=>z.id===v)||0;I?.splice(T+1,0,N)},k=()=>{n.children=[],Wr(c),d.value&&(ye("dragClick",{id:""}),d.value=null,e.value.init([]))},W=()=>{d.value&&(ye("dragClick",{id:""}),d.value=null,e.value.init([]))},b=v=>{const N=d.value,I=E(N.containerId).children,T=I?.findIndex(z=>z.id===N.id)||0;K(N.id),(0,r.nextTick)(()=>{const z=a[v],O=B(v);O.id=N.id,O.span=N.config.span,O.componentType=v,O.table=N.config.table,O.field=N.config.field,N.config.isSubTable&&(O.isSubTable=N.config.isSubTable);const L={id:O.id,name:z.name,type:v,runtimeType:z.runtimeType,componentName:z.componentName||"",dragType:N.dragType,groupId:N.groupId,containerId:N.containerId,isInput:N.isInput,level:N.level,config:O,isNewAdd:!0};c[L.id]=L,I?.splice(T,0,L)})},P=v=>{ye("dragAddByClick",v)};return(0,r.provide)("d-drag-design-provide",{activedComponent:d,getDesignLocals:m,getComponent:E,getParentComponents:S,isMyChildComponent:D,selectComponent:g,addComponent:M,deleteComponent:K,copyComponent:F,removeComponentFromContainer:R,addComponentToContainer:q,top:n,deleteChildren:Z,deleteChildrens:j}),{activedComponent:d,clearComponents:k,changeComponent:b,schemaComponentDic:c,clearSelect:W,addComponent:M,addComponentByTable:P,designComponentList:u}},fh=(0,r.defineComponent)({__name:"importComponent",props:{componentList:{type:Array,default:()=>[]},tableList:{type:Array,default:()=>[]}},setup(t,{expose:e}){const n=t,o=(0,r.computed)(()=>n.tableList.map(c=>({label:c.comment?`${c.name}(${c.comment})`:c.name,value:c.name}))),i=(0,r.ref)(),s=[{id:"layout",type:"j-layout",config:{top:48,topMove:!1,autoSize:["default"]},children:[{id:"table",type:"j-select",slot:"top",config:{label:"表名选择",loadOptions:()=>o,allowClear:!1}},{id:"fields",type:"j-table",config:{editConfig:{isAddBtn:!1,isRemoveBtn:!1},height:"100%",isMultiple:!0},children:[{id:"name",type:"span",config:{label:"字段名"}},{id:"type",type:"j-select",config:{label:"组件选择",options:n.componentList,width:200}}]}]}],a=(c,u)=>{if(c.id==="table"){const h=n.tableList.find(f=>f.name===u.value);if(h){const f=h.columns.map(g=>({value:g.name,name:g.coment?`${g.name}(${g.coment})`:g.name,type:"input",label:g.coment||g.name,selected:!g.isPrimary}));i.value.setFormData({fields:f})}}};return(0,r.onMounted)(()=>{i.value.init(s)}),e({ok:()=>{const c=i.value.getFormData(!1);return{addList:c.fields.filter(u=>u.selected),table:c.table,containerId:c.containerId,isSubTable:c.isSubTable}},closed:()=>{}}),(c,u)=>{const h=(0,r.resolveComponent)("j-form");return(0,r.openBlock)(),(0,r.createBlock)(h,{ref_key:"formRef",ref:i,"form-config":{labelWidth:"72px"},onChange:a},null,512)}}}),hh=fh,gh=(0,r.defineComponent)({props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(t){const{t:e}=(0,Ke.useAppInject)();return{labelWidth:(0,r.computed)(()=>t.componentData.config?.notShowLabel?"0px":t.componentData.config?.labelWidth===void 0&&t.globalConfig.labelWidth!==void 0?`${t.globalConfig.labelWidth}px`:t.componentData.config?.labelWidth?`${t.componentData.config?.labelWidth}px`:void 0),inputConfig:(0,r.computed)(()=>{const n={...t.componentData?.config};return t.globalConfig.size===void 0&&(n.size=t.globalConfig.size),n.display=!0,n}),t:e}}}),ph=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n};function mh(t,e,n,o,i,s){const a=(0,r.resolveComponent)("j-comp"),l=(0,r.resolveComponent)("el-form-item");return t.componentData.isInput?((0,r.openBlock)(),(0,r.createBlock)(l,{key:0,"label-width":t.labelWidth,label:t.t(t.componentData.config?.notShowLabel?"":t.componentData.config?.label||""),rules:t.componentData.config?.required?[{required:!0,message:""}]:[]},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(a,{type:t.componentData?.componentName||t.componentData?.type,config:t.inputConfig,modelValue:t.componentData?.config.defaultValue},null,8,["type","config","modelValue"])]),_:1},8,["label-width","label","rules"])):t.componentData?.children?((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(t.componentData?.componentName),(0,r.mergeProps)({key:1},t.componentData?.config,{"global-config":t.globalConfig,"component-data":t.componentData}),null,16,["global-config","component-data"])):((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(t.componentData?.componentName),(0,r.normalizeProps)((0,r.mergeProps)({key:2},t.componentData?.config)),null,16))}var Ar=ph(gh,[["render",mh]]),yh={class:"d-form-design j-block"},vh={class:"d-form-design-left"},_h={class:"d-form-design-component-list"},wh={class:"j-component-tool"},bh={class:"j-component-tool-name"},Ch={class:"d-form-design-center"},Eh={class:"d-form-design-container"},xh={key:0,class:"d-form-design-empty"},Nh={class:"d-form-design-right"},kh={class:"d-form-design-panel-title"},Sh={style:{margin:"0","font-size":"14px"}},Dh={class:"d-form-design-panel"},Th=(0,r.defineComponent)({name:"DFormDesign",__name:"formDesign",props:{notBindTable:{type:Boolean,default:!1},components:{default:()=>[]},componentConfigs:{default:()=>({})},componentInit:{type:Function,default:void 0},containerAddComponent:{type:Function,default:void 0},componentConfigInit:{type:Function,default:void 0},componentConfigChange:{type:Function,default:void 0},componentConfigValidate:{type:Function,default:void 0},flowComponents:{default:()=>[]},flowInit:{type:Function,default:void 0},flowComponentConfigInit:{type:Function,default:void 0},flowComponentConfigChange:{type:Function,default:void 0},flowComponentConfigs:{default:()=>({})},actions:{}},setup(t,{expose:e}){const n=t,{t:o,warning:i,error:s}=(0,Ke.useAppInject)(),a=(0,r.reactive)({name:"表单",id:"form",type:"form",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}}),l=(0,r.ref)([]),d=n.components.length;for(let p=0;p<d;p++)l.value.push(p);n.componentInit&&(a.config=n.componentInit("form")||{});const c=(0,r.ref)([]),u=(0,r.computed)(()=>c.value.map(p=>({label:p.comment?`${p.name}(${p.comment})`:p.name,value:p.name}))),h=(0,r.computed)(()=>{if(R.value){const p=G.value.getFormData(!1);if(p.table){const y=c.value.find(C=>C.name===p.table);if(y)return y.columns.map(C=>({value:C.name,label:C.coment?`${C.name}(${C.coment})`:C.name,coment:C.coment}))}}return[]}),f=p=>{c.value=p},g={},m=[];n.components.forEach(({children:p})=>{p.forEach(y=>{g[y.type]=y,y.dragType=y.dragType||"component",y.isInput!==!1&&(y.isInput=!0,m.push({label:y.name,value:y.type}))})});const E=p=>{p.forEach(y=>{y.type==="d-input-flow"&&(y.config=y.config||{},y.config.flowComponents=n.flowComponents,y.config.flowInit=n.flowInit,y.config.flowComponentConfigInit=C=>{n.flowComponentConfigInit&&(C.designComponents=F.value,C.component=R.value,n.flowComponentConfigInit(C))},y.config.flowComponentConfigs=n.flowComponentConfigs,y.config.flowComponentConfigChange=n.flowComponentConfigChange),y.children&&E(y.children)})},S={};Object.keys(n.componentConfigs||{}).forEach(p=>{const{hasBase:y,isInput:C,hasTwoPlaceholder:_,hasPlaceholder:Y,hasSpan:H,hasLabel:oe,bindTable:Q,labelTitle:ue}=g[p]||{hasBase:!1},fe=[{id:"id",type:"j-input",config:{label:"ID",readonly:!0}},{id:"componentType",type:"j-select",config:{label:"类型",allowClear:!1,display:C,options:m}},{id:"label",type:"j-input",config:{label:ue||"标题"},getCompConfig:({formData:he})=>({display:oe!==!1&&!he.notShowLabel})},{id:"notShowLabel",type:"j-switch",config:{label:"不显示"+(ue||"标题"),activeValue:!0,inactiveValue:!1},getCompConfig:({formData:he})=>({display:oe!==!1&&!he.isSubTable})},{id:"labelWidth",type:"j-number",config:{label:"标题宽度"},getCompConfig:({formData:he})=>({display:C&&!he.notShowLabel&&!he.isSubTable})},{id:"placeholder",type:"j-input",config:{display:C&&!_&&Y!==!1,label:"占位提示"}},{id:"startPlaceholder",type:"j-input",config:{display:!!_,label:"开始占位"}},{id:"endPlaceholder",type:"j-input",config:{display:!!_,label:"结束占位"}},{id:"span",type:"j-slider",config:{label:"表单栅栏",min:6,max:24,showTooltip:!0,step:6,showStops:!0,defautValue:24},getCompConfig:({formData:he})=>({display:H!==!1&&!he.isSubTable})},{id:"width",type:"j-number",config:{label:"单元格宽度",min:1},getCompConfig:({formData:he})=>({display:!!he.isSubTable})},{id:"isNotSave",type:"j-switch",config:{label:"不存表",display:C&&Q!==!1,activeValue:!0,inactiveValue:!1}},{id:"table",type:"j-select",config:{label:"数据表",loadOptions:()=>u},getCompConfig:({formData:he})=>({display:(C&&Q!==!1||Q===!0)&&(!he.isSubTable||Q===!0)&&!he.isNotSave&&!n.notBindTable})},{id:"field",type:"j-select",config:{label:"表字段",loadOptions:()=>h},getCompConfig:({formData:he})=>({display:C&&Q!==!1&&!he.isNotSave&&!n.notBindTable})},{id:"csType",type:"j-select",config:{label:"字段类型",allowClear:!1,options:[{label:"短文本",value:"string"},{label:"长文本",value:"text"},{label:"整数",value:"int"},{label:"小数",value:"decimal"},{label:"时间日期",value:"DateTime"}]},getCompConfig:({formData:he})=>({display:C&&Q!==!1&&!he.isNotSave&&n.notBindTable})},{id:"fieldLen",type:"j-number",config:{label:"字段长度"},getCompConfig:({formData:he})=>({display:C&&Q!==!1&&!he.isNotSave&&n.notBindTable&&he.csType==="string"})}],ge={type:"j-collapse",config:{defaultValue:[]},children:[]};y!==!1&&(ge.children?.push({config:{label:"基础信息"},children:[...fe]}),ge.config?.defaultValue.push("_collapse0")),ge.children?.push(...n.componentConfigs[p]),E(ge.children||[]),S[p]=[ge]});const D=p=>{const{value:y}=p||{};p.id==="componentType"&&K(y),R.value&&n.componentConfigChange&&(p.id==="field"&&p.data?.coment&&(R.value.config.label=p.data?.coment),n.componentConfigChange(R.value.type,{configRef:G,configData:R.value.config,...p})),p.id==="table"&&R.value&&R.value.type==="gridtable"&&(R.value.children||[]).forEach(C=>{C.isInput&&(C.config.table=y)})},B=(p,y)=>{g[p]?.isInput&&(n.notBindTable&&(y.configData.csType||G.value.setFormData({main:{csType:g[p]?.csType,fieldLen:g[p]?.fieldLen}})),u.value.length===1&&G.value.setFormData({main:{table:u.value[0].value}})),n.componentConfigInit&&n.componentConfigInit(p,{configRef:G,...y,notBindTable:n.notBindTable})},w=(p,y,C)=>{let _=!1;const Y=g[p];return y.container.type==="gridtable"?(!y.configData.isSubTable||C)&&(y.configData.isSubTable=!0,Y.isInput&&(y.configData.table=y.container.config.table,y.configData.field=""),_=!0):y.configData.isSubTable&&(_=!0,y.configData.isSubTable=!1,Y.isInput&&(y.configData.table="")),n.containerAddComponent&&n.containerAddComponent(p,y),_},M=(0,r.ref)(),G=(0,r.ref)(),{activedComponent:R,clearComponents:q,changeComponent:K,schemaComponentDic:j,addComponentByTable:Z,designComponentList:F}=Rr(M,G,a,n.componentInit,B,S,g,w),k=(0,r.computed)(()=>R.value?`【${R.value.name}】`:"");(0,r.provide)("dui-design-provide",{designItemName:Ar});const W=()=>{n.componentInit&&(a.config=n.componentInit("form")||{}),q()},b=()=>{let p=0;const y=bo(a.config,a.children||[]);if(n.notBindTable){const C={};y.components.forEach(H=>{const{isInput:oe,bindTable:Q}=g[H.type]||{hasBase:!1};oe&&Q!==!1?H.config.table&&!C.main&&(C.main={name:H.config.table,comment:"主表",type:"main",pKey:"J_Id"}):Q&&(C[H.id]={name:H.config.table||"t"+new Date().getTime()+p,comment:`子表${H.config.label}`,type:"chlid",field:"J_PId",relationField:"J_Id",pKey:"J_Id"},H.config.table=C[H.id].name,p++)}),C.main||(C.main={name:"t"+new Date().getTime()+p,comment:"主表",type:"main",pKey:"J_Id"},p++);let _=0;y.components.forEach(H=>{const{isInput:oe,bindTable:Q}=g[H.type]||{hasBase:!1};!H.config.isNotSave&&oe&&Q!==!1&&(H.config.csType||(H.config.csType=g[H.type]?.csType,H.config.fieldLen=g[H.type]?.fieldLen),H.config.isSubTable?H.config.table=C[H.containerId].name:H.config.table=C.main.name,H.config.field=H.config.field||`f${Math.floor(Date.now()/1e3)}${_}`,_++)});const Y=[];Object.keys(C).forEach(H=>{C[H].type==="chlid"&&(C[H].relationName=C.main.name,C[H].comment+=`,关联主表${C.main.name}`),Y.push(C[H])}),y.db=Y}else{const C={};c.value.forEach(_=>{_.columns.forEach(Y=>{C[`${_.name}_${Y.name}`]=Y.csType})}),y.components.forEach(_=>{_.config.table&&_.config.field&&(_.config.csType=C[`${_.config.table}_${_.config.field}`])})}return n.notBindTable?y.db.forEach(C=>{if(!y.components.find(_=>_.config.table===C.name&&_.config.field==="J_Id")){const _=y.components.find(Y=>Y.config.table===C.name&&Y.config.field);_&&y.components.push({id:C.name+"_J_Id",name:C.name+"_J_Id",type:"pkey",runtimeType:"j-input",groupId:"",config:{display:!1,table:C.name,field:"J_Id",label:"主键"},containerId:_.containerId,level:_.level})}}):c.value.forEach(C=>{C.columns.forEach(_=>{if(_.isPrimary&&!y.components.find(Y=>Y.config.table===C.name&&Y.config.field===_.name)){const Y=y.components.find(H=>H.config.table===C.name&&H.config.field);Y&&y.components.push({id:C.name+"_"+_.name,name:C.name+"_"+_.name,type:"pkey",runtimeType:"j-input",groupId:"",config:{display:!1,table:C.name,field:_.name,label:"主键"+_.name,isIdentity:_.isIdentity},containerId:Y.containerId,level:Y.level})}})}),y},P=p=>{const y=Br(p,g);a.config=y.formConfig,a.children?.push(...y.componentList),Object.keys(y.componentDic).forEach(C=>{j[C]=y.componentDic[C]})},v=()=>I(bo(a.config,a.children||[]).components,{},{}),N=p=>{const{isInput:y,bindTable:C}=g[p]||{hasBase:!1};if(!y&&C)return!0},I=(p,y,C)=>{if(!n.notBindTable)for(const _ of p){const{isInput:Y,bindTable:H}=g[_.type]||{hasBase:!1};if(!_.config.isNotSave&&_.type!=="pkey"){if(Y&&H!==!1){if((0,Ke.isNullOrEmpty)(_.config.table))return s&&s(`请【${_.config.label}】绑定数据表!`),!1;if(!_.config.isSubTable){if(C[_.config.table]&&N(C[_.config.table].type))return s&&s(`【${_.config.label}】和【${C[_.config.table].config.label}】重复绑定【${_.config.table}】表!`),!1;_.config.table&&(C[_.config.table]=_)}}else if(H){if((0,Ke.isNullOrEmpty)(_.config.table))return s&&s(`【${_.config.label}】请绑定数据表!`),!1;if(C[_.config.table])return s&&s(`【${_.config.label}】和【${C[_.config.table].config.label}】重复绑定【${_.config.table}】表!`),!1;_.config.table&&(C[_.config.table]=_)}}}for(const _ of p){if(!n.notBindTable){const{isInput:Y,bindTable:H}=g[_.type]||{hasBase:!1};if(!_.config.isNotSave&&Y&&H!==!1){if((0,Ke.isNullOrEmpty)(_.config.field))return s&&s(`请【${_.config.label}】绑定表字段!`),!1;if(y[`${_.config.table}-${_.config.field}`])return s&&s(`【${_.config.label}】和【${y[`${_.config.table}-${_.config.field}`].config.label}】重复绑定【${_.config.field}】字段!`),!1;y[`${_.config.table}-${_.config.field}`]=_}}if(n.componentConfigValidate&&!n.componentConfigValidate(_.type,{configData:_.config,errorTip:s}))return!1}return!0},T=(0,r.ref)(),z=(0,r.ref)(),O=(0,r.reactive)({width:0,height:0,formConfig:{}});let L=0;const ee=p=>{if(z.value)L=0,z.value.init(p||[]);else{if(L>600){console.warn("表单组件加载超时");return}L++,setTimeout(()=>{ee(p)},100)}},se=()=>{},V=()=>{},X=(0,r.ref)(),A=(0,r.ref)(),U=()=>{const{addList:p,table:y}=A.value?.ok()||{addList:[]};if(p.length<=0)i&&i("请选择字段!");else{if(R.value?.config.componentType==="gridtable"||R.value?.config.isSubTable)if(R.value.config.table){if(R.value.config.table!==y){i&&i("请设置相同的表和子表!");return}}else{let C=R.value;R.value.config.isSubTable&&(C=j[R.value.containerId]),C.config.table=y,(C.children||[]).forEach(_=>{_.isInput&&(_.config.table=y)}),G.value.setFormData({main:{table:y}})}p.forEach(C=>{const _=(0,Ke.deepClone)(g[C.type]);_.config={table:y,field:C.value,label:C.label},Z(_)}),X.value.close()}},te=()=>{A.value?.closed()};return e({setTables:p=>{f(p)},getSchema:()=>b(),setSchema:p=>P(p),reset:()=>W(),validate:()=>v()}),(p,y)=>{const C=(0,r.resolveComponent)("j-icon"),_=(0,r.resolveComponent)("d-drag-tool"),Y=(0,r.resolveComponent)("el-collapse-item"),H=(0,r.resolveComponent)("el-collapse"),oe=(0,r.resolveComponent)("d-drag-form-list"),Q=(0,r.resolveComponent)("el-row"),ue=(0,r.resolveComponent)("d-drag-container"),fe=(0,r.resolveComponent)("j-form"),ge=(0,r.resolveComponent)("j-layer");return(0,r.openBlock)(),(0,r.createElementBlock)("div",yh,[(0,r.createElementVNode)("div",vh,[(0,r.createElementVNode)("div",_h,[(0,r.createVNode)(H,{modelValue:l.value,"onUpdate:modelValue":y[0]||(y[0]=he=>l.value=he)},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(t.components,(he,Ze)=>((0,r.openBlock)(),(0,r.createBlock)(Y,{key:Ze,title:he.name,name:Ze},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(he.children,(Vt,Qh)=>((0,r.openBlock)(),(0,r.createBlock)(_,{key:Qh,config:Vt},{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",wh,[(0,r.createVNode)(C,{class:"j-component-tool-icon",icon:Vt.icon,size:14},null,8,["icon"]),(0,r.createElementVNode)("div",bh,(0,r.toDisplayString)((0,r.unref)(o)(Vt.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),(0,r.createElementVNode)("div",Ch,[(0,r.createElementVNode)("div",Eh,[(0,r.createVNode)(ue,{ref_key:"dragContainer",ref:M,class:"d-form-design-drag-container","is-component-container":!1,"component-data":a},{default:(0,r.withCtx)(()=>[!a.children||a.children.length===0?((0,r.openBlock)(),(0,r.createElementBlock)("div",xh,[...y[1]||(y[1]=[(0,r.createElementVNode)("div",null,"请从左侧拖拽组件到此处",-1)])])):((0,r.openBlock)(),(0,r.createBlock)(Q,{key:1},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(oe,{"component-list":a.children,"global-config":a.config},null,8,["component-list","global-config"])]),_:1}))]),_:1},8,["component-data"])])]),(0,r.withDirectives)((0,r.createElementVNode)("div",Nh,[(0,r.createElementVNode)("div",kh,[(0,r.createElementVNode)("span",Sh,(0,r.toDisplayString)(`${(0,r.unref)(o)("属性配置")}${k.value}`),1)]),(0,r.createElementVNode)("div",Dh,[(0,r.createVNode)(fe,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:G,onChange:D},null,512)])],512),[[r.vShow,(0,r.unref)(R)]]),(0,r.createVNode)(ge,{ref_key:"previewFormLayerRef",ref:T,width:O.width,height:O.height,onOk:se,onClosed:V},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(fe,{config:O.formConfig,"is-preview":!0,ref_key:"previewFormRef",ref:z,actions:t.actions},null,8,["config","actions"])]),_:1},8,["width","height"]),(0,r.createVNode)(ge,{ref_key:"importFormLayerRef",ref:X,width:800,height:600,"btn-text":"确认",onOk:U,onClosed:te},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(hh,{"component-list":m,"table-list":c.value,ref_key:"importComponentRef",ref:A},null,8,["table-list"])]),_:1},512)])}}}),Mh=Th,$r=qe(Mh,[Ar]),Pr=(t,e)=>{const n={ver:"V3",indexPage:{...t},components:[]};return Or(e||[],n.components),n},Or=(t,e)=>{t.forEach(n=>{const o={id:n.id,name:n.name,type:n.type,runtimeType:n.runtimeType||n.componentName||n.type,groupId:n.groupId||"",config:n.config,containerId:n.containerId,level:n.level};n.dragType==="container"&&Or(n.children||[],e),e.push(o)})},Ih=t=>{const e=Bh(t.components);return{pageConfig:t.indexPage,componentList:e}},Bh=t=>{const e={},n={};return t.forEach(o=>{e[o.containerId]=e[o.containerId]||[];const i={id:o.id,type:o.runtimeType,slot:o.groupId,config:{}};o.config&&Object.keys(o.config).forEach(s=>{i.config[s]=o.config[s]}),e[o.containerId].push(i),n[o.id]=i}),Object.keys(e).forEach(o=>{const i=n[o];if(i){const s=e[o];if(["j-tabs","j-collapse"].includes(i.type||"")&&i.config?.groups){const a={};s.forEach(l=>{if(l.slot!==void 0&&l.slot!==null){const d=l.slot.toString();a[d]||(a[d]=[]),delete l.slot,a[d].push(l)}}),i.children=i.config.groups.map(l=>{const d=a[l._i]||[];return{config:{label:l.label},children:d}}),delete i.config.groups}else i.children=s}}),e.indexPage||[]},zh=(t,e)=>{let n={},o=[];const i={};if(t.ver==="V3"){const s=t;n=s.indexPage;const a={};s.components.forEach(l=>{const d=e[l.type];if(!d)return;a[l.containerId]=a[l.containerId]||[];const c={id:l.id,name:l.name,type:l.type,dragType:d.dragType||"component",componentName:d.componentName||"",runtimeType:d.runtimeType,groupId:l.groupId,config:l.config,isInput:!1,containerId:l.containerId,level:l.level};i[c.id]=c,a[l.containerId].push(c),c.dragType==="container"&&(c.children=[])}),Object.keys(a).forEach(l=>{i[l]&&(i[l].children=a[l])}),o=a.indexPage||[]}return{pageConfig:n,componentList:o,componentDic:i}},Rh=(0,r.defineComponent)({name:"DIndexDesignItem",__name:"indexDesignItem",props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(t){return(e,n)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(t.componentData?.componentName),(0,r.mergeProps)(t.componentData?.config,{"global-config":t.globalConfig,"component-data":t.componentData}),null,16,["global-config","component-data"]))}}),Vr=Rh,Ah={class:"d-index-design j-block"},$h={class:"d-index-design-left"},Ph={class:"j-component-list"},Oh={class:"j-component-tool"},Vh={class:"j-component-tool-name"},Hh={class:"d-index-design-center"},Lh={class:"design-toolbar"},Fh={class:"design-container"},Gh={key:0,class:"j-block design-empty"},Wh={class:"d-index-design-right"},Uh={class:"d-index-design-panel-title"},Yh={style:{margin:"0","font-size":"14px"}},Xh={class:"d-index-design-panel"},jh=(0,r.defineComponent)({name:"DIndexDesign",__name:"indexDesign",props:{components:{type:Array,default:()=>[]},componentConfigs:{type:Object,default:()=>({})},componentInit:Function,containerAddComponent:Function,componentConfigInit:Function,componentConfigChange:Function,flowComponents:{type:Array,default:()=>[]},flowInit:Function,flowComponentConfigInit:Function,flowComponentConfigChange:Function,flowComponentConfigs:{type:Object,default:()=>({})},actions:{type:Object,default:()=>({})}},setup(t,{expose:e}){const{t:n}=(0,Ke.useAppInject)(),o=t,i=v=>{v.forEach(N=>{N.type==="d-input-flow"&&(N.config=N.config||{},N.config.flowComponents=o.flowComponents,N.config.flowInit=o.flowInit,N.config.flowComponentConfigInit=I=>{o.flowComponentConfigInit&&(I.designComponents=S.value,I.component=g.value,o.flowComponentConfigInit(I))},N.config.flowComponentConfigs=o.flowComponentConfigs,N.config.flowComponentConfigChange=o.flowComponentConfigChange),N.children&&i(N.children)})},s=(0,r.reactive)({name:"页面",id:"indexPage",type:"indexPage",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}});o.componentInit&&(s.config=o.componentInit("indexPage")||{});const a={},l=[];o.components.forEach(({children:v})=>{v.forEach(N=>{a[N.type]=N,N.dragType=N.dragType||"component",l.push({label:N.name,value:N.type})})});const d={};Object.keys(o.componentConfigs).forEach(v=>{const{hasBase:N}=a[v]||{hasBase:!1},I=[{id:"id",type:"j-input",config:{label:"ID",readonly:!0}},{id:"label",type:"j-input",config:{label:"名称"}}],T={type:"j-collapse",config:{defaultValue:[]},children:[]};N!==!1&&(T.children?.push({config:{label:"基础信息"},children:[...I]}),T.config?.defaultValue.push("_collapse0")),T.children?.push(...o.componentConfigs[v]),i(T.children||[]),d[v]=[T]});const c=v=>{g.value&&o.componentConfigChange&&o.componentConfigChange(g.value.type,{configRef:f,configData:g.value.config,...v})},u=(v,N)=>{o.componentConfigInit&&o.componentConfigInit(v,{configRef:f,...N})},h=(0,r.ref)(),f=(0,r.ref)(),{activedComponent:g,clearComponents:m,schemaComponentDic:E,designComponentList:S}=Rr(h,f,s,o.componentInit,u,d,a,o.containerAddComponent),D=(0,r.computed)(()=>g.value?`【${g.value.name}】`:""),B=(0,r.ref)([]),w=o.components.length;for(let v=0;v<w;v++)B.value.push(v);(0,r.provide)("dui-design-provide",{designItemName:Vr});const M=()=>{m()},G=()=>{o.componentInit&&(s.config=o.componentInit("indexPage")||{}),m()},R=()=>(console.log("pValidate"),!0),q=()=>Pr(s.config,s.children||[]),K=v=>{const N=zh(v,a);s.config=N.pageConfig,s.children?.push(...N.componentList),Object.keys(N.componentDic).forEach(I=>{E[I]=N.componentDic[I]})},j=(0,r.ref)(),Z=(0,r.ref)();(0,r.ref)(""),(0,r.reactive)({formConfig:{}});let F=0;const k=v=>{if(Z.value)F=0,Z.value.init(v);else{if(F>600){console.warn("组件加载超时");return}F++,setTimeout(()=>{k(v)},100)}},W=()=>{},b=()=>{},P=()=>{const{componentList:v}=Ih(Pr(s.config,s.children||[]));j.value.open("页面预览","full"),(0,r.nextTick)(()=>{k(v)})};return e({reset:G,validate:R,getSchema:q,setSchema:K}),(v,N)=>{const I=(0,r.resolveComponent)("j-icon"),T=(0,r.resolveComponent)("d-drag-tool"),z=(0,r.resolveComponent)("el-collapse-item"),O=(0,r.resolveComponent)("el-collapse"),L=(0,r.resolveComponent)("j-button"),ee=(0,r.resolveComponent)("el-tooltip"),se=(0,r.resolveComponent)("el-divider"),V=(0,r.resolveComponent)("el-empty"),X=(0,r.resolveComponent)("d-drag-index-list"),A=(0,r.resolveComponent)("d-drag-container"),U=(0,r.resolveComponent)("j-form"),te=(0,r.resolveComponent)("j-page"),ie=(0,r.resolveComponent)("j-layer");return(0,r.openBlock)(),(0,r.createElementBlock)("div",Ah,[(0,r.createElementVNode)("div",$h,[N[1]||(N[1]=(0,r.createElementVNode)("div",{class:"d-index-design-panel-title"},"组件库",-1)),(0,r.createElementVNode)("div",Ph,[(0,r.createVNode)(O,{modelValue:B.value,"onUpdate:modelValue":N[0]||(N[0]=le=>B.value=le)},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(t.components,(le,J)=>((0,r.openBlock)(),(0,r.createBlock)(z,{key:J,title:le.name,name:J},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(le.children,(re,x)=>((0,r.openBlock)(),(0,r.createBlock)(T,{key:x,config:re},{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",Oh,[(0,r.createVNode)(I,{class:"j-component-tool-icon",icon:re.icon,size:14},null,8,["icon"]),(0,r.createElementVNode)("div",Vh,(0,r.toDisplayString)((0,r.unref)(n)(re.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),(0,r.createElementVNode)("div",Hh,[(0,r.createElementVNode)("div",Lh,[N[2]||(N[2]=(0,r.createElementVNode)("div",null,null,-1)),(0,r.createElementVNode)("div",null,[(0,r.createVNode)(ee,{content:(0,r.unref)(n)("清空")},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(L,{danger:"",type:"text",onClick:M,icon:"mdi:delete-outline"})]),_:1},8,["content"]),(0,r.createVNode)(se,{direction:"vertical"}),(0,r.createVNode)(ee,{content:(0,r.unref)(n)("预览")},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(L,{type:"text",onClick:P,icon:"mdi:play-circle-outline"})]),_:1},8,["content"])])]),(0,r.createElementVNode)("div",Fh,[(0,r.createVNode)(A,{ref_key:"dragContainer",ref:h,class:"design-drag-container","is-component-container":!1,"component-data":s},{default:(0,r.withCtx)(()=>[!s.children||s.children.length===0?((0,r.openBlock)(),(0,r.createElementBlock)("div",Gh,[(0,r.createVNode)(V,{description:(0,r.unref)(n)("请从左侧拖拽组件到此处"),"image-size":100},null,8,["description"])])):((0,r.openBlock)(),(0,r.createBlock)(X,{key:1,"component-list":s.children,"global-config":s.config},null,8,["component-list","global-config"]))]),_:1},8,["component-data"])])]),(0,r.withDirectives)((0,r.createElementVNode)("div",Wh,[(0,r.createElementVNode)("div",Uh,[(0,r.createElementVNode)("span",Yh,(0,r.toDisplayString)(`${(0,r.unref)(n)("属性配置")}${D.value}`),1)]),(0,r.createElementVNode)("div",Xh,[(0,r.createVNode)(U,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:f,onChange:c},null,512)])],512),[[r.vShow,(0,r.unref)(g)&&d[(0,r.unref)(g).type]]]),(0,r.createVNode)(ie,{ref_key:"previewLayerRef",ref:j,"has-btns":!1,onOk:W,onClosed:b},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(te,{ref_key:"previewRef",ref:Z,actions:t.actions},null,8,["actions"])]),_:1},512)])}}}),Zh=jh,Hr=qe(Zh,[Vr]),Kh=[So,Mn,In,Bn,zn,Cr,Er,Mr,Ir,$r,Hr],Lr=new WeakSet,qh=t=>{Lr.has(t)||(Lr.add(t),Kh.forEach(e=>{const n=e.name;n&&t.component(n,e)}))},Jh={install:qh};me.DDrag=So,me.DDraggable=Ir,me.DFlowDesign=Cr,me.DFormDesign=$r,me.DIndexDesign=Hr,me.DInputFlow=Er,me.DLayout=Mr,me.default=Jh,me.dragContainer=In,me.dragFormList=Bn,me.dragIndexList=zn,me.dragTool=Mn,me.toFormDesignSchema=Br,me.toFormSaveSchema=bo,me.toFormSchema=dh});
26
+ Edge: ${t}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"},we=class extends Error{constructor(t,...e){var n;super((n=qi[t])==null?void 0:n.call(qi,...e)),this.name="VueFlowError",this.code=t,this.args=e}};function lo(t){return"clientX"in t}function Cd(t){return"sourceEvent"in t}function Ve(t,e){const n=lo(t);let o,i;return n?(o=t.clientX,i=t.clientY):"touches"in t&&t.touches.length>0?(o=t.touches[0].clientX,i=t.touches[0].clientY):"changedTouches"in t&&t.changedTouches.length>0?(o=t.changedTouches[0].clientX,i=t.changedTouches[0].clientY):(o=0,i=0),{x:o-(e?.left??0),y:i-(e?.top??0)}}var fn=()=>{var t;return typeof navigator<"u"&&((t=navigator?.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Ed(t){var e,n;return{width:((e=t.dimensions)==null?void 0:e.width)??t.width??0,height:((n=t.dimensions)==null?void 0:n.height)??t.height??0}}function hn(t,e=[1,1]){return{x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}}var xd=()=>!0;function co(t){t?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Nd(t,e,n){const o=[],i={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const s of e.values())cn(i,ln(s))>0&&o.push(s);return o}var kd=250;function Sd(t,e,n,o){var i,s;let a=[],l=Number.POSITIVE_INFINITY;const d=Nd(t,n,e+kd);for(const c of d){const u=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((s=c.handleBounds)==null?void 0:s.target)??[]];for(const h of u){if(o.nodeId===h.nodeId&&o.type===h.type&&o.id===h.id)continue;const{x:f,y:g}=pt(c,h,h.position,!0),p=Math.sqrt((f-t.x)**2+(g-t.y)**2);p>e||(p<l?(a=[{...h,x:f,y:g}],l=p):p===l&&a.push({...h,x:f,y:g}))}}if(!a.length)return null;if(a.length>1){const c=o.type==="source"?"target":"source";return a.find(u=>u.type===c)??a[0]}return a[0]}function Ji(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:d,isValidConnection:c=xd},u,h,f,g){const p=s==="target",b=e?a.querySelector(`.${l}-flow__handle[data-id="${d}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:S,y:D}=Ve(t),z=a.elementFromPoint(S,D),v=z?.classList.contains(`${l}-flow__handle`)?z:b,M={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const U=Qi(void 0,v),$=v.getAttribute("data-nodeid"),Q=v.getAttribute("data-handleid"),q=v.classList.contains("connectable"),j=v.classList.contains("connectableend");if(!$||!U)return M;const K={source:p?$:o,sourceHandle:p?Q:i,target:p?o:$,targetHandle:p?i:Q};M.connection=K,M.isValid=q&&j&&(n===We.Strict?p&&U==="source"||!p&&U==="target":$!==o||Q!==i)&&c(K,{nodes:h,edges:u,sourceNode:f(K.source),targetNode:f(K.target)}),M.toHandle=er($,U,Q,g,n,!0)}return M}function Qi(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function Dd(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Td(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}function er(t,e,n,o,i,s=!1){var a,l,d;const c=o.get(t);if(!c)return null;const u=i===We.Strict?(a=c.handleBounds)==null?void 0:a[e]:[...((l=c.handleBounds)==null?void 0:l.source)??[],...((d=c.handleBounds)==null?void 0:d.target)??[]],h=(n?u?.find(f=>f.id===n):u?.[0])??null;return h&&s?{...h,...pt(c,h,h.position,!0)}:h}var uo={[ae.Left]:ae.Right,[ae.Right]:ae.Left,[ae.Top]:ae.Bottom,[ae.Bottom]:ae.Top},Md=["production","prod"];function Ot(t,...e){tr()&&console.warn(`[Vue Flow]: ${t}`,...e)}function tr(){return!Md.includes(process.env.NODE_ENV||"")}function nr(t,e,n,o,i){const s=e.querySelectorAll(`.vue-flow__handle.${t}`);return s?.length?Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:t,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/o,y:(l.top-n.top)/o,...dn(a)}}):null}function fo(t,e,n,o,i,s=!1,a){i.value=!1,t.selected?(s||t.selected&&e)&&(o([t]),(0,r.nextTick)(()=>{a.blur()})):n([t])}function _e(t){return typeof(0,r.unref)(t)<"u"}function Id(t,e,n,o){if(!t||!t.source||!t.target)return n(new we(ve.EDGE_INVALID,t?.id??"[ID UNKNOWN]")),!1;let i;return Xe(t)?i=t:i={...t,id:zi(t)},i=Ii(i,void 0,o),dd(i,e)?!1:i}function Bd(t,e,n,o,i){if(!e.source||!e.target)return i(new we(ve.EDGE_INVALID,t.id)),!1;if(!n)return i(new we(ve.EDGE_NOT_FOUND,t.id)),!1;const{id:s,...a}=t;return{...a,id:o?zi(e):s,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle}}function or(t,e,n){const o={},i=[];for(let s=0;s<t.length;++s){const a=t[s];if(!rt(a)){n(new we(ve.NODE_INVALID,a?.id));continue}const l=ad(a,e(a.id),a.parentNode);a.parentNode&&(o[a.parentNode]=!0),i[s]=l}for(const s of i){const a=e(s.parentNode)||i.find(l=>l.id===s.parentNode);s.parentNode&&!a&&n(new we(ve.NODE_MISSING_PARENT,s.id,s.parentNode)),(s.parentNode||o[s.id])&&(o[s.id]&&(s.isParent=!0),a&&(a.isParent=!0))}return i}function ir(t,e,n,o,i,s){let a=i;const l=o.get(a)||new Map;o.set(a,l.set(n,e)),a=`${i}-${t}`;const d=o.get(a)||new Map;if(o.set(a,d.set(n,e)),s){a=`${i}-${t}-${s}`;const c=o.get(a)||new Map;o.set(a,c.set(n,e))}}function ho(t,e,n){t.clear();for(const o of n){const{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=o,d={edgeId:o.id,source:i,target:s,sourceHandle:a,targetHandle:l},c=`${i}-${a}--${s}-${l}`;ir("source",d,`${s}-${l}--${i}-${a}`,t,i,a),ir("target",d,c,t,s,l)}}function rr(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function go(t,e,n,o,i,s,a,l){const d=[];for(const c of t){const u=Xe(c)?c:Id(c,l,i,s);if(!u)continue;const h=n(u.source),f=n(u.target);if(!h||!f){i(new we(ve.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!h){i(new we(ve.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!f){i(new we(ve.EDGE_TARGET_MISSING,u.id,u.target));continue}if(e&&!e(u,{edges:l,nodes:a,sourceNode:h,targetNode:f})){i(new we(ve.EDGE_INVALID,u.id));continue}const g=o(u.id);d.push({...Ii(u,g,s),sourceNode:h,targetNode:f})}return d}var sr=Symbol("vueFlow"),ar=Symbol("nodeId"),lr=Symbol("nodeRef"),zd=Symbol("edgeId"),Rd=Symbol("edgeRef"),gn=Symbol("slots");function cr(t){const{vueFlowRef:e,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:s,nodeExtent:a,nodeDragThreshold:l,viewport:d,autoPanOnNodeDrag:c,autoPanSpeed:u,nodesDraggable:h,panBy:f,findNode:g,multiSelectionActive:p,nodesSelectionActive:b,selectNodesOnDrag:S,removeSelectedElements:D,addSelectedNodes:z,updateNodePositions:v,emits:M}=ge(),{onStart:U,onDrag:$,onStop:Q,onClick:q,el:j,disabled:K,id:G,selectable:k,dragHandle:Y}=t,w=(0,r.shallowRef)(!1);let V=[],m,E=null,B={x:void 0,y:void 0},T={x:0,y:0},A=null,H=!1,F=!1,te=0,se=!1;const L=Pd(),Z=({x:ee,y:re})=>{B={x:ee,y:re};let C=!1;if(V=V.map(_=>{const N={x:ee-_.distance.x,y:re-_.distance.y},{computedPosition:x}=ao(_,n.value?hn(N,o.value):N,M.error,a.value,_.parentNode?g(_.parentNode):void 0);return C=C||_.position.x!==x.x||_.position.y!==x.y,_.position=x,_}),F=F||C,!!C&&(v(V,!0,!0),w.value=!0,A)){const[_,N]=so({id:G,dragItems:V,findNode:g});$({event:A,node:_,nodes:N})}},P=()=>{if(!E)return;const[ee,re]=Fi(T,E,u.value);if(ee!==0||re!==0){const C={x:(B.x??0)-ee/d.value.zoom,y:(B.y??0)-re/d.value.zoom};f({x:ee,y:re})&&Z(C)}te=requestAnimationFrame(P)},X=(ee,re)=>{H=!0;const C=g(G);!S.value&&!p.value&&C&&(C.selected||D()),C&&(0,r.toValue)(k)&&S.value&&fo(C,p.value,z,D,b,!1,re);const _=L(ee.sourceEvent);if(B=_,V=md(s.value,h.value,_,G),V.length){const[N,x]=so({id:G,dragItems:V,findNode:g});U({event:ee.sourceEvent,node:N,nodes:x})}},ne=(ee,re)=>{var C;ee.sourceEvent.type==="touchmove"&&ee.sourceEvent.touches.length>1||(F=!1,l.value===0&&X(ee,re),B=L(ee.sourceEvent),E=((C=e.value)==null?void 0:C.getBoundingClientRect())||null,T=Ve(ee.sourceEvent,E))},ie=(ee,re)=>{const C=L(ee.sourceEvent);if(!se&&H&&c.value&&(se=!0,P()),!H){const _=C.xSnapped-(B.x??0),N=C.ySnapped-(B.y??0);Math.sqrt(_*_+N*N)>l.value&&X(ee,re)}(B.x!==C.xSnapped||B.y!==C.ySnapped)&&V.length&&H&&(A=ee.sourceEvent,T=Ve(ee.sourceEvent,E),Z(C))},le=ee=>{let re=!1;if(!H&&!w.value&&!p.value){const C=ee.sourceEvent,_=L(C),N=_.xSnapped-(B.x??0),x=_.ySnapped-(B.y??0),y=Math.sqrt(N*N+x*x);y!==0&&y<=l.value&&(q?.(C),re=!0)}if(V.length&&!re){F&&(v(V,!1,!1),F=!1);const[C,_]=so({id:G,dragItems:V,findNode:g});Q({event:ee.sourceEvent,node:C,nodes:_})}V=[],w.value=!1,se=!1,H=!1,B={x:void 0,y:void 0},cancelAnimationFrame(te)};return(0,r.watch)([()=>(0,r.toValue)(K),j],([ee,re],C,_)=>{if(re){const N=Ie(re);ee||(m=sl().on("start",x=>ne(x,re)).on("drag",x=>ie(x,re)).on("end",x=>le(x)).filter(x=>{const y=x.target,R=(0,r.toValue)(Y);return!x.button&&(!i.value||!ji(y,`.${i.value}`,re)&&(!R||ji(y,R,re)))}),N.call(m)),_(()=>{N.on(".drag",null),m&&(m.on("start",null),m.on("drag",null),m.on("end",null))})}}),w}function Ad(){return{doubleClick:oe(),click:oe(),mouseEnter:oe(),mouseMove:oe(),mouseLeave:oe(),contextMenu:oe(),updateStart:oe(),update:oe(),updateEnd:oe()}}function $d(t,e){const n=Ad();return n.doubleClick.on(o=>{var i,s;e.edgeDoubleClick(o),(s=(i=t.events)==null?void 0:i.doubleClick)==null||s.call(i,o)}),n.click.on(o=>{var i,s;e.edgeClick(o),(s=(i=t.events)==null?void 0:i.click)==null||s.call(i,o)}),n.mouseEnter.on(o=>{var i,s;e.edgeMouseEnter(o),(s=(i=t.events)==null?void 0:i.mouseEnter)==null||s.call(i,o)}),n.mouseMove.on(o=>{var i,s;e.edgeMouseMove(o),(s=(i=t.events)==null?void 0:i.mouseMove)==null||s.call(i,o)}),n.mouseLeave.on(o=>{var i,s;e.edgeMouseLeave(o),(s=(i=t.events)==null?void 0:i.mouseLeave)==null||s.call(i,o)}),n.contextMenu.on(o=>{var i,s;e.edgeContextMenu(o),(s=(i=t.events)==null?void 0:i.contextMenu)==null||s.call(i,o)}),n.updateStart.on(o=>{var i,s;e.edgeUpdateStart(o),(s=(i=t.events)==null?void 0:i.updateStart)==null||s.call(i,o)}),n.update.on(o=>{var i,s;e.edgeUpdate(o),(s=(i=t.events)==null?void 0:i.update)==null||s.call(i,o)}),n.updateEnd.on(o=>{var i,s;e.edgeUpdateEnd(o),(s=(i=t.events)==null?void 0:i.updateEnd)==null||s.call(i,o)}),Object.entries(n).reduce((o,[i,s])=>(o.emit[i]=s.trigger,o.on[i]=s.on,o),{emit:{},on:{}})}function Pd(){const{viewport:t,snapGrid:e,snapToGrid:n,vueFlowRef:o}=ge();return i=>{var s;const a=((s=o.value)==null?void 0:s.getBoundingClientRect())??{left:0,top:0},{x:l,y:d}=Ve(Cd(i)?i.sourceEvent:i,a),c=$t({x:l,y:d},t.value),{x:u,y:h}=n.value?hn(c,e.value):c;return{xSnapped:u,ySnapped:h,...c}}}function pn(){return!0}function dr({handleId:t,nodeId:e,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:s,onEdgeUpdateEnd:a}){const{id:l,vueFlowRef:d,connectionMode:c,connectionRadius:u,connectOnClick:h,connectionClickStartHandle:f,nodesConnectable:g,autoPanOnConnect:p,autoPanSpeed:b,findNode:S,panBy:D,startConnection:z,updateConnection:v,endConnection:M,emits:U,viewport:$,edges:Q,nodes:q,isValidConnection:j,nodeLookup:K}=ge();let G=null,k=!1,Y=null;function w(m){var E;const B=(0,r.toValue)(n)==="target",T=lo(m),A=Mi(m.target),H=m.currentTarget;if(H&&(T&&m.button===0||!T)){let F=function(J){C=Ve(J,le),Z=Sd($t(C,$.value,!1,[1,1]),u.value,K.value,x),_||(N(),_=!0);const W=Ji(J,{handle:Z,connectionMode:c.value,fromNodeId:(0,r.toValue)(e),fromHandleId:(0,r.toValue)(t),fromType:B?"target":"source",isValidConnection:L,doc:A,lib:"vue",flowId:l,nodeLookup:K.value},Q.value,q.value,S,K.value);Y=W.handleDomNode,G=W.connection,k=Td(!!Z,W.isValid);const ce={...I,isValid:k,to:W.toHandle&&k?At({x:W.toHandle.x,y:W.toHandle.y},$.value):C,toHandle:W.toHandle,toPosition:k&&W.toHandle?W.toHandle.position:uo[x.position],toNode:W.toHandle?K.value.get(W.toHandle.nodeId):null};if(k&&Z&&I?.toHandle&&ce.toHandle&&I.toHandle.type===ce.toHandle.type&&I.toHandle.nodeId===ce.toHandle.nodeId&&I.toHandle.id===ce.toHandle.id&&I.to.x===ce.to.x&&I.to.y===ce.to.y)return;const fe=Z??W.toHandle;if(v(fe&&k?At({x:fe.x,y:fe.y},$.value):C,fe,Dd(!!fe,k)),I=ce,!Z&&!k&&!Y)return co(re);G&&G.source!==G.target&&Y&&(co(re),re=Y,Y.classList.add("connecting","vue-flow__handle-connecting"),Y.classList.toggle("valid",!!k),Y.classList.toggle("vue-flow__handle-valid",!!k))},te=function(J){"touches"in J&&J.touches.length>0||((Z||Y)&&G&&k&&(s?s(J,G):U.connect(G)),U.connectEnd(J),i&&a?.(J),co(re),cancelAnimationFrame(P),M(J),_=!1,k=!1,G=null,Y=null,A.removeEventListener("mousemove",F),A.removeEventListener("mouseup",te),A.removeEventListener("touchmove",F),A.removeEventListener("touchend",te))};const se=S((0,r.toValue)(e));let L=(0,r.toValue)(o)||j.value||pn;!L&&se&&(L=(B?se.isValidSourcePos:se.isValidTargetPos)||pn);let Z,P=0;const{x:X,y:ne}=Ve(m),ie=Qi((0,r.toValue)(i),H),le=(E=d.value)==null?void 0:E.getBoundingClientRect();if(!le||!ie)return;const ee=er((0,r.toValue)(e),ie,(0,r.toValue)(t),K.value,c.value);if(!ee)return;let re,C=Ve(m,le),_=!1;const N=()=>{if(!p.value)return;const[J,W]=Fi(C,le,b.value);D({x:J,y:W}),P=requestAnimationFrame(N)},x={...ee,nodeId:(0,r.toValue)(e),type:ie,position:ee.position},y=K.value.get((0,r.toValue)(e)),R={inProgress:!0,isValid:null,from:pt(y,x,ae.Left,!0),fromHandle:x,fromPosition:x.position,fromNode:y,to:C,toHandle:null,toPosition:uo[x.position],toNode:null};z({nodeId:(0,r.toValue)(e),id:(0,r.toValue)(t),type:ie,position:H?.getAttribute("data-handlepos")||ae.Top,...C},{x:X-le.left,y:ne-le.top}),U.connectStart({event:m,nodeId:(0,r.toValue)(e),handleId:(0,r.toValue)(t),handleType:ie});let I=R;A.addEventListener("mousemove",F),A.addEventListener("mouseup",te),A.addEventListener("touchmove",F),A.addEventListener("touchend",te)}}function V(m){var E,B;if(!h.value)return;const T=(0,r.toValue)(n)==="target";if(!f.value){U.clickConnectStart({event:m,nodeId:(0,r.toValue)(e),handleId:(0,r.toValue)(t)}),z({nodeId:(0,r.toValue)(e),type:(0,r.toValue)(n),id:(0,r.toValue)(t),position:ae.Top,...Ve(m)},void 0,!0);return}let A=(0,r.toValue)(o)||j.value||pn;const H=S((0,r.toValue)(e));if(!A&&H&&(A=(T?H.isValidSourcePos:H.isValidTargetPos)||pn),H&&(typeof H.connectable>"u"?g.value:H.connectable)===!1)return;const F=Mi(m.target),te=Ji(m,{handle:{nodeId:(0,r.toValue)(e),id:(0,r.toValue)(t),type:(0,r.toValue)(n),position:ae.Top,...Ve(m)},connectionMode:c.value,fromNodeId:f.value.nodeId,fromHandleId:f.value.id??null,fromType:f.value.type,isValidConnection:A,doc:F,lib:"vue",flowId:l,nodeLookup:K.value},Q.value,q.value,S,K.value),se=((E=te.connection)==null?void 0:E.source)===((B=te.connection)==null?void 0:B.target);te.isValid&&te.connection&&!se&&U.connect(te.connection),U.clickConnectEnd(m),M(m,!0)}return{handlePointerDown:w,handleClick:V}}function Od(){return(0,r.inject)(ar,"")}function ur(t){const e=t??Od()??"",n=(0,r.inject)(lr,(0,r.ref)(null)),{findNode:o,edges:i,emits:s}=ge(),a=o(e);return a||s.error(new we(ve.NODE_NOT_FOUND,e)),{id:e,nodeEl:n,node:a,parentNode:(0,r.computed)(()=>o(a.parentNode)),connectedEdges:(0,r.computed)(()=>Pi([a],i.value))}}function Vd(){return{doubleClick:oe(),click:oe(),mouseEnter:oe(),mouseMove:oe(),mouseLeave:oe(),contextMenu:oe(),dragStart:oe(),drag:oe(),dragStop:oe()}}function Hd(t,e){const n=Vd();return n.doubleClick.on(o=>{var i,s;e.nodeDoubleClick(o),(s=(i=t.events)==null?void 0:i.doubleClick)==null||s.call(i,o)}),n.click.on(o=>{var i,s;e.nodeClick(o),(s=(i=t.events)==null?void 0:i.click)==null||s.call(i,o)}),n.mouseEnter.on(o=>{var i,s;e.nodeMouseEnter(o),(s=(i=t.events)==null?void 0:i.mouseEnter)==null||s.call(i,o)}),n.mouseMove.on(o=>{var i,s;e.nodeMouseMove(o),(s=(i=t.events)==null?void 0:i.mouseMove)==null||s.call(i,o)}),n.mouseLeave.on(o=>{var i,s;e.nodeMouseLeave(o),(s=(i=t.events)==null?void 0:i.mouseLeave)==null||s.call(i,o)}),n.contextMenu.on(o=>{var i,s;e.nodeContextMenu(o),(s=(i=t.events)==null?void 0:i.contextMenu)==null||s.call(i,o)}),n.dragStart.on(o=>{var i,s;e.nodeDragStart(o),(s=(i=t.events)==null?void 0:i.dragStart)==null||s.call(i,o)}),n.drag.on(o=>{var i,s;e.nodeDrag(o),(s=(i=t.events)==null?void 0:i.drag)==null||s.call(i,o)}),n.dragStop.on(o=>{var i,s;e.nodeDragStop(o),(s=(i=t.events)==null?void 0:i.dragStop)==null||s.call(i,o)}),Object.entries(n).reduce((o,[i,s])=>(o.emit[i]=s.trigger,o.on[i]=s.on,o),{emit:{},on:{}})}function fr(){const{getSelectedNodes:t,nodeExtent:e,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:s,nodesDraggable:a,emits:l}=ge();return(d,c=!1)=>{const u=s.value?i.value[0]:5,h=s.value?i.value[1]:5,f=c?4:1,g=d.x*u*f,p=d.y*h*f,b=[];for(const S of t.value)if(S.draggable||a&&typeof S.draggable>"u"){const{position:D}=ao(S,{x:S.computedPosition.x+g,y:S.computedPosition.y+p},l.error,e.value,S.parentNode?o(S.parentNode):void 0);b.push({id:S.id,position:D,from:S.position,distance:{x:d.x,y:d.y},dimensions:S.dimensions})}n(b,!0,!1)}}var mn=.1,Ld=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2;function Ke(){return Ot("Viewport not initialized yet."),Promise.resolve(!1)}var Fd={zoomIn:Ke,zoomOut:Ke,zoomTo:Ke,fitView:Ke,setCenter:Ke,fitBounds:Ke,project:t=>t,screenToFlowCoordinate:t=>t,flowToScreenCoordinate:t=>t,setViewport:Ke,setTransform:Ke,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Gd(t){function e(o,i){return new Promise(s=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(i?.interpolate==="linear"?kt:qt).scaleBy(po(t.d3Selection,i?.duration,i?.ease,()=>{s(!0)}),o):s(!1)})}function n(o,i,s,a){return new Promise(l=>{var d;const{x:c,y:u}=Ti({x:-o,y:-i},t.translateExtent),h=ft.translate(-c,-u).scale(s);t.d3Selection&&t.d3Zoom?(d=t.d3Zoom)==null||d.interpolate(a?.interpolate==="linear"?kt:qt).transform(po(t.d3Selection,a?.duration,a?.ease,()=>{l(!0)}),h):l(!1)})}return(0,r.computed)(()=>t.d3Zoom&&t.d3Selection&&t.dimensions.width&&t.dimensions.height?{viewportInitialized:!0,zoomIn:o=>e(1.2,o),zoomOut:o=>e(1/1.2,o),zoomTo:(o,i)=>new Promise(s=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(i?.interpolate==="linear"?kt:qt).scaleTo(po(t.d3Selection,i?.duration,i?.ease,()=>{s(!0)}),o):s(!1)}),setViewport:(o,i)=>n(o.x,o.y,o.zoom,i),setTransform:(o,i)=>n(o.x,o.y,o.zoom,i),getViewport:()=>({x:t.viewport.x,y:t.viewport.y,zoom:t.viewport.zoom}),getTransform:()=>({x:t.viewport.x,y:t.viewport.y,zoom:t.viewport.zoom}),fitView:(o={padding:mn,includeHiddenNodes:!1,duration:0})=>{var i,s;const a=[];for(const u of t.nodes)u.dimensions.width&&u.dimensions.height&&(o?.includeHiddenNodes||!u.hidden)&&(!((i=o.nodes)!=null&&i.length)||(s=o.nodes)!=null&&s.length&&o.nodes.includes(u.id))&&a.push(u);if(!a.length)return Promise.resolve(!1);const{x:l,y:d,zoom:c}=Oi(Ai(a),t.dimensions.width,t.dimensions.height,o.minZoom??t.minZoom,o.maxZoom??t.maxZoom,o.padding??mn);return n(l,d,c,o)},setCenter:(o,i,s)=>{const a=typeof s?.zoom<"u"?s.zoom:t.maxZoom;return n(t.dimensions.width/2-o*a,t.dimensions.height/2-i*a,a,s)},fitBounds:(o,i={padding:mn})=>{const{x:s,y:a,zoom:l}=Oi(o,t.dimensions.width,t.dimensions.height,t.minZoom,t.maxZoom,i.padding??mn);return n(s,a,l,i)},project:o=>$t(o,t.viewport,t.snapToGrid,t.snapGrid),screenToFlowCoordinate:o=>{if(t.vueFlowRef){const{x:i,y:s}=t.vueFlowRef.getBoundingClientRect();return $t({x:o.x-i,y:o.y-s},t.viewport,t.snapToGrid,t.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:o=>{if(t.vueFlowRef){const{x:i,y:s}=t.vueFlowRef.getBoundingClientRect();return At({x:o.x+i,y:o.y+s},t.viewport)}return{x:0,y:0}}}:Fd)}function po(t,e=0,n=Ld,o=()=>{}){const i=typeof e=="number"&&e>0;return i||o(),i?t.transition().duration(e).ease(n).on("end",o):t}function Wd(t,e,n){const o=(0,r.effectScope)(!0);return o.run(()=>{const i=()=>{o.run(()=>{let b,S,D=!!(n.nodes.value.length||n.edges.value.length);b=at([t.modelValue,()=>{var z,v;return(v=(z=t.modelValue)==null?void 0:z.value)==null?void 0:v.length}],([z])=>{z&&Array.isArray(z)&&(S?.pause(),n.setElements(z),!S&&!D&&z.length?D=!0:S?.resume())}),S=at([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([z,v])=>{var M;(M=t.modelValue)!=null&&M.value&&Array.isArray(t.modelValue.value)&&(b?.pause(),t.modelValue.value=[...z,...v],(0,r.nextTick)(()=>{b?.resume()}))},{immediate:D}),(0,r.onScopeDispose)(()=>{b?.stop(),S?.stop()})})},s=()=>{o.run(()=>{let b,S,D=!!n.nodes.value.length;b=at([t.nodes,()=>{var z,v;return(v=(z=t.nodes)==null?void 0:z.value)==null?void 0:v.length}],([z])=>{z&&Array.isArray(z)&&(S?.pause(),n.setNodes(z),!S&&!D&&z.length?D=!0:S?.resume())}),S=at([n.nodes,()=>n.nodes.value.length],([z])=>{var v;(v=t.nodes)!=null&&v.value&&Array.isArray(t.nodes.value)&&(b?.pause(),t.nodes.value=[...z],(0,r.nextTick)(()=>{b?.resume()}))},{immediate:D}),(0,r.onScopeDispose)(()=>{b?.stop(),S?.stop()})})},a=()=>{o.run(()=>{let b,S,D=!!n.edges.value.length;b=at([t.edges,()=>{var z,v;return(v=(z=t.edges)==null?void 0:z.value)==null?void 0:v.length}],([z])=>{z&&Array.isArray(z)&&(S?.pause(),n.setEdges(z),!S&&!D&&z.length?D=!0:S?.resume())}),S=at([n.edges,()=>n.edges.value.length],([z])=>{var v;(v=t.edges)!=null&&v.value&&Array.isArray(t.edges.value)&&(b?.pause(),t.edges.value=[...z],(0,r.nextTick)(()=>{b?.resume()}))},{immediate:D}),(0,r.onScopeDispose)(()=>{b?.stop(),S?.stop()})})},l=()=>{o.run(()=>{(0,r.watch)(()=>e.maxZoom,()=>{e.maxZoom&&_e(e.maxZoom)&&n.setMaxZoom(e.maxZoom)},{immediate:!0})})},d=()=>{o.run(()=>{(0,r.watch)(()=>e.minZoom,()=>{e.minZoom&&_e(e.minZoom)&&n.setMinZoom(e.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{(0,r.watch)(()=>e.translateExtent,()=>{e.translateExtent&&_e(e.translateExtent)&&n.setTranslateExtent(e.translateExtent)},{immediate:!0})})},u=()=>{o.run(()=>{(0,r.watch)(()=>e.nodeExtent,()=>{e.nodeExtent&&_e(e.nodeExtent)&&n.setNodeExtent(e.nodeExtent)},{immediate:!0})})},h=()=>{o.run(()=>{(0,r.watch)(()=>e.applyDefault,()=>{_e(e.applyDefault)&&(n.applyDefault.value=e.applyDefault)},{immediate:!0})})},f=()=>{o.run(()=>{const b=async S=>{let D=S;typeof e.autoConnect=="function"&&(D=await e.autoConnect(S)),D!==!1&&n.addEdges([D])};(0,r.watch)(()=>e.autoConnect,()=>{_e(e.autoConnect)&&(n.autoConnect.value=e.autoConnect)},{immediate:!0}),(0,r.watch)(n.autoConnect,(S,D,z)=>{S?n.onConnect(b):n.hooks.value.connect.off(b),z(()=>{n.hooks.value.connect.off(b)})},{immediate:!0})})},g=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const S of Object.keys(e)){const D=S;if(!b.includes(D)){const z=(0,r.toRef)(()=>e[D]),v=n[D];(0,r.isRef)(v)&&o.run(()=>{(0,r.watch)(z,M=>{_e(M)&&(v.value=M)},{immediate:!0})})}}};i(),s(),a(),d(),l(),c(),u(),h(),f(),g()}),()=>o.stop()}function Ud(){return{edgesChange:oe(),nodesChange:oe(),nodeDoubleClick:oe(),nodeClick:oe(),nodeMouseEnter:oe(),nodeMouseMove:oe(),nodeMouseLeave:oe(),nodeContextMenu:oe(),nodeDragStart:oe(),nodeDrag:oe(),nodeDragStop:oe(),nodesInitialized:oe(),miniMapNodeClick:oe(),miniMapNodeDoubleClick:oe(),miniMapNodeMouseEnter:oe(),miniMapNodeMouseMove:oe(),miniMapNodeMouseLeave:oe(),connect:oe(),connectStart:oe(),connectEnd:oe(),clickConnectStart:oe(),clickConnectEnd:oe(),paneReady:oe(),init:oe(),move:oe(),moveStart:oe(),moveEnd:oe(),selectionDragStart:oe(),selectionDrag:oe(),selectionDragStop:oe(),selectionContextMenu:oe(),selectionStart:oe(),selectionEnd:oe(),viewportChangeStart:oe(),viewportChange:oe(),viewportChangeEnd:oe(),paneScroll:oe(),paneClick:oe(),paneContextMenu:oe(),paneMouseEnter:oe(),paneMouseMove:oe(),paneMouseLeave:oe(),edgeContextMenu:oe(),edgeMouseEnter:oe(),edgeMouseMove:oe(),edgeMouseLeave:oe(),edgeDoubleClick:oe(),edgeClick:oe(),edgeUpdateStart:oe(),edgeUpdate:oe(),edgeUpdateEnd:oe(),updateNodeInternals:oe(),error:oe(t=>Ot(t.message))}}function Yd(t,e){const n=(0,r.getCurrentInstance)();(0,r.onBeforeMount)(()=>{for(const[i,s]of Object.entries(e.value)){const a=l=>{t(i,l)};s.setEmitter(a),wt(s.removeEmitter),s.setHasEmitListeners(()=>o(i)),wt(s.removeHasEmitListeners)}});function o(i){var s;const a=Xd(i);return!!((s=n?.vnode.props)!=null&&s[a])}}function Xd(t){const[e,...n]=t.split(":");return`on${e.replace(/(?:^|-)(\w)/g,(o,i)=>i.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function hr(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:oo.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Bt.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:ot.Bezier,style:{}},connectionMode:We.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:fn()?"Meta":"Control",zoomActivationKeyCode:fn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Ud(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}var jd=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Zd(t,e,n){const o=Gd(t),i=C=>{const _=C??[];t.hooks.updateNodeInternals.trigger(_)},s=C=>cd(C,t.nodes,t.edges),a=C=>ld(C,t.nodes,t.edges),l=C=>Pi(C,t.edges),d=({id:C,type:_,nodeId:N})=>{var x;const y=C?`-${_}-${C}`:`-${_}`;return Array.from(((x=t.connectionLookup.get(`${N}${y}`))==null?void 0:x.values())??[])},c=C=>{if(C)return e.value.get(C)},u=C=>{if(C)return n.value.get(C)},h=(C,_,N)=>{var x,y;const R=[];for(const I of C){const J={id:I.id,type:"position",dragging:N,from:I.from};if(_&&(J.position=I.position,I.parentNode)){const W=c(I.parentNode);J.position={x:J.position.x-(((x=W?.computedPosition)==null?void 0:x.x)??0),y:J.position.y-(((y=W?.computedPosition)==null?void 0:y.y)??0)}}R.push(J)}R?.length&&t.hooks.nodesChange.trigger(R)},f=C=>{if(!t.vueFlowRef)return;const _=t.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!_)return;const N=window.getComputedStyle(_),{m22:x}=new window.DOMMatrixReadOnly(N.transform),y=[];for(const R of C){const I=R,J=c(I.id);if(J){const W=dn(I.nodeElement);if(W.width&&W.height&&(J.dimensions.width!==W.width||J.dimensions.height!==W.height||I.forceUpdate)){const ce=I.nodeElement.getBoundingClientRect();J.dimensions=W,J.handleBounds.source=nr("source",I.nodeElement,ce,x,J.id),J.handleBounds.target=nr("target",I.nodeElement,ce,x,J.id),y.push({id:J.id,type:"dimensions",dimensions:W})}}}!t.fitViewOnInitDone&&t.fitViewOnInit&&o.value.fitView().then(()=>{t.fitViewOnInitDone=!0}),y.length&&t.hooks.nodesChange.trigger(y)},g=(C,_)=>{const N=new Set,x=new Set;for(const I of C)rt(I)?N.add(I.id):Xe(I)&&x.add(I.id);const y=Ze(e.value,N,!0),R=Ze(n.value,x);if(t.multiSelectionActive){for(const I of N)y.push(je(I,_));for(const I of x)R.push(je(I,_))}y.length&&t.hooks.nodesChange.trigger(y),R.length&&t.hooks.edgesChange.trigger(R)},p=C=>{if(t.multiSelectionActive){const _=C.map(N=>je(N.id,!0));t.hooks.nodesChange.trigger(_);return}t.hooks.nodesChange.trigger(Ze(e.value,new Set(C.map(_=>_.id)),!0)),t.hooks.edgesChange.trigger(Ze(n.value))},b=C=>{if(t.multiSelectionActive){const _=C.map(N=>je(N.id,!0));t.hooks.edgesChange.trigger(_);return}t.hooks.edgesChange.trigger(Ze(n.value,new Set(C.map(_=>_.id)))),t.hooks.nodesChange.trigger(Ze(e.value,new Set,!0))},S=C=>{g(C,!0)},D=C=>{const _=(C||t.nodes).map(N=>(N.selected=!1,je(N.id,!1)));t.hooks.nodesChange.trigger(_)},z=C=>{const _=(C||t.edges).map(N=>(N.selected=!1,je(N.id,!1)));t.hooks.edgesChange.trigger(_)},v=C=>{if(!C||!C.length)return g([],!1);const _=C.reduce((N,x)=>{const y=je(x.id,!1);return rt(x)?N.nodes.push(y):N.edges.push(y),N},{nodes:[],edges:[]});_.nodes.length&&t.hooks.nodesChange.trigger(_.nodes),_.edges.length&&t.hooks.edgesChange.trigger(_.edges)},M=C=>{var _;(_=t.d3Zoom)==null||_.scaleExtent([C,t.maxZoom]),t.minZoom=C},U=C=>{var _;(_=t.d3Zoom)==null||_.scaleExtent([t.minZoom,C]),t.maxZoom=C},$=C=>{var _;(_=t.d3Zoom)==null||_.translateExtent(C),t.translateExtent=C},Q=C=>{t.nodeExtent=C,i()},q=C=>{var _;(_=t.d3Zoom)==null||_.clickDistance(C)},j=C=>{t.nodesDraggable=C,t.nodesConnectable=C,t.elementsSelectable=C},K=C=>{const _=C instanceof Function?C(t.nodes):C;!t.initialized&&!_.length||(t.nodes=or(_,c,t.hooks.error.trigger))},G=C=>{const _=C instanceof Function?C(t.edges):C;if(!t.initialized&&!_.length)return;const N=go(_,t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);ho(t.connectionLookup,n.value,N),t.edges=N},k=C=>{const _=C instanceof Function?C([...t.nodes,...t.edges]):C;!t.initialized&&!_.length||(K(_.filter(rt)),G(_.filter(Xe)))},Y=C=>{let _=C instanceof Function?C(t.nodes):C;_=Array.isArray(_)?_:[_];const N=or(_,c,t.hooks.error.trigger),x=[];for(const y of N)x.push(Wi(y));x.length&&t.hooks.nodesChange.trigger(x)},w=C=>{let _=C instanceof Function?C(t.edges):C;_=Array.isArray(_)?_:[_];const N=go(_,t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges),x=[];for(const y of N)x.push(Wi(y));x.length&&t.hooks.edgesChange.trigger(x)},V=(C,_=!0,N=!1)=>{const x=C instanceof Function?C(t.nodes):C,y=Array.isArray(x)?x:[x],R=[],I=[];function J(ce){const fe=l(ce);for(const he of fe)(!_e(he.deletable)||he.deletable)&&I.push(Yi(he.id,he.source,he.target,he.sourceHandle,he.targetHandle))}function W(ce){const fe=[];for(const he of t.nodes)he.parentNode===ce&&fe.push(he);if(fe.length){for(const he of fe)R.push(Ui(he.id));_&&J(fe);for(const he of fe)W(he.id)}}for(const ce of y){const fe=typeof ce=="string"?c(ce):ce;fe&&(_e(fe.deletable)&&!fe.deletable||(R.push(Ui(fe.id)),_&&J([fe]),N&&W(fe.id)))}I.length&&t.hooks.edgesChange.trigger(I),R.length&&t.hooks.nodesChange.trigger(R)},m=C=>{const _=C instanceof Function?C(t.edges):C,N=Array.isArray(_)?_:[_],x=[];for(const y of N){const R=typeof y=="string"?u(y):y;R&&(_e(R.deletable)&&!R.deletable||x.push(Yi(typeof y=="string"?y:y.id,R.source,R.target,R.sourceHandle,R.targetHandle)))}t.hooks.edgesChange.trigger(x)},E=(C,_,N=!0)=>{const x=u(C.id);if(!x)return!1;const y=t.edges.indexOf(x),R=Bd(C,_,x,N,t.hooks.error.trigger);if(R){const[I]=go([R],t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);return t.edges=t.edges.map((J,W)=>W===y?I:J),ho(t.connectionLookup,n.value,[I]),I}return!1},B=(C,_,N={replace:!1})=>{const x=u(C);if(!x)return;const y=typeof _=="function"?_(x):_;x.data=N.replace?y:{...x.data,...y}},T=C=>Gi(C,t.nodes),A=C=>{const _=Gi(C,t.edges);return ho(t.connectionLookup,n.value,_),_},H=(C,_,N={replace:!1})=>{const x=c(C);if(!x)return;const y=typeof _=="function"?_(x):_;N.replace?t.nodes.splice(t.nodes.indexOf(x),1,y):Object.assign(x,y)},F=(C,_,N={replace:!1})=>{const x=c(C);if(!x)return;const y=typeof _=="function"?_(x):_;x.data=N.replace?y:{...x.data,...y}},te=(C,_,N=!1)=>{N?t.connectionClickStartHandle=C:t.connectionStartHandle=C,t.connectionEndHandle=null,t.connectionStatus=null,_&&(t.connectionPosition=_)},se=(C,_=null,N=null)=>{t.connectionStartHandle&&(t.connectionPosition=C,t.connectionEndHandle=_,t.connectionStatus=N)},L=(C,_)=>{t.connectionPosition={x:NaN,y:NaN},t.connectionEndHandle=null,t.connectionStatus=null,_?t.connectionClickStartHandle=null:t.connectionStartHandle=null},Z=C=>{const _=sd(C),N=_?null:Rt(C)?C:c(C.id);return!_&&!N?[null,null,_]:[_?C:ln(N),N,_]},P=(C,_=!0,N=t.nodes)=>{const[x,y,R]=Z(C);if(!x)return[];const I=[];for(const J of N||t.nodes){if(!R&&(J.id===y.id||!J.computedPosition))continue;const W=ln(J),ce=cn(W,x);(_&&ce>0||ce>=W.width*W.height||ce>=Number(x.width)*Number(x.height))&&I.push(J)}return I},X=(C,_,N=!0)=>{const[x]=Z(C);if(!x)return!1;const y=cn(x,_);return N&&y>0||y>=Number(x.width)*Number(x.height)},ne=C=>{const{viewport:_,dimensions:N,d3Zoom:x,d3Selection:y,translateExtent:R}=t;if(!x||!y||!C.x&&!C.y)return!1;const I=ft.translate(_.x+C.x,_.y+C.y).scale(_.zoom),J=[[0,0],[N.width,N.height]],W=x.constrain()(I,J,R),ce=t.viewport.x!==W.x||t.viewport.y!==W.y||t.viewport.zoom!==W.k;return x.transform(y,W),ce},ie=C=>{const _=C instanceof Function?C(t):C,N=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];_e(_.defaultEdgeOptions)&&(t.defaultEdgeOptions=_.defaultEdgeOptions);const x=_.modelValue||_.nodes||_.edges?[]:void 0;x&&(_.modelValue&&x.push(..._.modelValue),_.nodes&&x.push(..._.nodes),_.edges&&x.push(..._.edges),k(x));const y=()=>{_e(_.maxZoom)&&U(_.maxZoom),_e(_.minZoom)&&M(_.minZoom),_e(_.translateExtent)&&$(_.translateExtent)};for(const R of Object.keys(_)){const I=R,J=_[I];![...jd,...N].includes(I)&&_e(J)&&(t[I]=J)}$n(()=>t.d3Zoom).not.toBeNull().then(y),t.initialized||(t.initialized=!0)};return{updateNodePositions:h,updateNodeDimensions:f,setElements:k,setNodes:K,setEdges:G,addNodes:Y,addEdges:w,removeNodes:V,removeEdges:m,findNode:c,findEdge:u,updateEdge:E,updateEdgeData:B,updateNode:H,updateNodeData:F,applyEdgeChanges:A,applyNodeChanges:T,addSelectedElements:S,addSelectedNodes:p,addSelectedEdges:b,setMinZoom:M,setMaxZoom:U,setTranslateExtent:$,setNodeExtent:Q,setPaneClickDistance:q,removeSelectedElements:v,removeSelectedNodes:D,removeSelectedEdges:z,startConnection:te,updateConnection:se,endConnection:L,setInteractive:j,setState:ie,getIntersectingNodes:P,getIncomers:s,getOutgoers:a,getConnectedEdges:l,getHandleConnections:d,isNodeIntersecting:X,panBy:ne,fitView:C=>o.value.fitView(C),zoomIn:C=>o.value.zoomIn(C),zoomOut:C=>o.value.zoomOut(C),zoomTo:(C,_)=>o.value.zoomTo(C,_),setViewport:(C,_)=>o.value.setViewport(C,_),setTransform:(C,_)=>o.value.setTransform(C,_),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(C,_,N)=>o.value.setCenter(C,_,N),fitBounds:(C,_)=>o.value.fitBounds(C,_),project:C=>o.value.project(C),screenToFlowCoordinate:C=>o.value.screenToFlowCoordinate(C),flowToScreenCoordinate:C=>o.value.flowToScreenCoordinate(C),toObject:()=>{const C=[],_=[];for(const N of t.nodes){const{computedPosition:x,handleBounds:y,selected:R,dimensions:I,isParent:J,resizing:W,dragging:ce,events:fe,...he}=N;C.push(he)}for(const N of t.edges){const{selected:x,sourceNode:y,targetNode:R,events:I,...J}=N;_.push(J)}return JSON.parse(JSON.stringify({nodes:C,edges:_,position:[t.viewport.x,t.viewport.y],zoom:t.viewport.zoom,viewport:t.viewport}))},fromObject:C=>new Promise(_=>{const{nodes:N,edges:x,position:y,zoom:R,viewport:I}=C;N&&K(N),x&&G(x);const[J,W]=I?.x&&I?.y?[I.x,I.y]:y??[null,null];if(J&&W){const ce=I?.zoom||R||t.viewport.zoom;return $n(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:J,y:W,zoom:ce}).then(()=>{_(!0)})})}else _(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const C=hr();if(t.edges=[],t.nodes=[],t.d3Zoom&&t.d3Selection){const _=ft.translate(C.defaultViewport.x??0,C.defaultViewport.y??0).scale(it(C.defaultViewport.zoom??1,C.minZoom,C.maxZoom)),N=t.viewportRef.getBoundingClientRect(),x=[[0,0],[N.width,N.height]],y=t.d3Zoom.constrain()(_,x,C.translateExtent);t.d3Zoom.transform(t.d3Selection,y)}ie(C)},$destroy:()=>{}}}var Kd=["data-id","data-handleid","data-nodeid","data-handlepos"],mt=(0,r.defineComponent)({name:"Handle",compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>ae.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(t,{expose:e}){const n=(0,r.createPropsRestProxy)(t,["position","connectable","connectableStart","connectableEnd","id"]),o=(0,r.toRef)(()=>n.type??"source"),i=(0,r.toRef)(()=>n.isValidConnection??null),{id:s,connectionStartHandle:a,connectionClickStartHandle:l,connectionEndHandle:d,vueFlowRef:c,nodesConnectable:u,noDragClassName:h,noPanClassName:f}=ge(),{id:g,node:p,nodeEl:b,connectedEdges:S}=ur(),D=(0,r.ref)(),z=(0,r.toRef)(()=>typeof t.connectableStart<"u"?t.connectableStart:!0),v=(0,r.toRef)(()=>typeof t.connectableEnd<"u"?t.connectableEnd:!0),M=(0,r.toRef)(()=>{var G,k,Y,w,V,m;return((G=a.value)==null?void 0:G.nodeId)===g&&((k=a.value)==null?void 0:k.id)===t.id&&((Y=a.value)==null?void 0:Y.type)===o.value||((w=d.value)==null?void 0:w.nodeId)===g&&((V=d.value)==null?void 0:V.id)===t.id&&((m=d.value)==null?void 0:m.type)===o.value}),U=(0,r.toRef)(()=>{var G,k,Y;return((G=l.value)==null?void 0:G.nodeId)===g&&((k=l.value)==null?void 0:k.id)===t.id&&((Y=l.value)==null?void 0:Y.type)===o.value}),{handlePointerDown:$,handleClick:Q}=dr({nodeId:g,handleId:t.id,isValidConnection:i,type:o}),q=(0,r.computed)(()=>typeof t.connectable=="string"&&t.connectable==="single"?!S.value.some(G=>{const k=G[`${o.value}Handle`];return G[o.value]!==g?!1:k?k===t.id:!0}):typeof t.connectable=="number"?S.value.filter(G=>{const k=G[`${o.value}Handle`];return G[o.value]!==g?!1:k?k===t.id:!0}).length<t.connectable:typeof t.connectable=="function"?t.connectable(p,S.value):_e(t.connectable)?t.connectable:u.value);(0,r.onMounted)(()=>{var G;if(!p.dimensions.width||!p.dimensions.height)return;const k=(G=p.handleBounds[o.value])==null?void 0:G.find(T=>T.id===t.id);if(!c.value||k)return;const Y=c.value.querySelector(".vue-flow__transformationpane");if(!b.value||!D.value||!Y||!t.id)return;const w=b.value.getBoundingClientRect(),V=D.value.getBoundingClientRect(),m=window.getComputedStyle(Y),{m22:E}=new window.DOMMatrixReadOnly(m.transform),B={id:t.id,position:t.position,x:(V.left-w.left)/E,y:(V.top-w.top)/E,type:o.value,nodeId:g,...dn(D.value)};p.handleBounds[o.value]=[...p.handleBounds[o.value]??[],B]});function j(G){const k=lo(G);q.value&&z.value&&(k&&G.button===0||!k)&&$(G)}function K(G){!g||!l.value&&!z.value||q.value&&Q(G)}return e({handleClick:Q,handlePointerDown:$,onClick:K,onPointerDown:j}),(G,k)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{ref_key:"handle",ref:D,"data-id":`${(0,r.unref)(s)}-${(0,r.unref)(g)}-${t.id}-${o.value}`,"data-handleid":t.id,"data-nodeid":(0,r.unref)(g),"data-handlepos":G.position,class:(0,r.normalizeClass)(["vue-flow__handle",[`vue-flow__handle-${G.position}`,`vue-flow__handle-${t.id}`,(0,r.unref)(h),(0,r.unref)(f),o.value,{connectable:q.value,connecting:U.value,connectablestart:z.value,connectableend:v.value,connectionindicator:q.value&&(z.value&&!M.value||v.value&&M.value)}]]),onMousedown:j,onTouchstartPassive:j,onClick:K},[(0,r.renderSlot)(G.$slots,"default",{id:G.id})],42,Kd))}}),yn=function({sourcePosition:t=ae.Bottom,targetPosition:e=ae.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:s,data:a}){const l=a.label??n;return[(0,r.h)(mt,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?(0,r.h)(l):(0,r.h)(r.Fragment,[l]),(0,r.h)(mt,{type:"source",position:t,connectable:o,isValidConnection:s})]};yn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],yn.inheritAttrs=!1,yn.compatConfig={MODE:3};var qd=yn,vn=function({targetPosition:t=ae.Top,label:e,connectable:n=!0,isValidTargetPos:o,data:i}){const s=i.label??e;return[(0,r.h)(mt,{type:"target",position:t,connectable:n,isValidConnection:o}),typeof s!="string"&&s?(0,r.h)(s):(0,r.h)(r.Fragment,[s])]};vn.props=["targetPosition","label","isValidTargetPos","connectable","data"],vn.inheritAttrs=!1,vn.compatConfig={MODE:3};var Jd=vn,_n=function({sourcePosition:t=ae.Bottom,label:e,connectable:n=!0,isValidSourcePos:o,data:i}){const s=i.label??e;return[typeof s!="string"&&s?(0,r.h)(s):(0,r.h)(r.Fragment,[s]),(0,r.h)(mt,{type:"source",position:t,connectable:n,isValidConnection:o})]};_n.props=["sourcePosition","label","isValidSourcePos","connectable","data"],_n.inheritAttrs=!1,_n.compatConfig={MODE:3};var Qd=_n,eu=["transform"],tu=["width","height","x","y","rx","ry"],nu=["y"],ou=(0,r.defineComponent)({name:"EdgeText",compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(t){const e=(0,r.ref)({x:0,y:0,width:0,height:0}),n=(0,r.ref)(null),o=(0,r.computed)(()=>`translate(${t.x-e.value.width/2} ${t.y-e.value.height/2})`);(0,r.onMounted)(i),(0,r.watch)([()=>t.x,()=>t.y,n,()=>t.label],i);function i(){if(!n.value)return;const s=n.value.getBBox();(s.width!==e.value.width||s.height!==e.value.height)&&(e.value=s)}return(s,a)=>((0,r.openBlock)(),(0,r.createElementBlock)("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[s.labelShowBg?((0,r.openBlock)(),(0,r.createElementBlock)("rect",{key:0,class:"vue-flow__edge-textbg",width:`${e.value.width+2*s.labelBgPadding[0]}px`,height:`${e.value.height+2*s.labelBgPadding[1]}px`,x:-s.labelBgPadding[0],y:-s.labelBgPadding[1],style:(0,r.normalizeStyle)(s.labelBgStyle),rx:s.labelBgBorderRadius,ry:s.labelBgBorderRadius},null,12,tu)):(0,r.createCommentVNode)("",!0),(0,r.createElementVNode)("text",(0,r.mergeProps)(s.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:e.value.height/2,dy:"0.3em",style:s.labelStyle}),[(0,r.renderSlot)(s.$slots,"default",{},()=>[typeof s.label!="string"?((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(s.label),{key:0})):((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[(0,r.createTextVNode)((0,r.toDisplayString)(s.label),1)],64))])],16,nu)],8,eu))}}),iu=["id","d","marker-end","marker-start"],ru=["d","stroke-width"],Vt=(0,r.defineComponent)({name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(t,{expose:e}){const n=(0,r.ref)(null),o=(0,r.ref)(null),i=(0,r.ref)(null),s=(0,r.useAttrs)();return e({pathEl:n,interactionEl:o,labelEl:i}),(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createElementVNode)("path",(0,r.mergeProps)((0,r.unref)(s),{id:a.id,ref_key:"pathEl",ref:n,d:a.path,class:"vue-flow__edge-path","marker-end":a.markerEnd,"marker-start":a.markerStart}),null,16,iu),a.interactionWidth?((0,r.openBlock)(),(0,r.createElementBlock)("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:a.path,"stroke-width":a.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,ru)):(0,r.createCommentVNode)("",!0),a.label&&a.labelX&&a.labelY?((0,r.openBlock)(),(0,r.createBlock)(ou,{key:1,ref_key:"labelEl",ref:i,x:a.labelX,y:a.labelY,label:a.label,"label-show-bg":a.labelShowBg,"label-bg-style":a.labelBgStyle,"label-bg-padding":a.labelBgPadding,"label-bg-border-radius":a.labelBgBorderRadius,"label-style":a.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):(0,r.createCommentVNode)("",!0)],64))}});function gr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const i=Math.abs(n-t)/2,s=n<t?n+i:n-i,a=Math.abs(o-e)/2;return[s,o<e?o+a:o-a,i,a]}function pr({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){const d=t*.125+i*.375+a*.375+n*.125,c=e*.125+s*.375+l*.375+o*.125;return[d,c,Math.abs(d-t),Math.abs(c-e)]}function wn(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function mr({pos:t,x1:e,y1:n,x2:o,y2:i,c:s}){let a,l;switch(t){case ae.Left:a=e-wn(e-o,s),l=n;break;case ae.Right:a=e+wn(o-e,s),l=n;break;case ae.Top:a=e,l=n-wn(n-i,s);break;case ae.Bottom:a=e,l=n+wn(i-n,s);break}return[a,l]}function mo(t){const{sourceX:e,sourceY:n,sourcePosition:o=ae.Bottom,targetX:i,targetY:s,targetPosition:a=ae.Top,curvature:l=.25}=t,[d,c]=mr({pos:o,x1:e,y1:n,x2:i,y2:s,c:l}),[u,h]=mr({pos:a,x1:i,y1:s,x2:e,y2:n,c:l}),[f,g,p,b]=pr({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:d,sourceControlY:c,targetControlX:u,targetControlY:h});return[`M${e},${n} C${d},${c} ${u},${h} ${i},${s}`,f,g,p,b]}function yr({pos:t,x1:e,y1:n,x2:o,y2:i}){let s,a;switch(t){case ae.Left:case ae.Right:s=.5*(e+o),a=n;break;case ae.Top:case ae.Bottom:s=e,a=.5*(n+i);break}return[s,a]}function vr(t){const{sourceX:e,sourceY:n,sourcePosition:o=ae.Bottom,targetX:i,targetY:s,targetPosition:a=ae.Top}=t,[l,d]=yr({pos:o,x1:e,y1:n,x2:i,y2:s}),[c,u]=yr({pos:a,x1:i,y1:s,x2:e,y2:n}),[h,f,g,p]=pr({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:l,sourceControlY:d,targetControlX:c,targetControlY:u});return[`M${e},${n} C${l},${d} ${c},${u} ${i},${s}`,h,f,g,p]}var _r={[ae.Left]:{x:-1,y:0},[ae.Right]:{x:1,y:0},[ae.Top]:{x:0,y:-1},[ae.Bottom]:{x:0,y:1}};function su({source:t,sourcePosition:e=ae.Bottom,target:n}){return e===ae.Left||e===ae.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1}}function wr(t,e){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function au({source:t,sourcePosition:e=ae.Bottom,target:n,targetPosition:o=ae.Top,center:i,offset:s}){const a=_r[e],l=_r[o],d={x:t.x+a.x*s,y:t.y+a.y*s},c={x:n.x+l.x*s,y:n.y+l.y*s},u=su({source:d,sourcePosition:e,target:c}),h=u.x!==0?"x":"y",f=u[h];let g,p,b;const S={x:0,y:0},D={x:0,y:0},[z,v,M,U]=gr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[h]*l[h]===-1){p=i.x??z,b=i.y??v;const $=[{x:p,y:d.y},{x:p,y:c.y}],Q=[{x:d.x,y:b},{x:c.x,y:b}];a[h]===f?g=h==="x"?$:Q:g=h==="x"?Q:$}else{const $=[{x:d.x,y:c.y}],Q=[{x:c.x,y:d.y}];if(h==="x"?g=a.x===f?Q:$:g=a.y===f?$:Q,e===o){const K=Math.abs(t[h]-n[h]);if(K<=s){const G=Math.min(s-1,s-K);a[h]===f?S[h]=(d[h]>t[h]?-1:1)*G:D[h]=(c[h]>n[h]?-1:1)*G}}if(e!==o){const K=h==="x"?"y":"x",G=a[h]===l[K],k=d[K]>c[K],Y=d[K]<c[K];(a[h]===1&&(!G&&k||G&&Y)||a[h]!==1&&(!G&&Y||G&&k))&&(g=h==="x"?$:Q)}const q={x:d.x+S.x,y:d.y+S.y},j={x:c.x+D.x,y:c.y+D.y};Math.max(Math.abs(q.x-g[0].x),Math.abs(j.x-g[0].x))>=Math.max(Math.abs(q.y-g[0].y),Math.abs(j.y-g[0].y))?(p=(q.x+j.x)/2,b=g[0].y):(p=g[0].x,b=(q.y+j.y)/2)}return[[t,{x:d.x+S.x,y:d.y+S.y},...g,{x:c.x+D.x,y:c.y+D.y},n],p,b,M,U]}function lu(t,e,n,o){const i=Math.min(wr(t,e)/2,wr(e,n)/2,o),{x:s,y:a}=e;if(t.x===s&&s===n.x||t.y===a&&a===n.y)return`L${s} ${a}`;if(t.y===a){const d=t.x<n.x?-1:1,c=t.y<n.y?1:-1;return`L ${s+i*d},${a}Q ${s},${a} ${s},${a+i*c}`}const l=t.x<n.x?1:-1;return`L ${s},${a+i*(t.y<n.y?-1:1)}Q ${s},${a} ${s+i*l},${a}`}function yo(t){const{sourceX:e,sourceY:n,sourcePosition:o=ae.Bottom,targetX:i,targetY:s,targetPosition:a=ae.Top,borderRadius:l=5,centerX:d,centerY:c,offset:u=20}=t,[h,f,g,p,b]=au({source:{x:e,y:n},sourcePosition:o,target:{x:i,y:s},targetPosition:a,center:{x:d,y:c},offset:u});return[h.reduce((S,D,z)=>{let v;return z>0&&z<h.length-1?v=lu(h[z-1],D,h[z+1],l):v=`${z===0?"M":"L"}${D.x} ${D.y}`,S+=v,S},""),f,g,p,b]}function cu(t){const{sourceX:e,sourceY:n,targetX:o,targetY:i}=t,[s,a,l,d]=gr({sourceX:e,sourceY:n,targetX:o,targetY:i});return[`M ${e},${n}L ${o},${i}`,s,a,l,d]}var du=(0,r.defineComponent)({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=cu(t);return(0,r.h)(Vt,{path:n,labelX:o,labelY:i,...e,...t})}}}),br=(0,r.defineComponent)({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=yo({...t,sourcePosition:t.sourcePosition??ae.Bottom,targetPosition:t.targetPosition??ae.Top});return(0,r.h)(Vt,{path:n,labelX:o,labelY:i,...e,...t})}}}),uu=(0,r.defineComponent)({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(t,{attrs:e}){return()=>(0,r.h)(br,{...t,...e,borderRadius:0})}}),fu=(0,r.defineComponent)({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=mo({...t,sourcePosition:t.sourcePosition??ae.Bottom,targetPosition:t.targetPosition??ae.Top});return(0,r.h)(Vt,{path:n,labelX:o,labelY:i,...e,...t})}}}),hu=(0,r.defineComponent)({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=vr({...t,sourcePosition:t.sourcePosition??ae.Bottom,targetPosition:t.targetPosition??ae.Top});return(0,r.h)(Vt,{path:n,labelX:o,labelY:i,...e,...t})}}}),gu={input:Qd,default:qd,output:Jd},pu={default:fu,straight:du,step:uu,smoothstep:br,simplebezier:hu};function mu(t,e,n){const o=(0,r.computed)(()=>p=>e.value.get(p)),i=(0,r.computed)(()=>p=>n.value.get(p)),s=(0,r.computed)(()=>{const p={...pu,...t.edgeTypes},b=Object.keys(p);for(const S of t.edges)S.type&&!b.includes(S.type)&&(p[S.type]=S.type);return p}),a=(0,r.computed)(()=>{const p={...gu,...t.nodeTypes},b=Object.keys(p);for(const S of t.nodes)S.type&&!b.includes(S.type)&&(p[S.type]=S.type);return p}),l=(0,r.computed)(()=>t.onlyRenderVisibleElements?$i(t.nodes,{x:0,y:0,width:t.dimensions.width,height:t.dimensions.height},t.viewport,!0):t.nodes),d=(0,r.computed)(()=>{if(t.onlyRenderVisibleElements){const p=[];for(const b of t.edges){const S=e.value.get(b.source),D=e.value.get(b.target);wd({sourcePos:S.computedPosition||{x:0,y:0},targetPos:D.computedPosition||{x:0,y:0},sourceWidth:S.dimensions.width,sourceHeight:S.dimensions.height,targetWidth:D.dimensions.width,targetHeight:D.dimensions.height,width:t.dimensions.width,height:t.dimensions.height,viewport:t.viewport})&&p.push(b)}return p}return t.edges}),c=(0,r.computed)(()=>[...l.value,...d.value]),u=(0,r.computed)(()=>{const p=[];for(const b of t.nodes)b.selected&&p.push(b);return p}),h=(0,r.computed)(()=>{const p=[];for(const b of t.edges)b.selected&&p.push(b);return p}),f=(0,r.computed)(()=>[...u.value,...h.value]),g=(0,r.computed)(()=>{const p=[];for(const b of t.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&p.push(b);return p});return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:s,getNodeTypes:a,getEdges:d,getNodes:l,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:h,getNodesInitialized:g,areNodesInitialized:(0,r.computed)(()=>l.value.length>0&&g.value.length===l.value.length)}}var yu=class vt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var e;const n=(e=(0,r.getCurrentInstance)())==null?void 0:e.appContext.app;return vt.instance=n?.config.globalProperties.$vueFlowStorage??vt.instance??new vt,n&&(n.config.globalProperties.$vueFlowStorage=vt.instance),vt.instance}set(e,n){return this.flows.set(e,n)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,n){const o=(0,r.reactive)(hr()),i={};for(const[h,f]of Object.entries(o.hooks)){const g=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;i[g]=f.on}const s={};for(const[h,f]of Object.entries(o.hooks))s[h]=f.trigger;const a=(0,r.computed)(()=>{const h=new Map;for(const f of o.nodes)h.set(f.id,f);return h}),l=(0,r.computed)(()=>{const h=new Map;for(const f of o.edges)h.set(f.id,f);return h}),d=mu(o,a,l),c=Zd(o,a,l);c.setState({...o,...n});const u={...i,...d,...c,...ps(o),nodeLookup:a,edgeLookup:l,emits:s,id:e,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(e)}};return this.set(e,u),u}getId(){return`vue-flow-${this.currentId++}`}};function ge(t){const e=yu.getInstance(),n=(0,r.getCurrentScope)(),o=typeof t=="object",i=o?t:{id:t},s=i.id,a=s??n?.vueFlowId;let l;if(n){const d=(0,r.inject)(sr,null);typeof d<"u"&&d!==null&&(!a||d.id===a)&&(l=d)}if(l||a&&(l=e.get(a)),!l||a&&l.id!==a){const d=s??e.getId(),c=e.create(d,i);l=c,(n??(0,r.effectScope)(!0)).run(()=>{(0,r.watch)(c.applyDefault,(u,h,f)=>{const g=b=>{c.applyNodeChanges(b)},p=b=>{c.applyEdgeChanges(b)};u?(c.onNodesChange(g),c.onEdgesChange(p)):(c.hooks.value.nodesChange.off(g),c.hooks.value.edgesChange.off(p)),f(()=>{c.hooks.value.nodesChange.off(g),c.hooks.value.edgesChange.off(p)})},{immediate:!0}),wt(()=>{if(l){const u=e.get(l.id);u?u.$destroy():Ot(`No store instance found for id ${l.id} in storage.`)}})})}else o&&l.setState(i);if(n&&((0,r.provide)(sr,l),n.vueFlowId=l.id),o){const d=(0,r.getCurrentInstance)();d?.type.name!=="VueFlow"&&l.emits.error(new we(ve.USEVUEFLOW_OPTIONS))}return l}function vu(t){const{emits:e,dimensions:n}=ge();let o;(0,r.onMounted)(()=>{const i=()=>{var s,a;if(!t.value||!(((a=(s=t.value).checkVisibility)==null?void 0:a.call(s))??!0))return;const l=dn(t.value);(l.width===0||l.height===0)&&e.error(new we(ve.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:l.width||500,height:l.height||500}};i(),window.addEventListener("resize",i),t.value&&(o=new ResizeObserver(()=>i()),o.observe(t.value)),(0,r.onBeforeUnmount)(()=>{window.removeEventListener("resize",i),o&&t.value&&o.unobserve(t.value)})})}var _u=(0,r.defineComponent)({name:"UserSelection",compatConfig:{MODE:3},props:{userSelectionRect:{}},setup(t){return(e,n)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"vue-flow__selection vue-flow__container",style:(0,r.normalizeStyle)({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),wu=["tabIndex"],bu=(0,r.defineComponent)({name:"NodesSelection",compatConfig:{MODE:3},setup(t){const{emits:e,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:s,userSelectionActive:a}=ge(),l=fr(),d=(0,r.ref)(null),c=cr({el:d,onStart(p){e.selectionDragStart(p),e.nodeDragStart(p)},onDrag(p){e.selectionDrag(p),e.nodeDrag(p)},onStop(p){e.selectionDragStop(p),e.nodeDragStop(p)}});(0,r.onMounted)(()=>{var p;s.value||(p=d.value)==null||p.focus({preventScroll:!0})});const u=(0,r.computed)(()=>Ai(o.value)),h=(0,r.computed)(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function f(p){e.selectionContextMenu({event:p,nodes:o.value})}function g(p){s.value||ht[p.key]&&(p.preventDefault(),l({x:ht[p.key].x,y:ht[p.key].y},p.shiftKey))}return(p,b)=>!(0,r.unref)(a)&&u.value.width&&u.value.height?((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:0,class:(0,r.normalizeClass)(["vue-flow__nodesselection vue-flow__container",(0,r.unref)(i)]),style:(0,r.normalizeStyle)({transform:`translate(${(0,r.unref)(n).x}px,${(0,r.unref)(n).y}px) scale(${(0,r.unref)(n).zoom})`})},[(0,r.createElementVNode)("div",{ref_key:"el",ref:d,class:(0,r.normalizeClass)([{dragging:(0,r.unref)(c)},"vue-flow__nodesselection-rect"]),style:(0,r.normalizeStyle)(h.value),tabIndex:(0,r.unref)(s)?void 0:-1,onContextmenu:f,onKeydown:g},null,46,wu)],6)):(0,r.createCommentVNode)("",!0)}});function Cu(t,e){return{x:t.clientX-e.left,y:t.clientY-e.top}}var Eu=(0,r.defineComponent)({name:"Pane",compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(t){const{vueFlowRef:e,nodes:n,viewport:o,emits:i,userSelectionActive:s,removeSelectedElements:a,userSelectionRect:l,elementsSelectable:d,nodesSelectionActive:c,getSelectedEdges:u,getSelectedNodes:h,removeNodes:f,removeEdges:g,selectionMode:p,deleteKeyCode:b,multiSelectionKeyCode:S,multiSelectionActive:D,edgeLookup:z,nodeLookup:v,connectionLookup:M,defaultEdgeOptions:U,connectionStartHandle:$,panOnDrag:Q}=ge(),q=(0,r.shallowRef)(null),j=(0,r.shallowRef)(new Set),K=(0,r.shallowRef)(new Set),G=(0,r.shallowRef)(null),k=(0,r.toRef)(()=>d.value&&(t.isSelecting||s.value)),Y=(0,r.toRef)(()=>$.value!==null);let w=!1,V=!1;const m=zt(b,{actInsideInputWithModifier:!1}),E=zt(S);(0,r.watch)(m,L=>{L&&(f(h.value),g(u.value),c.value=!1)}),(0,r.watch)(E,L=>{D.value=L});function B(L,Z){return P=>{P.target===Z&&L?.(P)}}function T(L){if(w||Y.value){w=!1;return}i.paneClick(L),a(),c.value=!1}function A(L){var Z;if(Array.isArray(Q.value)&&((Z=Q.value)!=null&&Z.includes(2))){L.preventDefault();return}i.paneContextMenu(L)}function H(L){i.paneScroll(L)}function F(L){var Z,P,X;if(G.value=((Z=e.value)==null?void 0:Z.getBoundingClientRect())??null,!d.value||!t.isSelecting||L.button!==0||L.target!==q.value||!G.value)return;(X=(P=L.target)==null?void 0:P.setPointerCapture)==null||X.call(P,L.pointerId);const{x:ne,y:ie}=Cu(L,G.value);V=!0,w=!1,a(),l.value={width:0,height:0,startX:ne,startY:ie,x:ne,y:ie},i.selectionStart(L)}function te(L){var Z;if(!G.value||!l.value)return;w=!0;const{x:P,y:X}=Ve(L,G.value),{startX:ne=0,startY:ie=0}=l.value,le={startX:ne,startY:ie,x:P<ne?P:ne,y:X<ie?X:ie,width:Math.abs(P-ne),height:Math.abs(X-ie)},ee=j.value,re=K.value;j.value=new Set($i(n.value,le,o.value,p.value===oo.Partial,!0).map(_=>_.id)),K.value=new Set;const C=((Z=U.value)==null?void 0:Z.selectable)??!0;for(const _ of j.value){const N=M.value.get(_);if(N)for(const{edgeId:x}of N.values()){const y=z.value.get(x);y&&(y.selectable??C)&&K.value.add(x)}}if(!rr(ee,j.value)){const _=Ze(v.value,j.value,!0);i.nodesChange(_)}if(!rr(re,K.value)){const _=Ze(z.value,K.value);i.edgesChange(_)}l.value=le,s.value=!0,c.value=!1}function se(L){var Z;L.button!==0||!V||((Z=L.target)==null||Z.releasePointerCapture(L.pointerId),!s.value&&l.value&&L.target===q.value&&T(L),s.value=!1,l.value=null,c.value=j.value.size>0,i.selectionEnd(L),t.selectionKeyPressed&&(w=!1),V=!1)}return(L,Z)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{ref_key:"container",ref:q,class:(0,r.normalizeClass)(["vue-flow__pane vue-flow__container",{selection:L.isSelecting}]),onClick:Z[0]||(Z[0]=P=>k.value?void 0:B(T,q.value)(P)),onContextmenu:Z[1]||(Z[1]=P=>B(A,q.value)(P)),onWheelPassive:Z[2]||(Z[2]=P=>B(H,q.value)(P)),onPointerenter:Z[3]||(Z[3]=P=>k.value?void 0:(0,r.unref)(i).paneMouseEnter(P)),onPointerdown:Z[4]||(Z[4]=P=>k.value?F(P):(0,r.unref)(i).paneMouseMove(P)),onPointermove:Z[5]||(Z[5]=P=>k.value?te(P):(0,r.unref)(i).paneMouseMove(P)),onPointerup:Z[6]||(Z[6]=P=>k.value?se(P):void 0),onPointerleave:Z[7]||(Z[7]=P=>(0,r.unref)(i).paneMouseLeave(P))},[(0,r.renderSlot)(L.$slots,"default"),(0,r.unref)(s)&&(0,r.unref)(l)?((0,r.openBlock)(),(0,r.createBlock)(_u,{key:0,"user-selection-rect":(0,r.unref)(l)},null,8,["user-selection-rect"])):(0,r.createCommentVNode)("",!0),(0,r.unref)(c)&&(0,r.unref)(h).length?((0,r.openBlock)(),(0,r.createBlock)(bu,{key:1})):(0,r.createCommentVNode)("",!0)],34))}}),xu=(0,r.defineComponent)({name:"Transform",compatConfig:{MODE:3},setup(t){const{viewport:e,fitViewOnInit:n,fitViewOnInitDone:o}=ge(),i=(0,r.computed)(()=>n.value?!o.value:!1),s=(0,r.computed)(()=>`translate(${e.value.x}px,${e.value.y}px) scale(${e.value.zoom})`);return(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"vue-flow__transformationpane vue-flow__container",style:(0,r.normalizeStyle)({transform:s.value,opacity:i.value?0:void 0})},[(0,r.renderSlot)(a.$slots,"default")],4))}}),Nu=(0,r.defineComponent)({name:"Viewport",compatConfig:{MODE:3},setup(t){const{minZoom:e,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:s,selectionKeyCode:a,panActivationKeyCode:l,panOnScroll:d,panOnScrollMode:c,panOnScrollSpeed:u,panOnDrag:h,zoomOnDoubleClick:f,zoomOnPinch:g,zoomOnScroll:p,preventScrolling:b,noWheelClassName:S,noPanClassName:D,emits:z,connectionStartHandle:v,userSelectionActive:M,paneDragging:U,d3Zoom:$,d3Selection:Q,d3ZoomHandler:q,viewport:j,viewportRef:K,paneClickDistance:G}=ge();vu(K);const k=(0,r.shallowRef)(!1),Y=(0,r.shallowRef)(!1);let w=null,V=!1,m=0,E={x:0,y:0,zoom:0};const B=zt(l),T=zt(a),A=zt(s),H=(0,r.toRef)(()=>(!T.value||T.value&&a.value===!0)&&(B.value||h.value)),F=(0,r.toRef)(()=>B.value||d.value),te=(0,r.toRef)(()=>a.value===!0&&H.value!==!0),se=(0,r.toRef)(()=>T.value&&a.value!==!0||M.value||te.value),L=(0,r.toRef)(()=>v.value!==null);(0,r.onMounted)(()=>{if(!K.value){Ot("Viewport element is missing");return}const ie=K.value,le=ie.getBoundingClientRect(),ee=Qc().clickDistance(G.value).scaleExtent([e.value,n.value]).translateExtent(i.value),re=Ie(ie).call(ee),C=re.on("wheel.zoom"),_=ft.translate(o.value.x??0,o.value.y??0).scale(it(o.value.zoom??1,e.value,n.value)),N=[[0,0],[le.width,le.height]],x=ee.constrain()(_,N,i.value);ee.transform(re,x),ee.wheelDelta(Hi),$.value=ee,Q.value=re,q.value=C,j.value={x:x.x,y:x.y,zoom:x.k},ee.on("start",y=>{var R;if(!y.sourceEvent)return null;m=y.sourceEvent.button,k.value=!0;const I=X(y.transform);((R=y.sourceEvent)==null?void 0:R.type)==="mousedown"&&(U.value=!0),E=I,z.viewportChangeStart(I),z.moveStart({event:y,flowTransform:I})}),ee.on("end",y=>{if(!y.sourceEvent)return null;if(k.value=!1,U.value=!1,Z(H.value,m??0)&&!V&&z.paneContextMenu(y.sourceEvent),V=!1,P(E,y.transform)){const R=X(y.transform);E=R,z.viewportChangeEnd(R),z.moveEnd({event:y,flowTransform:R})}}),ee.filter(y=>{var R;const I=A.value||p.value,J=g.value&&y.ctrlKey,W=y.button,ce=y.type==="wheel";if(W===1&&y.type==="mousedown"&&(ne(y,"vue-flow__node")||ne(y,"vue-flow__edge")))return!0;if(!H.value&&!I&&!F.value&&!f.value&&!g.value||M.value||L.value&&!ce||!f.value&&y.type==="dblclick"||ne(y,S.value)&&ce||ne(y,D.value)&&(!ce||F.value&&ce&&!A.value)||!g.value&&y.ctrlKey&&ce||!I&&!F.value&&!J&&ce)return!1;if(!g&&y.type==="touchstart"&&((R=y.touches)==null?void 0:R.length)>1)return y.preventDefault(),!1;if(!H.value&&(y.type==="mousedown"||y.type==="touchstart")||te.value&&Array.isArray(h.value)&&h.value.includes(0)&&W===0||Array.isArray(h.value)&&!h.value.includes(W)&&(y.type==="mousedown"||y.type==="touchstart"))return!1;const fe=Array.isArray(h.value)&&h.value.includes(W)||a.value===!0&&Array.isArray(h.value)&&!h.value.includes(0)||!W||W<=1;return(!y.ctrlKey||B.value||ce)&&fe}),(0,r.watch)([M,H],()=>{M.value&&!k.value?ee.on("zoom",null):M.value||ee.on("zoom",y=>{j.value={x:y.transform.x,y:y.transform.y,zoom:y.transform.k};const R=X(y.transform);V=Z(H.value,m??0),z.viewportChange(R),z.move({event:y,flowTransform:R})})},{immediate:!0}),(0,r.watch)([M,F,c,A,g,b,S],()=>{F.value&&!A.value&&!M.value?re.on("wheel.zoom",y=>{if(ne(y,S.value))return!1;const R=A.value||p.value,I=g.value&&y.ctrlKey;if(!(!b.value||F.value||R||I))return!1;y.preventDefault(),y.stopImmediatePropagation();const J=re.property("__zoom").k||1,W=fn();if(!B.value&&y.ctrlKey&&g.value&&W){const ke=Ae(y),pe=J*2**Hi(y);ee.scaleTo(re,pe,ke,y);return}const ce=y.deltaMode===1?20:1;let fe=c.value===Bt.Vertical?0:y.deltaX*ce,he=c.value===Bt.Horizontal?0:y.deltaY*ce;!W&&y.shiftKey&&c.value!==Bt.Vertical&&!fe&&he&&(fe=he,he=0),ee.translateBy(re,-(fe/J)*u.value,-(he/J)*u.value);const Ee=X(re.property("__zoom"));w&&clearTimeout(w),Y.value?(z.move({event:y,flowTransform:Ee}),z.viewportChange(Ee),w=setTimeout(()=>{z.moveEnd({event:y,flowTransform:Ee}),z.viewportChangeEnd(Ee),Y.value=!1},150)):(Y.value=!0,z.moveStart({event:y,flowTransform:Ee}),z.viewportChangeStart(Ee))},{passive:!1}):typeof C<"u"&&re.on("wheel.zoom",function(y,R){const I=!b.value&&y.type==="wheel"&&!y.ctrlKey,J=A.value||p.value,W=g.value&&y.ctrlKey;if(!J&&!d.value&&!W&&y.type==="wheel"||I||ne(y,S.value))return null;y.preventDefault(),C.call(this,y,R)},{passive:!1})},{immediate:!0})});function Z(ie,le){return le===2&&Array.isArray(ie)&&ie.includes(2)}function P(ie,le){return ie.x!==le.x&&!Number.isNaN(le.x)||ie.y!==le.y&&!Number.isNaN(le.y)||ie.zoom!==le.k&&!Number.isNaN(le.k)}function X(ie){return{x:ie.x,y:ie.y,zoom:ie.k}}function ne(ie,le){return ie.target.closest(`.${le}`)}return(ie,le)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{ref_key:"viewportRef",ref:K,class:"vue-flow__viewport vue-flow__container"},[(0,r.createVNode)(Eu,{"is-selecting":se.value,"selection-key-pressed":(0,r.unref)(T),class:(0,r.normalizeClass)({connecting:L.value,dragging:(0,r.unref)(U),draggable:(0,r.unref)(h)===!0||Array.isArray((0,r.unref)(h))&&(0,r.unref)(h).includes(0)})},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(xu,null,{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(ie.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),ku=["id"],Su=["id"],Du=["id"],Tu=(0,r.defineComponent)({name:"A11yDescriptions",compatConfig:{MODE:3},setup(t){const{id:e,disableKeyboardA11y:n,ariaLiveMessage:o}=ge();return(i,s)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createElementVNode)("div",{id:`${(0,r.unref)(ki)}-${(0,r.unref)(e)}`,style:{display:"none"}}," Press enter or space to select a node. "+(0,r.toDisplayString)((0,r.unref)(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,ku),(0,r.createElementVNode)("div",{id:`${(0,r.unref)(Si)}-${(0,r.unref)(e)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,Su),(0,r.unref)(n)?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:0,id:`${(0,r.unref)(rd)}-${(0,r.unref)(e)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},(0,r.toDisplayString)((0,r.unref)(o)),9,Du))],64))}});function Mu(){const t=ge();(0,r.watch)(()=>t.viewportHelper.value.viewportInitialized,e=>{e&&setTimeout(()=>{t.emits.init(t),t.emits.paneReady(t)},1)})}function Iu(t,e,n){return n===ae.Left?t-e:n===ae.Right?t+e:t}function Bu(t,e,n){return n===ae.Top?t-e:n===ae.Bottom?t+e:t}var vo=function({radius:t=10,centerX:e=0,centerY:n=0,position:o=ae.Top,type:i}){return(0,r.h)("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Iu(e,t,o),cy:Bu(n,t,o),r:t,stroke:"transparent",fill:"transparent"})};vo.props=["radius","centerX","centerY","position","type"],vo.compatConfig={MODE:3};var Cr=vo,zu=(0,r.defineComponent)({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(t){const{id:e,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:s,nodesSelectionActive:a,noPanClassName:l,getEdgeTypes:d,removeSelectedEdges:c,findEdge:u,findNode:h,isValidConnection:f,multiSelectionActive:g,disableKeyboardA11y:p,elementsSelectable:b,edgesUpdatable:S,edgesFocusable:D,hooks:z}=ge(),v=(0,r.computed)(()=>u(t.id)),{emit:M,on:U}=$d(v.value,s),$=(0,r.inject)(gn),Q=(0,r.getCurrentInstance)(),q=(0,r.ref)(!1),j=(0,r.ref)(!1),K=(0,r.ref)(""),G=(0,r.ref)(null),k=(0,r.ref)("source"),Y=(0,r.ref)(null),w=(0,r.toRef)(()=>typeof v.value.selectable>"u"?b.value:v.value.selectable),V=(0,r.toRef)(()=>typeof v.value.updatable>"u"?S.value:v.value.updatable),m=(0,r.toRef)(()=>typeof v.value.focusable>"u"?D.value:v.value.focusable);(0,r.provide)(zd,t.id),(0,r.provide)(Rd,Y);const E=(0,r.computed)(()=>v.value.class instanceof Function?v.value.class(v.value):v.value.class),B=(0,r.computed)(()=>v.value.style instanceof Function?v.value.style(v.value):v.value.style),T=(0,r.computed)(()=>{const _=v.value.type||"default",N=$?.[`edge-${_}`];if(N)return N;let x=v.value.template??d.value[_];if(typeof x=="string"&&Q){const y=Object.keys(Q.appContext.components);y&&y.includes(_)&&(x=(0,r.resolveComponent)(_,!1))}return x&&typeof x!="string"?x:(s.error(new we(ve.EDGE_TYPE_MISSING,x)),!1)}),{handlePointerDown:A}=dr({nodeId:K,handleId:G,type:k,isValidConnection:f,edgeUpdaterType:k,onEdgeUpdate:te,onEdgeUpdateEnd:se});return()=>{const _=h(v.value.source),N=h(v.value.target),x="pathOptions"in v.value?v.value.pathOptions:{};if(!_&&!N)return s.error(new we(ve.EDGE_SOURCE_TARGET_MISSING,v.value.id,v.value.source,v.value.target)),null;if(!_)return s.error(new we(ve.EDGE_SOURCE_MISSING,v.value.id,v.value.source)),null;if(!N)return s.error(new we(ve.EDGE_TARGET_MISSING,v.value.id,v.value.target)),null;if(!v.value||v.value.hidden||_.hidden||N.hidden)return null;let y;o.value===We.Strict?y=_.handleBounds.source:y=[..._.handleBounds.source||[],..._.handleBounds.target||[]];const R=Ki(y,v.value.sourceHandle);let I;o.value===We.Strict?I=N.handleBounds.target:I=[...N.handleBounds.target||[],...N.handleBounds.source||[]];const J=Ki(I,v.value.targetHandle),W=R?.position||ae.Bottom,ce=J?.position||ae.Top,{x:fe,y:he}=pt(_,R,W),{x:Ee,y:ke}=pt(N,J,ce);return v.value.sourceX=fe,v.value.sourceY=he,v.value.targetX=Ee,v.value.targetY=ke,(0,r.h)("g",{ref:Y,key:t.id,"data-id":t.id,class:["vue-flow__edge",`vue-flow__edge-${T.value===!1?"default":v.value.type||"default"}`,l.value,E.value,{updating:q.value,selected:v.value.selected,animated:v.value.animated,inactive:!w.value&&!z.value.edgeClick.hasListeners()}],tabIndex:m.value?0:void 0,"aria-label":v.value.ariaLabel===null?void 0:v.value.ariaLabel??`Edge from ${v.value.source} to ${v.value.target}`,"aria-describedby":m.value?`${Si}-${e}`:void 0,"aria-roledescription":"edge",role:m.value?"group":"img",...v.value.domAttributes,onClick:Z,onContextmenu:P,onDblclick:X,onMouseenter:ne,onMousemove:ie,onMouseleave:le,onKeyDown:m.value?C:void 0},[j.value?null:(0,r.h)(T.value===!1?d.value.default:T.value,{id:t.id,sourceNode:_,targetNode:N,source:v.value.source,target:v.value.target,type:v.value.type,updatable:V.value,selected:v.value.selected,animated:v.value.animated,label:v.value.label,labelStyle:v.value.labelStyle,labelShowBg:v.value.labelShowBg,labelBgStyle:v.value.labelBgStyle,labelBgPadding:v.value.labelBgPadding,labelBgBorderRadius:v.value.labelBgBorderRadius,data:v.value.data,events:{...v.value.events,...U},style:B.value,markerStart:`url('#${Pt(v.value.markerStart,e)}')`,markerEnd:`url('#${Pt(v.value.markerEnd,e)}')`,sourcePosition:W,targetPosition:ce,sourceX:fe,sourceY:he,targetX:Ee,targetY:ke,sourceHandleId:v.value.sourceHandle,targetHandleId:v.value.targetHandle,interactionWidth:v.value.interactionWidth,...x}),[V.value==="source"||V.value===!0?[(0,r.h)("g",{onMousedown:ee,onMouseenter:H,onMouseout:F},(0,r.h)(Cr,{position:W,centerX:fe,centerY:he,radius:i.value,type:"source","data-type":"source"}))]:null,V.value==="target"||V.value===!0?[(0,r.h)("g",{onMousedown:re,onMouseenter:H,onMouseout:F},(0,r.h)(Cr,{position:ce,centerX:Ee,centerY:ke,radius:i.value,type:"target","data-type":"target"}))]:null]])};function H(){q.value=!0}function F(){q.value=!1}function te(_,N){M.update({event:_,edge:v.value,connection:N})}function se(_){M.updateEnd({event:_,edge:v.value}),j.value=!1}function L(_,N){_.button===0&&(j.value=!0,K.value=N?v.value.target:v.value.source,G.value=(N?v.value.targetHandle:v.value.sourceHandle)??null,k.value=N?"target":"source",M.updateStart({event:_,edge:v.value}),A(_))}function Z(_){var N;const x={event:_,edge:v.value};w.value&&(a.value=!1,v.value.selected&&g.value?(c([v.value]),(N=Y.value)==null||N.blur()):n([v.value])),M.click(x)}function P(_){M.contextMenu({event:_,edge:v.value})}function X(_){M.doubleClick({event:_,edge:v.value})}function ne(_){M.mouseEnter({event:_,edge:v.value})}function ie(_){M.mouseMove({event:_,edge:v.value})}function le(_){M.mouseLeave({event:_,edge:v.value})}function ee(_){L(_,!0)}function re(_){L(_,!1)}function C(_){var N;!p.value&&Di.includes(_.key)&&w.value&&(_.key==="Escape"?((N=Y.value)==null||N.blur(),c([u(t.id)])):n([u(t.id)]))}}}),Ru=(0,r.defineComponent)({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var t;const{id:e,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:s,connectionLineType:a,connectionLineStyle:l,connectionLineOptions:d,connectionStatus:c,viewport:u,findNode:h}=ge(),f=(t=(0,r.inject)(gn))==null?void 0:t["connection-line"],g=(0,r.computed)(()=>{var z;return h((z=o.value)==null?void 0:z.nodeId)}),p=(0,r.computed)(()=>{var z;return h((z=i.value)==null?void 0:z.nodeId)??null}),b=(0,r.computed)(()=>({x:(s.value.x-u.value.x)/u.value.zoom,y:(s.value.y-u.value.y)/u.value.zoom})),S=(0,r.computed)(()=>d.value.markerStart?`url(#${Pt(d.value.markerStart,e)})`:""),D=(0,r.computed)(()=>d.value.markerEnd?`url(#${Pt(d.value.markerEnd,e)})`:"");return()=>{var z,v,M;if(!g.value||!o.value)return null;const U=o.value.id,$=o.value.type,Q=g.value.handleBounds;let q=Q?.[$]??[];if(n.value===We.Loose){const B=Q?.[$==="source"?"target":"source"]??[];q=[...q,...B]}if(!q)return null;const j=(U?q.find(B=>B.id===U):q[0])??null,K=j?.position??ae.Top,{x:G,y:k}=pt(g.value,j,K);let Y=null;p.value&&(n.value===We.Strict?Y=((z=p.value.handleBounds[$==="source"?"target":"source"])==null?void 0:z.find(B=>{var T;return B.id===((T=i.value)==null?void 0:T.id)}))||null:Y=((v=[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]])==null?void 0:v.find(B=>{var T;return B.id===((T=i.value)==null?void 0:T.id)}))||null);const w=((M=i.value)==null?void 0:M.position)??(K?uo[K]:null);if(!K||!w)return null;const V=a.value??d.value.type??ot.Bezier;let m="";const E={sourceX:G,sourceY:k,sourcePosition:K,targetX:b.value.x,targetY:b.value.y,targetPosition:w};return V===ot.Bezier?[m]=mo(E):V===ot.Step?[m]=yo({...E,borderRadius:0}):V===ot.SmoothStep?[m]=yo(E):V===ot.SimpleBezier?[m]=vr(E):m=`M${G},${k} ${b.value.x},${b.value.y}`,(0,r.h)("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},(0,r.h)("g",{class:"vue-flow__connection"},f?(0,r.h)(f,{sourceX:G,sourceY:k,sourcePosition:K,targetX:b.value.x,targetY:b.value.y,targetPosition:w,sourceNode:g.value,sourceHandle:j,targetNode:p.value,targetHandle:Y,markerEnd:D.value,markerStart:S.value,connectionStatus:c.value}):(0,r.h)("path",{d:m,class:[d.value.class,c.value,"vue-flow__connection-path"],style:{...l.value,...d.value.style},"marker-end":D.value,"marker-start":S.value})))}}}),Au=["id","markerWidth","markerHeight","markerUnits","orient"],$u=(0,r.defineComponent)({name:"MarkerType",compatConfig:{MODE:3},props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(t){return(e,n)=>((0,r.openBlock)(),(0,r.createElementBlock)("marker",{id:e.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===(0,r.unref)(Ue).ArrowClosed?((0,r.openBlock)(),(0,r.createElementBlock)("polyline",{key:0,style:(0,r.normalizeStyle)({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):(0,r.createCommentVNode)("",!0),e.type===(0,r.unref)(Ue).Arrow?((0,r.openBlock)(),(0,r.createElementBlock)("polyline",{key:1,style:(0,r.normalizeStyle)({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):(0,r.createCommentVNode)("",!0)],8,Au))}}),Pu={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Ou=(0,r.defineComponent)({name:"MarkerDefinitions",compatConfig:{MODE:3},setup(t){const{id:e,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=ge(),s=(0,r.computed)(()=>{const a=new Set,l=[],d=c=>{if(c){const u=Pt(c,e);a.has(u)||(typeof c=="object"?l.push({...c,id:u,color:c.color||i.value}):l.push({id:u,color:i.value,type:c}),a.add(u))}};for(const c of[o.value.markerEnd,o.value.markerStart])d(c);for(const c of n.value)for(const u of[c.markerStart,c.markerEnd])d(u);return l.sort((c,u)=>c.id.localeCompare(u.id))});return(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)("svg",Pu,[(0,r.createElementVNode)("defs",null,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(s.value,d=>((0,r.openBlock)(),(0,r.createBlock)($u,{id:d.id,key:d.id,type:d.type,color:d.color,width:d.width,height:d.height,markerUnits:d.markerUnits,"stroke-width":d.strokeWidth,orient:d.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Vu=(0,r.defineComponent)({name:"Edges",compatConfig:{MODE:3},setup(t){const{findNode:e,getEdges:n,elevateEdgesOnSelect:o}=ge();return(i,s)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createVNode)(Ou),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(n),a=>((0,r.openBlock)(),(0,r.createElementBlock)("svg",{key:a.id,class:"vue-flow__edges vue-flow__container",style:(0,r.normalizeStyle)({zIndex:(0,r.unref)(bd)(a,(0,r.unref)(e),(0,r.unref)(o))})},[(0,r.createVNode)((0,r.unref)(zu),{id:a.id},null,8,["id"])],4))),128)),(0,r.createVNode)((0,r.unref)(Ru))],64))}}),Hu=(0,r.defineComponent)({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(t){const{id:e,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:s,emits:a,removeSelectedNodes:l,addSelectedNodes:d,updateNodeDimensions:c,onUpdateNodeInternals:u,getNodeTypes:h,nodeExtent:f,elevateNodesOnSelect:g,disableKeyboardA11y:p,ariaLiveMessage:b,snapToGrid:S,snapGrid:D,nodeDragThreshold:z,nodesDraggable:v,elementsSelectable:M,nodesConnectable:U,nodesFocusable:$,hooks:Q}=ge(),q=(0,r.ref)(null);(0,r.provide)(lr,q),(0,r.provide)(ar,t.id);const j=(0,r.inject)(gn),K=(0,r.getCurrentInstance)(),G=fr(),{node:k,parentNode:Y}=ur(t.id),{emit:w,on:V}=Hd(k,a),m=(0,r.toRef)(()=>typeof k.draggable>"u"?v.value:k.draggable),E=(0,r.toRef)(()=>typeof k.selectable>"u"?M.value:k.selectable),B=(0,r.toRef)(()=>typeof k.connectable>"u"?U.value:k.connectable),T=(0,r.toRef)(()=>typeof k.focusable>"u"?$.value:k.focusable),A=(0,r.computed)(()=>E.value||m.value||Q.value.nodeClick.hasListeners()||Q.value.nodeDoubleClick.hasListeners()||Q.value.nodeMouseEnter.hasListeners()||Q.value.nodeMouseMove.hasListeners()||Q.value.nodeMouseLeave.hasListeners()),H=(0,r.toRef)(()=>!!k.dimensions.width&&!!k.dimensions.height),F=(0,r.computed)(()=>{const N=k.type||"default",x=j?.[`node-${N}`];if(x)return x;let y=k.template||h.value[N];if(typeof y=="string"&&K){const R=Object.keys(K.appContext.components);R&&R.includes(N)&&(y=(0,r.resolveComponent)(N,!1))}return y&&typeof y!="string"?y:(a.error(new we(ve.NODE_TYPE_MISSING,y)),!1)}),te=cr({id:t.id,el:q,disabled:()=>!m.value,selectable:E,dragHandle:()=>k.dragHandle,onStart(N){w.dragStart(N)},onDrag(N){w.drag(N)},onStop(N){w.dragStop(N)},onClick(N){C(N)}}),se=(0,r.computed)(()=>k.class instanceof Function?k.class(k):k.class),L=(0,r.computed)(()=>{const N=(k.style instanceof Function?k.style(k):k.style)||{},x=k.width instanceof Function?k.width(k):k.width,y=k.height instanceof Function?k.height(k):k.height;return!N.width&&x&&(N.width=typeof x=="string"?x:`${x}px`),!N.height&&y&&(N.height=typeof y=="string"?y:`${y}px`),N}),Z=(0,r.toRef)(()=>Number(k.zIndex??L.value.zIndex??0));return u(N=>{(N.includes(t.id)||!N.length)&&X()}),(0,r.onMounted)(()=>{(0,r.watch)(()=>k.hidden,(N=!1,x,y)=>{!N&&q.value&&(t.resizeObserver.observe(q.value),y(()=>{q.value&&t.resizeObserver.unobserve(q.value)}))},{immediate:!0,flush:"post"})}),(0,r.watch)([()=>k.type,()=>k.sourcePosition,()=>k.targetPosition],()=>{(0,r.nextTick)(()=>{c([{id:t.id,nodeElement:q.value,forceUpdate:!0}])})}),(0,r.watch)([()=>k.position.x,()=>k.position.y,()=>{var N;return(N=Y.value)==null?void 0:N.computedPosition.x},()=>{var N;return(N=Y.value)==null?void 0:N.computedPosition.y},()=>{var N;return(N=Y.value)==null?void 0:N.computedPosition.z},Z,()=>k.selected,()=>k.dimensions.height,()=>k.dimensions.width,()=>{var N;return(N=Y.value)==null?void 0:N.dimensions.height},()=>{var N;return(N=Y.value)==null?void 0:N.dimensions.width}],([N,x,y,R,I,J])=>{const W={x:N,y:x,z:J+(g.value&&k.selected?1e3:0)};typeof y<"u"&&typeof R<"u"?k.computedPosition=pd({x:y,y:R,z:I},W):k.computedPosition=W},{flush:"post",immediate:!0}),(0,r.watch)([()=>k.extent,f],([N,x],[y,R])=>{(N!==y||x!==R)&&P()}),k.extent==="parent"||typeof k.extent=="object"&&"range"in k.extent&&k.extent.range==="parent"?$n(()=>H).toBe(!0).then(P):P(),()=>k.hidden?null:(0,r.h)("div",{ref:q,"data-id":k.id,class:["vue-flow__node",`vue-flow__node-${F.value===!1?"default":k.type||"default"}`,{[n.value]:m.value,dragging:te?.value,draggable:m.value,selected:k.selected,selectable:E.value,parent:k.isParent},se.value],style:{visibility:H.value?"visible":"hidden",zIndex:k.computedPosition.z??Z.value,transform:`translate(${k.computedPosition.x}px,${k.computedPosition.y}px)`,pointerEvents:A.value?"all":"none",...L.value},tabIndex:T.value?0:void 0,role:T.value?"group":void 0,"aria-describedby":p.value?void 0:`${ki}-${e}`,"aria-label":k.ariaLabel,"aria-roledescription":"node",...k.domAttributes,onMouseenter:ne,onMousemove:ie,onMouseleave:le,onContextmenu:ee,onClick:C,onDblclick:re,onKeydown:_},[(0,r.h)(F.value===!1?h.value.default:F.value,{id:k.id,type:k.type,data:k.data,events:{...k.events,...V},selected:k.selected,resizing:k.resizing,dragging:te.value,connectable:B.value,position:k.computedPosition,dimensions:k.dimensions,isValidTargetPos:k.isValidTargetPos,isValidSourcePos:k.isValidSourcePos,parent:k.parentNode,parentNodeId:k.parentNode,zIndex:k.computedPosition.z??Z.value,targetPosition:k.targetPosition,sourcePosition:k.sourcePosition,label:k.label,dragHandle:k.dragHandle,onUpdateNodeInternals:X})]);function P(){const N=k.computedPosition,{computedPosition:x,position:y}=ao(k,S.value?hn(N,D.value):N,a.error,f.value,Y.value);(k.computedPosition.x!==x.x||k.computedPosition.y!==x.y)&&(k.computedPosition={...k.computedPosition,...x}),(k.position.x!==y.x||k.position.y!==y.y)&&(k.position=y)}function X(){q.value&&c([{id:t.id,nodeElement:q.value,forceUpdate:!0}])}function ne(N){te?.value||w.mouseEnter({event:N,node:k})}function ie(N){te?.value||w.mouseMove({event:N,node:k})}function le(N){te?.value||w.mouseLeave({event:N,node:k})}function ee(N){return w.contextMenu({event:N,node:k})}function re(N){return w.doubleClick({event:N,node:k})}function C(N){E.value&&(!o.value||!m.value||z.value>0)&&fo(k,s.value,d,l,i,!1,q.value),w.click({event:N,node:k})}function _(N){if(!(io(N)||p.value))if(Di.includes(N.key)&&E.value){const x=N.key==="Escape";fo(k,s.value,d,l,i,x,q.value)}else m.value&&k.selected&&ht[N.key]&&(N.preventDefault(),b.value=`Moved selected node ${N.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~k.position.x}, y: ${~~k.position.y}`,G({x:ht[N.key].x,y:ht[N.key].y},N.shiftKey))}}}),Lu={height:"0",width:"0"},Fu=(0,r.defineComponent)({name:"EdgeLabelRenderer",compatConfig:{MODE:3},setup(t){const{viewportRef:e}=ge(),n=(0,r.toRef)(()=>{var o;return(o=e.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>((0,r.openBlock)(),(0,r.createElementBlock)("svg",null,[((0,r.openBlock)(),(0,r.createElementBlock)("foreignObject",Lu,[((0,r.openBlock)(),(0,r.createBlock)(r.Teleport,{to:n.value,disabled:!n.value},[(0,r.renderSlot)(o.$slots,"default")],8,["to","disabled"]))]))]))}});function Gu(t={includeHiddenNodes:!1}){const{nodes:e}=ge();return(0,r.computed)(()=>{if(e.value.length===0)return!1;for(const n of e.value)if((t.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}var Wu={class:"vue-flow__nodes vue-flow__container"},Uu=(0,r.defineComponent)({name:"Nodes",compatConfig:{MODE:3},setup(t){const{getNodes:e,updateNodeDimensions:n,emits:o}=ge(),i=Gu(),s=(0,r.ref)();return(0,r.watch)(i,a=>{a&&(0,r.nextTick)(()=>{o.nodesInitialized(e.value)})},{immediate:!0}),(0,r.onMounted)(()=>{s.value=new ResizeObserver(a=>{const l=a.map(d=>({id:d.target.getAttribute("data-id"),nodeElement:d.target,forceUpdate:!0}));(0,r.nextTick)(()=>n(l))})}),(0,r.onBeforeUnmount)(()=>{var a;return(a=s.value)==null?void 0:a.disconnect()}),(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",Wu,[s.value?((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,{key:0},(0,r.renderList)((0,r.unref)(e),(d,c,u,h)=>{const f=[d.id];if(h&&h.key===d.id&&(0,r.isMemoSame)(h,f))return h;const g=((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Hu),{id:d.id,key:d.id,"resize-observer":s.value},null,8,["id","resize-observer"]));return g.memo=f,g},l,0),128)):(0,r.createCommentVNode)("",!0)]))}});function Yu(){const{emits:t}=ge();(0,r.onMounted)(()=>{if(tr()){const e=document.querySelector(".vue-flow__pane");e&&window.getComputedStyle(e).zIndex!=="1"&&t.error(new we(ve.MISSING_STYLES))}})}var Xu=(0,r.createElementVNode)("div",{class:"vue-flow__edge-labels"},null,-1),ju=(0,r.defineComponent)({name:"VueFlow",compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(t,{expose:e,emit:n}){const o=t,i=(0,r.useSlots)(),s=Pn(o,"modelValue",n),a=Pn(o,"nodes",n),l=Pn(o,"edges",n),d=ge(o),c=Wd({modelValue:s,nodes:a,edges:l},o,d);return Yd(n,d.hooks),Mu(),Yu(),(0,r.provide)(gn,i),(0,r.onUnmounted)(c),e(d),(u,h)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{ref:(0,r.unref)(d).vueFlowRef,class:"vue-flow"},[(0,r.createVNode)(Nu,null,{default:(0,r.withCtx)(()=>[(0,r.createVNode)(Vu),Xu,(0,r.createVNode)(Uu),(0,r.renderSlot)(u.$slots,"zoom-pane")]),_:3}),(0,r.renderSlot)(u.$slots,"default"),(0,r.createVNode)(Tu)],512))}}),Zu=(0,r.defineComponent)({name:"Panel",compatConfig:{MODE:3},props:{position:{}},setup(t){const e=t,{userSelectionActive:n}=ge(),o=(0,r.computed)(()=>`${e.position}`.split("-"));return(i,s)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:(0,r.normalizeClass)(["vue-flow__panel",o.value]),style:(0,r.normalizeStyle)({pointerEvents:(0,r.unref)(n)?"none":"all"})},[(0,r.renderSlot)(i.$slots,"default")],6))}}),Ye=(t=>(t.Lines="lines",t.Dots="dots",t))(Ye||{}),Ku=function({dimensions:t,size:e,color:n}){return(0,r.h)("path",{stroke:n,"stroke-width":e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})},qu=function({radius:t,color:e}){return(0,r.h)("circle",{cx:t,cy:t,r:t,fill:e})};Ye.Lines,Ye.Dots;var Ju={[Ye.Dots]:"#81818a",[Ye.Lines]:"#eee"},Qu=["id","x","y","width","height","patternTransform"],ef={key:2,height:"100",width:"100"},tf=["fill"],nf=["x","y","fill"],of=(0,r.defineComponent)({name:"Background",compatConfig:{MODE:3},props:{id:{},variant:{default:()=>Ye.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(t){const{id:e,viewport:n}=ge(),o=(0,r.computed)(()=>{const a=n.value.zoom,[l,d]=Array.isArray(t.gap)?t.gap:[t.gap,t.gap],c=[l*a||1,d*a||1],u=t.size*a,[h,f]=Array.isArray(t.offset)?t.offset:[t.offset,t.offset];return{scaledGap:c,offset:[h*a||1+c[0]/2,f*a||1+c[1]/2],size:u}}),i=(0,r.toRef)(()=>`pattern-${e}${t.id?`-${t.id}`:""}`),s=(0,r.toRef)(()=>t.color||t.patternColor||Ju[t.variant||Ye.Dots]);return(a,l)=>((0,r.openBlock)(),(0,r.createElementBlock)("svg",{class:"vue-flow__background vue-flow__container",style:(0,r.normalizeStyle)({height:`${a.height>100?100:a.height}%`,width:`${a.width>100?100:a.width}%`})},[(0,r.renderSlot)(a.$slots,"pattern-container",{id:i.value},()=>[(0,r.createElementVNode)("pattern",{id:i.value,x:(0,r.unref)(n).x%o.value.scaledGap[0],y:(0,r.unref)(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[(0,r.renderSlot)(a.$slots,"pattern",{},()=>[a.variant===(0,r.unref)(Ye).Lines?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Ku),{key:0,size:a.lineWidth,color:s.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):a.variant===(0,r.unref)(Ye).Dots?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(qu),{key:1,color:s.value,radius:o.value.size/2},null,8,["color","radius"])):(0,r.createCommentVNode)("",!0),a.bgColor?((0,r.openBlock)(),(0,r.createElementBlock)("svg",ef,[(0,r.createElementVNode)("rect",{width:"100%",height:"100%",fill:a.bgColor},null,8,tf)])):(0,r.createCommentVNode)("",!0)])],8,Qu)]),(0,r.createElementVNode)("rect",{x:a.x,y:a.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,nf),(0,r.renderSlot)(a.$slots,"default",{id:i.value})],4))}}),rf={name:"ControlButton",compatConfig:{MODE:3}},sf=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n},af={type:"button",class:"vue-flow__controls-button"};function lf(t,e,n,o,i,s){return(0,r.openBlock)(),(0,r.createElementBlock)("button",af,[(0,r.renderSlot)(t.$slots,"default")])}var bn=sf(rf,[["render",lf]]),cf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},df=[(0,r.createElementVNode)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function uf(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",cf,df)}var ff={render:uf},hf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},gf=[(0,r.createElementVNode)("path",{d:"M0 0h32v4.2H0z"},null,-1)];function pf(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",hf,gf)}var mf={render:pf},yf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},vf=[(0,r.createElementVNode)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function _f(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",yf,vf)}var wf={render:_f},bf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Cf=[(0,r.createElementVNode)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function Ef(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",bf,Cf)}var xf={render:Ef},Nf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},kf=[(0,r.createElementVNode)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function Sf(t,e){return(0,r.openBlock)(),(0,r.createElementBlock)("svg",Nf,kf)}var Df={render:Sf},Tf=(0,r.defineComponent)({name:"Controls",compatConfig:{MODE:3},props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>xi.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(t,{emit:e}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:i,setInteractive:s,zoomIn:a,zoomOut:l,fitView:d,viewport:c,minZoom:u,maxZoom:h}=ge(),f=(0,r.toRef)(()=>n.value||o.value||i.value),g=(0,r.toRef)(()=>c.value.zoom<=u.value),p=(0,r.toRef)(()=>c.value.zoom>=h.value);function b(){a(),e("zoomIn")}function S(){l(),e("zoomOut")}function D(){d(t.fitViewParams),e("fitView")}function z(){s(!f.value),e("interactionChange",!f.value)}return(v,M)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Zu),{class:"vue-flow__controls",position:v.position},{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(v.$slots,"top"),v.showZoom?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:0},[(0,r.renderSlot)(v.$slots,"control-zoom-in",{},()=>[(0,r.createVNode)(bn,{class:"vue-flow__controls-zoomin",disabled:p.value,onClick:b},{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(v.$slots,"icon-zoom-in",{},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(ff))))])]),_:3},8,["disabled"])]),(0,r.renderSlot)(v.$slots,"control-zoom-out",{},()=>[(0,r.createVNode)(bn,{class:"vue-flow__controls-zoomout",disabled:g.value,onClick:S},{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(v.$slots,"icon-zoom-out",{},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(mf))))])]),_:3},8,["disabled"])])],64)):(0,r.createCommentVNode)("",!0),v.showFitView?(0,r.renderSlot)(v.$slots,"control-fit-view",{key:1},()=>[(0,r.createVNode)(bn,{class:"vue-flow__controls-fitview",onClick:D},{default:(0,r.withCtx)(()=>[(0,r.renderSlot)(v.$slots,"icon-fit-view",{},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(wf))))])]),_:3})]):(0,r.createCommentVNode)("",!0),v.showInteractive?(0,r.renderSlot)(v.$slots,"control-interactive",{key:2},()=>[v.showInteractive?((0,r.openBlock)(),(0,r.createBlock)(bn,{key:0,class:"vue-flow__controls-interactive",onClick:z},{default:(0,r.withCtx)(()=>[f.value?(0,r.renderSlot)(v.$slots,"icon-unlock",{key:0},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(Df))))]):(0,r.createCommentVNode)("",!0),f.value?(0,r.createCommentVNode)("",!0):(0,r.renderSlot)(v.$slots,"icon-lock",{key:1},()=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)((0,r.unref)(xf))))])]),_:3})):(0,r.createCommentVNode)("",!0)]):(0,r.createCommentVNode)("",!0),(0,r.renderSlot)(v.$slots,"default")]),_:3},8,["position"]))}}),Mf=["onClick"],If={class:"d-flow-node-menus-item-name"},Bf=(0,r.defineComponent)({name:"DNodeMenus",__name:"nodeMenus",props:{fromNodeId:{},handleId:{}},emits:["addNode"],setup(t,{emit:e}){const n=t,o=e,i=(0,r.inject)("d_flow_design_provide",{}),s=i.getFlowComponents?.()||[],a=l=>{o("addNode",l.type),(0,r.nextTick)(()=>{n.handleId==="line"?i.addNodeByLine?.(l.type,n.fromNodeId||""):i.addNode?.(l.type,n.fromNodeId||"",n.handleId||"")})};return(l,d)=>{const c=(0,r.resolveComponent)("j-icon");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"d-flow-node-menus",onClick:(0,r.withModifiers)(()=>{},["stop"])},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(s),(u,h)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:h,class:"d-flow-node-menus-item",onClick:f=>a(u)},[(0,r.createElementVNode)("div",{class:"d-flow-node-menus-item-icon",style:(0,r.normalizeStyle)({backgroundColor:u.iconColor||"var(--j-color-primary)"})},[(0,r.createVNode)(c,{icon:u.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,r.createElementVNode)("div",If,(0,r.toDisplayString)(u.name),1)],8,Mf))),128))])}}}),_o=Bf,zf={class:"d-flow-step-name"},Rf={key:0,style:{color:"var(--j-color-text-2)"}},Af={style:{color:"var(--j-color-text)"}},$f=(0,r.defineComponent)({name:"DStepNode",__name:"stepNode",props:{id:{},data:{}},setup(t){const e=t,{onNodeClick:n,onEdgeClick:o,onMoveStart:i,onConnectStart:s,onNodeDragStart:a,removeNodes:l,getEdges:d,getNodes:c,onNodesChange:u}=ge(),h=(0,r.inject)("d_flow_design_provide",{}),f=(0,r.computed)(()=>h.getFlowComponentMap?.value?.[e.data.type]||{}),g=()=>{l(e.id),h.onRemoveNode?.(e.id)},p=(0,r.ref)({});u(Y=>{if(e.data.isInit&&Y.findIndex(w=>w.type==="select"&&w.id===e.id&&w.id==="start"&&w.selected)!==-1){const w=c.value.find(V=>V.id==="start");w&&(w.data.isInit=!1),p.value.s1=!0}});const b=(0,r.ref)(!1),S=Y=>{Y.indexOf("t")!==-1&&!D.value||(b.value=!0,p.value[Y]=!0)},D=(0,r.computed)(()=>d.value.findIndex(Y=>Y.target===e.id)===-1),z=(0,r.ref)(!1),v=()=>{z.value=!0},M=(Y,w)=>{if(d.value.find(m=>m.source===w&&m.target===Y))return!0;const V=d.value.filter(m=>m.target===Y);for(let m=0;m<V.length;m++)if(M(V[m].source,w))return!0;return!1},U=Y=>z.value?(z.value=!1,!1):M(Y.source,Y.target)?!1:Y.source!==Y.target&&Y.sourceHandle!==Y.targetHandle&&Y.sourceHandle.indexOf("s")!==-1&&Y.targetHandle.indexOf("t")!==-1,$=()=>{G(),Object.keys(p.value).forEach(Y=>{p.value[Y]=!1})},Q=()=>{$()};n(()=>{console.log("onNodeClick"),b.value?b.value=!1:$()}),o(()=>{$()}),i(()=>{$()}),s(()=>{$()}),a(()=>{$()});const q=(0,r.ref)(),j=(0,r.ref)({top:0,left:0,bottom:0,right:0}),K=(0,r.ref)({getBoundingClientRect:()=>j.value}),G=()=>{q.value?.handleClose()},k=Y=>{const{clientX:w,clientY:V}=Y;j.value=DOMRect.fromRect({x:w,y:V}),Y.preventDefault(),q.value?.handleOpen()};return(Y,w)=>{const V=(0,r.resolveComponent)("j-icon"),m=(0,r.resolveComponent)("el-popover"),E=(0,r.resolveComponent)("el-tooltip"),B=(0,r.resolveComponent)("el-dropdown-item"),T=(0,r.resolveComponent)("el-dropdown-menu"),A=(0,r.resolveComponent)("el-dropdown");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{class:"d-flow-step",onContextmenu:(0,r.withModifiers)(k,["stop"])},[(0,r.createElementVNode)("div",{class:"d-flow-step-icon",style:(0,r.normalizeStyle)({backgroundColor:f.value.iconColor||"var(--j-color-primary)"})},[(0,r.createVNode)(V,{icon:f.value.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,r.createElementVNode)("div",zf,(0,r.toDisplayString)(f.value.name),1),t.data.type!=="start"?((0,r.openBlock)(),(0,r.createBlock)(E,{key:0,placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:(0,r.withCtx)(()=>[D.value?((0,r.openBlock)(),(0,r.createElementBlock)("div",Rf,[...w[4]||(w[4]=[(0,r.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击",-1),(0,r.createTextVNode)("添加节点 ",-1)])])):(0,r.createCommentVNode)("",!0),w[5]||(w[5]=(0,r.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,r.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),(0,r.createTextVNode)("连接节点 ")],-1))]),default:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(mt),{onClick:w[1]||(w[1]=H=>S("t1")),onMousedown:v,id:"t1",class:(0,r.normalizeClass)(["d-flow-step-target-handle",{"d-flow-step-target-handle-notadd":!D.value}]),type:"target",position:(0,r.unref)(ae).Left,"is-valid-connection":U},{default:(0,r.withCtx)(()=>[D.value?((0,r.openBlock)(),(0,r.createBlock)(m,{key:0,visible:p.value.t1,"onUpdate:visible":w[0]||(w[0]=H=>p.value.t1=H),placement:"left","popper-class":"d-flow-step-popper",trigger:"click","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:(0,r.withCtx)(()=>[(0,r.createVNode)(V,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:(0,r.withCtx)(()=>[(0,r.createVNode)(_o,{"handle-id":"t1","from-node-id":t.id,onAddNode:Q},null,8,["from-node-id"])]),_:1},8,["visible"])):(0,r.createCommentVNode)("",!0)]),_:1},8,["class","position"])]),_:1})):(0,r.createCommentVNode)("",!0),(0,r.createVNode)(E,{placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:(0,r.withCtx)(()=>[...w[6]||(w[6]=[(0,r.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,r.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击"),(0,r.createTextVNode)("添加节点 ")],-1),(0,r.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,r.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),(0,r.createTextVNode)("连接节点 ")],-1)])]),default:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(mt),{onClick:w[3]||(w[3]=H=>S("s1")),onMousedown:v,id:"s1",class:"d-flow-step-source-handle",type:"source",position:(0,r.unref)(ae).Right,"is-valid-connection":U},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(m,{visible:p.value.s1,"onUpdate:visible":w[2]||(w[2]=H=>p.value.s1=H),placement:"right",trigger:"click","popper-class":"d-flow-step-popper","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:(0,r.withCtx)(()=>[(0,r.createVNode)(V,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:(0,r.withCtx)(()=>[(0,r.createVNode)(_o,{"handle-id":"s1","from-node-id":t.id,onAddNode:Q},null,8,["from-node-id"])]),_:1},8,["visible"])]),_:1},8,["position"])]),_:1}),(0,r.createVNode)(A,{ref_key:"dropdownRef",ref:q,"popper-class":"d-flow-step-dropdown","virtual-ref":K.value,"show-arrow":!1,"popper-options":{modifiers:[{name:"offset",options:{offset:[0,0]}}]},"virtual-triggering":"",trigger:"contextmenu",placement:"bottom-start"},{dropdown:(0,r.withCtx)(()=>[(0,r.createVNode)(T,null,{default:(0,r.withCtx)(()=>[t.data.type!="start"?((0,r.openBlock)(),(0,r.createBlock)(B,{key:0,onClick:g},{default:(0,r.withCtx)(()=>[...w[7]||(w[7]=[(0,r.createTextVNode)("删除",-1)])]),_:1})):(0,r.createCommentVNode)("",!0),f.value.des?((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:1,style:(0,r.normalizeStyle)({width:"160px",padding:"4px 16px 0 16px","font-size":"12px","border-top":t.data.type!="start"?"1px solid var(--j-color-border)":void 0,"margin-top":t.data.type!="start"?"4px":void 0})},[w[8]||(w[8]=(0,r.createElementVNode)("div",{style:{"margin-bottom":"4px",color:"var(--j-color-text-2)"}},"关于",-1)),(0,r.createElementVNode)("div",Af,(0,r.toDisplayString)(f.value.des),1)],4)):(0,r.createCommentVNode)("",!0)]),_:1})]),_:1},8,["virtual-ref"])],32)}}}),Pf=$f,Of=(0,r.defineComponent)({name:"DEdgeWithButton",__name:"edgeWithButton",props:{id:{},sourceX:{},sourceY:{},targetX:{},targetY:{},sourcePosition:{},targetPosition:{},markerEnd:{},style:{}},setup(t){const e=t,{onEdgeMouseEnter:n,onEdgeMouseLeave:o,onNodeClick:i,onEdgeClick:s,onMoveStart:a,onConnectStart:l,onNodeDragStart:d}=ge(),c=(0,r.computed)(()=>mo(e)),u=(0,r.ref)(!1),h=(0,r.ref)(!1);n(({edge:S})=>{S.id===e.id&&(u.value=!0)}),o(()=>{u.value=!1});const f=(0,r.ref)(!1),g=()=>{f.value=!1,(0,r.nextTick)(()=>{h.value=!1})},p=()=>{h.value=!0,f.value=!0},b=()=>{g()};return i(()=>{g()}),s(()=>{g()}),a(()=>{g()}),l(()=>{g()}),d(()=>{g()}),(S,D)=>{const z=(0,r.resolveComponent)("j-icon"),v=(0,r.resolveComponent)("el-popover");return(0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createVNode)((0,r.unref)(Vt),{id:t.id,style:(0,r.normalizeStyle)(t.style),path:c.value[0],"marker-end":t.markerEnd},null,8,["id","style","path","marker-end"]),(0,r.createVNode)((0,r.unref)(Fu),null,{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${c.value[1]}px,${c.value[2]}px)`}),class:"nodrag nopan"},[(0,r.createVNode)(v,{visible:f.value,"show-arrow":!1,placement:"right","popper-class":"d-flow-step-popper"},{reference:(0,r.withCtx)(()=>[(0,r.withDirectives)((0,r.createElementVNode)("div",{onClick:(0,r.withModifiers)(p,["stop"]),class:"d-flow-edge-button"},[(0,r.createVNode)(z,{icon:"mdi:plus-circle"})],512),[[r.vShow,u.value||h.value]])]),default:(0,r.withCtx)(()=>[(0,r.createVNode)(_o,{"handle-id":"line","from-node-id":t.id,onAddNode:b},null,8,["from-node-id"])]),_:1},8,["visible"])],4)]),_:1})],64)}}}),Vf=Of,Hf=(0,r.defineComponent)({name:"DFlow",__name:"flow",props:{nodes:{default:()=>[]},edges:{default:()=>[]}},setup(t){return(e,n)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ju),{"min-zoom":.2,"max-zoom":4,"default-viewport":{zoom:1},"connection-mode":(0,r.unref)(We).Strict,nodes:t.nodes,edges:t.edges},{"edge-button":(0,r.withCtx)(o=>[(0,r.createVNode)(Vf,{id:o.id,"source-x":o.sourceX,"source-y":o.sourceY,"target-x":o.targetX,"target-y":o.targetY,"source-position":o.sourcePosition,"target-position":o.targetPosition,"marker-end":o.markerEnd,style:(0,r.normalizeStyle)(o.style)},null,8,["id","source-x","source-y","target-x","target-y","source-position","target-position","marker-end","style"])]),"node-step":(0,r.withCtx)(o=>[(0,r.createVNode)(Pf,(0,r.normalizeProps)((0,r.guardReactiveProps)(o)),null,16)]),default:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(Tf),{position:"bottom-left"}),(0,r.createVNode)((0,r.unref)(of))]),_:1},8,["connection-mode","nodes","edges"]))}}),Lf=Hf,Ff={class:"d-flow-design"},Gf={class:"d-flow-design-canvas"},Wf={class:"d-flow-design-right"},Uf={class:"d-flow-design-title"},Yf={class:"d-flow-design-title-name"},Xf={class:"d-flow-design-panel"},jf=(0,r.defineComponent)({name:"DFlowDesign",__name:"flowDesign",props:{components:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["nodeClick","edgeClick","paneClick","connect"],setup(t,{expose:e,emit:n}){const o=t,i=n,{addNodes:s,addEdges:a,removeEdges:l,addSelectedNodes:d,removeSelectedNodes:c,onConnect:u,onNodeClick:h,onPaneClick:f,onEdgeClick:g,getNodes:p,getEdges:b}=ge(),S=(0,r.computed)(()=>{const T={};return o.components.forEach(A=>{T[A.type]=A}),T.start={name:"开始",type:"start",icon:"ant-design:play-circle-outlined",des:"执行开始节点"},T}),D={id:"start",type:"step",data:{type:"start",isInit:!1},position:{x:80,y:160}},z=(0,r.ref)([D]),v=(0,r.ref)([]),M=(T,A)=>{if(A.indexOf("t")===-1){const H=b.value.filter(F=>F.source===T.id);if(H.length>0){let F=-1e6,te=0;return H.forEach(se=>{F=Math.max(F,se.targetNode.position.y+se.targetNode.dimensions.height+32),te=se.targetNode.position.x||0}),{x:te,y:F}}return{x:T.position.x+T.dimensions.width+100,y:T.position.y}}return{x:T.position.x-100-T.dimensions.width,y:T.position.y}},U=(T,A,H)=>{const F=p.value.find(se=>se.id===A);if(!F)return;const te={id:st(),type:"step",data:{type:T},position:M(F,H)};if(o.flowInit){const se=o.flowInit(te.data.type);se&&Object.keys(se).forEach(L=>{te.data[L]=se[L]})}s(te),H.indexOf("t")===-1?a({id:`${A}-${te.id}`,source:A,target:te.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Ue.Arrow}):a({id:`${A}-${te.id}`,source:te.id,target:A,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Ue.Arrow}),k(te.id)},$=T=>{const A=p.value.find(H=>H.id===T);A&&(A.position.x+=100+A.dimensions.width,b.value.filter(H=>H.source===T).forEach(H=>{$(H.target)}))},Q=(T,A)=>{const H=b.value.find(te=>te.id===A);if(!H)return;const F={id:st(),type:"step",data:{type:T},position:{x:H.targetNode.position.x,y:H.targetNode.position.y}};if(o.flowInit){const te=o.flowInit(F.data.type);te&&Object.keys(te).forEach(se=>{F.data[se]=te[se]})}s(F),a({id:`${H.sourceNode.id}-${F.id}`,source:H.sourceNode.id,target:F.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Ue.Arrow}),a({id:`${F.id}-${H.targetNode.id}`,source:F.id,target:H.targetNode.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Ue.Arrow}),l(A),$(H.target),k(F.id)};u(T=>{console.log("onConnect",T),T.type="button",T.markerEnd=Ue.Arrow,a(T),i("connect",T)});const q=()=>o.components||[],j=(0,r.ref)(),K=(0,r.computed)(()=>j.value?S.value[j.value.data.type]:void 0);h(T=>{j.value?.id!==T.node.id&&(j.value=T.node,V()),i("nodeClick",T.node)}),f(()=>{j.value=void 0,i("paneClick")}),g(T=>{j.value=void 0,i("edgeClick",T.edge)});const G=T=>{j.value?.id===T&&(j.value=void 0)},k=T=>{j.value&&c([j.value]),j.value=p.value.find(A=>A.id===T),j.value&&(V(),setTimeout(()=>{j.value&&d([j.value])},100))},Y=(0,r.ref)(),w={};Object.keys(o.flowComponentConfigs).forEach(T=>{const A={type:"j-collapse",config:{defaultValue:[]},children:[]};o.flowComponentConfigs[T].forEach((H,F)=>{const te=`_collapse${F}`;A.config?.defaultValue.push(te),A.children?.push(H)}),w[T]=[A]});const V=()=>{const T=w[j.value?.data.type||""];T&&Y.value?(Y.value.init&&Y.value.init(T,j.value?.data),o.flowComponentConfigInit&&o.flowComponentConfigInit({configRef:Y,inputParams:o.inputParams,components:p.value,configData:j.value?.data})):Y.value&&Y.value.init&&Y.value.init([])},m=(T,A)=>{j.value&&o.flowComponentConfigChange&&o.flowComponentConfigChange(j.value.data.type,{configRef:Y,component:T,configData:j.value.data,...A,isFlowNode:!0})};return(0,r.provide)("d_flow_design_provide",{getFlowComponents:q,addNode:U,addNodeByLine:Q,onRemoveNode:G,getFlowComponentMap:S}),e({getData:()=>{const T=[];return p.value.forEach(A=>{T.push({config:A.data,id:A.id,position:A.position,type:A.type})}),b.value.forEach(A=>{T.push({id:A.id,source:A.source,target:A.target,sourceHandle:A.sourceHandle,targetHandle:A.targetHandle,type:"line",config:{},position:{x:0,y:0}})}),T},setData:T=>{if(!T||T.length===0)D.data.isInit=!0,z.value=[D],k(D.id);else{D.data.isInit=!1;const A=[],H=[];T.forEach(F=>{if(F.type==="line")F.type="button",F.markerEnd=Ue.Arrow,H.push(F);else{const te={id:F.id,type:F.type,data:F.config,position:F.position};A.push(te)}}),z.value=A,v.value=H}}}),(T,A)=>{const H=(0,r.resolveComponent)("j-icon"),F=(0,r.resolveComponent)("j-form");return(0,r.openBlock)(),(0,r.createElementBlock)("div",Ff,[(0,r.createElementVNode)("div",Gf,[(0,r.createVNode)(Lf,{nodes:z.value,edges:v.value},null,8,["nodes","edges"])]),(0,r.withDirectives)((0,r.createElementVNode)("div",Wf,[(0,r.createElementVNode)("div",Uf,[(0,r.createElementVNode)("div",{class:"d-flow-design-title-icon",style:(0,r.normalizeStyle)({backgroundColor:K.value?.iconColor||"var(--j-color-primary)"})},[(0,r.createVNode)(H,{icon:K.value?.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,r.createElementVNode)("div",Yf,(0,r.toDisplayString)(K.value?.name||""),1)]),(0,r.createElementVNode)("div",Xf,[(0,r.createVNode)(F,{config:{labelPosition:"top"},style:{padding:"0"},ref_key:"configRef",ref:Y,onChange:m},null,512)])],512),[[r.vShow,j.value&&w[j.value.data.type]]])])}}}),Zf=jf,Er=Je(Zf),Kf={class:"d-input-flow j-block"},qf=(0,r.defineComponent)({name:"DInputFlow",__name:"inputFlow",props:{modelValue:{},type:{},btnText:{default:"事件"},title:{},size:{default:"default"},width:{default:1200},height:{default:800},beforeClose:{},flowComponents:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["update:modelValue","change"],setup(t,{emit:e}){const n=t,o=e,i=(0,r.ref)(),s=(0,r.computed)({get(){return n.modelValue},set(h){o("update:modelValue",h)}}),a=(0,r.computed)(()=>(n.modelValue?.trim(),n.btnText)),l=h=>{const f=typeof h=="string"?h:void 0;try{i.value?.setData(JSON.parse(f||"[]"))}catch{i.value?.setData([])}},d=async()=>{const h=i.value?.getData();return h?JSON.stringify(h):void 0},c=h=>{if(n.beforeClose){const f=typeof h=="string"?h:void 0;return n.beforeClose(f)}return!0},u=h=>{const f=h.value;o("change",{value:typeof f=="string"?f:void 0})};return(h,f)=>{const g=(0,r.resolveComponent)("d-flow-design"),p=(0,r.resolveComponent)("j-input-button");return(0,r.openBlock)(),(0,r.createBlock)(p,(0,r.mergeProps)(h.$attrs,{type:t.type,"btn-text":a.value,title:t.title,size:t.size,width:t.width,height:t.height,"before-close":c,ok:d,open:l,"destroy-on-close":"",modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=b=>s.value=b),onChange:u}),{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",Kf,[(0,r.createVNode)(g,{ref_key:"flowRef",ref:i,components:t.flowComponents,"flow-init":t.flowInit,"flow-component-config-init":t.flowComponentConfigInit,"flow-component-configs":t.flowComponentConfigs,"flow-component-config-change":t.flowComponentConfigChange,"input-params":t.inputParams},null,8,["components","flow-init","flow-component-config-init","flow-component-configs","flow-component-config-change","input-params"])])]),_:1},16,["type","btn-text","title","size","width","height","modelValue"])}}}),Jf=qf,xr=Je(Jf),O=class Me{static getElements(e,n=document){if(typeof e=="string"){const o="getElementById"in n?n:void 0;if(o&&!isNaN(+e[0])){const s=o.getElementById(e);return s?[s]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const s=n.querySelector(`[gs-id="${e}"]`);return s?[s]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const o="getElementById"in n?n:void 0;if(!e.length)return null;if(o&&e[0]==="#")return o.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(o&&!isNaN(+e[0]))return o.getElementById(e);let i=n.querySelector(e);return o&&!i&&(i=o.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,n){const o=document.createElement("div");return e.forEach(i=>{i&&o.classList.add(i)}),n?.appendChild(o),o}static shouldSizeToContent(e,n=!1){return e?.grid&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return Me.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const o=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=o)return 0;const s=e.y>n.y?e.y:n.y,a=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return a<=s?0:(i-o)*(a-s)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,s)=>{const a=n*((i.y??1e4)-(s.y??1e4));return a===0?n*((i.x??1e4)-(s.x??1e4)):a})}static find(e,n){return n?e.find(o=>o.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,o="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);o=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:o}}static defaults(e,...n){return n.forEach(o=>{for(const i in o){if(!o.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=o[i]:typeof o[i]=="object"&&typeof e[i]=="object"&&Me.defaults(e[i],o[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const o in e)if(e[o]!==n[o])return!1;return!0}static copyPos(e,n,o=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),o&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let o in e){const i=e[o],s=n[o];o[0]==="_"||i===s?delete e[o]:i&&typeof i=="object"&&s!==void 0&&(Me.removeInternalAndSame(i,s),Object.keys(i).length||delete e[o])}}static removeInternalForSave(e,n=!0){for(let o in e)(o[0]==="_"||e[o]===null||e[o]===void 0)&&delete e[o];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let o=!1;return(...i)=>{o||(o=!0,setTimeout(()=>{e(...i),o=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e);return/(auto|scroll)/.test(n.overflow+n.overflowY)?e:Me.getScrollElement(e.parentElement)}static updateScrollPosition(e,n,o){const i=Me.getScrollElement(e);if(!i)return;const s=e.getBoundingClientRect(),a=i.getBoundingClientRect(),l=window.innerHeight||document.documentElement.clientHeight,d=s.bottom-Math.min(a.bottom,l),c=s.top-Math.max(a.top,0),u=i.scrollTop;c<0&&o<0?e.offsetHeight>a.height?i.scrollTop+=o:i.scrollTop+=Math.abs(c)>Math.abs(o)?o:c:d>0&&o>0&&(e.offsetHeight>a.height?i.scrollTop+=o:i.scrollTop+=d>o?o:d),n.top+=i.scrollTop-u}static updateScrollResize(e,n,o){const i=Me.getScrollElement(n),s=i.clientHeight,a=i===Me.getScrollElement()?0:i.getBoundingClientRect().top,l=e.clientY-a,d=l<o,c=l>s-o;d?i.scrollBy({behavior:"smooth",top:l-o}):c&&i.scrollBy({behavior:"smooth",top:o-(s-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],o=Me.clone(e);for(const i in o)o.hasOwnProperty(i)&&typeof o[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(s=>s===i)&&(o[i]=Me.cloneDeep(e[i]));return o}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let o;typeof n=="string"?o=Me.getElement(n):o=n,o&&o.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const o in n)n.hasOwnProperty(o)&&(Array.isArray(n[o])?n[o].forEach(i=>{e.style[o]=i}):e.style[o]=n[o])}static initEvent(e,n){const o={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>o[s]=e[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>o[s]=e[s]),{...o,...i}}static simulateMouseEvent(e,n,o){const i=e,s=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(o||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const n=document.createElement("div");Me.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const o=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/o.width,yScale:1/o.height,xOffset:o.left,yOffset:o.top}}static swap(e,n,o){if(!e)return;const i=e[n];e[n]=e[o],e[o]=i}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}},wo=class _t{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,o,i={}){if(this.sortNodes(-1),o=o||this.collide(e,n),!o)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,o))return!0;let s=n;!this._loading&&this._useEntireRowArea(e,n)&&(s={x:0,w:this.column,y:n.y,h:n.h},o=this.collide(e,s,i.skip));let a=!1;const l={nested:!0,pack:!1};let d=0;for(;o=o||this.collide(e,s,i.skip);){if(d++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(o.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(o,{...o,y:e.y},e)||!this.collide(o,{...o,y:n.y-o.h},e))){e._skipDown=e._skipDown||n.y>e.y;const u={...n,y:o.y+o.h,...l};c=this._loading&&O.samePos(e,u)?!0:this.moveNode(e,u),(o.locked||this._loading)&&c?O.copyPos(n,e):!o.locked&&c&&i.pack&&(this._packNodes(),n.y=o.y+o.h,O.copyPos(e,n)),a=a||c}else c=this.moveNode(o,{...o,y:n.y+n.h,skip:e,...l});if(!c)return a;o=void 0}return a}collide(e,n=e,o){const i=e._id,s=o?._id;return this.nodes.find(a=>a._id!==i&&a._id!==s&&O.isIntercepted(a,n))}collideAll(e,n=e,o){const i=e._id,s=o?._id;return this.nodes.filter(a=>a._id!==i&&a._id!==s&&O.isIntercepted(a,n))}directionCollideCoverage(e,n,o){if(!n.rect||!e._rect)return;const i=e._rect,s={...n.rect};s.y>i.y?(s.h+=s.y-i.y,s.y=i.y):s.h+=i.y-s.y,s.x>i.x?(s.w+=s.x-i.x,s.x=i.x):s.w+=i.x-s.x;let a,l=.5;for(let d of o){if(d.locked||!d._rect)break;const c=d._rect;let u=Number.MAX_VALUE,h=Number.MAX_VALUE;i.y<c.y?u=(s.y+s.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(u=(c.y+c.h-s.y)/c.h),i.x<c.x?h=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(h=(c.x+c.w-s.x)/c.w);const f=Math.min(h,u);f>l&&(l=f,a=d)}return n.collide=a,a}cacheRects(e,n,o,i,s,a){return this.nodes.forEach(l=>l._rect={y:l.y*n+o,x:l.x*e+a,w:l.w*e-a-i,h:l.h*n-o-s}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function o(){const s=n.x,a=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=s,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=a):(e.x=s,e.y=a),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=O.isTouching(e,n)))return o();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=O.isTouching(e,n)))){if(n.y<e.y){const s=e;e=n,n=s}return o()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=O.isTouching(e,n)))){if(n.x<e.x){const s=e;e=n,n=s}return o()}return!1}}}isAreaEmpty(e,n,o,i){const s={x:e||0,y:n||0,w:o||1,h:i||1};return!this.collide(s)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const o=this.batchMode;o||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const s=this.nodes;return this.nodes=[],s.forEach((a,l,d)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=d[l-1])),this.addNode(a,!1,c)}),i||delete this._inColumnResize,o||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=O.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const o=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:o,w:e.w,h:e.h})))break;e._dirty=e.y!==o,e.y=o}}),this)}prepareNode(e,n){e._id=e._id??_t._idSeq++;const o=e.id;if(o){let s=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=o+"_"+s++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return O.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,O.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const o=e._orig||O.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const i={...e};i.autoPosition||i.x===void 0?(delete i.x,delete i.y):i.x=Math.min(this.defaultColumn-1,i.x),i.w=Math.min(this.defaultColumn,i.w||1),this.cacheOneLayout(i,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),O.samePos(e,o)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!O.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=O.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||O.samePos(e,e._orig)||(O.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,o=this.column,i){const s=i?i.y*o+(i.x+i.w):0;let a=!1;for(let l=s;!a;++l){const d=l%o,c=Math.floor(l/o);if(d+e.w>o)continue;const u={x:d,y:c,w:e.w,h:e.h};n.find(h=>O.isIntercepted(u,h))||((e.x!==d||e.y!==c)&&(e._dirty=!0),e.x=d,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,n=!1,o){const i=this.nodes.find(a=>a._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let s;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,o)&&(delete e.autoPosition,s=!0),this.nodes.push(e),n&&this.addedNodes.push(e),s||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,o=!1){return this.nodes.find(i=>i._id===e._id)?(o&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const o=this.nodes;return this.removedNodes=n?o:[],this.nodes=[],this._notify(o)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let o;const i=new _t({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(o={...a},o):{...a})});if(!o)return!1;const s=i.moveNode(o,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!s&&!n.resizing&&n.collide){const a=n.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return s?(i.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(d=>d._id===a._id);l&&(O.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new _t({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),o={...e};return this.cleanupNode(o),delete o.el,delete o._id,delete o.content,delete o.grid,n.addNode(o),n.getRow()<=this.maxRow?(e._willFitPos=O.copyPos({},o),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){if(!e||!n)return!1;let o;n.pack===void 0&&!this.batchMode&&(o=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,s=O.copyPos({},e,!0);if(O.copyPos(s,n),this.nodeBoundFix(s,i),O.copyPos(n,s),!n.forceCollide&&O.samePos(e,n))return!1;const a=O.copyPos({},e),l=this.collideAll(e,s,n.skip);let d=!0;if(l.length){const c=e._moving&&!n.nested;let u=c?this.directionCollideCoverage(e,n,l):l[0];if(c&&u&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const h=O.areaIntercept(n.rect,u._rect),f=O.area(n.rect),g=O.area(u._rect);h/(f<g?f:g)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?d=!this._fixCollisions(e,s,u,n):(d=!1,o&&delete n.pack)}return d&&!O.samePos(e,s)&&(e._dirty=!0,O.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!O.samePos(e,a)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,o){const i=this._layouts?.length||0;let s;i&&(o?o!==this.column&&(s=this._layouts[o]):this.column!==i-1&&(s=this._layouts[i-1]));const a=[];return this.sortNodes(),this.nodes.forEach(l=>{const d=s?.find(u=>u._id===l._id),c={...l,...d||{}};O.removeInternalForSave(c,!e),n&&n(l,c),a.push(c)}),a}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,o)=>{if(!n||o===this.column)return this;if(o<this.column)this._layouts[o]=void 0;else{const i=o/this.column;e.forEach(s=>{if(!s._orig)return;const a=n.find(l=>l._id===s._id);a&&(a.y>=0&&s.y!==s._orig.y&&(a.y+=s.y-s._orig.y,a.y<0&&(a.y=0)),s.x!==s._orig.x&&(a.x=Math.round(s.x*i),a.x<0&&(a.x=0)),s.w!==s._orig.w&&(a.w=Math.round(s.w*i),a.w<1&&(a.w=1)))})}}),this)}columnChanged(e,n,o="moveScale"){if(!this.nodes.length||!n||e===n)return this;const i=o==="compact"||o==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let s=[],a=i?this.nodes:O.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],d=this._layouts.length-1;!l.length&&e!==d&&this._layouts[d]?.length&&(e=d,this._layouts[d].forEach(c=>{const u=a.find(h=>h._id===c._id);u&&(!i&&!c.autoPosition&&(u.x=c.x??u.x,u.y=c.y??u.y),u.w=c.w??u.w,(c.x==null||c.y===void 0)&&(u.autoPosition=!0))})),l.forEach(c=>{const u=a.findIndex(h=>h._id===c._id);if(u!==-1){const h=a[u];if(i){h.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,s),c.autoPosition||(h.x=c.x??h.x,h.y=c.y??h.y,h.w=c.w??h.w,s.push(h)),a.splice(u,1)}})}if(i)this.compact(o,!1);else{if(a.length)if(typeof o=="function")o(n,e,s,a);else{const l=i||o==="none"?1:n/e,d=o==="move"||o==="moveScale",c=o==="scale"||o==="moveScale";a.forEach(u=>{u.x=n===1?0:d?Math.round(u.x*l):Math.min(u.x,n-1),u.w=n===1||e===1?1:c?Math.round(u.w*l)||1:Math.min(u.w,n),s.push(u)}),a=[]}s=O.sort(s,-1),this._inColumnResize=!0,this.nodes=[],s.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,o=!1){const i=[];return e.forEach((s,a)=>{s._id===void 0&&(s._id=(s.id?this.nodes.find(l=>l.id===s.id):void 0)?._id??_t._idSeq++),i[a]={x:s.x,y:s.y,w:s.w,_id:s._id}}),this._layouts=o?[]:this._layouts||[],this._layouts[n]=i,this}cacheOneLayout(e,n){e._id=e._id??_t._idSeq++;const o={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete o.x,delete o.y,e.autoPosition&&(o.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[n]=this._layouts[n]||[];const i=this.findCacheLayout(e,n);return i===-1?this._layouts[n].push(o):this._layouts[n][i]=o,this}findCacheLayout(e,n){return this._layouts?.[n]?.findIndex(o=>o._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let n=0;n<this._layouts.length;n++){const o=this.findCacheLayout(e,n);o!==-1&&this._layouts[n].splice(o,1)}}cleanupNode(e){for(const n in e)n[0]==="_"&&n!=="_id"&&delete e[n];return this}};wo._idSeq=0;var De={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"},ue=class{},Re=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),Te=class{};function Cn(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),O.simulateMouseEvent(t.changedTouches[0],e))}function Nr(t,e){t.cancelable&&t.preventDefault(),O.simulateMouseEvent(t,e)}function En(t){Te.touchHandled||(Te.touchHandled=!0,Cn(t,"mousedown"))}function xn(t){Te.touchHandled&&Cn(t,"mousemove")}function Nn(t){if(!Te.touchHandled)return;Te.pointerLeaveTimeout&&(window.clearTimeout(Te.pointerLeaveTimeout),delete Te.pointerLeaveTimeout);const e=!!ue.dragElement;Cn(t,"mouseup"),e||Cn(t,"click"),Te.touchHandled=!1}function kn(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function kr(t){ue.dragElement&&t.pointerType!=="mouse"&&Nr(t,"mouseenter")}function Sr(t){ue.dragElement&&t.pointerType!=="mouse"&&(Te.pointerLeaveTimeout=window.setTimeout(()=>{delete Te.pointerLeaveTimeout,Nr(t,"mouseleave")},10))}var Dr=class Ur{constructor(e,n,o){this.host=e,this.dir=n,this.option=o,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${Ur.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),Re&&(this.el.addEventListener("touchstart",En),this.el.addEventListener("pointerdown",kn)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Re&&(this.el.removeEventListener("touchstart",En),this.el.removeEventListener("pointerdown",kn)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Re&&(this.el.addEventListener("touchmove",xn),this.el.addEventListener("touchend",Nn)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const n=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Re&&(this.el.removeEventListener("touchmove",xn),this.el.removeEventListener("touchend",Nn)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,n){return this.option[e]&&this.option[e](n),this}};Dr.prefix="ui-resizable-";var bo=class{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,e){this._eventRegister[t]=e}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,e){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](e)}},Tr=class Eo extends bo{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},s=this.temporalRect||i;return{position:{left:(s.left-o.left)*this.rectScale.x,top:(s.top-o.top)*this.rectScale.y},size:{width:s.width*this.rectScale.x,height:s.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const n=e.handles&&e.handles!==this.option.handles,o=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(i=>this.option[i]=e[i]),n&&(this._removeHandlers(),this._setupHandlers()),o&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),ue.overResizeElement===this&&delete ue.overResizeElement),this}_mouseOver(e){ue.overResizeElement||ue.dragElement||(ue.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){ue.overResizeElement===this&&(delete ue.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Dr(this.el,e,{element:this.option.element,start:n=>this._resizeStart(n),stop:n=>this._resizeStop(n),move:n=>this._resizing(n,e)})),this}_resizeStart(e){this.sizeToContent=O.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=O.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=O.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(n,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",n),this}_resizing(e,n){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,n),this._applyChange();const o=O.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(o,this._ui()),this.triggerEvent("resize",o),this}_resizeStop(e){const n=O.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(n),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",n),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=Eo._originStyleProp.map(o=>this.el.style[o]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=O.getValuesFromTransformedElement(e);return this.rectScale={x:n.xScale,y:n.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return Eo._originStyleProp.forEach((e,n)=>{this.el.style[e]=this.elOriginStyleVal[n]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,n){const o=this.startEvent,i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},s=e.clientX-o.clientX,a=this.sizeToContent?0:e.clientY-o.clientY;let l,d;n.indexOf("e")>-1?i.width+=s:n.indexOf("w")>-1&&(i.width-=s,i.left+=s,l=!0),n.indexOf("s")>-1?i.height+=a:n.indexOf("n")>-1&&(i.height-=a,i.top+=a,d=!0);const c=this._constrainSize(i.width,i.height,l,d);return Math.round(i.width)!==Math.round(c.width)&&(n.indexOf("w")>-1&&(i.left+=i.width-c.width),i.width=c.width),Math.round(i.height)!==Math.round(c.height)&&(n.indexOf("n")>-1&&(i.top+=i.height-c.height),i.height=c.height),i}_constrainSize(e,n,o,i){const s=this.option,a=(o?s.maxWidthMoveLeft:s.maxWidth)||Number.MAX_SAFE_INTEGER,l=s.minWidth/this.rectScale.x||e,d=(i?s.maxHeightMoveUp:s.maxHeight)||Number.MAX_SAFE_INTEGER,c=s.minHeight/this.rectScale.y||n;return{width:Math.min(a,Math.max(l,e)),height:Math.min(d,Math.max(c,n))}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const{left:n,top:o}=this.el.parentElement.getBoundingClientRect();e={left:n,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(n=>{const o=this.temporalRect[n],i=n==="width"||n==="left"?this.rectScale.x:n==="height"||n==="top"?this.rectScale.y:1;this.el.style[n]=(o-e[n])*i+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}};Tr._originStyleProp=["width","height","position","left","top","opacity","zIndex"];var Qf='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle',Mr=class xo extends bo{constructor(e,n={}){super(),this.el=e,this.option=n,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const o=n?.handle?.substring(1),i=e.gridstackNode;this.dragEls=!o||e.classList.contains(o)?[e]:i?.subGrid?[e.querySelector(n.handle)||e]:Array.from(e.querySelectorAll(n.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),Re&&(e.addEventListener("touchstart",En),e.addEventListener("pointerdown",kn))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),Re&&(n.removeEventListener("touchstart",En),n.removeEventListener("pointerdown",kn))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this}_mouseDown(e){if(Te.touchHandled&&e.isTrusted&&(Te.touchHandled=!1),!ue.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(Qf)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete ue.dragElement,delete ue.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Re&&(e.currentTarget.addEventListener("touchmove",xn),e.currentTarget.addEventListener("touchend",Nn)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),ue.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=O.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(n,this.ui()),this.triggerEvent("drag",n)}_mouseMove(e){const n=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),ue.pauseDrag){const o=Number.isInteger(ue.pauseDrag)?ue.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),o)}else this._callDrag(e);else if(Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>3){this.dragging=!0,ue.dragElement=this;const o=this.el.gridstackNode?.grid;o?ue.dropElement=o.el.ddElement.ddDroppable:delete ue.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=O.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const i=O.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(i,this.ui()),this.triggerEvent("dragstart",i),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Re&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",xn,!0),e.currentTarget.removeEventListener("touchend",Nn,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),ue.dropElement?.el===this.el.parentElement&&delete ue.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const n=O.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(n),this.triggerEvent("dragstop",n),ue.dropElement&&ue.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete ue.dragElement,delete ue.dropElement,delete ue.mouseHandled,e.preventDefault()}_keyEvent(e){const n=this.el.gridstackNode,o=n?.grid||ue.dropElement?.el?.gridstack;if(e.key==="Escape")n&&n._origRotate&&(n._orig=n._origRotate,delete n._origRotate),o?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(n&&o&&(e.key==="r"||e.key==="R")){if(!O.canBeRotated(n))return;n._origRotate=n._origRotate||{...n._orig},delete n._moving,o.setAnimation(!1).rotate(n.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),n._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,n.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",O.swap(n._orig,"w","h"),delete n._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=O.cloneNode(this.el)),e.parentElement||O.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=xo.originStyleProp.map(n=>this.el.style[n]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const n=this.helper.style;return n.pointerEvents="none",n.width=this.dragOffset.width+"px",n.height=this.dragOffset.height+"px",n.willChange="left, top",n.position="fixed",this._dragFollow(e),n.transition="none",setTimeout(()=>{this.helper&&(n.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const e=this.helper,n=this.dragElementOriginStyle.transition||null;e.style.transition=this.dragElementOriginStyle.transition="none",xo.originStyleProp.forEach(o=>e.style[o]=this.dragElementOriginStyle[o]||null),setTimeout(()=>e.style.transition=n,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const n={left:0,top:0},o=this.helper.style,i=this.dragOffset;o.left=(e.clientX+i.offsetLeft-n.left)*this.dragTransform.xScale+"px",o.top=(e.clientY+i.offsetTop-n.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,n,o){let i=0,s=0;o&&(i=this.dragTransform.xOffset,s=this.dragTransform.yOffset);const a=n.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-i,offsetTop:-e.clientY+a.top-s,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const e=this.el.parentElement.getBoundingClientRect(),n=this.helper.getBoundingClientRect();return{position:{top:(n.top-e.top)*this.dragTransform.yScale,left:(n.left-e.left)*this.dragTransform.xScale}}}};Mr.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];var eh=class extends bo{constructor(t,e={}){super(),this.el=t,this.option=e,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,e){super.on(t,e)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Re&&(this.el.addEventListener("pointerenter",kr),this.el.addEventListener("pointerleave",Sr)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Re&&(this.el.removeEventListener("pointerenter",kr),this.el.removeEventListener("pointerleave",Sr)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(e=>this.option[e]=t[e]),this._setupAccept(),this}_mouseEnter(t){if(!ue.dragElement||Te.touchHandled&&t.isTrusted||!this._canDrop(ue.dragElement.el))return;t.preventDefault(),t.stopPropagation(),ue.dropElement&&ue.dropElement!==this&&ue.dropElement._mouseLeave(t,!0),ue.dropElement=this;const e=O.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(e,this._ui(ue.dragElement)),this.triggerEvent("dropover",e),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,e=!1){if(!ue.dragElement||ue.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const n=O.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(n,this._ui(ue.dragElement)),this.triggerEvent("dropout",n),ue.dropElement===this&&(delete ue.dropElement,!e)){let o,i=this.el.parentElement;for(;!o&&i;)o=i.ddElement?.ddDroppable,i=i.parentElement;o&&o._mouseEnter(t)}}drop(t){t.preventDefault();const e=O.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(e,this._ui(ue.dragElement)),this.triggerEvent("drop",e)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}},th=class Yr{static init(e){return e.ddElement||(e.ddElement=new Yr(e)),e.ddElement}constructor(e){this.el=e}on(e,n){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,n):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,n):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,n),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Mr(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new Tr(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new eh(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}},nh=class{resizable(t,e,n,o){return this._getDDElements(t,e).forEach(i=>{if(e==="disable"||e==="enable")i.ddResizable&&i.ddResizable[e]();else if(e==="destroy")i.ddResizable&&i.cleanResizable();else if(e==="option")i.setupResizable({[n]:o});else{const s=i.el.gridstackNode.grid;let a=i.el.getAttribute("gs-resize-handles")||s.opts.resizable.handles||"e,s,se";a==="all"&&(a="n,e,s,w,se,sw,ne,nw");const l=!s.opts.alwaysShowResizeHandle;i.setupResizable({...s.opts.resizable,handles:a,autoHide:l,start:e.start,stop:e.stop,resize:e.resize})}}),this}draggable(t,e,n,o){return this._getDDElements(t,e).forEach(i=>{if(e==="disable"||e==="enable")i.ddDraggable&&i.ddDraggable[e]();else if(e==="destroy")i.ddDraggable&&i.cleanDraggable();else if(e==="option")i.setupDraggable({[n]:o});else{const s=i.el.gridstackNode.grid;i.setupDraggable({...s.opts.draggable,start:e.start,stop:e.stop,drag:e.drag})}}),this}dragIn(t,e){return this._getDDElements(t).forEach(n=>n.setupDraggable(e)),this}droppable(t,e,n,o){return typeof e.accept=="function"&&!e._accept&&(e._accept=e.accept,e.accept=i=>e._accept(i)),this._getDDElements(t,e).forEach(i=>{e==="disable"||e==="enable"?i.ddDroppable&&i.ddDroppable[e]():e==="destroy"?i.ddDroppable&&i.cleanDroppable():e==="option"?i.setupDroppable({[n]:o}):i.setupDroppable(e)}),this}isDroppable(t){return!!(t?.ddElement?.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){return!!(t?.ddElement?.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){return!!(t?.ddElement?.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,e,n){return this._getDDElements(t).forEach(o=>o.on(e,i=>{n(i,ue.dragElement?ue.dragElement.el:i.target,ue.dragElement?ue.dragElement.helper:null)})),this}off(t,e){return this._getDDElements(t).forEach(n=>n.off(e)),this}_getDDElements(t,e){const n=t.gridstack||e!=="destroy"&&e!=="disable",o=O.getElements(t);return o.length?o.map(i=>i.ddElement||(n?th.init(i):null)).filter(i=>i):[]}},Ce=new nh,yt=class de{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const o=de.getGridElement(n);return o?(o.gridstack||(o.gridstack=new de(o,O.cloneDeep(e))),o.gridstack):(console.error(typeof n=="string"?'GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
27
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},n=".grid-stack"){const o=[];return typeof document>"u"||(de.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new de(i,O.cloneDeep(e))),o.push(i.gridstack)}),o.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
28
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),o}static addGrid(e,n={}){if(!e)return null;let o=e;if(o.gridstack){const i=o.gridstack;return n&&(i.opts={...i.opts,...n}),n.children!==void 0&&i.load(n.children),i}return(!e.classList.contains("grid-stack")||de.addRemoveCB)&&(de.addRemoveCB?o=de.addRemoveCB(e,n,!0,!0):o=O.createDiv(["grid-stack",n.class],e)),de.init(n,o)}static registerEngine(e){de.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=O.createDiv([this.opts.placeholderClass,De.itemClass,this.opts.itemClass]);const e=O.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,n={}){this.el=e,this.opts=n,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=n=n||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),n.row&&(n.minRow=n.maxRow=n.row,delete n.row);const o=O.toNumber(e.getAttribute("gs-row"));n.column==="auto"&&delete n.column,n.alwaysShowResizeHandle!==void 0&&(n._alwaysShowResizeHandle=n.alwaysShowResizeHandle);const i=n.columnOpts;if(i){const d=i.breakpoints;!i.columnWidth&&!d?.length?delete n.columnOpts:(i.columnMax=i.columnMax||12,d?.length>1&&d.sort((c,u)=>(u.w||0)-(c.w||0)))}const s={...O.cloneDeep(De),column:O.toNumber(e.getAttribute("gs-column"))||De.column,minRow:o||O.toNumber(e.getAttribute("gs-min-row"))||De.minRow,maxRow:o||O.toNumber(e.getAttribute("gs-max-row"))||De.maxRow,staticGrid:O.toBool(e.getAttribute("gs-static"))||De.staticGrid,sizeToContent:O.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||De.draggable.handle},removableOptions:{accept:n.itemClass||De.removableOptions.accept,decline:De.removableOptions.decline}};e.getAttribute("gs-animate")&&(s.animate=O.toBool(e.getAttribute("gs-animate"))),n=O.defaults(n,s),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(n),n.rtl==="auto"&&(n.rtl=e.style.direction==="rtl"),n.rtl&&this.el.classList.add("grid-stack-rtl");const a=this.el.closest("."+De.itemClass)?.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=n.cellHeight==="auto",this._isAutoCellHeight||n.cellHeight==="initial")this.cellHeight(void 0);else{typeof n.cellHeight=="number"&&n.cellHeightUnit&&n.cellHeightUnit!==De.cellHeightUnit&&(n.cellHeight=n.cellHeight+n.cellHeightUnit,delete n.cellHeightUnit);const d=n.cellHeight;delete n.cellHeight,this.cellHeight(d)}n.alwaysShowResizeHandle==="mobile"&&(n.alwaysShowResizeHandle=Re),this._setStaticClass();const l=n.engineClass||de.engineClass||wo;if(this.engine=new l({column:this.getColumn(),float:n.float,maxRow:n.maxRow,onChange:d=>{d.forEach(c=>{const u=c.el;u&&(c._removeDOM?(u&&u.remove(),delete c._removeDOM):this._writePosAttr(u,c))}),this._updateContainerHeight()}}),n.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(d=>this._prepareElement(d)),delete this.engine._loading,this.batchUpdate(!1)),n.children){const d=n.children;delete n.children,d.length&&this.load(d)}this.setAnimation(),n.subGridDynamic&&!ue.pauseDrag&&(ue.pauseDrag=!0),n.draggable?.pause!==void 0&&(ue.pauseDrag=n.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let n,o=e;if(o.grid=this,o.el?n=o.el:de.addRemoveCB?n=de.addRemoveCB(this.el,e,!0,!1):n=this.createWidgetDivs(o),!n)return;if(o=n.gridstackNode,o&&n.parentElement===this.el&&this.engine.nodes.find(s=>s._id===o._id))return n;const i=this._readAttr(n);return O.defaults(e,i),this.engine.prepareNode(e),this.el.appendChild(n),this.makeWidget(n,e),n}createWidgetDivs(e){const n=O.createDiv(["grid-stack-item",this.opts.itemClass]),o=O.createDiv(["grid-stack-item-content"],n);return O.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([i])=>{i.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,de.renderCB(o,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(n))):de.renderCB(o,e),n}makeSubGrid(e,n,o,i=!0){let s=e.gridstackNode;if(s||(s=this.makeWidget(e).gridstackNode),s.subGrid?.el)return s.subGrid;let a,l=this;for(;l&&!a;)a=l.opts?.subGridOpts,l=l.parentGridNode?.grid;n=O.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...n||s.subGridOpts||{}}),s.subGridOpts=n;let d;n.column==="auto"&&(d=!0,n.column=Math.max(s.w||1,o?.w||1),delete n.columnOpts);let c=s.el.querySelector(".grid-stack-item-content"),u,h;if(i&&(this._removeDD(s.el),h={...s,x:0,y:0},O.removeInternalForSave(h),delete h.subGridOpts,s.content&&(h.content=s.content,delete s.content),de.addRemoveCB?u=de.addRemoveCB(this.el,h,!0,!1):(u=O.createDiv(["grid-stack-item"]),u.appendChild(c),c=O.createDiv(["grid-stack-item-content"],s.el)),this.prepareDragDrop(s.el)),o){const g=d?n.column:s.w,p=s.h+o.h,b=s.el.style;b.transition="none",this.update(s.el,{w:g,h:p}),setTimeout(()=>b.transition=null)}const f=s.subGrid=de.addGrid(c,n);return o?._moving&&(f._isTemp=!0),d&&(f._autoColumn=!0),i&&f.makeWidget(u,h),o&&(o._moving?window.setTimeout(()=>O.simulateMouseEvent(o._event,"mouseenter",f.el),0):f.makeWidget(s.el,s)),this.resizeToContentCheck(!1,s),f}removeAsSubGrid(e){const n=this.parentGridNode?.grid;n&&(n.batchUpdate(),n.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,n.makeWidget(o.el,o)}),n.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>O.simulateMouseEvent(e._event,"mouseenter",n.el),0))}save(e=!0,n=!1,o=de.saveCB,i){const s=this.engine.save(e,o,i);if(s.forEach(a=>{if(e&&a.el&&!a.subGrid&&!o)a.content=a.el.querySelector(".grid-stack-item-content")?.innerHTML,a.content||delete a.content;else if(!e&&!o&&delete a.content,a.subGrid?.el){const l=a.w||a.subGrid.getColumn(),d=a.subGrid.save(e,n,o,l);a.subGridOpts=n?d:{children:d},delete a.subGrid}delete a.el}),n){const a=O.cloneDeep(this.opts);a.marginBottom===a.marginTop&&a.marginRight===a.marginLeft&&a.marginTop===a.marginRight&&(a.margin=a.marginTop,delete a.marginTop,delete a.marginRight,delete a.marginBottom,delete a.marginLeft),a.rtl===(this.el.style.direction==="rtl")&&(a.rtl="auto"),this._isAutoCellHeight&&(a.cellHeight="auto"),this._autoColumn&&(a.column="auto");const l=a._alwaysShowResizeHandle;return delete a._alwaysShowResizeHandle,l!==void 0?a.alwaysShowResizeHandle=l:delete a.alwaysShowResizeHandle,O.removeInternalAndSame(a,De),a.children=s,a}return s}load(e,n=de.addRemoveCB||!0){e=O.cloneDeep(e);const o=this.getColumn();e.forEach(u=>{u.w=u.w||u.minW||1,u.h=u.h||u.minH||1}),e=O.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let i=0;e.forEach(u=>{i=Math.max(i,(u.x||0)+u.w)}),i>this.engine.defaultColumn&&(this.engine.defaultColumn=i),i>o&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(i,o,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,i,!0));const s=de.addRemoveCB;typeof n=="function"&&(de.addRemoveCB=n);const a=[];this.batchUpdate();const l=!this.engine.nodes.length,d=l&&this.opts.animate;d&&this.setAnimation(!1),!l&&n&&[...this.engine.nodes].forEach(u=>{u.id&&(O.find(e,u.id)||(de.addRemoveCB&&de.addRemoveCB(this.el,u,!1,!1),a.push(u),this.removeWidget(u.el,!0,!1)))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(u=>O.find(e,u.id)?(c.push(u),!1):!0),e.forEach(u=>{const h=O.find(c,u.id);if(h){if(O.shouldSizeToContent(h)&&(u.h=h.h),this.engine.nodeBoundFix(u),(u.autoPosition||u.x===void 0||u.y===void 0)&&(u.w=u.w||h.w,u.h=u.h||h.h,this.engine.findEmptyPosition(u)),this.engine.nodes.push(h),O.samePos(h,u)&&this.engine.nodes.length>1&&(this.moveNode(h,{...u,forceCollide:!0}),O.copyPos(u,h)),this.update(h.el,u),u.subGridOpts?.children){const f=h.el.querySelector(".grid-stack");f&&f.gridstack&&f.gridstack.load(u.subGridOpts.children)}}else n&&this.addWidget(u)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,s?de.addRemoveCB=s:delete de.addRemoveCB,d&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const n=this.el.querySelector("."+this.opts.itemClass);if(n){const i=O.toNumber(n.getAttribute("gs-h"))||1;return Math.round(n.offsetHeight/i)}const o=parseInt(this.el.getAttribute("gs-current-row"));return o?Math.round(this.el.getBoundingClientRect().height/o):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+o}const n=O.parseHeight(e);return this.opts.cellHeightUnit===n.unit&&this.opts.cellHeight===n.h?this:(this.opts.cellHeightUnit=n.unit,this.opts.cellHeight=n.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const n=this.getColumn();let o=n;const i=this._widthOrContainer(!0);if(e.columnWidth)o=Math.min(Math.round(i/e.columnWidth)||1,e.columnMax);else{o=e.columnMax;let s=0;for(;s<e.breakpoints.length&&i<=e.breakpoints[s].w;)o=e.breakpoints[s++].c||n}if(o!==n){const s=e.breakpoints?.find(a=>a.c===o);return this.column(o,s?.layout||e.layout),!0}return!1}compact(e="compact",n=!0){return this.engine.compact(e,n),this._triggerChangeEvent(),this}column(e,n="moveScale"){if(!e||e<1||this.opts.column===e)return this;const o=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+o),this._updateColumnVar(),this.engine.columnChanged(o,e,n),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=n,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,n=!1){const o=this.el.getBoundingClientRect();let i;n?i={top:o.top+document.documentElement.scrollTop,left:o.left}:i={top:this.el.offsetTop,left:this.el.offsetLeft};const s=e.left-i.left,a=e.top-i.top,l=o.width/this.getColumn(),d=o.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(s/l),y:Math.floor(a/d)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,n,o,i){return this.engine.isAreaEmpty(e,n,o,i)}makeWidget(e,n){const o=de.getElement(e);if(!o||o.gridstackNode)return o;o.parentElement||this.el.appendChild(o),this._prepareElement(o,!0,n);const i=o.gridstackNode;this._updateContainerHeight(),i.subGridOpts&&this.makeSubGrid(o,i.subGridOpts,void 0,!1);let s;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(s=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),s&&delete this._ignoreLayoutsNodeChange,o}on(e,n){return e.indexOf(" ")!==-1?(e.split(" ").forEach(o=>this.on(o,n)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=o=>n(o):this._gsEventHandler[e]=o=>{o.detail&&n(o,o.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=n:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(n=>this.off(n)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,n=!0,o=!0){return e?(de.getElements(e).forEach(i=>{if(i.parentElement&&i.parentElement!==this.el)return;let s=i.gridstackNode;s||(s=this.engine.nodes.find(a=>i===a.el)),s&&(n&&de.addRemoveCB&&de.addRemoveCB(this.el,s,!1,!1),delete i.gridstackNode,this._removeDD(i),this.engine.removeNode(s,n,o),n&&i.parentElement&&i.remove())}),o&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,n=!0){return this.engine.nodes.forEach(o=>{e&&de.addRemoveCB&&de.addRemoveCB(this.el,o,!1,!1),delete o.el.gridstackNode,this.opts.staticGrid||this._removeDD(o.el)}),this.engine.removeAll(e,n),n&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,n){return n?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,n=!0,o=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&o&&i.subGrid.setStatic(e,n,o)}),n&&this._setStaticClass(),this)}updateOptions(e){const n=this.opts;return e===n?this:(e.acceptWidgets!==void 0&&(n.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==n.class&&(n.class&&this.el.classList.remove(n.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(n.minRow=n.maxRow=n.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(n.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(n.maxRow=e.maxRow)),e.lazyLoad!==void 0&&(n.lazyLoad=e.lazyLoad),e.children?.length&&this.load(e.children),this)}update(e,n){return de.getElements(e).forEach(o=>{const i=o?.gridstackNode;if(!i)return;const s={...O.copyPos({},i),...O.cloneDeep(n)};this.engine.nodeBoundFix(s),delete s.autoPosition;const a=["x","y","w","h"];let l;if(a.some(u=>s[u]!==void 0&&s[u]!==i[u])&&(l={},a.forEach(u=>{l[u]=s[u]!==void 0?s[u]:i[u],delete s[u]})),!l&&(s.minW||s.minH||s.maxW||s.maxH)&&(l={}),s.content!==void 0){const u=o.querySelector(".grid-stack-item-content");u&&u.textContent!==s.content&&(i.content=s.content,de.renderCB(u,s),i.subGrid?.el&&(u.appendChild(i.subGrid.el),i.subGrid._updateContainerHeight())),delete s.content}let d=!1,c=!1;for(const u in s)u[0]!=="_"&&i[u]!==s[u]&&(i[u]=s[u],d=!0,c=c||!this.opts.staticGrid&&(u==="noResize"||u==="noMove"||u==="locked"));if(O.sanitizeMinMax(i),l){const u=l.w!==void 0&&l.w!==i.w;this.moveNode(i,l),u&&i.subGrid?i.subGrid.onResize(this.hasAnimationCSS()?i.w:void 0):this.resizeToContentCheck(u,i),delete i._orig}(l||d)&&this._writeAttr(o,i),c&&this.prepareDragDrop(i.el),de.updateCB&&de.updateCB(i)}),this}moveNode(e,n){const o=e._updating;o||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,n),this._updateContainerHeight(),o||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const n=e.gridstackNode;if(!n)return;const o=n.grid;if(!o||e.parentElement!==o.el)return;const i=o.getCellHeight(!0);if(!i)return;let s=n.h?n.h*i:e.clientHeight,a;if(n.resizeToContentParent&&(a=e.querySelector(n.resizeToContentParent)),a||(a=e.querySelector(de.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,d=n.h?n.h*i-l:a.clientHeight;let c;if(n.subGrid){c=n.subGrid.getRow()*n.subGrid.getCellHeight(!0);const f=n.subGrid.el.getBoundingClientRect(),g=e.getBoundingClientRect();c+=f.top-g.top}else{if(n.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${n.id} '${de.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||d}}if(d===c)return;s+=c-d;let u=Math.ceil(s/i);const h=Number.isInteger(n.sizeToContent)?n.sizeToContent:0;h&&u>h&&(u=h,e.classList.add("size-to-content-max")),n.minH&&u<n.minH?u=n.minH:n.maxH&&u>n.maxH&&(u=n.maxH),u!==n.h&&(o._ignoreLayoutsNodeChange=!0,o.moveNode(n,{h:u}),delete o._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){de.resizeToContentCB?de.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return de.getElements(e).forEach(o=>{const i=o.gridstackNode;if(!O.canBeRotated(i))return;const s={w:i.h,h:i.w,minH:i.minW,minW:i.minH,maxH:i.maxW,maxW:i.maxH};if(n){const l=n.left>0?Math.floor(n.left/this.cellWidth()):0,d=n.top>0?Math.floor(n.top/this.opts.cellHeight):0;s.x=i.x+l-(i.h-(d+1)),s.y=i.y+d-l}Object.keys(s).forEach(l=>{s[l]===void 0&&delete s[l]});const a=i._orig;this.update(o,s),i._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const n=O.parseHeight(e);if(this.opts.marginUnit===n.unit&&this.opts.margin===n.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(n=>{delete n._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,n){const o=n?new CustomEvent(e,{bubbles:!1,detail:n}):new Event(e);let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;return i.el.dispatchEvent(o),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let n=this.getRow()+this._extraDragRow;const o=this.opts.cellHeight,i=this.opts.cellHeightUnit;if(!o)return this;if(!e&&!this.opts.minRow){const s=O.parseHeight(getComputedStyle(this.el).minHeight);if(s.h>0&&s.unit===i){const a=Math.floor(s.h/o);n<a&&(n=a)}}return this.el.setAttribute("gs-current-row",String(n)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),n&&(this.el.style[e?"minHeight":"height"]=n*o+i),e&&O.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,n=!1,o){o=o||this._readAttr(e),e.gridstackNode=o,o.el=e,o.grid=this,o=this.engine.addNode(o,n),this._writeAttr(e,o),e.classList.add(De.itemClass,this.opts.itemClass);const i=O.shouldSizeToContent(o);return i?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),i&&this.resizeToContentCheck(!1,o),O.lazyLoad(o)||this.prepareDragDrop(o.el),this}_writePosAttr(e,n){return(!n._moving&&!n._resizing||this._placeholder===e)&&(e.style.top=n.y?n.y===1?"var(--gs-cell-height)":`calc(${n.y} * var(--gs-cell-height))`:null,e.style.left=n.x?n.x===1?"var(--gs-column-width)":`calc(${n.x} * var(--gs-column-width))`:null,e.style.width=n.w>1?`calc(${n.w} * var(--gs-column-width))`:null,e.style.height=n.h>1?`calc(${n.h} * var(--gs-cell-height))`:null),e.setAttribute("gs-x",String(n.x)),e.setAttribute("gs-y",String(n.y)),n.w>1?e.setAttribute("gs-w",String(n.w)):e.removeAttribute("gs-w"),n.h>1?e.setAttribute("gs-h",String(n.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,n){if(!n)return this;this._writePosAttr(e,n);const o={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const i in o)n[i]?e.setAttribute(o[i],String(n[i])):e.removeAttribute(o[i]);return this}_readAttr(e,n=!0){const o={};o.x=O.toNumber(e.getAttribute("gs-x")),o.y=O.toNumber(e.getAttribute("gs-y")),o.w=O.toNumber(e.getAttribute("gs-w")),o.h=O.toNumber(e.getAttribute("gs-h")),o.autoPosition=O.toBool(e.getAttribute("gs-auto-position")),o.noResize=O.toBool(e.getAttribute("gs-no-resize")),o.noMove=O.toBool(e.getAttribute("gs-no-move")),o.locked=O.toBool(e.getAttribute("gs-locked"));const i=e.getAttribute("gs-size-to-content");i&&(i==="true"||i==="false"?o.sizeToContent=O.toBool(i):o.sizeToContent=parseInt(i,10)),o.id=e.getAttribute("gs-id"),o.maxW=O.toNumber(e.getAttribute("gs-max-w")),o.minW=O.toNumber(e.getAttribute("gs-min-w")),o.maxH=O.toNumber(e.getAttribute("gs-max-h")),o.minH=O.toNumber(e.getAttribute("gs-min-h")),n&&(o.w===1&&e.removeAttribute("gs-w"),o.h===1&&e.removeAttribute("gs-h"),o.maxW&&e.removeAttribute("gs-max-w"),o.minW&&e.removeAttribute("gs-min-w"),o.maxH&&e.removeAttribute("gs-max-h"),o.minH&&e.removeAttribute("gs-min-h"));for(const s in o){if(!o.hasOwnProperty(s))return;!o[s]&&o[s]!==0&&s!=="sizeToContent"&&delete o[s]}return o}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let n=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),n=!0):n=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(n),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,n=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,n),this.animationDelay);if(n)O.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.el);else if(this.engine.nodes.some(o=>O.shouldSizeToContent(o))){const o=[...this.engine.nodes];this.batchUpdate(),o.forEach(i=>{O.shouldSizeToContent(i)&&this.resizeToContentCBCheck(i.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,n?[n]:this.engine.nodes)}}_updateResizeEvent(e=!1){const n=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(o=>o.sizeToContent));return!e&&n&&!this.resizeObserver?(this._sizeThrottle=O.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!n)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return O.getElement(e)}static getElements(e=".grid-stack-item"){return O.getElements(e)}static getGridElement(e){return de.getElement(e)}static getGridElements(e){return O.getElements(e)}_initMargin(){let e,n=0,o=[];typeof this.opts.margin=="string"&&(o=this.opts.margin.split(" ")),o.length===2?(this.opts.marginTop=this.opts.marginBottom=o[0],this.opts.marginLeft=this.opts.marginRight=o[1]):o.length===4?(this.opts.marginTop=o[0],this.opts.marginRight=o[1],this.opts.marginBottom=o[2],this.opts.marginLeft=o[3]):(e=O.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,n=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(s=>{this.opts[s]===void 0?this.opts[s]=n:(e=O.parseHeight(this.opts[s]),this.opts[s]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const i=this.el.style;return i.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),i.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),i.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),i.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Ce}static setupDragIn(e,n,o,i=document){n?.pause!==void 0&&(ue.pauseDrag=n.pause),n={appendTo:"body",helper:"clone",...n||{}},(typeof e=="string"?O.getElements(e,i):e).forEach((s,a)=>{Ce.isDraggable(s)||Ce.dragIn(s,n),o?.[a]&&(s.gridstackNode=o[a])})}movable(e,n){return this.opts.staticGrid?this:(de.getElements(e).forEach(o=>{const i=o.gridstackNode;i&&(n?delete i.noMove:i.noMove=!0,this.prepareDragDrop(i.el))}),this)}resizable(e,n){return this.opts.staticGrid?this:(de.getElements(e).forEach(o=>{const i=o.gridstackNode;i&&(n?delete i.noResize:i.noResize=!0,this.prepareDragDrop(i.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&n&&o.subGrid.enableMove(e,n)}),this)}enableResize(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&n&&o.subGrid.enableResize(e,n)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&de._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Ce.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Ce.droppable(this.el,"destroy"),this;let e,n;const o=(i,s,a)=>{a=a||s;const l=a.gridstackNode;if(!l)return;if(!l.grid?.el){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=a.getBoundingClientRect();a.style.left=f.x+(this.dragTransform.xScale-1)*(i.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(i.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:d,left:c}=a.getBoundingClientRect();const u=this.el.getBoundingClientRect();c-=u.left,d-=u.top;const h={position:{top:d*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/n)),l.y=Math.max(0,Math.round(d/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){Ce.off(s,"drag");return}l._willFitPos&&(O.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,i,h,l,n,e)}else this._dragOrResize(a,i,h,l,n,e)};return Ce.droppable(this.el,{accept:i=>{const s=i.gridstackNode||this._readAttr(i,!1);if(s?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let a=!0;if(typeof this.opts.acceptWidgets=="function")a=this.opts.acceptWidgets(i);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=i.matches(l)}if(a&&s&&this.opts.maxRow){const l={w:s.w,h:s.h,minW:s.minW,minH:s.minH};a=this.engine.willItFit(l)}return a}}).on(this.el,"dropover",(i,s,a)=>{let l=a?.gridstackNode||s.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(s,a),a=a||s,n=this.cellWidth(),e=this.getCellHeight(!0),!l){const u=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(u){try{l=JSON.parse(u)}catch{console.error("Gridstack dropover: Bad JSON format: ",u)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const d=l.w||Math.round(a.offsetWidth/n)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(s._gridstackNodeOrig||(s._gridstackNodeOrig=l),s.gridstackNode=l={...l,w:d,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=d,l.h=c,l._temporaryRemoved=!0),de._itemRemoving(l.el,!1),Ce.on(s,"drag",o),o(i,s,a),!1}).on(this.el,"dropout",(i,s,a)=>{const l=a?.gridstackNode||s.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(s,a),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(i,s,a)=>{const l=a?.gridstackNode||s.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const d=!!this.placeholder.parentElement,c=s!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode,d&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const u=s._gridstackNodeOrig;if(delete s._gridstackNodeOrig,d&&u?.grid&&u.grid!==this){const f=u.grid;f.engine.removeNodeFromLayoutCache(u),f.engine.removedNodes.push(u),f._triggerRemoveEvent()._triggerChangeEvent(),f.parentGridNode&&!f.engine.nodes.length&&f.opts.subGridDynamic&&f.removeAsSubGrid()}if(!l||(d&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,Ce.off(s,"drag"),a!==s?(a.remove(),s=a):s.remove(),this._removeDD(s),!d))return!1;const h=l.subGrid?.el?.gridstack;return O.copyPos(l,this._readAttr(this.placeholder)),O.removePositioningStyles(s),c&&(l.content||l.subGridOpts||de.addRemoveCB)?(delete l.el,s=this.addWidget(l)):(this._prepareElement(s,!0,l),this.el.appendChild(s),this.resizeToContentCheck(!1,l),h&&(h.parentGridNode=l),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...i,type:"dropped"},u&&u.grid?u:void 0,l),!1}),this}static _itemRemoving(e,n){if(!e)return;const o=e?e.gridstackNode:void 0;!o?.grid||e.classList.contains(o.grid.opts.removableOptions.decline)||(n?o._isAboutToRemove=!0:delete o._isAboutToRemove,n?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Ce.isDroppable(e)&&Ce.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,o)=>de._itemRemoving(o,!0)).on(e,"dropout",(n,o)=>de._itemRemoving(o,!1)),this):this}prepareDragDrop(e,n=!1){const o=e?.gridstackNode;if(!o)return;const i=o.noMove||this.opts.disableDrag,s=o.noResize||this.opts.disableResize,a=this.opts.staticGrid||i&&s;if((n||a)&&(o._initDD&&(this._removeDD(e),delete o._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!n))return this;if(!o._initDD){let l,d;const c=(f,g)=>{this.triggerEvent(f,f.target),l=this.cellWidth(),d=this.getCellHeight(!0),this._onStartMoving(e,f,g,o,l,d)},u=(f,g)=>{this._dragOrResize(e,f,g,o,l,d)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete o._moving,delete o._resizing,delete o._event,delete o._lastTried;const g=o.w!==o._orig.w,p=f.target;if(!(!p.gridstackNode||p.gridstackNode.grid!==this)){if(o.el=p,o._isAboutToRemove){const b=e.gridstackNode.grid;b._gsEventHandler[f.type]&&b._gsEventHandler[f.type](f,p),b.engine.nodes.push(o),b.removeWidget(e,!0,!0)}else O.removePositioningStyles(p),o._temporaryRemoved?(this._writePosAttr(p,o),this.engine.addNode(o)):this._writePosAttr(p,o),this.triggerEvent(f,p);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),f.type==="resizestop"&&(Number.isInteger(o.sizeToContent)&&(o.sizeToContent=o.h),this.resizeToContentCheck(g,o))}};Ce.draggable(e,{start:c,stop:h,drag:u}).resizable(e,{start:c,stop:h,resize:u}),o._initDD=!0}return Ce.draggable(e,i?"disable":"enable").resizable(e,s?"disable":"enable"),this}_onStartMoving(e,n,o,i,s,a){if(this.engine.cleanNodes().beginUpdate(i),this._writePosAttr(this.placeholder,i),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=i,i.grid?.el)this.dragTransform=O.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=O.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(i.el=this.placeholder,i._lastUiPosition=o.position,i._prevYPix=o.position.top,i._moving=n.type==="dragstart",i._resizing=n.type==="resizestart",delete i._lastTried,n.type==="dropover"&&i._temporaryRemoved&&(this.engine.addNode(i),i._moving=!0),this.engine.cacheRects(s,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),n.type==="resizestart"){const l=this.getColumn()-i.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-i.y;Ce.resizable(e,"option","minWidth",s*Math.min(i.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(i.minH||1,d)).resizable(e,"option","maxWidth",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,i.x+i.w)).resizable(e,"option","maxHeight",a*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",a*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,i.y+i.h))}}_dragOrResize(e,n,o,i,s,a){const l={...i._orig};let d,c=this.opts.marginLeft,u=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const g=Math.round(a*.1),p=Math.round(s*.1);if(c=Math.min(c,p),u=Math.min(u,p),h=Math.min(h,g),f=Math.min(f,g),n.type==="drag"){if(i._temporaryRemoved)return;const S=o.position.top-i._prevYPix;i._prevYPix=o.position.top,this.opts.draggable.scroll!==!1&&O.updateScrollPosition(e,o.position,S);const D=o.position.left+(o.position.left>i._lastUiPosition.left?-u:c),z=o.position.top+(o.position.top>i._lastUiPosition.top?-f:h);l.x=Math.round(D/s),l.y=Math.round(z/a);const v=this._extraDragRow;if(this.engine.collide(i,l)){const M=this.getRow();let U=Math.max(0,l.y+i.h-M);this.opts.maxRow&&M+U>this.opts.maxRow&&(U=Math.max(0,this.opts.maxRow-M)),this._extraDragRow=U}else this._extraDragRow=0;if(this._extraDragRow!==v&&this._updateContainerHeight(),i.x===l.x&&i.y===l.y)return}else if(n.type==="resize"){if(l.x<0||(O.updateScrollResize(n,e,a),l.w=Math.round((o.size.width-c)/s),l.h=Math.round((o.size.height-h)/a),i.w===l.w&&i.h===l.h)||i._lastTried&&i._lastTried.w===l.w&&i._lastTried.h===l.h)return;const S=o.position.left+c,D=o.position.top+h;l.x=Math.round(S/s),l.y=Math.round(D/a),d=!0}i._event=n,i._lastTried=l;const b={x:o.position.left+c,y:o.position.top+h,w:(o.size?o.size.width:i.w*s)-c-u,h:(o.size?o.size.height:i.h*a)-h-f};if(this.engine.moveNodeCheck(i,{...l,cellWidth:s,cellHeight:a,rect:b,resizing:d})){i._lastUiPosition=o.position,this.engine.cacheRects(s,a,h,u,f,c),delete i._skipDown,d&&i.subGrid&&i.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const S=n.target;i._sidebarOrig||this._writePosAttr(S,i),this.triggerEvent(n,S)}}triggerEvent(e,n){let o=this;for(;o.parentGridNode;)o=o.parentGridNode.grid;o._gsEventHandler[e.type]&&o._gsEventHandler[e.type](e,n)}_leave(e,n){n=n||e;const o=n.gridstackNode;if(!o||(n.style.transform=n.style.transformOrigin=null,Ce.off(e,"drag"),o._temporaryRemoved))return;o._temporaryRemoved=!0,this.engine.removeNode(o),o.el=o._isExternal&&n?n:e;const i=o._sidebarOrig;o._isExternal&&this.engine.cleanupNode(o),o._sidebarOrig=i,this.opts.removable===!0&&de._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):o._isExternal&&this.engine.restoreInitial()}};yt.renderCB=(t,e)=>{t&&e?.content&&(t.textContent=e.content)},yt.resizeToContentParent=".grid-stack-item-content",yt.Utils=O,yt.Engine=wo,yt.GDRev="12.4.2";var oh={class:"d-layout"},ih=["gs-id","gs-x","gs-y","gs-w","gs-h","gs-locked","gs-no-resize","gs-no-move","gs-min-w","gs-min-h","gs-max-w","gs-max-h"],rh=(0,r.defineComponent)({name:"DLayout",__name:"layout",props:{modelValue:{default:()=>[]},column:{default:24},cellHeight:{default:60},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},disable:{type:Boolean,default:!1},animate:{type:Boolean,default:!0},float:{type:Boolean,default:!0},removable:{type:Boolean,default:!1},removableOptions:{}},emits:["update:modelValue","added","removed","changed","dragStart","dragStop","resizeStart","resizeStop"],setup(t,{expose:e,emit:n}){const o=t,i=n,s=(0,r.ref)();let a=null;const l=async()=>{s.value&&(await(0,r.nextTick)(),a&&a.destroy(!1),a=yt.init({column:o.column,cellHeight:o.cellHeight,disableDrag:!(o.draggable&&!o.disable),disableResize:!(o.resizable&&!o.disable),animate:o.animate,float:o.float,removable:o.removable,removableOptions:o.removableOptions},s.value),a.on("added",(f,g)=>{const p=g[0];p&&(i("added",d(p)),u())}),a.on("removed",(f,g)=>{const p=g[0];p&&(i("removed",d(p)),u())}),a.on("change",()=>{u(),i("changed",(a?.save()||[]).map(f=>d(f)))}),a.on("dragstart",(f,g)=>{g&&i("dragStart",f,d(g.gridstackNode||g))}),a.on("dragstop",(f,g)=>{g&&i("dragStop",f,d(g.gridstackNode||g))}),a.on("resizestart",(f,g)=>{g&&i("resizeStart",f,d(g.gridstackNode||g))}),a.on("resizestop",(f,g)=>{g&&i("resizeStop",f,d(g.gridstackNode||g))}))},d=f=>({id:f.id||f.el?.getAttribute("gs-id")||"",x:f.x||0,y:f.y||0,w:f.w||1,h:f.h||1,locked:f.locked||!1,noResize:f.noResize||!1,noMove:f.noMove||!1,minW:f.minW,minH:f.minH,maxW:f.maxW,maxH:f.maxH}),c=async()=>{if(!a||!s.value)return;await(0,r.nextTick)();const f=a.engine.nodes;new Set(f.map(p=>p.id));const g=new Set(o.modelValue.map(p=>p.id));f.forEach(p=>{if(!g.has(p.id||"")){const b=p.el;b&&a&&a.removeWidget(b,!1)}}),o.modelValue.forEach(p=>{const b=f.find(S=>S.id===p.id);if(b)b.el&&a&&a.update(b.el,{x:p.x,y:p.y,w:p.w,h:p.h,locked:p.locked,noResize:p.noResize,noMove:p.noMove,minW:p.minW,minH:p.minH,maxW:p.maxW,maxH:p.maxH});else{if(!s.value||!a)return;const S=s.value.querySelector(`[gs-id="${p.id}"]`);S&&a.makeWidget(S)}})},u=()=>{a&&i("update:modelValue",a.save().map(f=>{const g={id:f.id||"",x:f.x||0,y:f.y||0,w:f.w||1,h:f.h||1},p=o.modelValue.find(b=>b.id===g.id);return p&&Object.keys(p).forEach(b=>{["id","x","y","w","h"].includes(b)||(g[b]=p[b])}),g}))},h=(0,r.computed)(()=>o.modelValue);return(0,r.watch)(()=>o.modelValue,async()=>{a&&(await(0,r.nextTick)(),c())},{deep:!0}),(0,r.watch)(()=>[o.column,o.cellHeight,o.draggable,o.resizable,o.disable,o.animate,o.float,o.removable],()=>{l()}),(0,r.onMounted)(()=>{l()}),(0,r.onBeforeUnmount)(()=>{a&&(a.destroy(!1),a=null)}),e({addItem:async f=>{if(a&&s.value){await(0,r.nextTick)();const g=s.value.querySelector(`[gs-id="${f.id}"]`);g&&(a.makeWidget(g),a.update(g,{x:f.x,y:f.y,w:f.w,h:f.h,locked:f.locked,noResize:f.noResize,noMove:f.noMove,minW:f.minW,minH:f.minH,maxW:f.maxW,maxH:f.maxH}))}},removeItem:f=>{if(a&&s.value){const g=s.value.querySelector(`[gs-id="${f}"]`);g&&a.removeWidget(g,!1)}},clear:()=>{a&&a.removeAll(!1)},getGrid:()=>a}),(f,g)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",oh,[(0,r.createElementVNode)("div",{ref_key:"gridContainerRef",ref:s},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(h.value,p=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:p.id,"gs-id":p.id,"gs-x":p.x,"gs-y":p.y,"gs-w":p.w,"gs-h":p.h,"gs-locked":p.locked,"gs-no-resize":p.noResize,"gs-no-move":p.noMove,"gs-min-w":p.minW,"gs-min-h":p.minH,"gs-max-w":p.maxW,"gs-max-h":p.maxH,class:"d-layout-item"},[(0,r.renderSlot)(f.$slots,"item",{item:p})],8,ih))),128))],512)]))}}),sh=rh,Ir=Je(sh),be=(t,e="",n=!1)=>n?`${t}pt`:e?`${t}${e}`:`${t}px`,Ne=(t,e=0)=>t==null||isNaN(t)?0:Number(Number(t).toFixed(e)),ah=t=>t*3/4,lh=t=>t*4/3,ch=["onMousedown"],dh={key:2,class:"d-draggable__mask"},uh=(0,r.defineComponent)({name:"DDraggable",__name:"draggable",props:{index:{},mask:{type:Boolean,default:!0},scale:{default:1},readonly:{type:Boolean,default:!1},resize:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},step:{default:1},zIndex:{default:1},isActiveBgTransparent:{type:Boolean,default:!1},left:{default:0},top:{default:0},width:{},height:{},activeFlag:{type:Boolean,default:!1},isPt:{type:Boolean,default:!1}},emits:["focus","blur","over","out"],setup(t,{expose:e,emit:n}){const o=t,i=n,s=(0,r.ref)(),a=(0,r.ref)(),l=(0,r.ref)(0),d=(0,r.ref)(0),c=(0,r.ref)(0),u=(0,r.ref)(0),h=(0,r.ref)(null),f=(0,r.ref)(!1),g=(0,r.ref)(!1),p=(0,r.ref)(!1),b=(0,r.ref)(!1),S=(0,r.ref)([{classname:"left"},{classname:"right"},{classname:"top"},{classname:"bottom"},{classname:"top-left"},{classname:"top-right"},{classname:"bottom-left"},{classname:"bottom-right"}]),D=(0,r.computed)(()=>o.scale),z=(0,r.computed)(()=>({left:be(D.value,"",o.isPt)})),v=(0,r.computed)(()=>({left:be(-D.value,"",o.isPt)})),M=(0,r.computed)(()=>({left:"auto",right:be(-D.value,"",o.isPt)})),U=(0,r.computed)(()=>({top:be(-D.value,"",o.isPt)})),$=(0,r.computed)(()=>({top:"auto",bottom:be(-D.value,"",o.isPt)})),Q=(0,r.computed)(()=>{const L=8*D.value;return{width:be(L,"",o.isPt),height:be(L,"",o.isPt)}}),q=(0,r.computed)(()=>({fontSize:be(16*D.value,"",o.isPt)})),j=(0,r.computed)(()=>Object.assign((()=>{if(b.value){const L={zIndex:9999,...z.value};return o.isActiveBgTransparent&&(b.value||g.value)&&!o.readonly&&!o.disabled&&(L.backgroundColor="color-mix(in srgb, var(--j-color-primary-bg) 60%, transparent)"),L}return{zIndex:o.zIndex}})(),{top:be(u.value,"",o.isPt),width:be(l.value,"",o.isPt),height:be(d.value,"",o.isPt),padding:be(8*D.value,"",o.isPt),...z.value,left:be(c.value,"",o.isPt)}));(0,r.watch)(()=>o.width,L=>{l.value=Ne(G(L))||(h.value?.offsetWidth??0)}),(0,r.watch)(()=>o.height,L=>{d.value=Ne(G(L))||(h.value?.offsetHeight??0)},{deep:!0}),(0,r.watch)(()=>o.left,L=>{c.value=Ne(G(L))}),(0,r.watch)(()=>o.top,L=>{u.value=Ne(G(L))}),(0,r.watch)(l,L=>{s.value&&(s.value.style.width=be(L,"",o.isPt),o.resize&&h.value?.style&&(h.value.style.width=be(L,"",o.isPt)))}),(0,r.watch)(d,L=>{s.value&&(s.value.style.height=be(L,"",o.isPt),o.resize&&h.value?.style&&(h.value.style.height=be(L,"",o.isPt)))}),(0,r.watch)(()=>o.activeFlag,L=>{K(L)});const K=L=>{b.value=L},G=L=>L===void 0?0:o.isPt?lh(L):L,k=()=>{a.value&&a.value.firstChild&&(h.value=a.value.firstChild,l.value=Ne(G(o.width))||(h.value?.offsetWidth??0),d.value=Ne(G(o.height))||(h.value?.offsetHeight??0),c.value=Ne(G(o.left)),u.value=Ne(G(o.top)),K(o.activeFlag))},Y=L=>{c.value=L},w=L=>{u.value=L},V=L=>{const Z=8*D.value/2,P={};return L.split("-").forEach(X=>{P[X]=be(-Z,"",o.isPt)}),P},m=L=>{g.value=L},E=L=>o.isPt?ah(L):L,B=()=>{f.value=!0,i("focus",{index:o.index,width:E(l.value),height:E(d.value),left:E(c.value),top:E(u.value)})},T=()=>{f.value=!1,p.value=!1,i("blur",{index:o.index,width:E(l.value),height:E(d.value),left:E(c.value),top:E(u.value)})},A=()=>{document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,T()}},H=(L,Z)=>{if(o.disabled||o.readonly)return;let P,X,ne,ie,le,ee;p.value=!0,B();let re=L.clientX,C=L.clientY;document.onmousemove=_=>{f.value=!0,Z==="right"?(P=!0,X=!1):Z==="left"?(P=!0,ne=!0,le=!0,X=!1):Z==="top"?(P=!1,X=!0,ie=!0,ee=!0):Z==="bottom"?(P=!1,X=!0):Z==="bottom-right"?(P=!0,X=!0):Z==="bottom-left"?(P=!0,X=!0,ne=!0,le=!0):Z==="top-right"?(P=!0,X=!0,ie=!0,ee=!0):Z==="top-left"&&(P=!0,X=!0,ne=!0,le=!0,ie=!0,ee=!0);const N=_.clientX-re,x=_.clientY-C;if(re=_.clientX,C=_.clientY,P){let y=N*o.step;le&&(y=-y),ne&&(c.value=Ne(c.value-y)),l.value=Ne(l.value+y)}if(X){let y=x*o.step;ee&&(y=-y),ie&&(u.value=Ne(u.value-y)),d.value=Ne(d.value+y)}},A()},F=()=>{g.value=!1,i("out",{index:o.index,width:E(l.value),height:E(d.value),left:E(c.value),top:E(u.value)})},te=()=>{o.disabled||o.readonly||(g.value=!0,i("over",{index:o.index,width:E(l.value),height:E(d.value),left:E(c.value),top:E(u.value)}))},se=L=>{if(o.disabled||o.readonly)return;b.value=!0,B();let Z=L.clientX,P=L.clientY;document.onmousemove=X=>{const ne=X.clientX-Z,ie=X.clientY-P;Z=X.clientX,P=X.clientY,c.value=Ne(c.value+ne*o.step),u.value=Ne(u.value+ie*o.step)},A()};return(0,r.onMounted)(()=>{k()}),e({setActive:K,setLeft:Y,setTop:w,setOverActive:m}),(L,Z)=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{class:(0,r.normalizeClass)(["d-draggable",{"d-draggable--active":(b.value||g.value)&&!t.readonly&&!t.disabled},{"d-draggable--pt":t.isPt&&!t.readonly&&!t.disabled},{"d-draggable--move":f.value},{"d-draggable--click":t.disabled}]),onMousedown:(0,r.withModifiers)(se,["stop"]),onMouseover:(0,r.withModifiers)(te,["stop"]),onMouseout:(0,r.withModifiers)(F,["stop"]),style:(0,r.normalizeStyle)(j.value)},[(0,r.createElementVNode)("div",{class:"d-draggable__wrapper",ref_key:"wrapper",ref:s},[(b.value||g.value||f.value)&&!t.readonly&&!t.disabled?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:0},[(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...z.value,...U.value}),class:"d-draggable__line d-draggable__line--left"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...z.value,...v.value}),class:"d-draggable__line d-draggable__line--top"},null,4),t.isPt?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...z.value,...U.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...z.value,...v.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...z.value,...$.value}),class:"d-draggable__line d-draggable__line--left"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...z.value,...M.value}),class:"d-draggable__line d-draggable__line--top"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...z.value,...$.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),(0,r.createElementVNode)("div",{style:(0,r.normalizeStyle)({...z.value,...M.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4)],64)):((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:0,class:"d-draggable__line d-draggable__line--label",style:(0,r.normalizeStyle)(q.value)},(0,r.toDisplayString)(c.value)+","+(0,r.toDisplayString)(u.value),5))],64)):(0,r.createCommentVNode)("",!0),!t.readonly&&!t.disabled?((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,{key:1},(0,r.renderList)(S.value,(P,X)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:X},[b.value?((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:0,class:(0,r.normalizeClass)(["d-draggable__range",`d-draggable__range--${P.classname}`]),style:(0,r.normalizeStyle)([Q.value,V(P.classname)]),onMousedown:(0,r.withModifiers)(ne=>H(ne,P.classname),["stop"])},null,46,ch)):(0,r.createCommentVNode)("",!0)],64))),128)):(0,r.createCommentVNode)("",!0),(0,r.createElementVNode)("div",{class:"d-draggable__item",ref_key:"item",ref:a},[(0,r.renderSlot)(L.$slots,"default")],512),!t.disabled&&t.mask?((0,r.openBlock)(),(0,r.createElementBlock)("div",dh)):(0,r.createCommentVNode)("",!0)],512)],38))}}),fh=uh,Br=Je(fh),zr=t=>{const e=hh(t.components);return{formConfig:t.form,componentList:e}},Rr=(t,e)=>{let n={},o=[];const i={},s=t;n=s.form;const a={};return s.components.forEach(l=>{const d=e[l.type];a[l.containerId]=a[l.containerId]||[];const c={id:l.id,name:l.name,type:l.type,dragType:d?.dragType||"component",componentName:d?.componentName||"",runtimeType:d?.runtimeType,groupId:l.groupId,config:l.config,isInput:d?.isInput!==!1,containerId:l.containerId,level:l.level};d?.dragType==="container"&&(c.children=[]),i[c.id]=c,a[l.containerId].push(c)}),Object.keys(a).forEach(l=>{i[l]&&(i[l].children=a[l])}),o=a.form||[],{formConfig:n,componentList:o,componentDic:i}},Sn=(t,e)=>{const n={ver:"j1",form:{...t},components:[],db:{}};return Ar(e||[],n.components),n},Ar=(t,e)=>{t.forEach(n=>{if(n.type==="pkey")return;const o={id:n.id,name:n.name,type:n.type,runtimeType:n.runtimeType||n.componentName||n.type,groupId:n.groupId||"",config:n.config,containerId:n.containerId,level:n.level};n.dragType==="container"&&Ar(n.children||[],e),e.push(o)})},hh=t=>{const e={},n={};return t.forEach(o=>{e[o.containerId]=e[o.containerId]||[];const i={id:o.id,type:o.runtimeType,slot:o.groupId,config:{rule:[]}};o.config&&Object.keys(o.config).forEach(s=>{if(s==="required"){o.config.required&&i.config?.rule?.push({required:!0,message:o.config.requiredMsg||"请输入"});return}if(s==="patterns"){o.config.patterns.forEach(a=>{a.reg&&a.msg&&i.config?.rule?.push({pattern:new RegExp(a.reg),message:`请输入${a.msg||""}`})});return}i.config[s]=o.config[s]}),o.type==="pkey"&&(i.config.isPkey=!0),e[o.containerId].push(i),n[o.id]=i}),Object.keys(e).forEach(o=>{const i=n[o];if(i){const s=e[o];if(["j-tabs","j-collapse"].includes(i.type||"")&&i.config?.groups){const a={};s.forEach(l=>{if(l.slot!==void 0&&l.slot!==null){const d=l.slot.toString();a[d]||(a[d]=[]),delete l.slot,a[d].push(l)}}),i.children=i.config.groups.map(l=>{const d=a[l._i]||[],c={label:l.label};l.active&&i.type==="j-collapse"&&(c.active=l.active);let u;if(i.type==="j-tabs"&&i.config?.tabKey&&i.config?.options.length>0){const f=i.config.options.find(g=>g.label===l._i);f&&(u=({formData:g})=>({display:f.value.includes(g[i.config?.tabKey||""])?f.display:!f.display}))}const h={config:c,children:d};return u&&(h.getCompConfig=u),h}),delete i.config.groups}else i.children=s}}),e.form},$r=(t,e,n,o,i,s,a,l)=>{const d=(0,r.ref)(),c=(0,r.reactive)({}),u=(0,r.computed)(()=>{const m=[];return Object.keys(c).forEach(E=>{const B=c[E];B.dragType==="component"&&B.type!=="pkey"&&m.push(B)}),m}),h=(m=[],E)=>{const B=e?.value?.init;typeof B=="function"&&B(m,E)},f=m=>i?i(m,{componentDic:c,components:u.value,configData:d.value.config}):{},g=(m,E)=>{if(d.value?.id===m)return;const B=c[m]||E;if(B?d.value=B:m===n.id?d.value=n:d.value=null,d.value){const T=s[d.value.type];T?(h(T,d.value.config),f(d.value.type)):h([])}else h([]);E&&ye("dragClick",{id:E.id})},p=()=>t.value.$el.getBoundingClientRect(),b=m=>m===n.id?n:c[m]||{},S=m=>{const E=[];if(m===n.id)E.push({id:m,name:n.name});else{const B=c[m];if(B){E.push({id:m,name:B.name});const T=S(B.containerId);E.push(...T)}}return E},D=(m,E)=>{const B=c[E];if(B===void 0)return!1;const T=B.containerId;return m===T?!0:T===n.id?!1:D(m,T)},z=m=>o?o(m)||{}:{},v=(m,E,B,T)=>{if(l){const A=b(m);return l(B.componentType,{container:A,groupId:E,configData:B},T)}return!1},M=({name:m,type:E,dragType:B,isInput:T,componentName:A,runtimeType:H},F,te,se,L=!1)=>{const Z=z(E);if(Z.id=st(),Z.span=24,Z.componentType=E,U(F,Z.componentType))return;v(F,se,Z,!0);const P={id:Z.id,name:m,type:E,runtimeType:H,componentName:A||"",dragType:B||"component",containerId:F,isInput:!!T,level:c[F]?c[F].level+1:1,config:Z,isNewAdd:!L,groupId:se};return P.dragType==="container"&&(P.children=[]),c[P.id]=P,b(F).children?.splice(te,0,P),P},U=(m,E)=>!!(b(m).config.componentType==="gridtable"&&["divider","label","text","textEditor","viewTable","card","collapse","tabs","qrcode","barcode","tableLayout"].includes(E)),$=(m,E,B=!1)=>{let T=null;const A=b(m).children,H=A?.findIndex(F=>F.id===E)||0;if(B&&A&&A.length>1){let F=H+1;H>0&&(F=H-1),T=A[F]}return A?.splice(H,1),T?.id},Q=(m,E,B,T)=>{const A=b(E).children,H=m.containerId!==E;m.containerId=E,m.groupId=T,A?.splice(B,0,m),v(E,T,m.config,H)&&(Y(),g(m.id))},q=m=>{let E="";const B=b(m);return B&&(B.children&&B.children.length>0&&B.children.forEach(T=>{q(T.id)}),E=$(B.containerId,m,!0)||"",delete c[m]),d.value&&d.value.id===m&&(d.value=null,e.value.init([])),E},j=(m,E=[])=>{const B=b(m);if(B&&B.children&&B.children.length>0){const T=[];B.children.forEach(A=>{A.groupId&&E.includes(A.groupId)&&T.push(A.id)}),T.forEach(A=>{q(A),delete c[A]})}},K=(m,E)=>{const B=b(m);B&&(B.children&&B.children.length>0&&B.children.forEach(T=>{T.groupId===E&&q(T.id)}),delete c[m])},G=m=>{const E=Dn(b(m));E.id=st(),E.config.id=E.id,c[E.id]=E;const B=b(E.containerId).children,T=B?.findIndex(A=>A.id===m)||0;B?.splice(T+1,0,E)},k=()=>{n.children=[],Xr(c),d.value&&(ye("dragClick",{id:""}),d.value=null,e.value.init([]))},Y=()=>{d.value&&(ye("dragClick",{id:""}),d.value=null,e.value.init([]))},w=m=>{const E=d.value,B=b(E.containerId).children,T=B?.findIndex(A=>A.id===E.id)||0;q(E.id),(0,r.nextTick)(()=>{const A=a[m],H=z(m);H.id=E.id,H.span=E.config.span,H.componentType=m,H.table=E.config.table,H.field=E.config.field,E.config.isSubTable&&(H.isSubTable=E.config.isSubTable);const F={id:H.id,name:A.name,type:m,runtimeType:A.runtimeType,componentName:A.componentName||"",dragType:E.dragType,groupId:E.groupId,containerId:E.containerId,isInput:E.isInput,level:E.level,config:H,isNewAdd:!0};c[F.id]=F,B?.splice(T,0,F)})},V=m=>{ye("dragAddByClick",m)};return(0,r.provide)("d-drag-design-provide",{activedComponent:d,getDesignLocals:p,getComponent:b,getParentComponents:S,isMyChildComponent:D,selectComponent:g,addComponent:M,deleteComponent:q,copyComponent:G,removeComponentFromContainer:$,addComponentToContainer:Q,top:n,deleteChildren:K,deleteChildrens:j}),{activedComponent:d,clearComponents:k,changeComponent:w,schemaComponentDic:c,clearSelect:Y,addComponent:M,addComponentByTable:V,designComponentList:u}},gh=(0,r.defineComponent)({__name:"importComponent",props:{componentList:{type:Array,default:()=>[]},tableList:{type:Array,default:()=>[]}},setup(t,{expose:e}){const n=t,o=(0,r.computed)(()=>n.tableList.map(c=>({label:c.comment?`${c.name}(${c.comment})`:c.name,value:c.name}))),i=(0,r.ref)(),s=[{id:"layout",type:"j-layout",config:{top:48,topMove:!1,autoSize:["default"]},children:[{id:"table",type:"j-select",slot:"top",config:{label:"表名选择",loadOptions:()=>o,allowClear:!1}},{id:"fields",type:"j-table",config:{editConfig:{isAddBtn:!1,isRemoveBtn:!1},height:"100%",isMultiple:!0},children:[{id:"name",type:"span",config:{label:"字段名"}},{id:"type",type:"j-select",config:{label:"组件选择",options:n.componentList,width:200}}]}]}],a=(c,u)=>{if(c.id==="table"){const h=n.tableList.find(f=>f.name===u.value);if(h){const f=h.columns.map(g=>({value:g.name,name:g.coment?`${g.name}(${g.coment})`:g.name,type:"input",label:g.coment||g.name,selected:!g.isPrimary}));i.value.setFormData({fields:f})}}};return(0,r.onMounted)(()=>{i.value.init(s)}),e({ok:()=>{const c=i.value.getFormData(!1);return{addList:c.fields.filter(u=>u.selected),table:c.table,containerId:c.containerId,isSubTable:c.isSubTable}},closed:()=>{}}),(c,u)=>{const h=(0,r.resolveComponent)("j-form");return(0,r.openBlock)(),(0,r.createBlock)(h,{ref_key:"formRef",ref:i,"form-config":{labelWidth:"72px"},onChange:a},null,512)}}}),ph=gh,mh=(0,r.defineComponent)({props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(t){const{t:e}=(0,qe.useAppInject)();return{labelWidth:(0,r.computed)(()=>t.componentData.config?.notShowLabel?"0px":t.componentData.config?.labelWidth===void 0&&t.globalConfig.labelWidth!==void 0?`${t.globalConfig.labelWidth}px`:t.componentData.config?.labelWidth?`${t.componentData.config?.labelWidth}px`:void 0),inputConfig:(0,r.computed)(()=>{const n={...t.componentData?.config};return t.globalConfig.size===void 0&&(n.size=t.globalConfig.size),n.display=!0,n}),t:e}}}),yh=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n};function vh(t,e,n,o,i,s){const a=(0,r.resolveComponent)("j-comp"),l=(0,r.resolveComponent)("el-form-item");return t.componentData.isInput?((0,r.openBlock)(),(0,r.createBlock)(l,{key:0,"label-width":t.labelWidth,label:t.t(t.componentData.config?.notShowLabel?"":t.componentData.config?.label||""),rules:t.componentData.config?.required?[{required:!0,message:""}]:[]},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(a,{type:t.componentData?.componentName||t.componentData?.type,config:t.inputConfig,modelValue:t.componentData?.config.defaultValue},null,8,["type","config","modelValue"])]),_:1},8,["label-width","label","rules"])):t.componentData?.children?((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(t.componentData?.componentName),(0,r.mergeProps)({key:1},t.componentData?.config,{"global-config":t.globalConfig,"component-data":t.componentData}),null,16,["global-config","component-data"])):((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(t.componentData?.componentName),(0,r.normalizeProps)((0,r.mergeProps)({key:2},t.componentData?.config)),null,16))}var Pr=yh(mh,[["render",vh]]),_h={class:"d-form-design j-block"},wh={class:"d-form-design-left"},bh={class:"d-form-design-component-list"},Ch={class:"j-component-tool"},Eh={class:"j-component-tool-name"},xh={class:"d-form-design-center"},Nh={class:"d-form-design-container"},kh={key:0,class:"d-form-design-empty"},Sh={class:"d-form-design-right"},Dh={class:"d-form-design-panel-title"},Th={style:{margin:"0","font-size":"14px"}},Mh={class:"d-form-design-panel"},Ih=(0,r.defineComponent)({name:"DFormDesign",__name:"formDesign",props:{notBindTable:{type:Boolean,default:!1},components:{default:()=>[]},componentConfigs:{default:()=>({})},componentInit:{type:Function,default:void 0},containerAddComponent:{type:Function,default:void 0},componentConfigInit:{type:Function,default:void 0},componentConfigChange:{type:Function,default:void 0},componentConfigValidate:{type:Function,default:void 0},flowComponents:{default:()=>[]},flowInit:{type:Function,default:void 0},flowComponentConfigInit:{type:Function,default:void 0},flowComponentConfigChange:{type:Function,default:void 0},flowComponentConfigs:{default:()=>({})},actions:{}},setup(t,{expose:e}){const n=t,{t:o,warning:i,error:s}=(0,qe.useAppInject)(),a=(0,r.reactive)({name:"表单",id:"form",type:"form",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}}),l=(0,r.ref)([]),d=n.components.length;for(let x=0;x<d;x++)l.value.push(x);n.componentInit&&(a.config=n.componentInit("form")||{});const c=(0,r.ref)([]),u=(0,r.computed)(()=>c.value.map(x=>({label:x.comment?`${x.name}(${x.comment})`:x.name,value:x.name}))),h=(0,r.computed)(()=>{if($.value){const x=U.value.getFormData(!1);if(x.table){const y=c.value.find(R=>R.name===x.table);if(y)return y.columns.map(R=>({value:R.name,label:R.coment?`${R.name}(${R.coment})`:R.name,coment:R.coment}))}}return[]}),f=x=>{c.value=x},g={},p=[];n.components.forEach(({children:x})=>{x.forEach(y=>{g[y.type]=y,y.dragType=y.dragType||"component",y.isInput!==!1&&(y.isInput=!0,p.push({label:y.name,value:y.type}))})});const b=x=>{x.forEach(y=>{y.type==="d-input-flow"&&(y.config=y.config||{},y.config.flowComponents=n.flowComponents,y.config.flowInit=n.flowInit,y.config.flowComponentConfigInit=R=>{n.flowComponentConfigInit&&(R.designComponents=G.value,R.component=$.value,n.flowComponentConfigInit(R))},y.config.flowComponentConfigs=n.flowComponentConfigs,y.config.flowComponentConfigChange=n.flowComponentConfigChange),y.children&&b(y.children)})},S={};Object.keys(n.componentConfigs||{}).forEach(x=>{const{hasBase:y,isInput:R,hasTwoPlaceholder:I,hasPlaceholder:J,hasSpan:W,hasLabel:ce,bindTable:fe,labelTitle:he}=g[x]||{hasBase:!1},Ee=[{id:"id",type:"j-input",config:{label:"ID",readonly:!0}},{id:"componentType",type:"j-select",config:{label:"类型",allowClear:!1,display:R,options:p}},{id:"label",type:"j-input",config:{label:he||"标题"},getCompConfig:({formData:pe})=>({display:ce!==!1&&!pe.notShowLabel})},{id:"notShowLabel",type:"j-switch",config:{label:"不显示"+(he||"标题"),activeValue:!0,inactiveValue:!1},getCompConfig:({formData:pe})=>({display:ce!==!1&&!pe.isSubTable})},{id:"labelWidth",type:"j-number",config:{label:"标题宽度"},getCompConfig:({formData:pe})=>({display:R&&!pe.notShowLabel&&!pe.isSubTable})},{id:"placeholder",type:"j-input",config:{display:R&&!I&&J!==!1,label:"占位提示"}},{id:"startPlaceholder",type:"j-input",config:{display:!!I,label:"开始占位"}},{id:"endPlaceholder",type:"j-input",config:{display:!!I,label:"结束占位"}},{id:"span",type:"j-slider",config:{label:"表单栅栏",min:6,max:24,showTooltip:!0,step:6,showStops:!0,defautValue:24},getCompConfig:({formData:pe})=>({display:W!==!1&&!pe.isSubTable})},{id:"width",type:"j-number",config:{label:"单元格宽度",min:1},getCompConfig:({formData:pe})=>({display:!!pe.isSubTable})},{id:"isNotSave",type:"j-switch",config:{label:"不存表",display:R&&fe!==!1,activeValue:!0,inactiveValue:!1}},{id:"table",type:"j-select",config:{label:"数据表",loadOptions:()=>u},getCompConfig:({formData:pe})=>({display:(R&&fe!==!1||fe===!0)&&(!pe.isSubTable||fe===!0)&&!pe.isNotSave&&!n.notBindTable})},{id:"field",type:"j-select",config:{label:"表字段",loadOptions:()=>h},getCompConfig:({formData:pe})=>({display:R&&fe!==!1&&!pe.isNotSave&&!n.notBindTable})},{id:"csType",type:"j-select",config:{label:"字段类型",allowClear:!1,options:[{label:"短文本",value:"string"},{label:"长文本",value:"text"},{label:"整数",value:"int"},{label:"小数",value:"decimal"},{label:"时间日期",value:"DateTime"}]},getCompConfig:({formData:pe})=>({display:R&&fe!==!1&&!pe.isNotSave&&n.notBindTable})},{id:"fieldLen",type:"j-number",config:{label:"字段长度"},getCompConfig:({formData:pe})=>({display:R&&fe!==!1&&!pe.isNotSave&&n.notBindTable&&pe.csType==="string"})}],ke={type:"j-collapse",config:{defaultValue:[]},children:[]};y!==!1&&(ke.children?.push({config:{label:"基础信息"},children:[...Ee]}),ke.config?.defaultValue.push("_collapse0")),ke.children?.push(...n.componentConfigs[x]),b(ke.children||[]),S[x]=[ke]});const D=x=>{const{value:y}=x||{};x.id==="componentType"&&q(y),$.value&&n.componentConfigChange&&(x.id==="field"&&x.data?.coment&&($.value.config.label=x.data?.coment),n.componentConfigChange($.value.type,{configRef:U,configData:$.value.config,...x})),x.id==="table"&&$.value&&$.value.type==="gridtable"&&($.value.children||[]).forEach(R=>{R.isInput&&(R.config.table=y)})},z=(x,y)=>{g[x]?.isInput&&(n.notBindTable&&(y.configData.csType||U.value.setFormData({main:{csType:g[x]?.csType,fieldLen:g[x]?.fieldLen}})),u.value.length===1&&U.value.setFormData({main:{table:u.value[0].value}})),n.componentConfigInit&&n.componentConfigInit(x,{configRef:U,...y,notBindTable:n.notBindTable})},v=(x,y,R)=>{let I=!1;const J=g[x];return y.container.type==="gridtable"?(!y.configData.isSubTable||R)&&(y.configData.isSubTable=!0,J.isInput&&(y.configData.table=y.container.config.table,y.configData.field=""),I=!0):y.configData.isSubTable&&(I=!0,y.configData.isSubTable=!1,J.isInput&&(y.configData.table="")),n.containerAddComponent&&n.containerAddComponent(x,y),I},M=(0,r.ref)(),U=(0,r.ref)(),{activedComponent:$,clearComponents:Q,changeComponent:q,schemaComponentDic:j,addComponentByTable:K,designComponentList:G}=$r(M,U,a,n.componentInit,z,S,g,v),k=(0,r.computed)(()=>$.value?`【${$.value.name}】`:"");(0,r.provide)("dui-design-provide",{designItemName:Pr});const Y=()=>{Q()},w=()=>{n.componentInit&&(a.config=n.componentInit("form")||{}),Q()},V=()=>{let x=0;const y=Sn(a.config,a.children||[]);if(n.notBindTable){const R={};y.components.forEach(W=>{const{isInput:ce,bindTable:fe}=g[W.type]||{hasBase:!1};ce&&fe!==!1?W.config.table&&!R.main&&(R.main={name:W.config.table,comment:"主表",type:"main",pKey:"J_Id"}):fe&&(R[W.id]={name:W.config.table||"t"+new Date().getTime()+x,comment:`子表${W.config.label}`,type:"chlid",field:"J_PId",relationField:"J_Id",pKey:"J_Id"},W.config.table=R[W.id].name,x++)}),R.main||(R.main={name:"t"+new Date().getTime()+x,comment:"主表",type:"main",pKey:"J_Id"},x++);let I=0;y.components.forEach(W=>{const{isInput:ce,bindTable:fe}=g[W.type]||{hasBase:!1};!W.config.isNotSave&&ce&&fe!==!1&&(W.config.csType||(W.config.csType=g[W.type]?.csType,W.config.fieldLen=g[W.type]?.fieldLen),W.config.isSubTable?W.config.table=R[W.containerId].name:W.config.table=R.main.name,W.config.field=W.config.field||`f${Math.floor(Date.now()/1e3)}${I}`,I++)});const J=[];Object.keys(R).forEach(W=>{R[W].type==="chlid"&&(R[W].relationName=R.main.name,R[W].comment+=`,关联主表${R.main.name}`),J.push(R[W])}),y.db=J}else{const R={};c.value.forEach(I=>{I.columns.forEach(J=>{R[`${I.name}_${J.name}`]=J.csType})}),y.components.forEach(I=>{I.config.table&&I.config.field&&(I.config.csType=R[`${I.config.table}_${I.config.field}`])})}return n.notBindTable?y.db.forEach(R=>{if(!y.components.find(I=>I.config.table===R.name&&I.config.field==="J_Id")){const I=y.components.find(J=>J.config.table===R.name&&J.config.field);I&&y.components.push({id:R.name+"_J_Id",name:R.name+"_J_Id",type:"pkey",runtimeType:"j-input",groupId:"",config:{display:!1,table:R.name,field:"J_Id",label:"主键"},containerId:I.containerId,level:I.level})}}):c.value.forEach(R=>{R.columns.forEach(I=>{if(I.isPrimary&&!y.components.find(J=>J.config.table===R.name&&J.config.field===I.name)){const J=y.components.find(W=>W.config.table===R.name&&W.config.field);J&&y.components.push({id:R.name+"_"+I.name,name:R.name+"_"+I.name,type:"pkey",runtimeType:"j-input",groupId:"",config:{display:!1,table:R.name,field:I.name,label:"主键"+I.name,isIdentity:I.isIdentity},containerId:J.containerId,level:J.level})}})}),y},m=x=>{const y=Rr(x,g);a.config=y.formConfig,a.children?.push(...y.componentList),Object.keys(y.componentDic).forEach(R=>{j[R]=y.componentDic[R]})},E=()=>T(Sn(a.config,a.children||[]).components,{},{}),B=x=>{const{isInput:y,bindTable:R}=g[x]||{hasBase:!1};if(!y&&R)return!0},T=(x,y,R)=>{if(!n.notBindTable)for(const I of x){const{isInput:J,bindTable:W}=g[I.type]||{hasBase:!1};if(!I.config.isNotSave&&I.type!=="pkey"){if(J&&W!==!1){if((0,qe.isNullOrEmpty)(I.config.table))return s&&s(`请【${I.config.label}】绑定数据表!`),!1;if(!I.config.isSubTable){if(R[I.config.table]&&B(R[I.config.table].type))return s&&s(`【${I.config.label}】和【${R[I.config.table].config.label}】重复绑定【${I.config.table}】表!`),!1;I.config.table&&(R[I.config.table]=I)}}else if(W){if((0,qe.isNullOrEmpty)(I.config.table))return s&&s(`【${I.config.label}】请绑定数据表!`),!1;if(R[I.config.table])return s&&s(`【${I.config.label}】和【${R[I.config.table].config.label}】重复绑定【${I.config.table}】表!`),!1;I.config.table&&(R[I.config.table]=I)}}}for(const I of x){if(!n.notBindTable){const{isInput:J,bindTable:W}=g[I.type]||{hasBase:!1};if(!I.config.isNotSave&&J&&W!==!1){if((0,qe.isNullOrEmpty)(I.config.field))return s&&s(`请【${I.config.label}】绑定表字段!`),!1;if(y[`${I.config.table}-${I.config.field}`])return s&&s(`【${I.config.label}】和【${y[`${I.config.table}-${I.config.field}`].config.label}】重复绑定【${I.config.field}】字段!`),!1;y[`${I.config.table}-${I.config.field}`]=I}}if(n.componentConfigValidate&&!n.componentConfigValidate(I.type,{configData:I.config,errorTip:s}))return!1}return!0},A=(0,r.ref)(),H=(0,r.ref)(),F=(0,r.reactive)({width:0,height:0,formConfig:{}});let te=0;const se=x=>{if(H.value)te=0,H.value.init(x||[]);else{if(te>600){console.warn("表单组件加载超时");return}te++,setTimeout(()=>{se(x)},100)}},L=()=>{},Z=()=>{},P=()=>{const x=Sn(a.config,a.children||[]);F.width=x.form.width||800,F.height=x.form.height||600,A.value.open("表单预览",x.form.layerType),(0,r.nextTick)(()=>{const{formConfig:y,componentList:R}=zr(x);F.formConfig=y,se(R)})},X=(0,r.ref)(),ne=(0,r.ref)(),ie=()=>{const{addList:x,table:y}=ne.value?.ok()||{addList:[]};if(x.length<=0)i&&i("请选择字段!");else{if($.value?.config.componentType==="gridtable"||$.value?.config.isSubTable)if($.value.config.table){if($.value.config.table!==y){i&&i("请设置相同的表和子表!");return}}else{let R=$.value;$.value.config.isSubTable&&(R=j[$.value.containerId]),R.config.table=y,(R.children||[]).forEach(I=>{I.isInput&&(I.config.table=y)}),U.value.setFormData({main:{table:y}})}x.forEach(R=>{const I=(0,qe.deepClone)(g[R.type]);I.config={table:y,field:R.value,label:R.label},K(I)}),X.value.close()}},le=()=>{ne.value?.closed()};return e({setTables:x=>{f(x)},getSchema:()=>V(),setSchema:x=>m(x),reset:()=>w(),validate:()=>E(),preview:P,clear:Y}),(x,y)=>{const R=(0,r.resolveComponent)("j-icon"),I=(0,r.resolveComponent)("d-drag-tool"),J=(0,r.resolveComponent)("el-collapse-item"),W=(0,r.resolveComponent)("el-collapse"),ce=(0,r.resolveComponent)("d-drag-form-list"),fe=(0,r.resolveComponent)("el-row"),he=(0,r.resolveComponent)("d-drag-container"),Ee=(0,r.resolveComponent)("j-form"),ke=(0,r.resolveComponent)("j-layer");return(0,r.openBlock)(),(0,r.createElementBlock)("div",_h,[(0,r.createElementVNode)("div",wh,[(0,r.createElementVNode)("div",bh,[(0,r.createVNode)(W,{modelValue:l.value,"onUpdate:modelValue":y[0]||(y[0]=pe=>l.value=pe)},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(t.components,(pe,Wr)=>((0,r.openBlock)(),(0,r.createBlock)(J,{key:Wr,title:pe.name,name:Wr},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(pe.children,(Co,tg)=>((0,r.openBlock)(),(0,r.createBlock)(I,{key:tg,config:Co},{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",Ch,[(0,r.createVNode)(R,{class:"j-component-tool-icon",icon:Co.icon,size:14},null,8,["icon"]),(0,r.createElementVNode)("div",Eh,(0,r.toDisplayString)((0,r.unref)(o)(Co.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),(0,r.createElementVNode)("div",xh,[(0,r.createElementVNode)("div",Nh,[(0,r.createVNode)(he,{ref_key:"dragContainer",ref:M,class:"d-form-design-drag-container","is-component-container":!1,"component-data":a},{default:(0,r.withCtx)(()=>[!a.children||a.children.length===0?((0,r.openBlock)(),(0,r.createElementBlock)("div",kh,[...y[1]||(y[1]=[(0,r.createElementVNode)("div",null,"请从左侧拖拽组件到此处",-1)])])):((0,r.openBlock)(),(0,r.createBlock)(fe,{key:1},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(ce,{"component-list":a.children,"global-config":a.config},null,8,["component-list","global-config"])]),_:1}))]),_:1},8,["component-data"])])]),(0,r.withDirectives)((0,r.createElementVNode)("div",Sh,[(0,r.createElementVNode)("div",Dh,[(0,r.createElementVNode)("span",Th,(0,r.toDisplayString)(`${(0,r.unref)(o)("属性配置")}${k.value}`),1)]),(0,r.createElementVNode)("div",Mh,[(0,r.createVNode)(Ee,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:U,onChange:D},null,512)])],512),[[r.vShow,(0,r.unref)($)]]),(0,r.createVNode)(ke,{ref_key:"previewFormLayerRef",ref:A,width:F.width,height:F.height,onOk:L,onClosed:Z},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(Ee,{config:F.formConfig,"is-preview":!0,ref_key:"previewFormRef",ref:H,actions:t.actions},null,8,["config","actions"])]),_:1},8,["width","height"]),(0,r.createVNode)(ke,{ref_key:"importFormLayerRef",ref:X,width:800,height:600,"btn-text":"确认",onOk:ie,onClosed:le},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(ph,{"component-list":p,"table-list":c.value,ref_key:"importComponentRef",ref:ne},null,8,["table-list"])]),_:1},512)])}}}),Bh=Ih,Or=Je(Bh,[Pr]),Vr=(t,e)=>{const n={ver:"V3",indexPage:{...t},components:[]};return Hr(e||[],n.components),n},Hr=(t,e)=>{t.forEach(n=>{const o={id:n.id,name:n.name,type:n.type,runtimeType:n.runtimeType||n.componentName||n.type,groupId:n.groupId||"",config:n.config,containerId:n.containerId,level:n.level};n.dragType==="container"&&Hr(n.children||[],e),e.push(o)})},zh=t=>{const e=Rh(t.components);return{pageConfig:t.indexPage,componentList:e}},Rh=t=>{const e={},n={};return t.forEach(o=>{e[o.containerId]=e[o.containerId]||[];const i={id:o.id,type:o.runtimeType,slot:o.groupId,config:{}};o.config&&Object.keys(o.config).forEach(s=>{i.config[s]=o.config[s]}),e[o.containerId].push(i),n[o.id]=i}),Object.keys(e).forEach(o=>{const i=n[o];if(i){const s=e[o];if(["j-tabs","j-collapse"].includes(i.type||"")&&i.config?.groups){const a={};s.forEach(l=>{if(l.slot!==void 0&&l.slot!==null){const d=l.slot.toString();a[d]||(a[d]=[]),delete l.slot,a[d].push(l)}}),i.children=i.config.groups.map(l=>{const d=a[l._i]||[];return{config:{label:l.label},children:d}}),delete i.config.groups}else i.children=s}}),e.indexPage||[]},Ah=(t,e)=>{let n={},o=[];const i={};if(t.ver==="V3"){const s=t;n=s.indexPage;const a={};s.components.forEach(l=>{const d=e[l.type];if(!d)return;a[l.containerId]=a[l.containerId]||[];const c={id:l.id,name:l.name,type:l.type,dragType:d.dragType||"component",componentName:d.componentName||"",runtimeType:d.runtimeType,groupId:l.groupId,config:l.config,isInput:!1,containerId:l.containerId,level:l.level};i[c.id]=c,a[l.containerId].push(c),c.dragType==="container"&&(c.children=[])}),Object.keys(a).forEach(l=>{i[l]&&(i[l].children=a[l])}),o=a.indexPage||[]}return{pageConfig:n,componentList:o,componentDic:i}},$h=(0,r.defineComponent)({name:"DIndexDesignItem",__name:"indexDesignItem",props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(t){return(e,n)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(t.componentData?.componentName),(0,r.mergeProps)(t.componentData?.config,{"global-config":t.globalConfig,"component-data":t.componentData}),null,16,["global-config","component-data"]))}}),Lr=$h,Ph={class:"d-index-design j-block"},Oh={class:"d-index-design-left"},Vh={class:"j-component-list"},Hh={class:"j-component-tool"},Lh={class:"j-component-tool-name"},Fh={class:"d-index-design-center"},Gh={class:"design-toolbar"},Wh={class:"design-container"},Uh={key:0,class:"j-block design-empty"},Yh={class:"d-index-design-right"},Xh={class:"d-index-design-panel-title"},jh={style:{margin:"0","font-size":"14px"}},Zh={class:"d-index-design-panel"},Kh=(0,r.defineComponent)({name:"DIndexDesign",__name:"indexDesign",props:{components:{type:Array,default:()=>[]},componentConfigs:{type:Object,default:()=>({})},componentInit:Function,containerAddComponent:Function,componentConfigInit:Function,componentConfigChange:Function,flowComponents:{type:Array,default:()=>[]},flowInit:Function,flowComponentConfigInit:Function,flowComponentConfigChange:Function,flowComponentConfigs:{type:Object,default:()=>({})},actions:{type:Object,default:()=>({})}},setup(t,{expose:e}){const{t:n}=(0,qe.useAppInject)(),o=t,i=m=>{m.forEach(E=>{E.type==="d-input-flow"&&(E.config=E.config||{},E.config.flowComponents=o.flowComponents,E.config.flowInit=o.flowInit,E.config.flowComponentConfigInit=B=>{o.flowComponentConfigInit&&(B.designComponents=S.value,B.component=g.value,o.flowComponentConfigInit(B))},E.config.flowComponentConfigs=o.flowComponentConfigs,E.config.flowComponentConfigChange=o.flowComponentConfigChange),E.children&&i(E.children)})},s=(0,r.reactive)({name:"页面",id:"indexPage",type:"indexPage",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}});o.componentInit&&(s.config=o.componentInit("indexPage")||{});const a={},l=[];o.components.forEach(({children:m})=>{m.forEach(E=>{a[E.type]=E,E.dragType=E.dragType||"component",l.push({label:E.name,value:E.type})})});const d={};Object.keys(o.componentConfigs).forEach(m=>{const{hasBase:E}=a[m]||{hasBase:!1},B=[{id:"id",type:"j-input",config:{label:"ID",readonly:!0}},{id:"label",type:"j-input",config:{label:"名称"}}],T={type:"j-collapse",config:{defaultValue:[]},children:[]};E!==!1&&(T.children?.push({config:{label:"基础信息"},children:[...B]}),T.config?.defaultValue.push("_collapse0")),T.children?.push(...o.componentConfigs[m]),i(T.children||[]),d[m]=[T]});const c=m=>{g.value&&o.componentConfigChange&&o.componentConfigChange(g.value.type,{configRef:f,configData:g.value.config,...m})},u=(m,E)=>{o.componentConfigInit&&o.componentConfigInit(m,{configRef:f,...E})},h=(0,r.ref)(),f=(0,r.ref)(),{activedComponent:g,clearComponents:p,schemaComponentDic:b,designComponentList:S}=$r(h,f,s,o.componentInit,u,d,a,o.containerAddComponent),D=(0,r.computed)(()=>g.value?`【${g.value.name}】`:""),z=(0,r.ref)([]),v=o.components.length;for(let m=0;m<v;m++)z.value.push(m);(0,r.provide)("dui-design-provide",{designItemName:Lr});const M=()=>{p()},U=()=>{o.componentInit&&(s.config=o.componentInit("indexPage")||{}),p()},$=()=>(console.log("pValidate"),!0),Q=()=>Vr(s.config,s.children||[]),q=m=>{const E=Ah(m,a);s.config=E.pageConfig,s.children?.push(...E.componentList),Object.keys(E.componentDic).forEach(B=>{b[B]=E.componentDic[B]})},j=(0,r.ref)(),K=(0,r.ref)();(0,r.ref)(""),(0,r.reactive)({formConfig:{}});let G=0;const k=m=>{if(K.value)G=0,K.value.init(m);else{if(G>600){console.warn("组件加载超时");return}G++,setTimeout(()=>{k(m)},100)}},Y=()=>{},w=()=>{},V=()=>{const{componentList:m}=zh(Vr(s.config,s.children||[]));j.value.open("页面预览","full"),(0,r.nextTick)(()=>{k(m)})};return e({reset:U,validate:$,getSchema:Q,setSchema:q}),(m,E)=>{const B=(0,r.resolveComponent)("j-icon"),T=(0,r.resolveComponent)("d-drag-tool"),A=(0,r.resolveComponent)("el-collapse-item"),H=(0,r.resolveComponent)("el-collapse"),F=(0,r.resolveComponent)("j-button"),te=(0,r.resolveComponent)("el-tooltip"),se=(0,r.resolveComponent)("el-divider"),L=(0,r.resolveComponent)("el-empty"),Z=(0,r.resolveComponent)("d-drag-index-list"),P=(0,r.resolveComponent)("d-drag-container"),X=(0,r.resolveComponent)("j-form"),ne=(0,r.resolveComponent)("j-page"),ie=(0,r.resolveComponent)("j-layer");return(0,r.openBlock)(),(0,r.createElementBlock)("div",Ph,[(0,r.createElementVNode)("div",Oh,[E[1]||(E[1]=(0,r.createElementVNode)("div",{class:"d-index-design-panel-title"},"组件库",-1)),(0,r.createElementVNode)("div",Vh,[(0,r.createVNode)(H,{modelValue:z.value,"onUpdate:modelValue":E[0]||(E[0]=le=>z.value=le)},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(t.components,(le,ee)=>((0,r.openBlock)(),(0,r.createBlock)(A,{key:ee,title:le.name,name:ee},{default:(0,r.withCtx)(()=>[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(le.children,(re,C)=>((0,r.openBlock)(),(0,r.createBlock)(T,{key:C,config:re},{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("div",Hh,[(0,r.createVNode)(B,{class:"j-component-tool-icon",icon:re.icon,size:14},null,8,["icon"]),(0,r.createElementVNode)("div",Lh,(0,r.toDisplayString)((0,r.unref)(n)(re.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),(0,r.createElementVNode)("div",Fh,[(0,r.createElementVNode)("div",Gh,[E[2]||(E[2]=(0,r.createElementVNode)("div",null,null,-1)),(0,r.createElementVNode)("div",null,[(0,r.createVNode)(te,{content:(0,r.unref)(n)("清空")},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(F,{danger:"",type:"text",onClick:M,icon:"mdi:delete-outline"})]),_:1},8,["content"]),(0,r.createVNode)(se,{direction:"vertical"}),(0,r.createVNode)(te,{content:(0,r.unref)(n)("预览")},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(F,{type:"text",onClick:V,icon:"mdi:play-circle-outline"})]),_:1},8,["content"])])]),(0,r.createElementVNode)("div",Wh,[(0,r.createVNode)(P,{ref_key:"dragContainer",ref:h,class:"design-drag-container","is-component-container":!1,"component-data":s},{default:(0,r.withCtx)(()=>[!s.children||s.children.length===0?((0,r.openBlock)(),(0,r.createElementBlock)("div",Uh,[(0,r.createVNode)(L,{description:(0,r.unref)(n)("请从左侧拖拽组件到此处"),"image-size":100},null,8,["description"])])):((0,r.openBlock)(),(0,r.createBlock)(Z,{key:1,"component-list":s.children,"global-config":s.config},null,8,["component-list","global-config"]))]),_:1},8,["component-data"])])]),(0,r.withDirectives)((0,r.createElementVNode)("div",Yh,[(0,r.createElementVNode)("div",Xh,[(0,r.createElementVNode)("span",jh,(0,r.toDisplayString)(`${(0,r.unref)(n)("属性配置")}${D.value}`),1)]),(0,r.createElementVNode)("div",Zh,[(0,r.createVNode)(X,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:f,onChange:c},null,512)])],512),[[r.vShow,(0,r.unref)(g)&&d[(0,r.unref)(g).type]]]),(0,r.createVNode)(ie,{ref_key:"previewLayerRef",ref:j,"has-btns":!1,onOk:Y,onClosed:w},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(ne,{ref_key:"previewRef",ref:K,actions:t.actions},null,8,["actions"])]),_:1},512)])}}}),qh=Kh,Fr=Je(qh,[Lr]),Jh=[Do,In,Bn,zn,Rn,Er,xr,Ir,Br,Or,Fr],Gr=new WeakSet,Qh=t=>{Gr.has(t)||(Gr.add(t),Jh.forEach(e=>{const n=e.name;n&&t.component(n,e)}))},eg={install:Qh};me.DDrag=Do,me.DDraggable=Br,me.DFlowDesign=Er,me.DFormDesign=Or,me.DIndexDesign=Fr,me.DInputFlow=xr,me.DLayout=Ir,me.default=eg,me.dragContainer=Bn,me.dragFormList=zn,me.dragIndexList=Rn,me.dragTool=In,me.toFormDesignSchema=Rr,me.toFormSaveSchema=Sn,me.toFormSchema=zr});