@stackmango/graff 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/index.cjs CHANGED
@@ -210,4 +210,4 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
210
210
  C ${c.x} ${c.y},
211
211
  ${u.x} ${u.y},
212
212
  ${s.x} ${s.y}
213
- `},[e.design.from.position,e.design.to.position]);return Ce.jsxs("g",{children:[Ce.jsx("circle",{cx:e.design.from.position.x+"px",cy:e.design.from.position.y+"px",r:t?.data?.connectionTipRadius,fill:`rgba(0,0,0,${r?.5:1})`,onMouseDown:i=>{console.log("Drrrrrrr from"),n?.dispatch({startPosition:{x:i.clientX,y:i.clientY},elementDragged:{type:"connection-tip",id:e.id+"/from"}})},onMouseUp:()=>{n?.dispatch(null)}}),Ce.jsx("path",{d:a,stroke:e.design.previewStatus=="NORMAL"?r?"grey":"black":e.design.previewStatus=="COMPATIBLE"?"green":"red",strokeWidth:t?.data?.connectionThickness,fill:"none"}),Ce.jsx("circle",{cx:e.design.to.position.x+"px",cy:e.design.to.position.y+"px",r:t?.data?.connectionTipRadius,fill:`rgba(0,0,0,${r?.5:1})`,onMouseDown:i=>{console.log("Drrrrrrr to"),n?.dispatch({startPosition:{x:i.clientX,y:i.clientY},elementDragged:{type:"connection-tip",id:e.id+"/to"}})},onMouseUp:()=>{n?.dispatch(null)}})]})};function kp(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var $d=()=>Math.random().toString(36).substring(7).split("").join("."),bz={INIT:`@@redux/INIT${$d()}`,REPLACE:`@@redux/REPLACE${$d()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$d()}`},Ea=bz;function gz(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function yz(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(wz(e))return"date";if(xz(e))return"error";const n=vz(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function vz(e){return typeof e.constructor=="function"?e.constructor.name:null}function xz(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function wz(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Sz(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=yz(e)),t}function ix(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function Oz(e,t,n,r){const a=Object.keys(t),i=n&&n.type===Ea.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(a.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!gz(e))return`The ${i} has unexpected type of "${Sz(e)}". Expected argument to be an object with the following keys: "${a.join('", "')}"`;const s=Object.keys(e).filter(l=>!t.hasOwnProperty(l)&&!r[l]);if(s.forEach(l=>{r[l]=!0}),!(n&&n.type===Ea.REPLACE)&&s.length>0)return`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${a.join('", "')}". Unexpected keys will be ignored.`}function kz(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Ea.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?kp(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:Ea.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?kp(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Ea.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function Ah(e){const t=Object.keys(e),n={};for(let s=0;s<t.length;s++){const l=t[s];process.env.NODE_ENV!=="production"&&typeof e[l]>"u"&&ix(`No reducer provided for key "${l}"`),typeof e[l]=="function"&&(n[l]=e[l])}const r=Object.keys(n);let a;process.env.NODE_ENV!=="production"&&(a={});let i;try{kz(n)}catch(s){i=s}return function(l={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const p=Oz(l,n,c,a);p&&ix(p)}let u=!1;const d={};for(let p=0;p<r.length;p++){const h=r[p],m=n[h],b=l[h],f=m(b,c);if(typeof f>"u"){const g=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?kp(14):`When called with an action of type ${g?`"${String(g)}"`:"(unknown type)"}, the slice reducer for key "${h}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}d[h]=f,u=u||f!==b}return u=u||r.length!==Object.keys(l).length,u?d:l}}const Ez=(e,t)=>{const n=e?{...e}:null;switch(t.type){case"set-selection_area":return t.payload;case"clear-selection_area":return null}return n},Cz=(e,t)=>{const n=e?{...e}:{node:[],connection:[]};switch(t.type){case"set-selected_items":return t.payload;case"select":t.payload.isShiftPressed?n[t.payload.type].find(a=>a==t.payload.id)?n[t.payload.type]=n[t.payload.type].filter(a=>a!=t.payload.id):n[t.payload.type].push(t.payload.id):n[t.payload.type]=[t.payload.id];break;case"add-selection":n?.[t.payload.type].push(t.payload.id);break;case"remove-selection":n.node=n?.node.filter(r=>r!=t.payload),n.connection=n?.connection.filter(r=>r!=t.payload);break;case"reset-selection":n.node=[],n.connection=[];break}return n},Tz=(e={},t)=>{const n={...e};switch(t.type){case"add-node":n[No()]=t.payload;break;case"add-node-byId":let r={...t.payload};delete r.id,n[t.payload.id]=r;break;case"add-node-port":break;case"remove-node":delete n[t.payload];break;case"remove-nodes":t.payload.forEach(s=>{delete n[s]});break;case"update-node":n[t.payload.id]=t.payload.updatedNode;break;case"set-node-ports":n[t.payload.nodeId].ports=t.payload.ports;break;case"set-node-ports-input":n[t.payload.nodeId].ports.input=t.payload.ports;break;case"set-node-ports-output":n[t.payload.nodeId].ports.output=t.payload.ports;break;case"add-node-ports-output":n[t.payload.nodeId].ports.output={...n[t.payload.nodeId].ports.output,...t.payload.ports};break;case"remove-node-ports-output":const i=Object.keys(n[t.payload.nodeId].ports.output).filter(s=>!t.payload.ports.find(l=>l==s)).reduce((s,l)=>({...s,[l]:n[t.payload.nodeId].ports.output[l]}),{});n[t.payload.nodeId].ports.output=i;break;case"set-node-label":n[t.payload.nodeId].meta.label=t.payload.label;break;case"set-node-core":n[t.payload.nodeId].core=t.payload.data;break;case"clone-node-byId":n[t.payload.nodeId]=n[t.payload.cloneSourceId];break}return n},Dz=(e={},t)=>{const n={...e};switch(t.type){case"init-node-view":n[t.payload.nodeId]={position:t.payload.position,isSelected:t.payload.isSelected??!1};break;case"move-node":const r=He.add(n[t.payload.nodeId].position,t.payload.motionVector);kt.isPointBounded(t.payload.boundArea,r)&&(n[t.payload.nodeId]?n[t.payload.nodeId].position=r:console.log("Calling no node"));break;case"remove-node":delete n[t.payload];break;case"remove-nodes":t.payload.forEach(a=>{delete n[a]});break}return n},jz=(e={},t)=>{let n={...e};switch(t.type){case"add-connection":n[No()]=t.payload;break;case"add-connection-byId":let r={...t.payload};delete r.id,n[t.payload.id]=r;break;case"set-connection-from-port":n[t.payload.connectionId].from=t.payload.portId;break;case"set-connection-to-port":n[t.payload.connectionId].to=t.payload.portId;break;case"remove-connections":t.payload.forEach(a=>{delete n[a]});break}return n},Pz=(e={},t)=>{let n={...e};switch(t.type){case"init-connection":n[t.payload.connectionId]={from:{position:t.payload.from},to:{position:t.payload.to}};break;case"set-connection-from-position":n[t.payload.connectionId].from.position=t.payload.position;break;case"set-connections-from-position":Object.keys(t.payload).forEach(a=>{n[a].from.position=t.payload[a]});break;case"set-connection-to-position":n[t.payload.connectionId].to.position=t.payload.position;break;case"move-connectiontip":const r=He.add(n[t.payload.connectionId][t.payload.type].position,t.payload.offset);n[t.payload.connectionId]&&kt.isPointBounded(t.payload.boundArea,r)&&(n[t.payload.connectionId][t.payload.type].position=r);break;case"move-connectiontip_multiple":Object.keys(t.payload.tips).forEach(a=>{const i=He.add(n[a][t.payload.tips[a].tipType].position,t.payload.tips[a].offset);kt.isPointBounded(t.payload.boundArea,i)&&(n[a][t.payload.tips[a].tipType].position=i)});break;case"remove-connections":t.payload.forEach(a=>{delete n[a]});break}return n},Mz=(e,t)=>{const n={...e};switch(t.type){case"add-connection":n[No()]={portStatus:"NO_PORT",...t.payload};break;case"add-connection-byId":let r={...t.payload};delete r.id,n[t.payload.id]={portStatus:"NO_PORT",...r};break;case"set-connection-from-port":n[t.payload.connectionId].skeleton.from=t.payload.portId;break;case"set-connection-to-port":n[t.payload.connectionId].skeleton.to=t.payload.portId;break;case"init-connection-position":n[t.payload.connectionId].design={from:{position:t.payload.from},to:{position:t.payload.to}};break;case"set-connection-from-position":n[t.payload.connectionId].design.from.position=t.payload.position;break;case"set-connection-to-position":n[t.payload.connectionId].design.to.position=t.payload.position;break;case"move-connectiontip":if(n[t.payload.connectionId]){const a=He.add(n[t.payload.connectionId].design[t.payload.type].position,t.payload.offset);n[t.payload.connectionId]&&kt.isPointBounded(t.payload.boundArea,a)&&(n[t.payload.connectionId].design[t.payload.type].position=a)}break;case"set-port_status":n[t.payload.connectionId].portStatus=t.payload.status;break;case"remove-connection":delete n[t.payload.connectionId];break;case"remove-connections":t.payload.connectionId.forEach(a=>{delete n[a]});break}return n},Rz=(e,t)=>{let n={...e};switch(t.type){case"set-document-position":n=t.payload;break;case"move-document":const r=He.add(n,{x:t.payload.speed*t.payload.direction.x,y:t.payload.speed*t.payload.direction.y});kt.isPointBounded(t.payload.boundArea,r)&&(n=r);break}return n},Nz=(e,t)=>{let n={...e};return t.type==="set-viewport-position"&&(n=t.payload),n},Iz=Ah({nodes:Tz,connections:jz}),Az=Ah({nodes:Dz,connections:Pz,viewportPosition:Nz,documentPosition:Rz}),_z=Ah({connections:Mz,selection:Ez,selectedItems:Cz}),Fz=e=>({type:"dummy",ports:{input:{i1:{meta:{index:0}}},output:{o1:{meta:{index:0}}}},core:{type:e,...e=="object"?{properties:1}:e=="array"?{items:1}:{}},meta:{label:e.toLocaleUpperCase(),type:"task"},editRules:{ports:{input:!1,ouput:!1}}}),$z=e=>{const[t,n]=j.useReducer(e.Assets.reducer,e.Assets.initialState),[r,a]=j.useReducer(e.View.reducer,e.View.initialState),[i,s]=j.useReducer(e.Interaction.reducer,e.Interaction.initialState),l=j.useRef(e.Config.initialState).current;return{assets:{data:t,dispatch:n},view:{data:r,dispatch:a},interaction:{data:i,dispatch:s},config:{data:l}}},aa={key:{schema:{type:"string",title:"Field Key",description:"Key"},component:"textbox",reducer:Ct},title:{schema:{type:"string",title:"Label",description:"Human-readable label"},component:"textbox",reducer:Ct},description:{schema:{type:"string",title:"Description",description:"Help text or tooltip"},component:"textbox",reducer:Ct},default:{schema:{type:"string",title:"Default Value",description:"Default value for the field"},component:"textbox",reducer:Ct},readOnly:{schema:{type:"boolean",title:"Read Only"},component:"toggle",reducer:Ua}},Vz={const:{schema:{type:"string",title:"Constant value",description:"Locks the field to a single value"},component:"textbox",reducer:Ct},minLength:{schema:{type:"integer",title:"Minimum length",minimum:0},component:"textbox",reducer:Ct},maxLength:{schema:{type:"integer",title:"Maximum length",minimum:0},component:"textbox",reducer:Ct},pattern:{schema:{type:"string",title:"Regex pattern",description:"ECMAScript regular expression"},component:"textbox",reducer:Ct},format:{schema:{type:"string",title:"Format",description:"Semantic format hint (email, uri, date, etc.)"},component:"textbox",reducer:Ct}},Bz={minimum:{schema:{type:"number",title:"Minimum"},component:"textbox",config:{dataType:"float"},reducer:Ct},maximum:{schema:{type:"number",title:"Maximum"},component:"textbox",config:{dataType:"float"},reducer:Ct},exclusiveMinimum:{schema:{type:"boolean",title:"Exclusive Minimum"},component:"toggle",reducer:Ua},multipleOf:{schema:{type:"number",title:"Multiple Of"},component:"textbox",config:{dataType:"integer"},reducer:Ct}},Lz={minItems:{schema:{type:"number",title:"Min Items"},component:"textbox",config:{dataType:"integer"},reducer:Ct},maxItems:{schema:{type:"number",title:"Max Items"},component:"textbox",config:{dataType:"integer"},reducer:Ct},uniqueItems:{schema:{type:"boolean",title:"Unique Items"},component:"toggle",reducer:Ua},items:{schema:{type:"number",title:"Items"},component:"textbox",config:{dataType:"integer"},reducer:Ct}},zz={items:{schema:{type:"number",title:"Items"},component:"textbox",config:{dataType:"integer"},reducer:Ct},required:{schema:{type:"number",title:"Required Items"},component:"textbox",reducer:Ct},additionalProperties:{schema:{type:"boolean",title:"Allow Additional Properties"},component:"toggle",reducer:Ua}},Hz={string:{...aa,...Vz},number:{...aa,...Bz},boolean:aa,array:{...aa,...Lz},object:{...aa,...zz}},dO=j.createContext(null),Wz=e=>{const t=e.config.stateFetcher();return console.log("Default Frame",t?.assets.data.nodes[e.id]),Ce.jsxs("div",{className:"flexbox-row",style:{width:t?.config?.data?.nodeDimensions?.width,height:t?.config?.data?.nodeDimensions?.height},children:[Ce.jsx("div",{className:"fullheight flexbox-column flexbox-center",style:{alignSelf:"stretch"},children:Object.keys(t?.assets.data.nodes[e.id].ports?.input??{}).map(n=>Ce.jsx(ka,{dragSetter:r=>t?.dragSession.dispatch(r),excludeParent:!0,dragItem:{id:e.id+"/input/"+n,type:"port"},style:{width:t?.config.data?.portRadius,height:t?.config.data?.portSlabHeight,borderRadius:100,zIndex:1,position:"relative"},class:"flexbox-row flexbox-center",children:Ce.jsx("div",{style:{width:t?.config.data?.portRadius,height:t?.config.data?.portRadius,boxSizing:"border-box",borderRadius:(t?.config.data?.portRadius??50)/2,border:"3px solid",transform:"translateX(50%)"}})}))}),Ce.jsx(ka,{id:"node-drag_wrapper",excludeParent:!0,dragSetter:t?.dragSession.dispatch,dragItem:{id:e.id,type:"node"},class:"flexbox-row flexbox-row-fit fullheight",children:Ce.jsx("div",{className:"fullwidth fullheight curve shadow padding flexbox-column gap",style:{backgroundColor:"white",alignSelf:"stretch",border:`${t?.interaction?.data.selectedItems.node.find(n=>n==e.id)?2:0}px solid rgba(51, 153, 255, 0.4)`},children:e.children})}),Ce.jsx("div",{className:"fullheight flexbox-column flexbox-center",children:Object.keys(t?.assets.data.nodes[e.id].ports?.output??{}).map(n=>Ce.jsx(ka,{dragSetter:r=>t?.dragSession?.dispatch(r),excludeParent:!0,dragItem:{id:e.id+"/output/"+n,type:"port"},style:{width:t?.config.data?.portRadius,height:t?.config.data?.portSlabHeight,borderRadius:100,zIndex:1,position:"relative"},class:"flexbox-row flexbox-center",children:Ce.jsx("div",{style:{width:t?.config.data?.portRadius,height:t?.config.data?.portRadius,boxSizing:"border-box",borderRadius:(t?.config.data?.portRadius??50)/2,border:"3px solid",transform:"translateX(-50%)"}})}))})]})},pO=e=>{const{assets:t,view:n,dragSession:r,interaction:a,config:i}=e.config.stateFetcher()??{},s=j.useRef(!1),l=ck(({first:g,last:x,down:w,delta:S,xy:C,event:O,initial:E})=>{const I=Fd(E),A=Fd(C),F=Fd(S);if(O.stopPropagation(),w){if(!s.current&&r?.data?.current?.elementDragged){const V=new CustomEvent("dragstart-"+e.id,{detail:{dragPosition:A,dragVector:He.ORIGIN,dragElement:r?.data.current?.elementDragged}});window.dispatchEvent(V),s.current=!0}if(s){const V=new CustomEvent("ondrag-"+e.id,{detail:{initialDragPosition:I,currentDragPosition:A,dragVector:F,dragElement:r?.data.current?.elementDragged}});window.dispatchEvent(V)}}if(x){const V=new CustomEvent("dragstop-"+e.id,{detail:{initialDragPosition:I,currentDragPosition:A,dragVector:F,dragElement:r?.data.current?.elementDragged}});r?.data?.current&&(r.data.current=null),window.dispatchEvent(V),s.current=!1}}),c=j.useMemo(()=>t?.data.nodes?Object.keys(t.data.nodes).map(g=>({id:g,skeleton:t?.data.nodes[g],design:n?.data.nodes[g]??i?.data?.defaultNodeView})):null,[t?.data.nodes,n?.data.nodes]),u=j.useMemo(()=>t?.data.connections?Object.keys(t?.data.connections).map(g=>({id:g,skeleton:t?.data.connections[g],design:n?.data.connections[g]})):null,[t?.data.nodes,n?.data.nodes]),d=j.useMemo(()=>a?.data.connections?Object.keys(a?.data.connections).map(g=>({id:g,...a?.data.connections[g]})):[],[a?.data.connections]),p=j.useMemo(()=>kt.getBoxCoordinates(a?.data.selection?.start??He.ORIGIN,a?.data.selection?.end??He.ORIGIN),[a?.data.selection]),h=j.useMemo(()=>({width:(p?.coords.a?.x??0)-(p?.coords.b?.x??0),height:(p?.coords.a?.y??0)-(p?.coords.d?.y??0)}),[p]),m=j.useRef(e.config.nodeComponent).current,b=j.useRef(e.config.connectionComponent).current,f=j.useCallback(g=>{g.detail?.dragElement},[n?.data.documentPosition,n?.data.viewportPosition]);return j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,f),()=>window.removeEventListener("ondrag-"+e.id,f)),[f]),j.useEffect(()=>{},[]),Ce.jsx("div",{id:"graph-document_"+e.id,className:"graph-document fullwidth fullheight",children:Ce.jsxs("div",{...l?.(),className:"fullwidth fullheight",style:{position:"relative"},children:[Ce.jsx("div",{className:"absolute fullwidth fullheight",children:c?.map(g=>Ce.jsx("div",{className:"absolute flexbox-row",style:{top:g.design?.position.y,left:g.design?.position.x,backgroundColor:"white"},children:Ce.jsx(Wz,{id:g.id,config:{stateFetcher:e.config.stateFetcher},children:Ce.jsx(m,{...g,design:g?.design?g.design:i?.data.defaultNodeView?i?.data.defaultNodeView:{isSelected:!1,position:He.ORIGIN},config:{stateFetcher:e.config.stateFetcher}})})}))}),Ce.jsxs("svg",{className:"absolute fullwidth fullheight",style:{inset:0,pointerEvents:"none",zIndex:1,backgroundColor:"transparent"},children:[u?.map(g=>Ce.jsx(b,{...g,design:{...g.design?g.design:i?.data.defaultConnectionView?i.data.defaultConnectionView:{from:{position:He.ORIGIN},to:{position:He.ORIGIN}},previewStatus:"NORMAL"},config:{stateFetcher:e.config.stateFetcher}})),d.map(g=>Ce.jsx(b,{...g,design:{...g.design,previewStatus:g.portStatus=="NO_PORT"?"NORMAL":g.portStatus=="COMPATIBLE_PORT"?"COMPATIBLE":"INCOMPATIBLE"},config:{stateFetcher:e.config.stateFetcher}}))]}),a?.data.selection?Ce.jsx("div",{className:"absolute",style:{backgroundColor:"rgba(51, 153, 255, 0.4)",left:p?.coords.a?.x,top:p?.coords.a?.y,width:Math.abs(h.width),height:Math.abs(h.height),transform:`scaleY(${h.height<0?-1:1})`,border:"1px solid rgb(80 168 255 / 50%)"}}):null]})})},qz=e=>{const t=j.useRef(null),[n,r]=j.useState(!1),a=j.useRef(null),[i,s]=fO.useSearchParams(),{assets:l,view:c,interaction:u,config:d}=j.useMemo(()=>e.state,[e.state]),p=j.useRef(null),h=j.useRef(!1),m=j.useRef({width:0,height:0}),b=j.useMemo(()=>({node:{p1:{x:d.data.documentBoundaryThickness,y:d.data.documentBoundaryThickness},p2:{x:d.data.documentDimension.width-d.data.nodeDimensions.width-d.data.documentBoundaryThickness,y:d.data.documentDimension.height-d.data.nodeDimensions.height-d.data.documentBoundaryThickness}},document:{p1:{x:-(d.data.documentDimension.width-m.current.width),y:-(d.data.documentDimension.height-m.current.height)},p2:He.ORIGIN},connectionTip:{p1:{x:d.data.documentBoundaryThickness,y:d.data.documentBoundaryThickness},p2:{x:d.data.documentDimension.width-d.data.portRadius-d.data.documentBoundaryThickness,y:d.data.documentDimension.height-d.data.portRadius-d.data.documentBoundaryThickness}}}),[d.data.documentDimension,d.data.nodeDimensions,d.data.documentBoundaryThickness,d.data.portRadius,m.current]),f=j.useCallback(k=>{t.current=k},[]),g=j.useCallback(()=>{p.current&&(clearInterval(p.current),p.current=null)},[]),x=j.useCallback((k,D)=>{p.current=setInterval(()=>{if(c?.dispatch?.({type:"move-document",payload:{speed:3.5,direction:He.getScaledVector(k,-1),boundArea:b.document}}),D.type=="node"){c.dispatch({type:"move-node",payload:{nodeId:D.id,motionVector:He.getScaledVector(k,3.5),boundArea:b.node}});const B=xr.getConnections(l.data.connections,{id:D.id,...l.data.nodes[D.id]});console.log("Connected Connections",B),c.dispatch({type:"move-connectiontip_multiple",payload:{tips:Object.keys(B).map($=>({id:$,tipType:B[$],offset:He.getScaledVector(k,3.5)})).reduce(($,H)=>({...$,[H.id]:{tipType:H.tipType,offset:H.offset}}),{}),boundArea:b.connectionTip}})}if(D.type=="connection-tip"){let B=D.id.split("/");u.dispatch({type:"move-connectiontip",payload:{connectionId:B[0],offset:He.getScaledVector(k,3.5),type:B[1],boundArea:b.connectionTip}})}},8)},[l.data.connections,l.data.nodes,d.data.documentDimension,d.data.documentBoundaryThickness,d.data.nodeDimensions]),w=j.useCallback(k=>{if(k.detail&&k.detail.dragElement){const D=He.subtract(k.detail.currentDragPosition,k.detail.dragVector),R={p1:{x:d.data.documentBoundaryThickness,y:d.data.documentBoundaryThickness},p2:{x:m.current.width-d.data.documentBoundaryThickness,y:m.current.height-d.data.documentBoundaryThickness}},B=kt.isPointBounded(R,D),$=kt.isPointBounded(R,k.detail.currentDragPosition);B&&!$?(p.current&&g(),x(k.detail.dragVector,k.detail.dragElement)):$&&!B&&p.current&&g()}return()=>{g()}},[d.data.documentBoundaryThickness,d.data.documentDimension,x]),S=j.useCallback(k=>{k.detail&&k.detail.dragElement&&k.detail.dragElement?.type=="node"&&(c.dispatch({type:"move-node",payload:{nodeId:k.detail.dragElement.id,motionVector:k.detail.dragVector,boundArea:b.node}}),Object.keys(l.data.connections).forEach(D=>{const R=l.data.connections[D].from.split("/")[0],B=l.data.connections[D].to.split("/")[0];R==k.detail.dragElement.id&&c.dispatch({type:"move-connectiontip",payload:{connectionId:D,type:"from",offset:k.detail.dragVector,boundArea:b.connectionTip}}),B==k.detail.dragElement.id&&c.dispatch({type:"move-connectiontip",payload:{connectionId:D,type:"to",offset:k.detail.dragVector,boundArea:b.connectionTip}})}))},[l.data.connections,c.data.nodes,c.data.documentPosition,c.data.viewportPosition,e.id,d.data.documentDimension.width,d.data.documentDimension.height,d.data.nodeDimensions.width,d.data.nodeDimensions.height,d.data.documentBoundaryThickness,b.node]),C=j.useCallback(k=>{if(k.detail&&k.detail.dragElement&&k.detail.dragElement.type=="port"){const D=k.detail.dragElement.id.split("/"),R=No(),B={workspace:{x:c.data.documentPosition.x,y:c.data.documentPosition.y},viewspace:He.ORIGIN,viewport:c.data.viewportPosition},H=xr.getAllPortsPositions({position:c.data.nodes[D[0]].position,dimensions:d.data.nodeDimensions},{input:Object.keys(l.data.nodes[D[0]].ports.input),output:Object.keys(l.data.nodes[D[0]].ports.output),dimensions:{portRadius:d.data.portRadius,slabHeight:d.data.portSlabHeight}})[D[1]=="input"?"inputPorts":"outputPorts"].find(P=>P.key==D[2])?.position;H&&(u.dispatch({type:"add-connection-byId",payload:{id:R,skeleton:{from:D[1]=="output"?k.detail.dragElement.id:"",to:D[1]=="input"?k.detail.dragElement.id:""},design:{from:{position:H},to:{position:H}}}}),f({startPosition:kt.shiftPosition({type:"workspace",position:k.detail.currentDragPosition},"viewport",B),elementDragged:{type:"connection-tip",id:R+"/"+(D[1]=="input"?"from":"to")},currentPosition:kt.shiftPosition({type:"workspace",position:k.detail.currentDragPosition},"viewport",B)}))}},[c.data.documentPosition,c.data.viewportPosition,l.data.nodes,c.data.nodes,d.data.nodeDimensions,d.data.portRadius,d.data.portSlabHeight]),O=j.useCallback(k=>{if(k.detail?.dragElement&&k.detail?.dragElement?.type=="connection-tip"){let D=k.detail.dragElement.id.split("/");Object.keys(l.data.connections).find(R=>R==D[0])?c.dispatch({type:"move-connectiontip",payload:{connectionId:D[0],offset:k.detail.dragVector,type:D[1],boundArea:b.connectionTip}}):Object.keys(u.data.connections).find(R=>R==D[0])&&(console.log("Tip Info",D),u.dispatch({type:"move-connectiontip",payload:{connectionId:D[0],offset:k.detail.dragVector,type:D[1],boundArea:b.connectionTip}}))}},[l.data.connections,u.data.connections]),E=j.useCallback(k=>{if(k.detail?.dragElement?.type=="document"){const D={workspace:c.data.documentPosition,viewspace:He.ORIGIN,viewport:c.data.viewportPosition},R=kt.shiftPosition({type:"viewport",position:k.detail.initialDragPosition},"workspace",D),B=kt.shiftPosition({type:"viewport",position:k.detail.currentDragPosition},"workspace",D);u.dispatch?.({type:"set-selection_area",payload:{start:R,end:B}}),u.dispatch({type:"set-selected_items",payload:{node:Object.keys(c.data.nodes).filter($=>xr.isNodeBounded({p1:R,p2:B},{...c.data.nodes[$],id:$},d.data.nodeDimensions)),connection:[]}})}},[c.data.documentPosition,c.data.viewportPosition,c.data.nodes,d.data.nodeDimensions]),I=j.useCallback(()=>{u.dispatch({type:"remove-connections",payload:{connectionId:Object.keys(u.data.connections)}}),u.dispatch?.({type:"clear-selection_area"}),p.current&&g()},[u.data.connections]),A=j.useCallback(k=>{if(k.detail.dragElement?.type=="connection-tip"){const D={workspace:{x:c.data.documentPosition.x,y:c.data.documentPosition.y},viewspace:He.ORIGIN,viewport:c.data.viewportPosition};let R=kt.shiftPosition({type:"viewport",position:k.detail.currentDragPosition},"workspace",D),B=k.detail.dragElement.id.split("/"),$=u.data.connections[B[0]];if($){let H=B[1]=="from"?$.skeleton.to:$.skeleton.from,P=No();Object.keys(l.data.nodes).filter(T=>T!=H.split("/")[0]).forEach(T=>{let L=xr.getAllPortsPositions({position:c.data.nodes[T]?.position,dimensions:d.data.nodeDimensions},{input:Object.keys(l.data.nodes[T].ports.input),output:Object.keys(l.data.nodes[T].ports.output),dimensions:{portRadius:d.data.portRadius,slabHeight:d.data.portSlabHeight}});L.outputPorts.forEach(W=>{B[1]=="from"&&R.x>W.position.x-d.data.portRadius&&R.x<W.position.x+d.data.portRadius&&R.y>W.position.y-d.data.portRadius&&R.y<W.position.y+d.data.portRadius&&(u.dispatch({type:"remove-connection",payload:{connectionId:B[0]}}),l.dispatch({type:"add-connection-byId",payload:{id:P,from:T+"/output/"+W.key,to:H}}),c.dispatch({type:"init-connection",payload:{connectionId:P,from:W.position,to:$.design.to.position}}),f(null))}),L.inputPorts.forEach(W=>{B[1]=="to"&&R.x>W.position.x-d.data.portRadius&&R.x<W.position.x+d.data.portRadius&&R.y>W.position.y-d.data.portRadius&&R.y<W.position.y+d.data.portRadius&&(u.dispatch({type:"remove-connection",payload:{connectionId:B[0]}}),l.dispatch({type:"add-connection-byId",payload:{id:P,from:H,to:T+"/input/"+W.key}}),c.dispatch({type:"init-connection",payload:{connectionId:P,from:$.design.from.position,to:W.position}}),f(null))})})}}},[c.data.documentPosition,c.data.viewportPosition,l.data.nodes,l.data.connections,u.data.connections]),F=j.useCallback(k=>{k.type=="node"&&u.dispatch?.({type:"select",payload:{type:k.type,id:k.id,isShiftPressed:h.current}}),k.type=="document"&&(h.current||u.dispatch({type:"reset-selection"}))},[]);j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,A),()=>window.removeEventListener("ondrag-"+e.id,A)),[A]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,E),()=>window.removeEventListener("ondrag-"+e.id,E)),[E]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,S),()=>window.removeEventListener("ondrag-"+e.id,S)),[S]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,C),()=>window.removeEventListener("ondrag-"+e.id,C)),[C]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,O),()=>window.removeEventListener("ondrag-"+e.id,O)),[O]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,w),()=>window.removeEventListener("ondrag-"+e.id,w)),[w]),j.useEffect(()=>(window.addEventListener("dragstop-"+e.id,I),()=>window.removeEventListener("dragstop-"+e.id,I)),[I]);const V=j.useCallback(k=>{k.key=="Shift"&&(h.current=!0)},[]),M=j.useCallback(k=>{k.key=="Shift"&&(h.current=!1)},[]),y=j.useCallback(k=>{k.key=="Delete"&&(l.dispatch({type:"remove-nodes",payload:u.data.selectedItems.node}),c.dispatch({type:"remove-nodes",payload:u.data.selectedItems.node}),c.dispatch({type:"remove-connections",payload:u.data.selectedItems.node.reduce((D,R)=>[...D,...Object.keys(xr.getConnections(l.data.connections,{...l.data.nodes[R],id:R}))],[])}),l.dispatch({type:"remove-connections",payload:u.data.selectedItems.node.reduce((D,R)=>[...D,...Object.keys(xr.getConnections(l.data.connections,{...l.data.nodes[R],id:R}))],[])}))},[u.data.selectedItems,l.data.connections,l.data.nodes]);j.useEffect(()=>(window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)),[y]),j.useEffect(()=>{const k=new ResizeObserver(()=>{let D=a.current?.getBoundingClientRect();D&&(r(!1),c.dispatch({type:"set-viewport-position",payload:{x:-D.x,y:-D.y}}),m.current={width:D.width,height:D.height},r(!0))});return k.observe(a.current),window.addEventListener("keydown",V),window.addEventListener("keyup",M),()=>{k.disconnect(),window.removeEventListener("keydown",V),window.removeEventListener("keyup",M)}},[]);const _=j.useCallback(k=>{k.target==k.currentTarget&&(i.delete("node_form"),s(i))},[i]);return console.log("Graph State",l.data,c.data,u.data),Ce.jsx(dO.Provider,{value:{assets:l,view:c,config:d,interaction:u,dragSession:{data:t,dispatch:f}},children:Ce.jsxs("div",{ref:a,className:"fullwidth fullheight no-select",style:{position:"relative",overflow:"hidden"},children:[n?Ce.jsxs("div",{onMouseDown:()=>F({type:"document",id:e.id}),className:"fullwidth fullheight flexbox-row flexbox-center",children:[Ce.jsx(ka,{id:"document-drag_wrapper",dragItem:{type:"document",id:e.id},dragSetter:f,class:"absolute",style:{top:c.data.documentPosition.y,left:c.data.documentPosition.x,width:d.data.documentDimension.width,height:d.data.documentDimension.height},children:Ce.jsx(pO,{id:e.id,config:e.config.document})}),i.get("node_form")?Ce.jsx("div",{className:"absolute fullwidth fullheight",style:{zIndex:200,backgroundColor:"rgba(0,0,0,0.1)"},children:Ce.jsx("div",{onClick:_,className:"fullwidth fullheight",style:{position:"relative"},children:Ce.jsx("div",{className:"absolute white-bg curve padding",style:{width:"80%",height:"80%",bottom:50,left:"50%",top:"50%",transform:"translate(-50%,-50%)",boxShadow:"0px 0px 30px rgba(0,0,0,0.1)"}})})}):null]}):Ce.jsx("div",{className:"fullwidth fullheight flexbox-row flexbox-center",children:Ce.jsx("div",{className:"fullwidth fullheight flexbox-column flexbox-center",children:Ce.jsx("span",{children:"Loading Document"})})}),Ce.jsxs("div",{children:[Ce.jsx("div",{className:"absolute fullheight",style:{backgroundColor:"rgba(0,0,0,0.1)",width:d?.data?.documentBoundaryThickness,left:0,top:0}}),Ce.jsx("div",{className:"absolute fullheight",style:{backgroundColor:"rgba(0,0,0,0.1)",width:d?.data?.documentBoundaryThickness,right:0,top:0}}),Ce.jsx("div",{className:"absolute fullwidth",style:{backgroundColor:"rgba(0,0,0,0.1)",height:d?.data?.documentBoundaryThickness,left:0,top:0}}),Ce.jsx("div",{className:"absolute fullwidth",style:{backgroundColor:"rgba(0,0,0,0.1)",height:d?.data?.documentBoundaryThickness,left:0,bottom:0}})]})]})})},Uz={Dropdown:lx,Textbox:cx,Toggle:ux};exports.AssetsReducer=Iz;exports.Connection=mz;exports.Context_Workspace=dO;exports.Document=pO;exports.Draggable=ka;exports.Form=fz;exports.FormInputElements=Uz;exports.InteractionReducer=_z;exports.JSONForms=Hz;exports.NodeUtils=xr;exports.UIDCreator=No;exports.UiElementsRegistry_Standard=lz;exports.VectorApi=He;exports.ViewReducer=Az;exports.Workspace=qz;exports.getSchemaNode=Fz;exports.schemaNodeExporter=cO;exports.useWorkspace=$z;
213
+ `},[e.design.from.position,e.design.to.position]);return Ce.jsxs("g",{children:[Ce.jsx("circle",{cx:e.design.from.position.x+"px",cy:e.design.from.position.y+"px",r:t?.data?.connectionTipRadius,fill:`rgba(0,0,0,${r?.5:1})`,onMouseDown:i=>{console.log("Drrrrrrr from"),n?.dispatch({startPosition:{x:i.clientX,y:i.clientY},elementDragged:{type:"connection-tip",id:e.id+"/from"}})},onMouseUp:()=>{n?.dispatch(null)}}),Ce.jsx("path",{d:a,stroke:e.design.previewStatus=="NORMAL"?r?"grey":"black":e.design.previewStatus=="COMPATIBLE"?"green":"red",strokeWidth:t?.data?.connectionThickness,fill:"none"}),Ce.jsx("circle",{cx:e.design.to.position.x+"px",cy:e.design.to.position.y+"px",r:t?.data?.connectionTipRadius,fill:`rgba(0,0,0,${r?.5:1})`,onMouseDown:i=>{console.log("Drrrrrrr to"),n?.dispatch({startPosition:{x:i.clientX,y:i.clientY},elementDragged:{type:"connection-tip",id:e.id+"/to"}})},onMouseUp:()=>{n?.dispatch(null)}})]})};function kp(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var $d=()=>Math.random().toString(36).substring(7).split("").join("."),bz={INIT:`@@redux/INIT${$d()}`,REPLACE:`@@redux/REPLACE${$d()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$d()}`},Ea=bz;function gz(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function yz(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(wz(e))return"date";if(xz(e))return"error";const n=vz(e);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function vz(e){return typeof e.constructor=="function"?e.constructor.name:null}function xz(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function wz(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Sz(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=yz(e)),t}function ix(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function Oz(e,t,n,r){const a=Object.keys(t),i=n&&n.type===Ea.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(a.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!gz(e))return`The ${i} has unexpected type of "${Sz(e)}". Expected argument to be an object with the following keys: "${a.join('", "')}"`;const s=Object.keys(e).filter(l=>!t.hasOwnProperty(l)&&!r[l]);if(s.forEach(l=>{r[l]=!0}),!(n&&n.type===Ea.REPLACE)&&s.length>0)return`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${a.join('", "')}". Unexpected keys will be ignored.`}function kz(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Ea.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?kp(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:Ea.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?kp(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Ea.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function Ah(e){const t=Object.keys(e),n={};for(let s=0;s<t.length;s++){const l=t[s];process.env.NODE_ENV!=="production"&&typeof e[l]>"u"&&ix(`No reducer provided for key "${l}"`),typeof e[l]=="function"&&(n[l]=e[l])}const r=Object.keys(n);let a;process.env.NODE_ENV!=="production"&&(a={});let i;try{kz(n)}catch(s){i=s}return function(l={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const p=Oz(l,n,c,a);p&&ix(p)}let u=!1;const d={};for(let p=0;p<r.length;p++){const h=r[p],m=n[h],b=l[h],f=m(b,c);if(typeof f>"u"){const g=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?kp(14):`When called with an action of type ${g?`"${String(g)}"`:"(unknown type)"}, the slice reducer for key "${h}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}d[h]=f,u=u||f!==b}return u=u||r.length!==Object.keys(l).length,u?d:l}}const Ez=(e,t)=>{const n=e?{...e}:null;switch(t.type){case"set-selection_area":return t.payload;case"clear-selection_area":return null}return n},Cz=(e,t)=>{const n=e?{...e}:{node:[],connection:[]};switch(t.type){case"set-selected_items":return t.payload;case"select":t.payload.isShiftPressed?n[t.payload.type].find(a=>a==t.payload.id)?n[t.payload.type]=n[t.payload.type].filter(a=>a!=t.payload.id):n[t.payload.type].push(t.payload.id):n[t.payload.type]=[t.payload.id];break;case"add-selection":n?.[t.payload.type].push(t.payload.id);break;case"remove-selection":n.node=n?.node.filter(r=>r!=t.payload),n.connection=n?.connection.filter(r=>r!=t.payload);break;case"reset-selection":n.node=[],n.connection=[];break}return n},Tz=(e={},t)=>{const n={...e};switch(t.type){case"add-node":n[No()]=t.payload;break;case"add-node-byId":let r={...t.payload};delete r.id,n[t.payload.id]=r;break;case"add-node-port":break;case"remove-node":delete n[t.payload];break;case"remove-nodes":t.payload.forEach(s=>{delete n[s]});break;case"update-node":n[t.payload.id]=t.payload.updatedNode;break;case"set-node-ports":n[t.payload.nodeId].ports=t.payload.ports;break;case"set-node-ports-input":n[t.payload.nodeId].ports.input=t.payload.ports;break;case"set-node-ports-output":n[t.payload.nodeId].ports.output=t.payload.ports;break;case"add-node-ports-output":n[t.payload.nodeId].ports.output={...n[t.payload.nodeId].ports.output,...t.payload.ports};break;case"remove-node-ports-output":const i=Object.keys(n[t.payload.nodeId].ports.output).filter(s=>!t.payload.ports.find(l=>l==s)).reduce((s,l)=>({...s,[l]:n[t.payload.nodeId].ports.output[l]}),{});n[t.payload.nodeId].ports.output=i;break;case"set-node-label":n[t.payload.nodeId].meta.label=t.payload.label;break;case"set-node-core":n[t.payload.nodeId].core=t.payload.data;break;case"clone-node-byId":n[t.payload.nodeId]=n[t.payload.cloneSourceId];break}return n},Dz=(e={},t)=>{const n={...e};switch(t.type){case"init-node-view":n[t.payload.nodeId]={position:t.payload.position,isSelected:t.payload.isSelected??!1};break;case"move-node":const r=He.add(n[t.payload.nodeId].position,t.payload.motionVector);kt.isPointBounded(t.payload.boundArea,r)&&(n[t.payload.nodeId]?n[t.payload.nodeId].position=r:console.log("Calling no node"));break;case"remove-node":delete n[t.payload];break;case"remove-nodes":t.payload.forEach(a=>{delete n[a]});break}return n},jz=(e={},t)=>{let n={...e};switch(t.type){case"add-connection":n[No()]=t.payload;break;case"add-connection-byId":let r={...t.payload};delete r.id,n[t.payload.id]=r;break;case"set-connection-from-port":n[t.payload.connectionId].from=t.payload.portId;break;case"set-connection-to-port":n[t.payload.connectionId].to=t.payload.portId;break;case"remove-connections":t.payload.forEach(a=>{delete n[a]});break}return n},Pz=(e={},t)=>{let n={...e};switch(t.type){case"init-connection":n[t.payload.connectionId]={from:{position:t.payload.from},to:{position:t.payload.to}};break;case"set-connection-from-position":n[t.payload.connectionId].from.position=t.payload.position;break;case"set-connections-from-position":Object.keys(t.payload).forEach(a=>{n[a].from.position=t.payload[a]});break;case"set-connection-to-position":n[t.payload.connectionId].to.position=t.payload.position;break;case"move-connectiontip":const r=He.add(n[t.payload.connectionId][t.payload.type].position,t.payload.offset);n[t.payload.connectionId]&&kt.isPointBounded(t.payload.boundArea,r)&&(n[t.payload.connectionId][t.payload.type].position=r);break;case"move-connectiontip_multiple":Object.keys(t.payload.tips).forEach(a=>{const i=He.add(n[a][t.payload.tips[a].tipType].position,t.payload.tips[a].offset);kt.isPointBounded(t.payload.boundArea,i)&&(n[a][t.payload.tips[a].tipType].position=i)});break;case"remove-connections":t.payload.forEach(a=>{delete n[a]});break}return n},Mz=(e,t)=>{const n={...e};switch(t.type){case"add-connection":n[No()]={portStatus:"NO_PORT",...t.payload};break;case"add-connection-byId":let r={...t.payload};delete r.id,n[t.payload.id]={portStatus:"NO_PORT",...r};break;case"set-connection-from-port":n[t.payload.connectionId].skeleton.from=t.payload.portId;break;case"set-connection-to-port":n[t.payload.connectionId].skeleton.to=t.payload.portId;break;case"init-connection-position":n[t.payload.connectionId].design={from:{position:t.payload.from},to:{position:t.payload.to}};break;case"set-connection-from-position":n[t.payload.connectionId].design.from.position=t.payload.position;break;case"set-connection-to-position":n[t.payload.connectionId].design.to.position=t.payload.position;break;case"move-connectiontip":if(n[t.payload.connectionId]){const a=He.add(n[t.payload.connectionId].design[t.payload.type].position,t.payload.offset);n[t.payload.connectionId]&&kt.isPointBounded(t.payload.boundArea,a)&&(n[t.payload.connectionId].design[t.payload.type].position=a)}break;case"set-port_status":n[t.payload.connectionId].portStatus=t.payload.status;break;case"remove-connection":delete n[t.payload.connectionId];break;case"remove-connections":t.payload.connectionId.forEach(a=>{delete n[a]});break}return n},Rz=(e,t)=>{let n={...e};switch(t.type){case"set-document-position":n=t.payload;break;case"move-document":const r=He.add(n,{x:t.payload.speed*t.payload.direction.x,y:t.payload.speed*t.payload.direction.y});kt.isPointBounded(t.payload.boundArea,r)&&(n=r);break}return n},Nz=(e,t)=>{let n={...e};return t.type==="set-viewport-position"&&(n=t.payload),n},Iz=Ah({nodes:Tz,connections:jz}),Az=Ah({nodes:Dz,connections:Pz,viewportPosition:Nz,documentPosition:Rz}),_z=Ah({connections:Mz,selection:Ez,selectedItems:Cz}),Fz=e=>({type:"dummy",ports:{input:{i1:{meta:{index:0}}},output:{o1:{meta:{index:0}}}},core:{type:e,...e=="object"?{properties:1}:e=="array"?{items:1}:{}},meta:{label:e.toLocaleUpperCase(),type:"task"},editRules:{ports:{input:!1,ouput:!1}}}),$z=e=>{const[t,n]=j.useReducer(e.Assets.reducer,e.Assets.initialState),[r,a]=j.useReducer(e.View.reducer,e.View.initialState),[i,s]=j.useReducer(e.Interaction.reducer,e.Interaction.initialState),l=j.useRef(e.Config.initialState).current;return{assets:{data:t,dispatch:n},view:{data:r,dispatch:a},interaction:{data:i,dispatch:s},config:{data:l}}},aa={key:{schema:{type:"string",title:"Field Key",description:"Key"},component:"textbox",reducer:Ct},title:{schema:{type:"string",title:"Label",description:"Human-readable label"},component:"textbox",reducer:Ct},description:{schema:{type:"string",title:"Description",description:"Help text or tooltip"},component:"textbox",reducer:Ct},default:{schema:{type:"string",title:"Default Value",description:"Default value for the field"},component:"textbox",reducer:Ct},readOnly:{schema:{type:"boolean",title:"Read Only"},component:"toggle",reducer:Ua}},Vz={const:{schema:{type:"string",title:"Constant value",description:"Locks the field to a single value"},component:"textbox",reducer:Ct},minLength:{schema:{type:"integer",title:"Minimum length",minimum:0},component:"textbox",reducer:Ct},maxLength:{schema:{type:"integer",title:"Maximum length",minimum:0},component:"textbox",reducer:Ct},pattern:{schema:{type:"string",title:"Regex pattern",description:"ECMAScript regular expression"},component:"textbox",reducer:Ct},format:{schema:{type:"string",title:"Format",description:"Semantic format hint (email, uri, date, etc.)"},component:"textbox",reducer:Ct}},Bz={minimum:{schema:{type:"number",title:"Minimum"},component:"textbox",config:{dataType:"float"},reducer:Ct},maximum:{schema:{type:"number",title:"Maximum"},component:"textbox",config:{dataType:"float"},reducer:Ct},exclusiveMinimum:{schema:{type:"boolean",title:"Exclusive Minimum"},component:"toggle",reducer:Ua},multipleOf:{schema:{type:"number",title:"Multiple Of"},component:"textbox",config:{dataType:"integer"},reducer:Ct}},Lz={minItems:{schema:{type:"number",title:"Min Items"},component:"textbox",config:{dataType:"integer"},reducer:Ct},maxItems:{schema:{type:"number",title:"Max Items"},component:"textbox",config:{dataType:"integer"},reducer:Ct},uniqueItems:{schema:{type:"boolean",title:"Unique Items"},component:"toggle",reducer:Ua},items:{schema:{type:"number",title:"Items"},component:"textbox",config:{dataType:"integer"},reducer:Ct}},zz={items:{schema:{type:"number",title:"Items"},component:"textbox",config:{dataType:"integer"},reducer:Ct},required:{schema:{type:"number",title:"Required Items"},component:"textbox",reducer:Ct},additionalProperties:{schema:{type:"boolean",title:"Allow Additional Properties"},component:"toggle",reducer:Ua}},Hz={string:{...aa,...Vz},number:{...aa,...Bz},boolean:aa,array:{...aa,...Lz},object:{...aa,...zz}},dO=j.createContext(null),Wz=e=>{const t=e.config.stateFetcher();return console.log("Default Frame",t?.assets.data.nodes[e.id]),Ce.jsxs("div",{className:"flexbox-row",style:{width:t?.config?.data?.nodeDimensions?.width,height:t?.config?.data?.nodeDimensions?.height},children:[Ce.jsx("div",{className:"fullheight flexbox-column flexbox-center",style:{alignSelf:"stretch"},children:Object.keys(t?.assets.data.nodes[e.id].ports?.input??{}).map(n=>Ce.jsx(ka,{dragSetter:r=>t?.dragSession.dispatch(r),excludeParent:!0,dragItem:{id:e.id+"/input/"+n,type:"port"},style:{width:t?.config.data?.portRadius,height:t?.config.data?.portSlabHeight,borderRadius:100,zIndex:1,position:"relative"},class:"flexbox-row flexbox-center",children:Ce.jsx("div",{style:{width:t?.config.data?.portRadius,height:t?.config.data?.portRadius,boxSizing:"border-box",borderRadius:(t?.config.data?.portRadius??50)/2,border:"3px solid",transform:"translateX(50%)"}})}))}),Ce.jsx(ka,{id:"node-drag_wrapper",excludeParent:!0,dragSetter:t?.dragSession.dispatch,dragItem:{id:e.id,type:"node"},class:"flexbox-row flexbox-row-fit fullheight",children:Ce.jsx("div",{className:"fullwidth fullheight curve shadow padding flexbox-column gap",style:{backgroundColor:"white",alignSelf:"stretch",border:`${t?.interaction?.data.selectedItems.node.find(n=>n==e.id)?2:0}px solid rgba(51, 153, 255, 0.4)`},children:e.children})}),Ce.jsx("div",{className:"fullheight flexbox-column flexbox-center",children:Object.keys(t?.assets.data.nodes[e.id].ports?.output??{}).map(n=>Ce.jsx(ka,{dragSetter:r=>t?.dragSession?.dispatch(r),excludeParent:!0,dragItem:{id:e.id+"/output/"+n,type:"port"},style:{width:t?.config.data?.portRadius,height:t?.config.data?.portSlabHeight,borderRadius:100,zIndex:1,position:"relative"},class:"flexbox-row flexbox-center",children:Ce.jsx("div",{style:{width:t?.config.data?.portRadius,height:t?.config.data?.portRadius,boxSizing:"border-box",borderRadius:(t?.config.data?.portRadius??50)/2,border:"3px solid",transform:"translateX(-50%)"}})}))})]})},pO=e=>{const{assets:t,view:n,dragSession:r,interaction:a,config:i}=e.config.stateFetcher()??{},s=j.useRef(!1),l=ck(({first:g,last:x,down:w,delta:S,xy:C,event:O,initial:E})=>{const I=Fd(E),A=Fd(C),F=Fd(S);if(O.stopPropagation(),w){if(!s.current&&r?.data?.current?.elementDragged){const V=new CustomEvent("dragstart-"+e.id,{detail:{dragPosition:A,dragVector:He.ORIGIN,dragElement:r?.data.current?.elementDragged}});window.dispatchEvent(V),s.current=!0}if(s){const V=new CustomEvent("ondrag-"+e.id,{detail:{initialDragPosition:I,currentDragPosition:A,dragVector:F,dragElement:r?.data.current?.elementDragged}});window.dispatchEvent(V)}}if(x){const V=new CustomEvent("dragstop-"+e.id,{detail:{initialDragPosition:I,currentDragPosition:A,dragVector:F,dragElement:r?.data.current?.elementDragged}});r?.data?.current&&(r.data.current=null),window.dispatchEvent(V),s.current=!1}}),c=j.useMemo(()=>t?.data.nodes?Object.keys(t.data.nodes).map(g=>({id:g,skeleton:t?.data.nodes[g],design:n?.data.nodes[g]??i?.data?.defaultNodeView})):null,[t?.data.nodes,n?.data.nodes]),u=j.useMemo(()=>t?.data.connections?Object.keys(t?.data.connections).map(g=>({id:g,skeleton:t?.data.connections[g],design:n?.data.connections[g]})):null,[t?.data.nodes,n?.data.nodes]),d=j.useMemo(()=>a?.data.connections?Object.keys(a?.data.connections).map(g=>({id:g,...a?.data.connections[g]})):[],[a?.data.connections]),p=j.useMemo(()=>kt.getBoxCoordinates(a?.data.selection?.start??He.ORIGIN,a?.data.selection?.end??He.ORIGIN),[a?.data.selection]),h=j.useMemo(()=>({width:(p?.coords.a?.x??0)-(p?.coords.b?.x??0),height:(p?.coords.a?.y??0)-(p?.coords.d?.y??0)}),[p]),m=j.useRef(e.config.nodeComponent).current,b=j.useRef(e.config.connectionComponent).current,f=j.useCallback(g=>{g.detail?.dragElement},[n?.data.documentPosition,n?.data.viewportPosition]);return j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,f),()=>window.removeEventListener("ondrag-"+e.id,f)),[f]),j.useEffect(()=>{},[]),Ce.jsx("div",{id:"graph-document_"+e.id,className:"graph-document fullwidth fullheight",children:Ce.jsxs("div",{...l?.(),className:"fullwidth fullheight",style:{position:"relative"},children:[Ce.jsx("div",{className:"absolute fullwidth fullheight",children:c?.map(g=>Ce.jsx("div",{className:"absolute flexbox-row",style:{top:g.design?.position.y,left:g.design?.position.x,backgroundColor:"white"},children:Ce.jsx(Wz,{id:g.id,config:{stateFetcher:e.config.stateFetcher},children:Ce.jsx(m,{...g,design:g?.design?g.design:i?.data.defaultNodeView?i?.data.defaultNodeView:{isSelected:!1,position:He.ORIGIN},config:{stateFetcher:e.config.stateFetcher}})})}))}),Ce.jsxs("svg",{className:"absolute fullwidth fullheight",style:{inset:0,pointerEvents:"none",zIndex:1,backgroundColor:"transparent"},children:[u?.map(g=>Ce.jsx(b,{...g,design:{...g.design?g.design:i?.data.defaultConnectionView?i.data.defaultConnectionView:{from:{position:He.ORIGIN},to:{position:He.ORIGIN}},previewStatus:"NORMAL"},config:{stateFetcher:e.config.stateFetcher}})),d.map(g=>Ce.jsx(b,{...g,design:{...g.design,previewStatus:g.portStatus=="NO_PORT"?"NORMAL":g.portStatus=="COMPATIBLE_PORT"?"COMPATIBLE":"INCOMPATIBLE"},config:{stateFetcher:e.config.stateFetcher}}))]}),a?.data.selection?Ce.jsx("div",{className:"absolute",style:{backgroundColor:"rgba(51, 153, 255, 0.4)",left:p?.coords.a?.x,top:p?.coords.a?.y,width:Math.abs(h.width),height:Math.abs(h.height),transform:`scaleY(${h.height<0?-1:1})`,border:"1px solid rgb(80 168 255 / 50%)"}}):null]})})},qz=e=>{const t=j.useRef(null),[n,r]=j.useState(!1),a=j.useRef(null),[i,s]=fO.useSearchParams(),{assets:l,view:c,interaction:u,config:d}=j.useMemo(()=>e.state,[e.state]),p=j.useRef(null),h=j.useRef(!1),m=j.useRef({width:0,height:0}),b=j.useMemo(()=>({node:{p1:{x:d.data.documentBoundaryThickness,y:d.data.documentBoundaryThickness},p2:{x:d.data.documentDimension.width-d.data.nodeDimensions.width-d.data.documentBoundaryThickness,y:d.data.documentDimension.height-d.data.nodeDimensions.height-d.data.documentBoundaryThickness}},document:{p1:{x:-(d.data.documentDimension.width-m.current.width),y:-(d.data.documentDimension.height-m.current.height)},p2:He.ORIGIN},connectionTip:{p1:{x:d.data.documentBoundaryThickness,y:d.data.documentBoundaryThickness},p2:{x:d.data.documentDimension.width-d.data.portRadius-d.data.documentBoundaryThickness,y:d.data.documentDimension.height-d.data.portRadius-d.data.documentBoundaryThickness}}}),[d.data.documentDimension,d.data.nodeDimensions,d.data.documentBoundaryThickness,d.data.portRadius,m.current]),f=j.useCallback(k=>{t.current=k},[]),g=j.useCallback(()=>{p.current&&(clearInterval(p.current),p.current=null)},[]),x=j.useCallback((k,D)=>{p.current=setInterval(()=>{if(c?.dispatch?.({type:"move-document",payload:{speed:3.5,direction:He.getScaledVector(k,-1),boundArea:b.document}}),D.type=="node"){c.dispatch({type:"move-node",payload:{nodeId:D.id,motionVector:He.getScaledVector(k,3.5),boundArea:b.node}});const B=xr.getConnections(l.data.connections,{id:D.id,...l.data.nodes[D.id]});console.log("Connected Connections",B),c.dispatch({type:"move-connectiontip_multiple",payload:{tips:Object.keys(B).map($=>({id:$,tipType:B[$],offset:He.getScaledVector(k,3.5)})).reduce(($,H)=>({...$,[H.id]:{tipType:H.tipType,offset:H.offset}}),{}),boundArea:b.connectionTip}})}if(D.type=="connection-tip"){let B=D.id.split("/");u.dispatch({type:"move-connectiontip",payload:{connectionId:B[0],offset:He.getScaledVector(k,3.5),type:B[1],boundArea:b.connectionTip}})}},8)},[l.data.connections,l.data.nodes,d.data.documentDimension,d.data.documentBoundaryThickness,d.data.nodeDimensions]),w=j.useCallback(k=>{if(k.detail&&k.detail.dragElement){const D=He.subtract(k.detail.currentDragPosition,k.detail.dragVector),R={p1:{x:d.data.documentBoundaryThickness,y:d.data.documentBoundaryThickness},p2:{x:m.current.width-d.data.documentBoundaryThickness,y:m.current.height-d.data.documentBoundaryThickness}},B=kt.isPointBounded(R,D),$=kt.isPointBounded(R,k.detail.currentDragPosition);B&&!$?(p.current&&g(),x(k.detail.dragVector,k.detail.dragElement)):$&&!B&&p.current&&g()}return()=>{g()}},[d.data.documentBoundaryThickness,d.data.documentDimension,x]),S=j.useCallback(k=>{k.detail&&k.detail.dragElement&&k.detail.dragElement?.type=="node"&&(c.dispatch({type:"move-node",payload:{nodeId:k.detail.dragElement.id,motionVector:k.detail.dragVector,boundArea:b.node}}),Object.keys(l.data.connections).forEach(D=>{const R=l.data.connections[D].from.split("/")[0],B=l.data.connections[D].to.split("/")[0];R==k.detail.dragElement.id&&c.dispatch({type:"move-connectiontip",payload:{connectionId:D,type:"from",offset:k.detail.dragVector,boundArea:b.connectionTip}}),B==k.detail.dragElement.id&&c.dispatch({type:"move-connectiontip",payload:{connectionId:D,type:"to",offset:k.detail.dragVector,boundArea:b.connectionTip}})}))},[l.data.connections,c.data.nodes,c.data.documentPosition,c.data.viewportPosition,e.id,d.data.documentDimension.width,d.data.documentDimension.height,d.data.nodeDimensions.width,d.data.nodeDimensions.height,d.data.documentBoundaryThickness,b.node]),C=j.useCallback(k=>{if(k.detail&&k.detail.dragElement&&k.detail.dragElement.type=="port"){const D=k.detail.dragElement.id.split("/"),R=No(),B={workspace:{x:c.data.documentPosition.x,y:c.data.documentPosition.y},viewspace:He.ORIGIN,viewport:c.data.viewportPosition},H=xr.getAllPortsPositions({position:c.data.nodes[D[0]].position,dimensions:d.data.nodeDimensions},{input:Object.keys(l.data.nodes[D[0]].ports.input),output:Object.keys(l.data.nodes[D[0]].ports.output),dimensions:{portRadius:d.data.portRadius,slabHeight:d.data.portSlabHeight}})[D[1]=="input"?"inputPorts":"outputPorts"].find(P=>P.key==D[2])?.position;H&&(u.dispatch({type:"add-connection-byId",payload:{id:R,skeleton:{from:D[1]=="output"?k.detail.dragElement.id:"",to:D[1]=="input"?k.detail.dragElement.id:""},design:{from:{position:H},to:{position:H}}}}),f({startPosition:kt.shiftPosition({type:"workspace",position:k.detail.currentDragPosition},"viewport",B),elementDragged:{type:"connection-tip",id:R+"/"+(D[1]=="input"?"from":"to")},currentPosition:kt.shiftPosition({type:"workspace",position:k.detail.currentDragPosition},"viewport",B)}))}},[c.data.documentPosition,c.data.viewportPosition,l.data.nodes,c.data.nodes,d.data.nodeDimensions,d.data.portRadius,d.data.portSlabHeight]),O=j.useCallback(k=>{if(k.detail?.dragElement&&k.detail?.dragElement?.type=="connection-tip"){let D=k.detail.dragElement.id.split("/");Object.keys(l.data.connections).find(R=>R==D[0])?c.dispatch({type:"move-connectiontip",payload:{connectionId:D[0],offset:k.detail.dragVector,type:D[1],boundArea:b.connectionTip}}):Object.keys(u.data.connections).find(R=>R==D[0])&&(console.log("Tip Info",D),u.dispatch({type:"move-connectiontip",payload:{connectionId:D[0],offset:k.detail.dragVector,type:D[1],boundArea:b.connectionTip}}))}},[l.data.connections,u.data.connections]),E=j.useCallback(k=>{if(k.detail?.dragElement?.type=="document"){const D={workspace:c.data.documentPosition,viewspace:He.ORIGIN,viewport:c.data.viewportPosition},R=kt.shiftPosition({type:"viewport",position:k.detail.initialDragPosition},"workspace",D),B=kt.shiftPosition({type:"viewport",position:k.detail.currentDragPosition},"workspace",D);u.dispatch?.({type:"set-selection_area",payload:{start:R,end:B}}),u.dispatch({type:"set-selected_items",payload:{node:Object.keys(c.data.nodes).filter($=>xr.isNodeBounded({p1:R,p2:B},{...c.data.nodes[$],id:$},d.data.nodeDimensions)),connection:[]}})}},[c.data.documentPosition,c.data.viewportPosition,c.data.nodes,d.data.nodeDimensions]),I=j.useCallback(()=>{u.dispatch({type:"remove-connections",payload:{connectionId:Object.keys(u.data.connections)}}),u.dispatch?.({type:"clear-selection_area"}),p.current&&g()},[u.data.connections]),A=j.useCallback(k=>{if(k.detail.dragElement?.type=="connection-tip"){const D={workspace:{x:c.data.documentPosition.x,y:c.data.documentPosition.y},viewspace:He.ORIGIN,viewport:c.data.viewportPosition};let R=kt.shiftPosition({type:"viewport",position:k.detail.currentDragPosition},"workspace",D),B=k.detail.dragElement.id.split("/"),$=u.data.connections[B[0]];if($){let H=B[1]=="from"?$.skeleton.to:$.skeleton.from,P=No();Object.keys(l.data.nodes).filter(T=>T!=H.split("/")[0]).forEach(T=>{let L=xr.getAllPortsPositions({position:c.data.nodes[T]?.position,dimensions:d.data.nodeDimensions},{input:Object.keys(l.data.nodes[T].ports.input),output:Object.keys(l.data.nodes[T].ports.output),dimensions:{portRadius:d.data.portRadius,slabHeight:d.data.portSlabHeight}});L.outputPorts.forEach(W=>{B[1]=="from"&&R.x>W.position.x-d.data.portRadius&&R.x<W.position.x+d.data.portRadius&&R.y>W.position.y-d.data.portRadius&&R.y<W.position.y+d.data.portRadius&&(u.dispatch({type:"remove-connection",payload:{connectionId:B[0]}}),l.dispatch({type:"add-connection-byId",payload:{id:P,from:T+"/output/"+W.key,to:H}}),c.dispatch({type:"init-connection",payload:{connectionId:P,from:W.position,to:$.design.to.position}}),f(null))}),L.inputPorts.forEach(W=>{B[1]=="to"&&R.x>W.position.x-d.data.portRadius&&R.x<W.position.x+d.data.portRadius&&R.y>W.position.y-d.data.portRadius&&R.y<W.position.y+d.data.portRadius&&(u.dispatch({type:"remove-connection",payload:{connectionId:B[0]}}),l.dispatch({type:"add-connection-byId",payload:{id:P,from:H,to:T+"/input/"+W.key}}),c.dispatch({type:"init-connection",payload:{connectionId:P,from:$.design.from.position,to:W.position}}),f(null))})})}}},[c.data.documentPosition,c.data.viewportPosition,l.data.nodes,l.data.connections,u.data.connections]),F=j.useCallback(k=>{k.type=="node"&&u.dispatch?.({type:"select",payload:{type:k.type,id:k.id,isShiftPressed:h.current}}),k.type=="document"&&(h.current||u.dispatch({type:"reset-selection"}))},[]);j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,A),()=>window.removeEventListener("ondrag-"+e.id,A)),[A]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,E),()=>window.removeEventListener("ondrag-"+e.id,E)),[E]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,S),()=>window.removeEventListener("ondrag-"+e.id,S)),[S]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,C),()=>window.removeEventListener("ondrag-"+e.id,C)),[C]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,O),()=>window.removeEventListener("ondrag-"+e.id,O)),[O]),j.useEffect(()=>(window.addEventListener("ondrag-"+e.id,w),()=>window.removeEventListener("ondrag-"+e.id,w)),[w]),j.useEffect(()=>(window.addEventListener("dragstop-"+e.id,I),()=>window.removeEventListener("dragstop-"+e.id,I)),[I]);const V=j.useCallback(k=>{k.key=="Shift"&&(h.current=!0)},[]),M=j.useCallback(k=>{k.key=="Shift"&&(h.current=!1)},[]),y=j.useCallback(k=>{k.key=="Delete"&&(l.dispatch({type:"remove-nodes",payload:u.data.selectedItems.node}),c.dispatch({type:"remove-nodes",payload:u.data.selectedItems.node}),c.dispatch({type:"remove-connections",payload:u.data.selectedItems.node.reduce((D,R)=>[...D,...Object.keys(xr.getConnections(l.data.connections,{...l.data.nodes[R],id:R}))],[])}),l.dispatch({type:"remove-connections",payload:u.data.selectedItems.node.reduce((D,R)=>[...D,...Object.keys(xr.getConnections(l.data.connections,{...l.data.nodes[R],id:R}))],[])}))},[u.data.selectedItems,l.data.connections,l.data.nodes]);j.useEffect(()=>(window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)),[y]),j.useEffect(()=>{const k=new ResizeObserver(()=>{let D=a.current?.getBoundingClientRect();D&&(r(!1),c.dispatch({type:"set-viewport-position",payload:{x:-D.x,y:-D.y}}),m.current={width:D.width,height:D.height},r(!0))});return k.observe(a.current),window.addEventListener("keydown",V),window.addEventListener("keyup",M),()=>{k.disconnect(),window.removeEventListener("keydown",V),window.removeEventListener("keyup",M)}},[]);const _=j.useCallback(k=>{k.target==k.currentTarget&&(i.delete("node_form"),s(i))},[i]);return console.log("Graph State",l.data,c.data,u.data),Ce.jsx(dO.Provider,{value:{assets:l,view:c,config:d,interaction:u,dragSession:{data:t,dispatch:f}},children:Ce.jsxs("div",{ref:a,className:"fullwidth fullheight no-select",style:{position:"relative",overflow:"hidden"},children:[n?Ce.jsxs("div",{onMouseDown:()=>F({type:"document",id:e.id}),className:"fullwidth fullheight flexbox-row flexbox-center",children:[Ce.jsx(ka,{id:"document-drag_wrapper",dragItem:{type:"document",id:e.id},dragSetter:f,class:"absolute",style:{top:c.data.documentPosition.y,left:c.data.documentPosition.x,width:d.data.documentDimension.width,height:d.data.documentDimension.height},children:Ce.jsx(pO,{id:e.id,config:e.config.document})}),i.get("node_form")?Ce.jsx("div",{className:"absolute fullwidth fullheight",style:{zIndex:200,backgroundColor:"rgba(0,0,0,0.1)"},children:Ce.jsx("div",{onClick:_,className:"fullwidth fullheight",style:{position:"relative"},children:Ce.jsx("div",{className:"absolute white-bg curve padding",style:{width:"80%",height:"80%",bottom:50,left:"50%",top:"50%",transform:"translate(-50%,-50%)",boxShadow:"0px 0px 30px rgba(0,0,0,0.1)"}})})}):null]}):Ce.jsx("div",{className:"fullwidth fullheight flexbox-row flexbox-center",children:Ce.jsx("div",{className:"fullwidth fullheight flexbox-column flexbox-center",children:Ce.jsx("span",{children:"Loading Document"})})}),Ce.jsx("div",{className:"absolute fullheight",style:{backgroundColor:"rgba(0,0,0,0)",width:d?.data?.documentBoundaryThickness,left:0,top:0}}),Ce.jsx("div",{className:"absolute fullheight",style:{backgroundColor:"rgba(0,0,0,0)",width:d?.data?.documentBoundaryThickness,right:0,top:0}}),Ce.jsx("div",{className:"absolute fullwidth",style:{backgroundColor:"rgba(0,0,0,0)",height:d?.data?.documentBoundaryThickness,left:0,top:0}}),Ce.jsx("div",{className:"absolute fullwidth",style:{backgroundColor:"rgba(0,0,0,0)",height:d?.data?.documentBoundaryThickness,left:0,bottom:0}})]})})},Uz={Dropdown:lx,Textbox:cx,Toggle:ux};exports.AssetsReducer=Iz;exports.Connection=mz;exports.Context_Workspace=dO;exports.Document=pO;exports.Draggable=ka;exports.Form=fz;exports.FormInputElements=Uz;exports.InteractionReducer=_z;exports.JSONForms=Hz;exports.NodeUtils=xr;exports.UIDCreator=No;exports.UiElementsRegistry_Standard=lz;exports.VectorApi=He;exports.ViewReducer=Az;exports.Workspace=qz;exports.getSchemaNode=Fz;exports.schemaNodeExporter=cO;exports.useWorkspace=$z;