@a2simcode/dui 0.0.1 → 0.0.3

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.
Files changed (38) hide show
  1. package/dist/components-dui/drag/index.d.ts +36 -0
  2. package/dist/components-dui/drag/src/container.vue.d.ts +40 -0
  3. package/dist/components-dui/drag/src/drag.vue.d.ts +29 -0
  4. package/dist/components-dui/drag/src/dragFormList.vue.d.ts +16 -0
  5. package/dist/components-dui/drag/src/dragIndexList.vue.d.ts +16 -0
  6. package/dist/components-dui/drag/src/eventBus.d.ts +4 -0
  7. package/dist/components-dui/drag/src/hooks/useDesign.d.ts +11 -0
  8. package/dist/components-dui/drag/src/hooks/useDrag.d.ts +18 -0
  9. package/dist/components-dui/drag/src/hooks/useMouseEvent.d.ts +6 -0
  10. package/dist/components-dui/drag/src/interface.d.ts +80 -0
  11. package/dist/components-dui/drag/src/tool.vue.d.ts +24 -0
  12. package/dist/components-dui/draggable/index.d.ts +223 -0
  13. package/dist/components-dui/draggable/src/draggable.vue.d.ts +131 -0
  14. package/dist/components-dui/flowDesign/index.d.ts +66 -0
  15. package/dist/components-dui/flowDesign/src/edge/edgeWithButton.vue.d.ts +22 -0
  16. package/dist/components-dui/flowDesign/src/flow.vue.d.ts +12 -0
  17. package/dist/components-dui/flowDesign/src/flowDesign.vue.d.ts +44 -0
  18. package/dist/components-dui/flowDesign/src/interface.d.ts +108 -0
  19. package/dist/components-dui/flowDesign/src/node/stepNode.vue.d.ts +10 -0
  20. package/dist/components-dui/flowDesign/src/nodeMenus.vue.d.ts +12 -0
  21. package/dist/components-dui/index.d.ts +11 -0
  22. package/dist/components-dui/inputFlow/index.d.ts +68 -0
  23. package/dist/components-dui/inputFlow/src/inputFlow.vue.d.ts +60 -0
  24. package/dist/components-dui/layout/index.d.ts +115 -0
  25. package/dist/components-dui/layout/src/layout.vue.d.ts +114 -0
  26. package/dist/components-dui/utils/components.d.ts +8 -0
  27. package/dist/components-dui/utils/index.d.ts +7 -0
  28. package/dist/components-dui/utils/number.d.ts +27 -0
  29. package/dist/dui.css +1 -1
  30. package/dist/dui.es.js +14127 -57
  31. package/dist/dui.umd.js +28 -1
  32. package/package.json +18 -14
  33. package/dist/button/index.d.ts +0 -51
  34. package/dist/button/src/button.vue.d.ts +0 -29
  35. package/dist/button/src/types.d.ts +0 -9
  36. package/dist/index.d.ts +0 -8
  37. package/dist/utils/index.d.ts +0 -4
  38. /package/dist/{vite.config.d.ts → components-dui/vite.config.d.ts} +0 -0
package/dist/dui.umd.js CHANGED
@@ -1 +1,28 @@
1
- (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.DuiUI={},n.Vue))})(this,(function(n,e){"use strict";const c=t=>(t.install=o=>{o.component(t.name,t)},t),s=["disabled"],f={key:0,class:"dui-button-loading-icon"},b={key:1,class:"dui-button-icon"},r={key:2,class:"dui-button-content"},u=c(((t,o)=>{const i=t.__vccOpts||t;for(const[d,a]of o)i[d]=a;return i})(e.defineComponent({name:"DuiButton",__name:"button",props:{type:{default:"default"},size:{default:"default"},shape:{default:"default"},icon:{},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},block:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:o}){const i=t,d=o,a=l=>{!i.disabled&&!i.loading&&d("click",l)};return(l,C)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["dui-button",{"dui-button-primary":t.type==="primary","dui-button-default":t.type==="default","dui-button-dashed":t.type==="dashed","dui-button-text":t.type==="text","dui-button-lg":t.size==="large","dui-button-sm":t.size==="small","dui-button-round":t.shape==="round","dui-button-circle":t.shape==="circle","dui-button-block":t.block,"dui-button-loading":t.loading,"dui-button-disabled":t.disabled}]),disabled:t.disabled||t.loading,onClick:a},[t.loading?(e.openBlock(),e.createElementBlock("span",f,"⏳")):e.createCommentVNode("",!0),t.icon&&!t.loading?(e.openBlock(),e.createElementBlock("span",b,e.toDisplayString(t.icon),1)):e.createCommentVNode("",!0),l.$slots.default?(e.openBlock(),e.createElementBlock("span",r,[e.renderSlot(l.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)],10,s))}}),[["__scopeId","data-v-6eec975a"]])),m=[u],k={install:t=>{m.forEach(o=>{t.component(o.name,o)})}};n.DuiButton=u,n.default=k,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(_e,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(_e=typeof globalThis<"u"?globalThis:_e||self,r(_e.DuiUI={},_e.Vue))})(this,(function(_e,r){"use strict";const mt=(t,e)=>(t.install=n=>{n.component(t.name,t),e&&e.forEach(o=>{n.component(o.name,o)})},t),Wt=(t="")=>{const e=Date.now(),n=Math.floor(Math.random()*1e9);return t===""?String(n)+String(e):t+"_"+n+String(e)},On={},wr=(t,e,n)=>{n[t]=n[t]||{};const o=Wt();return n[t][o]=e,o},_r=(t,e,n)=>{const o=[],i=n[t]||{};return Object.keys(i).forEach(s=>{const l=i[s];try{l&&o.push(l(e))}catch(a){console.error(a)}}),o},br=(t,e,n)=>{if(e){const o=n[t];o&&delete o[e]}else delete n[t]},Vo=(t,e)=>wr(t,e,On),we=(t,e)=>_r(t,e,On),xr=(t,e)=>{br(t,e,On)},Lo=(t,e,n,o,i,s)=>{const l=e.id,a=e.level,{getDesignLocals:d,selectComponent:c,getComponent:u,isMyChildComponent:f,addComponent:h,deleteComponent:g,getParentComponents:p,removeComponentFromContainer:m,addComponentToContainer:v,copyComponent:E,activedComponent:M,top:y}=r.inject("d-drag-design-provide",{}),C=[],$=r.ref(!1),O=r.ref(!1),L=r.ref(!1),j=r.ref(!1),W=r.ref(!1),G={id:"",type:""},F=r.ref(!1),N=r.ref(!1);let H="",_=null;const A=B=>{if(H===B)return _;H=B;const{top:U,left:K,width:te,height:ce}=t.value.getBoundingClientRect();return _=[{x:K,y:U},{x:K+te,y:U},{x:K+te,y:U+ce},{x:K,y:U+ce}],_},S=(B,U,K)=>{let te=U-K[0].y;te<0&&(te=-te);let ce=U-K[3].y;ce<0&&(ce=-ce);let q=B-K[0].x;q<0&&(q=-q);let ie=B-K[1].x;return ie<0&&(ie=-ie),{ly:te>ce?ce:te,typey:te>ce?"bottom":"top",lx:q>ie?ie:q,lallx:q+ie}},R=(B,U,K)=>B>=K[0].x&&B<=K[1].x&&U>=K[0].y&&U<=K[3].y,V=()=>{if(i){we("dragClick",{id:l});return}if(!O.value){if(c(l),a!==0){const B=t.value.getBoundingClientRect(),U=d();B.top-U.top<22?j.value=!0:j.value=!1}O.value=!0,we("dragClick",{id:l})}},T=B=>{const U=g(B);U&&r.nextTick(()=>{we("dragClick",{id:U})})},I=()=>{G.id="",G.type="",a===0&&(W.value=!1)},Y=()=>{we("mouseEnterOrLeave",{id:l,type:"enter"})},X=()=>{we("mouseEnterOrLeave",{id:l,type:"leave"})},J=B=>{we("dragClick",{id:B})},re={mouseEnterOrLeave:({id:B,type:U})=>{U==="enter"?C.push(B):C.length>0&&C.splice(C.length-1,1);const K=C.length;K>0&&l===C[K-1]?$.value=!0:$.value=!1},dragAciveChild:({type:B,id:U})=>{U===l?B==="top"?(F.value=!0,N.value=!1):(N.value=!0,F.value=!1):(N.value=!1,F.value=!1)},dragClick({id:B,isAgain:U}){console.log("dragClick",B,l),B!==l?O.value=!1:(U&&(O.value=!1),V())}};re[`dragGetChildDistance_${l}`]=({dragX:B,dragY:U,moveId:K})=>{const te=A(K);return S(B,U,te)};const P={isInContainer({x:B,y:U,id:K,moveId:te}){if(l===K||f(K,l))return L.value=!1,{isIn:!1,level:a,id:l,groupId:s};const ce=A(te);if(R(B,U,ce))return a===0&&(W.value=!0),{isIn:!0,level:a,id:l,groupId:s};if(a===0){const{ly:q,lx:ie}=S(B,U,ce);if(q<20&&ie<20)return W.value=!0,{isIn:!0,level:a,id:l,groupId:s};W.value=!1}return L.value=!1,{isIn:!1,level:a,id:l,groupId:s}},dragActiveContainer:({containerId:B,containerGroupId:U,dragX:K,dragY:te,moveId:ce})=>{if(B===l&&U===s)if(L.value=!0,o&&o.value.length>0){let q={ly:9999999,lx:0,lallx:0,id:"",typey:""};o?.value.forEach(ie=>{if(s&&ie.groupId!==s)return;const b=we(`dragGetChildDistance_${ie.id}`,{dragX:K,dragY:te,moveId:ce})[0];b&&(q.ly>b.ly||q.ly===b.ly&&(q.lx>b.lx||q.lx===b.lx&&q.lallx>b.lallx))&&(q=b,q.id=ie.id)}),G.id=q.id,G.type=q.typey,we("dragAciveChild",{id:q.id,type:q.typey})}else we("dragAciveChild",{id:""});else L.value=!1},dragAdd:B=>{if(L.value){let U=o?.value.length||0;G.id!==""&&G.id!==void 0&&(U=o?.value.findIndex(K=>K.id===G.id)||0,G.type==="bottom"&&(U+=1)),h(B,l,U,s),L.value=!1}I()},dragAddByClick:B=>{if(!M.value&&l===y.id||M.value?.id===l||M.value?.containerId===l&&M.value?.dragType!=="container"){const U=o?.value.length||0,K=h(B,l,U,s,!0);K&&B.config&&Object.keys(B.config).forEach(te=>{K.config[te]=B.config[te]})}},dragUpdate(B){if(L.value){const U=u(B);if(U.level=a+1,G.id!==U.id){m(U.containerId,B);let K=o?.value.findIndex(te=>te.id===G.id)||0;G.type==="bottom"&&(K+=1),v(U,l,K,s)}L.value=!1,r.nextTick(()=>{we("dragClick",{id:U.id,isAgain:!0})})}I()}},Z={};return r.onMounted(()=>{(!i||n!=="container")&&Object.keys(re).forEach(B=>{Z[B]=Vo(B,re[B])}),n==="container"&&Object.keys(P).forEach(B=>{Z[B]=Vo(B,P[B])}),e.isNewAdd&&r.nextTick(()=>{V(),delete e.isNewAdd})}),r.onUnmounted(()=>{Object.keys(Z).forEach(B=>{xr(B,Z[B])})}),{onMouseenter:Y,onMouseleave:X,activeComponent:V,handleComponentClick:J,deleteComponentByClick:T,copyComponent:E,getParentComponents:p,isBottomToolBar:j,isHover:$,isSelect:O,isToContainer:L,isMoveingInTopLevel:W,isTopActive:F,isBottomActive:N}},Fo=(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=r.ref(!1),l=(g,p,m)=>{const v=document.createElement("div");return v.id=n.dragElementId,v.innerText=g,v.className="d-drag-move",v.style.top=`${p}px`,v.style.left=`${m}px`,document.body.appendChild(v),v},a=()=>{document.onmousemove=null,document.onmouseup=null,s.value=!1,we("dragAciveChild",{id:""})},d=()=>{a(),n.dragElement&&(n.dragElement.remove(),n.dragElement=null,e?we("dragAdd",t):we("dragUpdate",t.id))},c=g=>{const{clientY:p,clientX:m}=g;if(!n.dragElement){const v=Math.abs(n.x-m),E=Math.abs(n.y-p);if(v<=1&&E<=1)return;s.value=!0,n.dragElement=l(t.name,p-11,m-32)}n.dragElement.style.top=`${p-11}px`,n.dragElement.style.left=`${m-32}px`,n.clientX=m,n.clientY=p,i(()=>{if(!s.value)return;const v=we("isInContainer",{x:m,y:p,id:t.id,moveId:n.id});n.toContainerLevel=-1,n.toContainerId="",n.groupId="",v.forEach(({level:E,id:M,isIn:y,groupId:C})=>{y&&n.toContainerLevel<E&&(n.toContainerLevel=E,n.toContainerId=M,n.groupId=C)}),n.toContainerId!==""?we("dragActiveContainer",{containerId:n.toContainerId,containerGroupId:n.groupId,dragX:m,dragY:p,moveId:n.id}):we("dragAciveChild",{id:""})},100)};return{onContextmenu:()=>{a()},onMousedown:g=>{n.x=g.clientX,n.y=g.clientY,n.id=Wt(),document.onmouseup=d,document.onmousemove=c},onClick:()=>{we("dragAddByClick",t)},moveActive:s}},Er=t=>(t.install=e=>{e.component(t.name,t)},t),Cr=t=>!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&Object.keys(t).length===0),Go=/^[a-z0-9]+(-[a-z0-9]+)*$/,Yt=(t,e,n,o="")=>{const i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;o=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const a=i.pop(),d=i.pop(),c={provider:i.length>0?i[0]:o,prefix:d,name:a};return e&&!Ut(c)?null:c}const s=i[0],l=s.split("-");if(l.length>1){const a={provider:o,prefix:l.shift(),name:l.join("-")};return e&&!Ut(a)?null:a}if(n&&o===""){const a={provider:o,prefix:"",name:s};return e&&!Ut(a,n)?null:a}return null},Ut=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1,Wo=Object.freeze({left:0,top:0,width:16,height:16}),Xt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),yt=Object.freeze({...Wo,...Xt}),Hn=Object.freeze({...yt,body:"",hidden:!1});function Nr(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const o=((t.rotate||0)+(e.rotate||0))%4;return o&&(n.rotate=o),n}function Yo(t,e){const n=Nr(t,e);for(const o in Hn)o in Xt?o in t&&!(o in n)&&(n[o]=Xt[o]):o in e?n[o]=e[o]:o in t&&(n[o]=t[o]);return n}function kr(t,e){const n=t.icons,o=t.aliases||Object.create(null),i=Object.create(null);function s(l){if(n[l])return i[l]=[];if(!(l in i)){i[l]=null;const a=o[l]&&o[l].parent,d=a&&s(a);d&&(i[l]=[a].concat(d))}return i[l]}return Object.keys(n).concat(Object.keys(o)).forEach(s),i}function Sr(t,e,n){const o=t.icons,i=t.aliases||Object.create(null);let s={};function l(a){s=Yo(o[a]||i[a],s)}return l(e),n.forEach(l),Yo(t,s)}function Uo(t,e){const n=[];if(typeof t!="object"||typeof t.icons!="object")return n;t.not_found instanceof Array&&t.not_found.forEach(i=>{e(i,null),n.push(i)});const o=kr(t);for(const i in o){const s=o[i];s&&(e(i,Sr(t,i,s)),n.push(i))}return n}const Mr={provider:"",aliases:{},not_found:{},...Wo};function Vn(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function Xo(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!Vn(t,Mr))return null;const n=e.icons;for(const i in n){const s=n[i];if(!i||typeof s.body!="string"||!Vn(s,Hn))return null}const o=e.aliases||Object.create(null);for(const i in o){const s=o[i],l=s.parent;if(!i||typeof l!="string"||!n[l]&&!o[l]||!Vn(s,Hn))return null}return e}const jo=Object.create(null);function Dr(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function it(t,e){const n=jo[t]||(jo[t]=Object.create(null));return n[e]||(n[e]=Dr(t,e))}function Zo(t,e){return Xo(e)?Uo(e,(n,o)=>{o?t.icons[n]=o:t.missing.add(n)}):[]}function zr(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}let vt=!1;function qo(t){return typeof t=="boolean"&&(vt=t),vt}function Ko(t){const e=typeof t=="string"?Yt(t,!0,vt):t;if(e){const n=it(e.provider,e.prefix),o=e.name;return n.icons[o]||(n.missing.has(o)?null:void 0)}}function Tr(t,e){const n=Yt(t,!0,vt);if(!n)return!1;const o=it(n.provider,n.prefix);return e?zr(o,n.name,e):(o.missing.add(n.name),!0)}function Ir(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),vt&&!e&&!t.prefix){let i=!1;return Xo(t)&&(t.prefix="",Uo(t,(s,l)=>{Tr(s,l)&&(i=!0)})),i}const n=t.prefix;if(!Ut({prefix:n,name:"a"}))return!1;const o=it(e,n);return!!Zo(o,t)}function Qo(t){const e=Ko(t);return e&&{...yt,...e}}const Jo=Object.freeze({width:null,height:null}),ei=Object.freeze({...Jo,...Xt}),Br=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Rr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ti(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const o=t.split(Br);if(o===null||!o.length)return t;const i=[];let s=o.shift(),l=Rr.test(s);for(;;){if(l){const a=parseFloat(s);isNaN(a)?i.push(s):i.push(Math.ceil(a*e*n)/n)}else i.push(s);if(s=o.shift(),s===void 0)return i.join("");l=!l}}function Ar(t,e="defs"){let n="";const o=t.indexOf("<"+e);for(;o>=0;){const i=t.indexOf(">",o),s=t.indexOf("</"+e);if(i===-1||s===-1)break;const l=t.indexOf(">",s);if(l===-1)break;n+=t.slice(i+1,s).trim(),t=t.slice(0,o).trim()+t.slice(l+1)}return{defs:n,content:t}}function $r(t,e){return t?"<defs>"+t+"</defs>"+e:e}function Pr(t,e,n){const o=Ar(t);return $r(o.defs,e+o.content+n)}const Or=t=>t==="unset"||t==="undefined"||t==="none";function Hr(t,e){const n={...yt,...t},o={...ei,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let s=n.body;[n,o].forEach(m=>{const v=[],E=m.hFlip,M=m.vFlip;let y=m.rotate;E?M?y+=2:(v.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),v.push("scale(-1 1)"),i.top=i.left=0):M&&(v.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),v.push("scale(1 -1)"),i.top=i.left=0);let C;switch(y<0&&(y-=Math.floor(y/4)*4),y=y%4,y){case 1:C=i.height/2+i.top,v.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:v.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:C=i.width/2+i.left,v.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}y%2===1&&(i.left!==i.top&&(C=i.left,i.left=i.top,i.top=C),i.width!==i.height&&(C=i.width,i.width=i.height,i.height=C)),v.length&&(s=Pr(s,'<g transform="'+v.join(" ")+'">',"</g>"))});const l=o.width,a=o.height,d=i.width,c=i.height;let u,f;l===null?(f=a===null?"1em":a==="auto"?c:a,u=ti(f,d/c)):(u=l==="auto"?d:l,f=a===null?ti(u,c/d):a==="auto"?c:a);const h={},g=(m,v)=>{Or(v)||(h[m]=v.toString())};g("width",u),g("height",f);const p=[i.left,i.top,d,c];return h.viewBox=p.join(" "),{attributes:h,viewBox:p,body:s}}const Vr=/\sid="(\S+)"/g,Lr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Fr=0;function Gr(t,e=Lr){const n=[];let o;for(;o=Vr.exec(t);)n.push(o[1]);if(!n.length)return t;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(s=>{const l=typeof e=="function"?e(s):e+(Fr++).toString(),a=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+l+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}const Ln=Object.create(null);function Wr(t,e){Ln[t]=e}function Fn(t){return Ln[t]||Ln[""]}function Gn(t){let e;if(typeof t.resources=="string")e=[t.resources];else if(e=t.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:t.random===!0,index:t.index||0,dataAfterTimeout:t.dataAfterTimeout!==!1}}const Wn=Object.create(null),wt=["https://api.simplesvg.com","https://api.unisvg.com"],jt=[];for(;wt.length>0;)wt.length===1||Math.random()>.5?jt.push(wt.shift()):jt.push(wt.pop());Wn[""]=Gn({resources:["https://api.iconify.design"].concat(jt)});function Yr(t,e){const n=Gn(e);return n===null?!1:(Wn[t]=n,!0)}function Yn(t){return Wn[t]}let ni=(()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}})();function Ur(t,e){const n=Yn(t);if(!n)return 0;let o;if(!n.maxURL)o=0;else{let i=0;n.resources.forEach(l=>{i=Math.max(i,l.length)});const s=e+".json?icons=";o=n.maxURL-i-n.path.length-s.length}return o}function Xr(t){return t===404}const jr=(t,e,n)=>{const o=[],i=Ur(t,e),s="icons";let l={type:s,provider:t,prefix:e,icons:[]},a=0;return n.forEach((d,c)=>{a+=d.length+1,a>=i&&c>0&&(o.push(l),l={type:s,provider:t,prefix:e,icons:[]},a=d.length),l.icons.push(d)}),o.push(l),o};function Zr(t){if(typeof t=="string"){const e=Yn(t);if(e)return e.path}return"/"}const qr={prepare:jr,send:(t,e,n)=>{if(!ni){n("abort",424);return}let o=Zr(e.provider);switch(e.type){case"icons":{const s=e.prefix,a=e.icons.join(","),d=new URLSearchParams({icons:a});o+=s+".json?"+d.toString();break}case"custom":{const s=e.uri;o+=s.slice(0,1)==="/"?s.slice(1):s;break}default:n("abort",400);return}let i=503;ni(t+o).then(s=>{const l=s.status;if(l!==200){setTimeout(()=>{n(Xr(l)?"abort":"next",l)});return}return i=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?n("abort",s):n("next",i)});return}setTimeout(()=>{n("success",s)})}).catch(()=>{n("next",i)})}};function Kr(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort((i,s)=>i.provider!==s.provider?i.provider.localeCompare(s.provider):i.prefix!==s.prefix?i.prefix.localeCompare(s.prefix):i.name.localeCompare(s.name));let o={provider:"",prefix:"",name:""};return t.forEach(i=>{if(o.name===i.name&&o.prefix===i.prefix&&o.provider===i.provider)return;o=i;const s=i.provider,l=i.prefix,a=i.name,d=n[s]||(n[s]=Object.create(null)),c=d[l]||(d[l]=it(s,l));let u;a in c.icons?u=e.loaded:l===""||c.missing.has(a)?u=e.missing:u=e.pending;const f={provider:s,prefix:l,name:a};u.push(f)}),e}function oi(t,e){t.forEach(n=>{const o=n.loaderCallbacks;o&&(n.loaderCallbacks=o.filter(i=>i.id!==e))})}function Qr(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout(()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const o=t.provider,i=t.prefix;e.forEach(s=>{const l=s.icons,a=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==i)return!0;const c=d.name;if(t.icons[c])l.loaded.push({provider:o,prefix:i,name:c});else if(t.missing.has(c))l.missing.push({provider:o,prefix:i,name:c});else return n=!0,!0;return!1}),l.pending.length!==a&&(n||oi([t],s.id),s.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),s.abort))})}))}let Jr=0;function el(t,e,n){const o=Jr++,i=oi.bind(null,n,o);if(!e.pending.length)return i;const s={id:o,icons:e,callback:t,abort:i};return n.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(s)}),i}function tl(t,e=!0,n=!1){const o=[];return t.forEach(i=>{const s=typeof i=="string"?Yt(i,e,n):i;s&&o.push(s)}),o}var nl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ol(t,e,n,o){const i=t.resources.length,s=t.random?Math.floor(Math.random()*i):t.index;let l;if(t.random){let O=t.resources.slice(0);for(l=[];O.length>1;){const L=Math.floor(Math.random()*O.length);l.push(O[L]),O=O.slice(0,L).concat(O.slice(L+1))}l=l.concat(O)}else l=t.resources.slice(s).concat(t.resources.slice(0,s));const a=Date.now();let d="pending",c=0,u,f=null,h=[],g=[];typeof o=="function"&&g.push(o);function p(){f&&(clearTimeout(f),f=null)}function m(){d==="pending"&&(d="aborted"),p(),h.forEach(O=>{O.status==="pending"&&(O.status="aborted")}),h=[]}function v(O,L){L&&(g=[]),typeof O=="function"&&g.push(O)}function E(){return{startTime:a,payload:e,status:d,queriesSent:c,queriesPending:h.length,subscribe:v,abort:m}}function M(){d="failed",g.forEach(O=>{O(void 0,u)})}function y(){h.forEach(O=>{O.status==="pending"&&(O.status="aborted")}),h=[]}function C(O,L,j){const W=L!=="success";switch(h=h.filter(G=>G!==O),d){case"pending":break;case"failed":if(W||!t.dataAfterTimeout)return;break;default:return}if(L==="abort"){u=j,M();return}if(W){u=j,h.length||(l.length?$():M());return}if(p(),y(),!t.random){const G=t.resources.indexOf(O.resource);G!==-1&&G!==t.index&&(t.index=G)}d="completed",g.forEach(G=>{G(j)})}function $(){if(d!=="pending")return;p();const O=l.shift();if(O===void 0){if(h.length){f=setTimeout(()=>{p(),d==="pending"&&(y(),M())},t.timeout);return}M();return}const L={status:"pending",resource:O,callback:(j,W)=>{C(L,j,W)}};h.push(L),c++,f=setTimeout($,t.rotate),n(O,e,L.callback)}return setTimeout($),E}function ii(t){const e={...nl,...t};let n=[];function o(){n=n.filter(a=>a().status==="pending")}function i(a,d,c){const u=ol(e,a,d,(f,h)=>{o(),c&&c(f,h)});return n.push(u),u}function s(a){return n.find(d=>a(d))||null}return{query:i,find:s,setIndex:a=>{e.index=a},getIndex:()=>e.index,cleanup:o}}function si(){}const Un=Object.create(null);function il(t){if(!Un[t]){const e=Yn(t);if(!e)return;const n=ii(e),o={config:e,redundancy:n};Un[t]=o}return Un[t]}function sl(t,e,n){let o,i;if(typeof t=="string"){const s=Fn(t);if(!s)return n(void 0,424),si;i=s.send;const l=il(t);l&&(o=l.redundancy)}else{const s=Gn(t);if(s){o=ii(s);const l=t.resources?t.resources[0]:"",a=Fn(l);a&&(i=a.send)}}return!o||!i?(n(void 0,424),si):o.query(e,i,n)().abort}function ri(){}function rl(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,Qr(t)}))}function ll(t){const e=[],n=[];return t.forEach(o=>{(o.match(Go)?e:n).push(o)}),{valid:e,invalid:n}}function _t(t,e,n){function o(){const i=t.pendingIcons;e.forEach(s=>{i&&i.delete(s),t.icons[s]||t.missing.add(s)})}if(n&&typeof n=="object")try{if(!Zo(t,n).length){o();return}}catch(i){console.error(i)}o(),rl(t)}function li(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function al(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout(()=>{t.iconsQueueFlag=!1;const{provider:n,prefix:o}=t,i=t.iconsToLoad;if(delete t.iconsToLoad,!i||!i.length)return;const s=t.loadIcon;if(t.loadIcons&&(i.length>1||!s)){li(t.loadIcons(i,o,n),u=>{_t(t,i,u)});return}if(s){i.forEach(u=>{const f=s(u,o,n);li(f,h=>{const g=h?{prefix:o,icons:{[u]:h}}:null;_t(t,[u],g)})});return}const{valid:l,invalid:a}=ll(i);if(a.length&&_t(t,a,null),!l.length)return;const d=o.match(Go)?Fn(n):null;if(!d){_t(t,l,null);return}d.prepare(n,o,l).forEach(u=>{sl(n,u,f=>{_t(t,u.icons,f)})})}))}const cl=(t,e)=>{const n=tl(t,!0,qo()),o=Kr(n);if(!o.pending.length){let d=!0;return e&&setTimeout(()=>{d&&e(o.loaded,o.missing,o.pending,ri)}),()=>{d=!1}}const i=Object.create(null),s=[];let l,a;return o.pending.forEach(d=>{const{provider:c,prefix:u}=d;if(u===a&&c===l)return;l=c,a=u,s.push(it(c,u));const f=i[c]||(i[c]=Object.create(null));f[u]||(f[u]=[])}),o.pending.forEach(d=>{const{provider:c,prefix:u,name:f}=d,h=it(c,u),g=h.pendingIcons||(h.pendingIcons=new Set);g.has(f)||(g.add(f),i[c][u].push(f))}),s.forEach(d=>{const c=i[d.provider][d.prefix];c.length&&al(d,c)}),e?el(e,o,s):ri};function dl(t,e){const n={...t};for(const o in e){const i=e[o],s=typeof i;o in Jo?(i===null||i&&(s==="string"||s==="number"))&&(n[o]=i):s===typeof n[o]&&(n[o]=o==="rotate"?i%4:i)}return n}const ul=/[\s,]+/;function fl(t,e){e.split(ul).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function hl(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function o(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(t);return isNaN(i)?0:o(i)}else if(n!==t){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let s=parseFloat(t.slice(0,t.length-n.length));return isNaN(s)?0:(s=s/i,s%1===0?o(s):0)}}return e}function gl(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const o in e)n+=" "+o+'="'+e[o]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function pl(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ml(t){return"data:image/svg+xml,"+pl(t)}function yl(t){return'url("'+ml(t)+'")'}const ai={...ei,inline:!1},vl={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},wl={display:"inline-block"},Xn={backgroundColor:"currentColor"},ci={backgroundColor:"transparent"},di={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},ui={webkitMask:Xn,mask:Xn,background:ci};for(const t in ui){const e=ui[t];for(const n in di)e[t+n]=di[n]}const Zt={};["horizontal","vertical"].forEach(t=>{const e=t.slice(0,1)+"Flip";Zt[t+"-flip"]=e,Zt[t.slice(0,1)+"-flip"]=e,Zt[t+"Flip"]=e});function fi(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const hi=(t,e)=>{const n=dl(ai,e),o={...vl},i=e.mode||"svg",s={},l=e.style,a=typeof l=="object"&&!(l instanceof Array)?l:{};for(let m in e){const v=e[m];if(v!==void 0)switch(m){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":n[m]=v===!0||v==="true"||v===1;break;case"flip":typeof v=="string"&&fl(n,v);break;case"color":s.color=v;break;case"rotate":typeof v=="string"?n[m]=hl(v):typeof v=="number"&&(n[m]=v);break;case"ariaHidden":case"aria-hidden":v!==!0&&v!=="true"&&delete o["aria-hidden"];break;default:{const E=Zt[m];E?(v===!0||v==="true"||v===1)&&(n[E]=!0):ai[m]===void 0&&(o[m]=v)}}}const d=Hr(t,n),c=d.attributes;if(n.inline&&(s.verticalAlign="-0.125em"),i==="svg"){o.style={...s,...a},Object.assign(o,c);let m=0,v=e.id;return typeof v=="string"&&(v=v.replace(/-/g,"_")),o.innerHTML=Gr(d.body,v?()=>v+"ID"+m++:"iconifyVue"),r.h("svg",o)}const{body:u,width:f,height:h}=t,g=i==="mask"||(i==="bg"?!1:u.indexOf("currentColor")!==-1),p=gl(u,{...c,width:f+"",height:h+""});return o.style={...s,"--svg":yl(p),width:fi(c.width),height:fi(c.height),...wl,...g?Xn:ci,...a},r.h("span",o)};if(qo(!0),Wr("",qr),typeof document<"u"&&typeof window<"u"){const t=window;if(t.IconifyPreload!==void 0){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(o=>{try{(typeof o!="object"||o===null||o instanceof Array||typeof o.icons!="object"||typeof o.prefix!="string"||!Ir(o))&&console.error(n)}catch{console.error(n)}})}if(t.IconifyProviders!==void 0){const e=t.IconifyProviders;if(typeof e=="object"&&e!==null)for(let n in e){const o="IconifyProviders["+n+"] is invalid.";try{const i=e[n];if(typeof i!="object"||!i||i.resources===void 0)continue;Yr(n,i)||console.error(o)}catch{console.error(o)}}}}const _l={...yt,body:""},gi=r.defineComponent((t,{emit:e})=>{const n=r.ref(null);function o(){n.value&&(n.value.abort?.(),n.value=null)}const i=r.ref(!!t.ssr),s=r.ref(""),l=r.shallowRef(null);function a(){const c=t.icon;if(typeof c=="object"&&c!==null&&typeof c.body=="string")return s.value="",{data:c};let u;if(typeof c!="string"||(u=Yt(c,!1,!0))===null)return null;let f=Ko(u);if(!f){const p=n.value;return(!p||p.name!==c)&&(f===null?n.value={name:c}:n.value={name:c,abort:cl([u],d)}),null}o(),s.value!==c&&(s.value=c,r.nextTick(()=>{e("load",c)}));const h=t.customise;if(h){f=Object.assign({},f);const p=h(f.body,u.name,u.prefix,u.provider);typeof p=="string"&&(f.body=p)}const g=["iconify"];return u.prefix!==""&&g.push("iconify--"+u.prefix),u.provider!==""&&g.push("iconify--"+u.provider),{data:f,classes:g}}function d(){const c=a();c?c.data!==l.value?.data&&(l.value=c):l.value=null}return i.value?d():r.onMounted(()=>{i.value=!0,d()}),r.watch(()=>t.icon,d),r.onUnmounted(o),()=>{const c=l.value;if(!c)return hi(_l,t);let u=t;return c.classes&&(u={...t,class:c.classes.join(" ")}),hi({...yt,...c.data},u)}},{props:["icon","mode","ssr","width","height","style","color","inline","rotate","hFlip","horizontalFlip","vFlip","verticalFlip","flip","id","ariaHidden","customise","title"],emits:["load"]}),bt=r.defineComponent({name:"JIcon",inheritAttrs:!1,__name:"icon",props:{icon:{},size:{default:16},color:{default:void 0},rotate:{default:void 0},isDiv:{type:Boolean,default:!0}},setup(t){const e=t,n=r.computed(()=>{const i=e.icon;if(i.indexOf(":")===-1)return Qo(`jcode:${e.icon}`)==null,`jcode:${e.icon}`;const l=`jcode:${i.split(":")[1]}`;return Qo(l)!=null?l:i}),o=r.computed(()=>({size:e.size,color:e.color,icon:n.value}));return(i,s)=>t.isDiv?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0},i.$attrs,{class:"j-icon jicon",style:{height:`${t.size}px`}}),[r.createVNode(r.unref(gi),r.mergeProps(o.value,{height:`${t.size}px`,width:`${t.size}px`,mode:"svg",style:`transform:rotate(${t.rotate||0}deg)`}),null,16,["height","width","style"])],16)):(r.openBlock(),r.createElementBlock("span",r.mergeProps({key:1},i.$attrs,{class:"jicon"}),[r.createVNode(r.unref(gi),r.mergeProps(o.value,{height:`${t.size}px`,width:`${t.size}px`,mode:"svg",style:`transform:rotate(${t.rotate||0}deg)`}),null,16,["height","width","style"])],16))}}),bl=["disabled"],xl={key:2},st=Er(r.defineComponent({name:"JButton",__name:"button",props:{type:{type:String,default:"default"},size:{type:String,default:"default"},shape:{type:String,default:"default"},ghost:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},danger:{type:Boolean,default:!1},block:{type:Boolean,default:!1},loading:{type:[Boolean,Object],default:()=>!1},icon:{type:String,default:""},href:{type:String,default:""},target:{type:String,default:"_self"},label:{type:String,default:""},notLabel:{type:Boolean,default:!1},compact:Boolean,lastCompactItem:Boolean,firstCompactItem:Boolean},emits:["click"],setup(t,{expose:e,emit:n}){const o=t,i=n,s=h=>{!u.value&&!o.disabled&&(i("click",h),o.href&&window.open(o.href,o.target?o.target:"_self"))},l=r.shallowRef(null),a=()=>{l.value?.focus()},d=()=>{l.value?.blur()},c=r.computed(()=>o.notLabel||!o.label),u=r.ref(!1);r.watch(()=>o.loading,h=>{if(typeof h=="boolean")u.value=h;else if(Cr(h?.delay))u.value=!1;else{const g=setTimeout(()=>{u.value=!0},h.delay);return()=>clearTimeout(g)}},{immediate:!0});const f=r.computed(()=>o.label||"");return e({focus:a,blur:d}),(h,g)=>(r.openBlock(),r.createElementBlock("button",{ref_key:"buttonNodeRef",ref:l,type:"button",class:r.normalizeClass(["j-button",{"j-button-primary":t.type=="primary","j-button-default":t.type=="default","j-button-dashed":t.type=="dashed","j-button-link":t.type=="link","j-button-text":t.type=="text","j-button-ghost":t.ghost==!0,"j-button-danger":t.danger==!0,"j-button-lg":t.size=="large","j-button-sm":t.size=="small","j-button-circle":t.shape=="circle","j-button-round":t.shape=="round","j-button-block":t.block==!0,"j-button-loading":u.value==!0,"j-button-icon-only":c.value==!0,"j-button-compact":t.compact==!0,"j-button-last-compact-item":t.lastCompactItem==!0,"j-button-first-compact-item":t.firstCompactItem==!0}]),disabled:t.disabled,onClick:r.withModifiers(s,["stop"])},[u.value?(r.openBlock(),r.createBlock(bt,{key:0,icon:"mdi:loading",size:t.size=="large"?14:12,class:"loading-spin j-button-loading-icon"},null,8,["size"])):r.createCommentVNode("",!0),t.icon?(r.openBlock(),r.createBlock(bt,{key:1,icon:t.icon},null,8,["icon"])):r.createCommentVNode("",!0),t.notLabel?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",xl,r.toDisplayString(f.value),1)),r.renderSlot(h.$slots,"iconAfter")],10,bl))}})),El={class:"d-drag-btns-pname"},Cl={key:0,class:"d-drag-mask"},jn=r.defineComponent({name:"DDrag",__name:"drag",props:{componentData:{default:()=>({})},isContainer:{type:Boolean,default:!1}},setup(t){const e=t,n=r.ref(),{onMouseenter:o,onMouseleave:i,activeComponent:s,handleComponentClick:l,deleteComponentByClick:a,copyComponent:d,getParentComponents:c,isHover:u,isSelect:f,isTopActive:h,isBottomActive:g,isBottomToolBar:p}=Lo(n,e.componentData,"component"),{onContextmenu:m,onMousedown:v,moveActive:E}=Fo(e.componentData,!1);return(M,y)=>{const C=r.resolveComponent("el-space");return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["d-drag-component",{selected:r.unref(f),hovered:r.unref(u),isBottomToolBar:r.unref(p),active:r.unref(E),isTopActive:r.unref(h),isBottomActive:r.unref(g)}])},[y[11]||(y[11]=r.createElementVNode("div",{class:"d-drag-line"},null,-1)),r.createElementVNode("div",{class:"d-drag-btns",onMouseenter:y[4]||(y[4]=(...$)=>r.unref(o)&&r.unref(o)(...$)),onMouseleave:y[5]||(y[5]=(...$)=>r.unref(i)&&r.unref(i)(...$))},[r.createVNode(C,{size:4},{default:r.withCtx(()=>[r.createElementVNode("div",{class:"d-drag-btns-names",onClick:r.withModifiers(()=>{},["stop"])},[r.createVNode(r.unref(st),{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"]),r.createElementVNode("div",El,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(c)(t.componentData.containerId),$=>(r.openBlock(),r.createElementBlock("div",{key:$.id},[r.createVNode(r.unref(st),{class:"d-drag-btn",type:"primary",size:"small",label:$.name,onClick:O=>r.unref(l)($.id)},null,8,["label","onClick"])]))),128))])]),r.createVNode(r.unref(st),{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:content-copy",onClick:y[0]||(y[0]=r.withModifiers($=>r.unref(d)(t.componentData.id),["stop"]))}),r.createElementVNode("div",{onContextmenu:y[1]||(y[1]=r.withModifiers((...$)=>r.unref(m)&&r.unref(m)(...$),["stop"])),onMousedown:y[2]||(y[2]=r.withModifiers((...$)=>r.unref(v)&&r.unref(v)(...$),["stop"])),style:{display:"flex"}},[r.createVNode(r.unref(st),{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:drag"})],32),r.createVNode(r.unref(st),{class:"d-drag-btn",danger:"",type:"primary",size:"small",icon:"mdi:delete",onClick:y[3]||(y[3]=r.withModifiers($=>r.unref(a)(t.componentData.id),["stop"]))})]),_:1})],32),r.createElementVNode("div",{ref_key:"refDrag",ref:n,class:"d-drag-body",onClick:y[6]||(y[6]=r.withModifiers((...$)=>r.unref(s)&&r.unref(s)(...$),["stop"])),onContextmenu:y[7]||(y[7]=r.withModifiers((...$)=>r.unref(m)&&r.unref(m)(...$),["stop"])),onMousedown:y[8]||(y[8]=r.withModifiers((...$)=>r.unref(v)&&r.unref(v)(...$),["stop"])),onMouseenter:y[9]||(y[9]=(...$)=>r.unref(o)&&r.unref(o)(...$)),onMouseleave:y[10]||(y[10]=(...$)=>r.unref(i)&&r.unref(i)(...$))},[r.renderSlot(M.$slots,"default"),t.isContainer?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",Cl))],544)],2)}}}),Zn=r.defineComponent({name:"DDragTool",__name:"tool",props:{config:{}},setup(t){const e=t,{onContextmenu:n,onMousedown:o,onClick:i}=Fo(e.config??{name:"",id:""},!0);return(s,l)=>(r.openBlock(),r.createElementBlock("div",{class:"d-drag-tool",onClick:l[0]||(l[0]=r.withModifiers((...a)=>r.unref(i)&&r.unref(i)(...a),["stop"])),onContextmenu:l[1]||(l[1]=r.withModifiers((...a)=>r.unref(n)&&r.unref(n)(...a),["stop"])),onMousedown:l[2]||(l[2]=r.withModifiers((...a)=>r.unref(o)&&r.unref(o)(...a),["stop"]))},[r.renderSlot(s.$slots,"default")],32))}}),Nl={key:0,class:"d-drag-line"},kl={key:1,class:"d-drag-btns"},qn=r.defineComponent({name:"DDragContainer",__name:"container",props:{componentData:{default:()=>({})},isComponentContainer:{type:Boolean,default:!0},groupId:{default:void 0}},setup(t){const e=t,n=r.ref(),o=r.computed(()=>e.componentData?.children||[]),{onMouseenter:i,onMouseleave:s,activeComponent:l,isHover:a,isSelect:d,isToContainer:c,isMoveingInTopLevel:u,isTopActive:f,isBottomActive:h}=Lo(n,e.componentData,"container",o,e.isComponentContainer,e.groupId),g=r.computed(()=>!!(o.value.findIndex(p=>p.groupId===e.groupId)===-1&&c.value));return(p,m)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"refDrag",ref:n,class:r.normalizeClass(["d-drag-container",{selected:r.unref(d)&&!t.isComponentContainer,hovered:r.unref(a)&&!t.isComponentContainer,isTopLevel:t.componentData.level===0,active:g.value,isMoveingInTopLevel:r.unref(u),isTopActive:r.unref(f),isBottomActive:r.unref(h)}])},[t.isComponentContainer?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",Nl)),t.isComponentContainer?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",kl,[r.createElementVNode("div",{class:"d-drag-btns-names",onClick:r.withModifiers(()=>{},["stop"])},[r.createVNode(r.unref(st),{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"])])])),r.createElementVNode("div",{class:"d-drag-body",onClick:m[0]||(m[0]=r.withModifiers((...v)=>r.unref(l)&&r.unref(l)(...v),["stop"])),onMouseenter:m[1]||(m[1]=(...v)=>r.unref(i)&&r.unref(i)(...v)),onMouseleave:m[2]||(m[2]=(...v)=>r.unref(s)&&r.unref(s)(...v))},[r.renderSlot(p.$slots,"default")],32)],2))}}),Kn=r.defineComponent({name:"DDragFormList",__name:"dragFormList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=r.inject("dui-design-provide",{});return(n,o)=>{const i=r.resolveComponent("el-col");return r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(t.componentList,s=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:s.id},[s.type!="pkey"?(r.openBlock(),r.createBlock(i,{key:0,span:s.config.span||24},{default:r.withCtx(()=>[r.createVNode(jn,{"is-container":s.dragType!=="component","component-data":s},{default:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(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"])):r.createCommentVNode("",!0)],64))),128)}}}),Qn=r.defineComponent({name:"DDragIndexList",__name:"dragIndexList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=r.inject("dui-design-provide",{}),n=o=>{if(o.flexWidth)return{width:o.flexWidth+"%"}};return(o,i)=>(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(t.componentList,s=>(r.openBlock(),r.createBlock(jn,{key:s.id,style:r.normalizeStyle(n(s.config)),"is-container":s.dragType!=="component","component-data":s},{default:r.withCtx(()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(r.unref(e)),{"component-data":s,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["style","is-container","component-data"]))),128))}}),pi=mt(jn,[Zn,qn,Kn,Qn]);function xt(t){return r.getCurrentScope()?(r.onScopeDispose(t),!0):!1}function Pe(t){return typeof t=="function"?t():r.unref(t)}const Sl=typeof window<"u"&&typeof document<"u",Ml=t=>typeof t<"u",Dl=Object.prototype.toString,zl=t=>Dl.call(t)==="[object Object]",Tl=()=>{};function Il(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}const mi=t=>t();function Bl(t=mi){const e=r.ref(!0);function n(){e.value=!1}function o(){e.value=!0}const i=(...s)=>{e.value&&t(...s)};return{isActive:r.readonly(e),pause:n,resume:o,eventFilter:i}}function yi(t,e=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(e?()=>i(n):o,t)})}function Rl(t,e,n={}){const{eventFilter:o=mi,...i}=n;return r.watch(t,Il(o,e),i)}function rt(t,e,n={}){const{eventFilter:o,...i}=n,{eventFilter:s,pause:l,resume:a,isActive:d}=Bl(o);return{stop:Rl(t,e,{...i,eventFilter:s}),pause:l,resume:a,isActive:d}}function Al(t,e={}){if(!r.isRef(t))return r.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const o in t.value)n[o]=r.customRef(()=>({get(){return t.value[o]},set(i){var s;if((s=Pe(e.replaceRef))!=null?s:!0)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 Jn(t,e=!1){function n(f,{flush:h="sync",deep:g=!1,timeout:p,throwOnTimeout:m}={}){let v=null;const M=[new Promise(y=>{v=r.watch(t,C=>{f(C)!==e&&(v?.(),y(C))},{flush:h,deep:g,immediate:!0})})];return p!=null&&M.push(yi(p,m).then(()=>Pe(t)).finally(()=>v?.())),Promise.race(M)}function o(f,h){if(!r.isRef(f))return n(C=>C===f,h);const{flush:g="sync",deep:p=!1,timeout:m,throwOnTimeout:v}=h??{};let E=null;const y=[new Promise(C=>{E=r.watch([t,f],([$,O])=>{e!==($===O)&&(E?.(),C($))},{flush:g,deep:p,immediate:!0})})];return m!=null&&y.push(yi(m,v).then(()=>Pe(t)).finally(()=>(E?.(),Pe(t)))),Promise.race(y)}function i(f){return n(h=>!!h,f)}function s(f){return o(null,f)}function l(f){return o(void 0,f)}function a(f){return n(Number.isNaN,f)}function d(f,h){return n(g=>{const p=Array.from(g);return p.includes(f)||p.includes(Pe(f))},h)}function c(f){return u(1,f)}function u(f=1,h){let g=-1;return n(()=>(g+=1,g>=f),h)}return Array.isArray(Pe(t))?{toMatch:n,toContains:d,changed:c,changedTimes:u,get not(){return Jn(t,!e)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:s,toBeNaN:a,toBeUndefined:l,changed:c,changedTimes:u,get not(){return Jn(t,!e)}}}function eo(t){return Jn(t)}function $l(t){var e;const n=Pe(t);return(e=n?.$el)!=null?e:n}const vi=Sl?window:void 0;function wi(...t){let e,n,o,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,o,i]=t,e=vi):[e,n,o,i]=t,!e)return Tl;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const s=[],l=()=>{s.forEach(u=>u()),s.length=0},a=(u,f,h,g)=>(u.addEventListener(f,h,g),()=>u.removeEventListener(f,h,g)),d=r.watch(()=>[$l(e),Pe(i)],([u,f])=>{if(l(),!u)return;const h=zl(f)?{...f}:f;s.push(...n.flatMap(g=>o.map(p=>a(u,g,p,h))))},{immediate:!0,flush:"post"}),c=()=>{d(),l()};return xt(c),c}function Pl(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function _i(...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=vi,eventName:s="keydown",passive:l=!1,dedupe:a=!1}=o,d=Pl(e);return wi(i,s,u=>{u.repeat&&Pe(a)||d(u)&&n(u)},l)}function Ol(t){return JSON.parse(JSON.stringify(t))}function to(t,e,n,o={}){var i,s,l;const{clone:a=!1,passive:d=!1,eventName:c,deep:u=!1,defaultValue:f,shouldEmit:h}=o,g=r.getCurrentInstance(),p=n||g?.emit||((i=g?.$emit)==null?void 0:i.bind(g))||((l=(s=g?.proxy)==null?void 0:s.$emit)==null?void 0:l.bind(g?.proxy));let m=c;e||(e="modelValue"),m=m||`update:${e.toString()}`;const v=y=>a?typeof a=="function"?a(y):Ol(y):y,E=()=>Ml(t[e])?v(t[e]):f,M=y=>{h?h(y)&&p(m,y):p(m,y)};if(d){const y=E(),C=r.ref(y);let $=!1;return r.watch(()=>t[e],O=>{$||($=!0,C.value=v(O),r.nextTick(()=>$=!1))}),r.watch(C,O=>{!$&&(O!==t[e]||u)&&M(O)},{deep:u}),C}else return r.computed({get(){return E()},set(y){M(y)}})}var Hl={value:()=>{}};function qt(){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 Kt(n)}function Kt(t){this._=t}function Vl(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}})}Kt.prototype=qt.prototype={constructor:Kt,on:function(t,e){var n=this._,o=Vl(t+"",n),i,s=-1,l=o.length;if(arguments.length<2){for(;++s<l;)if((i=(t=o[s]).type)&&(i=Ll(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<l;)if(i=(t=o[s]).type)n[i]=bi(n[i],t.name,e);else if(e==null)for(i in n)n[i]=bi(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 Kt(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 Ll(t,e){for(var n=0,o=t.length,i;n<o;++n)if((i=t[n]).name===e)return i.value}function bi(t,e,n){for(var o=0,i=t.length;o<i;++o)if(t[o].name===e){t[o]=Hl,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var no="http://www.w3.org/1999/xhtml";const xi={svg:"http://www.w3.org/2000/svg",xhtml:no,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Qt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),xi.hasOwnProperty(e)?{space:xi[e],local:t}:t}function Fl(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===no&&e.documentElement.namespaceURI===no?e.createElement(t):e.createElementNS(n,t)}}function Gl(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ei(t){var e=Qt(t);return(e.local?Gl:Fl)(e)}function Wl(){}function oo(t){return t==null?Wl:function(){return this.querySelector(t)}}function Yl(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],l=s.length,a=o[i]=new Array(l),d,c,u=0;u<l;++u)(d=s[u])&&(c=t.call(d,d.__data__,u,s))&&("__data__"in d&&(c.__data__=d.__data__),a[u]=c);return new Ce(o,this._parents)}function Ul(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Xl(){return[]}function Ci(t){return t==null?Xl:function(){return this.querySelectorAll(t)}}function jl(t){return function(){return Ul(t.apply(this,arguments))}}function Zl(t){typeof t=="function"?t=jl(t):t=Ci(t);for(var e=this._groups,n=e.length,o=[],i=[],s=0;s<n;++s)for(var l=e[s],a=l.length,d,c=0;c<a;++c)(d=l[c])&&(o.push(t.call(d,d.__data__,c,l)),i.push(d));return new Ce(o,i)}function Ni(t){return function(){return this.matches(t)}}function ki(t){return function(e){return e.matches(t)}}var ql=Array.prototype.find;function Kl(t){return function(){return ql.call(this.children,t)}}function Ql(){return this.firstElementChild}function Jl(t){return this.select(t==null?Ql:Kl(typeof t=="function"?t:ki(t)))}var ea=Array.prototype.filter;function ta(){return Array.from(this.children)}function na(t){return function(){return ea.call(this.children,t)}}function oa(t){return this.selectAll(t==null?ta:na(typeof t=="function"?t:ki(t)))}function ia(t){typeof t!="function"&&(t=Ni(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var s=e[i],l=s.length,a=o[i]=[],d,c=0;c<l;++c)(d=s[c])&&t.call(d,d.__data__,c,s)&&a.push(d);return new Ce(o,this._parents)}function Si(t){return new Array(t.length)}function sa(){return new Ce(this._enter||this._groups.map(Si),this._parents)}function Jt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Jt.prototype={constructor:Jt,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 ra(t){return function(){return t}}function la(t,e,n,o,i,s){for(var l=0,a,d=e.length,c=s.length;l<c;++l)(a=e[l])?(a.__data__=s[l],o[l]=a):n[l]=new Jt(t,s[l]);for(;l<d;++l)(a=e[l])&&(i[l]=a)}function aa(t,e,n,o,i,s,l){var a,d,c=new Map,u=e.length,f=s.length,h=new Array(u),g;for(a=0;a<u;++a)(d=e[a])&&(h[a]=g=l.call(d,d.__data__,a,e)+"",c.has(g)?i[a]=d:c.set(g,d));for(a=0;a<f;++a)g=l.call(t,s[a],a,s)+"",(d=c.get(g))?(o[a]=d,d.__data__=s[a],c.delete(g)):n[a]=new Jt(t,s[a]);for(a=0;a<u;++a)(d=e[a])&&c.get(h[a])===d&&(i[a]=d)}function ca(t){return t.__data__}function da(t,e){if(!arguments.length)return Array.from(this,ca);var n=e?aa:la,o=this._parents,i=this._groups;typeof t!="function"&&(t=ra(t));for(var s=i.length,l=new Array(s),a=new Array(s),d=new Array(s),c=0;c<s;++c){var u=o[c],f=i[c],h=f.length,g=ua(t.call(u,u&&u.__data__,c,o)),p=g.length,m=a[c]=new Array(p),v=l[c]=new Array(p),E=d[c]=new Array(h);n(u,f,m,v,E,g,e);for(var M=0,y=0,C,$;M<p;++M)if(C=m[M]){for(M>=y&&(y=M+1);!($=v[y])&&++y<p;);C._next=$||null}}return l=new Ce(l,o),l._enter=a,l._exit=d,l}function ua(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function fa(){return new Ce(this._exit||this._groups.map(Si),this._parents)}function ha(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 ga(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,i=n.length,s=o.length,l=Math.min(i,s),a=new Array(i),d=0;d<l;++d)for(var c=n[d],u=o[d],f=c.length,h=a[d]=new Array(f),g,p=0;p<f;++p)(g=c[p]||u[p])&&(h[p]=g);for(;d<i;++d)a[d]=n[d];return new Ce(a,this._parents)}function pa(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],i=o.length-1,s=o[i],l;--i>=0;)(l=o[i])&&(s&&l.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(l,s),s=l);return this}function ma(t){t||(t=ya);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,o=n.length,i=new Array(o),s=0;s<o;++s){for(var l=n[s],a=l.length,d=i[s]=new Array(a),c,u=0;u<a;++u)(c=l[u])&&(d[u]=c);d.sort(e)}return new Ce(i,this._parents).order()}function ya(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function va(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function wa(){return Array.from(this)}function _a(){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 l=o[i];if(l)return l}return null}function ba(){let t=0;for(const e of this)++t;return t}function xa(){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,l=i.length,a;s<l;++s)(a=i[s])&&t.call(a,a.__data__,s,i);return this}function Ca(t){return function(){this.removeAttribute(t)}}function Na(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ka(t,e){return function(){this.setAttribute(t,e)}}function Sa(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ma(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Da(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 za(t,e){var n=Qt(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:Ca:typeof e=="function"?n.local?Da:Ma:n.local?Sa:ka)(n,e))}function Mi(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Ta(t){return function(){this.style.removeProperty(t)}}function Ia(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ba(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Ra(t,e,n){return arguments.length>1?this.each((e==null?Ta:typeof e=="function"?Ba:Ia)(t,e,n??"")):lt(this.node(),t)}function lt(t,e){return t.style.getPropertyValue(e)||Mi(t).getComputedStyle(t,null).getPropertyValue(e)}function Aa(t){return function(){delete this[t]}}function $a(t,e){return function(){this[t]=e}}function Pa(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Oa(t,e){return arguments.length>1?this.each((e==null?Aa:typeof e=="function"?Pa:$a)(t,e)):this.node()[t]}function Di(t){return t.trim().split(/^|\s+/)}function io(t){return t.classList||new zi(t)}function zi(t){this._node=t,this._names=Di(t.getAttribute("class")||"")}zi.prototype={add:function(t){var e=this._names.indexOf(t);e<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 Ti(t,e){for(var n=io(t),o=-1,i=e.length;++o<i;)n.add(e[o])}function Ii(t,e){for(var n=io(t),o=-1,i=e.length;++o<i;)n.remove(e[o])}function Ha(t){return function(){Ti(this,t)}}function Va(t){return function(){Ii(this,t)}}function La(t,e){return function(){(e.apply(this,arguments)?Ti:Ii)(this,t)}}function Fa(t,e){var n=Di(t+"");if(arguments.length<2){for(var o=io(this.node()),i=-1,s=n.length;++i<s;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?La:e?Ha:Va)(n,e))}function Ga(){this.textContent=""}function Wa(t){return function(){this.textContent=t}}function Ya(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ua(t){return arguments.length?this.each(t==null?Ga:(typeof t=="function"?Ya:Wa)(t)):this.node().textContent}function Xa(){this.innerHTML=""}function ja(t){return function(){this.innerHTML=t}}function Za(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function qa(t){return arguments.length?this.each(t==null?Xa:(typeof t=="function"?Za:ja)(t)):this.node().innerHTML}function Ka(){this.nextSibling&&this.parentNode.appendChild(this)}function Qa(){return this.each(Ka)}function Ja(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ec(){return this.each(Ja)}function tc(t){var e=typeof t=="function"?t:Ei(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function nc(){return null}function oc(t,e){var n=typeof t=="function"?t:Ei(t),o=e==null?nc:typeof e=="function"?e:oo(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ic(){var t=this.parentNode;t&&t.removeChild(this)}function sc(){return this.each(ic)}function rc(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function lc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ac(t){return this.select(t?lc:rc)}function cc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function dc(t){return function(e){t.call(this,e,this.__data__)}}function uc(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 fc(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 hc(t,e,n){return function(){var o=this.__on,i,s=dc(e);if(o){for(var l=0,a=o.length;l<a;++l)if((i=o[l]).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 gc(t,e,n){var o=uc(t+""),i,s=o.length,l;if(arguments.length<2){var a=this.node().__on;if(a){for(var d=0,c=a.length,u;d<c;++d)for(i=0,u=a[d];i<s;++i)if((l=o[i]).type===u.type&&l.name===u.name)return u.value}return}for(a=e?hc:fc,i=0;i<s;++i)this.each(a(o[i],e,n));return this}function Bi(t,e,n){var o=Mi(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 pc(t,e){return function(){return Bi(this,t,e)}}function mc(t,e){return function(){return Bi(this,t,e.apply(this,arguments))}}function yc(t,e){return this.each((typeof e=="function"?mc:pc)(t,e))}function*vc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,s=o.length,l;i<s;++i)(l=o[i])&&(yield l)}var Ri=[null];function Ce(t,e){this._groups=t,this._parents=e}function Et(){return new Ce([[document.documentElement]],Ri)}function wc(){return this}Ce.prototype=Et.prototype={constructor:Ce,select:Yl,selectAll:Zl,selectChild:Jl,selectChildren:oa,filter:ia,data:da,enter:sa,exit:fa,join:ha,merge:ga,selection:wc,order:pa,sort:ma,call:va,nodes:wa,node:_a,size:ba,empty:xa,each:Ea,attr:za,style:Ra,property:Oa,classed:Fa,text:Ua,html:qa,raise:Qa,lower:ec,append:tc,insert:oc,remove:sc,clone:ac,datum:cc,on:gc,dispatch:yc,[Symbol.iterator]:vc};function Se(t){return typeof t=="string"?new Ce([[document.querySelector(t)]],[document.documentElement]):new Ce([[t]],Ri)}function _c(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Te(t,e){if(t=_c(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]}const bc={passive:!1},Ct={capture:!0,passive:!1};function so(t){t.stopImmediatePropagation()}function at(t){t.preventDefault(),t.stopImmediatePropagation()}function Ai(t){var e=t.document.documentElement,n=Se(t).on("dragstart.drag",at,Ct);"onselectstart"in e?n.on("selectstart.drag",at,Ct):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function $i(t,e){var n=t.document.documentElement,o=Se(t).on("dragstart.drag",null);e&&(o.on("click.drag",at,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)}const en=t=>()=>t;function ro(t,{sourceEvent:e,subject:n,target:o,identifier:i,active:s,x:l,y:a,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:l,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}ro.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function xc(t){return!t.ctrlKey&&!t.button}function Ec(){return this.parentNode}function Cc(t,e){return e??{x:t.x,y:t.y}}function Nc(){return navigator.maxTouchPoints||"ontouchstart"in this}function kc(){var t=xc,e=Ec,n=Cc,o=Nc,i={},s=qt("start","drag","end"),l=0,a,d,c,u,f=0;function h(C){C.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",E,bc).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(C,$){if(!(u||!t.call(this,C,$))){var O=y(this,e.call(this,C,$),C,$,"mouse");O&&(Se(C.view).on("mousemove.drag",p,Ct).on("mouseup.drag",m,Ct),Ai(C.view),so(C),c=!1,a=C.clientX,d=C.clientY,O("start",C))}}function p(C){if(at(C),!c){var $=C.clientX-a,O=C.clientY-d;c=$*$+O*O>f}i.mouse("drag",C)}function m(C){Se(C.view).on("mousemove.drag mouseup.drag",null),$i(C.view,c),at(C),i.mouse("end",C)}function v(C,$){if(t.call(this,C,$)){var O=C.changedTouches,L=e.call(this,C,$),j=O.length,W,G;for(W=0;W<j;++W)(G=y(this,L,C,$,O[W].identifier,O[W]))&&(so(C),G("start",C,O[W]))}}function E(C){var $=C.changedTouches,O=$.length,L,j;for(L=0;L<O;++L)(j=i[$[L].identifier])&&(at(C),j("drag",C,$[L]))}function M(C){var $=C.changedTouches,O=$.length,L,j;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),L=0;L<O;++L)(j=i[$[L].identifier])&&(so(C),j("end",C,$[L]))}function y(C,$,O,L,j,W){var G=s.copy(),F=Te(W||O,$),N,H,_;if((_=n.call(C,new ro("beforestart",{sourceEvent:O,target:h,identifier:j,active:l,x:F[0],y:F[1],dx:0,dy:0,dispatch:G}),L))!=null)return N=_.x-F[0]||0,H=_.y-F[1]||0,function A(S,R,V){var T=F,I;switch(S){case"start":i[j]=A,I=l++;break;case"end":delete i[j],--l;case"drag":F=Te(V||R,$),I=l;break}G.call(S,C,new ro(S,{sourceEvent:R,subject:_,target:h,identifier:j,active:I,x:F[0]+N,y:F[1]+H,dx:F[0]-T[0],dy:F[1]-T[1],dispatch:G}),L)}}return h.filter=function(C){return arguments.length?(t=typeof C=="function"?C:en(!!C),h):t},h.container=function(C){return arguments.length?(e=typeof C=="function"?C:en(C),h):e},h.subject=function(C){return arguments.length?(n=typeof C=="function"?C:en(C),h):n},h.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:en(!!C),h):o},h.on=function(){var C=s.on.apply(s,arguments);return C===s?h:C},h.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,h):Math.sqrt(f)},h}function lo(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Pi(t,e){var n=Object.create(t.prototype);for(var o in e)n[o]=e[o];return n}function Nt(){}var kt=.7,tn=1/kt,ct="\\s*([+-]?\\d+)\\s*",St="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ie="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Sc=/^#([0-9a-f]{3,8})$/,Mc=new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`),Dc=new RegExp(`^rgb\\(${Ie},${Ie},${Ie}\\)$`),zc=new RegExp(`^rgba\\(${ct},${ct},${ct},${St}\\)$`),Tc=new RegExp(`^rgba\\(${Ie},${Ie},${Ie},${St}\\)$`),Ic=new RegExp(`^hsl\\(${St},${Ie},${Ie}\\)$`),Bc=new RegExp(`^hsla\\(${St},${Ie},${Ie},${St}\\)$`),Oi={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};lo(Nt,qe,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Hi,formatHex:Hi,formatHex8:Rc,formatHsl:Ac,formatRgb:Vi,toString:Vi});function Hi(){return this.rgb().formatHex()}function Rc(){return this.rgb().formatHex8()}function Ac(){return Yi(this).formatHsl()}function Vi(){return this.rgb().formatRgb()}function qe(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Sc.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Li(e):n===3?new xe(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?nn(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?nn(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=Mc.exec(t))?new xe(e[1],e[2],e[3],1):(e=Dc.exec(t))?new xe(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=zc.exec(t))?nn(e[1],e[2],e[3],e[4]):(e=Tc.exec(t))?nn(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Ic.exec(t))?Wi(e[1],e[2]/100,e[3]/100,1):(e=Bc.exec(t))?Wi(e[1],e[2]/100,e[3]/100,e[4]):Oi.hasOwnProperty(t)?Li(Oi[t]):t==="transparent"?new xe(NaN,NaN,NaN,0):null}function Li(t){return new xe(t>>16&255,t>>8&255,t&255,1)}function nn(t,e,n,o){return o<=0&&(t=e=n=NaN),new xe(t,e,n,o)}function $c(t){return t instanceof Nt||(t=qe(t)),t?(t=t.rgb(),new xe(t.r,t.g,t.b,t.opacity)):new xe}function ao(t,e,n,o){return arguments.length===1?$c(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}lo(xe,ao,Pi(Nt,{brighter(t){return t=t==null?tn:Math.pow(tn,t),new xe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?kt:Math.pow(kt,t),new xe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new xe(Ke(this.r),Ke(this.g),Ke(this.b),on(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:Fi,formatHex:Fi,formatHex8:Pc,formatRgb:Gi,toString:Gi}));function Fi(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}`}function Pc(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}${Qe((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gi(){const t=on(this.opacity);return`${t===1?"rgb(":"rgba("}${Ke(this.r)}, ${Ke(this.g)}, ${Ke(this.b)}${t===1?")":`, ${t})`}`}function on(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ke(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Qe(t){return t=Ke(t),(t<16?"0":"")+t.toString(16)}function Wi(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 Yi(t){if(t instanceof Me)return new Me(t.h,t.s,t.l,t.opacity);if(t instanceof Nt||(t=qe(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),l=NaN,a=s-i,d=(s+i)/2;return a?(e===s?l=(n-o)/a+(n<o)*6:n===s?l=(o-e)/a+2:l=(e-n)/a+4,a/=d<.5?s+i:2-s-i,l*=60):a=d>0&&d<1?0:l,new Me(l,a,d,t.opacity)}function Oc(t,e,n,o){return arguments.length===1?Yi(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}lo(Me,Oc,Pi(Nt,{brighter(t){return t=t==null?tn:Math.pow(tn,t),new Me(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?kt:Math.pow(kt,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 xe(co(t>=240?t-240:t+120,i,o),co(t,i,o),co(t<120?t+240:t-120,i,o),this.opacity)},clamp(){return new Me(Ui(this.h),sn(this.s),sn(this.l),on(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=on(this.opacity);return`${t===1?"hsl(":"hsla("}${Ui(this.h)}, ${sn(this.s)*100}%, ${sn(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Ui(t){return t=(t||0)%360,t<0?t+360:t}function sn(t){return Math.max(0,Math.min(1,t||0))}function co(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const uo=t=>()=>t;function Hc(t,e){return function(n){return t+n*e}}function Vc(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 Lc(t){return(t=+t)==1?Xi:function(e,n){return n-e?Vc(e,n,t):uo(isNaN(e)?n:e)}}function Xi(t,e){var n=e-t;return n?Hc(t,n):uo(isNaN(t)?e:t)}const rn=(function t(e){var n=Lc(e);function o(i,s){var l=n((i=ao(i)).r,(s=ao(s)).r),a=n(i.g,s.g),d=n(i.b,s.b),c=Xi(i.opacity,s.opacity);return function(u){return i.r=l(u),i.g=a(u),i.b=d(u),i.opacity=c(u),i+""}}return o.gamma=t,o})(1);function Fc(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 Gc(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Wc(t,e){var n=e?e.length:0,o=t?Math.min(n,t.length):0,i=new Array(o),s=new Array(n),l;for(l=0;l<o;++l)i[l]=Mt(t[l],e[l]);for(;l<n;++l)s[l]=e[l];return function(a){for(l=0;l<o;++l)s[l]=i[l](a);return s}}function Yc(t,e){var n=new Date;return t=+t,e=+e,function(o){return n.setTime(t*(1-o)+e*o),n}}function Be(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Uc(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]=Mt(t[i],e[i]):o[i]=e[i];return function(s){for(i in n)o[i]=n[i](s);return o}}var fo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ho=new RegExp(fo.source,"g");function Xc(t){return function(){return t}}function jc(t){return function(e){return t(e)+""}}function ji(t,e){var n=fo.lastIndex=ho.lastIndex=0,o,i,s,l=-1,a=[],d=[];for(t=t+"",e=e+"";(o=fo.exec(t))&&(i=ho.exec(e));)(s=i.index)>n&&(s=e.slice(n,s),a[l]?a[l]+=s:a[++l]=s),(o=o[0])===(i=i[0])?a[l]?a[l]+=i:a[++l]=i:(a[++l]=null,d.push({i:l,x:Be(o,i)})),n=ho.lastIndex;return n<e.length&&(s=e.slice(n),a[l]?a[l]+=s:a[++l]=s),a.length<2?d[0]?jc(d[0].x):Xc(e):(e=d.length,function(c){for(var u=0,f;u<e;++u)a[(f=d[u]).i]=f.x(c);return a.join("")})}function Mt(t,e){var n=typeof e,o;return e==null||n==="boolean"?uo(e):(n==="number"?Be:n==="string"?(o=qe(e))?(e=o,rn):ji:e instanceof qe?rn:e instanceof Date?Yc:Gc(e)?Fc:Array.isArray(e)?Wc:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Uc:Be)(t,e)}var Zi=180/Math.PI,go={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function qi(t,e,n,o,i,s){var l,a,d;return(l=Math.sqrt(t*t+e*e))&&(t/=l,e/=l),(d=t*n+e*o)&&(n-=t*d,o-=e*d),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,d/=a),t*o<e*n&&(t=-t,e=-e,d=-d,l=-l),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Zi,skewX:Math.atan(d)*Zi,scaleX:l,scaleY:a}}var ln;function Zc(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?go:qi(e.a,e.b,e.c,e.d,e.e,e.f)}function qc(t){return t==null||(ln||(ln=document.createElementNS("http://www.w3.org/2000/svg","g")),ln.setAttribute("transform",t),!(t=ln.transform.baseVal.consolidate()))?go:(t=t.matrix,qi(t.a,t.b,t.c,t.d,t.e,t.f))}function Ki(t,e,n,o){function i(c){return c.length?c.pop()+" ":""}function s(c,u,f,h,g,p){if(c!==f||u!==h){var m=g.push("translate(",null,e,null,n);p.push({i:m-4,x:Be(c,f)},{i:m-2,x:Be(u,h)})}else(f||h)&&g.push("translate("+f+e+h+n)}function l(c,u,f,h){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:Be(c,u)})):u&&f.push(i(f)+"rotate("+u+o)}function a(c,u,f,h){c!==u?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:Be(c,u)}):u&&f.push(i(f)+"skewX("+u+o)}function d(c,u,f,h,g,p){if(c!==f||u!==h){var m=g.push(i(g)+"scale(",null,",",null,")");p.push({i:m-4,x:Be(c,f)},{i:m-2,x:Be(u,h)})}else(f!==1||h!==1)&&g.push(i(g)+"scale("+f+","+h+")")}return function(c,u){var f=[],h=[];return c=t(c),u=t(u),s(c.translateX,c.translateY,u.translateX,u.translateY,f,h),l(c.rotate,u.rotate,f,h),a(c.skewX,u.skewX,f,h),d(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,h),c=u=null,function(g){for(var p=-1,m=h.length,v;++p<m;)f[(v=h[p]).i]=v.x(g);return f.join("")}}}var Kc=Ki(Zc,"px, ","px)","deg)"),Qc=Ki(qc,", ",")",")"),Jc=1e-12;function Qi(t){return((t=Math.exp(t))+1/t)/2}function ed(t){return((t=Math.exp(t))-1/t)/2}function td(t){return((t=Math.exp(2*t))-1)/(t+1)}const an=(function t(e,n,o){function i(s,l){var a=s[0],d=s[1],c=s[2],u=l[0],f=l[1],h=l[2],g=u-a,p=f-d,m=g*g+p*p,v,E;if(m<Jc)E=Math.log(h/c)/e,v=function(L){return[a+L*g,d+L*p,c*Math.exp(e*L*E)]};else{var M=Math.sqrt(m),y=(h*h-c*c+o*m)/(2*c*n*M),C=(h*h-c*c-o*m)/(2*h*n*M),$=Math.log(Math.sqrt(y*y+1)-y),O=Math.log(Math.sqrt(C*C+1)-C);E=(O-$)/e,v=function(L){var j=L*E,W=Qi($),G=c/(n*M)*(W*td(e*j+$)-ed($));return[a+G*g,d+G*p,c*W/Qi(e*j+$)]}}return v.duration=E*1e3*e/Math.SQRT2,v}return i.rho=function(s){var l=Math.max(.001,+s),a=l*l,d=a*a;return t(l,a,d)},i})(Math.SQRT2,2,4);var dt=0,Dt=0,zt=0,Ji=1e3,cn,Tt,dn=0,Je=0,un=0,It=typeof performance=="object"&&performance.now?performance:Date,es=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function po(){return Je||(es(nd),Je=It.now()+un)}function nd(){Je=0}function fn(){this._call=this._time=this._next=null}fn.prototype=ts.prototype={constructor:fn,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?po():+n)+(e==null?0:+e),!this._next&&Tt!==this&&(Tt?Tt._next=this:cn=this,Tt=this),this._call=t,this._time=n,mo()},stop:function(){this._call&&(this._call=null,this._time=1/0,mo())}};function ts(t,e,n){var o=new fn;return o.restart(t,e,n),o}function od(){po(),++dt;for(var t=cn,e;t;)(e=Je-t._time)>=0&&t._call.call(void 0,e),t=t._next;--dt}function ns(){Je=(dn=It.now())+un,dt=Dt=0;try{od()}finally{dt=0,sd(),Je=0}}function id(){var t=It.now(),e=t-dn;e>Ji&&(un-=e,dn=t)}function sd(){for(var t,e=cn,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:cn=n);Tt=t,mo(o)}function mo(t){if(!dt){Dt&&(Dt=clearTimeout(Dt));var e=t-Je;e>24?(t<1/0&&(Dt=setTimeout(ns,t-It.now()-un)),zt&&(zt=clearInterval(zt))):(zt||(dn=It.now(),zt=setInterval(id,Ji)),dt=1,es(ns))}}function os(t,e,n){var o=new fn;return e=e==null?0:+e,o.restart(i=>{o.stop(),t(i+e)},e,n),o}var rd=qt("start","end","cancel","interrupt"),ld=[],is=0,ss=1,yo=2,hn=3,rs=4,vo=5,gn=6;function pn(t,e,n,o,i,s){var l=t.__transition;if(!l)t.__transition={};else if(n in l)return;ad(t,n,{name:e,index:o,group:i,on:rd,tween:ld,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:is})}function wo(t,e){var n=De(t,e);if(n.state>is)throw new Error("too late; already scheduled");return n}function Re(t,e){var n=De(t,e);if(n.state>hn)throw new Error("too late; already running");return n}function De(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ad(t,e,n){var o=t.__transition,i;o[e]=n,n.timer=ts(s,0,n.time);function s(c){n.state=ss,n.timer.restart(l,n.delay,n.time),n.delay<=c&&l(c-n.delay)}function l(c){var u,f,h,g;if(n.state!==ss)return d();for(u in o)if(g=o[u],g.name===n.name){if(g.state===hn)return os(l);g.state===rs?(g.state=gn,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete o[u]):+u<e&&(g.state=gn,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete o[u])}if(os(function(){n.state===hn&&(n.state=rs,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=yo,n.on.call("start",t,t.__data__,n.index,n.group),n.state===yo){for(n.state=hn,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++f]=g);i.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(d),n.state=vo,1),f=-1,h=i.length;++f<h;)i[f].call(t,u);n.state===vo&&(n.on.call("end",t,t.__data__,n.index,n.group),d())}function d(){n.state=gn,n.timer.stop(),delete o[e];for(var c in o)return;delete t.__transition}}function mn(t,e){var n=t.__transition,o,i,s=!0,l;if(n){e=e==null?null:e+"";for(l in n){if((o=n[l]).name!==e){s=!1;continue}i=o.state>yo&&o.state<vo,o.state=gn,o.timer.stop(),o.on.call(i?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[l]}s&&delete t.__transition}}function cd(t){return this.each(function(){mn(this,t)})}function dd(t,e){var n,o;return function(){var i=Re(this,t),s=i.tween;if(s!==n){o=n=s;for(var l=0,a=o.length;l<a;++l)if(o[l].name===e){o=o.slice(),o.splice(l,1);break}}i.tween=o}}function ud(t,e,n){var o,i;if(typeof n!="function")throw new Error;return function(){var s=Re(this,t),l=s.tween;if(l!==o){i=(o=l).slice();for(var a={name:e,value:n},d=0,c=i.length;d<c;++d)if(i[d].name===e){i[d]=a;break}d===c&&i.push(a)}s.tween=i}}function fd(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=De(this.node(),n).tween,i=0,s=o.length,l;i<s;++i)if((l=o[i]).name===t)return l.value;return null}return this.each((e==null?dd:ud)(n,t,e))}function _o(t,e,n){var o=t._id;return t.each(function(){var i=Re(this,o);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return De(i,o).value[e]}}function ls(t,e){var n;return(typeof e=="number"?Be:e instanceof qe?rn:(n=qe(e))?(e=n,rn):ji)(t,e)}function hd(t){return function(){this.removeAttribute(t)}}function gd(t){return function(){this.removeAttributeNS(t.space,t.local)}}function pd(t,e,n){var o,i=n+"",s;return function(){var l=this.getAttribute(t);return l===i?null:l===o?s:s=e(o=l,n)}}function md(t,e,n){var o,i=n+"",s;return function(){var l=this.getAttributeNS(t.space,t.local);return l===i?null:l===o?s:s=e(o=l,n)}}function yd(t,e,n){var o,i,s;return function(){var l,a=n(this),d;return a==null?void this.removeAttribute(t):(l=this.getAttribute(t),d=a+"",l===d?null:l===o&&d===i?s:(i=d,s=e(o=l,a)))}}function vd(t,e,n){var o,i,s;return function(){var l,a=n(this),d;return a==null?void this.removeAttributeNS(t.space,t.local):(l=this.getAttributeNS(t.space,t.local),d=a+"",l===d?null:l===o&&d===i?s:(i=d,s=e(o=l,a)))}}function wd(t,e){var n=Qt(t),o=n==="transform"?Qc:ls;return this.attrTween(t,typeof e=="function"?(n.local?vd:yd)(n,o,_o(this,"attr."+t,e)):e==null?(n.local?gd:hd)(n):(n.local?md:pd)(n,o,e))}function _d(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function bd(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function xd(t,e){var n,o;function i(){var s=e.apply(this,arguments);return s!==o&&(n=(o=s)&&bd(t,s)),n}return i._value=e,i}function Ed(t,e){var n,o;function i(){var s=e.apply(this,arguments);return s!==o&&(n=(o=s)&&_d(t,s)),n}return i._value=e,i}function Cd(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=Qt(t);return this.tween(n,(o.local?xd:Ed)(o,e))}function Nd(t,e){return function(){wo(this,t).delay=+e.apply(this,arguments)}}function kd(t,e){return e=+e,function(){wo(this,t).delay=e}}function Sd(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Nd:kd)(e,t)):De(this.node(),e).delay}function Md(t,e){return function(){Re(this,t).duration=+e.apply(this,arguments)}}function Dd(t,e){return e=+e,function(){Re(this,t).duration=e}}function zd(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Md:Dd)(e,t)):De(this.node(),e).duration}function Td(t,e){if(typeof e!="function")throw new Error;return function(){Re(this,t).ease=e}}function Id(t){var e=this._id;return arguments.length?this.each(Td(e,t)):De(this.node(),e).ease}function Bd(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Re(this,t).ease=n}}function Rd(t){if(typeof t!="function")throw new Error;return this.each(Bd(this._id,t))}function Ad(t){typeof t!="function"&&(t=Ni(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var s=e[i],l=s.length,a=o[i]=[],d,c=0;c<l;++c)(d=s[c])&&t.call(d,d.__data__,c,s)&&a.push(d);return new Oe(o,this._parents,this._name,this._id)}function $d(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),l=new Array(o),a=0;a<s;++a)for(var d=e[a],c=n[a],u=d.length,f=l[a]=new Array(u),h,g=0;g<u;++g)(h=d[g]||c[g])&&(f[g]=h);for(;a<o;++a)l[a]=e[a];return new Oe(l,this._parents,this._name,this._id)}function Pd(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 Od(t,e,n){var o,i,s=Pd(e)?wo:Re;return function(){var l=s(this,t),a=l.on;a!==o&&(i=(o=a).copy()).on(e,n),l.on=i}}function Hd(t,e){var n=this._id;return arguments.length<2?De(this.node(),n).on.on(t):this.each(Od(n,t,e))}function Vd(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Ld(){return this.on("end.remove",Vd(this._id))}function Fd(t){var e=this._name,n=this._id;typeof t!="function"&&(t=oo(t));for(var o=this._groups,i=o.length,s=new Array(i),l=0;l<i;++l)for(var a=o[l],d=a.length,c=s[l]=new Array(d),u,f,h=0;h<d;++h)(u=a[h])&&(f=t.call(u,u.__data__,h,a))&&("__data__"in u&&(f.__data__=u.__data__),c[h]=f,pn(c[h],e,n,h,c,De(u,n)));return new Oe(s,this._parents,e,n)}function Gd(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ci(t));for(var o=this._groups,i=o.length,s=[],l=[],a=0;a<i;++a)for(var d=o[a],c=d.length,u,f=0;f<c;++f)if(u=d[f]){for(var h=t.call(u,u.__data__,f,d),g,p=De(u,n),m=0,v=h.length;m<v;++m)(g=h[m])&&pn(g,e,n,m,h,p);s.push(h),l.push(u)}return new Oe(s,l,e,n)}var Wd=Et.prototype.constructor;function Yd(){return new Wd(this._groups,this._parents)}function Ud(t,e){var n,o,i;return function(){var s=lt(this,t),l=(this.style.removeProperty(t),lt(this,t));return s===l?null:s===n&&l===o?i:i=e(n=s,o=l)}}function as(t){return function(){this.style.removeProperty(t)}}function Xd(t,e,n){var o,i=n+"",s;return function(){var l=lt(this,t);return l===i?null:l===o?s:s=e(o=l,n)}}function jd(t,e,n){var o,i,s;return function(){var l=lt(this,t),a=n(this),d=a+"";return a==null&&(d=a=(this.style.removeProperty(t),lt(this,t))),l===d?null:l===o&&d===i?s:(i=d,s=e(o=l,a))}}function Zd(t,e){var n,o,i,s="style."+e,l="end."+s,a;return function(){var d=Re(this,t),c=d.on,u=d.value[s]==null?a||(a=as(e)):void 0;(c!==n||i!==u)&&(o=(n=c).copy()).on(l,i=u),d.on=o}}function qd(t,e,n){var o=(t+="")=="transform"?Kc:ls;return e==null?this.styleTween(t,Ud(t,o)).on("end.style."+t,as(t)):typeof e=="function"?this.styleTween(t,jd(t,o,_o(this,"style."+t,e))).each(Zd(this._id,t)):this.styleTween(t,Xd(t,o,e),n).on("end.style."+t,null)}function Kd(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function Qd(t,e,n){var o,i;function s(){var l=e.apply(this,arguments);return l!==i&&(o=(i=l)&&Kd(t,l,n)),o}return s._value=e,s}function Jd(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,Qd(t,e,n??""))}function eu(t){return function(){this.textContent=t}}function tu(t){return function(){var e=t(this);this.textContent=e??""}}function nu(t){return this.tween("text",typeof t=="function"?tu(_o(this,"text",t)):eu(t==null?"":t+""))}function ou(t){return function(e){this.textContent=t.call(this,e)}}function iu(t){var e,n;function o(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&ou(i)),e}return o._value=t,o}function su(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,iu(t))}function ru(){for(var t=this._name,e=this._id,n=cs(),o=this._groups,i=o.length,s=0;s<i;++s)for(var l=o[s],a=l.length,d,c=0;c<a;++c)if(d=l[c]){var u=De(d,e);pn(d,t,n,c,l,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Oe(o,this._parents,t,n)}function lu(){var t,e,n=this,o=n._id,i=n.size();return new Promise(function(s,l){var a={value:l},d={value:function(){--i===0&&s()}};n.each(function(){var c=Re(this,o),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(d)),c.on=e}),i===0&&s()})}var au=0;function Oe(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function cs(){return++au}var He=Et.prototype;Oe.prototype={constructor:Oe,select:Fd,selectAll:Gd,selectChild:He.selectChild,selectChildren:He.selectChildren,filter:Ad,merge:$d,selection:Yd,transition:ru,call:He.call,nodes:He.nodes,node:He.node,size:He.size,empty:He.empty,each:He.each,on:Hd,attr:wd,attrTween:Cd,style:qd,styleTween:Jd,text:nu,textTween:su,remove:Ld,tween:fd,delay:Sd,duration:zd,ease:Id,easeVarying:Rd,end:lu,[Symbol.iterator]:He[Symbol.iterator]};function cu(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var du={time:null,delay:0,duration:250,ease:cu};function uu(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 fu(t){var e,n;t instanceof Oe?(e=t._id,t=t._name):(e=cs(),(n=du).time=po(),t=t==null?null:t+"");for(var o=this._groups,i=o.length,s=0;s<i;++s)for(var l=o[s],a=l.length,d,c=0;c<a;++c)(d=l[c])&&pn(d,t,e,c,l,n||uu(d,e));return new Oe(o,this._parents,t,e)}Et.prototype.interrupt=cd,Et.prototype.transition=fu;const yn=t=>()=>t;function hu(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 Ve(t,e,n){this.k=t,this.x=e,this.y=n}Ve.prototype={constructor:Ve,scale:function(t){return t===1?this:new Ve(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Ve(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 Ve(1,0,0);Ve.prototype;function bo(t){t.stopImmediatePropagation()}function Bt(t){t.preventDefault(),t.stopImmediatePropagation()}function gu(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function pu(){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 ds(){return this.__zoom||ut}function mu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function yu(){return navigator.maxTouchPoints||"ontouchstart"in this}function vu(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],l=t.invertY(e[1][1])-n[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),l>s?(s+l)/2:Math.min(0,s)||Math.max(0,l))}function wu(){var t=gu,e=pu,n=vu,o=mu,i=yu,s=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],a=250,d=an,c=qt("start","zoom","end"),u,f,h,g=500,p=150,m=0,v=10;function E(_){_.property("__zoom",ds).on("wheel.zoom",j,{passive:!1}).on("mousedown.zoom",W).on("dblclick.zoom",G).filter(i).on("touchstart.zoom",F).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(_,A,S,R){var V=_.selection?_.selection():_;V.property("__zoom",ds),_!==V?$(_,A,S,R):V.interrupt().each(function(){O(this,arguments).event(R).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},E.scaleBy=function(_,A,S,R){E.scaleTo(_,function(){var V=this.__zoom.k,T=typeof A=="function"?A.apply(this,arguments):A;return V*T},S,R)},E.scaleTo=function(_,A,S,R){E.transform(_,function(){var V=e.apply(this,arguments),T=this.__zoom,I=S==null?C(V):typeof S=="function"?S.apply(this,arguments):S,Y=T.invert(I),X=typeof A=="function"?A.apply(this,arguments):A;return n(y(M(T,X),I,Y),V,l)},S,R)},E.translateBy=function(_,A,S,R){E.transform(_,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof S=="function"?S.apply(this,arguments):S),e.apply(this,arguments),l)},null,R)},E.translateTo=function(_,A,S,R,V){E.transform(_,function(){var T=e.apply(this,arguments),I=this.__zoom,Y=R==null?C(T):typeof R=="function"?R.apply(this,arguments):R;return n(ut.translate(Y[0],Y[1]).scale(I.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof S=="function"?-S.apply(this,arguments):-S),T,l)},R,V)};function M(_,A){return A=Math.max(s[0],Math.min(s[1],A)),A===_.k?_:new Ve(A,_.x,_.y)}function y(_,A,S){var R=A[0]-S[0]*_.k,V=A[1]-S[1]*_.k;return R===_.x&&V===_.y?_:new Ve(_.k,R,V)}function C(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function $(_,A,S,R){_.on("start.zoom",function(){O(this,arguments).event(R).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(R).end()}).tween("zoom",function(){var V=this,T=arguments,I=O(V,T).event(R),Y=e.apply(V,T),X=S==null?C(Y):typeof S=="function"?S.apply(V,T):S,J=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),re=V.__zoom,P=typeof A=="function"?A.apply(V,T):A,Z=d(re.invert(X).concat(J/re.k),P.invert(X).concat(J/P.k));return function(B){if(B===1)B=P;else{var U=Z(B),K=J/U[2];B=new Ve(K,X[0]-U[0]*K,X[1]-U[1]*K)}I.zoom(null,B)}})}function O(_,A,S){return!S&&_.__zooming||new L(_,A)}function L(_,A){this.that=_,this.args=A,this.active=0,this.sourceEvent=null,this.extent=e.apply(_,A),this.taps=0}L.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,A){return this.mouse&&_!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var A=Se(this.that).datum();c.call(_,this.that,new hu(_,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:c}),A)}};function j(_,...A){if(!t.apply(this,arguments))return;var S=O(this,A).event(_),R=this.__zoom,V=Math.max(s[0],Math.min(s[1],R.k*Math.pow(2,o.apply(this,arguments)))),T=Te(_);if(S.wheel)(S.mouse[0][0]!==T[0]||S.mouse[0][1]!==T[1])&&(S.mouse[1]=R.invert(S.mouse[0]=T)),clearTimeout(S.wheel);else{if(R.k===V)return;S.mouse=[T,R.invert(T)],mn(this),S.start()}Bt(_),S.wheel=setTimeout(I,p),S.zoom("mouse",n(y(M(R,V),S.mouse[0],S.mouse[1]),S.extent,l));function I(){S.wheel=null,S.end()}}function W(_,...A){if(h||!t.apply(this,arguments))return;var S=_.currentTarget,R=O(this,A,!0).event(_),V=Se(_.view).on("mousemove.zoom",X,!0).on("mouseup.zoom",J,!0),T=Te(_,S),I=_.clientX,Y=_.clientY;Ai(_.view),bo(_),R.mouse=[T,this.__zoom.invert(T)],mn(this),R.start();function X(re){if(Bt(re),!R.moved){var P=re.clientX-I,Z=re.clientY-Y;R.moved=P*P+Z*Z>m}R.event(re).zoom("mouse",n(y(R.that.__zoom,R.mouse[0]=Te(re,S),R.mouse[1]),R.extent,l))}function J(re){V.on("mousemove.zoom mouseup.zoom",null),$i(re.view,R.moved),Bt(re),R.event(re).end()}}function G(_,...A){if(t.apply(this,arguments)){var S=this.__zoom,R=Te(_.changedTouches?_.changedTouches[0]:_,this),V=S.invert(R),T=S.k*(_.shiftKey?.5:2),I=n(y(M(S,T),R,V),e.apply(this,A),l);Bt(_),a>0?Se(this).transition().duration(a).call($,I,R,_):Se(this).call(E.transform,I,R,_)}}function F(_,...A){if(t.apply(this,arguments)){var S=_.touches,R=S.length,V=O(this,A,_.changedTouches.length===R).event(_),T,I,Y,X;for(bo(_),I=0;I<R;++I)Y=S[I],X=Te(Y,this),X=[X,this.__zoom.invert(X),Y.identifier],V.touch0?!V.touch1&&V.touch0[2]!==X[2]&&(V.touch1=X,V.taps=0):(V.touch0=X,T=!0,V.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(V.taps<2&&(f=X[0],u=setTimeout(function(){u=null},g)),mn(this),V.start())}}function N(_,...A){if(this.__zooming){var S=O(this,A).event(_),R=_.changedTouches,V=R.length,T,I,Y,X;for(Bt(_),T=0;T<V;++T)I=R[T],Y=Te(I,this),S.touch0&&S.touch0[2]===I.identifier?S.touch0[0]=Y:S.touch1&&S.touch1[2]===I.identifier&&(S.touch1[0]=Y);if(I=S.that.__zoom,S.touch1){var J=S.touch0[0],re=S.touch0[1],P=S.touch1[0],Z=S.touch1[1],B=(B=P[0]-J[0])*B+(B=P[1]-J[1])*B,U=(U=Z[0]-re[0])*U+(U=Z[1]-re[1])*U;I=M(I,Math.sqrt(B/U)),Y=[(J[0]+P[0])/2,(J[1]+P[1])/2],X=[(re[0]+Z[0])/2,(re[1]+Z[1])/2]}else if(S.touch0)Y=S.touch0[0],X=S.touch0[1];else return;S.zoom("touch",n(y(I,Y,X),S.extent,l))}}function H(_,...A){if(this.__zooming){var S=O(this,A).event(_),R=_.changedTouches,V=R.length,T,I;for(bo(_),h&&clearTimeout(h),h=setTimeout(function(){h=null},g),T=0;T<V;++T)I=R[T],S.touch0&&S.touch0[2]===I.identifier?delete S.touch0:S.touch1&&S.touch1[2]===I.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(I=Te(I,this),Math.hypot(f[0]-I[0],f[1]-I[1])<v)){var Y=Se(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return E.wheelDelta=function(_){return arguments.length?(o=typeof _=="function"?_:yn(+_),E):o},E.filter=function(_){return arguments.length?(t=typeof _=="function"?_:yn(!!_),E):t},E.touchable=function(_){return arguments.length?(i=typeof _=="function"?_:yn(!!_),E):i},E.extent=function(_){return arguments.length?(e=typeof _=="function"?_:yn([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),E):e},E.scaleExtent=function(_){return arguments.length?(s[0]=+_[0],s[1]=+_[1],E):[s[0],s[1]]},E.translateExtent=function(_){return arguments.length?(l[0][0]=+_[0][0],l[1][0]=+_[1][0],l[0][1]=+_[0][1],l[1][1]=+_[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(_){return arguments.length?(n=_,E):n},E.duration=function(_){return arguments.length?(a=+_,E):a},E.interpolate=function(_){return arguments.length?(d=_,E):d},E.on=function(){var _=c.on.apply(c,arguments);return _===c?E:_},E.clickDistance=function(_){return arguments.length?(m=(_=+_)*_,E):Math.sqrt(m)},E.tapDistance=function(_){return arguments.length?(v=+_,E):v},E}var oe=(t=>(t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom",t))(oe||{}),xo=(t=>(t.Partial="partial",t.Full="full",t))(xo||{}),et=(t=>(t.Bezier="default",t.SimpleBezier="simple-bezier",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t))(et||{}),Le=(t=>(t.Strict="strict",t.Loose="loose",t))(Le||{}),Fe=(t=>(t.Arrow="arrow",t.ArrowClosed="arrowclosed",t))(Fe||{}),Rt=(t=>(t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal",t))(Rt||{}),us=(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))(us||{});const _u=["INPUT","SELECT","TEXTAREA"],bu=typeof document<"u"?document:null;function Eo(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 _u.includes(o?.nodeName)||i||!!s}function xu(t){return t.ctrlKey||t.metaKey||t.shiftKey||t.altKey}function fs(t,e,n,o){const i=e.replace("+",`
2
+ `).replace(`
3
+
4
+ `,`
5
+ +`).split(`
6
+ `).map(l=>l.trim().toLowerCase());if(i.length===1)return t.toLowerCase()===e.toLowerCase();o||n.add(t.toLowerCase());const s=i.every((l,a)=>n.has(l)&&Array.from(n.values())[a]===i[a]);return o&&n.delete(t.toLowerCase()),s}function Eu(t,e){return n=>{if(!n.code&&!n.key)return!1;const o=Cu(n.code,t);return Array.isArray(t)?t.some(i=>fs(n[o],i,e,n.type==="keyup")):fs(n[o],t,e,n.type==="keyup")}}function Cu(t,e){return e.includes(t)?"code":"key"}function At(t,e){const n=r.computed(()=>r.toValue(e?.target)??bu),o=r.shallowRef(r.toValue(t)===!0);let i=!1;const s=new Set;let l=d(r.toValue(t));r.watch(()=>r.toValue(t),(c,u)=>{typeof u=="boolean"&&typeof c!="boolean"&&a(),l=d(c)},{immediate:!0}),wi(["blur","contextmenu"],a),_i((...c)=>l(...c),c=>{var u,f;const h=r.toValue(e?.actInsideInputWithModifier)??!0,g=r.toValue(e?.preventDefault)??!1;if(i=xu(c),(!i||i&&!h)&&Eo(c))return;const m=((f=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:f[0])||c.target,v=m?.nodeName==="BUTTON"||m?.nodeName==="A";!g&&(i||!v)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),_i((...c)=>l(...c),c=>{const u=r.toValue(e?.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!u)&&Eo(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function a(){i=!1,s.clear(),o.value=r.toValue(t)===!0}function d(c){return c===null?(a(),()=>!1):typeof c=="boolean"?(a(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?Eu(c,s):c}return o}const hs="vue-flow__node-desc",gs="vue-flow__edge-desc",Nu="vue-flow__aria-live",ps=["Enter"," ","Escape"],ft={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function vn(t){return{...t.computedPosition||{x:0,y:0},width:t.dimensions.width||0,height:t.dimensions.height||0}}function wn(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 _n(t){return{width:t.offsetWidth,height:t.offsetHeight}}function tt(t,e=0,n=1){return Math.min(Math.max(t,e),n)}function ms(t,e){return{x:tt(t.x,e[0][0],e[1][0]),y:tt(t.y,e[0][1],e[1][1])}}function ys(t){const e=t.getRootNode();return"elementFromPoint"in e?e:window.document}function Ye(t){return t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t}function nt(t){return t&&typeof t=="object"&&"id"in t&&"position"in t&&!Ye(t)}function $t(t){return nt(t)&&"computedPosition"in t}function bn(t){return!Number.isNaN(t)&&Number.isFinite(t)}function ku(t){return bn(t.width)&&bn(t.height)&&bn(t.x)&&bn(t.y)}function Su(t,e,n){const o={id:t.id.toString(),type:t.type??"default",dimensions:r.markRaw({width:0,height:0}),computedPosition: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:me(t.data)?t.data:{},events:r.markRaw(me(t.events)?t.events:{})};return Object.assign(e??o,t,{id:t.id.toString(),parentNode:n})}function vs(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:me(t.data)?t.data:{},events:r.markRaw(me(t.events)?t.events:{}),label:t.label??"",interactionWidth:t.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(e??s,t,{id:t.id.toString()})}function ws(t,e,n,o){const i=typeof t=="string"?t:t.id,s=new Set,l=o==="source"?"target":"source";for(const a of n)a[l]===i&&s.add(a[o]);return e.filter(a=>s.has(a.id))}function Mu(...t){if(t.length===3){const[s,l,a]=t;return ws(s,l,a,"target")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(s=>Ye(s)&&s.source===o).map(s=>n.find(l=>nt(l)&&l.id===s.target))}function Du(...t){if(t.length===3){const[s,l,a]=t;return ws(s,l,a,"source")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(s=>Ye(s)&&s.target===o).map(s=>n.find(l=>nt(l)&&l.id===s.source))}function _s({source:t,sourceHandle:e,target:n,targetHandle:o}){return`vueflow__edge-${t}${e??""}-${n}${o??""}`}function zu(t,e){return e.some(n=>Ye(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 Pt({x:t,y:e},{x:n,y:o,zoom:i}){return{x:t*i+n,y:e*i+o}}function Ot({x:t,y:e},{x:n,y:o,zoom:i},s=!1,l=[1,1]){const a={x:(t-n)/i,y:(e-o)/i};return s?En(a,l):a}function Tu(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 bs({x:t,y:e,width:n,height:o}){return{x:t,y:e,x2:t+n,y2:e+o}}function Iu({x:t,y:e,x2:n,y2:o}){return{x:t,y:e,width:n-t,height:o-e}}function xs(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=Tu(e,bs({...o.computedPosition,...o.dimensions}))}return Iu(e)}function Es(t,e,n={x:0,y:0,zoom:1},o=!1,i=!1){const s={...Ot(e,n),width:e.width/n.zoom,height:e.height/n.zoom},l=[];for(const a of t){const{dimensions:d,selectable:c=!0,hidden:u=!1}=a,f=d.width??a.width??null,h=d.height??a.height??null;if(i&&!c||u)continue;const g=wn(s,vn(a)),p=f===null||h===null,m=o&&g>0,v=(f??0)*(h??0);(p||m||g>=v||a.dragging)&&l.push(a)}return l}function Cs(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 Vt(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Bu(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),l=ht(t.right??t.x??0,e);return{top:o,right:l,bottom:i,left:s,x:s+l,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Ru(t,e,n,o,i,s){const{x:l,y:a}=Pt(t,{x:e,y:n,zoom:o}),{x:d,y:c}=Pt({x:t.x+t.width,y:t.y+t.height},{x:e,y:n,zoom:o}),u=i-d,f=s-c;return{left:Math.floor(l),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}function Ns(t,e,n,o,i,s=.1){const l=Bu(s,e,n),a=(e-l.x)/t.width,d=(n-l.y)/t.height,c=Math.min(a,d),u=tt(c,o,i),f=t.x+t.width/2,h=t.y+t.height/2,g=e/2-f*u,p=n/2-h*u,m=Ru(t,g,p,u,e,n),v={left:Math.min(m.left-l.left,0),top:Math.min(m.top-l.top,0),right:Math.min(m.right-l.right,0),bottom:Math.min(m.bottom-l.bottom,0)};return{x:g-v.left+v.right,y:p-v.top+v.bottom,zoom:u}}function Au(t,e){return{x:e.x+t.x,y:e.y+t.y,z:(t.z>e.z?t.z:e.z)+1}}function ks(t,e){if(!t.parentNode)return!1;const n=e.get(t.parentNode);return n?n.selected?!0:ks(n,e):!1}function Ht(t,e){return typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`}function Ss(t){const e=t.ctrlKey&&xn()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e}function Ms(t,e,n){return t<e?tt(Math.abs(t-e),1,e)/e:t>n?-tt(Math.abs(t-n),1,e)/e:0}function Ds(t,e,n=15,o=40){const i=Ms(t.x,o,e.width-o)*n,s=Ms(t.y,o,e.height-o)*n;return[i,s]}function Co(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 l=Number(i.width.replace("px",""));i.width=`${l+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 l=Number(i.height.replace("px",""));i.height=`${l+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 l=e.style;return{...l(s),...i}}:e.style={...e.style,...i}}}}function zs(t,e){var n,o;const i=t.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")e.findIndex(d=>d.id===l.item.id)===-1&&e.push(l.item);else if(l.type==="remove"){const a=e.findIndex(d=>d.id===l.id);a!==-1&&e.splice(a,1)}const s=e.map(l=>l.id);for(const l of e)for(const a of t)if(a.id===l.id)switch(a.type){case"select":l.selected=a.selected;break;case"position":if($t(l)&&(typeof a.position<"u"&&(l.position=a.position),typeof a.dragging<"u"&&(l.dragging=a.dragging),l.expandParent&&l.parentNode)){const d=e[s.indexOf(l.parentNode)];d&&$t(d)&&Co(l,d)}break;case"dimensions":if($t(l)&&(typeof a.dimensions<"u"&&(l.dimensions=a.dimensions),typeof a.updateStyle<"u"&&a.updateStyle&&(l.style={...l.style||{},width:`${(n=a.dimensions)==null?void 0:n.width}px`,height:`${(o=a.dimensions)==null?void 0:o.height}px`}),typeof a.resizing<"u"&&(l.resizing=a.resizing),l.expandParent&&l.parentNode)){const d=e[s.indexOf(l.parentNode)];d&&$t(d)&&(!!d.dimensions.width&&!!d.dimensions.height?Co(l,d):r.nextTick(()=>{Co(l,d)}))}break}return e}function Ue(t,e){return{id:t,type:"select",selected:e}}function Ts(t){return{item:t,type:"add"}}function Is(t){return{id:t,type:"remove"}}function Bs(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 l=e.has(i);!(s.selected===void 0&&!l)&&s.selected!==l&&(n&&(s.selected=l),o.push(Ue(s.id,l)))}return o}const Rs=()=>{};function Q(t){const e=new Set;let n=Rs,o=()=>!1;const i=()=>e.size>0||o(),s=h=>{n=h},l=()=>{n=Rs},a=h=>{o=h},d=()=>{o=()=>!1},c=h=>{e.delete(h)};return{on:h=>{e.add(h);const g=()=>c(h);return xt(g),{off:g}},off:c,trigger:h=>{const g=[n];return i()?g.push(...e):t&&g.push(t),Promise.allSettled(g.map(p=>p(h)))},hasListeners:i,listeners:e,setEmitter:s,removeEmitter:l,setHasEmitListeners:a,removeHasEmitListeners:d}}function As(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 $u(t,e,n,o){var i,s;const l=new Map;for(const[a,d]of t)(d.selected||d.id===o)&&(!d.parentNode||!ks(d,t))&&(d.draggable||e&&typeof d.draggable>"u")&&t.get(a)&&l.set(a,{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(l.values())}function No({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 $s(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 Pu(t,e,n){const[o,i,s,l]=typeof t!="string"?$s(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+l,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-s]]:!1}function Ou(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=Pu(i,t,o);s&&(i=s)}else e(new ye(pe.NODE_EXTENT_INVALID,t.id)),i=n;else if(Array.isArray(i)){const s=o?.computedPosition.x||0,l=o?.computedPosition.y||0;i=[[i[0][0]+s,i[0][1]+l],[i[1][0]+s,i[1][1]+l]]}else if(i!=="parent"&&i?.range&&Array.isArray(i.range)){const[s,l,a,d]=$s(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-l,i.range[1][1]+u-a]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Hu({width:t,height:e},n){return[n[0],[n[1][0]-(t||0),n[1][1]-(e||0)]]}function ko(t,e,n,o,i){const s=Hu(t.dimensions,Ou(t,n,o,i)),l=ms(e,s);return{position:{x:l.x-(i?.computedPosition.x||0),y:l.y-(i?.computedPosition.y||0)},computedPosition:l}}function gt(t,e,n=oe.Left,o=!1){const i=(e?.x??0)+t.computedPosition.x,s=(e?.y??0)+t.computedPosition.y,{width:l,height:a}=e??Gu(t);if(o)return{x:i+l/2,y:s+a/2};switch(e?.position??n){case oe.Top:return{x:i+l/2,y:s};case oe.Right:return{x:i+l,y:s+a/2};case oe.Bottom:return{x:i+l/2,y:s+a};case oe.Left:return{x:i,y:s+a/2}}}function Ps(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function Vu({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:s,width:l,height:a,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=bs({x:(0-d.x)/d.zoom,y:(0-d.y)/d.zoom,width:l/d.zoom,height:a/d.zoom}),f=Math.max(0,Math.min(u.x2,c.x2)-Math.max(u.x,c.x)),h=Math.max(0,Math.min(u.y2,c.y2)-Math.max(u.y,c.y));return Math.ceil(f*h)>0}function Lu(t,e,n=!1){const o=typeof t.zIndex=="number";let i=o?t.zIndex:0;const s=e(t.source),l=e(t.target);return!s||!l?0:(n&&(i=o?t.zIndex:Math.max(s.computedPosition.z||0,l.computedPosition.z||0)),i)}var pe=(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))(pe||{});const Os={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
+ Node: ${t}`,NODE_NOT_FOUND:t=>`Node not found
8
+ Node: ${t}`,NODE_MISSING_PARENT:(t,e)=>`Node is missing a parent
9
+ Node: ${t}
10
+ Parent: ${e}`,NODE_TYPE_MISSING:t=>`Node type is missing
11
+ Type: ${t}`,NODE_EXTENT_INVALID:t=>`Only child nodes can use a parent extent
12
+ Node: ${t}`,EDGE_INVALID:t=>`An edge needs a source and a target
13
+ Edge: ${t}`,EDGE_SOURCE_MISSING:(t,e)=>`Edge source is missing
14
+ Edge: ${t}
15
+ Source: ${e}`,EDGE_TARGET_MISSING:(t,e)=>`Edge target is missing
16
+ Edge: ${t}
17
+ Target: ${e}`,EDGE_TYPE_MISSING:t=>`Edge type is missing
18
+ Type: ${t}`,EDGE_SOURCE_TARGET_SAME:(t,e,n)=>`Edge source and target are the same
19
+ Edge: ${t}
20
+ Source: ${e}
21
+ Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(t,e,n)=>`Edge source or target is missing
22
+ Edge: ${t}
23
+ Source: ${e}
24
+ Target: ${n}`,EDGE_ORPHANED:t=>`Edge was orphaned (suddenly missing source or target) and has been removed
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"};class ye extends Error{constructor(e,...n){var o;super((o=Os[e])==null?void 0:o.call(Os,...n)),this.name="VueFlowError",this.code=e,this.args=n}}function So(t){return"clientX"in t}function Fu(t){return"sourceEvent"in t}function Ae(t,e){const n=So(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)}}const xn=()=>{var t;return typeof navigator<"u"&&((t=navigator?.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Gu(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 En(t,e=[1,1]){return{x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}}const Wu=()=>!0;function Mo(t){t?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Yu(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())wn(i,vn(s))>0&&o.push(s);return o}const Uu=250;function Xu(t,e,n,o){var i,s;let l=[],a=Number.POSITIVE_INFINITY;const d=Yu(t,n,e+Uu);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 f of u){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:h,y:g}=gt(c,f,f.position,!0),p=Math.sqrt((h-t.x)**2+(g-t.y)**2);p>e||(p<a?(l=[{...f,x:h,y:g}],a=p):p===a&&l.push({...f,x:h,y:g}))}}if(!l.length)return null;if(l.length>1){const c=o.type==="source"?"target":"source";return l.find(u=>u.type===c)??l[0]}return l[0]}function Hs(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:s,doc:l,lib:a,flowId:d,isValidConnection:c=Wu},u,f,h,g){const p=s==="target",m=e?l.querySelector(`.${a}-flow__handle[data-id="${d}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:v,y:E}=Ae(t),M=l.elementFromPoint(v,E),y=M?.classList.contains(`${a}-flow__handle`)?M:m,C={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const $=Vs(void 0,y),O=y.getAttribute("data-nodeid"),L=y.getAttribute("data-handleid"),j=y.classList.contains("connectable"),W=y.classList.contains("connectableend");if(!O||!$)return C;const G={source:p?O:o,sourceHandle:p?L:i,target:p?o:O,targetHandle:p?i:L};C.connection=G;const N=j&&W&&(n===Le.Strict?p&&$==="source"||!p&&$==="target":O!==o||L!==i);C.isValid=N&&c(G,{nodes:f,edges:u,sourceNode:h(G.source),targetNode:h(G.target)}),C.toHandle=Ls(O,$,L,g,n,!0)}return C}function Vs(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function ju(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Zu(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}function Ls(t,e,n,o,i,s=!1){var l,a,d;const c=o.get(t);if(!c)return null;const u=i===Le.Strict?(l=c.handleBounds)==null?void 0:l[e]:[...((a=c.handleBounds)==null?void 0:a.source)??[],...((d=c.handleBounds)==null?void 0:d.target)??[]],f=(n?u?.find(h=>h.id===n):u?.[0])??null;return f&&s?{...f,...gt(c,f,f.position,!0)}:f}const Do={[oe.Left]:oe.Right,[oe.Right]:oe.Left,[oe.Top]:oe.Bottom,[oe.Bottom]:oe.Top},qu=["production","prod"];function Vt(t,...e){Fs()&&console.warn(`[Vue Flow]: ${t}`,...e)}function Fs(){return!qu.includes(process.env.NODE_ENV||"")}function Gs(t,e,n,o,i){const s=e.querySelectorAll(`.vue-flow__handle.${t}`);return s?.length?Array.from(s).map(l=>{const a=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:t,nodeId:i,position:l.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,..._n(l)}}):null}function zo(t,e,n,o,i,s=!1,l){i.value=!1,t.selected?(s||t.selected&&e)&&(o([t]),r.nextTick(()=>{l.blur()})):n([t])}function me(t){return typeof r.unref(t)<"u"}function Ku(t,e,n,o){if(!t||!t.source||!t.target)return n(new ye(pe.EDGE_INVALID,t?.id??"[ID UNKNOWN]")),!1;let i;return Ye(t)?i=t:i={...t,id:_s(t)},i=vs(i,void 0,o),zu(i,e)?!1:i}function Qu(t,e,n,o,i){if(!e.source||!e.target)return i(new ye(pe.EDGE_INVALID,t.id)),!1;if(!n)return i(new ye(pe.EDGE_NOT_FOUND,t.id)),!1;const{id:s,...l}=t;return{...l,id:o?_s(e):s,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle}}function Ws(t,e,n){const o={},i=[];for(let s=0;s<t.length;++s){const l=t[s];if(!nt(l)){n(new ye(pe.NODE_INVALID,l?.id)||`[ID UNKNOWN|INDEX ${s}]`);continue}const a=Su(l,e(l.id),l.parentNode);l.parentNode&&(o[l.parentNode]=!0),i[s]=a}for(const s of i){const l=e(s.parentNode)||i.find(a=>a.id===s.parentNode);s.parentNode&&!l&&n(new ye(pe.NODE_MISSING_PARENT,s.id,s.parentNode)),(s.parentNode||o[s.id])&&(o[s.id]&&(s.isParent=!0),l&&(l.isParent=!0))}return i}function Ys(t,e,n,o,i,s){let l=i;const a=o.get(l)||new Map;o.set(l,a.set(n,e)),l=`${i}-${t}`;const d=o.get(l)||new Map;if(o.set(l,d.set(n,e)),s){l=`${i}-${t}-${s}`;const c=o.get(l)||new Map;o.set(l,c.set(n,e))}}function To(t,e,n){t.clear();for(const o of n){const{source:i,target:s,sourceHandle:l=null,targetHandle:a=null}=o,d={edgeId:o.id,source:i,target:s,sourceHandle:l,targetHandle:a},c=`${i}-${l}--${s}-${a}`,u=`${s}-${a}--${i}-${l}`;Ys("source",d,u,t,i,l),Ys("target",d,c,t,s,a)}}function Us(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Io(t,e,n,o,i,s,l,a){const d=[];for(const c of t){const u=Ye(c)?c:Ku(c,a,i,s);if(!u)continue;const f=n(u.source),h=n(u.target);if(!f||!h){i(new ye(pe.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!f){i(new ye(pe.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!h){i(new ye(pe.EDGE_TARGET_MISSING,u.id,u.target));continue}if(e&&!e(u,{edges:a,nodes:l,sourceNode:f,targetNode:h})){i(new ye(pe.EDGE_INVALID,u.id));continue}const g=o(u.id);d.push({...vs(u,g,s),sourceNode:f,targetNode:h})}return d}const Xs=Symbol("vueFlow"),js=Symbol("nodeId"),Zs=Symbol("nodeRef"),Ju=Symbol("edgeId"),ef=Symbol("edgeRef"),Cn=Symbol("slots");function qs(t){const{vueFlowRef:e,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:s,nodeExtent:l,nodeDragThreshold:a,viewport:d,autoPanOnNodeDrag:c,autoPanSpeed:u,nodesDraggable:f,panBy:h,findNode:g,multiSelectionActive:p,nodesSelectionActive:m,selectNodesOnDrag:v,removeSelectedElements:E,addSelectedNodes:M,updateNodePositions:y,emits:C}=ge(),{onStart:$,onDrag:O,onStop:L,onClick:j,el:W,disabled:G,id:F,selectable:N,dragHandle:H}=t,_=r.shallowRef(!1);let A=[],S,R=null,V={x:void 0,y:void 0},T={x:0,y:0},I=null,Y=!1,X=!1,J=0,re=!1;const P=of(),Z=({x:q,y:ie})=>{V={x:q,y:ie};let b=!1;if(A=A.map(w=>{const x={x:q-w.distance.x,y:ie-w.distance.y},{computedPosition:D}=ko(w,n.value?En(x,o.value):x,C.error,l.value,w.parentNode?g(w.parentNode):void 0);return b=b||w.position.x!==D.x||w.position.y!==D.y,w.position=D,w}),X=X||b,!!b&&(y(A,!0,!0),_.value=!0,I)){const[w,x]=No({id:F,dragItems:A,findNode:g});O({event:I,node:w,nodes:x})}},B=()=>{if(!R)return;const[q,ie]=Ds(T,R,u.value);if(q!==0||ie!==0){const b={x:(V.x??0)-q/d.value.zoom,y:(V.y??0)-ie/d.value.zoom};h({x:q,y:ie})&&Z(b)}J=requestAnimationFrame(B)},U=(q,ie)=>{Y=!0;const b=g(F);!v.value&&!p.value&&b&&(b.selected||E()),b&&r.toValue(N)&&v.value&&zo(b,p.value,M,E,m,!1,ie);const w=P(q.sourceEvent);if(V=w,A=$u(s.value,f.value,w,F),A.length){const[x,D]=No({id:F,dragItems:A,findNode:g});$({event:q.sourceEvent,node:x,nodes:D})}},K=(q,ie)=>{var b;q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1||(X=!1,a.value===0&&U(q,ie),V=P(q.sourceEvent),R=((b=e.value)==null?void 0:b.getBoundingClientRect())||null,T=Ae(q.sourceEvent,R))},te=(q,ie)=>{const b=P(q.sourceEvent);if(!re&&Y&&c.value&&(re=!0,B()),!Y){const w=b.xSnapped-(V.x??0),x=b.ySnapped-(V.y??0);Math.sqrt(w*w+x*x)>a.value&&U(q,ie)}(V.x!==b.xSnapped||V.y!==b.ySnapped)&&A.length&&Y&&(I=q.sourceEvent,T=Ae(q.sourceEvent,R),Z(b))},ce=q=>{let ie=!1;if(!Y&&!_.value&&!p.value){const b=q.sourceEvent,w=P(b),x=w.xSnapped-(V.x??0),D=w.ySnapped-(V.y??0),k=Math.sqrt(x*x+D*D);k!==0&&k<=a.value&&(j?.(b),ie=!0)}if(A.length&&!ie){X&&(y(A,!1,!1),X=!1);const[b,w]=No({id:F,dragItems:A,findNode:g});L({event:q.sourceEvent,node:b,nodes:w})}A=[],_.value=!1,re=!1,Y=!1,V={x:void 0,y:void 0},cancelAnimationFrame(J)};return r.watch([()=>r.toValue(G),W],([q,ie],b,w)=>{if(ie){const x=Se(ie);q||(S=kc().on("start",D=>K(D,ie)).on("drag",D=>te(D,ie)).on("end",D=>ce(D)).filter(D=>{const k=D.target,ee=r.toValue(H);return!D.button&&(!i.value||!As(k,`.${i.value}`,ie)&&(!ee||As(k,ee,ie)))}),x.call(S)),w(()=>{x.on(".drag",null),S&&(S.on("start",null),S.on("drag",null),S.on("end",null))})}}),_}function tf(){return{doubleClick:Q(),click:Q(),mouseEnter:Q(),mouseMove:Q(),mouseLeave:Q(),contextMenu:Q(),updateStart:Q(),update:Q(),updateEnd:Q()}}function nf(t,e){const n=tf();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 of(){const{viewport:t,snapGrid:e,snapToGrid:n,vueFlowRef:o}=ge();return i=>{var s;const l=((s=o.value)==null?void 0:s.getBoundingClientRect())??{left:0,top:0},a=Fu(i)?i.sourceEvent:i,{x:d,y:c}=Ae(a,l),u=Ot({x:d,y:c},t.value),{x:f,y:h}=n.value?En(u,e.value):u;return{xSnapped:f,ySnapped:h,...u}}}function Nn(){return!0}function Ks({handleId:t,nodeId:e,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:s,onEdgeUpdateEnd:l}){const{id:a,vueFlowRef:d,connectionMode:c,connectionRadius:u,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:g,autoPanOnConnect:p,autoPanSpeed:m,findNode:v,panBy:E,startConnection:M,updateConnection:y,endConnection:C,emits:$,viewport:O,edges:L,nodes:j,isValidConnection:W,nodeLookup:G}=ge();let F=null,N=!1,H=null;function _(S){var R;const V=r.toValue(n)==="target",T=So(S),I=ys(S.target),Y=S.currentTarget;if(Y&&(T&&S.button===0||!T)){let X=function(se){b=Ae(se,ce),Z=Xu(Ot(b,O.value,!1,[1,1]),u.value,G.value,D),w||(x(),w=!0);const ue=Hs(se,{handle:Z,connectionMode:c.value,fromNodeId:r.toValue(e),fromHandleId:r.toValue(t),fromType:V?"target":"source",isValidConnection:P,doc:I,lib:"vue",flowId:a,nodeLookup:G.value},L.value,j.value,v,G.value);H=ue.handleDomNode,F=ue.connection,N=Zu(!!Z,ue.isValid);const fe={...le,isValid:N,to:ue.toHandle&&N?Pt({x:ue.toHandle.x,y:ue.toHandle.y},O.value):b,toHandle:ue.toHandle,toPosition:N&&ue.toHandle?ue.toHandle.position:Do[D.position],toNode:ue.toHandle?G.value.get(ue.toHandle.nodeId):null};if(N&&Z&&le?.toHandle&&fe.toHandle&&le.toHandle.type===fe.toHandle.type&&le.toHandle.nodeId===fe.toHandle.nodeId&&le.toHandle.id===fe.toHandle.id&&le.to.x===fe.to.x&&le.to.y===fe.to.y)return;const he=Z??ue.toHandle;if(y(he&&N?Pt({x:he.x,y:he.y},O.value):b,he,ju(!!he,N)),le=fe,!Z&&!N&&!H)return Mo(ie);F&&F.source!==F.target&&H&&(Mo(ie),ie=H,H.classList.add("connecting","vue-flow__handle-connecting"),H.classList.toggle("valid",!!N),H.classList.toggle("vue-flow__handle-valid",!!N))},J=function(se){"touches"in se&&se.touches.length>0||((Z||H)&&F&&N&&(s?s(se,F):$.connect(F)),$.connectEnd(se),i&&l?.(se),Mo(ie),cancelAnimationFrame(B),C(se),w=!1,N=!1,F=null,H=null,I.removeEventListener("mousemove",X),I.removeEventListener("mouseup",J),I.removeEventListener("touchmove",X),I.removeEventListener("touchend",J))};const re=v(r.toValue(e));let P=r.toValue(o)||W.value||Nn;!P&&re&&(P=(V?re.isValidSourcePos:re.isValidTargetPos)||Nn);let Z,B=0;const{x:U,y:K}=Ae(S),te=Vs(r.toValue(i),Y),ce=(R=d.value)==null?void 0:R.getBoundingClientRect();if(!ce||!te)return;const q=Ls(r.toValue(e),te,r.toValue(t),G.value,c.value);if(!q)return;let ie,b=Ae(S,ce),w=!1;const x=()=>{if(!p.value)return;const[se,ue]=Ds(b,ce,m.value);E({x:se,y:ue}),B=requestAnimationFrame(x)},D={...q,nodeId:r.toValue(e),type:te,position:q.position},k=G.value.get(r.toValue(e)),ne={inProgress:!0,isValid:null,from:gt(k,D,oe.Left,!0),fromHandle:D,fromPosition:D.position,fromNode:k,to:b,toHandle:null,toPosition:Do[D.position],toNode:null};M({nodeId:r.toValue(e),id:r.toValue(t),type:te,position:Y?.getAttribute("data-handlepos")||oe.Top,...b},{x:U-ce.left,y:K-ce.top}),$.connectStart({event:S,nodeId:r.toValue(e),handleId:r.toValue(t),handleType:te});let le=ne;I.addEventListener("mousemove",X),I.addEventListener("mouseup",J),I.addEventListener("touchmove",X),I.addEventListener("touchend",J)}}function A(S){var R,V;if(!f.value)return;const T=r.toValue(n)==="target";if(!h.value){$.clickConnectStart({event:S,nodeId:r.toValue(e),handleId:r.toValue(t)}),M({nodeId:r.toValue(e),type:r.toValue(n),id:r.toValue(t),position:oe.Top,...Ae(S)},void 0,!0);return}let I=r.toValue(o)||W.value||Nn;const Y=v(r.toValue(e));if(!I&&Y&&(I=(T?Y.isValidSourcePos:Y.isValidTargetPos)||Nn),Y&&(typeof Y.connectable>"u"?g.value:Y.connectable)===!1)return;const X=ys(S.target),J=Hs(S,{handle:{nodeId:r.toValue(e),id:r.toValue(t),type:r.toValue(n),position:oe.Top,...Ae(S)},connectionMode:c.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:I,doc:X,lib:"vue",flowId:a,nodeLookup:G.value},L.value,j.value,v,G.value),re=((R=J.connection)==null?void 0:R.source)===((V=J.connection)==null?void 0:V.target);J.isValid&&J.connection&&!re&&$.connect(J.connection),$.clickConnectEnd(S),C(S,!0)}return{handlePointerDown:_,handleClick:A}}function sf(){return r.inject(js,"")}function Qs(t){const e=t??sf()??"",n=r.inject(Zs,r.ref(null)),{findNode:o,edges:i,emits:s}=ge(),l=o(e);return l||s.error(new ye(pe.NODE_NOT_FOUND,e)),{id:e,nodeEl:n,node:l,parentNode:r.computed(()=>o(l.parentNode)),connectedEdges:r.computed(()=>Cs([l],i.value))}}function rf(){return{doubleClick:Q(),click:Q(),mouseEnter:Q(),mouseMove:Q(),mouseLeave:Q(),contextMenu:Q(),dragStart:Q(),drag:Q(),dragStop:Q()}}function lf(t,e){const n=rf();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 Js(){const{getSelectedNodes:t,nodeExtent:e,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:s,nodesDraggable:l,emits:a}=ge();return(d,c=!1)=>{const u=s.value?i.value[0]:5,f=s.value?i.value[1]:5,h=c?4:1,g=d.x*u*h,p=d.y*f*h,m=[];for(const v of t.value)if(v.draggable||l&&typeof v.draggable>"u"){const E={x:v.computedPosition.x+g,y:v.computedPosition.y+p},{position:M}=ko(v,E,a.error,e.value,v.parentNode?o(v.parentNode):void 0);m.push({id:v.id,position:M,from:v.position,distance:{x:d.x,y:d.y},dimensions:v.dimensions})}n(m,!0,!1)}}const kn=.1,af=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2;function je(){return Vt("Viewport not initialized yet."),Promise.resolve(!1)}const cf={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 df(t){function e(o,i){return new Promise(s=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(i?.interpolate==="linear"?Mt:an).scaleBy(Bo(t.d3Selection,i?.duration,i?.ease,()=>{s(!0)}),o):s(!1)})}function n(o,i,s,l){return new Promise(a=>{var d;const{x:c,y:u}=ms({x:-o,y:-i},t.translateExtent),f=ut.translate(-c,-u).scale(s);t.d3Selection&&t.d3Zoom?(d=t.d3Zoom)==null||d.interpolate(l?.interpolate==="linear"?Mt:an).transform(Bo(t.d3Selection,l?.duration,l?.ease,()=>{a(!0)}),f):a(!1)})}return r.computed(()=>t.d3Zoom&&t.d3Selection&&t.dimensions.width&&t.dimensions.height?{viewportInitialized:!0,zoomIn:i=>e(1.2,i),zoomOut:i=>e(1/1.2,i),zoomTo:(i,s)=>new Promise(l=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(s?.interpolate==="linear"?Mt:an).scaleTo(Bo(t.d3Selection,s?.duration,s?.ease,()=>{l(!0)}),i):l(!1)}),setViewport:(i,s)=>n(i.x,i.y,i.zoom,s),setTransform:(i,s)=>n(i.x,i.y,i.zoom,s),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:(i={padding:kn,includeHiddenNodes:!1,duration:0})=>{var s,l;const a=[];for(const h of t.nodes)h.dimensions.width&&h.dimensions.height&&(i?.includeHiddenNodes||!h.hidden)&&(!((s=i.nodes)!=null&&s.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(h.id))&&a.push(h);if(!a.length)return Promise.resolve(!1);const d=xs(a),{x:c,y:u,zoom:f}=Ns(d,t.dimensions.width,t.dimensions.height,i.minZoom??t.minZoom,i.maxZoom??t.maxZoom,i.padding??kn);return n(c,u,f,i)},setCenter:(i,s,l)=>{const a=typeof l?.zoom<"u"?l.zoom:t.maxZoom,d=t.dimensions.width/2-i*a,c=t.dimensions.height/2-s*a;return n(d,c,a,l)},fitBounds:(i,s={padding:kn})=>{const{x:l,y:a,zoom:d}=Ns(i,t.dimensions.width,t.dimensions.height,t.minZoom,t.maxZoom,s.padding??kn);return n(l,a,d,s)},project:i=>Ot(i,t.viewport,t.snapToGrid,t.snapGrid),screenToFlowCoordinate:i=>{if(t.vueFlowRef){const{x:s,y:l}=t.vueFlowRef.getBoundingClientRect(),a={x:i.x-s,y:i.y-l};return Ot(a,t.viewport,t.snapToGrid,t.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(t.vueFlowRef){const{x:s,y:l}=t.vueFlowRef.getBoundingClientRect(),a={x:i.x+s,y:i.y+l};return Pt(a,t.viewport)}return{x:0,y:0}}}:cf)}function Bo(t,e=0,n=af,o=()=>{}){const i=typeof e=="number"&&e>0;return i||o(),i?t.transition().duration(e).ease(n).on("end",o):t}function uf(t,e,n){const o=r.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let m,v,E=!!(n.nodes.value.length||n.edges.value.length);m=rt([t.modelValue,()=>{var M,y;return(y=(M=t.modelValue)==null?void 0:M.value)==null?void 0:y.length}],([M])=>{M&&Array.isArray(M)&&(v?.pause(),n.setElements(M),!v&&!E&&M.length?E=!0:v?.resume())}),v=rt([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([M,y])=>{var C;(C=t.modelValue)!=null&&C.value&&Array.isArray(t.modelValue.value)&&(m?.pause(),t.modelValue.value=[...M,...y],r.nextTick(()=>{m?.resume()}))},{immediate:E}),r.onScopeDispose(()=>{m?.stop(),v?.stop()})})},s=()=>{o.run(()=>{let m,v,E=!!n.nodes.value.length;m=rt([t.nodes,()=>{var M,y;return(y=(M=t.nodes)==null?void 0:M.value)==null?void 0:y.length}],([M])=>{M&&Array.isArray(M)&&(v?.pause(),n.setNodes(M),!v&&!E&&M.length?E=!0:v?.resume())}),v=rt([n.nodes,()=>n.nodes.value.length],([M])=>{var y;(y=t.nodes)!=null&&y.value&&Array.isArray(t.nodes.value)&&(m?.pause(),t.nodes.value=[...M],r.nextTick(()=>{m?.resume()}))},{immediate:E}),r.onScopeDispose(()=>{m?.stop(),v?.stop()})})},l=()=>{o.run(()=>{let m,v,E=!!n.edges.value.length;m=rt([t.edges,()=>{var M,y;return(y=(M=t.edges)==null?void 0:M.value)==null?void 0:y.length}],([M])=>{M&&Array.isArray(M)&&(v?.pause(),n.setEdges(M),!v&&!E&&M.length?E=!0:v?.resume())}),v=rt([n.edges,()=>n.edges.value.length],([M])=>{var y;(y=t.edges)!=null&&y.value&&Array.isArray(t.edges.value)&&(m?.pause(),t.edges.value=[...M],r.nextTick(()=>{m?.resume()}))},{immediate:E}),r.onScopeDispose(()=>{m?.stop(),v?.stop()})})},a=()=>{o.run(()=>{r.watch(()=>e.maxZoom,()=>{e.maxZoom&&me(e.maxZoom)&&n.setMaxZoom(e.maxZoom)},{immediate:!0})})},d=()=>{o.run(()=>{r.watch(()=>e.minZoom,()=>{e.minZoom&&me(e.minZoom)&&n.setMinZoom(e.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{r.watch(()=>e.translateExtent,()=>{e.translateExtent&&me(e.translateExtent)&&n.setTranslateExtent(e.translateExtent)},{immediate:!0})})},u=()=>{o.run(()=>{r.watch(()=>e.nodeExtent,()=>{e.nodeExtent&&me(e.nodeExtent)&&n.setNodeExtent(e.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{r.watch(()=>e.applyDefault,()=>{me(e.applyDefault)&&(n.applyDefault.value=e.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const m=async v=>{let E=v;typeof e.autoConnect=="function"&&(E=await e.autoConnect(v)),E!==!1&&n.addEdges([E])};r.watch(()=>e.autoConnect,()=>{me(e.autoConnect)&&(n.autoConnect.value=e.autoConnect)},{immediate:!0}),r.watch(n.autoConnect,(v,E,M)=>{v?n.onConnect(m):n.hooks.value.connect.off(m),M(()=>{n.hooks.value.connect.off(m)})},{immediate:!0})})},g=()=>{const m=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const v of Object.keys(e)){const E=v;if(!m.includes(E)){const M=r.toRef(()=>e[E]),y=n[E];r.isRef(y)&&o.run(()=>{r.watch(M,C=>{me(C)&&(y.value=C)},{immediate:!0})})}}};i(),s(),l(),d(),a(),c(),u(),f(),h(),g()}),()=>o.stop()}function ff(){return{edgesChange:Q(),nodesChange:Q(),nodeDoubleClick:Q(),nodeClick:Q(),nodeMouseEnter:Q(),nodeMouseMove:Q(),nodeMouseLeave:Q(),nodeContextMenu:Q(),nodeDragStart:Q(),nodeDrag:Q(),nodeDragStop:Q(),nodesInitialized:Q(),miniMapNodeClick:Q(),miniMapNodeDoubleClick:Q(),miniMapNodeMouseEnter:Q(),miniMapNodeMouseMove:Q(),miniMapNodeMouseLeave:Q(),connect:Q(),connectStart:Q(),connectEnd:Q(),clickConnectStart:Q(),clickConnectEnd:Q(),paneReady:Q(),init:Q(),move:Q(),moveStart:Q(),moveEnd:Q(),selectionDragStart:Q(),selectionDrag:Q(),selectionDragStop:Q(),selectionContextMenu:Q(),selectionStart:Q(),selectionEnd:Q(),viewportChangeStart:Q(),viewportChange:Q(),viewportChangeEnd:Q(),paneScroll:Q(),paneClick:Q(),paneContextMenu:Q(),paneMouseEnter:Q(),paneMouseMove:Q(),paneMouseLeave:Q(),edgeContextMenu:Q(),edgeMouseEnter:Q(),edgeMouseMove:Q(),edgeMouseLeave:Q(),edgeDoubleClick:Q(),edgeClick:Q(),edgeUpdateStart:Q(),edgeUpdate:Q(),edgeUpdateEnd:Q(),updateNodeInternals:Q(),error:Q(t=>Vt(t.message))}}function hf(t,e){const n=r.getCurrentInstance();r.onBeforeMount(()=>{for(const[i,s]of Object.entries(e.value)){const l=a=>{t(i,a)};s.setEmitter(l),xt(s.removeEmitter),s.setHasEmitListeners(()=>o(i)),xt(s.removeHasEmitListeners)}});function o(i){var s;const l=gf(i);return!!((s=n?.vnode.props)==null?void 0:s[l])}}function gf(t){const[e,...n]=t.split(":");return`on${e.replace(/(?:^|-)(\w)/g,(i,s)=>s.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function er(){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:xo.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Rt.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:et.Bezier,style:{}},connectionMode:Le.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.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:xn()?"Meta":"Control",zoomActivationKeyCode:xn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:ff(),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:""}}const pf=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function mf(t,e,n){const o=df(t),i=b=>{const w=b??[];t.hooks.updateNodeInternals.trigger(w)},s=b=>Du(b,t.nodes,t.edges),l=b=>Mu(b,t.nodes,t.edges),a=b=>Cs(b,t.edges),d=({id:b,type:w,nodeId:x})=>{var D;const k=b?`-${w}-${b}`:`-${w}`;return Array.from(((D=t.connectionLookup.get(`${x}${k}`))==null?void 0:D.values())??[])},c=b=>{if(b)return e.value.get(b)},u=b=>{if(b)return n.value.get(b)},f=(b,w,x)=>{var D,k;const ee=[];for(const ne of b){const le={id:ne.id,type:"position",dragging:x,from:ne.from};if(w&&(le.position=ne.position,ne.parentNode)){const se=c(ne.parentNode);le.position={x:le.position.x-(((D=se?.computedPosition)==null?void 0:D.x)??0),y:le.position.y-(((k=se?.computedPosition)==null?void 0:k.y)??0)}}ee.push(le)}ee?.length&&t.hooks.nodesChange.trigger(ee)},h=b=>{if(!t.vueFlowRef)return;const w=t.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!w)return;const x=window.getComputedStyle(w),{m22:D}=new window.DOMMatrixReadOnly(x.transform),k=[];for(const ee of b){const ne=ee,le=c(ne.id);if(le){const se=_n(ne.nodeElement);if(!!(se.width&&se.height&&(le.dimensions.width!==se.width||le.dimensions.height!==se.height||ne.forceUpdate))){const fe=ne.nodeElement.getBoundingClientRect();le.dimensions=se,le.handleBounds.source=Gs("source",ne.nodeElement,fe,D,le.id),le.handleBounds.target=Gs("target",ne.nodeElement,fe,D,le.id),k.push({id:le.id,type:"dimensions",dimensions:se})}}}!t.fitViewOnInitDone&&t.fitViewOnInit&&o.value.fitView().then(()=>{t.fitViewOnInitDone=!0}),k.length&&t.hooks.nodesChange.trigger(k)},g=(b,w)=>{const x=new Set,D=new Set;for(const ne of b)nt(ne)?x.add(ne.id):Ye(ne)&&D.add(ne.id);const k=Xe(e.value,x,!0),ee=Xe(n.value,D);if(t.multiSelectionActive){for(const ne of x)k.push(Ue(ne,w));for(const ne of D)ee.push(Ue(ne,w))}k.length&&t.hooks.nodesChange.trigger(k),ee.length&&t.hooks.edgesChange.trigger(ee)},p=b=>{if(t.multiSelectionActive){const w=b.map(x=>Ue(x.id,!0));t.hooks.nodesChange.trigger(w);return}t.hooks.nodesChange.trigger(Xe(e.value,new Set(b.map(w=>w.id)),!0)),t.hooks.edgesChange.trigger(Xe(n.value))},m=b=>{if(t.multiSelectionActive){const w=b.map(x=>Ue(x.id,!0));t.hooks.edgesChange.trigger(w);return}t.hooks.edgesChange.trigger(Xe(n.value,new Set(b.map(w=>w.id)))),t.hooks.nodesChange.trigger(Xe(e.value,new Set,!0))},v=b=>{g(b,!0)},E=b=>{const x=(b||t.nodes).map(D=>(D.selected=!1,Ue(D.id,!1)));t.hooks.nodesChange.trigger(x)},M=b=>{const x=(b||t.edges).map(D=>(D.selected=!1,Ue(D.id,!1)));t.hooks.edgesChange.trigger(x)},y=b=>{if(!b||!b.length)return g([],!1);const w=b.reduce((x,D)=>{const k=Ue(D.id,!1);return nt(D)?x.nodes.push(k):x.edges.push(k),x},{nodes:[],edges:[]});w.nodes.length&&t.hooks.nodesChange.trigger(w.nodes),w.edges.length&&t.hooks.edgesChange.trigger(w.edges)},C=b=>{var w;(w=t.d3Zoom)==null||w.scaleExtent([b,t.maxZoom]),t.minZoom=b},$=b=>{var w;(w=t.d3Zoom)==null||w.scaleExtent([t.minZoom,b]),t.maxZoom=b},O=b=>{var w;(w=t.d3Zoom)==null||w.translateExtent(b),t.translateExtent=b},L=b=>{t.nodeExtent=b,i()},j=b=>{var w;(w=t.d3Zoom)==null||w.clickDistance(b)},W=b=>{t.nodesDraggable=b,t.nodesConnectable=b,t.elementsSelectable=b},G=b=>{const w=b instanceof Function?b(t.nodes):b;!t.initialized&&!w.length||(t.nodes=Ws(w,c,t.hooks.error.trigger))},F=b=>{const w=b instanceof Function?b(t.edges):b;if(!t.initialized&&!w.length)return;const x=Io(w,t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);To(t.connectionLookup,n.value,x),t.edges=x},N=b=>{const w=b instanceof Function?b([...t.nodes,...t.edges]):b;!t.initialized&&!w.length||(G(w.filter(nt)),F(w.filter(Ye)))},H=b=>{let w=b instanceof Function?b(t.nodes):b;w=Array.isArray(w)?w:[w];const x=Ws(w,c,t.hooks.error.trigger),D=[];for(const k of x)D.push(Ts(k));D.length&&t.hooks.nodesChange.trigger(D)},_=b=>{let w=b instanceof Function?b(t.edges):b;w=Array.isArray(w)?w:[w];const x=Io(w,t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges),D=[];for(const k of x)D.push(Ts(k));D.length&&t.hooks.edgesChange.trigger(D)},A=(b,w=!0,x=!1)=>{const D=b instanceof Function?b(t.nodes):b,k=Array.isArray(D)?D:[D],ee=[],ne=[];function le(ue){const fe=a(ue);for(const he of fe)(!me(he.deletable)||he.deletable)&&ne.push(Bs(he.id,he.source,he.target,he.sourceHandle,he.targetHandle))}function se(ue){const fe=[];for(const he of t.nodes)he.parentNode===ue&&fe.push(he);if(fe.length){for(const he of fe)ee.push(Is(he.id));w&&le(fe);for(const he of fe)se(he.id)}}for(const ue of k){const fe=typeof ue=="string"?c(ue):ue;fe&&(me(fe.deletable)&&!fe.deletable||(ee.push(Is(fe.id)),w&&le([fe]),x&&se(fe.id)))}ne.length&&t.hooks.edgesChange.trigger(ne),ee.length&&t.hooks.nodesChange.trigger(ee)},S=b=>{const w=b instanceof Function?b(t.edges):b,x=Array.isArray(w)?w:[w],D=[];for(const k of x){const ee=typeof k=="string"?u(k):k;ee&&(me(ee.deletable)&&!ee.deletable||D.push(Bs(typeof k=="string"?k:k.id,ee.source,ee.target,ee.sourceHandle,ee.targetHandle)))}t.hooks.edgesChange.trigger(D)},R=(b,w,x=!0)=>{const D=u(b.id);if(!D)return!1;const k=t.edges.indexOf(D),ee=Qu(b,w,D,x,t.hooks.error.trigger);if(ee){const[ne]=Io([ee],t.isValidConnection,c,u,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);return t.edges=t.edges.map((le,se)=>se===k?ne:le),To(t.connectionLookup,n.value,[ne]),ne}return!1},V=(b,w,x={replace:!1})=>{const D=u(b);if(!D)return;const k=typeof w=="function"?w(D):w;D.data=x.replace?k:{...D.data,...k}},T=b=>zs(b,t.nodes),I=b=>{const w=zs(b,t.edges);return To(t.connectionLookup,n.value,w),w},Y=(b,w,x={replace:!1})=>{const D=c(b);if(!D)return;const k=typeof w=="function"?w(D):w;x.replace?t.nodes.splice(t.nodes.indexOf(D),1,k):Object.assign(D,k)},X=(b,w,x={replace:!1})=>{const D=c(b);if(!D)return;const k=typeof w=="function"?w(D):w;D.data=x.replace?k:{...D.data,...k}},J=(b,w,x=!1)=>{x?t.connectionClickStartHandle=b:t.connectionStartHandle=b,t.connectionEndHandle=null,t.connectionStatus=null,w&&(t.connectionPosition=w)},re=(b,w=null,x=null)=>{t.connectionStartHandle&&(t.connectionPosition=b,t.connectionEndHandle=w,t.connectionStatus=x)},P=(b,w)=>{t.connectionPosition={x:Number.NaN,y:Number.NaN},t.connectionEndHandle=null,t.connectionStatus=null,w?t.connectionClickStartHandle=null:t.connectionStartHandle=null},Z=b=>{const w=ku(b),x=w?null:$t(b)?b:c(b.id);return!w&&!x?[null,null,w]:[w?b:vn(x),x,w]},B=(b,w=!0,x=t.nodes)=>{const[D,k,ee]=Z(b);if(!D)return[];const ne=[];for(const le of x||t.nodes){if(!ee&&(le.id===k.id||!le.computedPosition))continue;const se=vn(le),ue=wn(se,D);(w&&ue>0||ue>=se.width*se.height||ue>=Number(D.width)*Number(D.height))&&ne.push(le)}return ne},U=(b,w,x=!0)=>{const[D]=Z(b);if(!D)return!1;const k=wn(D,w);return x&&k>0||k>=Number(D.width)*Number(D.height)},K=b=>{const{viewport:w,dimensions:x,d3Zoom:D,d3Selection:k,translateExtent:ee}=t;if(!D||!k||!b.x&&!b.y)return!1;const ne=ut.translate(w.x+b.x,w.y+b.y).scale(w.zoom),le=[[0,0],[x.width,x.height]],se=D.constrain()(ne,le,ee),ue=t.viewport.x!==se.x||t.viewport.y!==se.y||t.viewport.zoom!==se.k;return D.transform(k,se),ue},te=b=>{const w=b instanceof Function?b(t):b,x=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];me(w.defaultEdgeOptions)&&(t.defaultEdgeOptions=w.defaultEdgeOptions);const D=w.modelValue||w.nodes||w.edges?[]:void 0;D&&(w.modelValue&&D.push(...w.modelValue),w.nodes&&D.push(...w.nodes),w.edges&&D.push(...w.edges),N(D));const k=()=>{me(w.maxZoom)&&$(w.maxZoom),me(w.minZoom)&&C(w.minZoom),me(w.translateExtent)&&O(w.translateExtent)};for(const ee of Object.keys(w)){const ne=ee,le=w[ne];![...pf,...x].includes(ne)&&me(le)&&(t[ne]=le)}eo(()=>t.d3Zoom).not.toBeNull().then(k),t.initialized||(t.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:N,setNodes:G,setEdges:F,addNodes:H,addEdges:_,removeNodes:A,removeEdges:S,findNode:c,findEdge:u,updateEdge:R,updateEdgeData:V,updateNode:Y,updateNodeData:X,applyEdgeChanges:I,applyNodeChanges:T,addSelectedElements:v,addSelectedNodes:p,addSelectedEdges:m,setMinZoom:C,setMaxZoom:$,setTranslateExtent:O,setNodeExtent:L,setPaneClickDistance:j,removeSelectedElements:y,removeSelectedNodes:E,removeSelectedEdges:M,startConnection:J,updateConnection:re,endConnection:P,setInteractive:W,setState:te,getIntersectingNodes:B,getIncomers:s,getOutgoers:l,getConnectedEdges:a,getHandleConnections:d,isNodeIntersecting:U,panBy:K,fitView:b=>o.value.fitView(b),zoomIn:b=>o.value.zoomIn(b),zoomOut:b=>o.value.zoomOut(b),zoomTo:(b,w)=>o.value.zoomTo(b,w),setViewport:(b,w)=>o.value.setViewport(b,w),setTransform:(b,w)=>o.value.setTransform(b,w),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(b,w,x)=>o.value.setCenter(b,w,x),fitBounds:(b,w)=>o.value.fitBounds(b,w),project:b=>o.value.project(b),screenToFlowCoordinate:b=>o.value.screenToFlowCoordinate(b),flowToScreenCoordinate:b=>o.value.flowToScreenCoordinate(b),toObject:()=>{const b=[],w=[];for(const x of t.nodes){const{computedPosition:D,handleBounds:k,selected:ee,dimensions:ne,isParent:le,resizing:se,dragging:ue,events:fe,...he}=x;b.push(he)}for(const x of t.edges){const{selected:D,sourceNode:k,targetNode:ee,events:ne,...le}=x;w.push(le)}return JSON.parse(JSON.stringify({nodes:b,edges:w,position:[t.viewport.x,t.viewport.y],zoom:t.viewport.zoom,viewport:t.viewport}))},fromObject:b=>new Promise(w=>{const{nodes:x,edges:D,position:k,zoom:ee,viewport:ne}=b;x&&G(x),D&&F(D);const[le,se]=ne?.x&&ne?.y?[ne.x,ne.y]:k??[null,null];if(le&&se){const ue=ne?.zoom||ee||t.viewport.zoom;return eo(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:le,y:se,zoom:ue}).then(()=>{w(!0)})})}else w(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const b=er();if(t.edges=[],t.nodes=[],t.d3Zoom&&t.d3Selection){const w=ut.translate(b.defaultViewport.x??0,b.defaultViewport.y??0).scale(tt(b.defaultViewport.zoom??1,b.minZoom,b.maxZoom)),x=t.viewportRef.getBoundingClientRect(),D=[[0,0],[x.width,x.height]],k=t.d3Zoom.constrain()(w,D,b.translateExtent);t.d3Zoom.transform(t.d3Selection,k)}te(b)},$destroy:()=>{}}}const yf=["data-id","data-handleid","data-nodeid","data-handlepos"],vf={name:"Handle",compatConfig:{MODE:3}},pt=r.defineComponent({...vf,props:{id:{default:null},type:{},position:{default:()=>oe.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=r.createPropsRestProxy(t,["position","connectable","connectableStart","connectableEnd","id"]),o=r.toRef(()=>n.type??"source"),i=r.toRef(()=>n.isValidConnection??null),{id:s,connectionStartHandle:l,connectionClickStartHandle:a,connectionEndHandle:d,vueFlowRef:c,nodesConnectable:u,noDragClassName:f,noPanClassName:h}=ge(),{id:g,node:p,nodeEl:m,connectedEdges:v}=Qs(),E=r.ref(),M=r.toRef(()=>typeof t.connectableStart<"u"?t.connectableStart:!0),y=r.toRef(()=>typeof t.connectableEnd<"u"?t.connectableEnd:!0),C=r.toRef(()=>{var F,N,H,_,A,S;return((F=l.value)==null?void 0:F.nodeId)===g&&((N=l.value)==null?void 0:N.id)===t.id&&((H=l.value)==null?void 0:H.type)===o.value||((_=d.value)==null?void 0:_.nodeId)===g&&((A=d.value)==null?void 0:A.id)===t.id&&((S=d.value)==null?void 0:S.type)===o.value}),$=r.toRef(()=>{var F,N,H;return((F=a.value)==null?void 0:F.nodeId)===g&&((N=a.value)==null?void 0:N.id)===t.id&&((H=a.value)==null?void 0:H.type)===o.value}),{handlePointerDown:O,handleClick:L}=Ks({nodeId:g,handleId:t.id,isValidConnection:i,type:o}),j=r.computed(()=>typeof t.connectable=="string"&&t.connectable==="single"?!v.value.some(F=>{const N=F[`${o.value}Handle`];return F[o.value]!==g?!1:N?N===t.id:!0}):typeof t.connectable=="number"?v.value.filter(F=>{const N=F[`${o.value}Handle`];return F[o.value]!==g?!1:N?N===t.id:!0}).length<t.connectable:typeof t.connectable=="function"?t.connectable(p,v.value):me(t.connectable)?t.connectable:u.value);r.onMounted(()=>{var F;if(!p.dimensions.width||!p.dimensions.height)return;const N=(F=p.handleBounds[o.value])==null?void 0:F.find(T=>T.id===t.id);if(!c.value||N)return;const H=c.value.querySelector(".vue-flow__transformationpane");if(!m.value||!E.value||!H||!t.id)return;const _=m.value.getBoundingClientRect(),A=E.value.getBoundingClientRect(),S=window.getComputedStyle(H),{m22:R}=new window.DOMMatrixReadOnly(S.transform),V={id:t.id,position:t.position,x:(A.left-_.left)/R,y:(A.top-_.top)/R,type:o.value,nodeId:g,..._n(E.value)};p.handleBounds[o.value]=[...p.handleBounds[o.value]??[],V]});function W(F){const N=So(F);j.value&&M.value&&(N&&F.button===0||!N)&&O(F)}function G(F){!g||!a.value&&!M.value||j.value&&L(F)}return e({handleClick:L,handlePointerDown:O,onClick:G,onPointerDown:W}),(F,N)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"handle",ref:E,"data-id":`${r.unref(s)}-${r.unref(g)}-${t.id}-${o.value}`,"data-handleid":t.id,"data-nodeid":r.unref(g),"data-handlepos":F.position,class:r.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${F.position}`,`vue-flow__handle-${t.id}`,r.unref(f),r.unref(h),o.value,{connectable:j.value,connecting:$.value,connectablestart:M.value,connectableend:y.value,connectionindicator:j.value&&(M.value&&!C.value||y.value&&C.value)}]]),onMousedown:W,onTouchstartPassive:W,onClick:G},[r.renderSlot(F.$slots,"default",{id:F.id})],42,yf))}}),Sn=function({sourcePosition:t=oe.Bottom,targetPosition:e=oe.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:s,data:l}){const a=l.label??n;return[r.h(pt,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof a!="string"&&a?r.h(a):r.h(r.Fragment,[a]),r.h(pt,{type:"source",position:t,connectable:o,isValidConnection:s})]};Sn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Sn.inheritAttrs=!1,Sn.compatConfig={MODE:3};const wf=Sn,Mn=function({targetPosition:t=oe.Top,label:e,connectable:n=!0,isValidTargetPos:o,data:i}){const s=i.label??e;return[r.h(pt,{type:"target",position:t,connectable:n,isValidConnection:o}),typeof s!="string"&&s?r.h(s):r.h(r.Fragment,[s])]};Mn.props=["targetPosition","label","isValidTargetPos","connectable","data"],Mn.inheritAttrs=!1,Mn.compatConfig={MODE:3};const _f=Mn,Dn=function({sourcePosition:t=oe.Bottom,label:e,connectable:n=!0,isValidSourcePos:o,data:i}){const s=i.label??e;return[typeof s!="string"&&s?r.h(s):r.h(r.Fragment,[s]),r.h(pt,{type:"source",position:t,connectable:n,isValidConnection:o})]};Dn.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Dn.inheritAttrs=!1,Dn.compatConfig={MODE:3};const bf=Dn,xf=["transform"],Ef=["width","height","x","y","rx","ry"],Cf=["y"],Nf={name:"EdgeText",compatConfig:{MODE:3}},kf=r.defineComponent({...Nf,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(t){const e=r.ref({x:0,y:0,width:0,height:0}),n=r.ref(null),o=r.computed(()=>`translate(${t.x-e.value.width/2} ${t.y-e.value.height/2})`);r.onMounted(i),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,l)=>(r.openBlock(),r.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[s.labelShowBg?(r.openBlock(),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:r.normalizeStyle(s.labelBgStyle),rx:s.labelBgBorderRadius,ry:s.labelBgBorderRadius},null,12,Ef)):r.createCommentVNode("",!0),r.createElementVNode("text",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}),[r.renderSlot(s.$slots,"default",{},()=>[typeof s.label!="string"?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(s.label),{key:0})):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createTextVNode(r.toDisplayString(s.label),1)],64))])],16,Cf)],8,xf))}}),Sf=["id","d","marker-end","marker-start"],Mf=["d","stroke-width"],Df={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Lt=r.defineComponent({...Df,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(t,{expose:e}){const n=r.ref(null),o=r.ref(null),i=r.ref(null),s=r.useAttrs();return e({pathEl:n,interactionEl:o,labelEl:i}),(l,a)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("path",r.mergeProps(r.unref(s),{id:l.id,ref_key:"pathEl",ref:n,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,Sf),l.interactionWidth?(r.openBlock(),r.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Mf)):r.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(r.openBlock(),r.createBlock(kf,{key:1,ref_key:"labelEl",ref:i,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):r.createCommentVNode("",!0)],64))}});function tr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const i=Math.abs(n-t)/2,s=n<t?n+i:n-i,l=Math.abs(o-e)/2,a=o<e?o+l:o-l;return[s,a,i,l]}function nr({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:i,sourceControlY:s,targetControlX:l,targetControlY:a}){const d=t*.125+i*.375+l*.375+n*.125,c=e*.125+s*.375+a*.375+o*.125,u=Math.abs(d-t),f=Math.abs(c-e);return[d,c,u,f]}function zn(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function or({pos:t,x1:e,y1:n,x2:o,y2:i,c:s}){let l,a;switch(t){case oe.Left:l=e-zn(e-o,s),a=n;break;case oe.Right:l=e+zn(o-e,s),a=n;break;case oe.Top:l=e,a=n-zn(n-i,s);break;case oe.Bottom:l=e,a=n+zn(i-n,s);break}return[l,a]}function Ro(t){const{sourceX:e,sourceY:n,sourcePosition:o=oe.Bottom,targetX:i,targetY:s,targetPosition:l=oe.Top,curvature:a=.25}=t,[d,c]=or({pos:o,x1:e,y1:n,x2:i,y2:s,c:a}),[u,f]=or({pos:l,x1:i,y1:s,x2:e,y2:n,c:a}),[h,g,p,m]=nr({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:d,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${n} C${d},${c} ${u},${f} ${i},${s}`,h,g,p,m]}function ir({pos:t,x1:e,y1:n,x2:o,y2:i}){let s,l;switch(t){case oe.Left:case oe.Right:s=.5*(e+o),l=n;break;case oe.Top:case oe.Bottom:s=e,l=.5*(n+i);break}return[s,l]}function sr(t){const{sourceX:e,sourceY:n,sourcePosition:o=oe.Bottom,targetX:i,targetY:s,targetPosition:l=oe.Top}=t,[a,d]=ir({pos:o,x1:e,y1:n,x2:i,y2:s}),[c,u]=ir({pos:l,x1:i,y1:s,x2:e,y2:n}),[f,h,g,p]=nr({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:a,sourceControlY:d,targetControlX:c,targetControlY:u});return[`M${e},${n} C${a},${d} ${c},${u} ${i},${s}`,f,h,g,p]}const rr={[oe.Left]:{x:-1,y:0},[oe.Right]:{x:1,y:0},[oe.Top]:{x:0,y:-1},[oe.Bottom]:{x:0,y:1}};function zf({source:t,sourcePosition:e=oe.Bottom,target:n}){return e===oe.Left||e===oe.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 lr(t,e){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Tf({source:t,sourcePosition:e=oe.Bottom,target:n,targetPosition:o=oe.Top,center:i,offset:s}){const l=rr[e],a=rr[o],d={x:t.x+l.x*s,y:t.y+l.y*s},c={x:n.x+a.x*s,y:n.y+a.y*s},u=zf({source:d,sourcePosition:e,target:c}),f=u.x!==0?"x":"y",h=u[f];let g,p,m;const v={x:0,y:0},E={x:0,y:0},[M,y,C,$]=tr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(l[f]*a[f]===-1){p=i.x??M,m=i.y??y;const L=[{x:p,y:d.y},{x:p,y:c.y}],j=[{x:d.x,y:m},{x:c.x,y:m}];l[f]===h?g=f==="x"?L:j:g=f==="x"?j:L}else{const L=[{x:d.x,y:c.y}],j=[{x:c.x,y:d.y}];if(f==="x"?g=l.x===h?j:L:g=l.y===h?L:j,e===o){const H=Math.abs(t[f]-n[f]);if(H<=s){const _=Math.min(s-1,s-H);l[f]===h?v[f]=(d[f]>t[f]?-1:1)*_:E[f]=(c[f]>n[f]?-1:1)*_}}if(e!==o){const H=f==="x"?"y":"x",_=l[f]===a[H],A=d[H]>c[H],S=d[H]<c[H];(l[f]===1&&(!_&&A||_&&S)||l[f]!==1&&(!_&&S||_&&A))&&(g=f==="x"?L:j)}const W={x:d.x+v.x,y:d.y+v.y},G={x:c.x+E.x,y:c.y+E.y},F=Math.max(Math.abs(W.x-g[0].x),Math.abs(G.x-g[0].x)),N=Math.max(Math.abs(W.y-g[0].y),Math.abs(G.y-g[0].y));F>=N?(p=(W.x+G.x)/2,m=g[0].y):(p=g[0].x,m=(W.y+G.y)/2)}return[[t,{x:d.x+v.x,y:d.y+v.y},...g,{x:c.x+E.x,y:c.y+E.y},n],p,m,C,$]}function If(t,e,n,o){const i=Math.min(lr(t,e)/2,lr(e,n)/2,o),{x:s,y:l}=e;if(t.x===s&&s===n.x||t.y===l&&l===n.y)return`L${s} ${l}`;if(t.y===l){const c=t.x<n.x?-1:1,u=t.y<n.y?1:-1;return`L ${s+i*c},${l}Q ${s},${l} ${s},${l+i*u}`}const a=t.x<n.x?1:-1,d=t.y<n.y?-1:1;return`L ${s},${l+i*d}Q ${s},${l} ${s+i*a},${l}`}function Ao(t){const{sourceX:e,sourceY:n,sourcePosition:o=oe.Bottom,targetX:i,targetY:s,targetPosition:l=oe.Top,borderRadius:a=5,centerX:d,centerY:c,offset:u=20}=t,[f,h,g,p,m]=Tf({source:{x:e,y:n},sourcePosition:o,target:{x:i,y:s},targetPosition:l,center:{x:d,y:c},offset:u});return[f.reduce((E,M,y)=>{let C;return y>0&&y<f.length-1?C=If(f[y-1],M,f[y+1],a):C=`${y===0?"M":"L"}${M.x} ${M.y}`,E+=C,E},""),h,g,p,m]}function Bf(t){const{sourceX:e,sourceY:n,targetX:o,targetY:i}=t,[s,l,a,d]=tr({sourceX:e,sourceY:n,targetX:o,targetY:i});return[`M ${e},${n}L ${o},${i}`,s,l,a,d]}const Rf=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]=Bf(t);return r.h(Lt,{path:n,labelX:o,labelY:i,...e,...t})}}}),ar=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]=Ao({...t,sourcePosition:t.sourcePosition??oe.Bottom,targetPosition:t.targetPosition??oe.Top});return r.h(Lt,{path:n,labelX:o,labelY:i,...e,...t})}}}),Af=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()=>r.h(ar,{...t,...e,borderRadius:0})}}),$f=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]=Ro({...t,sourcePosition:t.sourcePosition??oe.Bottom,targetPosition:t.targetPosition??oe.Top});return r.h(Lt,{path:n,labelX:o,labelY:i,...e,...t})}}}),Pf=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]=sr({...t,sourcePosition:t.sourcePosition??oe.Bottom,targetPosition:t.targetPosition??oe.Top});return r.h(Lt,{path:n,labelX:o,labelY:i,...e,...t})}}}),Of={input:bf,default:wf,output:_f},Hf={default:$f,straight:Rf,step:Af,smoothstep:ar,simplebezier:Pf};function Vf(t,e,n){const o=r.computed(()=>m=>e.value.get(m)),i=r.computed(()=>m=>n.value.get(m)),s=r.computed(()=>{const m={...Hf,...t.edgeTypes},v=Object.keys(m);for(const E of t.edges)E.type&&!v.includes(E.type)&&(m[E.type]=E.type);return m}),l=r.computed(()=>{const m={...Of,...t.nodeTypes},v=Object.keys(m);for(const E of t.nodes)E.type&&!v.includes(E.type)&&(m[E.type]=E.type);return m}),a=r.computed(()=>t.onlyRenderVisibleElements?Es(t.nodes,{x:0,y:0,width:t.dimensions.width,height:t.dimensions.height},t.viewport,!0):t.nodes),d=r.computed(()=>{if(t.onlyRenderVisibleElements){const m=[];for(const v of t.edges){const E=e.value.get(v.source),M=e.value.get(v.target);Vu({sourcePos:E.computedPosition||{x:0,y:0},targetPos:M.computedPosition||{x:0,y:0},sourceWidth:E.dimensions.width,sourceHeight:E.dimensions.height,targetWidth:M.dimensions.width,targetHeight:M.dimensions.height,width:t.dimensions.width,height:t.dimensions.height,viewport:t.viewport})&&m.push(v)}return m}return t.edges}),c=r.computed(()=>[...a.value,...d.value]),u=r.computed(()=>{const m=[];for(const v of t.nodes)v.selected&&m.push(v);return m}),f=r.computed(()=>{const m=[];for(const v of t.edges)v.selected&&m.push(v);return m}),h=r.computed(()=>[...u.value,...f.value]),g=r.computed(()=>{const m=[];for(const v of t.nodes)v.dimensions.width&&v.dimensions.height&&v.handleBounds!==void 0&&m.push(v);return m}),p=r.computed(()=>a.value.length>0&&g.value.length===a.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:s,getNodeTypes:l,getEdges:d,getNodes:a,getSelectedElements:h,getSelectedNodes:u,getSelectedEdges:f,getNodesInitialized:g,areNodesInitialized:p}}class ot{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var e;const n=(e=r.getCurrentInstance())==null?void 0:e.appContext.app,o=n?.config.globalProperties.$vueFlowStorage??ot.instance;return ot.instance=o??new ot,n&&(n.config.globalProperties.$vueFlowStorage=ot.instance),ot.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=er(),i=r.reactive(o),s={};for(const[h,g]of Object.entries(i.hooks)){const p=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;s[p]=g.on}const l={};for(const[h,g]of Object.entries(i.hooks))l[h]=g.trigger;const a=r.computed(()=>{const h=new Map;for(const g of i.nodes)h.set(g.id,g);return h}),d=r.computed(()=>{const h=new Map;for(const g of i.edges)h.set(g.id,g);return h}),c=Vf(i,a,d),u=mf(i,a,d);u.setState({...i,...n});const f={...s,...c,...u,...Al(i),nodeLookup:a,edgeLookup:d,emits:l,id:e,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(e)}};return this.set(e,f),f}getId(){return`vue-flow-${this.currentId++}`}}function ge(t){const e=ot.getInstance(),n=r.getCurrentScope(),o=typeof t=="object",i=o?t:{id:t},s=i.id,l=s??n?.vueFlowId;let a;if(n){const d=r.inject(Xs,null);typeof d<"u"&&d!==null&&(!l||d.id===l)&&(a=d)}if(a||l&&(a=e.get(l)),!a||l&&a.id!==l){const d=s??e.getId(),c=e.create(d,i);a=c,(n??r.effectScope(!0)).run(()=>{r.watch(c.applyDefault,(f,h,g)=>{const p=v=>{c.applyNodeChanges(v)},m=v=>{c.applyEdgeChanges(v)};f?(c.onNodesChange(p),c.onEdgesChange(m)):(c.hooks.value.nodesChange.off(p),c.hooks.value.edgesChange.off(m)),g(()=>{c.hooks.value.nodesChange.off(p),c.hooks.value.edgesChange.off(m)})},{immediate:!0}),xt(()=>{if(a){const f=e.get(a.id);f?f.$destroy():Vt(`No store instance found for id ${a.id} in storage.`)}})})}else o&&a.setState(i);if(n&&(r.provide(Xs,a),n.vueFlowId=a.id),o){const d=r.getCurrentInstance();d?.type.name!=="VueFlow"&&a.emits.error(new ye(pe.USEVUEFLOW_OPTIONS))}return a}function Lf(t){const{emits:e,dimensions:n}=ge();let o;r.onMounted(()=>{const i=()=>{var s,l;if(!t.value||!(((l=(s=t.value).checkVisibility)==null?void 0:l.call(s))??!0))return;const a=_n(t.value);(a.width===0||a.height===0)&&e.error(new ye(pe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:a.width||500,height:a.height||500}};i(),window.addEventListener("resize",i),t.value&&(o=new ResizeObserver(()=>i()),o.observe(t.value)),r.onBeforeUnmount(()=>{window.removeEventListener("resize",i),o&&t.value&&o.unobserve(t.value)})})}const Ff={name:"UserSelection",compatConfig:{MODE:3}},Gf=r.defineComponent({...Ff,props:{userSelectionRect:{}},setup(t){return(e,n)=>(r.openBlock(),r.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:r.normalizeStyle({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),Wf=["tabIndex"],Yf={name:"NodesSelection",compatConfig:{MODE:3}},Uf=r.defineComponent({...Yf,setup(t){const{emits:e,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:s,userSelectionActive:l}=ge(),a=Js(),d=r.ref(null),c=qs({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)}});r.onMounted(()=>{var p;s.value||(p=d.value)==null||p.focus({preventScroll:!0})});const u=r.computed(()=>xs(o.value)),f=r.computed(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function h(p){e.selectionContextMenu({event:p,nodes:o.value})}function g(p){s.value||ft[p.key]&&(p.preventDefault(),a({x:ft[p.key].x,y:ft[p.key].y},p.shiftKey))}return(p,m)=>!r.unref(l)&&u.value.width&&u.value.height?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["vue-flow__nodesselection vue-flow__container",r.unref(i)]),style:r.normalizeStyle({transform:`translate(${r.unref(n).x}px,${r.unref(n).y}px) scale(${r.unref(n).zoom})`})},[r.createElementVNode("div",{ref_key:"el",ref:d,class:r.normalizeClass([{dragging:r.unref(c)},"vue-flow__nodesselection-rect"]),style:r.normalizeStyle(f.value),tabIndex:r.unref(s)?void 0:-1,onContextmenu:h,onKeydown:g},null,46,Wf)],6)):r.createCommentVNode("",!0)}});function Xf(t,e){return{x:t.clientX-e.left,y:t.clientY-e.top}}const jf={name:"Pane",compatConfig:{MODE:3}},Zf=r.defineComponent({...jf,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(t){const{vueFlowRef:e,nodes:n,viewport:o,emits:i,userSelectionActive:s,removeSelectedElements:l,userSelectionRect:a,elementsSelectable:d,nodesSelectionActive:c,getSelectedEdges:u,getSelectedNodes:f,removeNodes:h,removeEdges:g,selectionMode:p,deleteKeyCode:m,multiSelectionKeyCode:v,multiSelectionActive:E,edgeLookup:M,nodeLookup:y,connectionLookup:C,defaultEdgeOptions:$,connectionStartHandle:O,panOnDrag:L}=ge(),j=r.shallowRef(null),W=r.shallowRef(new Set),G=r.shallowRef(new Set),F=r.shallowRef(null),N=r.toRef(()=>d.value&&(t.isSelecting||s.value)),H=r.toRef(()=>O.value!==null);let _=!1,A=!1;const S=At(m,{actInsideInputWithModifier:!1}),R=At(v);r.watch(S,P=>{P&&(h(f.value),g(u.value),c.value=!1)}),r.watch(R,P=>{E.value=P});function V(P,Z){return B=>{B.target===Z&&P?.(B)}}function T(P){if(_||H.value){_=!1;return}i.paneClick(P),l(),c.value=!1}function I(P){var Z;if(Array.isArray(L.value)&&((Z=L.value)!=null&&Z.includes(2))){P.preventDefault();return}i.paneContextMenu(P)}function Y(P){i.paneScroll(P)}function X(P){var Z,B,U;if(F.value=((Z=e.value)==null?void 0:Z.getBoundingClientRect())??null,!d.value||!t.isSelecting||P.button!==0||P.target!==j.value||!F.value)return;(U=(B=P.target)==null?void 0:B.setPointerCapture)==null||U.call(B,P.pointerId);const{x:K,y:te}=Xf(P,F.value);A=!0,_=!1,l(),a.value={width:0,height:0,startX:K,startY:te,x:K,y:te},i.selectionStart(P)}function J(P){var Z;if(!F.value||!a.value)return;_=!0;const{x:B,y:U}=Ae(P,F.value),{startX:K=0,startY:te=0}=a.value,ce={startX:K,startY:te,x:B<K?B:K,y:U<te?U:te,width:Math.abs(B-K),height:Math.abs(U-te)},q=W.value,ie=G.value;W.value=new Set(Es(n.value,ce,o.value,p.value===xo.Partial,!0).map(w=>w.id)),G.value=new Set;const b=((Z=$.value)==null?void 0:Z.selectable)??!0;for(const w of W.value){const x=C.value.get(w);if(x)for(const{edgeId:D}of x.values()){const k=M.value.get(D);k&&(k.selectable??b)&&G.value.add(D)}}if(!Us(q,W.value)){const w=Xe(y.value,W.value,!0);i.nodesChange(w)}if(!Us(ie,G.value)){const w=Xe(M.value,G.value);i.edgesChange(w)}a.value=ce,s.value=!0,c.value=!1}function re(P){var Z;P.button!==0||!A||((Z=P.target)==null||Z.releasePointerCapture(P.pointerId),!s.value&&a.value&&P.target===j.value&&T(P),s.value=!1,a.value=null,c.value=W.value.size>0,i.selectionEnd(P),t.selectionKeyPressed&&(_=!1),A=!1)}return(P,Z)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"container",ref:j,class:r.normalizeClass(["vue-flow__pane vue-flow__container",{selection:P.isSelecting}]),onClick:Z[0]||(Z[0]=B=>N.value?void 0:V(T,j.value)(B)),onContextmenu:Z[1]||(Z[1]=B=>V(I,j.value)(B)),onWheelPassive:Z[2]||(Z[2]=B=>V(Y,j.value)(B)),onPointerenter:Z[3]||(Z[3]=B=>N.value?void 0:r.unref(i).paneMouseEnter(B)),onPointerdown:Z[4]||(Z[4]=B=>N.value?X(B):r.unref(i).paneMouseMove(B)),onPointermove:Z[5]||(Z[5]=B=>N.value?J(B):r.unref(i).paneMouseMove(B)),onPointerup:Z[6]||(Z[6]=B=>N.value?re(B):void 0),onPointerleave:Z[7]||(Z[7]=B=>r.unref(i).paneMouseLeave(B))},[r.renderSlot(P.$slots,"default"),r.unref(s)&&r.unref(a)?(r.openBlock(),r.createBlock(Gf,{key:0,"user-selection-rect":r.unref(a)},null,8,["user-selection-rect"])):r.createCommentVNode("",!0),r.unref(c)&&r.unref(f).length?(r.openBlock(),r.createBlock(Uf,{key:1})):r.createCommentVNode("",!0)],34))}}),qf={name:"Transform",compatConfig:{MODE:3}},Kf=r.defineComponent({...qf,setup(t){const{viewport:e,fitViewOnInit:n,fitViewOnInitDone:o}=ge(),i=r.computed(()=>n.value?!o.value:!1),s=r.computed(()=>`translate(${e.value.x}px,${e.value.y}px) scale(${e.value.zoom})`);return(l,a)=>(r.openBlock(),r.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:r.normalizeStyle({transform:s.value,opacity:i.value?0:void 0})},[r.renderSlot(l.$slots,"default")],4))}}),Qf={name:"Viewport",compatConfig:{MODE:3}},Jf=r.defineComponent({...Qf,setup(t){const{minZoom:e,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:s,selectionKeyCode:l,panActivationKeyCode:a,panOnScroll:d,panOnScrollMode:c,panOnScrollSpeed:u,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:g,zoomOnScroll:p,preventScrolling:m,noWheelClassName:v,noPanClassName:E,emits:M,connectionStartHandle:y,userSelectionActive:C,paneDragging:$,d3Zoom:O,d3Selection:L,d3ZoomHandler:j,viewport:W,viewportRef:G,paneClickDistance:F}=ge();Lf(G);const N=r.shallowRef(!1),H=r.shallowRef(!1);let _=null,A=!1,S=0,R={x:0,y:0,zoom:0};const V=At(a),T=At(l),I=At(s),Y=r.toRef(()=>(!T.value||T.value&&l.value===!0)&&(V.value||f.value)),X=r.toRef(()=>V.value||d.value),J=r.toRef(()=>l.value===!0&&Y.value!==!0),re=r.toRef(()=>T.value&&l.value!==!0||C.value||J.value),P=r.toRef(()=>y.value!==null);r.onMounted(()=>{if(!G.value){Vt("Viewport element is missing");return}const te=G.value,ce=te.getBoundingClientRect(),q=wu().clickDistance(F.value).scaleExtent([e.value,n.value]).translateExtent(i.value),ie=Se(te).call(q),b=ie.on("wheel.zoom"),w=ut.translate(o.value.x??0,o.value.y??0).scale(tt(o.value.zoom??1,e.value,n.value)),x=[[0,0],[ce.width,ce.height]],D=q.constrain()(w,x,i.value);q.transform(ie,D),q.wheelDelta(Ss),O.value=q,L.value=ie,j.value=b,W.value={x:D.x,y:D.y,zoom:D.k},q.on("start",k=>{var ee;if(!k.sourceEvent)return null;S=k.sourceEvent.button,N.value=!0;const ne=U(k.transform);((ee=k.sourceEvent)==null?void 0:ee.type)==="mousedown"&&($.value=!0),R=ne,M.viewportChangeStart(ne),M.moveStart({event:k,flowTransform:ne})}),q.on("end",k=>{if(!k.sourceEvent)return null;if(N.value=!1,$.value=!1,Z(Y.value,S??0)&&!A&&M.paneContextMenu(k.sourceEvent),A=!1,B(R,k.transform)){const ee=U(k.transform);R=ee,M.viewportChangeEnd(ee),M.moveEnd({event:k,flowTransform:ee})}}),q.filter(k=>{var ee;const ne=I.value||p.value,le=g.value&&k.ctrlKey,se=k.button,ue=k.type==="wheel";if(se===1&&k.type==="mousedown"&&(K(k,"vue-flow__node")||K(k,"vue-flow__edge")))return!0;if(!Y.value&&!ne&&!X.value&&!h.value&&!g.value||C.value||P.value&&!ue||!h.value&&k.type==="dblclick"||K(k,v.value)&&ue||K(k,E.value)&&(!ue||X.value&&ue&&!I.value)||!g.value&&k.ctrlKey&&ue||!ne&&!X.value&&!le&&ue)return!1;if(!g&&k.type==="touchstart"&&((ee=k.touches)==null?void 0:ee.length)>1)return k.preventDefault(),!1;if(!Y.value&&(k.type==="mousedown"||k.type==="touchstart")||J.value&&Array.isArray(f.value)&&f.value.includes(0)&&se===0||Array.isArray(f.value)&&!f.value.includes(se)&&(k.type==="mousedown"||k.type==="touchstart"))return!1;const fe=Array.isArray(f.value)&&f.value.includes(se)||l.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!se||se<=1;return(!k.ctrlKey||V.value||ue)&&fe}),r.watch([C,Y],()=>{C.value&&!N.value?q.on("zoom",null):C.value||q.on("zoom",k=>{W.value={x:k.transform.x,y:k.transform.y,zoom:k.transform.k};const ee=U(k.transform);A=Z(Y.value,S??0),M.viewportChange(ee),M.move({event:k,flowTransform:ee})})},{immediate:!0}),r.watch([C,X,c,I,g,m,v],()=>{X.value&&!I.value&&!C.value?ie.on("wheel.zoom",k=>{if(K(k,v.value))return!1;const ee=I.value||p.value,ne=g.value&&k.ctrlKey;if(!(!m.value||X.value||ee||ne))return!1;k.preventDefault(),k.stopImmediatePropagation();const se=ie.property("__zoom").k||1,ue=xn();if(!V.value&&k.ctrlKey&&g.value&&ue){const Pg=Te(k),Og=Ss(k),Hg=se*2**Og;q.scaleTo(ie,Hg,Pg,k);return}const fe=k.deltaMode===1?20:1;let he=c.value===Rt.Vertical?0:k.deltaX*fe,Ze=c.value===Rt.Horizontal?0:k.deltaY*fe;!ue&&k.shiftKey&&c.value!==Rt.Vertical&&!he&&Ze&&(he=Ze,Ze=0),q.translateBy(ie,-(he/se)*u.value,-(Ze/se)*u.value);const $e=U(ie.property("__zoom"));_&&clearTimeout(_),H.value?(M.move({event:k,flowTransform:$e}),M.viewportChange($e),_=setTimeout(()=>{M.moveEnd({event:k,flowTransform:$e}),M.viewportChangeEnd($e),H.value=!1},150)):(H.value=!0,M.moveStart({event:k,flowTransform:$e}),M.viewportChangeStart($e))},{passive:!1}):typeof b<"u"&&ie.on("wheel.zoom",function(k,ee){const ne=!m.value&&k.type==="wheel"&&!k.ctrlKey,le=I.value||p.value,se=g.value&&k.ctrlKey;if(!le&&!d.value&&!se&&k.type==="wheel"||ne||K(k,v.value))return null;k.preventDefault(),b.call(this,k,ee)},{passive:!1})},{immediate:!0})});function Z(te,ce){return ce===2&&Array.isArray(te)&&te.includes(2)}function B(te,ce){return te.x!==ce.x&&!Number.isNaN(ce.x)||te.y!==ce.y&&!Number.isNaN(ce.y)||te.zoom!==ce.k&&!Number.isNaN(ce.k)}function U(te){return{x:te.x,y:te.y,zoom:te.k}}function K(te,ce){return te.target.closest(`.${ce}`)}return(te,ce)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"viewportRef",ref:G,class:"vue-flow__viewport vue-flow__container"},[r.createVNode(Zf,{"is-selecting":re.value,"selection-key-pressed":r.unref(T),class:r.normalizeClass({connecting:P.value,dragging:r.unref($),draggable:r.unref(f)===!0||Array.isArray(r.unref(f))&&r.unref(f).includes(0)})},{default:r.withCtx(()=>[r.createVNode(Kf,null,{default:r.withCtx(()=>[r.renderSlot(te.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),eh=["id"],th=["id"],nh=["id"],oh={name:"A11yDescriptions",compatConfig:{MODE:3}},ih=r.defineComponent({...oh,setup(t){const{id:e,disableKeyboardA11y:n,ariaLiveMessage:o}=ge();return(i,s)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{id:`${r.unref(hs)}-${r.unref(e)}`,style:{display:"none"}}," Press enter or space to select a node. "+r.toDisplayString(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,eh),r.createElementVNode("div",{id:`${r.unref(gs)}-${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,th),r.unref(n)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",{key:0,id:`${r.unref(Nu)}-${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%)"}},r.toDisplayString(r.unref(o)),9,nh))],64))}});function sh(){const t=ge();r.watch(()=>t.viewportHelper.value.viewportInitialized,e=>{e&&setTimeout(()=>{t.emits.init(t),t.emits.paneReady(t)},1)})}function rh(t,e,n){return n===oe.Left?t-e:n===oe.Right?t+e:t}function lh(t,e,n){return n===oe.Top?t-e:n===oe.Bottom?t+e:t}const $o=function({radius:t=10,centerX:e=0,centerY:n=0,position:o=oe.Top,type:i}){return r.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:rh(e,t,o),cy:lh(n,t,o),r:t,stroke:"transparent",fill:"transparent"})};$o.props=["radius","centerX","centerY","position","type"],$o.compatConfig={MODE:3};const cr=$o,ah=r.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(t){const{id:e,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:s,nodesSelectionActive:l,noPanClassName:a,getEdgeTypes:d,removeSelectedEdges:c,findEdge:u,findNode:f,isValidConnection:h,multiSelectionActive:g,disableKeyboardA11y:p,elementsSelectable:m,edgesUpdatable:v,edgesFocusable:E,hooks:M}=ge(),y=r.computed(()=>u(t.id)),{emit:C,on:$}=nf(y.value,s),O=r.inject(Cn),L=r.getCurrentInstance(),j=r.ref(!1),W=r.ref(!1),G=r.ref(""),F=r.ref(null),N=r.ref("source"),H=r.ref(null),_=r.toRef(()=>typeof y.value.selectable>"u"?m.value:y.value.selectable),A=r.toRef(()=>typeof y.value.updatable>"u"?v.value:y.value.updatable),S=r.toRef(()=>typeof y.value.focusable>"u"?E.value:y.value.focusable);r.provide(Ju,t.id),r.provide(ef,H);const R=r.computed(()=>y.value.class instanceof Function?y.value.class(y.value):y.value.class),V=r.computed(()=>y.value.style instanceof Function?y.value.style(y.value):y.value.style),T=r.computed(()=>{const w=y.value.type||"default",x=O?.[`edge-${w}`];if(x)return x;let D=y.value.template??d.value[w];if(typeof D=="string"&&L){const k=Object.keys(L.appContext.components);k&&k.includes(w)&&(D=r.resolveComponent(w,!1))}return D&&typeof D!="string"?D:(s.error(new ye(pe.EDGE_TYPE_MISSING,D)),!1)}),{handlePointerDown:I}=Ks({nodeId:G,handleId:F,type:N,isValidConnection:h,edgeUpdaterType:N,onEdgeUpdate:J,onEdgeUpdateEnd:re});return()=>{const w=f(y.value.source),x=f(y.value.target),D="pathOptions"in y.value?y.value.pathOptions:{};if(!w&&!x)return s.error(new ye(pe.EDGE_SOURCE_TARGET_MISSING,y.value.id,y.value.source,y.value.target)),null;if(!w)return s.error(new ye(pe.EDGE_SOURCE_MISSING,y.value.id,y.value.source)),null;if(!x)return s.error(new ye(pe.EDGE_TARGET_MISSING,y.value.id,y.value.target)),null;if(!y.value||y.value.hidden||w.hidden||x.hidden)return null;let k;o.value===Le.Strict?k=w.handleBounds.source:k=[...w.handleBounds.source||[],...w.handleBounds.target||[]];const ee=Ps(k,y.value.sourceHandle);let ne;o.value===Le.Strict?ne=x.handleBounds.target:ne=[...x.handleBounds.target||[],...x.handleBounds.source||[]];const le=Ps(ne,y.value.targetHandle),se=ee?.position||oe.Bottom,ue=le?.position||oe.Top,{x:fe,y:he}=gt(w,ee,se),{x:Ze,y:$e}=gt(x,le,ue);return y.value.sourceX=fe,y.value.sourceY=he,y.value.targetX=Ze,y.value.targetY=$e,r.h("g",{ref:H,key:t.id,"data-id":t.id,class:["vue-flow__edge",`vue-flow__edge-${T.value===!1?"default":y.value.type||"default"}`,a.value,R.value,{updating:j.value,selected:y.value.selected,animated:y.value.animated,inactive:!_.value&&!M.value.edgeClick.hasListeners()}],tabIndex:S.value?0:void 0,"aria-label":y.value.ariaLabel===null?void 0:y.value.ariaLabel??`Edge from ${y.value.source} to ${y.value.target}`,"aria-describedby":S.value?`${gs}-${e}`:void 0,"aria-roledescription":"edge",role:S.value?"group":"img",...y.value.domAttributes,onClick:Z,onContextmenu:B,onDblclick:U,onMouseenter:K,onMousemove:te,onMouseleave:ce,onKeyDown:S.value?b:void 0},[W.value?null:r.h(T.value===!1?d.value.default:T.value,{id:t.id,sourceNode:w,targetNode:x,source:y.value.source,target:y.value.target,type:y.value.type,updatable:A.value,selected:y.value.selected,animated:y.value.animated,label:y.value.label,labelStyle:y.value.labelStyle,labelShowBg:y.value.labelShowBg,labelBgStyle:y.value.labelBgStyle,labelBgPadding:y.value.labelBgPadding,labelBgBorderRadius:y.value.labelBgBorderRadius,data:y.value.data,events:{...y.value.events,...$},style:V.value,markerStart:`url('#${Ht(y.value.markerStart,e)}')`,markerEnd:`url('#${Ht(y.value.markerEnd,e)}')`,sourcePosition:se,targetPosition:ue,sourceX:fe,sourceY:he,targetX:Ze,targetY:$e,sourceHandleId:y.value.sourceHandle,targetHandleId:y.value.targetHandle,interactionWidth:y.value.interactionWidth,...D}),[A.value==="source"||A.value===!0?[r.h("g",{onMousedown:q,onMouseenter:Y,onMouseout:X},r.h(cr,{position:se,centerX:fe,centerY:he,radius:i.value,type:"source","data-type":"source"}))]:null,A.value==="target"||A.value===!0?[r.h("g",{onMousedown:ie,onMouseenter:Y,onMouseout:X},r.h(cr,{position:ue,centerX:Ze,centerY:$e,radius:i.value,type:"target","data-type":"target"}))]:null]])};function Y(){j.value=!0}function X(){j.value=!1}function J(w,x){C.update({event:w,edge:y.value,connection:x})}function re(w){C.updateEnd({event:w,edge:y.value}),W.value=!1}function P(w,x){w.button===0&&(W.value=!0,G.value=x?y.value.target:y.value.source,F.value=(x?y.value.targetHandle:y.value.sourceHandle)??null,N.value=x?"target":"source",C.updateStart({event:w,edge:y.value}),I(w))}function Z(w){var x;const D={event:w,edge:y.value};_.value&&(l.value=!1,y.value.selected&&g.value?(c([y.value]),(x=H.value)==null||x.blur()):n([y.value])),C.click(D)}function B(w){C.contextMenu({event:w,edge:y.value})}function U(w){C.doubleClick({event:w,edge:y.value})}function K(w){C.mouseEnter({event:w,edge:y.value})}function te(w){C.mouseMove({event:w,edge:y.value})}function ce(w){C.mouseLeave({event:w,edge:y.value})}function q(w){P(w,!0)}function ie(w){P(w,!1)}function b(w){var x;!p.value&&ps.includes(w.key)&&_.value&&(w.key==="Escape"?((x=H.value)==null||x.blur(),c([u(t.id)])):n([u(t.id)]))}}}),ch=r.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var t;const{id:e,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:s,connectionLineType:l,connectionLineStyle:a,connectionLineOptions:d,connectionStatus:c,viewport:u,findNode:f}=ge(),h=(t=r.inject(Cn))==null?void 0:t["connection-line"],g=r.computed(()=>{var M;return f((M=o.value)==null?void 0:M.nodeId)}),p=r.computed(()=>{var M;return f((M=i.value)==null?void 0:M.nodeId)??null}),m=r.computed(()=>({x:(s.value.x-u.value.x)/u.value.zoom,y:(s.value.y-u.value.y)/u.value.zoom})),v=r.computed(()=>d.value.markerStart?`url(#${Ht(d.value.markerStart,e)})`:""),E=r.computed(()=>d.value.markerEnd?`url(#${Ht(d.value.markerEnd,e)})`:"");return()=>{var M,y,C;if(!g.value||!o.value)return null;const $=o.value.id,O=o.value.type,L=g.value.handleBounds;let j=L?.[O]??[];if(n.value===Le.Loose){const V=L?.[O==="source"?"target":"source"]??[];j=[...j,...V]}if(!j)return null;const W=($?j.find(V=>V.id===$):j[0])??null,G=W?.position??oe.Top,{x:F,y:N}=gt(g.value,W,G);let H=null;p.value&&(n.value===Le.Strict?H=((M=p.value.handleBounds[O==="source"?"target":"source"])==null?void 0:M.find(V=>{var T;return V.id===((T=i.value)==null?void 0:T.id)}))||null:H=((y=[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]])==null?void 0:y.find(V=>{var T;return V.id===((T=i.value)==null?void 0:T.id)}))||null);const _=((C=i.value)==null?void 0:C.position)??(G?Do[G]:null);if(!G||!_)return null;const A=l.value??d.value.type??et.Bezier;let S="";const R={sourceX:F,sourceY:N,sourcePosition:G,targetX:m.value.x,targetY:m.value.y,targetPosition:_};return A===et.Bezier?[S]=Ro(R):A===et.Step?[S]=Ao({...R,borderRadius:0}):A===et.SmoothStep?[S]=Ao(R):A===et.SimpleBezier?[S]=sr(R):S=`M${F},${N} ${m.value.x},${m.value.y}`,r.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},r.h("g",{class:"vue-flow__connection"},h?r.h(h,{sourceX:F,sourceY:N,sourcePosition:G,targetX:m.value.x,targetY:m.value.y,targetPosition:_,sourceNode:g.value,sourceHandle:W,targetNode:p.value,targetHandle:H,markerEnd:E.value,markerStart:v.value,connectionStatus:c.value}):r.h("path",{d:S,class:[d.value.class,c.value,"vue-flow__connection-path"],style:{...a.value,...d.value.style},"marker-end":E.value,"marker-start":v.value})))}}}),dh=["id","markerWidth","markerHeight","markerUnits","orient"],uh={name:"MarkerType",compatConfig:{MODE:3}},fh=r.defineComponent({...uh,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)=>(r.openBlock(),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===r.unref(Fe).ArrowClosed?(r.openBlock(),r.createElementBlock("polyline",{key:0,style: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)):r.createCommentVNode("",!0),e.type===r.unref(Fe).Arrow?(r.openBlock(),r.createElementBlock("polyline",{key:1,style: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)):r.createCommentVNode("",!0)],8,dh))}}),hh={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},gh={name:"MarkerDefinitions",compatConfig:{MODE:3}},ph=r.defineComponent({...gh,setup(t){const{id:e,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=ge(),s=r.computed(()=>{const l=new Set,a=[],d=c=>{if(c){const u=Ht(c,e);l.has(u)||(typeof c=="object"?a.push({...c,id:u,color:c.color||i.value}):a.push({id:u,color:i.value,type:c}),l.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 a.sort((c,u)=>c.id.localeCompare(u.id))});return(l,a)=>(r.openBlock(),r.createElementBlock("svg",hh,[r.createElementVNode("defs",null,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.value,d=>(r.openBlock(),r.createBlock(fh,{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))])]))}}),mh={name:"Edges",compatConfig:{MODE:3}},yh=r.defineComponent({...mh,setup(t){const{findNode:e,getEdges:n,elevateEdgesOnSelect:o}=ge();return(i,s)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(ph),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(n),l=>(r.openBlock(),r.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:r.normalizeStyle({zIndex:r.unref(Lu)(l,r.unref(e),r.unref(o))})},[r.createVNode(r.unref(ah),{id:l.id},null,8,["id"])],4))),128)),r.createVNode(r.unref(ch))],64))}}),vh=r.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(t){const{id:e,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:s,emits:l,removeSelectedNodes:a,addSelectedNodes:d,updateNodeDimensions:c,onUpdateNodeInternals:u,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:g,disableKeyboardA11y:p,ariaLiveMessage:m,snapToGrid:v,snapGrid:E,nodeDragThreshold:M,nodesDraggable:y,elementsSelectable:C,nodesConnectable:$,nodesFocusable:O,hooks:L}=ge(),j=r.ref(null);r.provide(Zs,j),r.provide(js,t.id);const W=r.inject(Cn),G=r.getCurrentInstance(),F=Js(),{node:N,parentNode:H}=Qs(t.id),{emit:_,on:A}=lf(N,l),S=r.toRef(()=>typeof N.draggable>"u"?y.value:N.draggable),R=r.toRef(()=>typeof N.selectable>"u"?C.value:N.selectable),V=r.toRef(()=>typeof N.connectable>"u"?$.value:N.connectable),T=r.toRef(()=>typeof N.focusable>"u"?O.value:N.focusable),I=r.computed(()=>R.value||S.value||L.value.nodeClick.hasListeners()||L.value.nodeDoubleClick.hasListeners()||L.value.nodeMouseEnter.hasListeners()||L.value.nodeMouseMove.hasListeners()||L.value.nodeMouseLeave.hasListeners()),Y=r.toRef(()=>!!N.dimensions.width&&!!N.dimensions.height),X=r.computed(()=>{const x=N.type||"default",D=W?.[`node-${x}`];if(D)return D;let k=N.template||f.value[x];if(typeof k=="string"&&G){const ee=Object.keys(G.appContext.components);ee&&ee.includes(x)&&(k=r.resolveComponent(x,!1))}return k&&typeof k!="string"?k:(l.error(new ye(pe.NODE_TYPE_MISSING,k)),!1)}),J=qs({id:t.id,el:j,disabled:()=>!S.value,selectable:R,dragHandle:()=>N.dragHandle,onStart(x){_.dragStart(x)},onDrag(x){_.drag(x)},onStop(x){_.dragStop(x)},onClick(x){b(x)}}),re=r.computed(()=>N.class instanceof Function?N.class(N):N.class),P=r.computed(()=>{const x=(N.style instanceof Function?N.style(N):N.style)||{},D=N.width instanceof Function?N.width(N):N.width,k=N.height instanceof Function?N.height(N):N.height;return!x.width&&D&&(x.width=typeof D=="string"?D:`${D}px`),!x.height&&k&&(x.height=typeof k=="string"?k:`${k}px`),x}),Z=r.toRef(()=>Number(N.zIndex??P.value.zIndex??0));return u(x=>{(x.includes(t.id)||!x.length)&&U()}),r.onMounted(()=>{r.watch(()=>N.hidden,(x=!1,D,k)=>{!x&&j.value&&(t.resizeObserver.observe(j.value),k(()=>{j.value&&t.resizeObserver.unobserve(j.value)}))},{immediate:!0,flush:"post"})}),r.watch([()=>N.type,()=>N.sourcePosition,()=>N.targetPosition],()=>{r.nextTick(()=>{c([{id:t.id,nodeElement:j.value,forceUpdate:!0}])})}),r.watch([()=>N.position.x,()=>N.position.y,()=>{var x;return(x=H.value)==null?void 0:x.computedPosition.x},()=>{var x;return(x=H.value)==null?void 0:x.computedPosition.y},()=>{var x;return(x=H.value)==null?void 0:x.computedPosition.z},Z,()=>N.selected,()=>N.dimensions.height,()=>N.dimensions.width,()=>{var x;return(x=H.value)==null?void 0:x.dimensions.height},()=>{var x;return(x=H.value)==null?void 0:x.dimensions.width}],([x,D,k,ee,ne,le])=>{const se={x,y:D,z:le+(g.value&&N.selected?1e3:0)};typeof k<"u"&&typeof ee<"u"?N.computedPosition=Au({x:k,y:ee,z:ne},se):N.computedPosition=se},{flush:"post",immediate:!0}),r.watch([()=>N.extent,h],([x,D],[k,ee])=>{(x!==k||D!==ee)&&B()}),N.extent==="parent"||typeof N.extent=="object"&&"range"in N.extent&&N.extent.range==="parent"?eo(()=>Y).toBe(!0).then(B):B(),()=>N.hidden?null:r.h("div",{ref:j,"data-id":N.id,class:["vue-flow__node",`vue-flow__node-${X.value===!1?"default":N.type||"default"}`,{[n.value]:S.value,dragging:J?.value,draggable:S.value,selected:N.selected,selectable:R.value,parent:N.isParent},re.value],style:{visibility:Y.value?"visible":"hidden",zIndex:N.computedPosition.z??Z.value,transform:`translate(${N.computedPosition.x}px,${N.computedPosition.y}px)`,pointerEvents:I.value?"all":"none",...P.value},tabIndex:T.value?0:void 0,role:T.value?"group":void 0,"aria-describedby":p.value?void 0:`${hs}-${e}`,"aria-label":N.ariaLabel,"aria-roledescription":"node",...N.domAttributes,onMouseenter:K,onMousemove:te,onMouseleave:ce,onContextmenu:q,onClick:b,onDblclick:ie,onKeydown:w},[r.h(X.value===!1?f.value.default:X.value,{id:N.id,type:N.type,data:N.data,events:{...N.events,...A},selected:N.selected,resizing:N.resizing,dragging:J.value,connectable:V.value,position:N.computedPosition,dimensions:N.dimensions,isValidTargetPos:N.isValidTargetPos,isValidSourcePos:N.isValidSourcePos,parent:N.parentNode,parentNodeId:N.parentNode,zIndex:N.computedPosition.z??Z.value,targetPosition:N.targetPosition,sourcePosition:N.sourcePosition,label:N.label,dragHandle:N.dragHandle,onUpdateNodeInternals:U})]);function B(){const x=N.computedPosition,{computedPosition:D,position:k}=ko(N,v.value?En(x,E.value):x,l.error,h.value,H.value);(N.computedPosition.x!==D.x||N.computedPosition.y!==D.y)&&(N.computedPosition={...N.computedPosition,...D}),(N.position.x!==k.x||N.position.y!==k.y)&&(N.position=k)}function U(){j.value&&c([{id:t.id,nodeElement:j.value,forceUpdate:!0}])}function K(x){J?.value||_.mouseEnter({event:x,node:N})}function te(x){J?.value||_.mouseMove({event:x,node:N})}function ce(x){J?.value||_.mouseLeave({event:x,node:N})}function q(x){return _.contextMenu({event:x,node:N})}function ie(x){return _.doubleClick({event:x,node:N})}function b(x){R.value&&(!o.value||!S.value||M.value>0)&&zo(N,s.value,d,a,i,!1,j.value),_.click({event:x,node:N})}function w(x){if(!(Eo(x)||p.value))if(ps.includes(x.key)&&R.value){const D=x.key==="Escape";zo(N,s.value,d,a,i,D,j.value)}else S.value&&N.selected&&ft[x.key]&&(x.preventDefault(),m.value=`Moved selected node ${x.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~N.position.x}, y: ${~~N.position.y}`,F({x:ft[x.key].x,y:ft[x.key].y},x.shiftKey))}}}),wh={height:"0",width:"0"},_h={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},bh=r.defineComponent({..._h,setup(t){const{viewportRef:e}=ge(),n=r.toRef(()=>{var o;return(o=e.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(r.openBlock(),r.createElementBlock("svg",null,[(r.openBlock(),r.createElementBlock("foreignObject",wh,[(r.openBlock(),r.createBlock(r.Teleport,{to:n.value,disabled:!n.value},[r.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function xh(t={includeHiddenNodes:!1}){const{nodes:e}=ge();return 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})}const Eh={class:"vue-flow__nodes vue-flow__container"},Ch={name:"Nodes",compatConfig:{MODE:3}},Nh=r.defineComponent({...Ch,setup(t){const{getNodes:e,updateNodeDimensions:n,emits:o}=ge(),i=xh(),s=r.ref();return r.watch(i,l=>{l&&r.nextTick(()=>{o.nodesInitialized(e.value)})},{immediate:!0}),r.onMounted(()=>{s.value=new ResizeObserver(l=>{const a=l.map(d=>({id:d.target.getAttribute("data-id"),nodeElement:d.target,forceUpdate:!0}));r.nextTick(()=>n(a))})}),r.onBeforeUnmount(()=>{var l;return(l=s.value)==null?void 0:l.disconnect()}),(l,a)=>(r.openBlock(),r.createElementBlock("div",Eh,[s.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(e),(d,c,u,f)=>{const h=[d.id];if(f&&f.key===d.id&&r.isMemoSame(f,h))return f;const g=(r.openBlock(),r.createBlock(r.unref(vh),{id:d.id,key:d.id,"resize-observer":s.value},null,8,["id","resize-observer"]));return g.memo=h,g},a,0),128)):r.createCommentVNode("",!0)]))}});function kh(){const{emits:t}=ge();r.onMounted(()=>{if(Fs()){const e=document.querySelector(".vue-flow__pane");e&&window.getComputedStyle(e).zIndex!=="1"&&t.error(new ye(pe.MISSING_STYLES))}})}const Sh=r.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Mh={name:"VueFlow",compatConfig:{MODE:3}},Dh=r.defineComponent({...Mh,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=r.useSlots(),s=to(o,"modelValue",n),l=to(o,"nodes",n),a=to(o,"edges",n),d=ge(o),c=uf({modelValue:s,nodes:l,edges:a},o,d);return hf(n,d.hooks),sh(),kh(),r.provide(Cn,i),r.onUnmounted(c),e(d),(u,f)=>(r.openBlock(),r.createElementBlock("div",{ref:r.unref(d).vueFlowRef,class:"vue-flow"},[r.createVNode(Jf,null,{default:r.withCtx(()=>[r.createVNode(yh),Sh,r.createVNode(Nh),r.renderSlot(u.$slots,"zoom-pane")]),_:3}),r.renderSlot(u.$slots,"default"),r.createVNode(ih)],512))}}),zh={name:"Panel",compatConfig:{MODE:3}},Th=r.defineComponent({...zh,props:{position:{}},setup(t){const e=t,{userSelectionActive:n}=ge(),o=r.computed(()=>`${e.position}`.split("-"));return(i,s)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["vue-flow__panel",o.value]),style:r.normalizeStyle({pointerEvents:r.unref(n)?"none":"all"})},[r.renderSlot(i.$slots,"default")],6))}});var Ge=(t=>(t.Lines="lines",t.Dots="dots",t))(Ge||{});const dr=function({dimensions:t,size:e,color:n}){return r.h("path",{stroke:n,"stroke-width":e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})},ur=function({radius:t,color:e}){return r.h("circle",{cx:t,cy:t,r:t,fill:e})};Ge.Lines+"",Ge.Dots+"";const Ih={[Ge.Dots]:"#81818a",[Ge.Lines]:"#eee"},Bh=["id","x","y","width","height","patternTransform"],Rh={key:2,height:"100",width:"100"},Ah=["fill"],$h=["x","y","fill"],Ph={name:"Background",compatConfig:{MODE:3}},Oh=r.defineComponent({...Ph,props:{id:{},variant:{default:()=>Ge.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=r.computed(()=>{const l=n.value.zoom,[a,d]=Array.isArray(t.gap)?t.gap:[t.gap,t.gap],c=[a*l||1,d*l||1],u=t.size*l,[f,h]=Array.isArray(t.offset)?t.offset:[t.offset,t.offset],g=[f*l||1+c[0]/2,h*l||1+c[1]/2];return{scaledGap:c,offset:g,size:u}}),i=r.toRef(()=>`pattern-${e}${t.id?`-${t.id}`:""}`),s=r.toRef(()=>t.color||t.patternColor||Ih[t.variant||Ge.Dots]);return(l,a)=>(r.openBlock(),r.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:r.normalizeStyle({height:`${l.height>100?100:l.height}%`,width:`${l.width>100?100:l.width}%`})},[r.renderSlot(l.$slots,"pattern-container",{id:i.value},()=>[r.createElementVNode("pattern",{id:i.value,x:r.unref(n).x%o.value.scaledGap[0],y: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"},[r.renderSlot(l.$slots,"pattern",{},()=>[l.variant===r.unref(Ge).Lines?(r.openBlock(),r.createBlock(r.unref(dr),{key:0,size:l.lineWidth,color:s.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):l.variant===r.unref(Ge).Dots?(r.openBlock(),r.createBlock(r.unref(ur),{key:1,color:s.value,radius:o.value.size/2},null,8,["color","radius"])):r.createCommentVNode("",!0),l.bgColor?(r.openBlock(),r.createElementBlock("svg",Rh,[r.createElementVNode("rect",{width:"100%",height:"100%",fill:l.bgColor},null,8,Ah)])):r.createCommentVNode("",!0)])],8,Bh)]),r.createElementVNode("rect",{x:l.x,y:l.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,$h),r.renderSlot(l.$slots,"default",{id:i.value})],4))}}),Hh={name:"ControlButton",compatConfig:{MODE:3}},Vh=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n},Lh={type:"button",class:"vue-flow__controls-button"};function Fh(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("button",Lh,[r.renderSlot(t.$slots,"default")])}const Tn=Vh(Hh,[["render",Fh]]),Gh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Wh=[r.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Yh(t,e){return r.openBlock(),r.createElementBlock("svg",Gh,Wh)}const Uh={render:Yh},Xh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},jh=[r.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Zh(t,e){return r.openBlock(),r.createElementBlock("svg",Xh,jh)}const qh={render:Zh},Kh={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Qh=[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 Jh(t,e){return r.openBlock(),r.createElementBlock("svg",Kh,Qh)}const eg={render:Jh},tg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ng=[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 og(t,e){return r.openBlock(),r.createElementBlock("svg",tg,ng)}const ig={render:og},sg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},rg=[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 lg(t,e){return r.openBlock(),r.createElementBlock("svg",sg,rg)}const ag={render:lg},cg={name:"Controls",compatConfig:{MODE:3}},dg=r.defineComponent({...cg,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>us.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(t,{emit:e}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:i,setInteractive:s,zoomIn:l,zoomOut:a,fitView:d,viewport:c,minZoom:u,maxZoom:f}=ge(),h=r.toRef(()=>n.value||o.value||i.value),g=r.toRef(()=>c.value.zoom<=u.value),p=r.toRef(()=>c.value.zoom>=f.value);function m(){l(),e("zoomIn")}function v(){a(),e("zoomOut")}function E(){d(t.fitViewParams),e("fitView")}function M(){s(!h.value),e("interactionChange",!h.value)}return(y,C)=>(r.openBlock(),r.createBlock(r.unref(Th),{class:"vue-flow__controls",position:y.position},{default:r.withCtx(()=>[r.renderSlot(y.$slots,"top"),y.showZoom?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.renderSlot(y.$slots,"control-zoom-in",{},()=>[r.createVNode(Tn,{class:"vue-flow__controls-zoomin",disabled:p.value,onClick:m},{default:r.withCtx(()=>[r.renderSlot(y.$slots,"icon-zoom-in",{},()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(r.unref(Uh))))])]),_:3},8,["disabled"])]),r.renderSlot(y.$slots,"control-zoom-out",{},()=>[r.createVNode(Tn,{class:"vue-flow__controls-zoomout",disabled:g.value,onClick:v},{default:r.withCtx(()=>[r.renderSlot(y.$slots,"icon-zoom-out",{},()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(r.unref(qh))))])]),_:3},8,["disabled"])])],64)):r.createCommentVNode("",!0),y.showFitView?r.renderSlot(y.$slots,"control-fit-view",{key:1},()=>[r.createVNode(Tn,{class:"vue-flow__controls-fitview",onClick:E},{default:r.withCtx(()=>[r.renderSlot(y.$slots,"icon-fit-view",{},()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(r.unref(eg))))])]),_:3})]):r.createCommentVNode("",!0),y.showInteractive?r.renderSlot(y.$slots,"control-interactive",{key:2},()=>[y.showInteractive?(r.openBlock(),r.createBlock(Tn,{key:0,class:"vue-flow__controls-interactive",onClick:M},{default:r.withCtx(()=>[h.value?r.renderSlot(y.$slots,"icon-unlock",{key:0},()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(r.unref(ag))))]):r.createCommentVNode("",!0),h.value?r.createCommentVNode("",!0):r.renderSlot(y.$slots,"icon-lock",{key:1},()=>[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(r.unref(ig))))])]),_:3})):r.createCommentVNode("",!0)]):r.createCommentVNode("",!0),r.renderSlot(y.$slots,"default")]),_:3},8,["position"]))}}),ug=["onClick"],fg={class:"d-flow-node-menus-item-name"},Po=r.defineComponent({name:"DNodeMenus",__name:"nodeMenus",props:{fromNodeId:{},handleId:{}},emits:["addNode"],setup(t,{emit:e}){const n=t,o=e,i=r.inject("d_flow_design_provide",{}),s=i.getFlowComponents?.()||[],l=a=>{o("addNode",a.type),r.nextTick(()=>{n.handleId==="line"?i.addNodeByLine?.(a.type,n.fromNodeId||""):i.addNode?.(a.type,n.fromNodeId||"",n.handleId||"")})};return(a,d)=>{const c=r.resolveComponent("j-icon");return r.openBlock(),r.createElementBlock("div",{class:"d-flow-node-menus",onClick:r.withModifiers(()=>{},["stop"])},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(s),(u,f)=>(r.openBlock(),r.createElementBlock("div",{key:f,class:"d-flow-node-menus-item",onClick:h=>l(u)},[r.createElementVNode("div",{class:"d-flow-node-menus-item-icon",style:r.normalizeStyle({backgroundColor:u.iconColor||"var(--j-color-primary)"})},[r.createVNode(c,{icon:u.icon||"mdi:source-branch"},null,8,["icon"])],4),r.createElementVNode("div",fg,r.toDisplayString(u.name),1)],8,ug))),128))])}}}),hg={class:"d-flow-step-name"},gg={key:0,style:{color:"var(--j-color-text-2)"}},pg={style:{color:"var(--j-color-text)"}},mg=r.defineComponent({name:"DStepNode",__name:"stepNode",props:{id:{},data:{}},setup(t){const e=t,{onNodeClick:n,onEdgeClick:o,onMoveStart:i,onConnectStart:s,onNodeDragStart:l,removeNodes:a,getEdges:d,getNodes:c,onNodesChange:u}=ge(),f=r.inject("d_flow_design_provide",{}),h=r.computed(()=>f.getFlowComponentMap?.value?.[e.data.type]||{}),g=()=>{a(e.id),f.onRemoveNode?.(e.id)},p=r.ref({});u(H=>{if(e.data.isInit&&H.findIndex(_=>_.type==="select"&&_.id===e.id&&_.id==="start"&&_.selected)!==-1){const _=c.value.find(A=>A.id==="start");_&&(_.data.isInit=!1),p.value.s1=!0}});const m=r.ref(!1),v=H=>{H.indexOf("t")!==-1&&!E.value||(m.value=!0,p.value[H]=!0)},E=r.computed(()=>d.value.findIndex(H=>H.target===e.id)===-1),M=r.ref(!1),y=()=>{M.value=!0},C=(H,_)=>{if(d.value.find(R=>R.source===_&&R.target===H))return!0;const S=d.value.filter(R=>R.target===H);for(let R=0;R<S.length;R++)if(C(S[R].source,_))return!0;return!1},$=H=>M.value?(M.value=!1,!1):C(H.source,H.target)?!1:H.source!==H.target&&H.sourceHandle!==H.targetHandle&&H.sourceHandle.indexOf("s")!==-1&&H.targetHandle.indexOf("t")!==-1,O=()=>{F(),Object.keys(p.value).forEach(H=>{p.value[H]=!1})},L=()=>{O()};n(()=>{console.log("onNodeClick"),m.value?m.value=!1:O()}),o(()=>{O()}),i(()=>{O()}),s(()=>{O()}),l(()=>{O()});const j=r.ref(),W=r.ref({top:0,left:0,bottom:0,right:0}),G=r.ref({getBoundingClientRect:()=>W.value}),F=()=>{j.value?.handleClose()},N=H=>{const{clientX:_,clientY:A}=H;W.value=DOMRect.fromRect({x:_,y:A}),H.preventDefault(),j.value?.handleOpen()};return(H,_)=>{const A=r.resolveComponent("el-popover"),S=r.resolveComponent("el-tooltip"),R=r.resolveComponent("el-dropdown-item"),V=r.resolveComponent("el-dropdown-menu"),T=r.resolveComponent("el-dropdown");return r.openBlock(),r.createElementBlock("div",{class:"d-flow-step",onContextmenu:r.withModifiers(N,["stop"])},[r.createElementVNode("div",{class:"d-flow-step-icon",style:r.normalizeStyle({backgroundColor:h.value.iconColor||"var(--j-color-primary)"})},[r.createVNode(bt,{icon:h.value.icon||"mdi:source-branch"},null,8,["icon"])],4),r.createElementVNode("div",hg,r.toDisplayString(h.value.name),1),t.data.type!=="start"?(r.openBlock(),r.createBlock(S,{key:0,placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:r.withCtx(()=>[E.value?(r.openBlock(),r.createElementBlock("div",gg,[..._[4]||(_[4]=[r.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击",-1),r.createTextVNode("添加节点 ",-1)])])):r.createCommentVNode("",!0),_[5]||(_[5]=r.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[r.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),r.createTextVNode("连接节点 ")],-1))]),default:r.withCtx(()=>[r.createVNode(r.unref(pt),{onClick:_[1]||(_[1]=I=>v("t1")),onMousedown:y,id:"t1",class:r.normalizeClass(["d-flow-step-target-handle",{"d-flow-step-target-handle-notadd":!E.value}]),type:"target",position:r.unref(oe).Left,"is-valid-connection":$},{default:r.withCtx(()=>[E.value?(r.openBlock(),r.createBlock(A,{key:0,visible:p.value.t1,"onUpdate:visible":_[0]||(_[0]=I=>p.value.t1=I),placement:"left","popper-class":"d-flow-step-popper",trigger:"click","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:r.withCtx(()=>[r.createVNode(bt,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:r.withCtx(()=>[r.createVNode(Po,{"handle-id":"t1","from-node-id":t.id,onAddNode:L},null,8,["from-node-id"])]),_:1},8,["visible"])):r.createCommentVNode("",!0)]),_:1},8,["class","position"])]),_:1})):r.createCommentVNode("",!0),r.createVNode(S,{placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:r.withCtx(()=>[..._[6]||(_[6]=[r.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[r.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击"),r.createTextVNode("添加节点 ")],-1),r.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[r.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),r.createTextVNode("连接节点 ")],-1)])]),default:r.withCtx(()=>[r.createVNode(r.unref(pt),{onClick:_[3]||(_[3]=I=>v("s1")),onMousedown:y,id:"s1",class:"d-flow-step-source-handle",type:"source",position:r.unref(oe).Right,"is-valid-connection":$},{default:r.withCtx(()=>[r.createVNode(A,{visible:p.value.s1,"onUpdate:visible":_[2]||(_[2]=I=>p.value.s1=I),placement:"right",trigger:"click","popper-class":"d-flow-step-popper","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:r.withCtx(()=>[r.createVNode(bt,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:r.withCtx(()=>[r.createVNode(Po,{"handle-id":"s1","from-node-id":t.id,onAddNode:L},null,8,["from-node-id"])]),_:1},8,["visible"])]),_:1},8,["position"])]),_:1}),r.createVNode(T,{ref_key:"dropdownRef",ref:j,"popper-class":"d-flow-step-dropdown","virtual-ref":G.value,"show-arrow":!1,"popper-options":{modifiers:[{name:"offset",options:{offset:[0,0]}}]},"virtual-triggering":"",trigger:"contextmenu",placement:"bottom-start"},{dropdown:r.withCtx(()=>[r.createVNode(V,null,{default:r.withCtx(()=>[t.data.type!="start"?(r.openBlock(),r.createBlock(R,{key:0,onClick:g},{default:r.withCtx(()=>[..._[7]||(_[7]=[r.createTextVNode("删除",-1)])]),_:1})):r.createCommentVNode("",!0),h.value.des?(r.openBlock(),r.createElementBlock("div",{key:1,style: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})},[_[8]||(_[8]=r.createElementVNode("div",{style:{"margin-bottom":"4px",color:"var(--j-color-text-2)"}},"关于",-1)),r.createElementVNode("div",pg,r.toDisplayString(h.value.des),1)],4)):r.createCommentVNode("",!0)]),_:1})]),_:1},8,["virtual-ref"])],32)}}}),yg=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:l,onConnectStart:a,onNodeDragStart:d}=ge(),c=r.computed(()=>Ro(e)),u=r.ref(!1),f=r.ref(!1);n(({edge:v})=>{v.id===e.id&&(u.value=!0)}),o(()=>{u.value=!1});const h=r.ref(!1),g=()=>{h.value=!1,r.nextTick(()=>{f.value=!1})},p=()=>{f.value=!0,h.value=!0},m=()=>{g()};return i(()=>{g()}),s(()=>{g()}),l(()=>{g()}),a(()=>{g()}),d(()=>{g()}),(v,E)=>{const M=r.resolveComponent("j-icon"),y=r.resolveComponent("el-popover");return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(r.unref(Lt),{id:t.id,style:r.normalizeStyle(t.style),path:c.value[0],"marker-end":t.markerEnd},null,8,["id","style","path","marker-end"]),r.createVNode(r.unref(bh),null,{default:r.withCtx(()=>[r.createElementVNode("div",{style:r.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${c.value[1]}px,${c.value[2]}px)`}),class:"nodrag nopan"},[r.createVNode(y,{visible:h.value,"show-arrow":!1,placement:"right","popper-class":"d-flow-step-popper"},{reference:r.withCtx(()=>[r.withDirectives(r.createElementVNode("div",{onClick:r.withModifiers(p,["stop"]),class:"d-flow-edge-button"},[r.createVNode(M,{icon:"mdi:plus-circle"})],512),[[r.vShow,u.value||f.value]])]),default:r.withCtx(()=>[r.createVNode(Po,{"handle-id":"line","from-node-id":t.id,onAddNode:m},null,8,["from-node-id"])]),_:1},8,["visible"])],4)]),_:1})],64)}}}),vg=r.defineComponent({name:"DFlow",__name:"flow",props:{nodes:{default:()=>[]},edges:{default:()=>[]}},setup(t){return(e,n)=>(r.openBlock(),r.createBlock(r.unref(Dh),{"min-zoom":.2,"max-zoom":4,"default-viewport":{zoom:1},"connection-mode":r.unref(Le).Strict,nodes:t.nodes,edges:t.edges},{"edge-button":r.withCtx(o=>[r.createVNode(yg,{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:r.normalizeStyle(o.style)},null,8,["id","source-x","source-y","target-x","target-y","source-position","target-position","marker-end","style"])]),"node-step":r.withCtx(o=>[r.createVNode(mg,r.normalizeProps(r.guardReactiveProps(o)),null,16)]),default:r.withCtx(()=>[r.createVNode(r.unref(dg),{position:"bottom-left"}),r.createVNode(r.unref(Oh))]),_:1},8,["connection-mode","nodes","edges"]))}}),wg={class:"d-flow-design"},_g={class:"d-flow-design-canvas"},bg={class:"d-flow-design-right"},xg={class:"d-flow-design-title"},Eg={class:"d-flow-design-title-name"},Cg={class:"d-flow-design-panel"},fr=mt(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:l,removeEdges:a,addSelectedNodes:d,removeSelectedNodes:c,onConnect:u,onNodeClick:f,onPaneClick:h,onEdgeClick:g,getNodes:p,getEdges:m}=ge(),v=r.computed(()=>{const T={};return o.components.forEach(I=>{T[I.type]=I}),T.start={name:"开始",type:"start",icon:"ant-design:play-circle-outlined",des:"执行开始节点"},T}),E={id:"start",type:"step",data:{type:"start",isInit:!1},position:{x:80,y:160}},M=r.ref([E]),y=r.ref([]),C=(T,I)=>{if(I.indexOf("t")===-1){const Y=m.value.filter(X=>X.source===T.id);if(Y.length>0){let X=-1e6,J=0;return Y.forEach(re=>{X=Math.max(X,re.targetNode.position.y+re.targetNode.dimensions.height+32),J=re.targetNode.position.x||0}),{x:J,y:X}}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}},$=(T,I,Y)=>{const X=p.value.find(re=>re.id===I);if(!X)return;const J={id:Wt(),type:"step",data:{type:T},position:C(X,Y)};if(o.flowInit){const re=o.flowInit(J.data.type);re&&Object.keys(re).forEach(P=>{J.data[P]=re[P]})}s(J),Y.indexOf("t")===-1?l({id:`${I}-${J.id}`,source:I,target:J.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Fe.Arrow}):l({id:`${I}-${J.id}`,source:J.id,target:I,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Fe.Arrow}),N(J.id)},O=T=>{const I=p.value.find(Y=>Y.id===T);I&&(I.position.x+=100+I.dimensions.width,m.value.filter(X=>X.source===T).forEach(X=>{O(X.target)}))},L=(T,I)=>{const Y=m.value.find(J=>J.id===I);if(!Y)return;const X={id:Wt(),type:"step",data:{type:T},position:{x:Y.targetNode.position.x,y:Y.targetNode.position.y}};if(o.flowInit){const J=o.flowInit(X.data.type);J&&Object.keys(J).forEach(re=>{X.data[re]=J[re]})}s(X),l({id:`${Y.sourceNode.id}-${X.id}`,source:Y.sourceNode.id,target:X.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Fe.Arrow}),l({id:`${X.id}-${Y.targetNode.id}`,source:X.id,target:Y.targetNode.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:Fe.Arrow}),a(I),O(Y.target),N(X.id)};u(T=>{console.log("onConnect",T),T.type="button",T.markerEnd=Fe.Arrow,l(T),i("connect",T)});const j=()=>o.components||[],W=r.ref(),G=r.computed(()=>W.value?v.value[W.value.data.type]:void 0);f(T=>{W.value?.id!==T.node.id&&(W.value=T.node,A()),i("nodeClick",T.node)}),h(()=>{W.value=void 0,i("paneClick")}),g(T=>{W.value=void 0,i("edgeClick",T.edge)});const F=T=>{W.value?.id===T&&(W.value=void 0)},N=T=>{W.value&&c([W.value]),W.value=p.value.find(I=>I.id===T),W.value&&(A(),setTimeout(()=>{W.value&&d([W.value])},100))},H=r.ref(),_={};Object.keys(o.flowComponentConfigs).forEach(T=>{const I={type:"collapse",config:{groups:[],defaultValue:[]},children:[]};o.flowComponentConfigs[T].forEach((Y,X)=>{const J=`m${X}`;I.config?.defaultValue.push(J),I.config?.groups.push({i:J,label:Y.config?.label}),Y.children?.forEach(re=>{re.slot=J,I.children?.push(re)})}),_[T]=[I]});const A=()=>{const T=_[W.value?.data.type||""];T&&H.value?(H.value.setInit&&H.value.setInit(T,W.value?.data),o.flowComponentConfigInit&&o.flowComponentConfigInit({configRef:H,inputParams:o.inputParams,components:p.value,configData:W.value?.data})):H.value&&H.value.setInit&&H.value.setInit([])},S=(T,I)=>{W.value&&o.flowComponentConfigChange&&o.flowComponentConfigChange(W.value.data.type,{configRef:H,component:T,configData:W.value.data,...I,isFlowNode:!0})};return r.provide("d_flow_design_provide",{getFlowComponents:j,addNode:$,addNodeByLine:L,onRemoveNode:F,getFlowComponentMap:v}),e({getData:()=>{const T=[];return p.value.forEach(I=>{T.push({config:I.data,id:I.id,position:I.position,type:I.type})}),m.value.forEach(I=>{T.push({id:I.id,source:I.source,target:I.target,sourceHandle:I.sourceHandle,targetHandle:I.targetHandle,type:"line",config:{},position:{x:0,y:0}})}),T},setData:T=>{if(!T||T.length===0)E.data.isInit=!0,M.value=[E],N(E.id);else{E.data.isInit=!1;const I=[],Y=[];T.forEach(X=>{if(X.type==="line")X.type="button",X.markerEnd=Fe.Arrow,Y.push(X);else{const J={id:X.id,type:X.type,data:X.config,position:X.position};I.push(J)}}),M.value=I,y.value=Y}}}),(T,I)=>{const Y=r.resolveComponent("j-icon"),X=r.resolveComponent("j-form");return r.openBlock(),r.createElementBlock("div",wg,[r.createElementVNode("div",_g,[r.createVNode(vg,{nodes:M.value,edges:y.value},null,8,["nodes","edges"])]),r.withDirectives(r.createElementVNode("div",bg,[r.createElementVNode("div",xg,[r.createElementVNode("div",{class:"d-flow-design-title-icon",style:r.normalizeStyle({backgroundColor:G.value?.iconColor||"var(--j-color-primary)"})},[r.createVNode(Y,{icon:G.value?.icon||"mdi:source-branch"},null,8,["icon"])],4),r.createElementVNode("div",Eg,r.toDisplayString(G.value?.name||""),1)]),r.createElementVNode("div",Cg,[r.createVNode(X,{"form-config":{layout:"vertical"},style:{padding:"0"},ref_key:"configRef",ref:H,onChange:S},null,512)])],512),[[r.vShow,W.value&&_[W.value.data.type]]])])}}})),Ng={class:"d-input-flow j-block"},hr=mt(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=r.ref(),s=r.computed({get(){return n.modelValue},set(f){o("update:modelValue",f)}}),l=r.computed(()=>(n.modelValue?.trim(),n.btnText)),a=f=>{const h=typeof f=="string"?f:void 0;try{i.value?.setData(JSON.parse(h||"[]"))}catch{i.value?.setData([])}},d=async()=>{const f=i.value?.getData();return f?JSON.stringify(f):void 0},c=f=>{if(n.beforeClose){const h=typeof f=="string"?f:void 0;return n.beforeClose(h)}return!0},u=f=>{const h=f.value;o("change",{value:typeof h=="string"?h:void 0})};return(f,h)=>{const g=r.resolveComponent("d-flow-design"),p=r.resolveComponent("j-input-button");return r.openBlock(),r.createBlock(p,r.mergeProps(f.$attrs,{type:t.type,label:l.value,title:t.title,size:t.size,width:t.width,height:t.height,"before-close":c,ok:d,open:a,"destroy-on-close":"",modelValue:s.value,"onUpdate:modelValue":h[0]||(h[0]=m=>s.value=m),onChange:u}),{default:r.withCtx(()=>[r.createElementVNode("div",Ng,[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","label","title","size","width","height","modelValue"])}}}));class z{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 z.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,l=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return l<=s?0:(i-o)*(l-s)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,s)=>{const l=n*((i.y??1e4)-(s.y??1e4));return l===0?n*((i.x??1e4)-(s.x??1e4)):l})}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"&&z.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&&(z.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:z.getScrollElement(e.parentElement)}static updateScrollPosition(e,n,o){const i=z.getScrollElement(e);if(!i)return;const s=e.getBoundingClientRect(),l=i.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,d=s.bottom-Math.min(l.bottom,a),c=s.top-Math.max(l.top,0),u=i.scrollTop;c<0&&o<0?e.offsetHeight>l.height?i.scrollTop+=o:i.scrollTop+=Math.abs(c)>Math.abs(o)?o:c:d>0&&o>0&&(e.offsetHeight>l.height?i.scrollTop+=o:i.scrollTop+=d>o?o:d),n.top+=i.scrollTop-u}static updateScrollResize(e,n,o){const i=z.getScrollElement(n),s=i.clientHeight,l=i===z.getScrollElement()?0:i.getBoundingClientRect().top,a=e.clientY-l,d=a<o,c=a>s-o;d?i.scrollBy({behavior:"smooth",top:a-o}):c&&i.scrollBy({behavior:"smooth",top:o-(s-a)})}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=z.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]=z.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=z.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");z.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)}}class We{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 l=!1;const a={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,...a};c=this._loading&&z.samePos(e,u)?!0:this.moveNode(e,u),(o.locked||this._loading)&&c?z.copyPos(n,e):!o.locked&&c&&i.pack&&(this._packNodes(),n.y=o.y+o.h,z.copyPos(e,n)),l=l||c}else c=this.moveNode(o,{...o,y:n.y+n.h,skip:e,...a});if(!c)return l;o=void 0}return l}collide(e,n=e,o){const i=e._id,s=o?._id;return this.nodes.find(l=>l._id!==i&&l._id!==s&&z.isIntercepted(l,n))}collideAll(e,n=e,o){const i=e._id,s=o?._id;return this.nodes.filter(l=>l._id!==i&&l._id!==s&&z.isIntercepted(l,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 l,a=.5;for(let d of o){if(d.locked||!d._rect)break;const c=d._rect;let u=Number.MAX_VALUE,f=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?f=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(f=(c.x+c.w-s.x)/c.w);const h=Math.min(f,u);h>a&&(a=h,l=d)}return n.collide=l,l}cacheRects(e,n,o,i,s,l){return this.nodes.forEach(a=>a._rect={y:a.y*n+o,x:a.x*e+l,w:a.w*e-l-i,h:a.h*n-o-s}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function o(){const s=n.x,l=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=l):(e.x=s,e.y=l),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=z.isTouching(e,n)))return o();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=z.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=z.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((l,a,d)=>{let c;l.locked||(l.autoPosition=!0,e==="list"&&a&&(c=d[a-1])),this.addNode(l,!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=z.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??We._idSeq++;const o=e.id;if(o){let s=1;for(;this.nodes.find(l=>l.id===e.id&&l!==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 z.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,z.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||z.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 s={...e};s.autoPosition||s.x===void 0?(delete s.x,delete s.y):s.x=Math.min(this.defaultColumn-1,s.x),s.w=Math.min(this.defaultColumn,s.w||1),this.cacheOneLayout(s,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),z.samePos(e,o)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!z.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=z.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||z.samePos(e,e._orig)||(z.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 l=!1;for(let a=s;!l;++a){const d=a%o,c=Math.floor(a/o);if(d+e.w>o)continue;const u={x:d,y:c,w:e.w,h:e.h};n.find(f=>z.isIntercepted(u,f))||((e.x!==d||e.y!==c)&&(e._dirty=!0),e.x=d,e.y=c,delete e.autoPosition,l=!0)}return l}addNode(e,n=!1,o){const i=this.nodes.find(l=>l._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 We({column:this.column,float:this.float,nodes:this.nodes.map(l=>l._id===e._id?(o={...l},o):{...l})});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 l=n.collide.el.gridstackNode;if(this.swap(e,l))return this._notify(),!0}return s?(i.nodes.filter(l=>l._dirty).forEach(l=>{const a=this.nodes.find(d=>d._id===l._id);a&&(z.copyPos(a,l),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new We({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=z.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=z.copyPos({},e,!0);if(z.copyPos(s,n),this.nodeBoundFix(s,i),z.copyPos(n,s),!n.forceCollide&&z.samePos(e,n))return!1;const l=z.copyPos({},e),a=this.collideAll(e,s,n.skip);let d=!0;if(a.length){const c=e._moving&&!n.nested;let u=c?this.directionCollideCoverage(e,n,a):a[0];if(c&&u&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const f=z.areaIntercept(n.rect,u._rect),h=z.area(n.rect),g=z.area(u._rect);f/(h<g?h: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&&!z.samePos(e,s)&&(e._dirty=!0,z.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!z.samePos(e,l)}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 l=[];return this.sortNodes(),this.nodes.forEach(a=>{const d=s?.find(u=>u._id===a._id),c={...a,...d||{}};z.removeInternalForSave(c,!e),n&&n(a,c),l.push(c)}),l}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 l=n.find(a=>a._id===s._id);l&&(l.y>=0&&s.y!==s._orig.y&&(l.y+=s.y-s._orig.y,l.y<0&&(l.y=0)),s.x!==s._orig.x&&(l.x=Math.round(s.x*i),l.x<0&&(l.x=0)),s.w!==s._orig.w&&(l.w=Math.round(s.w*i),l.w<1&&(l.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=[],l=i?this.nodes:z.sort(this.nodes,-1);if(n>e&&this._layouts){const a=this._layouts[n]||[],d=this._layouts.length-1;!a.length&&e!==d&&this._layouts[d]?.length&&(e=d,this._layouts[d].forEach(c=>{const u=l.find(f=>f._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))})),a.forEach(c=>{const u=l.findIndex(f=>f._id===c._id);if(u!==-1){const f=l[u];if(i){f.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,s),c.autoPosition||(f.x=c.x??f.x,f.y=c.y??f.y,f.w=c.w??f.w,s.push(f)),l.splice(u,1)}})}if(i)this.compact(o,!1);else{if(l.length)if(typeof o=="function")o(n,e,s,l);else{const a=i||o==="none"?1:n/e,d=o==="move"||o==="moveScale",c=o==="scale"||o==="moveScale";l.forEach(u=>{u.x=n===1?0:d?Math.round(u.x*a):Math.min(u.x,n-1),u.w=n===1||e===1?1:c?Math.round(u.w*a)||1:Math.min(u.w,n),s.push(u)}),l=[]}s=z.sort(s,-1),this._inColumnResize=!0,this.nodes=[],s.forEach(a=>{this.addNode(a,!1),delete a._orig})}return this.nodes.forEach(a=>delete a._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,o=!1){const i=[];return e.forEach((s,l)=>{if(s._id===void 0){const a=s.id?this.nodes.find(d=>d.id===s.id):void 0;s._id=a?._id??We._idSeq++}i[l]={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??We._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}}We._idSeq=0;const Ne={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"};class de{}const ze=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class ke{}function In(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),z.simulateMouseEvent(t.changedTouches[0],e))}function gr(t,e){t.cancelable&&t.preventDefault(),z.simulateMouseEvent(t,e)}function Bn(t){ke.touchHandled||(ke.touchHandled=!0,In(t,"mousedown"))}function Rn(t){ke.touchHandled&&In(t,"mousemove")}function An(t){if(!ke.touchHandled)return;ke.pointerLeaveTimeout&&(window.clearTimeout(ke.pointerLeaveTimeout),delete ke.pointerLeaveTimeout);const e=!!de.dragElement;In(t,"mouseup"),e||In(t,"click"),ke.touchHandled=!1}function $n(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function pr(t){de.dragElement&&t.pointerType!=="mouse"&&gr(t,"mouseenter")}function mr(t){de.dragElement&&t.pointerType!=="mouse"&&(ke.pointerLeaveTimeout=window.setTimeout(()=>{delete ke.pointerLeaveTimeout,gr(t,"mouseleave")},10))}class Pn{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(`${Pn.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),ze&&(this.el.addEventListener("touchstart",Bn),this.el.addEventListener("pointerdown",$n)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),ze&&(this.el.removeEventListener("touchstart",Bn),this.el.removeEventListener("pointerdown",$n)),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),ze&&(this.el.addEventListener("touchmove",Rn),this.el.addEventListener("touchend",An)),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),ze&&(this.el.removeEventListener("touchmove",Rn),this.el.removeEventListener("touchend",An)),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}}Pn.prefix="ui-resizable-";class Oo{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,n){this._eventRegister[e]=n}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,n){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](n)}}class Ft extends Oo{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const i=this.el.parentElement.getBoundingClientRect(),s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},l=this.temporalRect||s;return{position:{left:(l.left-i.left)*this.rectScale.x,top:(l.top-i.top)*this.rectScale.y},size:{width:l.width*this.rectScale.x,height:l.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 Pn(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=z.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=z.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=z.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=z.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=z.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=Ft._originStyleProp.map(o=>this.el.style[o]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=z.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 Ft._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,l=this.sizeToContent?0:e.clientY-o.clientY;let a,d;n.indexOf("e")>-1?i.width+=s:n.indexOf("w")>-1&&(i.width-=s,i.left+=s,a=!0),n.indexOf("s")>-1?i.height+=l:n.indexOf("n")>-1&&(i.height-=l,i.top+=l,d=!0);const c=this._constrainSize(i.width,i.height,a,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,l=(o?s.maxWidthMoveLeft:s.maxWidth)||Number.MAX_SAFE_INTEGER,a=s.minWidth/this.rectScale.x||e,d=(i?s.maxHeightMoveUp:s.maxHeight)||Number.MAX_SAFE_INTEGER,c=s.minHeight/this.rectScale.y||n,u=Math.min(l,Math.max(a,e)),f=Math.min(d,Math.max(c,n));return{width:u,height:f}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const n=this.el.parentElement,{left:o,top:i}=n.getBoundingClientRect();e={left:o,top:i,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}}Ft._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const kg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Gt extends Oo{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),ze&&(e.addEventListener("touchstart",Bn),e.addEventListener("pointerdown",$n))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),ze&&(n.removeEventListener("touchstart",Bn),n.removeEventListener("pointerdown",$n))}),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(ke.touchHandled&&e.isTrusted&&(ke.touchHandled=!1),!de.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(kg)||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),ze&&(e.currentTarget.addEventListener("touchmove",Rn),e.currentTarget.addEventListener("touchend",An)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),de.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=z.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=z.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const i=z.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),ze&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Rn,!0),e.currentTarget.removeEventListener("touchend",An,!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=z.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(!z.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",z.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=z.cloneNode(this.el)),e.parentElement||z.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Gt.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 n=this.helper,o=this.dragElementOriginStyle.transition||null;n.style.transition=this.dragElementOriginStyle.transition="none",Gt.originStyleProp.forEach(i=>n.style[i]=this.dragElementOriginStyle[i]||null),setTimeout(()=>n.style.transition=o,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 l=n.getBoundingClientRect();return{left:l.left,top:l.top,offsetLeft:-e.clientX+l.left-i,offsetTop:-e.clientY+l.top-s,width:l.width*this.dragTransform.xScale,height:l.height*this.dragTransform.yScale}}ui(){const n=this.el.parentElement.getBoundingClientRect(),o=this.helper.getBoundingClientRect();return{position:{top:(o.top-n.top)*this.dragTransform.yScale,left:(o.left-n.left)*this.dragTransform.xScale}}}}Gt.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Sg extends Oo{constructor(e,n={}){super(),this.el=e,this.option=n,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,n){super.on(e,n)}off(e){super.off(e)}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),ze&&(this.el.addEventListener("pointerenter",pr),this.el.addEventListener("pointerleave",mr)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),ze&&(this.el.removeEventListener("pointerenter",pr),this.el.removeEventListener("pointerleave",mr)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this._setupAccept(),this}_mouseEnter(e){if(!de.dragElement||ke.touchHandled&&e.isTrusted||!this._canDrop(de.dragElement.el))return;e.preventDefault(),e.stopPropagation(),de.dropElement&&de.dropElement!==this&&de.dropElement._mouseLeave(e,!0),de.dropElement=this;const n=z.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(n,this._ui(de.dragElement)),this.triggerEvent("dropover",n),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,n=!1){if(!de.dragElement||de.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const o=z.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(o,this._ui(de.dragElement)),this.triggerEvent("dropout",o),de.dropElement===this&&(delete de.dropElement,!n)){let i,s=this.el.parentElement;for(;!i&&s;)i=s.ddElement?.ddDroppable,s=s.parentElement;i&&i._mouseEnter(e)}}drop(e){e.preventDefault();const n=z.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(n,this._ui(de.dragElement)),this.triggerEvent("drop",n)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class Ho{static init(e){return e.ddElement||(e.ddElement=new Ho(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 Gt(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 Ft(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 Sg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Mg{resizable(e,n,o,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddResizable&&s.ddResizable[n]();else if(n==="destroy")s.ddResizable&&s.cleanResizable();else if(n==="option")s.setupResizable({[o]:i});else{const a=s.el.gridstackNode.grid;let d=s.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";d==="all"&&(d="n,e,s,w,se,sw,ne,nw");const c=!a.opts.alwaysShowResizeHandle;s.setupResizable({...a.opts.resizable,handles:d,autoHide:c,start:n.start,stop:n.stop,resize:n.resize})}}),this}draggable(e,n,o,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddDraggable&&s.ddDraggable[n]();else if(n==="destroy")s.ddDraggable&&s.cleanDraggable();else if(n==="option")s.setupDraggable({[o]:i});else{const l=s.el.gridstackNode.grid;s.setupDraggable({...l.opts.draggable,start:n.start,stop:n.stop,drag:n.drag})}}),this}dragIn(e,n){return this._getDDElements(e).forEach(o=>o.setupDraggable(n)),this}droppable(e,n,o,i){return typeof n.accept=="function"&&!n._accept&&(n._accept=n.accept,n.accept=s=>n._accept(s)),this._getDDElements(e,n).forEach(s=>{n==="disable"||n==="enable"?s.ddDroppable&&s.ddDroppable[n]():n==="destroy"?s.ddDroppable&&s.cleanDroppable():n==="option"?s.setupDroppable({[o]:i}):s.setupDroppable(n)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,n,o){return this._getDDElements(e).forEach(i=>i.on(n,s=>{o(s,de.dragElement?de.dragElement.el:s.target,de.dragElement?de.dragElement.helper:null)})),this}off(e,n){return this._getDDElements(e).forEach(o=>o.off(n)),this}_getDDElements(e,n){const o=e.gridstack||n!=="destroy"&&n!=="disable",i=z.getElements(e);return i.length?i.map(l=>l.ddElement||(o?Ho.init(l):null)).filter(l=>l):[]}}const be=new Mg;class ae{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const o=ae.getGridElement(n);return o?(o.gridstack||(o.gridstack=new ae(o,z.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"||(ae.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new ae(i,z.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 l=o.gridstack;return n&&(l.opts={...l.opts,...n}),n.children!==void 0&&l.load(n.children),l}return(!e.classList.contains("grid-stack")||ae.addRemoveCB)&&(ae.addRemoveCB?o=ae.addRemoveCB(e,n,!0,!0):o=z.createDiv(["grid-stack",n.class],e)),ae.init(n,o)}static registerEngine(e){ae.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=z.createDiv([this.opts.placeholderClass,Ne.itemClass,this.opts.itemClass]);const e=z.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=z.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 c=i.breakpoints;!i.columnWidth&&!c?.length?delete n.columnOpts:(i.columnMax=i.columnMax||12,c?.length>1&&c.sort((u,f)=>(f.w||0)-(u.w||0)))}const s={...z.cloneDeep(Ne),column:z.toNumber(e.getAttribute("gs-column"))||Ne.column,minRow:o||z.toNumber(e.getAttribute("gs-min-row"))||Ne.minRow,maxRow:o||z.toNumber(e.getAttribute("gs-max-row"))||Ne.maxRow,staticGrid:z.toBool(e.getAttribute("gs-static"))||Ne.staticGrid,sizeToContent:z.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||Ne.draggable.handle},removableOptions:{accept:n.itemClass||Ne.removableOptions.accept,decline:Ne.removableOptions.decline}};e.getAttribute("gs-animate")&&(s.animate=z.toBool(e.getAttribute("gs-animate"))),n=z.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("."+Ne.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!==Ne.cellHeightUnit&&(n.cellHeight=n.cellHeight+n.cellHeightUnit,delete n.cellHeightUnit);const c=n.cellHeight;delete n.cellHeight,this.cellHeight(c)}n.alwaysShowResizeHandle==="mobile"&&(n.alwaysShowResizeHandle=ze),this._setStaticClass();const d=n.engineClass||ae.engineClass||We;if(this.engine=new d({column:this.getColumn(),float:n.float,maxRow:n.maxRow,onChange:c=>{c.forEach(u=>{const f=u.el;f&&(u._removeDOM?(f&&f.remove(),delete u._removeDOM):this._writePosAttr(f,u))}),this._updateContainerHeight()}}),n.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(c=>this._prepareElement(c)),delete this.engine._loading,this.batchUpdate(!1)),n.children){const c=n.children;delete n.children,c.length&&this.load(c)}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:ae.addRemoveCB?n=ae.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 z.defaults(e,i),this.engine.prepareNode(e),this.el.appendChild(n),this.makeWidget(n,e),n}createWidgetDivs(e){const n=z.createDiv(["grid-stack-item",this.opts.itemClass]),o=z.createDiv(["grid-stack-item-content"],n);return z.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([i])=>{i.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,ae.renderCB(o,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(n))):ae.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 l,a=this;for(;a&&!l;)l=a.opts?.subGridOpts,a=a.parentGridNode?.grid;n=z.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...l||{},...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,f;if(i&&(this._removeDD(s.el),f={...s,x:0,y:0},z.removeInternalForSave(f),delete f.subGridOpts,s.content&&(f.content=s.content,delete s.content),ae.addRemoveCB?u=ae.addRemoveCB(this.el,f,!0,!1):(u=z.createDiv(["grid-stack-item"]),u.appendChild(c),c=z.createDiv(["grid-stack-item-content"],s.el)),this.prepareDragDrop(s.el)),o){const g=d?n.column:s.w,p=s.h+o.h,m=s.el.style;m.transition="none",this.update(s.el,{w:g,h:p}),setTimeout(()=>m.transition=null)}const h=s.subGrid=ae.addGrid(c,n);return o?._moving&&(h._isTemp=!0),d&&(h._autoColumn=!0),i&&h.makeWidget(u,f),o&&(o._moving?window.setTimeout(()=>z.simulateMouseEvent(o._event,"mouseenter",h.el),0):h.makeWidget(s.el,s)),this.resizeToContentCheck(!1,s),h}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(()=>z.simulateMouseEvent(e._event,"mouseenter",n.el),0))}save(e=!0,n=!1,o=ae.saveCB,i){const s=this.engine.save(e,o,i);if(s.forEach(l=>{if(e&&l.el&&!l.subGrid&&!o){const a=l.el.querySelector(".grid-stack-item-content");l.content=a?.innerHTML,l.content||delete l.content}else if(!e&&!o&&delete l.content,l.subGrid?.el){const a=l.w||l.subGrid.getColumn(),d=l.subGrid.save(e,n,o,a);l.subGridOpts=n?d:{children:d},delete l.subGrid}delete l.el}),n){const l=z.cloneDeep(this.opts);l.marginBottom===l.marginTop&&l.marginRight===l.marginLeft&&l.marginTop===l.marginRight&&(l.margin=l.marginTop,delete l.marginTop,delete l.marginRight,delete l.marginBottom,delete l.marginLeft),l.rtl===(this.el.style.direction==="rtl")&&(l.rtl="auto"),this._isAutoCellHeight&&(l.cellHeight="auto"),this._autoColumn&&(l.column="auto");const a=l._alwaysShowResizeHandle;return delete l._alwaysShowResizeHandle,a!==void 0?l.alwaysShowResizeHandle=a:delete l.alwaysShowResizeHandle,z.removeInternalAndSame(l,Ne),l.children=s,l}return s}load(e,n=ae.addRemoveCB||!0){e=z.cloneDeep(e);const o=this.getColumn();e.forEach(u=>{u.w=u.w||u.minW||1,u.h=u.h||u.minH||1}),e=z.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=ae.addRemoveCB;typeof n=="function"&&(ae.addRemoveCB=n);const l=[];this.batchUpdate();const a=!this.engine.nodes.length,d=a&&this.opts.animate;d&&this.setAnimation(!1),!a&&n&&[...this.engine.nodes].forEach(f=>{if(!f.id)return;z.find(e,f.id)||(ae.addRemoveCB&&ae.addRemoveCB(this.el,f,!1,!1),l.push(f),this.removeWidget(f.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(u=>z.find(e,u.id)?(c.push(u),!1):!0),e.forEach(u=>{const f=z.find(c,u.id);if(f){if(z.shouldSizeToContent(f)&&(u.h=f.h),this.engine.nodeBoundFix(u),(u.autoPosition||u.x===void 0||u.y===void 0)&&(u.w=u.w||f.w,u.h=u.h||f.h,this.engine.findEmptyPosition(u)),this.engine.nodes.push(f),z.samePos(f,u)&&this.engine.nodes.length>1&&(this.moveNode(f,{...u,forceCollide:!0}),z.copyPos(u,f)),this.update(f.el,u),u.subGridOpts?.children){const h=f.el.querySelector(".grid-stack");h&&h.gridstack&&h.gridstack.load(u.subGridOpts.children)}}else n&&this.addWidget(u)}),delete this.engine._loading,this.engine.removedNodes=l,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,s?ae.addRemoveCB=s:delete ae.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=z.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=z.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(l=>l.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,l=e.top-i.top,a=o.width/this.getColumn(),d=o.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(s/a),y:Math.floor(l/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=ae.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(i=>this.on(i,n)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=i=>n(i):this._gsEventHandler[e]=i=>{i.detail&&n(i,i.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(o=>this.off(o)),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?(ae.getElements(e).forEach(i=>{if(i.parentElement&&i.parentElement!==this.el)return;let s=i.gridstackNode;s||(s=this.engine.nodes.find(l=>i===l.el)),s&&(n&&ae.addRemoveCB&&ae.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&&ae.addRemoveCB&&ae.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 ae.getElements(e).forEach(o=>{const i=o?.gridstackNode;if(!i)return;const s={...z.copyPos({},i),...z.cloneDeep(n)};this.engine.nodeBoundFix(s),delete s.autoPosition;const l=["x","y","w","h"];let a;if(l.some(u=>s[u]!==void 0&&s[u]!==i[u])&&(a={},l.forEach(u=>{a[u]=s[u]!==void 0?s[u]:i[u],delete s[u]})),!a&&(s.minW||s.minH||s.maxW||s.maxH)&&(a={}),s.content!==void 0){const u=o.querySelector(".grid-stack-item-content");u&&u.textContent!==s.content&&(i.content=s.content,ae.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(z.sanitizeMinMax(i),a){const u=a.w!==void 0&&a.w!==i.w;this.moveNode(i,a),u&&i.subGrid?i.subGrid.onResize(this.hasAnimationCSS()?i.w:void 0):this.resizeToContentCheck(u,i),delete i._orig}(a||d)&&this._writeAttr(o,i),c&&this.prepareDragDrop(i.el),ae.updateCB&&ae.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,l;if(n.resizeToContentParent&&(l=e.querySelector(n.resizeToContentParent)),l||(l=e.querySelector(ae.resizeToContentParent)),!l)return;const a=e.clientHeight-l.clientHeight,d=n.h?n.h*i-a:l.clientHeight;let c;if(n.subGrid){c=n.subGrid.getRow()*n.subGrid.getCellHeight(!0);const h=n.subGrid.el.getBoundingClientRect(),g=e.getBoundingClientRect();c+=h.top-g.top}else{if(n.subGridOpts?.children?.length)return;{const h=l.firstElementChild;if(!h){console.error(`Error: GridStack.resizeToContent() widget id:${n.id} '${ae.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=h.getBoundingClientRect().height||d}}if(d===c)return;s+=c-d;let u=Math.ceil(s/i);const f=Number.isInteger(n.sizeToContent)?n.sizeToContent:0;f&&u>f&&(u=f,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){ae.resizeToContentCB?ae.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return ae.getElements(e).forEach(o=>{const i=o.gridstackNode;if(!z.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 a=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+a-(i.h-(d+1)),s.y=i.y+d-a}Object.keys(s).forEach(a=>{s[a]===void 0&&delete s[a]});const l=i._orig;this.update(o,s),i._orig=l}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const o=z.parseHeight(e);if(this.opts.marginUnit===o.unit&&this.opts.margin===o.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=z.parseHeight(getComputedStyle(this.el).minHeight);if(s.h>0&&s.unit===i){const l=Math.floor(s.h/o);n<l&&(n=l)}}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&&z.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(Ne.itemClass,this.opts.itemClass);const i=z.shouldSizeToContent(o);return i?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),i&&this.resizeToContentCheck(!1,o),z.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=z.toNumber(e.getAttribute("gs-x")),o.y=z.toNumber(e.getAttribute("gs-y")),o.w=z.toNumber(e.getAttribute("gs-w")),o.h=z.toNumber(e.getAttribute("gs-h")),o.autoPosition=z.toBool(e.getAttribute("gs-auto-position")),o.noResize=z.toBool(e.getAttribute("gs-no-resize")),o.noMove=z.toBool(e.getAttribute("gs-no-move")),o.locked=z.toBool(e.getAttribute("gs-locked"));const i=e.getAttribute("gs-size-to-content");i&&(i==="true"||i==="false"?o.sizeToContent=z.toBool(i):o.sizeToContent=parseInt(i,10)),o.id=e.getAttribute("gs-id"),o.maxW=z.toNumber(e.getAttribute("gs-max-w")),o.minW=z.toNumber(e.getAttribute("gs-min-w")),o.maxH=z.toNumber(e.getAttribute("gs-max-h")),o.minH=z.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)z.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.el);else if(this.engine.nodes.some(o=>z.shouldSizeToContent(o))){const o=[...this.engine.nodes];this.batchUpdate(),o.forEach(i=>{z.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=z.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 z.getElement(e)}static getElements(e=".grid-stack-item"){return z.getElements(e)}static getGridElement(e){return ae.getElement(e)}static getGridElements(e){return z.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=z.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,n=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(l=>{this.opts[l]===void 0?this.opts[l]=n:(e=z.parseHeight(this.opts[l]),this.opts[l]=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 s=this.el.style;return s.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),s.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return be}static setupDragIn(e,n,o,i=document){n?.pause!==void 0&&(de.pauseDrag=n.pause),n={appendTo:"body",helper:"clone",...n||{}},(typeof e=="string"?z.getElements(e,i):e).forEach((l,a)=>{be.isDraggable(l)||be.dragIn(l,n),o?.[a]&&(l.gridstackNode=o[a])})}movable(e,n){return this.opts.staticGrid?this:(ae.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:(ae.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&&ae._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return be.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 be.droppable(this.el,"destroy"),this;let e,n;const o=(i,s,l)=>{l=l||s;const a=l.gridstackNode;if(!a)return;if(!a.grid?.el){l.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const h=l.getBoundingClientRect();l.style.left=h.x+(this.dragTransform.xScale-1)*(i.clientX-h.x)/this.dragTransform.xScale+"px",l.style.top=h.y+(this.dragTransform.yScale-1)*(i.clientY-h.y)/this.dragTransform.yScale+"px",l.style.transformOrigin="0px 0px"}let{top:d,left:c}=l.getBoundingClientRect();const u=this.el.getBoundingClientRect();c-=u.left,d-=u.top;const f={position:{top:d*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(c/n)),a.y=Math.max(0,Math.round(d/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){be.off(s,"drag");return}a._willFitPos&&(z.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(l,i,f,a,n,e)}else this._dragOrResize(l,i,f,a,n,e)};return be.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 l=!0;if(typeof this.opts.acceptWidgets=="function")l=this.opts.acceptWidgets(i);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;l=i.matches(a)}if(l&&s&&this.opts.maxRow){const a={w:s.w,h:s.h,minW:s.minW,minH:s.minH};l=this.engine.willItFit(a)}return l}}).on(this.el,"dropover",(i,s,l)=>{let a=l?.gridstackNode||s.gridstackNode;if(a?.grid===this&&!a._temporaryRemoved)return!1;if(a?._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a?.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(s,l),l=l||s,n=this.cellWidth(),e=this.getCellHeight(!0),!a){const u=l.getAttribute("data-gs-widget")||l.getAttribute("gridstacknode");if(u){try{a=JSON.parse(u)}catch{console.error("Gridstack dropover: Bad JSON format: ",u)}l.removeAttribute("data-gs-widget"),l.removeAttribute("gridstacknode")}a||(a=this._readAttr(l)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,l.gridstackNode=a);const d=a.w||Math.round(l.offsetWidth/n)||1,c=a.h||Math.round(l.offsetHeight/e)||1;return a.grid&&a.grid!==this?(s._gridstackNodeOrig||(s._gridstackNodeOrig=a),s.gridstackNode=a={...a,w:d,h:c,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=d,a.h=c,a._temporaryRemoved=!0),ae._itemRemoving(a.el,!1),be.on(s,"drag",o),o(i,s,l),!1}).on(this.el,"dropout",(i,s,l)=>{const a=l?.gridstackNode||s.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(s,l),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(i,s,l)=>{const a=l?.gridstackNode||s.gridstackNode;if(a?.grid===this&&!a._isExternal)return!1;const d=!!this.placeholder.parentElement,c=s!==l;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 h=u.grid;h.engine.removeNodeFromLayoutCache(u),h.engine.removedNodes.push(u),h._triggerRemoveEvent()._triggerChangeEvent(),h.parentGridNode&&!h.engine.nodes.length&&h.opts.subGridDynamic&&h.removeAsSubGrid()}if(!a||(d&&(this.engine.cleanupNode(a),a.grid=this),delete a.grid?._isTemp,be.off(s,"drag"),l!==s?(l.remove(),s=l):s.remove(),this._removeDD(s),!d))return!1;const f=a.subGrid?.el?.gridstack;return z.copyPos(a,this._readAttr(this.placeholder)),z.removePositioningStyles(s),c&&(a.content||a.subGridOpts||ae.addRemoveCB)?(delete a.el,s=this.addWidget(a)):(this._prepareElement(s,!0,a),this.el.appendChild(s),this.resizeToContentCheck(!1,a),f&&(f.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...i,type:"dropped"},u&&u.grid?u:void 0,a),!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&&!be.isDroppable(e)&&be.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,o)=>ae._itemRemoving(o,!0)).on(e,"dropout",(n,o)=>ae._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,l=this.opts.staticGrid||i&&s;if((n||l)&&(o._initDD&&(this._removeDD(e),delete o._initDD),l&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!n))return this;if(!o._initDD){let a,d;const c=(h,g)=>{this.triggerEvent(h,h.target),a=this.cellWidth(),d=this.getCellHeight(!0),this._onStartMoving(e,h,g,o,a,d)},u=(h,g)=>{this._dragOrResize(e,h,g,o,a,d)},f=h=>{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=h.target;if(!(!p.gridstackNode||p.gridstackNode.grid!==this)){if(o.el=p,o._isAboutToRemove){const m=e.gridstackNode.grid;m._gsEventHandler[h.type]&&m._gsEventHandler[h.type](h,p),m.engine.nodes.push(o),m.removeWidget(e,!0,!0)}else z.removePositioningStyles(p),o._temporaryRemoved?(this._writePosAttr(p,o),this.engine.addNode(o)):this._writePosAttr(p,o),this.triggerEvent(h,p);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),h.type==="resizestop"&&(Number.isInteger(o.sizeToContent)&&(o.sizeToContent=o.h),this.resizeToContentCheck(g,o))}};be.draggable(e,{start:c,stop:f,drag:u}).resizable(e,{start:c,stop:f,resize:u}),o._initDD=!0}return be.draggable(e,i?"disable":"enable").resizable(e,s?"disable":"enable"),this}_onStartMoving(e,n,o,i,s,l){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=z.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const a=this.placeholder.closest(".grid-stack");this.dragTransform=z.getValuesFromTransformedElement(a)}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,l,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),n.type==="resizestart"){const a=this.getColumn()-i.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-i.y;be.resizable(e,"option","minWidth",s*Math.min(i.minW||1,a)).resizable(e,"option","minHeight",l*Math.min(i.minH||1,d)).resizable(e,"option","maxWidth",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,a)).resizable(e,"option","maxWidthMoveLeft",s*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,i.x+i.w)).resizable(e,"option","maxHeight",l*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",l*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,i.y+i.h))}}_dragOrResize(e,n,o,i,s,l){const a={...i._orig};let d,c=this.opts.marginLeft,u=this.opts.marginRight,f=this.opts.marginTop,h=this.opts.marginBottom;const g=Math.round(l*.1),p=Math.round(s*.1);if(c=Math.min(c,p),u=Math.min(u,p),f=Math.min(f,g),h=Math.min(h,g),n.type==="drag"){if(i._temporaryRemoved)return;const v=o.position.top-i._prevYPix;i._prevYPix=o.position.top,this.opts.draggable.scroll!==!1&&z.updateScrollPosition(e,o.position,v);const E=o.position.left+(o.position.left>i._lastUiPosition.left?-u:c),M=o.position.top+(o.position.top>i._lastUiPosition.top?-h:f);a.x=Math.round(E/s),a.y=Math.round(M/l);const y=this._extraDragRow;if(this.engine.collide(i,a)){const C=this.getRow();let $=Math.max(0,a.y+i.h-C);this.opts.maxRow&&C+$>this.opts.maxRow&&($=Math.max(0,this.opts.maxRow-C)),this._extraDragRow=$}else this._extraDragRow=0;if(this._extraDragRow!==y&&this._updateContainerHeight(),i.x===a.x&&i.y===a.y)return}else if(n.type==="resize"){if(a.x<0||(z.updateScrollResize(n,e,l),a.w=Math.round((o.size.width-c)/s),a.h=Math.round((o.size.height-f)/l),i.w===a.w&&i.h===a.h)||i._lastTried&&i._lastTried.w===a.w&&i._lastTried.h===a.h)return;const v=o.position.left+c,E=o.position.top+f;a.x=Math.round(v/s),a.y=Math.round(E/l),d=!0}i._event=n,i._lastTried=a;const m={x:o.position.left+c,y:o.position.top+f,w:(o.size?o.size.width:i.w*s)-c-u,h:(o.size?o.size.height:i.h*l)-f-h};if(this.engine.moveNodeCheck(i,{...a,cellWidth:s,cellHeight:l,rect:m,resizing:d})){i._lastUiPosition=o.position,this.engine.cacheRects(s,l,f,u,h,c),delete i._skipDown,d&&i.subGrid&&i.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const v=n.target;i._sidebarOrig||this._writePosAttr(v,i),this.triggerEvent(n,v)}}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,be.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&&ae._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):o._isExternal&&this.engine.restoreInitial()}}ae.renderCB=(t,e)=>{t&&e?.content&&(t.textContent=e.content)},ae.resizeToContentParent=".grid-stack-item-content",ae.Utils=z,ae.Engine=We,ae.GDRev="12.4.2";const Dg={class:"d-layout"},zg=["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"],yr=mt(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=r.ref();let l=null;const a=async()=>{s.value&&(await r.nextTick(),l&&l.destroy(!1),l=ae.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),l.on("added",(h,g)=>{const p=g[0];if(p){const m=d(p);i("added",m),u()}}),l.on("removed",(h,g)=>{const p=g[0];if(p){const m=d(p);i("removed",m),u()}}),l.on("change",()=>{u();const g=(l?.save()||[]).map(p=>d(p));i("changed",g)}),l.on("dragstart",(h,g)=>{if(g){const p=g.gridstackNode||g,m=d(p);i("dragStart",h,m)}}),l.on("dragstop",(h,g)=>{if(g){const p=g.gridstackNode||g,m=d(p);i("dragStop",h,m)}}),l.on("resizestart",(h,g)=>{if(g){const p=g.gridstackNode||g,m=d(p);i("resizeStart",h,m)}}),l.on("resizestop",(h,g)=>{if(g){const p=g.gridstackNode||g,m=d(p);i("resizeStop",h,m)}}))},d=h=>({id:h.id||h.el?.getAttribute("gs-id")||"",x:h.x||0,y:h.y||0,w:h.w||1,h:h.h||1,locked:h.locked||!1,noResize:h.noResize||!1,noMove:h.noMove||!1,minW:h.minW,minH:h.minH,maxW:h.maxW,maxH:h.maxH}),c=async()=>{if(!l||!s.value)return;await r.nextTick();const h=l.engine.nodes;new Set(h.map(p=>p.id));const g=new Set(o.modelValue.map(p=>p.id));h.forEach(p=>{if(!g.has(p.id||"")){const m=p.el;m&&l&&l.removeWidget(m,!1)}}),o.modelValue.forEach(p=>{const m=h.find(v=>v.id===p.id);if(m)m.el&&l&&l.update(m.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||!l)return;const v=s.value.querySelector(`[gs-id="${p.id}"]`);v&&l.makeWidget(v)}})},u=()=>{if(!l)return;const g=l.save().map(p=>{const m={id:p.id||"",x:p.x||0,y:p.y||0,w:p.w||1,h:p.h||1},v=o.modelValue.find(E=>E.id===m.id);return v&&Object.keys(v).forEach(E=>{["id","x","y","w","h"].includes(E)||(m[E]=v[E])}),m});i("update:modelValue",g)},f=r.computed(()=>o.modelValue);return r.watch(()=>o.modelValue,async()=>{l&&(await r.nextTick(),c())},{deep:!0}),r.watch(()=>[o.column,o.cellHeight,o.draggable,o.resizable,o.disable,o.animate,o.float,o.removable],()=>{a()}),r.onMounted(()=>{a()}),r.onBeforeUnmount(()=>{l&&(l.destroy(!1),l=null)}),e({addItem:async h=>{if(l&&s.value){await r.nextTick();const g=s.value.querySelector(`[gs-id="${h.id}"]`);g&&(l.makeWidget(g),l.update(g,{x:h.x,y:h.y,w:h.w,h:h.h,locked:h.locked,noResize:h.noResize,noMove:h.noMove,minW:h.minW,minH:h.minH,maxW:h.maxW,maxH:h.maxH}))}},removeItem:h=>{if(l&&s.value){const g=s.value.querySelector(`[gs-id="${h}"]`);g&&l.removeWidget(g,!1)}},clear:()=>{l&&l.removeAll(!1)},getGrid:()=>l}),(h,g)=>(r.openBlock(),r.createElementBlock("div",Dg,[r.createElementVNode("div",{ref_key:"gridContainerRef",ref:s},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(f.value,p=>(r.openBlock(),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"},[r.renderSlot(h.$slots,"item",{item:p})],8,zg))),128))],512)]))}})),ve=(t,e="",n=!1)=>n?`${t}pt`:e?`${t}${e}`:`${t}px`,Ee=(t,e=0)=>t==null||isNaN(t)?0:Number(Number(t).toFixed(e)),Tg=t=>t*3/4,Ig=t=>t*4/3,Bg=["onMousedown"],Rg={key:2,class:"d-draggable__mask"},vr=mt(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=r.ref(),l=r.ref(),a=r.ref(0),d=r.ref(0),c=r.ref(0),u=r.ref(0),f=r.ref(null),h=r.ref(!1),g=r.ref(!1),p=r.ref(!1),m=r.ref(!1),v=r.ref([{classname:"left"},{classname:"right"},{classname:"top"},{classname:"bottom"},{classname:"top-left"},{classname:"top-right"},{classname:"bottom-left"},{classname:"bottom-right"}]),E=r.computed(()=>o.scale),M=r.computed(()=>({left:ve(E.value,"",o.isPt)})),y=r.computed(()=>({left:ve(-E.value,"",o.isPt)})),C=r.computed(()=>({left:"auto",right:ve(-E.value,"",o.isPt)})),$=r.computed(()=>({top:ve(-E.value,"",o.isPt)})),O=r.computed(()=>({top:"auto",bottom:ve(-E.value,"",o.isPt)})),L=r.computed(()=>{const P=8*E.value;return{width:ve(P,"",o.isPt),height:ve(P,"",o.isPt)}}),j=r.computed(()=>({fontSize:ve(16*E.value,"",o.isPt)})),W=r.computed(()=>Object.assign((()=>{if(m.value){const P={zIndex:9999,...M.value};return o.isActiveBgTransparent&&(m.value||g.value)&&!o.readonly&&!o.disabled&&(P.backgroundColor="color-mix(in srgb, var(--j-color-primary-bg) 60%, transparent)"),P}return{zIndex:o.zIndex}})(),{top:ve(u.value,"",o.isPt),width:ve(a.value,"",o.isPt),height:ve(d.value,"",o.isPt),padding:ve(8*E.value,"",o.isPt),...M.value,left:ve(c.value,"",o.isPt)}));r.watch(()=>o.width,P=>{a.value=Ee(F(P))||(f.value?.offsetWidth??0)}),r.watch(()=>o.height,P=>{d.value=Ee(F(P))||(f.value?.offsetHeight??0)},{deep:!0}),r.watch(()=>o.left,P=>{c.value=Ee(F(P))}),r.watch(()=>o.top,P=>{u.value=Ee(F(P))}),r.watch(a,P=>{s.value&&(s.value.style.width=ve(P,"",o.isPt),o.resize&&f.value?.style&&(f.value.style.width=ve(P,"",o.isPt)))}),r.watch(d,P=>{s.value&&(s.value.style.height=ve(P,"",o.isPt),o.resize&&f.value?.style&&(f.value.style.height=ve(P,"",o.isPt)))}),r.watch(()=>o.activeFlag,P=>{G(P)});const G=P=>{m.value=P},F=P=>P===void 0?0:o.isPt?Ig(P):P,N=()=>{l.value&&l.value.firstChild&&(f.value=l.value.firstChild,a.value=Ee(F(o.width))||(f.value?.offsetWidth??0),d.value=Ee(F(o.height))||(f.value?.offsetHeight??0),c.value=Ee(F(o.left)),u.value=Ee(F(o.top)),G(o.activeFlag))},H=P=>{c.value=P},_=P=>{u.value=P},A=P=>{const Z=8*E.value/2,B={};return P.split("-").forEach(K=>{B[K]=ve(-Z,"",o.isPt)}),B},S=P=>{g.value=P},R=P=>o.isPt?Tg(P):P,V=()=>{h.value=!0,i("focus",{index:o.index,width:R(a.value),height:R(d.value),left:R(c.value),top:R(u.value)})},T=()=>{h.value=!1,p.value=!1,i("blur",{index:o.index,width:R(a.value),height:R(d.value),left:R(c.value),top:R(u.value)})},I=()=>{document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,T()}},Y=(P,Z)=>{if(o.disabled||o.readonly)return;let B,U,K,te,ce,q;p.value=!0,V();let ie=P.clientX,b=P.clientY;document.onmousemove=w=>{h.value=!0,Z==="right"?(B=!0,U=!1):Z==="left"?(B=!0,K=!0,ce=!0,U=!1):Z==="top"?(B=!1,U=!0,te=!0,q=!0):Z==="bottom"?(B=!1,U=!0):Z==="bottom-right"?(B=!0,U=!0):Z==="bottom-left"?(B=!0,U=!0,K=!0,ce=!0):Z==="top-right"?(B=!0,U=!0,te=!0,q=!0):Z==="top-left"&&(B=!0,U=!0,K=!0,ce=!0,te=!0,q=!0);const x=w.clientX-ie,D=w.clientY-b;if(ie=w.clientX,b=w.clientY,B){let k=x*o.step;ce&&(k=-k),K&&(c.value=Ee(c.value-k)),a.value=Ee(a.value+k)}if(U){let k=D*o.step;q&&(k=-k),te&&(u.value=Ee(u.value-k)),d.value=Ee(d.value+k)}},I()},X=()=>{g.value=!1,i("out",{index:o.index,width:R(a.value),height:R(d.value),left:R(c.value),top:R(u.value)})},J=()=>{o.disabled||o.readonly||(g.value=!0,i("over",{index:o.index,width:R(a.value),height:R(d.value),left:R(c.value),top:R(u.value)}))},re=P=>{if(o.disabled||o.readonly)return;m.value=!0,V();let Z=P.clientX,B=P.clientY;document.onmousemove=U=>{const K=U.clientX-Z,te=U.clientY-B;Z=U.clientX,B=U.clientY,c.value=Ee(c.value+K*o.step),u.value=Ee(u.value+te*o.step)},I()};return r.onMounted(()=>{N()}),e({setActive:G,setLeft:H,setTop:_,setOverActive:S}),(P,Z)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["d-draggable",{"d-draggable--active":(m.value||g.value)&&!t.readonly&&!t.disabled},{"d-draggable--pt":t.isPt&&!t.readonly&&!t.disabled},{"d-draggable--move":h.value},{"d-draggable--click":t.disabled}]),onMousedown:r.withModifiers(re,["stop"]),onMouseover:r.withModifiers(J,["stop"]),onMouseout:r.withModifiers(X,["stop"]),style:r.normalizeStyle(W.value)},[r.createElementVNode("div",{class:"d-draggable__wrapper",ref_key:"wrapper",ref:s},[(m.value||g.value||h.value)&&!t.readonly&&!t.disabled?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createElementVNode("div",{style:r.normalizeStyle({...M.value,...$.value}),class:"d-draggable__line d-draggable__line--left"},null,4),r.createElementVNode("div",{style:r.normalizeStyle({...M.value,...y.value}),class:"d-draggable__line d-draggable__line--top"},null,4),t.isPt?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",{style:r.normalizeStyle({...M.value,...$.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),r.createElementVNode("div",{style:r.normalizeStyle({...M.value,...y.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4),r.createElementVNode("div",{style:r.normalizeStyle({...M.value,...O.value}),class:"d-draggable__line d-draggable__line--left"},null,4),r.createElementVNode("div",{style:r.normalizeStyle({...M.value,...C.value}),class:"d-draggable__line d-draggable__line--top"},null,4),r.createElementVNode("div",{style:r.normalizeStyle({...M.value,...O.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),r.createElementVNode("div",{style:r.normalizeStyle({...M.value,...C.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4)],64)):(r.openBlock(),r.createElementBlock("div",{key:0,class:"d-draggable__line d-draggable__line--label",style:r.normalizeStyle(j.value)},r.toDisplayString(c.value)+","+r.toDisplayString(u.value),5))],64)):r.createCommentVNode("",!0),!t.readonly&&!t.disabled?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:1},r.renderList(v.value,(B,U)=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:U},[m.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["d-draggable__range",`d-draggable__range--${B.classname}`]),style:r.normalizeStyle([L.value,A(B.classname)]),onMousedown:r.withModifiers(K=>Y(K,B.classname),["stop"])},null,46,Bg)):r.createCommentVNode("",!0)],64))),128)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"d-draggable__item",ref_key:"item",ref:l},[r.renderSlot(P.$slots,"default")],512),!t.disabled&&t.mask?(r.openBlock(),r.createElementBlock("div",Rg)):r.createCommentVNode("",!0)],512)],38))}})),Ag=[pi,Zn,qn,Kn,Qn,fr,hr,yr,vr],$g={install:t=>{Ag.forEach(e=>{t.component(e.name,e)})}};_e.DDrag=pi,_e.DDraggable=vr,_e.DFlowDesign=fr,_e.DInputFlow=hr,_e.DLayout=yr,_e.default=$g,_e.dragContainer=qn,_e.dragFormList=Kn,_e.dragIndexList=Qn,_e.dragTool=Zn,Object.defineProperties(_e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));