@web-noise/core 0.0.4 → 0.0.6

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.
@@ -1 +1 @@
1
- {"mappings":"Ia+LG,EC3KA,C,Q,Q,C,C,O,C,C,Y,C,K,mB,A,Q,a,C,C,iB,C,C,U,C,C,O,C,C,Y,C,K,gB,A,Q,M,iB,A,Q,U,C,K,Q,A,Q,Y,C,C,a,C,C,W,C,C,e,C,C,U,C,K,O,A,Q,U,C,K,iB,A,Q,W,C,C,gB,C,C,c,C,C,iB,C,K,gB,A,O,0B,A,Q,G,qB,C,C,W,C,C,oB,C,C,oB,C,C,uB,C,C,c,C,C,qB,C,C,W,C,C,Y,C,C,qB,C,C,gB,C,C,Y,C,C,U,C,C,iB,C,C,iB,C,K,W,A,Q,U,C,K,S,A,Q,W,C,C,S,C,C,U,C,K,e,A,Q,gB,C,K,c,A,Q,kB,C,C,Q,C,C,Q,C,C,a,C,K,iB,A,O,yC,A,Q,M,kB,A,Q,M,Y,A,Q,gB,C,K,W,A,Q,Y,C,K,iB,A,Q,gB,C,C,c,C,C,e,C,C,S,E,C,Y,E,K,gB,A,Q,a,E,K,c,A,Q,O,mB,A,O,kC,A,Q,c,E,C,gB,E,K,gB,A,Q,e,E,K,gB,A,Q,O,qB,A,O,oC,A,Q,U,E,K,Q,C,S,G,C,E,O,G,E,U,C,E,O,C,C,CXhBH,IAAM,GAAyC,EAAE,CKEpC,GAAiC,CAAA,EDM9C,IAAM,GAAkB,IAAI,IAAI,GEZf,8MFYjB,6CGZa,GAAoB,wBACpB,GAAuB,CAAA,CAAA,EAAI,GAAA,CAAmB,IAG9C,EAKX,EADU,GAAA,IAAA,CAAA,GAAQ,CAAA,CAAA,GAClB,IAAA,CAAA,OACA,GAAA,MAAA,CAAA,SACA,GAAA,KAAA,CAAA,QACA,GAAA,GAAA,CAAA,MGMF,IAAM,GAAc,AAAc,GACzB,KAAK,KAAK,CAAC,KAAK,SAAS,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;;;;QA4DO,CAAA,AAAA,GAEH,AAAA,EAAC,GAAU,CAAA,SAAA,CACT,AAAA,EAAC,GAAa,CAAA,SAAA,CACX,EAAQ,KAAK,CAAC,GAAG,CAAC,CAAC,EAAM,IACxB,AAAA,EAAC,GAAG,CACF,QAAS,IAAM,EAAoB,GAEnC,OAAQ,IAAU,EAAgB,SAAA,CAElC,AAAA,EAAC,GAAa,CACZ,SAAU,AAAC,GAAQ,EAAe,EAAO,GACzC,MAAO,EAAK,IAAI,EAAI,SAAS,GAE/B,AAAA,EAAC,GAAS,CACR,QAAS,AAAC,IACR,EAAM,eAAe,GAElB,OAAO,OAAO,CAAC,4CAIlB,EAAW,EACb,CAAC,GACD,AAAA,EAjBG,IAoBT,AAAA,EAAC,GAAc,CAAC,QAAS,IAAM,EAAQ,MAAoB,SACzD,AAAA,EAAC,GAAW,CAAA,EAAG,GACA,AAAA,GAEnB,AAAA,EAAC,GAAe,CAAA,SAAA,CACd,AAAA,EAAC,GAAM,CAAA,GACD,CAAK,CACT,SAAU,AAAC,IACT,GACF,EACA,YAAa,EAAe,GAE9B,AAAA,EAAC,GAAoB,CAAC,KAAM,EAAU,SAAA,YAAA,GAEf,AAAA,GACP,AAAA,GACP,AAAA,EAGnB,S,M,M,C,M,e,C,M,I,C,M,M,C,M,Q,C,M,U,C,M,W,C,M,Y,C,M,U,C,M,W,C,M,I,C,M,K,C,M,a,C,M,Y,C,M,O,C,M,Q,C,M,Q,C,M,K,C,M,Q","sources":["<anon>","packages/core/index.ts","packages/core/src/components/App.tsx","packages/fetch/index.ts","packages/fetch/lib.ts","packages/core/src/store/index.ts","packages/patch/index.ts","packages/patch/src/createPatch.ts","packages/patch/src/audioNodeTypes.ts","node_modules/@parcel/runtime-js/lib/bundles/runtime-46fa6afb492e1190.js","packages/core/src/constants.ts","packages/core/src/helpers/generateNodeId.ts","packages/core/src/store/nodesStore.ts","packages/core/src/store/history/index.ts","packages/core/src/store/audioPatch/index.ts","packages/core/src/store/audioPatch/compareGraphs.ts","packages/core/src/store/projectStore.ts","packages/core/src/styles.ts","packages/core/src/theme.ts","packages/core/src/components/Editor/index.tsx","packages/core/src/components/contextMenu/EdgeContextMenu.tsx","packages/core/src/hooks/useTheme.ts","packages/core/src/components/contextMenu/styles.tsx","packages/core/src/components/contextMenu/EditorContextMenu.tsx","packages/core/src/components/AddNode/index.tsx","packages/core/src/components/Modal.tsx","packages/core/src/components/AddNode/Filters.tsx","packages/core/src/components/AddNode/Plugins.tsx","packages/core/src/components/UploadPatch.tsx","packages/core/src/components/UploadProject.tsx","packages/core/src/components/contextMenu/NodeContextMenu.tsx","packages/core/src/components/ControlPanel/index.tsx","packages/core/src/components/ControlPanel/ControlPanelItem.tsx","packages/core/src/hooks/useAudioNode.ts","packages/core/src/hooks/useNode.ts","packages/core/src/components/ControlPanel/styles.tsx","packages/core/src/components/Node/index.tsx","packages/core/src/components/EditableLabel.tsx","packages/core/src/components/NodeInfoModal.tsx","packages/core/src/components/Help/index.tsx","packages/core/src/components/Help/HelpModal.tsx","node_modules/@parcel/runtime-js/lib/bundles/runtime-64181e2ef3200fa7.js","packages/core/src/components/ResumeContext.tsx","packages/core/src/components/ToggleMinimap.tsx","packages/core/src/components/Wire.tsx"],"sourcesContent":["import {jsxs as $djR0r$jsxs, jsx as $djR0r$jsx, Fragment as $djR0r$Fragment} from \"react/jsx-runtime\";\nimport {withTheme as $djR0r$withTheme, ThemeProvider as $djR0r$ThemeProvider, Global as $djR0r$Global, css as $djR0r$css, useTheme as $djR0r$useTheme} from \"@emotion/react\";\nimport $djR0r$emotionstyled from \"@emotion/styled\";\nimport {nanoid as $djR0r$nanoid} from \"nanoid\";\nimport {useState as $djR0r$useState, useEffect as $djR0r$useEffect, useMemo as $djR0r$useMemo, useCallback as $djR0r$useCallback, useRef as $djR0r$useRef} from \"react\";\nimport {FaPlus as $djR0r$FaPlus} from \"react-icons/fa6\";\nimport {MdClose as $djR0r$MdClose, MdDragHandle as $djR0r$MdDragHandle, MdSettings as $djR0r$MdSettings, MdInfoOutline as $djR0r$MdInfoOutline} from \"react-icons/md\";\nimport \"reactflow/dist/style.css\";\nimport $djR0r$reactflow, {getConnectedEdges as $djR0r$getConnectedEdges, addEdge as $djR0r$addEdge, applyNodeChanges as $djR0r$applyNodeChanges, applyEdgeChanges as $djR0r$applyEdgeChanges, useOnViewportChange as $djR0r$useOnViewportChange, Background as $djR0r$Background, BackgroundVariant as $djR0r$BackgroundVariant, MiniMap as $djR0r$MiniMap, Controls as $djR0r$Controls, ReactFlowProvider as $djR0r$ReactFlowProvider, useReactFlow as $djR0r$useReactFlow, Position as $djR0r$Position, Handle as $djR0r$Handle, ControlButton as $djR0r$ControlButton, getBezierPath as $djR0r$getBezierPath} from \"reactflow\";\nimport {create as $djR0r$create} from \"zustand\";\nimport {reverse as $djR0r$reverse, patch as $djR0r$patch, create as $djR0r$create1} from \"jsondiffpatch\";\nimport {injectGlobal as $djR0r$injectGlobal} from \"@emotion/css\";\nimport {useContextMenu as $djR0r$useContextMenu, Item as $djR0r$Item, Menu as $djR0r$Menu, Separator as $djR0r$Separator} from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport $djR0r$jsfiledownload from \"js-file-download\";\nimport $djR0r$hotkeysjs from \"hotkeys-js\";\nimport {createPortal as $djR0r$createPortal} from \"react-dom\";\nimport {FileDrop as $djR0r$FileDrop} from \"react-file-drop\";\nimport {FaFileUpload as $djR0r$FaFileUpload, FaQuestion as $djR0r$FaQuestion, FaVolumeOff as $djR0r$FaVolumeOff, FaMap as $djR0r$FaMap, FaRegMap as $djR0r$FaRegMap} from \"react-icons/fa\";\nimport {Resizable as $djR0r$Resizable} from \"re-resizable\";\nimport $djR0r$reactgridlayout from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport {AiFillLock as $djR0r$AiFillLock, AiFillUnlock as $djR0r$AiFillUnlock} from \"react-icons/ai\";\nimport {RxDashboard as $djR0r$RxDashboard} from \"react-icons/rx\";\nimport $djR0r$reactmoderndrawer from \"react-modern-drawer\";\nimport \"react-modern-drawer/dist/index.css\";\nimport {marked as $djR0r$marked} from \"marked\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n\n\n\n\n\n\n\nconst $4df9b03f6b65375a$export$4659b591c19bdf3d = (url, pattern)=>{\n // Escape special characters in the pattern, except for '*'\n const escapedPattern = pattern.replace(/([.+?^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\n // Replace '*' with '.*' to match any sequence of characters\n const regexPattern = escapedPattern.replace(/\\*/g, '.*');\n // Create a regular expression from the pattern, ensuring it matches the entire URL\n const regex = new RegExp(`^${regexPattern}$`);\n // Test if the URL matches the pattern\n return regex.test(url);\n};\n\n\nconst $4165c1239dbc641a$var$customFetchers = [];\nconst $4165c1239dbc641a$export$9e4ff1580457920e = (matcher, fetcher)=>{\n $4165c1239dbc641a$var$customFetchers.push([\n matcher,\n fetcher\n ]);\n return ()=>{\n //delete fetcher\n };\n};\nconst $4165c1239dbc641a$var$getFetcher = (url)=>{\n return [\n ...$4165c1239dbc641a$var$customFetchers\n ].reverse().find(([matcher])=>{\n return (0, $4df9b03f6b65375a$export$4659b591c19bdf3d)(url, matcher);\n })?.[1];\n};\nconst $4165c1239dbc641a$var$webNoiseFetch = (...args)=>{\n const request = new Request(...args);\n const fetcher = $4165c1239dbc641a$var$getFetcher(request.url);\n if (fetcher) return fetcher(...args);\n return fetch(...args);\n};\nvar $4165c1239dbc641a$export$2e2bcd8739ae039 = $4165c1239dbc641a$var$webNoiseFetch;\n\n\n\n\nconst $059c7a7b96627b87$export$64e2564cc3ca44e9 = {};\nconst $059c7a7b96627b87$export$ff7e9ed3f5c574f2 = (newAudioNodeTypes)=>{\n Object.assign($059c7a7b96627b87$export$64e2564cc3ca44e9, newAudioNodeTypes);\n};\nconst $059c7a7b96627b87$export$6bf50e9be02d9812 = (type)=>$059c7a7b96627b87$export$64e2564cc3ca44e9[type];\n\n\nvar $8cea846e06c7f3f1$exports = {};\n$8cea846e06c7f3f1$exports = \"data:application/javascript,class%20e%20extends%20AudioWorkletProcessor%7Bprocess%28%29%7Breturn%210%7D%7DregisterProcessor%28%22dump-node-processor%22%2Ce%29%3Bexport%7Be%20as%20DumpNodeProcessor%7D%3B\";\n\n\nconst $4bc43559bc9437b5$var$dumpNodeWorklet = new URL((0, (/*@__PURE__*/$parcel$interopDefault($8cea846e06c7f3f1$exports))), \"file:///packages/patch/src/createPatch.ts\");\nconst $4bc43559bc9437b5$var$createPatch = (audioContext = new AudioContext())=>{\n /*\n * due to bug in chrome we need to kickstart worklet outputs\n * by connecting it to an input\n * */ const dumpNodePromise = audioContext.audioWorklet.addModule($4bc43559bc9437b5$var$dumpNodeWorklet).then(()=>{\n return new AudioWorkletNode(audioContext, \"dump-node-processor\");\n });\n const audioNodes = new Map();\n const audioConnections = new Map();\n const registerAudioNode = async (node)=>{\n const { id: id, type: type, data: data } = node;\n if (!type) {\n audioNodes.set(id, {\n loading: false,\n error: new Error(`Node: ${id} has no type`),\n node: null\n });\n return;\n }\n const nodeCreator = (0, $059c7a7b96627b87$export$6bf50e9be02d9812)(type);\n if (nodeCreator === false) return;\n const createNode = nodeCreator;\n if (!createNode) {\n audioNodes.set(id, {\n loading: false,\n error: new Error(`Could not find handler for audio type ${type}`),\n node: null\n });\n return;\n }\n audioNodes.set(id, {\n loading: true,\n error: null,\n node: null\n });\n try {\n const audioNode = await createNode(audioContext, data);\n const dumpNode = await dumpNodePromise;\n audioNodes.set(id, {\n loading: false,\n error: null,\n node: audioNode\n });\n // Kickstart worklet outputs\n Object.values(audioNode.outputs || []).forEach(({ port: port })=>{\n if (!dumpNode) return;\n if (port instanceof AudioWorkletNode) port.connect(dumpNode);\n if (Array.isArray(port) && port[0] instanceof AudioWorkletNode) port[0].connect(dumpNode, port[1]);\n });\n } catch (error) {\n audioNodes.set(id, {\n loading: false,\n error: error,\n node: null\n });\n }\n };\n const registerAudioNodes = async (nodes)=>{\n return Promise.all(nodes.map(registerAudioNode));\n };\n const unregisterAudioNode = (props)=>{\n const { id: id, data: data } = props;\n const audioNode = audioNodes.get(id);\n if (!audioNode) {\n console.error(`Audio node #${id} does not exist`);\n return;\n }\n const { loading: loading, error: error, node: node } = audioNode;\n if (loading) {\n console.error(`Audio node #${id} is yet not loaded`);\n return;\n }\n if (error) {\n console.error(`Audio node #${id} is in error state: ${error.toString()}`);\n return;\n }\n node.destroy && node.destroy();\n //disconnect all ports\n Object.values(node.inputs || {}).forEach(({ port: port })=>port instanceof AudioNode && port.disconnect && port.disconnect());\n Object.values(node.outputs || {}).forEach(({ port: port })=>port instanceof AudioNode && port.disconnect && port.disconnect());\n audioNodes.delete(id);\n };\n const unregisterAudioNodes = (nodes)=>{\n return nodes.map(unregisterAudioNode);\n };\n const registerAudioConnection = (edge)=>{\n const { source: source, sourceHandle: sourceHandle, target: target, targetHandle: targetHandle, id: id } = edge;\n const { node: sourceNode } = audioNodes.get(source) || {};\n if (!sourceNode) {\n console.error(`can't find source node ${source}`);\n return;\n }\n if (!sourceHandle) {\n console.error(`source handle is not defined in node ${source}`);\n return;\n }\n const outputNode = sourceNode.outputs?.[sourceHandle];\n const outputNodePort = outputNode?.port;\n const { node: targetNode } = audioNodes.get(target) || {};\n if (!targetNode) {\n console.error(`can't find target node ${targetNode}`);\n return;\n }\n if (!targetHandle) {\n console.error(`source handle is not defined in node ${sourceNode}`);\n return;\n }\n const inputNode = targetNode.inputs?.[targetHandle];\n const inputNodePort = inputNode?.port;\n if (!outputNodePort) {\n console.error(`Can't find output port: ${source}:${sourceHandle}`);\n return;\n }\n if (!inputNodePort) {\n console.error(`Can't find input port: ${target}:${targetHandle}`);\n return;\n }\n const isInputNode = inputNodePort instanceof AudioNode;\n const isInputParam = inputNodePort instanceof AudioParam;\n const isInputArray = inputNodePort instanceof Array;\n const isInputSimple = isInputNode || isInputParam;\n const isOutputNode = outputNodePort instanceof AudioNode;\n const isOutputArray = outputNodePort instanceof Array;\n if (isOutputNode && isInputSimple) //@ts-ignore inputNode can actually be AudioParam\n outputNodePort.connect(inputNodePort);\n else if (isOutputNode && isInputArray) outputNodePort.connect(inputNodePort[0], 0, inputNodePort[1]);\n else if (isOutputArray && isInputSimple) //@ts-ignore inputNode can actually be AudioParam\n outputNodePort[0].connect(inputNodePort, outputNodePort[1]);\n else if (isOutputArray && isInputArray) outputNodePort[0].connect(inputNodePort[0], outputNodePort[1], inputNodePort[1]);\n else {\n console.log(outputNodePort, inputNodePort);\n console.error(`ports can be only AudioNode or AudioNodeChannel`);\n }\n audioConnections.set(id, {\n output: outputNode,\n input: inputNode\n });\n };\n const registerAudioConnections = (edges)=>{\n return edges.map(registerAudioConnection);\n };\n const unregisterAudioConnection = (edge)=>{\n const { id: id, data: data } = edge;\n const audioConnection = audioConnections.get(id);\n if (!audioConnection) {\n console.error(`can't find connection with id: ${id}`);\n return;\n }\n const { input: { port: inputNodePort }, output: { port: outputNodePort } } = audioConnection;\n const isInputNode = inputNodePort instanceof AudioNode;\n const isInputParam = inputNodePort instanceof AudioParam;\n const isInputArray = inputNodePort instanceof Array;\n const isInputSimple = isInputNode || isInputParam;\n const isOutputNode = outputNodePort instanceof AudioNode;\n const isOutputArray = outputNodePort instanceof Array;\n if (isOutputNode && isInputSimple) //@ts-ignore inputNode can actually be AudioParam\n outputNodePort.disconnect(inputNodePort);\n else if (isOutputNode && isInputArray) outputNodePort.disconnect(inputNodePort[0], 0, inputNodePort[1]);\n else if (isOutputArray && isInputSimple) //@ts-ignore inputNode can actually be AudioParam\n outputNodePort[0].disconnect(inputNodePort, outputNodePort[1]);\n else if (isOutputArray && isInputArray) outputNodePort[0].disconnect(inputNodePort[0], outputNodePort[1], inputNodePort[1]);\n else {\n console.log(outputNodePort, inputNodePort);\n throw new Error(`output port can not be only AudioNode or AudioNodeChannel`);\n }\n audioConnections.delete(id);\n };\n const unregisterAudioConnections = (edges)=>{\n return edges.map(unregisterAudioConnection);\n };\n return {\n audioContext: audioContext,\n audioNodes: audioNodes,\n registerAudioNode: registerAudioNode,\n registerAudioNodes: registerAudioNodes,\n unregisterAudioNode: unregisterAudioNode,\n unregisterAudioNodes: unregisterAudioNodes,\n audioConnections: audioConnections,\n registerAudioConnection: registerAudioConnection,\n registerAudioConnections: registerAudioConnections,\n unregisterAudioConnection: unregisterAudioConnection,\n unregisterAudioConnections: unregisterAudioConnections\n };\n};\nvar $4bc43559bc9437b5$export$2e2bcd8739ae039 = $4bc43559bc9437b5$var$createPatch;\n\n\n\n\n\nconst $9738c58e5420c085$export$956b3cf15d7c363 = \"web-noise-drag-handle\";\nconst $9738c58e5420c085$export$21d634b1d5d9bee3 = `.${$9738c58e5420c085$export$956b3cf15d7c363}`;\nconst $9738c58e5420c085$export$9f05d3e6ade4c09e = {\n rowHeight: 10,\n cols: 4\n};\nvar $9738c58e5420c085$export$b0b7b95ee465c83c;\n(function(PortType) {\n PortType[\"Gate\"] = \"gate\";\n PortType[\"Number\"] = \"number\";\n PortType[\"Audio\"] = \"audio\";\n PortType[\"Any\"] = \"any\";\n})($9738c58e5420c085$export$b0b7b95ee465c83c || ($9738c58e5420c085$export$b0b7b95ee465c83c = {}));\n\n\nconst $5c30fde65a1f208b$var$generateNodeId = (node)=>{\n const random = +new Date() + Math.floor(Math.random() * 1000);\n if (!node?.type) return random.toString();\n return `${node.type}-${random}`;\n};\nvar $5c30fde65a1f208b$export$2e2bcd8739ae039 = $5c30fde65a1f208b$var$generateNodeId;\n\n\n\n\nconst $647d11026d55ca5b$var$nodesStateCreator = (set, get)=>({\n nodes: [],\n edges: [],\n onNodesChange: (changes)=>{\n set(({ nodes: nodes })=>({\n nodes: (0, $djR0r$applyNodeChanges)(changes, nodes).map((node)=>({\n dragHandle: (0, $9738c58e5420c085$export$21d634b1d5d9bee3),\n ...node\n }))\n }));\n },\n onEdgesChange: (changes)=>{\n set(({ edges: edges })=>({\n edges: (0, $djR0r$applyEdgeChanges)(changes, edges)\n }));\n },\n onConnect: (connection)=>{\n set(({ edges: edges })=>({\n edges: (0, $djR0r$addEdge)(connection, edges)\n }));\n },\n addNode: (node)=>{\n set(({ nodes: nodes })=>({\n nodes: nodes.concat(node)\n }));\n },\n setNodes: (nodes)=>{\n set({\n nodes: nodes\n });\n },\n setEdges: (edges)=>{\n set({\n edges: edges\n });\n },\n setNodesAndEdges: ({ nodes: nodes, edges: edges })=>{\n set({\n nodes: nodes,\n edges: edges\n });\n },\n getNodesAndEdges: ()=>{\n const { nodes: nodes, edges: edges } = get();\n return {\n nodes: nodes,\n edges: edges\n };\n },\n clearElements: ()=>{\n set({\n nodes: [],\n edges: []\n });\n },\n getNode: (id)=>{\n const { nodes: nodes } = get();\n const node = nodes.find((node)=>node.id === id);\n return node || null;\n },\n updateNodeData: (id, data)=>{\n set(({ nodes: nodes })=>{\n return {\n nodes: nodes.map((node)=>{\n if (node.id === id) return {\n ...node,\n data: {\n ...node.data,\n ...data\n }\n };\n return node;\n })\n };\n });\n },\n nodeTypes: {},\n setNodeTypes: (nodeTypes)=>set({\n nodeTypes: nodeTypes\n })\n });\nvar $647d11026d55ca5b$export$2e2bcd8739ae039 = $647d11026d55ca5b$var$nodesStateCreator;\n\n\n\nconst $15640845882b881f$var$cloneObject = (input)=>{\n return JSON.parse(JSON.stringify(input));\n};\nconst $15640845882b881f$export$b1b92d12d1c2ae0e = (set, get)=>({\n history: {\n maxHistoryLength: 5,\n buffer: [],\n pointer: 0,\n skipCollect: false,\n push: (changes)=>{\n const { history: history } = get();\n const { maxHistoryLength: maxHistoryLength, skipCollect: skipCollect } = history;\n if (skipCollect) {\n set({\n history: {\n ...history,\n skipCollect: false\n }\n });\n return;\n }\n set(({ history: history })=>{\n if (!history) return {};\n const { buffer: buffer, pointer: pointer } = history;\n const newBuffer = buffer.slice(Math.max(pointer - maxHistoryLength + 1, 0), pointer);\n return {\n history: {\n ...history,\n buffer: [\n ...newBuffer,\n changes\n ],\n pointer: Math.min(pointer + 1, maxHistoryLength)\n }\n };\n });\n },\n back: ()=>{\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, history: history } = get();\n const { buffer: buffer, pointer: pointer } = history;\n const patchData = buffer[pointer - 1];\n if (!patchData) return;\n const reversedPatchData = $djR0r$reverse(patchData);\n if (!reversedPatchData) return;\n const updates = $15640845882b881f$var$cloneObject({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel\n });\n const patch = $djR0r$patch(updates, reversedPatchData);\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer - 1,\n skipCollect: true\n }\n });\n },\n forward: ()=>{\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, history: history } = get();\n const { buffer: buffer, pointer: pointer } = history;\n const patchData = buffer[pointer];\n if (!patchData) return;\n const updates = $15640845882b881f$var$cloneObject({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel\n });\n const patch = $djR0r$patch(updates, patchData);\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer + 1,\n skipCollect: true\n }\n });\n },\n // @TODO: remove this method and store history per file\n clear: ()=>{\n const { history: history } = get();\n set({\n history: {\n ...history,\n buffer: [],\n pointer: 0,\n skipCollect: true\n }\n });\n }\n }\n });\nconst $15640845882b881f$var$COLLECT_CHANGES_DEBOUNCE_TIME = 500;\nconst $15640845882b881f$export$4e64751394766316 = (set, get)=>{\n const jsondiffpatchInstance = $djR0r$create1({\n propertyFilter: (name, context)=>{\n //@TODO: rework this function, find better solution\n if (context.parent?.parent?.childName === \"controlPanel\") return true;\n if (// @ts-ignore\n [\n \"data\",\n \"position\",\n \"controlPanel\"\n ].includes(context.parent?.childName)) return true;\n return [\n \"controlPanel\",\n \"size\",\n \"edges\",\n \"nodes\",\n \"data\",\n \"label\",\n \"config\",\n \"values\",\n \"position\",\n \"x\",\n \"y\"\n ].includes(name);\n }\n });\n let oldState = get();\n let timer;\n return (state, prevState)=>{\n if (state.currentFileIndex !== prevState.currentFileIndex) get().history.clear();\n clearTimeout(timer);\n if (!oldState) oldState = prevState;\n timer = setTimeout(()=>{\n const changes = jsondiffpatchInstance.diff(oldState, state);\n oldState = null;\n if (changes) get().history.push(changes);\n }, $15640845882b881f$var$COLLECT_CHANGES_DEBOUNCE_TIME);\n };\n};\nconst $15640845882b881f$var$history = (config)=>(set, get, api)=>{\n const collectChanges = $15640845882b881f$export$4e64751394766316(set, get);\n api.subscribe(collectChanges);\n return config((...args)=>set(...args), get, api);\n };\nvar $15640845882b881f$export$2e2bcd8739ae039 = $15640845882b881f$var$history;\n\n\n\nconst $1efbebe6ffe1c168$export$e364ea0c1dfb25e5 = (left, right)=>{\n const setLeft = new Set(left.map((item)=>item.id));\n const setRight = new Set(right.map((item)=>item.id));\n const added = right.filter((item)=>!setLeft.has(item.id));\n const removed = left.filter((item)=>!setRight.has(item.id));\n return {\n added: added,\n removed: removed\n };\n};\n\n\nconst $64d14d164a029007$export$62647b40ff8aed70 = (set, get)=>({\n patch: (0, $4bc43559bc9437b5$export$2e2bcd8739ae039)(),\n nodesState: {}\n });\nconst $64d14d164a029007$var$audioPatch = (config)=>(set, get, api)=>{\n api.subscribe(async (state, prevState)=>{});\n const promises = new Set();\n let currentState = {\n ...get(),\n nodes: [],\n edges: []\n };\n return config(async (...args)=>{\n const oldState = get();\n const [storeChanges] = args;\n //@ts-ignore\n const newState = {\n ...currentState,\n ...typeof storeChanges === \"function\" ? storeChanges({\n ...currentState\n }) : storeChanges\n };\n const nodeChanges = (0, $1efbebe6ffe1c168$export$e364ea0c1dfb25e5)(currentState.nodes, newState.nodes);\n const edgeChanges = (0, $1efbebe6ffe1c168$export$e364ea0c1dfb25e5)(currentState.edges, newState.edges);\n //@ts-ignore\n currentState = newState;\n const newNodes = nodeChanges.added;\n const newEdges = edgeChanges.added;\n const removedEdges = edgeChanges.removed;\n const removedNodes = nodeChanges.removed;\n const { patch: patch } = oldState;\n if (newNodes.length) {\n const promise = patch.registerAudioNodes(//@ts-ignore\n newNodes);\n promises.add(promise);\n await promise;\n promises.delete(promise);\n }\n if (!(newEdges.length || removedEdges.length || removedNodes.length)) {\n set(...args);\n return;\n }\n if (promises.size) try {\n await Promise.all([\n ...promises.values()\n ]);\n } catch (e) {\n console.log(\"some error\", e);\n }\n if (newEdges.length) patch.registerAudioConnections(//@ts-ignore\n newEdges);\n if (removedEdges.length) //@ts-ignore\n patch.unregisterAudioConnections(removedEdges);\n if (removedNodes.length) //@ts-ignore\n patch.unregisterAudioNodes(removedNodes);\n set(...args);\n }, get, api);\n };\nvar $64d14d164a029007$export$2e2bcd8739ae039 = $64d14d164a029007$var$audioPatch;\n\n\nconst $e615699a379fa930$var$projectStateCreator = (set, get)=>({\n project: {\n files: []\n },\n setProject (project) {\n set({\n project: project,\n currentFileIndex: 0\n });\n },\n getProject () {\n return get().project;\n },\n pullEditorChanges () {\n const { getEditorState: getEditorState, currentFileIndex: currentFileIndex, updateFileContent: updateFileContent, project: project } = get();\n const currentFile = project.files[currentFileIndex];\n updateFileContent(currentFileIndex, {\n ...currentFile,\n file: getEditorState()\n });\n },\n currentFileIndex: 0,\n setCurrentFileIndex (newFileIndex) {\n const { currentFileIndex: currentFileIndex } = get();\n if (newFileIndex === currentFileIndex) return;\n set({\n currentFileIndex: newFileIndex\n });\n },\n updateFileContent (index, file) {\n const { project: project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i)=>{\n if (i === index) return {\n // @TODO check again if merging is really needed here\n ...f,\n ...file\n };\n return f;\n })\n }\n });\n },\n updateFileName (index, fileName) {\n const { project: project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i)=>{\n if (i === index) return {\n ...f,\n name: fileName\n };\n return f;\n })\n }\n });\n },\n addFile (file) {\n const { project: project } = get();\n const files = [\n ...project.files,\n file\n ];\n set({\n project: {\n ...project,\n files: files\n },\n currentFileIndex: files.length - 1\n });\n },\n deleteFile: (fileIndex)=>{\n const { project: project, currentFileIndex: currentFileIndex } = get();\n set({\n project: {\n ...project,\n files: project.files.filter((_, index)=>fileIndex !== index)\n }\n });\n if (fileIndex <= currentFileIndex) set({\n currentFileIndex: currentFileIndex - 1\n });\n }\n });\nvar $e615699a379fa930$export$2e2bcd8739ae039 = $e615699a379fa930$var$projectStateCreator;\n\n\nconst $6f5e1924a22d258c$export$34c5bc865219488e = (...args)=>{\n const [set, get] = args;\n return {\n ...(0, $647d11026d55ca5b$export$2e2bcd8739ae039)(...args),\n ...(0, $15640845882b881f$export$b1b92d12d1c2ae0e)(...args),\n ...(0, $64d14d164a029007$export$62647b40ff8aed70)(...args),\n ...(0, $e615699a379fa930$export$2e2bcd8739ae039)(...args),\n setGraph: async ({ nodes: nodes, edges: edges })=>{\n const { patch: patch, createNodes: createNodes, createEdges: createEdges, setNodesAndEdges: setNodesAndEdges, nodes: activeNodes, edges: activeEdges } = get();\n setNodesAndEdges({\n nodes: [],\n edges: []\n });\n await createNodes(nodes);\n createEdges(edges);\n },\n clearGraph: ()=>{\n const { setGraph: setGraph } = get();\n setGraph({\n nodes: [],\n edges: []\n });\n },\n createNodes: async (nodes)=>{\n const { createNode: createNode } = get();\n await Promise.all(nodes.map((node)=>createNode(node)));\n },\n createNode: (nodeData)=>{\n const { addNode: addNode, nodesConfiguration: nodesConfiguration } = get();\n const { type: type, id: id, data: data } = nodeData;\n if (typeof type === \"undefined\") throw new Error(`node type is not defined for node: ${id}`);\n const node = {\n ...nodeData,\n data: {\n ...data,\n config: {\n ...nodesConfiguration[type]?.defaultConfig,\n ...data?.config\n }\n }\n };\n addNode(node);\n },\n removeNode: (node)=>get().removeNodes([\n node\n ]),\n removeNodes: (nodes)=>{\n const { edges: edges, nodes: currentNodes, onNodesDelete: onNodesDelete, removeEdges: removeEdges, removeNodesFromControlPanel: removeNodesFromControlPanel } = get();\n const parentNodeIds = nodes.map(({ id: id })=>id);\n const children = currentNodes.filter(({ parentNode: parentNode })=>parentNode && parentNodeIds.includes(parentNode));\n const resultingNodes = [\n ...nodes,\n ...children\n ];\n removeNodesFromControlPanel(resultingNodes);\n const connectedEdges = (0, $djR0r$getConnectedEdges)(resultingNodes, edges);\n removeEdges(connectedEdges);\n onNodesDelete(resultingNodes);\n const nodeIds = resultingNodes.map(({ id: id })=>id);\n set({\n nodes: currentNodes.filter(({ id: id })=>!nodeIds.includes(id))\n });\n },\n removeEdges: (edges)=>{\n const { edges: currentEdges, onEdgesDelete: onEdgesDelete } = get();\n const edgeIds = edges.map(({ id: id })=>id);\n onEdgesDelete(edges);\n set({\n edges: currentEdges.filter(({ id: id })=>!edgeIds.includes(id))\n });\n },\n createEdges: (newEdges)=>{\n const { patch: patch, edges: edges, setEdges: setEdges } = get();\n setEdges(newEdges);\n },\n onConnect: async (connection)=>{\n const { edges: edges, createEdges: createEdges } = get();\n const newEdges = (0, $djR0r$addEdge)(connection, edges);\n createEdges(newEdges);\n },\n onEdgesDelete: (edges)=>{\n const { patch: patch } = get();\n },\n onNodesDelete: async (nodes)=>{\n const { removeNodesFromControlPanel: removeNodesFromControlPanel, patch: patch } = get();\n removeNodesFromControlPanel(nodes);\n },\n plugins: [],\n setPlugins: async (plugins)=>{\n const { setNodeTypes: setNodeTypes } = get();\n set({\n plugins: plugins\n });\n const nodesConf = plugins.reduce((acc, plugin)=>{\n return {\n ...acc,\n ...plugin.components.reduce((subAcc, item)=>({\n ...subAcc,\n [item.type]: item\n }), {})\n };\n }, {});\n const nodeTypes = Object.keys(nodesConf).reduce((acc, type)=>{\n return {\n ...acc,\n [type]: nodesConf[type].node\n };\n }, {});\n const audioNodeTypes = Object.keys(nodesConf).reduce((acc, type)=>{\n return {\n ...acc,\n [type]: nodesConf[type].audioNode\n };\n }, {});\n (0, $059c7a7b96627b87$export$ff7e9ed3f5c574f2)(audioNodeTypes);\n setNodeTypes(nodeTypes);\n set(({ nodesConfiguration: nodesConfiguration })=>({\n nodesConfiguration: {\n ...nodesConfiguration,\n ...nodesConf\n }\n }));\n },\n nodesConfiguration: {},\n config: {\n showMinimap: false\n },\n setConfig: (changes)=>{\n set(({ config: config })=>({\n config: {\n ...config,\n ...changes\n }\n }));\n },\n getEditorState: ()=>{\n const { getNodesAndEdges: getNodesAndEdges, controlPanel: controlPanel, viewport: viewport } = get();\n return {\n ...getNodesAndEdges(),\n controlPanel: controlPanel,\n viewport: viewport\n };\n },\n setEditorState: async ({ nodes: nodes, edges: edges, controlPanel: controlPanel, viewport: viewport })=>{\n const { setGraph: setGraph } = get();\n await setGraph({\n nodes: nodes,\n edges: edges\n });\n // @TODO: remove this line once audio patch initialisation is reworked\n await new Promise((r)=>setTimeout(r, 1000));\n set({\n controlPanel: controlPanel,\n viewport: viewport\n });\n },\n isHelpShown: false,\n toggleHelp: ()=>{\n const { isHelpShown: showHelp } = get();\n set({\n isHelpShown: !showHelp\n });\n },\n copyBuffer: {\n nodes: [],\n edges: []\n },\n copy: (elements)=>{\n set({\n copyBuffer: elements\n });\n },\n copySelectedItems: ()=>{\n const { nodes: currentNodes, edges: currentEdges, copy: copy } = get();\n const nodes = currentNodes.filter(({ selected: selected })=>selected);\n const edges = currentEdges.filter(({ selected: selected })=>selected);\n if (!nodes.length) return;\n copy({\n nodes: nodes,\n edges: edges\n });\n },\n pasteBuffer: (x = 0, y = 0)=>{\n const { copyBuffer: copyBuffer, createNodes: createNodes, setEdges: setEdges, nodes: nodes, edges: edges } = get();\n const { nodes: nodesToCopy, edges: edgesToCopy } = copyBuffer;\n if (!nodesToCopy.length) return;\n set({\n nodes: nodes.map((node)=>({\n ...node,\n selected: false\n }))\n });\n const topLeftNode = nodesToCopy.reduce((acc, node)=>{\n if (!acc) return node;\n if (node.position.x < acc.position.x && node.position.y < acc.position.y) return node;\n return acc;\n });\n const xDelta = topLeftNode.position.x - x;\n const yDelta = topLeftNode.position.y - y;\n const { nodes: newNodes, mapping: mapping } = nodesToCopy.reduce((acc, node)=>{\n const newNodeId = (0, $5c30fde65a1f208b$export$2e2bcd8739ae039)(node);\n return {\n nodes: [\n ...acc.nodes,\n {\n ...node,\n id: newNodeId,\n position: {\n x: node.position.x - xDelta,\n y: node.position.y - yDelta\n },\n selected: true\n }\n ],\n mapping: {\n ...acc.mapping,\n [node.id]: newNodeId\n }\n };\n }, {\n nodes: [],\n mapping: {}\n });\n createNodes(newNodes);\n const newEdges = edgesToCopy.map((edge)=>{\n const source = mapping[edge.source] || edge.source;\n const target = mapping[edge.target] || edge.target;\n return {\n ...edge,\n id: edge.id.replace(edge.source, source).replace(edge.target, target),\n source: source,\n target: target,\n selected: true\n };\n });\n setEdges([\n ...edges.map((edge)=>({\n ...edge,\n selected: false\n })),\n ...newEdges\n ]);\n },\n getControlPanelNode: (node)=>{\n const { nodesConfiguration: nodesConfiguration } = get();\n const { type: type } = node;\n if (!type) return null;\n const controlPanelNode = nodesConfiguration[type]?.controlPanelNode;\n if (!controlPanelNode) {\n console.error(`could not find node for type ${type}`);\n return null;\n }\n return controlPanelNode;\n },\n controlPanel: {\n show: true,\n nodes: [],\n size: {\n width: 200,\n height: 100\n }\n },\n showControlPanel: ()=>set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n show: true\n }\n })),\n hideControlPanel: ()=>set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n show: false\n }\n })),\n addNodeToControlPanel: (node)=>{\n const { nodesConfiguration: nodesConfiguration } = get();\n const defaultConfig = node.type ? nodesConfiguration[node.type]?.defaultConfig : {};\n const { height: height } = defaultConfig?.size || {};\n const newNode = {\n id: node.id,\n ...height ? {\n height: height / (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).rowHeight\n } : {}\n };\n set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n nodes: [\n ...controlPanel.nodes,\n newNode\n ]\n }\n }));\n },\n removeNodeFromControlPanel: (node)=>get().removeNodesFromControlPanel([\n node\n ]),\n removeNodesFromControlPanel: (nodes)=>{\n const nodeIds = nodes.map(({ id: id })=>id);\n set(({ controlPanel: controlPanel })=>{\n const nodes = controlPanel.nodes.filter(({ id: id })=>!nodeIds.includes(id));\n return {\n controlPanel: {\n ...controlPanel,\n nodes: nodes\n }\n };\n });\n },\n setControlPanelNodes: (nodes)=>{\n set(({ controlPanel: controlPanel })=>{\n return {\n controlPanel: {\n ...controlPanel,\n nodes: nodes\n }\n };\n });\n },\n setControlPanelSize: (size)=>{\n set(({ controlPanel: controlPanel })=>{\n return {\n controlPanel: {\n ...controlPanel,\n size: size\n }\n };\n });\n },\n viewport: {\n x: 0,\n y: 0,\n zoom: 1\n },\n setViewport: (viewport)=>set({\n viewport: viewport\n })\n };\n};\nconst $6f5e1924a22d258c$var$useStore = (0, $djR0r$create)((0, $64d14d164a029007$export$2e2bcd8739ae039)((0, $15640845882b881f$export$2e2bcd8739ae039)($6f5e1924a22d258c$export$34c5bc865219488e)));\nvar $6f5e1924a22d258c$export$2e2bcd8739ae039 = $6f5e1924a22d258c$var$useStore;\n\n\n\nconst $de1eff52c6419df8$var$LEVA_COLOR_ACCENT2_BLUE = \"#007bff\";\nconst $de1eff52c6419df8$var$COLOR_GREEN_PRIMARY = \"#14df42\";\nconst $de1eff52c6419df8$var$COLOR_WHITE_PRIMARY = \"#ffffff\";\nconst $de1eff52c6419df8$var$colors = {\n elevation1: \"#292d39\",\n elevation2: \"#181c20\",\n elevation3: \"#373c4b\",\n accent1: \"#0066dc\",\n accent2: $de1eff52c6419df8$var$LEVA_COLOR_ACCENT2_BLUE,\n accent3: \"#3c93ff\",\n highlight1: \"#535760\",\n highlight2: \"#8c92a4\",\n highlight3: \"#fefefe\",\n vivid1: $de1eff52c6419df8$var$COLOR_GREEN_PRIMARY,\n whitePrimary: $de1eff52c6419df8$var$COLOR_WHITE_PRIMARY,\n error: \"#db5353\"\n};\nconst $de1eff52c6419df8$var$zIndex = {\n modal: 9998,\n controlPanel: 9999,\n resumeContextLayout: 10003\n};\nconst $de1eff52c6419df8$var$theme = {\n colors: $de1eff52c6419df8$var$colors,\n zIndex: $de1eff52c6419df8$var$zIndex\n};\nvar $de1eff52c6419df8$export$2e2bcd8739ae039 = $de1eff52c6419df8$var$theme;\n\n\n(0, $djR0r$injectGlobal)`\n .react-flow {\n .react-flow__pane {\n /* background: rgb(106 106 106); */\n /* background: \"white\"; */\n // background: #292d39;\n background: ${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.elevation3};\n }\n\n .react-flow__background {\n /* background: #efefef; */\n stroke: white;\n }\n\n .react-flow__node-default {\n background: #292d39;\n color: white;\n border: none;\n /* background: transparent; */\n }\n\n .react-flow__node {\n padding: 0;\n width: auto;\n }\n\n .react-flow__edge-path {\n stroke: ${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2};\n }\n\n .react-flow__node.selected {\n border: 1px solid ${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2};\n box-shadow: 0 0 0 0.5px #${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2};\n }\n\n .react-flow__node-default.selected, .react-flow__node-default.selected:hover {\n box-shadow: 0 0 0 0.5px #${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2};\n }\n\n /* .react-flow__minimap-mask {\n fill: ${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.elevation1}\n }\n\n .react-flow__minimap-node {\n fill:${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2}\n } */\n }\n\n`;\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $40266ad71a95dba8$var$useTheme = ()=>{\n return (0, $djR0r$useTheme)();\n};\nvar $40266ad71a95dba8$export$2e2bcd8739ae039 = $40266ad71a95dba8$var$useTheme;\n\n\n\n\n\n\nconst $ee2caa06ac02c5bc$export$ef9839ae55b8ba40 = (0, $djR0r$emotionstyled)((0, $djR0r$Item))``;\nconst $ee2caa06ac02c5bc$export$98eff9c5659394e3 = (0, $djR0r$emotionstyled)((0, $djR0r$Menu))`\n background: ${({ colors: colors })=>colors.elevation2};\n padding: 0;\n border-radius: 0;\n\n .react-contexify__item__content {\n color: ${({ colors: colors })=>colors.whitePrimary};\n }\n\n .react-contexify__separator {\n background-color: ${({ colors: colors })=>colors.elevation1};\n margin: 0;\n }\n`;\n\n\nconst $b2eaa5961e75d009$export$d4cd258d01c03112 = \"editor-edge-menu\";\nconst $b2eaa5961e75d009$export$8b2e4a15453bac1e = ()=>{\n const { show: show } = (0, $djR0r$useContextMenu)({\n id: $b2eaa5961e75d009$export$d4cd258d01c03112\n });\n const onContextMenu = (0, $djR0r$useCallback)((event, edge)=>{\n event.stopPropagation();\n show(event, {\n props: {\n edge: edge\n }\n });\n }, [\n show\n ]);\n return {\n onContextMenu: onContextMenu\n };\n};\nconst $b2eaa5961e75d009$var$EdgeContextMenu = ()=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const removeEdges = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.removeEdges);\n return (0, $djR0r$jsx)((0, $djR0r$Fragment), {\n children: (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$98eff9c5659394e3), {\n id: $b2eaa5961e75d009$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: (event)=>removeEdges([\n event.props.edge\n ]),\n children: \"Delete Edge (DEL)\"\n })\n })\n });\n};\nvar $b2eaa5961e75d009$export$2e2bcd8739ae039 = $b2eaa5961e75d009$var$EdgeContextMenu;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $96e3c18b52e89add$var$ModalOuter = (0, $djR0r$emotionstyled).div`\n position: fixed;\n z-index: ${({ theme: theme })=>theme.zIndex.modal};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: ${({ theme: theme })=>theme.colors.elevation3}cc;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\nconst $96e3c18b52e89add$var$ModalInner = (0, $djR0r$emotionstyled).div`\n background: ${({ theme: theme })=>theme.colors.elevation2};\n box-shadow: 1px 1px 1px 1px ${({ theme: theme })=>theme.colors.elevation1};\n color: white;\n width: 70%;\n height: 80%;\n overflow-y: scroll;\n position: relative;\n`;\nconst $96e3c18b52e89add$var$ModalCloser = (0, $djR0r$emotionstyled)((0, $djR0r$MdClose))`\n position: absolute;\n top: 0.2rem;\n right: 0.2rem;\n cursor: pointer;\n`;\nconst $96e3c18b52e89add$var$Modal = ({ children: children, onClose: onClose, ...props })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n (0, $djR0r$useEffect)(()=>{\n const escHandler = (event)=>{\n if (event.key === \"Escape\") onClose?.();\n };\n document.addEventListener(\"keydown\", escHandler);\n return ()=>{\n document.removeEventListener(\"keydown\", escHandler);\n };\n }, [\n onClose\n ]);\n return /*#__PURE__*/ (0, $djR0r$createPortal)((0, $djR0r$jsx)($96e3c18b52e89add$var$ModalOuter, {\n theme: theme,\n onClick: onClose,\n children: (0, $djR0r$jsxs)($96e3c18b52e89add$var$ModalInner, {\n ...props,\n onClick: (e)=>{\n e.stopPropagation();\n },\n theme: theme,\n children: [\n children,\n (0, $djR0r$jsx)($96e3c18b52e89add$var$ModalCloser, {\n theme: theme,\n onClick: onClose\n })\n ]\n })\n }), document.body);\n};\nvar $96e3c18b52e89add$export$2e2bcd8739ae039 = $96e3c18b52e89add$var$Modal;\n\n\n\n\n\n\n\nconst $7eaa077f1f9bb73b$var$InputWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n position: relative;\n`;\nconst $7eaa077f1f9bb73b$var$InputInner = (0, $djR0r$emotionstyled).input`\n padding-right: 2rem;\n padding-left: 0.3rem;\n width: 100%;\n appearance: textfield;\n font-size: inherit;\n background: none;\n border: none;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n appearance: textfield;\n cursor: auto;\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n border-radius: 0.1rem;\n height: 2rem;\n color: ${({ theme: theme })=>theme.colors.highlight2};\n\n &:focus,\n &:hover {\n box-shadow: 0 0 0 var(--leva-borderWidths-focus)\n ${({ theme: theme })=>theme.colors.accent2};\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin-right: 1rem;\n }\n`;\nconst $7eaa077f1f9bb73b$var$FiltersWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n flex-direction: column;\n padding: 0.6rem;\n gap: 0.6rem;\n border-right: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n min-width: 14rem;\n`;\nconst $7eaa077f1f9bb73b$var$PluginName = (0, $djR0r$emotionstyled).label`\n user-select: none;\n input {\n display: none;\n }\n input:checked + span {\n color: ${({ theme: theme })=>theme.colors.accent2};\n }\n &:hover {\n color: ${({ theme: theme })=>theme.colors.accent3};\n cursor: pointer;\n }\n`;\nconst $7eaa077f1f9bb73b$var$Filters = ({ onChange: onChange, value: value })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const plugins = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ plugins: plugins })=>plugins);\n const inputRef = (0, $djR0r$useRef)(null);\n (0, $djR0r$useEffect)(()=>{\n if (!inputRef.current) return;\n inputRef.current.focus();\n }, [\n inputRef\n ]);\n return (0, $djR0r$jsxs)($7eaa077f1f9bb73b$var$FiltersWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($7eaa077f1f9bb73b$var$InputWrapper, {\n children: (0, $djR0r$jsx)($7eaa077f1f9bb73b$var$InputInner, {\n ref: inputRef,\n theme: theme,\n value: value.search || \"\",\n placeholder: \"search...\",\n onChange: (event)=>onChange({\n ...value,\n search: event.target.value\n })\n })\n }),\n plugins.map(({ name: name, components: components }, index)=>{\n if (!name) return null;\n return (0, $djR0r$jsxs)($7eaa077f1f9bb73b$var$PluginName, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)(\"input\", {\n type: \"checkbox\",\n name: \"plugin\",\n value: name,\n checked: name === value.plugin,\n onChange: ()=>{\n onChange({\n ...value,\n plugin: name === value.plugin ? null : name\n });\n }\n }),\n (0, $djR0r$jsx)(\"span\", {\n children: name\n })\n ]\n }, index);\n })\n ]\n });\n};\nvar $7eaa077f1f9bb73b$export$2e2bcd8739ae039 = $7eaa077f1f9bb73b$var$Filters;\n\n\n\n\n\n\n\nconst $682a69da6ef2887d$var$PluginsWrapper = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n width: 100%;\n`);\nconst $682a69da6ef2887d$var$PluginWrapper = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n`);\nconst $682a69da6ef2887d$var$NodesList = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).ul`\n list-style: none;\n margin: 0;\n padding: 0;\n padding-bottom: 10px;\n columns: 2;\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n border-radius: 4px;\n margin-bottom: 0.5rem;\n &:hover {\n border-color: ${({ theme: theme })=>theme.colors.accent2};\n cursor: pointer;\n }\n }\n`);\nconst $682a69da6ef2887d$var$NodeTitle = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`);\nconst $682a69da6ef2887d$var$NodeDescription = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n color: ${({ theme: theme })=>theme.colors.highlight2};\n font-size: 12px;\n`);\nconst $682a69da6ef2887d$var$PluginHeader = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div``);\nconst $682a69da6ef2887d$var$PluginTitle = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n font-size: 1.1rem;\n padding: 0.25rem 0;\n color: ${({ theme: theme })=>theme.colors.highlight3};\n`);\nconst $682a69da6ef2887d$var$PluginDescription = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n color: ${({ theme: theme })=>theme.colors.highlight2};\n font-size: 12px;\n`);\nconst $682a69da6ef2887d$var$Plugins = ({ onComponentClick: onComponentClick, filters: { plugin: plugin, search: search } })=>{\n const plugins = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ plugins: plugins })=>plugins);\n const pluginsGroup = (0, $djR0r$useMemo)(()=>{\n if (!plugin) return plugins;\n return plugins.filter(({ name: name })=>name === plugin);\n // return plugins.filter(({ type }) => type === )\n }, [\n plugins,\n plugin\n ]);\n const filteredPlugins = (0, $djR0r$useMemo)(()=>{\n if (!search) return pluginsGroup;\n return pluginsGroup.map((plugin)=>({\n ...plugin,\n components: plugin.components.filter(({ type: type, name: name })=>type.toLocaleLowerCase().includes(search.toLocaleLowerCase()) || name?.toLocaleLowerCase().includes(search.toLocaleLowerCase()))\n }));\n }, [\n pluginsGroup,\n search\n ]);\n return (0, $djR0r$jsx)($682a69da6ef2887d$var$PluginsWrapper, {\n children: filteredPlugins.map(({ name: name, description: description, components: components }, index)=>{\n if (!components.length) return null;\n return (0, $djR0r$jsxs)($682a69da6ef2887d$var$PluginWrapper, {\n children: [\n (0, $djR0r$jsxs)($682a69da6ef2887d$var$PluginHeader, {\n children: [\n (0, $djR0r$jsx)($682a69da6ef2887d$var$PluginTitle, {\n children: name\n }),\n (0, $djR0r$jsx)($682a69da6ef2887d$var$PluginDescription, {\n children: description\n })\n ]\n }),\n (0, $djR0r$jsx)($682a69da6ef2887d$var$NodesList, {\n children: components.sort((a, b)=>a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1).map((component, idx)=>(0, $djR0r$jsxs)(\"li\", {\n onClick: ()=>onComponentClick(component),\n children: [\n (0, $djR0r$jsx)($682a69da6ef2887d$var$NodeTitle, {\n children: component.name || component.type\n }),\n component.description && (0, $djR0r$jsx)($682a69da6ef2887d$var$NodeDescription, {\n children: component.description\n })\n ]\n }, idx))\n })\n ]\n }, index);\n })\n });\n};\nvar $682a69da6ef2887d$export$2e2bcd8739ae039 = $682a69da6ef2887d$var$Plugins;\n\n\nconst $881ab8dac829e111$var$AddNodeWrapper = (0, $djR0r$emotionstyled).div`\n height: 100%;\n width: 100%;\n display: flex;\n gap: 1rem;\n`;\nconst $881ab8dac829e111$var$PluginsPanel = (0, $djR0r$emotionstyled).div`\n flex-grow: 1;\n height: 100%;\n overflow-y: scroll;\n`;\nconst $881ab8dac829e111$var$AddNode = ({ isOpen: isOpen, closeMenu: closeMenu, mousePosition: mousePosition })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const { screenToFlowPosition: screenToFlowPosition } = (0, $djR0r$useReactFlow)();\n const { createNode: createNode } = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ createNode: createNode })=>({\n createNode: createNode\n }));\n const [filtersState, setFiltersState] = (0, $djR0r$useState)({});\n const onComponentClick = (0, $djR0r$useCallback)(({ type: type })=>{\n const { x: x, y: y } = screenToFlowPosition(mousePosition);\n const newNode = {\n //@TODO: generate node id in `createNode` function\n id: `${type}-${+new Date()}`,\n type: type,\n data: {\n label: type\n },\n position: {\n x: x,\n y: y\n },\n targetPosition: (0, $djR0r$Position).Left,\n sourcePosition: (0, $djR0r$Position).Right\n };\n createNode(newNode);\n closeMenu();\n }, [\n mousePosition,\n screenToFlowPosition,\n createNode,\n closeMenu,\n mousePosition\n ]);\n return isOpen ? (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: ()=>{\n closeMenu();\n setFiltersState({});\n },\n children: (0, $djR0r$jsxs)($881ab8dac829e111$var$AddNodeWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)((0, $7eaa077f1f9bb73b$export$2e2bcd8739ae039), {\n onChange: setFiltersState,\n value: filtersState\n }),\n (0, $djR0r$jsx)($881ab8dac829e111$var$PluginsPanel, {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $682a69da6ef2887d$export$2e2bcd8739ae039), {\n filters: filtersState,\n onComponentClick: (component)=>{\n onComponentClick(component);\n setFiltersState({});\n }\n })\n })\n ]\n })\n }) : null;\n};\nvar $881ab8dac829e111$export$2e2bcd8739ae039 = $881ab8dac829e111$var$AddNode;\n\n\n\n\n\n\n\n\n\n\nconst $7f7ac6f44564377e$var$UploadPatchWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme: theme })=>theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\nconst $7f7ac6f44564377e$var$DropZoneInner = (0, $djR0r$emotionstyled).div`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\nconst $7f7ac6f44564377e$var$FileUploadIcon = (0, $djR0r$emotionstyled)((0, $djR0r$FaFileUpload))`\n width: 100%;\n height: 8rem;\n`;\nconst $7f7ac6f44564377e$var$FileUploadMessage = (0, $djR0r$emotionstyled).div`\n font-size: 2rem;\n`;\nconst $7f7ac6f44564377e$var$UploadPatch = ({ isOpen: isOpen, closeMenu: closeMenu })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const setGraph = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ setGraph: setGraph })=>setGraph);\n const setEditorState = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setEditorState);\n const fileInputRef = (0, $djR0r$useRef)(null);\n const uploadFile = (0, $djR0r$useCallback)((files)=>{\n const [file] = files || [];\n file.text().then(JSON.parse).then((editorState)=>{\n setEditorState(editorState);\n closeMenu();\n }).catch(console.error);\n }, [\n setGraph,\n closeMenu\n ]);\n const onTargetClick = ()=>{\n fileInputRef.current?.click();\n };\n return isOpen ? (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: closeMenu,\n children: (0, $djR0r$jsxs)($7f7ac6f44564377e$var$UploadPatchWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)(\"input\", {\n onChange: ({ target: { files: files } })=>uploadFile(files),\n ref: fileInputRef,\n type: \"file\",\n className: \"hidden\",\n style: {\n display: \"none\"\n },\n accept: \".json\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$FileDrop), {\n className: \"drop-zone-wrapper\",\n targetClassName: \"drop-zone\",\n draggingOverTargetClassName: \"drop-zone-drag-over\",\n onTargetClick: onTargetClick,\n onDrop: (files)=>uploadFile(files),\n children: (0, $djR0r$jsxs)($7f7ac6f44564377e$var$DropZoneInner, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($7f7ac6f44564377e$var$FileUploadIcon, {}),\n (0, $djR0r$jsx)($7f7ac6f44564377e$var$FileUploadMessage, {\n children: \"click or drop file here\"\n })\n ]\n })\n })\n ]\n })\n }) : null;\n};\nvar $7f7ac6f44564377e$export$2e2bcd8739ae039 = $7f7ac6f44564377e$var$UploadPatch;\n\n\n\n\n\n\n\n\n\n\nconst $5da3065ea9b7ce79$var$UploadProjectWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme: theme })=>theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\nconst $5da3065ea9b7ce79$var$DropZoneInner = (0, $djR0r$emotionstyled).div`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\nconst $5da3065ea9b7ce79$var$FileUploadIcon = (0, $djR0r$emotionstyled)((0, $djR0r$FaFileUpload))`\n width: 100%;\n height: 8rem;\n`;\nconst $5da3065ea9b7ce79$var$FileUploadMessage = (0, $djR0r$emotionstyled).div`\n font-size: 2rem;\n`;\n// @TODO: unify with upload file\nconst $5da3065ea9b7ce79$var$UploadProject = ({ isOpen: isOpen, closeMenu: closeMenu })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const setProject = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setProject);\n const fileInputRef = (0, $djR0r$useRef)(null);\n const uploadFile = (0, $djR0r$useCallback)((files)=>{\n const [file] = files || [];\n file.text().then(JSON.parse).then((projectState)=>{\n setProject(projectState);\n closeMenu();\n }).catch(console.error);\n }, [\n setProject,\n closeMenu\n ]);\n const onTargetClick = ()=>{\n fileInputRef.current?.click();\n };\n return isOpen ? (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: closeMenu,\n children: (0, $djR0r$jsxs)($5da3065ea9b7ce79$var$UploadProjectWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)(\"input\", {\n onChange: ({ target: { files: files } })=>uploadFile(files),\n ref: fileInputRef,\n type: \"file\",\n className: \"hidden\",\n style: {\n display: \"none\"\n },\n accept: \".json\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$FileDrop), {\n className: \"drop-zone-wrapper\",\n targetClassName: \"drop-zone\",\n draggingOverTargetClassName: \"drop-zone-drag-over\",\n onTargetClick: onTargetClick,\n onDrop: (files)=>uploadFile(files),\n children: (0, $djR0r$jsxs)($5da3065ea9b7ce79$var$DropZoneInner, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($5da3065ea9b7ce79$var$FileUploadIcon, {}),\n (0, $djR0r$jsx)($5da3065ea9b7ce79$var$FileUploadMessage, {\n children: \"click or drop file here\"\n })\n ]\n })\n })\n ]\n })\n }) : null;\n};\nvar $5da3065ea9b7ce79$export$2e2bcd8739ae039 = $5da3065ea9b7ce79$var$UploadProject;\n\n\n\nconst $28ba16bd16f671c0$export$d4cd258d01c03112 = \"editor-menu\";\nconst $28ba16bd16f671c0$export$59ce2a6808e35a29 = ()=>{\n const { show: show } = (0, $djR0r$useContextMenu)({\n id: $28ba16bd16f671c0$export$d4cd258d01c03112\n });\n return {\n onContextMenu: show\n };\n};\nconst $28ba16bd16f671c0$var$EditorContextMenu = ({ editorContextMenu: editorContextMenu = [] })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const [mousePosition, setMousePosition] = (0, $djR0r$useState)({\n x: 0,\n y: 0\n });\n const [showAddNode, setShowAddNode] = (0, $djR0r$useState)(false);\n const [showUploadPatch, setShowUploadPatch] = (0, $djR0r$useState)(false);\n const [showUploadProject, setShowUploadProject] = (0, $djR0r$useState)(false);\n const addNodeHandler = (0, $djR0r$useCallback)((x, y)=>{\n setMousePosition({\n x: x,\n y: y\n });\n setShowAddNode(true);\n }, [\n setShowAddNode\n ]);\n const pasteBuffer = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.pasteBuffer);\n const { screenToFlowPosition: screenToFlowPosition } = (0, $djR0r$useReactFlow)();\n const pasteBufferHandler = (0, $djR0r$useCallback)((mousePosition)=>{\n const { x: x, y: y } = screenToFlowPosition(mousePosition);\n pasteBuffer(x, y);\n }, [\n setShowAddNode,\n screenToFlowPosition\n ]);\n const clearGraph = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ clearGraph: clearGraph })=>clearGraph);\n const getEditorState = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.getEditorState);\n const getProject = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.getProject);\n const deleteAllHandler = (0, $djR0r$useCallback)(()=>{\n clearGraph();\n }, [\n clearGraph\n ]);\n const toggleHelp = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n const historyBack = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.history.back);\n const historyForward = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.history.forward);\n const historyPointer = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.history.pointer);\n const historyBuffer = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.history.buffer);\n const copySelectedItems = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.copySelectedItems);\n const nodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodes);\n const selectedNodes = (0, $djR0r$useMemo)(()=>nodes.filter(({ selected: selected })=>selected), [\n nodes\n ]);\n const currentCopyBuffer = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.copyBuffer);\n const reactFlowInstance = (0, $djR0r$useReactFlow)();\n const downloadPatchHandler = (0, $djR0r$useCallback)(()=>{\n const fileName = \"web-noise-patch.json\";\n const editorState = getEditorState();\n const data = {\n ...editorState\n };\n (0, $djR0r$jsfiledownload)(JSON.stringify(data, null, 2), fileName);\n }, [\n getEditorState,\n reactFlowInstance\n ]);\n const downloadProjectHandler = (0, $djR0r$useCallback)(()=>{\n const fileName = \"web-noise-project.json\";\n const projectState = getProject();\n const data = {\n ...projectState\n };\n (0, $djR0r$jsfiledownload)(JSON.stringify(data, null, 2), fileName);\n }, [\n getEditorState,\n reactFlowInstance\n ]);\n (0, $djR0r$useEffect)(()=>{\n (0, $djR0r$hotkeysjs)(\"command+shift+a\", ()=>{\n addNodeHandler(200, 50);\n return false;\n });\n //@TODO: find more elegant way to handle ?\n (0, $djR0r$hotkeysjs)(\"shift+/\", ()=>{\n toggleHelp();\n return false;\n });\n (0, $djR0r$hotkeysjs)(\"command+z\", ()=>{\n historyBack();\n return false;\n });\n (0, $djR0r$hotkeysjs)(\"command+shift+z\", ()=>{\n historyForward();\n return false;\n });\n (0, $djR0r$hotkeysjs)(\"command+c\", ()=>{\n copySelectedItems();\n return false;\n });\n (0, $djR0r$hotkeysjs)(\"command+v\", ()=>{\n pasteBufferHandler({\n x: 200,\n y: 50\n });\n return false;\n });\n return ()=>{\n (0, $djR0r$hotkeysjs).unbind();\n };\n }, [\n addNodeHandler,\n pasteBufferHandler\n ]);\n return (0, $djR0r$jsxs)((0, $djR0r$Fragment), {\n children: [\n (0, $djR0r$jsx)((0, $881ab8dac829e111$export$2e2bcd8739ae039), {\n isOpen: showAddNode,\n closeMenu: ()=>setShowAddNode(false),\n mousePosition: mousePosition\n }),\n (0, $djR0r$jsx)((0, $7f7ac6f44564377e$export$2e2bcd8739ae039), {\n isOpen: showUploadPatch,\n closeMenu: ()=>setShowUploadPatch(false)\n }),\n (0, $djR0r$jsx)((0, $5da3065ea9b7ce79$export$2e2bcd8739ae039), {\n isOpen: showUploadProject,\n closeMenu: ()=>setShowUploadProject(false)\n }),\n (0, $djR0r$jsxs)((0, $ee2caa06ac02c5bc$export$98eff9c5659394e3), {\n id: $28ba16bd16f671c0$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: [\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: ({ triggerEvent: { clientX: clientX, clientY: clientY } })=>addNodeHandler(clientX, clientY),\n children: \"Add Node (\\u2318+\\u21E7+A)\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: deleteAllHandler,\n children: \"Delete All\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: downloadPatchHandler,\n children: \"Download patch\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: ()=>setShowUploadPatch(true),\n children: \"Upload patch\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: downloadProjectHandler,\n children: \"Download project\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: ()=>setShowUploadProject(true),\n children: \"Upload project\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n disabled: historyPointer === 0,\n onClick: historyBack,\n children: \"Undo (\\u2318+z)\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n disabled: historyPointer === historyBuffer.length,\n onClick: historyForward,\n children: \"Redo (\\u2318+\\u21E7+Z)\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n disabled: !selectedNodes.length,\n onClick: copySelectedItems,\n children: \"Copy Selected (\\u2318+c)\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n disabled: !currentCopyBuffer.nodes.length,\n onClick: ({ triggerEvent: { clientX: x, clientY: y } })=>pasteBufferHandler({\n x: x,\n y: y\n }),\n children: \"Paste (\\u2318+v)\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n editorContextMenu.map((item, index)=>(0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n children: item\n }, index)),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: toggleHelp,\n children: \"Help (\\u21E7+?)\"\n })\n ]\n })\n ]\n });\n};\nvar $28ba16bd16f671c0$export$2e2bcd8739ae039 = $28ba16bd16f671c0$var$EditorContextMenu;\n\n\n\n\n\n\n\n\n\nconst $0ffe51df9638a254$export$d4cd258d01c03112 = \"editor-node-menu\";\nconst $0ffe51df9638a254$export$cbbbfb9fb15f3780 = ()=>{\n const { show: show } = (0, $djR0r$useContextMenu)({\n id: $0ffe51df9638a254$export$d4cd258d01c03112\n });\n const onContextMenu = (0, $djR0r$useCallback)((event, node)=>{\n event.stopPropagation();\n show(event, {\n props: {\n node: node\n }\n });\n }, []);\n return {\n onContextMenu: onContextMenu\n };\n};\nconst $0ffe51df9638a254$var$NodeContextMenu = (args)=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const removeNodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.removeNodes);\n const addNodeToControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.addNodeToControlPanel);\n const removeNodeFromControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.removeNodeFromControlPanel);\n const copy = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.copy);\n const nodesConfiguration = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration);\n const controlPanelNodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.controlPanel.nodes);\n const isOnControlPanel = (0, $djR0r$useCallback)(({ props: props })=>{\n if (!props?.node.type) return false;\n return !!controlPanelNodes.find(({ id: id })=>id === props.node.id);\n }, [\n controlPanelNodes\n ]);\n const hasControlPanelNode = (0, $djR0r$useCallback)(({ props: props })=>{\n if (!props?.node.type) return false;\n const nodeConfiguration = nodesConfiguration[props.node.type];\n return !!nodeConfiguration?.controlPanelNode;\n }, [\n nodesConfiguration\n ]);\n return (0, $djR0r$jsx)((0, $djR0r$Fragment), {\n children: (0, $djR0r$jsxs)((0, $ee2caa06ac02c5bc$export$98eff9c5659394e3), {\n id: $0ffe51df9638a254$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: [\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: (event)=>removeNodes([\n event.props.node\n ]),\n children: \"Delete Node (DEL)\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n hidden: (...args)=>!hasControlPanelNode(...args) || isOnControlPanel(...args),\n onClick: (event)=>addNodeToControlPanel(event.props.node),\n children: \"Add To Control Panel\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n hidden: (...args)=>!hasControlPanelNode(...args) || !isOnControlPanel(...args),\n onClick: (event)=>removeNodeFromControlPanel(event.props.node),\n children: \"Remove From Control Panel\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: (event)=>copy({\n nodes: [\n event.props.node\n ],\n edges: []\n }),\n children: \"Copy (\\u2318+c)\"\n })\n ]\n })\n });\n};\nvar $0ffe51df9638a254$export$2e2bcd8739ae039 = $0ffe51df9638a254$var$NodeContextMenu;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $607523634e2ef7fa$var$useAudioNode = (id)=>{\n const patch = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ patch: patch })=>patch);\n return patch.audioNodes.get(id);\n};\nvar $607523634e2ef7fa$export$2e2bcd8739ae039 = $607523634e2ef7fa$var$useAudioNode;\n\n\n\n\nconst $c2be4ce66a537e42$var$useNode = (id)=>{\n const updateNodeData = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ updateNodeData: updateNodeData })=>updateNodeData);\n const updateNodeValues = (0, $djR0r$useCallback)((values)=>updateNodeData(id, {\n values: values\n }), [\n id,\n updateNodeData\n ]);\n const updateNodeConfig = (0, $djR0r$useCallback)((config)=>updateNodeData(id, {\n config: config\n }), [\n id,\n updateNodeData\n ]);\n const updateNodeLabel = (0, $djR0r$useCallback)((label)=>updateNodeData(id, {\n label: label\n }), [\n id,\n updateNodeData\n ]);\n return {\n updateNodeValues: updateNodeValues,\n updateNodeConfig: updateNodeConfig,\n updateNodeLabel: updateNodeLabel\n };\n};\nvar $c2be4ce66a537e42$export$2e2bcd8739ae039 = $c2be4ce66a537e42$var$useNode;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $61078804f94ec8d6$export$5abe11f802ebd1f2 = (0, $djR0r$emotionstyled).input`\n width: 100%;\n background: none;\n border: none;\n text-align: center;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n\n &:focus {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-within {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-vissible {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:not([readonly]):focus {\n color: #fff;\n appearance: none;\n cursor: auto;\n background-color: var(--leva-colors-elevation2);\n padding: 0.3rem;\n border-radius: 0.2rem;\n }\n`;\nconst $61078804f94ec8d6$var$EditableLabel = ({ onChange: onChange, value: value = \"\", className: className })=>{\n const labelInputRef = (0, $djR0r$useRef)(null);\n const [labelEditMode, setLabelEditMode] = (0, $djR0r$useState)(false);\n const editNodeLabel = (0, $djR0r$useCallback)((event)=>{\n //@ts-ignore\n event.target?.select();\n setLabelEditMode(true);\n }, [\n setLabelEditMode\n ]);\n const exitEditMode = (0, $djR0r$useCallback)(()=>{\n window.getSelection()?.collapseToEnd();\n setLabelEditMode(false);\n }, [\n setLabelEditMode\n ]);\n const saveNodeLabel = (0, $djR0r$useCallback)(()=>{\n exitEditMode();\n if (labelInputRef.current) onChange(labelInputRef.current.value);\n }, [\n labelInputRef,\n exitEditMode,\n onChange\n ]);\n const cancelNodeLabelEdit = (0, $djR0r$useCallback)(()=>{\n exitEditMode();\n if (labelInputRef.current && value) labelInputRef.current.value = value;\n }, [\n labelInputRef,\n exitEditMode,\n value\n ]);\n (0, $djR0r$useEffect)(()=>{\n if (!labelInputRef.current) return;\n labelInputRef.current.value = value;\n }, [\n value,\n labelInputRef\n ]);\n return (0, $djR0r$jsx)($61078804f94ec8d6$export$5abe11f802ebd1f2, {\n ref: labelInputRef,\n type: \"text\",\n readOnly: !labelEditMode,\n onDoubleClick: (event)=>editNodeLabel(event),\n onBlur: saveNodeLabel,\n onKeyDown: (event)=>{\n switch(event.key){\n case \"Escape\":\n cancelNodeLabelEdit();\n break;\n case \"Enter\":\n saveNodeLabel();\n break;\n }\n },\n className: className\n });\n};\nvar $61078804f94ec8d6$export$2e2bcd8739ae039 = $61078804f94ec8d6$var$EditableLabel;\n\n\n\n\n\n\n\n\n\nconst $de6d95f0aff74a75$var$NodeInfoWrapper = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n height: 100%;\n width: 100%;\n overflow: scroll;\n padding: 0.6rem;\n box-sizing: border-box;\n\n hr {\n border: none;\n border-bottom: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n }\n\n code {\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n color: ${({ theme: theme })=>theme.colors.highlight3};\n font-family:\n source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n }\n\n pre {\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n padding: 0.2rem 0.3rem;\n border-radius: 1px;\n }\n\n a {\n color: ${({ theme: theme })=>theme.colors.accent1};\n }\n`);\nconst $de6d95f0aff74a75$var$useNodeManifest = (type)=>{\n const data = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration[type]);\n return data;\n};\nconst $de6d95f0aff74a75$var$NodeInfoModal = ({ isOpen: isOpen, onClose: onClose, type: nodeType, node: node })=>{\n const { info: info, portsDescription: portsDescription } = $de6d95f0aff74a75$var$useNodeManifest(nodeType);\n const portsInfo = (0, $djR0r$useMemo)(()=>{\n const parts = [];\n const inputPorts = node.inputs;\n if (inputPorts) {\n parts.push(`## Inputs`);\n for(const portName in inputPorts){\n const port = inputPorts[portName];\n parts.push(`### *${portName}*`);\n const description = portsDescription?.inputs?.[portName];\n if (description) parts.push(description);\n if (Array.isArray(port.type)) parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n else parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n if (port.range) parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n if (port.defaultValue !== undefined) parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n const outputPorts = node.outputs;\n if (outputPorts) {\n parts.push(`## Outputs`);\n for(const portName in outputPorts){\n const port = outputPorts[portName];\n parts.push(`### *${portName}*`);\n const description = portsDescription?.outputs?.[portName];\n if (description) parts.push(description);\n if (Array.isArray(port.type)) parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n else parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n if (port.range) parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n if (port.defaultValue !== undefined) parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n return parts.join(\"\\n\\n\");\n }, [\n node,\n portsDescription\n ]);\n const combinedInfo = (info || \"\") + \"\\n\\n\" + portsInfo;\n return isOpen ? (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: onClose,\n children: (0, $djR0r$jsx)($de6d95f0aff74a75$var$NodeInfoWrapper, {\n dangerouslySetInnerHTML: {\n __html: (0, $djR0r$marked)(combinedInfo || \"\")\n }\n })\n }) : null;\n};\nvar $de6d95f0aff74a75$export$2e2bcd8739ae039 = $de6d95f0aff74a75$var$NodeInfoModal;\n\n\nconst $8d34719b9811e505$var$NodeWrapper = (0, $djR0r$emotionstyled).div`\n background-color: var(--leva-colors-elevation1);\n`;\nconst $8d34719b9811e505$var$NodeLoaderWrapper = (0, $djR0r$emotionstyled)($8d34719b9811e505$var$NodeWrapper)`\n padding: 2rem 5rem;\n`;\nconst $8d34719b9811e505$var$NodeErrorWrapper = (0, $djR0r$emotionstyled)($8d34719b9811e505$var$NodeWrapper)`\n padding: 1rem 2rem;\n`;\nconst $8d34719b9811e505$var$SettingsIconWrapper = (0, $djR0r$emotionstyled)((0, $djR0r$MdSettings))`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\nconst $8d34719b9811e505$var$InfoIconWrapper = (0, $djR0r$emotionstyled)((0, $djR0r$MdInfoOutline))`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\nconst $8d34719b9811e505$var$Section = (0, $djR0r$emotionstyled).div`\n position: relative;\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n background-color: var(--leva-colors-elevation1);\n`;\nconst $8d34719b9811e505$export$1bdb8f2d1fe25c22 = (0, $djR0r$emotionstyled)($8d34719b9811e505$var$Section)`\n display: flex;\n height: var(--leva-sizes-titleBarHeight);\n touch-action: none;\n align-items: center;\n justify-content: center;\n flex: 1 1 0%;\n color: var(--leva-colors-highlight1);\n padding: 0 0.4rem;\n gap: 0.3rem;\n`;\nconst $8d34719b9811e505$export$bfd3bd1fa283e3c6 = (0, $djR0r$emotionstyled)($8d34719b9811e505$var$Section)(({ theme: theme })=>`\n display: grid;\n grid-template-areas: \"inputs outputs\";\n background: ${theme.colors.elevation2};\n border-bottom: 1px solid ${theme.colors.elevation1};\n color: ${theme.colors.highlight3};\n font-size: 0.6rem;\n`);\nconst $8d34719b9811e505$export$f1afba0ff9ea1277 = (0, $djR0r$emotionstyled).div`\n grid-area: inputs;\n text-align: left;\n`;\nconst $8d34719b9811e505$export$af4f9b41fc32ed9e = (0, $djR0r$emotionstyled).div`\n grid-area: outputs;\n text-align: right;\n`;\nconst $8d34719b9811e505$export$a2d375858cc72119 = (0, $djR0r$emotionstyled).div`\n position: relative;\n padding: 5px 10px;\n`;\nconst $8d34719b9811e505$var$portColors = {\n [(0, $9738c58e5420c085$export$b0b7b95ee465c83c).Audio]: \"#4ade80\",\n [(0, $9738c58e5420c085$export$b0b7b95ee465c83c).Gate]: \"#c084fc\",\n [(0, $9738c58e5420c085$export$b0b7b95ee465c83c).Number]: \"#38bdf8\",\n [(0, $9738c58e5420c085$export$b0b7b95ee465c83c).Any]: \"#fb923c\"\n};\nconst $8d34719b9811e505$var$StyledHandle = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)((0, $djR0r$Handle), {\n shouldForwardProp: (prop)=>prop !== \"portType\"\n})`\n --port-color: ${(props)=>{\n if (!props.portType) return props.theme.colors.highlight2;\n if (Array.isArray(props.portType)) {\n const colors = props.portType.map((type)=>$8d34719b9811e505$var$portColors[type]);\n return `linear-gradient(0.25turn, ${colors.join(\", \")});`;\n } else return $8d34719b9811e505$var$portColors[props.portType];\n}};\n border-color: var(--port-color);\n background: var(--port-color);\n box-shadow: 0px 0px 0px 1px ${({ theme: theme })=>theme.colors.elevation2} inset;\n`);\nconst $8d34719b9811e505$var$StyledInputHandle = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)($8d34719b9811e505$var$StyledHandle)`\n left: -3px;\n`);\nconst $8d34719b9811e505$export$9ea0feffc20ee81 = ({ ...props })=>(0, $djR0r$jsx)($8d34719b9811e505$var$StyledInputHandle, {\n ...props,\n type: \"target\",\n position: (0, $djR0r$Position).Left\n });\nconst $8d34719b9811e505$export$222539e2a2fac4e0 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)($8d34719b9811e505$var$StyledHandle)`\n right: -3px;\n`);\nconst $8d34719b9811e505$export$496e5e1ee1696f64 = (props)=>(0, $djR0r$jsx)($8d34719b9811e505$export$222539e2a2fac4e0, {\n ...props,\n type: \"source\",\n position: (0, $djR0r$Position).Right\n });\nconst $8d34719b9811e505$export$7e0b3af1e60a3273 = ({ className: className, ...props })=>(0, $djR0r$jsx)($8d34719b9811e505$export$1bdb8f2d1fe25c22, {\n ...props,\n className: [\n className,\n (0, $9738c58e5420c085$export$956b3cf15d7c363)\n ].join(\" \")\n });\nconst $8d34719b9811e505$var$useNodeManifest = (type)=>{\n const data = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration[type]);\n return data;\n};\nconst $8d34719b9811e505$var$useConfigNode = (type)=>{\n const { configNode: ConfigNode } = $8d34719b9811e505$var$useNodeManifest(type);\n return {\n ConfigNode: ConfigNode\n };\n};\nconst $8d34719b9811e505$export$361064385d50ec44 = (props)=>{\n const { id: id, children: children, selected: selected, ...rest } = props;\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const getNode = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ getNode: getNode })=>getNode);\n const nodesConfiguration = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration);\n const [isInfoModalShown, setIsInfoModalShown] = (0, $djR0r$useState)(false);\n const { info: info } = $8d34719b9811e505$var$useNodeManifest(props.type);\n const isResizeable = (0, $djR0r$useMemo)(()=>nodesConfiguration[props.type].resizable ?? false, [\n nodesConfiguration,\n props.type\n ]);\n const { updateNodeLabel: updateNodeLabel, updateNodeConfig: updateNodeConfig } = (0, $c2be4ce66a537e42$export$2e2bcd8739ae039)(id);\n const { data: data } = getNode(id) || {};\n const audioNode = (0, $607523634e2ef7fa$export$2e2bcd8739ae039)(id);\n const { ConfigNode: ConfigNode } = $8d34719b9811e505$var$useConfigNode(rest.type);\n const [configMode, setShowConfigMode] = (0, $djR0r$useState)(false);\n if (!audioNode) return (0, $djR0r$jsx)($8d34719b9811e505$var$NodeLoaderWrapper, {\n className: (0, $9738c58e5420c085$export$956b3cf15d7c363),\n children: \"can't find audio node\"\n });\n if (audioNode.loading) return (0, $djR0r$jsx)($8d34719b9811e505$var$NodeLoaderWrapper, {\n className: (0, $9738c58e5420c085$export$956b3cf15d7c363),\n children: \"loading\"\n });\n if (audioNode.error) return (0, $djR0r$jsxs)($8d34719b9811e505$var$NodeErrorWrapper, {\n className: (0, $9738c58e5420c085$export$956b3cf15d7c363),\n children: [\n \"error: \",\n audioNode.error.toString()\n ]\n });\n if (!audioNode.node) return (0, $djR0r$jsx)($8d34719b9811e505$var$NodeLoaderWrapper, {\n className: (0, $9738c58e5420c085$export$956b3cf15d7c363),\n children: \"can't find audio node\"\n });\n const size = data?.config?.size;\n const { node: { inputs: inputs, outputs: outputs } } = audioNode;\n return (0, $djR0r$jsxs)($8d34719b9811e505$var$NodeWrapper, {\n children: [\n (0, $djR0r$jsxs)($8d34719b9811e505$export$7e0b3af1e60a3273, {\n children: [\n info && (0, $djR0r$jsx)($8d34719b9811e505$var$InfoIconWrapper, {\n onClickCapture: ()=>setIsInfoModalShown(true)\n }),\n (0, $djR0r$jsx)((0, $61078804f94ec8d6$export$2e2bcd8739ae039), {\n value: data?.label ?? \"No Name\",\n onChange: updateNodeLabel\n }),\n ConfigNode && (0, $djR0r$jsx)($8d34719b9811e505$var$SettingsIconWrapper, {\n onClickCapture: ()=>setShowConfigMode((isShown)=>!isShown)\n })\n ]\n }),\n (0, $djR0r$jsxs)($8d34719b9811e505$export$bfd3bd1fa283e3c6, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($8d34719b9811e505$export$f1afba0ff9ea1277, {\n children: inputs ? Object.keys(inputs).map((key, index)=>(0, $djR0r$jsxs)($8d34719b9811e505$export$a2d375858cc72119, {\n children: [\n (0, $djR0r$jsx)($8d34719b9811e505$export$9ea0feffc20ee81, {\n id: key,\n portType: inputs[key].type\n }),\n (0, $djR0r$jsx)(\"span\", {\n children: key\n })\n ]\n }, index)) : null\n }),\n (0, $djR0r$jsx)($8d34719b9811e505$export$af4f9b41fc32ed9e, {\n children: outputs ? Object.keys(outputs).map((key, index)=>(0, $djR0r$jsxs)($8d34719b9811e505$export$a2d375858cc72119, {\n children: [\n (0, $djR0r$jsx)($8d34719b9811e505$export$496e5e1ee1696f64, {\n id: key,\n portType: outputs[key].type\n }),\n (0, $djR0r$jsx)(\"span\", {\n children: key\n })\n ]\n }, index)) : null\n })\n ]\n }),\n ConfigNode && configMode && selected ? (0, $djR0r$jsx)(ConfigNode, {\n ...props\n }) : isResizeable ? (0, $djR0r$jsx)((0, $djR0r$Resizable), {\n size: size,\n minWidth: 180,\n minHeight: 30,\n enable: {\n bottom: true,\n bottomRight: true,\n right: true\n },\n onResizeStop: (e, direction, ref, d)=>{\n const newSize = size ? {\n width: size.width + d.width,\n height: size.height + d.height\n } : ref.getBoundingClientRect();\n updateNodeConfig({\n ...data?.config,\n size: newSize\n });\n },\n children: children\n }) : children,\n (0, $djR0r$jsx)((0, $de6d95f0aff74a75$export$2e2bcd8739ae039), {\n isOpen: isInfoModalShown,\n type: props.type,\n onClose: ()=>setIsInfoModalShown(false),\n node: audioNode.node\n })\n ]\n });\n};\n\n\nconst $10a9c816b85d070f$export$86de09faaa70680d = (0, $djR0r$emotionstyled).div`\n width: 100%;\n padding: 0.4rem 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\nconst $10a9c816b85d070f$export$548ca3bae446ddc2 = (0, $djR0r$emotionstyled)((0, $8d34719b9811e505$export$7e0b3af1e60a3273))`\n display: flex;\n gap: 0.1rem;\n padding: 0 0.4rem;\n justify-content: start;\n font-size: 0.6rem;\n height: auto;\n min-width: 0;\n`;\nconst $10a9c816b85d070f$export$9fb15e3cc717240 = (0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n height: 70%;\n width: auto;\n gap: 0.4rem;\n`;\nconst $10a9c816b85d070f$export$be58b4326e23250f = (0, $djR0r$emotionstyled).span`\n width: auto;\n height: 100%;\n cursor: pointer;\n svg {\n width: auto;\n height: 100%;\n }\n &:hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n\n\nconst $78800a41ab03e65a$var$ControlPanelNodeWrapper = (0, $djR0r$emotionstyled).div`\n height: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n`;\nconst $78800a41ab03e65a$var$PanelNode = (props)=>{\n const { node: node } = props;\n const getControlPanelNode = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.getControlPanelNode);\n const ControlPanelNode = (0, $djR0r$useMemo)(()=>getControlPanelNode(node), [\n node\n ]);\n if (!ControlPanelNode) return null;\n return (0, $djR0r$jsx)(ControlPanelNode, {\n ...props\n });\n};\nconst $78800a41ab03e65a$var$ControlPanelItem = (props)=>{\n const { node: node, showControls: showControls, onDelete: onDelete } = props;\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const { id: id } = node;\n const { node: audioNode } = (0, $607523634e2ef7fa$export$2e2bcd8739ae039)(id) || {};\n const { updateNodeValues: updateNodeValues } = (0, $c2be4ce66a537e42$export$2e2bcd8739ae039)(id);\n return (0, $djR0r$jsxs)($78800a41ab03e65a$var$ControlPanelNodeWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsxs)((0, $10a9c816b85d070f$export$548ca3bae446ddc2), {\n theme: theme,\n children: [\n (0, $djR0r$jsx)((0, $10a9c816b85d070f$export$86de09faaa70680d), {\n children: node.data.label\n }),\n showControls && (0, $djR0r$jsxs)((0, $10a9c816b85d070f$export$9fb15e3cc717240), {\n children: [\n (0, $djR0r$jsx)((0, $10a9c816b85d070f$export$be58b4326e23250f), {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $djR0r$MdDragHandle), {\n className: \"grid-item-handle\"\n })\n }),\n (0, $djR0r$jsx)((0, $10a9c816b85d070f$export$be58b4326e23250f), {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $djR0r$MdClose), {\n onClick: ()=>onDelete(node)\n })\n })\n ]\n })\n ]\n }),\n (0, $djR0r$jsx)($78800a41ab03e65a$var$PanelNode, {\n node: node,\n audioNode: audioNode,\n updateNodeValues: updateNodeValues\n })\n ]\n });\n};\nvar $78800a41ab03e65a$export$2e2bcd8739ae039 = $78800a41ab03e65a$var$ControlPanelItem;\n\n\n\nconst $aa370ed1795ceb6e$var$ControlPanelIconWrapper = (0, $djR0r$emotionstyled).div`\n position: fixed;\n z-index: 5;\n box-shadow: 0px 1px 2px ${({ theme: theme })=>theme.colors.elevation2};\n left: 1rem;\n top: 4rem;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${({ theme: theme })=>theme.colors.elevation1};\n color: ${({ theme: theme })=>theme.colors.highlight1};\n\n :hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n cursor: pointer;\n }\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelIconsBar = (0, $djR0r$emotionstyled)((0, $10a9c816b85d070f$export$9fb15e3cc717240))`\n height: 80%;\n`;\nconst $aa370ed1795ceb6e$var$CloseIconWrapper = (0, $djR0r$emotionstyled)((0, $10a9c816b85d070f$export$be58b4326e23250f))`\n font-size: 1rem;\n display: flex;\n align-items: center;\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelHeader = (0, $djR0r$emotionstyled)((0, $10a9c816b85d070f$export$548ca3bae446ddc2))`\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n font-size: 0.7rem;\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelTitle = (0, $djR0r$emotionstyled)((0, $10a9c816b85d070f$export$86de09faaa70680d))`\n text-align: center;\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelWrapper = (0, $djR0r$emotionstyled).div`\n height: 100%;\n width: 100%;\n padding: 0.3rem 0.4rem;\n box-sizing: border-box;\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelBody = (0, $djR0r$emotionstyled).div`\n height: auto;\n padding: 0;\n max-height: 95vh;\n overflow-y: scroll;\n border: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelSettings = (0, $djR0r$emotionstyled).div`\n padding: 1rem 0;\n font-family: var(--leva-fonts-mono);\n font-size: 0.8rem;\n`;\nconst $aa370ed1795ceb6e$var$LockGridWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n }\n`;\nconst $aa370ed1795ceb6e$var$GridResizeHandle = (0, $djR0r$emotionstyled).div`\n position: absolute;\n height: 1rem;\n top: 0;\n bottom: 0;\n margin: auto;\n left: 0.5rem;\n border-right: 1px solid ${({ theme: theme })=>theme.colors.whitePrimary};\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelItemWrapper = (0, $djR0r$emotionstyled).div`\n box-sizing: border-box;\n overflow: hidden;\n .react-resizable-handle:after {\n border-color: ${({ theme: theme })=>theme.colors.whitePrimary};\n border-width: 1px;\n }\n`;\nconst $aa370ed1795ceb6e$var$ControlPanel = ()=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const nodeRef = (0, $djR0r$useRef)(null);\n const nodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodes);\n const { show: show, nodes: controlPanelNodes, size: size } = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.controlPanel);\n const { width: width = 200, height: height } = size;\n const filteredNodes = (0, $djR0r$useMemo)(()=>{\n const nodeIds = controlPanelNodes.map(({ id: id })=>id);\n return nodes.filter(({ id: id })=>nodeIds.includes(id));\n }, [\n nodes,\n controlPanelNodes\n ]);\n const showControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.showControlPanel);\n const hideControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.hideControlPanel);\n const setControlPanelNodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setControlPanelNodes);\n const setControlPanelSize = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setControlPanelSize);\n const removeNodeFromControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.removeNodeFromControlPanel);\n const [isGridLocked, setGridLocked] = (0, $djR0r$useState)(true);\n const layout = (0, $djR0r$useMemo)(()=>{\n const fallbackY = controlPanelNodes.reduce((acc, { height: height = (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).rowHeight, x: x, y: y = 0 })=>{\n const Y = y + height;\n return Y > acc ? Y : acc;\n }, 0);\n return controlPanelNodes.map(({ id: i, width: width, height: height, x: x, y: y })=>{\n return {\n i: i,\n w: width || (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).cols,\n h: height || 6,\n x: x ?? 0,\n y: y ?? fallbackY\n };\n });\n }, [\n controlPanelNodes\n ]);\n if (!filteredNodes.length) return null;\n return (0, $djR0r$jsxs)((0, $djR0r$Fragment), {\n children: [\n (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelIconWrapper, {\n theme: theme,\n ref: nodeRef,\n onClick: showControlPanel,\n children: (0, $djR0r$jsx)((0, $djR0r$RxDashboard), {})\n }),\n (0, $djR0r$jsxs)((0, $djR0r$reactmoderndrawer), {\n open: show,\n onClose: hideControlPanel,\n direction: \"left\",\n className: \"\",\n size: \"auto\",\n enableOverlay: false,\n style: {\n background: theme.colors.elevation1,\n position: \"absolute\"\n },\n children: [\n (0, $djR0r$jsxs)($aa370ed1795ceb6e$var$ControlPanelHeader, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelTitle, {\n children: \"Control Panel\"\n }),\n (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelIconsBar, {\n children: (0, $djR0r$jsx)($aa370ed1795ceb6e$var$CloseIconWrapper, {\n onClick: hideControlPanel,\n theme: theme,\n children: (0, $djR0r$jsx)((0, $djR0r$MdClose), {})\n })\n })\n ]\n }),\n (0, $djR0r$jsxs)($aa370ed1795ceb6e$var$ControlPanelWrapper, {\n children: [\n (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelSettings, {\n children: isGridLocked ? (0, $djR0r$jsxs)($aa370ed1795ceb6e$var$LockGridWrapper, {\n theme: theme,\n onClick: ()=>setGridLocked(false),\n children: [\n (0, $djR0r$jsx)((0, $djR0r$AiFillLock), {}),\n \"Unlock grid\"\n ]\n }) : (0, $djR0r$jsxs)($aa370ed1795ceb6e$var$LockGridWrapper, {\n theme: theme,\n onClick: ()=>setGridLocked(true),\n children: [\n (0, $djR0r$jsx)((0, $djR0r$AiFillUnlock), {}),\n \"Lock grid\"\n ]\n })\n }),\n (0, $djR0r$jsx)((0, $djR0r$Resizable), {\n enable: {\n top: false,\n right: !isGridLocked,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false\n },\n handleComponent: {\n right: (0, $djR0r$jsx)($aa370ed1795ceb6e$var$GridResizeHandle, {\n theme: theme\n })\n },\n minWidth: 120,\n size: {\n width: width,\n height: \"auto\"\n },\n onResizeStop: (e, direction, ref, d)=>{\n setControlPanelSize({\n width: width + d.width,\n height: height + d.height\n });\n },\n children: (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelBody, {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $djR0r$reactgridlayout), {\n layout: layout,\n className: \"layout\",\n cols: (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).cols,\n rowHeight: (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).rowHeight,\n width: width,\n margin: [\n 0,\n 0\n ],\n isResizable: !isGridLocked,\n draggableHandle: \".grid-item-handle\",\n onLayoutChange: (nodes)=>{\n requestAnimationFrame(()=>{\n setControlPanelNodes(nodes.map(({ i: i, w: w, h: h, x: x, y: y })=>({\n id: i,\n width: w,\n height: h,\n x: x,\n y: y\n })));\n });\n },\n children: filteredNodes.map((node)=>{\n return (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelItemWrapper, {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $78800a41ab03e65a$export$2e2bcd8739ae039), {\n node: node,\n showControls: !isGridLocked,\n onDelete: removeNodeFromControlPanel\n })\n }, node.id);\n })\n })\n })\n })\n ]\n })\n ]\n })\n ]\n });\n};\nvar $aa370ed1795ceb6e$export$2e2bcd8739ae039 = $aa370ed1795ceb6e$var$ControlPanel;\n\n\n\n\n\n\n\n\n\n\n\n\nvar $e94dbfe8457a1793$exports = {};\n$e94dbfe8457a1793$exports = \"# Quick start\\n\\n## Add node\\n - Mouse right click\\n - Select **'Add Node'** from context menu\\n\\n ### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or\\n\\n - Press `CMD+SHIFT+A`\\n\\n<br/>\\n\\n## Connect nodes\\n - Mouse left click and hold on source port\\n - Drop on target port\\n\\n<br/>\\n\\n## Delete Node or Connection\\n - Mouse right click on node/connection\\n - Select **'Delete Node'**/**'Delete Connection'** from context menu\\n\\n ### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or\\n\\n - Mouse left click on node/connection, then press `Backspace`\\n\\n<br/>\\n\\n\\n## Move node\\n - Drag and Drop\\n\\n\";\n\n\nconst $0d9fa38071943b2c$var$MdPreview = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n font-family: var(--leva-fonts-mono);\n font-size: 0.7rem;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n overflow: scroll;\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n padding: 0 0.5rem;\n\n code {\n color: ${({ theme: theme })=>theme.colors.accent3};\n filter: hue-rotate(180deg);\n }\n`);\nconst $0d9fa38071943b2c$var$ModalContent = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n padding: 1rem;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n overflow: hidden;\n`);\nconst $0d9fa38071943b2c$var$HelpModal = ()=>{\n const isHelpShown = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.isHelpShown);\n const toggleHelp = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n if (!isHelpShown) return null;\n return (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: ()=>{\n toggleHelp();\n },\n children: (0, $djR0r$jsx)($0d9fa38071943b2c$var$ModalContent, {\n children: (0, $djR0r$jsx)($0d9fa38071943b2c$var$MdPreview, {\n dangerouslySetInnerHTML: {\n __html: (0, $djR0r$marked)((0, (/*@__PURE__*/$parcel$interopDefault($e94dbfe8457a1793$exports))))\n },\n onWheelCapture: (event)=>event.stopPropagation()\n })\n })\n });\n};\nvar $0d9fa38071943b2c$export$2e2bcd8739ae039 = $0d9fa38071943b2c$var$HelpModal;\n\n\nconst $978ea880a50613b0$export$78bddedbcf2939ac = ()=>{\n const toggleHelp = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n return (0, $djR0r$jsx)((0, $djR0r$Fragment), {\n children: (0, $djR0r$jsx)((0, $djR0r$ControlButton), {\n onClick: toggleHelp,\n children: (0, $djR0r$jsx)((0, $djR0r$FaQuestion), {})\n })\n });\n};\n\n\n\n\n\n\n\n\nconst $8555f8953ca3d620$var$Layout = (0, $djR0r$emotionstyled).div`\n position: fixed;\n z-index: ${({ theme: theme })=>theme.zIndex.resumeContextLayout};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgb(24 28 32 / 90%);\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n cursor: pointer;\n`;\nconst $8555f8953ca3d620$var$Row = (0, $djR0r$emotionstyled).div`\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n`;\nconst $8555f8953ca3d620$var$Message = (0, $djR0r$emotionstyled).div`\n font-family: var(--leva-fonts-mono);\n font-size: 2rem;\n`;\nconst $8555f8953ca3d620$var$Icon = (0, $djR0r$emotionstyled)((0, $djR0r$FaVolumeOff))`\n width: 7rem;\n height: 7rem;\n`;\nconst $8555f8953ca3d620$var$ResumeContext = ()=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const patch = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ patch: patch })=>patch);\n const audioContext = patch.audioContext;\n const [isContextResumed, setIsContextResumed] = (0, $djR0r$useState)(audioContext.state === \"running\");\n if (isContextResumed) return null;\n return (0, $djR0r$jsxs)($8555f8953ca3d620$var$Layout, {\n theme: theme,\n onClick: ()=>{\n audioContext.resume();\n setIsContextResumed(true);\n },\n children: [\n (0, $djR0r$jsx)($8555f8953ca3d620$var$Row, {\n children: (0, $djR0r$jsx)($8555f8953ca3d620$var$Message, {\n theme: theme,\n children: \"Click anywhere to resume audio context\"\n })\n }),\n (0, $djR0r$jsx)($8555f8953ca3d620$var$Row, {\n children: (0, $djR0r$jsx)($8555f8953ca3d620$var$Icon, {})\n })\n ]\n });\n};\nvar $8555f8953ca3d620$export$2e2bcd8739ae039 = $8555f8953ca3d620$var$ResumeContext;\n\n\n\n\n\n\nconst $a86b09d17e46bbc8$var$ToggleMinimap = ()=>{\n const setConfig = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ setConfig: setConfig })=>setConfig);\n const { showMinimap: showMinimap } = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ config: config })=>config);\n return (0, $djR0r$jsx)((0, $djR0r$ControlButton), {\n onClick: ()=>setConfig({\n showMinimap: !showMinimap\n }),\n children: showMinimap ? (0, $djR0r$jsx)((0, $djR0r$FaMap), {}) : (0, $djR0r$jsx)((0, $djR0r$FaRegMap), {})\n });\n};\nvar $a86b09d17e46bbc8$export$2e2bcd8739ae039 = $a86b09d17e46bbc8$var$ToggleMinimap;\n\n\n\n\n\n\n\nconst $ea8f5cfca6de366a$var$Wire = ({ id: id, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, style: style = {}, data: data, markerStart: markerStart, markerEnd: markerEnd, source: source, target: target, sourceHandleId: sourceHandleId, targetHandleId: targetHandleId, selected: selected })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const getNode = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ getNode: getNode })=>getNode);\n const sourceNode = getNode(source);\n const targetNode = getNode(target);\n const isConnectedToSelected = sourceNode?.selected || targetNode?.selected;\n (0, $djR0r$useEffect)(()=>{\n if (!sourceHandleId || !targetHandleId) return;\n console.log(`connected ${source} to ${target}`);\n return ()=>{\n console.log(`disconnected ${source} from ${target}`);\n };\n }, [\n source,\n sourceHandleId,\n target,\n targetHandleId\n ]);\n const [edgePath] = (0, $djR0r$getBezierPath)({\n targetX: targetX,\n targetY: targetY,\n targetPosition: targetPosition,\n sourceX: sourceX,\n sourceY: sourceY,\n sourcePosition: sourcePosition\n });\n return (0, $djR0r$jsxs)((0, $djR0r$Fragment), {\n children: [\n (0, $djR0r$jsx)(\"path\", {\n id: id,\n style: {\n ...style,\n stroke: selected ? theme.colors.accent2 : isConnectedToSelected ? theme.colors.highlight3 : theme.colors.highlight2\n },\n className: \"react-flow__edge-path Wire\",\n d: edgePath,\n markerEnd: markerEnd\n }),\n (0, $djR0r$jsx)(\"path\", {\n style: {\n ...style,\n strokeWidth: 8,\n color: \"transparent\",\n opacity: 0,\n cursor: \"pointer\"\n },\n d: edgePath,\n markerEnd: markerEnd\n })\n ]\n });\n};\nvar $ea8f5cfca6de366a$export$2e2bcd8739ae039 = $ea8f5cfca6de366a$var$Wire;\n\n\nconst $34040b5af26d0b8a$var$onNodeDragStop = (_event, node)=>console.log(\"drag stop\", node);\nconst $34040b5af26d0b8a$var$onNodeClick = (_event, element)=>console.log(\"click\", element);\nconst $34040b5af26d0b8a$var$snapGrid = [\n 20,\n 20\n];\nconst $34040b5af26d0b8a$export$72cb76f559fbafcf = ({ editorState: editorState, plugins: plugins = [], editorContextMenu: editorContextMenu = [], onChange: onChange = ()=>{} })=>{\n const edgeTypes = (0, $djR0r$useMemo)(()=>({\n wire: (0, $ea8f5cfca6de366a$export$2e2bcd8739ae039)\n }), []);\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, onNodesChange: onNodesChange, onNodesDelete: onNodesDelete, onEdgesChange: onEdgesChange, onEdgesDelete: onEdgesDelete, onConnect: onConnect, setEditorState: setEditorState, setPlugins: setPlugins, setViewport: setViewport, viewport: viewport } = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)();\n const editorConfig = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ config: config })=>config);\n const nodeTypes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ nodeTypes: nodeTypes })=>nodeTypes);\n (0, $djR0r$useEffect)(()=>{\n setPlugins(plugins);\n }, [\n plugins\n ]);\n (0, $djR0r$useEffect)(()=>{\n if (editorState) setEditorState(editorState);\n }, [\n editorState,\n setEditorState\n ]);\n const [reactflowInstance, setReactflowInstance] = (0, $djR0r$useState)(null);\n (0, $djR0r$useEffect)(()=>{\n if (!reactflowInstance) return;\n onChange({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel,\n viewport: viewport\n });\n }, [\n nodes,\n edges,\n controlPanel,\n viewport\n ]);\n const onInit = (0, $djR0r$useCallback)((rfi)=>{\n if (!reactflowInstance) {\n setReactflowInstance(rfi);\n console.log(\"flow loaded:\", rfi);\n }\n }, [\n reactflowInstance\n ]);\n const { onContextMenu: onEditorContextMenu } = (0, $28ba16bd16f671c0$export$59ce2a6808e35a29)();\n const { onContextMenu: onNodeContextMenu } = (0, $0ffe51df9638a254$export$cbbbfb9fb15f3780)();\n const { onContextMenu: onEdgeContextMenu } = (0, $b2eaa5961e75d009$export$8b2e4a15453bac1e)();\n (0, $djR0r$useEffect)(()=>{\n if (!viewport) return;\n reactflowInstance?.setViewport(viewport);\n }, [\n viewport,\n reactflowInstance\n ]);\n (0, $djR0r$useOnViewportChange)({\n onEnd: setViewport\n });\n return (0, $djR0r$jsxs)((0, $djR0r$reactflow), {\n nodes: nodes,\n edges: edges,\n onNodesChange: onNodesChange,\n onNodesDelete: onNodesDelete,\n onEdgesChange: onEdgesChange,\n onConnect: onConnect,\n onNodeDragStop: $34040b5af26d0b8a$var$onNodeDragStop,\n onEdgesDelete: onEdgesDelete,\n onInit: onInit,\n onNodeClick: $34040b5af26d0b8a$var$onNodeClick,\n onContextMenu: onEditorContextMenu,\n onNodeContextMenu: onNodeContextMenu,\n onEdgeContextMenu: onEdgeContextMenu,\n nodeTypes: nodeTypes,\n edgeTypes: edgeTypes,\n snapGrid: $34040b5af26d0b8a$var$snapGrid,\n defaultViewport: editorState?.viewport,\n defaultEdgeOptions: {\n type: \"wire\"\n },\n snapToGrid: true,\n fitView: true,\n disableKeyboardA11y: true,\n children: [\n (0, $djR0r$jsx)((0, $djR0r$Background), {\n variant: (0, $djR0r$BackgroundVariant).Dots,\n gap: 12\n }),\n editorConfig.showMinimap ? (0, $djR0r$jsx)((0, $djR0r$MiniMap), {}) : null,\n (0, $djR0r$jsxs)((0, $djR0r$Controls), {\n style: {\n right: \"1rem\",\n left: \"initial\",\n bottom: \"40%\",\n top: \"initial\"\n },\n showInteractive: false,\n children: [\n (0, $djR0r$jsx)((0, $a86b09d17e46bbc8$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $978ea880a50613b0$export$78bddedbcf2939ac), {})\n ]\n }),\n (0, $djR0r$jsx)((0, $8555f8953ca3d620$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $aa370ed1795ceb6e$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $0d9fa38071943b2c$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $28ba16bd16f671c0$export$2e2bcd8739ae039), {\n editorContextMenu: editorContextMenu\n }),\n (0, $djR0r$jsx)((0, $0ffe51df9638a254$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $b2eaa5961e75d009$export$2e2bcd8739ae039), {})\n ]\n });\n};\nconst $34040b5af26d0b8a$export$7cda8d932e2f33c0 = (props)=>(0, $djR0r$jsx)((0, $djR0r$ReactFlowProvider), {\n children: (0, $djR0r$jsx)($34040b5af26d0b8a$export$72cb76f559fbafcf, {\n ...props\n })\n });\nvar $34040b5af26d0b8a$export$2e2bcd8739ae039 = $34040b5af26d0b8a$export$7cda8d932e2f33c0;\n\n\n\nconst $682f9b4ff493f2ac$export$d31000d36961d6c2 = {\n nodes: [],\n edges: [],\n controlPanel: {\n nodes: [],\n show: false,\n size: {\n width: 200,\n height: 100\n }\n },\n viewport: {\n x: 0,\n y: 0,\n zoom: 1.5\n }\n};\nconst $682f9b4ff493f2ac$export$6cd5d5c1dae69a36 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`);\nconst $682f9b4ff493f2ac$export$b38a2fd24b22fb35 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n height: 100%;\n width: 100%;\n display: flex;\n position: relative;\n`);\nconst $682f9b4ff493f2ac$export$8c347812506d5ac9 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n background: ${({ theme: theme })=>theme.colors.elevation2};\n opacity: 0.7;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n font-family: var(--leva-fonts-mono);\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n display: ${({ show: show })=>show ? \"flex\" : \"none\"};\n align-items: center;\n justify-content: center;\n font-size: 6rem;\n`);\nconst $682f9b4ff493f2ac$export$2206531ad8592d57 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n height: 2rem;\n display: flex;\n align-items: center;\n background: ${({ theme: theme })=>theme.colors.elevation2};\n`);\nconst $682f9b4ff493f2ac$export$3e41faf802a29e71 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 100%;\n box-sizing: border-box;\n padding: 0.3rem 0.4rem;\n\n border-right: 1px solid ${({ theme: theme })=>theme.colors.elevation1};\n\n input {\n color: ${({ theme: theme, active: active })=>active ? theme.colors.whitePrimary : theme.colors.highlight1};\n\n &:not([readonly]):focus {\n background-color: ${({ theme: theme })=>theme.colors.elevation1};\n }\n }\n`);\nconst $682f9b4ff493f2ac$export$61e5b3c7bace77b8 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 0.5rem;\n cursor: pointer;\n\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n`);\nconst $682f9b4ff493f2ac$export$3aef34186a092045 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)((0, $djR0r$FaPlus))`\n height: 40%;\n width: auto;\n`);\nconst $682f9b4ff493f2ac$export$cae179f078f4b4a4 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)((0, $djR0r$MdClose))`\n height: 70%;\n width: auto;\n cursor: pointer;\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n`);\nconst $682f9b4ff493f2ac$var$generateId = ()=>{\n return (0, $djR0r$nanoid)();\n};\nconst $682f9b4ff493f2ac$var$generateEmptyFile = ()=>({\n file: $682f9b4ff493f2ac$export$d31000d36961d6c2,\n name: \"Unnamed\",\n type: \"patch\",\n id: $682f9b4ff493f2ac$var$generateId()\n });\nconst $682f9b4ff493f2ac$export$86fbec116b87613f = ({ ...props })=>{\n const { projectState: projectState, theme: theme } = props;\n const currentFileIndex = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.currentFileIndex);\n const setCurrentFileIndex = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setCurrentFileIndex);\n const project = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.project);\n const setProject = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setProject);\n const getProject = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.getProject);\n const updateFileName = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.updateFileName);\n const pullEditorChanges = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.pullEditorChanges);\n const addFile = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.addFile);\n const deleteFile = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.deleteFile);\n const setEditorState = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setEditorState);\n const [showLoader, setShowLoader] = (0, $djR0r$useState)(false);\n (0, $djR0r$useEffect)(()=>{\n setProject(projectState || {\n files: [\n $682f9b4ff493f2ac$var$generateEmptyFile()\n ]\n });\n projectState && setEditorState(projectState.files[0].file);\n }, [\n projectState\n ]);\n // EXPERIMENTAL CODE\n (0, $djR0r$useEffect)(()=>{\n const fetcher = async (...args)=>{\n const request = new Request(...args);\n const files = getProject().files;\n const index = request.url.replace(\"project://\", \"\");\n const file = files.find(({ id: id })=>id === index);\n return new Response(JSON.stringify(file?.file ?? null));\n };\n (0, $4165c1239dbc641a$export$9e4ff1580457920e)(\"project://*\", fetcher);\n return ()=>{\n //unregister here\n };\n }, [\n getProject\n ]);\n (0, $djR0r$useEffect)(()=>{\n setShowLoader(true);\n setEditorState(getProject().files[currentFileIndex]?.file);\n setTimeout(()=>{\n setShowLoader(false);\n }, 1600);\n }, [\n currentFileIndex,\n setEditorState\n ]);\n return (0, $djR0r$jsxs)((0, $djR0r$ThemeProvider), {\n theme: theme || (0, $de1eff52c6419df8$export$2e2bcd8739ae039),\n children: [\n (0, $djR0r$jsx)((0, $djR0r$Global), {\n styles: (0, $djR0r$css)`\n :root {\n --leva-colors-elevation1: #292d39;\n --leva-colors-elevation2: #181c20;\n --leva-colors-elevation3: #373c4b;\n --leva-colors-accent1: #0066dc;\n --leva-colors-accent2: #007bff;\n --leva-colors-accent3: #3c93ff;\n --leva-colors-highlight1: #535760;\n --leva-colors-highlight2: #8c92a4;\n --leva-colors-highlight3: #fefefe;\n --leva-colors-vivid1: #ffcc00;\n --leva-colors-folderWidgetColor: var(--leva-colors-highlight2);\n --leva-colors-folderTextColor: var(--leva-colors-highlight3);\n --leva-colors-toolTipBackground: var(--leva-colors-highlight3);\n --leva-colors-toolTipText: var(--leva-colors-elevation2);\n --leva-radii-xs: 2px;\n --leva-radii-sm: 3px;\n --leva-radii-lg: 10px;\n --leva-space-xs: 3px;\n --leva-space-sm: 6px;\n --leva-space-md: 10px;\n --leva-space-rowGap: 7px;\n --leva-space-colGap: 7px;\n --leva-fonts-mono:\n ui-monospace, SFMono-Regular, Menlo, \"Roboto Mono\", monospace;\n --leva-fonts-sans: system-ui, sans-serif;\n --leva-fontSizes-root: 11px;\n --leva-fontSizes-toolTip: var(--leva-fontSizes-root);\n --leva-sizes-rootWidth: 280px;\n --leva-sizes-controlWidth: 160px;\n --leva-sizes-numberInputMinWidth: 38px;\n --leva-sizes-scrubberWidth: 8px;\n --leva-sizes-scrubberHeight: 16px;\n --leva-sizes-rowHeight: 24px;\n --leva-sizes-folderTitleHeight: 20px;\n --leva-sizes-checkboxSize: 16px;\n --leva-sizes-joystickWidth: 100px;\n --leva-sizes-joystickHeight: 100px;\n --leva-sizes-colorPickerWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-colorPickerHeight: 100px;\n --leva-sizes-imagePreviewWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-imagePreviewHeight: 100px;\n --leva-sizes-monitorHeight: 60px;\n --leva-sizes-titleBarHeight: 39px;\n --leva-shadows-level1: 0 0 9px 0 #00000088;\n --leva-shadows-level2: 0 4px 14px #00000033;\n --leva-borderWidths-root: 0px;\n --leva-borderWidths-input: 1px;\n --leva-borderWidths-focus: 1px;\n --leva-borderWidths-hover: 1px;\n --leva-borderWidths-active: 1px;\n --leva-borderWidths-folder: 1px;\n --leva-fontWeights-label: normal;\n --leva-fontWeights-folder: normal;\n --leva-fontWeights-button: normal;\n }\n `\n }),\n (0, $djR0r$jsxs)($682f9b4ff493f2ac$export$6cd5d5c1dae69a36, {\n children: [\n (0, $djR0r$jsxs)($682f9b4ff493f2ac$export$2206531ad8592d57, {\n children: [\n project.files.map((file, index)=>(0, $djR0r$jsxs)($682f9b4ff493f2ac$export$3e41faf802a29e71, {\n onClick: ()=>setCurrentFileIndex(index),\n active: index === currentFileIndex,\n children: [\n (0, $djR0r$jsx)((0, $61078804f94ec8d6$export$2e2bcd8739ae039), {\n onChange: (val)=>updateFileName(index, val),\n value: file.name || \"Unnamed\"\n }),\n (0, $djR0r$jsx)($682f9b4ff493f2ac$export$cae179f078f4b4a4, {\n onClick: (event)=>{\n event.stopPropagation();\n if (!window.confirm(\"Do you really want to delete this file?\")) return;\n deleteFile(index);\n }\n })\n ]\n }, index)),\n (0, $djR0r$jsx)($682f9b4ff493f2ac$export$61e5b3c7bace77b8, {\n onClick: ()=>addFile($682f9b4ff493f2ac$var$generateEmptyFile()),\n children: (0, $djR0r$jsx)($682f9b4ff493f2ac$export$3aef34186a092045, {})\n })\n ]\n }),\n (0, $djR0r$jsxs)($682f9b4ff493f2ac$export$b38a2fd24b22fb35, {\n children: [\n (0, $djR0r$jsx)((0, $34040b5af26d0b8a$export$7cda8d932e2f33c0), {\n ...props,\n onChange: (state)=>{\n pullEditorChanges();\n },\n editorState: $682f9b4ff493f2ac$export$d31000d36961d6c2\n }),\n (0, $djR0r$jsx)($682f9b4ff493f2ac$export$8c347812506d5ac9, {\n show: showLoader,\n children: \"Loading...\"\n })\n ]\n })\n ]\n })\n ]\n });\n};\nvar $682f9b4ff493f2ac$export$2e2bcd8739ae039 = $682f9b4ff493f2ac$export$86fbec116b87613f;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nexport {$682f9b4ff493f2ac$export$2e2bcd8739ae039 as Editor, $682f9b4ff493f2ac$export$d31000d36961d6c2 as EDITOR_DEFAULTS, $ea8f5cfca6de366a$export$2e2bcd8739ae039 as Wire, $8d34719b9811e505$export$361064385d50ec44 as WNNode, $8d34719b9811e505$export$7e0b3af1e60a3273 as TitleBar, $8d34719b9811e505$export$bfd3bd1fa283e3c6 as PortsPanel, $8d34719b9811e505$export$af4f9b41fc32ed9e as OutputPorts, $8d34719b9811e505$export$496e5e1ee1696f64 as OutputHandle, $8d34719b9811e505$export$f1afba0ff9ea1277 as InputPorts, $8d34719b9811e505$export$9ea0feffc20ee81 as InputHandle, $8d34719b9811e505$export$a2d375858cc72119 as Port, $96e3c18b52e89add$export$2e2bcd8739ae039 as Modal, $61078804f94ec8d6$export$2e2bcd8739ae039 as EditableLabel, $607523634e2ef7fa$export$2e2bcd8739ae039 as useAudioNode, $c2be4ce66a537e42$export$2e2bcd8739ae039 as useNode, $40266ad71a95dba8$export$2e2bcd8739ae039 as useTheme, $6f5e1924a22d258c$export$2e2bcd8739ae039 as useStore, $de1eff52c6419df8$export$2e2bcd8739ae039 as theme, $9738c58e5420c085$export$b0b7b95ee465c83c as PortType};\n//# sourceMappingURL=module.js.map\n","export { default as Editor, EDITOR_DEFAULTS } from \"./src/components/App\";\nexport { default as Wire } from \"./src/components/Wire\";\nexport {\n WNNode,\n TitleBar,\n type WNNodeProps,\n PortsPanel,\n OutputPorts,\n OutputHandle,\n InputPorts,\n InputHandle,\n Port,\n} from \"./src/components/Node\";\nexport { default as Modal } from \"./src/components/Modal\";\nexport { default as EditableLabel } from \"./src/components/EditableLabel\";\nexport { default as useAudioNode } from \"./src/hooks/useAudioNode\";\nexport { default as useNode } from \"./src/hooks/useNode\";\nexport { default as useTheme } from \"./src/hooks/useTheme\";\nexport { default as useStore } from \"./src/store\";\nexport { default as theme } from \"./src/theme\";\n\nexport { PortType } from \"./src/constants\";\n\nexport type {\n WNAudioNode,\n CreateWNAudioNode,\n ControlPanelNodeProps,\n PluginConfig,\n PluginComponent,\n ControlPanelNode,\n WNNodeData,\n WNNode as TWNNode,\n InputPort,\n OutputPort,\n EditorState,\n Project,\n WNEdge as TWNEdge,\n EditorStoreState,\n} from \"./src/types\";\n\nexport type { Theme } from \"./src/theme\";\n","import { css, Global, ThemeProvider, withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\nimport { nanoid } from \"nanoid\";\nimport { ReactNode, useEffect, useMemo, useState } from \"react\";\nimport { FaPlus as IconAdd } from \"react-icons/fa6\";\nimport { MdClose } from \"react-icons/md\";\nimport \"reactflow/dist/style.css\";\nimport { registerFetcher } from \"@web-noise/fetch\";\nimport useStore from \"../store\";\nimport \"../styles\";\nimport defaultTheme, { Theme } from \"../theme\";\nimport type { EditorState, PluginConfig, Project, ProjectFile } from \"../types\";\nimport { Editor } from \"./Editor\";\nimport EditableLabel from \"./EditableLabel\";\n\n// @TODO: move default state to editor\nexport const EDITOR_DEFAULTS = {\n nodes: [],\n edges: [],\n controlPanel: {\n nodes: [],\n show: false,\n size: {\n width: 200,\n height: 100,\n },\n },\n viewport: { x: 0, y: 0, zoom: 1.5 },\n};\n\nexport const AppWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`);\n\nexport const EditorContainer = withTheme(styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n display: flex;\n position: relative;\n`);\n\nexport const EditorLoadingOverlay = withTheme(styled.div<{\n theme: Theme;\n show: boolean;\n}>`\n background: ${({ theme }) => theme.colors.elevation2};\n opacity: 0.7;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n font-family: var(--leva-fonts-mono);\n color: ${({ theme }) => theme.colors.whitePrimary};\n display: ${({ show }) => (show ? \"flex\" : \"none\")};\n align-items: center;\n justify-content: center;\n font-size: 6rem;\n`);\n\nexport const TabsContainer = withTheme(styled.div<{ theme: Theme }>`\n height: 2rem;\n display: flex;\n align-items: center;\n background: ${({ theme }) => theme.colors.elevation2};\n`);\n\nexport const Tab = withTheme(styled.div<{ theme: Theme; active?: boolean }>`\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 100%;\n box-sizing: border-box;\n padding: 0.3rem 0.4rem;\n\n border-right: 1px solid ${({ theme }) => theme.colors.elevation1};\n\n input {\n color: ${({ theme, active }) =>\n active ? theme.colors.whitePrimary : theme.colors.highlight1};\n\n &:not([readonly]):focus {\n background-color: ${({ theme }) => theme.colors.elevation1};\n }\n }\n`);\n\nexport const TabIconWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 0.5rem;\n cursor: pointer;\n\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n`);\n\nexport const AddFileIcon = withTheme(styled(IconAdd)<{ theme: Theme }>`\n height: 40%;\n width: auto;\n`);\n\nexport const CloseIcon = withTheme(styled(MdClose)<{ theme: Theme }>`\n height: 70%;\n width: auto;\n cursor: pointer;\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n`);\n\nconst generateId = (): string => {\n return nanoid();\n};\n\nconst generateEmptyFile = (): ProjectFile => ({\n file: EDITOR_DEFAULTS,\n name: \"Unnamed\",\n type: \"patch\",\n id: generateId(),\n});\n\nexport const App = ({\n ...props\n}: {\n projectState?: Project;\n plugins?: Array<PluginConfig>;\n editorContextMenu?: Array<ReactNode>;\n onChange?: ({ nodes, edges, controlPanel }: EditorState) => void;\n theme?: Theme;\n}) => {\n const { projectState, theme } = props;\n const currentFileIndex = useStore((store) => store.currentFileIndex);\n const setCurrentFileIndex = useStore((store) => store.setCurrentFileIndex);\n\n const project = useStore((store) => store.project);\n const setProject = useStore((store) => store.setProject);\n const getProject = useStore((store) => store.getProject);\n const updateFileName = useStore((store) => store.updateFileName);\n const pullEditorChanges = useStore((store) => store.pullEditorChanges);\n\n const addFile = useStore((store) => store.addFile);\n const deleteFile = useStore((store) => store.deleteFile);\n\n const setEditorState = useStore((store) => store.setEditorState);\n\n const [showLoader, setShowLoader] = useState(false);\n\n useEffect(() => {\n setProject(\n projectState || {\n files: [generateEmptyFile()],\n },\n );\n projectState && setEditorState(projectState.files[0].file);\n }, [projectState]);\n\n // EXPERIMENTAL CODE\n useEffect(() => {\n const fetcher: typeof fetch = async (...args) => {\n const request = new Request(...args);\n const files = getProject().files;\n const index = request.url.replace(\"project://\", \"\");\n const file = files.find(({ id }) => id === index);\n return new Response(JSON.stringify(file?.file ?? null));\n };\n registerFetcher(\"project://*\", fetcher);\n return () => {\n //unregister here\n };\n }, [getProject]);\n\n useEffect(() => {\n setShowLoader(true);\n setEditorState(getProject().files[currentFileIndex]?.file);\n setTimeout(() => {\n setShowLoader(false);\n }, 1600);\n }, [currentFileIndex, setEditorState]);\n\n return (\n <ThemeProvider theme={theme || defaultTheme}>\n <Global\n styles={css`\n :root {\n --leva-colors-elevation1: #292d39;\n --leva-colors-elevation2: #181c20;\n --leva-colors-elevation3: #373c4b;\n --leva-colors-accent1: #0066dc;\n --leva-colors-accent2: #007bff;\n --leva-colors-accent3: #3c93ff;\n --leva-colors-highlight1: #535760;\n --leva-colors-highlight2: #8c92a4;\n --leva-colors-highlight3: #fefefe;\n --leva-colors-vivid1: #ffcc00;\n --leva-colors-folderWidgetColor: var(--leva-colors-highlight2);\n --leva-colors-folderTextColor: var(--leva-colors-highlight3);\n --leva-colors-toolTipBackground: var(--leva-colors-highlight3);\n --leva-colors-toolTipText: var(--leva-colors-elevation2);\n --leva-radii-xs: 2px;\n --leva-radii-sm: 3px;\n --leva-radii-lg: 10px;\n --leva-space-xs: 3px;\n --leva-space-sm: 6px;\n --leva-space-md: 10px;\n --leva-space-rowGap: 7px;\n --leva-space-colGap: 7px;\n --leva-fonts-mono:\n ui-monospace, SFMono-Regular, Menlo, \"Roboto Mono\", monospace;\n --leva-fonts-sans: system-ui, sans-serif;\n --leva-fontSizes-root: 11px;\n --leva-fontSizes-toolTip: var(--leva-fontSizes-root);\n --leva-sizes-rootWidth: 280px;\n --leva-sizes-controlWidth: 160px;\n --leva-sizes-numberInputMinWidth: 38px;\n --leva-sizes-scrubberWidth: 8px;\n --leva-sizes-scrubberHeight: 16px;\n --leva-sizes-rowHeight: 24px;\n --leva-sizes-folderTitleHeight: 20px;\n --leva-sizes-checkboxSize: 16px;\n --leva-sizes-joystickWidth: 100px;\n --leva-sizes-joystickHeight: 100px;\n --leva-sizes-colorPickerWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-colorPickerHeight: 100px;\n --leva-sizes-imagePreviewWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-imagePreviewHeight: 100px;\n --leva-sizes-monitorHeight: 60px;\n --leva-sizes-titleBarHeight: 39px;\n --leva-shadows-level1: 0 0 9px 0 #00000088;\n --leva-shadows-level2: 0 4px 14px #00000033;\n --leva-borderWidths-root: 0px;\n --leva-borderWidths-input: 1px;\n --leva-borderWidths-focus: 1px;\n --leva-borderWidths-hover: 1px;\n --leva-borderWidths-active: 1px;\n --leva-borderWidths-folder: 1px;\n --leva-fontWeights-label: normal;\n --leva-fontWeights-folder: normal;\n --leva-fontWeights-button: normal;\n }\n `}\n />\n <AppWrapper>\n <TabsContainer>\n {project.files.map((file, index) => (\n <Tab\n onClick={() => setCurrentFileIndex(index)}\n key={index}\n active={index === currentFileIndex}\n >\n <EditableLabel\n onChange={(val) => updateFileName(index, val)}\n value={file.name || \"Unnamed\"}\n />\n <CloseIcon\n onClick={(event) => {\n event.stopPropagation();\n if (\n !window.confirm(\"Do you really want to delete this file?\")\n ) {\n return;\n }\n deleteFile(index);\n }}\n />\n </Tab>\n ))}\n <TabIconWrapper onClick={() => addFile(generateEmptyFile())}>\n <AddFileIcon />\n </TabIconWrapper>\n </TabsContainer>\n <EditorContainer>\n <Editor\n {...props}\n onChange={(state) => {\n pullEditorChanges();\n }}\n editorState={EDITOR_DEFAULTS}\n />\n <EditorLoadingOverlay show={showLoader}>\n Loading...\n </EditorLoadingOverlay>\n </EditorContainer>\n </AppWrapper>\n </ThemeProvider>\n );\n};\n\nexport default App;\n","import { match } from './lib';\n\ntype Fetch = typeof fetch;\n\nconst customFetchers: Array<[string, Fetch]> = [];\n\ntype RegisterFetcher = (matcher: string, fetcher: Fetch) => void;\n\nexport const registerFetcher: RegisterFetcher = (matcher, fetcher) => {\n customFetchers.push([matcher, fetcher]);\n return () => {\n //delete fetcher\n };\n};\n\nconst getFetcher = (url: string): Fetch | void => {\n return [...customFetchers].reverse().find(([matcher]) => {\n return match(url, matcher);\n })?.[1];\n};\n\nconst webNoiseFetch: Fetch = (...args) => {\n const request = new Request(...args);\n const fetcher = getFetcher(request.url);\n if (fetcher) {\n return fetcher(...args);\n }\n return fetch(...args);\n};\n\nexport default webNoiseFetch;\n","export const match = (url: string, pattern: string): boolean => {\n // Escape special characters in the pattern, except for '*'\n const escapedPattern = pattern.replace(/([.+?^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\n\n // Replace '*' with '.*' to match any sequence of characters\n const regexPattern = escapedPattern.replace(/\\*/g, '.*');\n\n // Create a regular expression from the pattern, ensuring it matches the entire URL\n const regex = new RegExp(`^${regexPattern}$`);\n\n // Test if the URL matches the pattern\n return regex.test(url);\n};\n","import {\n addEdge,\n getConnectedEdges,\n NodeTypes,\n OnConnect,\n Viewport,\n} from \"reactflow\";\nimport { create, StateCreator } from \"zustand\";\nimport { setAudioNodeTypes, AudioNodeTypes } from \"@web-noise/patch\";\nimport { CONTROL_PANEL_GRID_CONFIG } from \"../constants\";\nimport generateNodeId from \"../helpers/generateNodeId\";\nimport {\n ControlPanelNode,\n ControlPanelNodes,\n PluginComponent,\n PluginConfig,\n WNEdge,\n WNNode,\n GraphState,\n EditorState,\n ControlPanelState,\n EditorStoreState,\n} from \"../types\";\nimport nodesStateCreator, { NodesState } from \"./nodesStore\";\nimport history, { historyStateCreator, HistoryState } from \"./history\";\nimport audioPatch, {\n AudioPatchState,\n audioPatchStateCreator,\n} from \"./audioPatch\";\nimport projectStateCreator, { ProjectState } from \"./projectStore\";\n\nexport type { AudioNodeTypes, NodesState, GraphState };\n\ninterface EditorConfig {\n showMinimap: boolean;\n}\n\ntype NodesConfiguration = Record<string, PluginComponent>;\n\nexport type StoreState = NodesState &\n HistoryState &\n ProjectState &\n AudioPatchState & {\n setGraph: (elements: { nodes: WNNode[]; edges: WNEdge[] }) => Promise<void>;\n clearGraph: () => void;\n createNode: (node: WNNode) => void;\n createNodes: (node: WNNode[]) => Promise<void>;\n removeNode: (node: WNNode) => void;\n removeNodes: (nodes: WNNode[]) => void;\n removeEdges: (nodes: WNEdge[]) => void;\n onConnect: OnConnect;\n createEdges: (edge: WNEdge[]) => void;\n onEdgesDelete: (edges: WNEdge[]) => void;\n onNodesDelete: (nodes: WNNode[]) => Promise<void>;\n plugins: Array<PluginConfig>;\n setPlugins: (plugins: Array<PluginConfig>) => void;\n nodesConfiguration: NodesConfiguration;\n config: EditorConfig;\n setConfig: (config: Partial<EditorConfig>) => void;\n getEditorState: () => EditorState;\n setEditorState: (state: EditorState) => Promise<void>;\n isHelpShown: boolean;\n toggleHelp: () => void;\n copyBuffer: { nodes: WNNode[]; edges: WNEdge[] };\n copy: (elements: { nodes: WNNode[]; edges: WNEdge[] }) => void;\n copySelectedItems: () => void;\n pasteBuffer: (x: number, y: number) => void;\n /* move to control panel store */\n getControlPanelNode: (node: WNNode) => ControlPanelNode | null;\n controlPanel: ControlPanelState;\n setControlPanelNodes: (nodes: ControlPanelNodes) => void;\n showControlPanel: () => void;\n hideControlPanel: () => void;\n setControlPanelSize: (width: { width: number; height: number }) => void;\n addNodeToControlPanel: (node: WNNode) => void;\n removeNodeFromControlPanel: (node: WNNode) => void;\n removeNodesFromControlPanel: (nodes: WNNode[]) => void;\n /* / move to control panel store */\n viewport: Viewport;\n setViewport: (viewport: Viewport) => void;\n };\n\nexport const stateCreator: StateCreator<StoreState> = (...args) => {\n const [set, get] = args;\n return {\n ...nodesStateCreator(...args),\n ...historyStateCreator(...args),\n ...audioPatchStateCreator(...args),\n ...projectStateCreator(...args),\n\n setGraph: async ({ nodes, edges }) => {\n const {\n patch,\n createNodes,\n createEdges,\n setNodesAndEdges,\n nodes: activeNodes,\n edges: activeEdges,\n } = get();\n setNodesAndEdges({ nodes: [], edges: [] });\n\n await createNodes(nodes);\n createEdges(edges);\n },\n clearGraph: () => {\n const { setGraph } = get();\n setGraph({ nodes: [], edges: [] });\n },\n createNodes: async (nodes) => {\n const { createNode } = get();\n await Promise.all(nodes.map((node) => createNode(node)));\n },\n createNode: (nodeData) => {\n const { addNode, nodesConfiguration } = get();\n\n const { type, id, data } = nodeData;\n\n if (typeof type === \"undefined\") {\n throw new Error(`node type is not defined for node: ${id}`);\n }\n\n const node = {\n ...nodeData,\n data: {\n ...data,\n config: {\n ...nodesConfiguration[type]?.defaultConfig,\n ...data?.config,\n },\n },\n };\n\n addNode(node);\n },\n removeNode: (node) => get().removeNodes([node]),\n removeNodes: (nodes) => {\n const {\n edges,\n nodes: currentNodes,\n onNodesDelete,\n removeEdges,\n removeNodesFromControlPanel,\n } = get();\n const parentNodeIds = nodes.map(({ id }) => id);\n const children = currentNodes.filter(\n ({ parentNode }) => parentNode && parentNodeIds.includes(parentNode),\n );\n const resultingNodes = [...nodes, ...children];\n removeNodesFromControlPanel(resultingNodes);\n const connectedEdges = getConnectedEdges(resultingNodes, edges);\n removeEdges(connectedEdges);\n onNodesDelete(resultingNodes);\n const nodeIds = resultingNodes.map(({ id }) => id);\n set({\n nodes: currentNodes.filter(({ id }) => !nodeIds.includes(id)),\n });\n },\n removeEdges: (edges) => {\n const { edges: currentEdges, onEdgesDelete } = get();\n const edgeIds = edges.map(({ id }) => id);\n onEdgesDelete(edges);\n set({\n edges: currentEdges.filter(({ id }) => !edgeIds.includes(id)),\n });\n },\n createEdges: (newEdges) => {\n const { patch, edges, setEdges } = get();\n setEdges(newEdges);\n },\n onConnect: async (connection) => {\n const { edges, createEdges } = get();\n const newEdges = addEdge(connection, edges);\n createEdges(newEdges);\n },\n onEdgesDelete: (edges) => {\n const { patch } = get();\n },\n onNodesDelete: async (nodes) => {\n const { removeNodesFromControlPanel, patch } = get();\n removeNodesFromControlPanel(nodes);\n },\n plugins: [],\n setPlugins: async (plugins) => {\n const { setNodeTypes } = get();\n set({ plugins });\n\n const nodesConf: NodesConfiguration = plugins.reduce((acc, plugin) => {\n return {\n ...acc,\n ...plugin.components.reduce(\n (subAcc, item) => ({\n ...subAcc,\n [item.type]: item,\n }),\n {},\n ),\n };\n }, {});\n\n const nodeTypes: NodeTypes = Object.keys(nodesConf).reduce(\n (acc, type) => {\n return {\n ...acc,\n [type]: nodesConf[type].node,\n };\n },\n {},\n );\n\n const audioNodeTypes: AudioNodeTypes = Object.keys(nodesConf).reduce(\n (acc, type) => {\n return {\n ...acc,\n [type]: nodesConf[type].audioNode,\n };\n },\n {},\n );\n\n setAudioNodeTypes(audioNodeTypes);\n setNodeTypes(nodeTypes);\n\n set(({ nodesConfiguration }) => ({\n nodesConfiguration: { ...nodesConfiguration, ...nodesConf },\n }));\n },\n nodesConfiguration: {},\n config: { showMinimap: false },\n setConfig: (changes) => {\n set(({ config }) => ({ config: { ...config, ...changes } }));\n },\n getEditorState: () => {\n const { getNodesAndEdges, controlPanel, viewport } = get();\n return {\n ...getNodesAndEdges(),\n controlPanel,\n viewport,\n };\n },\n setEditorState: async ({ nodes, edges, controlPanel, viewport }) => {\n const { setGraph } = get();\n await setGraph({ nodes, edges });\n // @TODO: remove this line once audio patch initialisation is reworked\n await new Promise((r) => setTimeout(r, 1000));\n set({\n controlPanel,\n viewport,\n });\n },\n isHelpShown: false,\n toggleHelp: () => {\n const { isHelpShown: showHelp } = get();\n set({ isHelpShown: !showHelp });\n },\n copyBuffer: { nodes: [], edges: [] },\n copy: (elements) => {\n set({ copyBuffer: elements });\n },\n copySelectedItems: () => {\n const { nodes: currentNodes, edges: currentEdges, copy } = get();\n const nodes = currentNodes.filter(({ selected }) => selected);\n const edges = currentEdges.filter(({ selected }) => selected);\n if (!nodes.length) {\n return;\n }\n copy({ nodes, edges });\n },\n pasteBuffer: (x = 0, y = 0) => {\n const { copyBuffer, createNodes, setEdges, nodes, edges } = get();\n const { nodes: nodesToCopy, edges: edgesToCopy } = copyBuffer;\n\n if (!nodesToCopy.length) {\n return;\n }\n\n set({\n nodes: nodes.map((node) => ({ ...node, selected: false })),\n });\n\n const topLeftNode = nodesToCopy.reduce((acc, node) => {\n if (!acc) {\n return node;\n }\n if (\n node.position.x < acc.position.x &&\n node.position.y < acc.position.y\n ) {\n return node;\n }\n return acc;\n });\n\n const xDelta = topLeftNode.position.x - x;\n const yDelta = topLeftNode.position.y - y;\n\n const { nodes: newNodes, mapping } = nodesToCopy.reduce(\n (acc, node) => {\n const newNodeId = generateNodeId(node);\n return {\n nodes: [\n ...acc.nodes,\n {\n ...node,\n id: newNodeId,\n position: {\n x: node.position.x - xDelta,\n y: node.position.y - yDelta,\n },\n selected: true,\n },\n ],\n mapping: {\n ...acc.mapping,\n [node.id]: newNodeId,\n },\n };\n },\n { nodes: [], mapping: {} } as {\n nodes: Array<WNNode>;\n mapping: Record<WNNode[\"id\"], WNNode[\"id\"]>;\n },\n );\n createNodes(newNodes);\n\n const newEdges = edgesToCopy.map((edge) => {\n const source = mapping[edge.source] || edge.source;\n const target = mapping[edge.target] || edge.target;\n return {\n ...edge,\n id: edge.id.replace(edge.source, source).replace(edge.target, target),\n source,\n target,\n selected: true,\n };\n });\n setEdges([\n ...edges.map((edge) => ({ ...edge, selected: false })),\n ...newEdges,\n ]);\n },\n getControlPanelNode: (node) => {\n const { nodesConfiguration } = get();\n const { type } = node;\n if (!type) {\n return null;\n }\n const controlPanelNode = nodesConfiguration[type]?.controlPanelNode;\n if (!controlPanelNode) {\n console.error(`could not find node for type ${type}`);\n return null;\n }\n return controlPanelNode;\n },\n controlPanel: {\n show: true,\n nodes: [],\n size: {\n width: 200,\n height: 100,\n },\n },\n showControlPanel: () =>\n set(({ controlPanel }) => ({\n controlPanel: { ...controlPanel, show: true },\n })),\n hideControlPanel: () =>\n set(({ controlPanel }) => ({\n controlPanel: { ...controlPanel, show: false },\n })),\n addNodeToControlPanel: (node) => {\n const { nodesConfiguration } = get();\n const defaultConfig = node.type\n ? nodesConfiguration[node.type]?.defaultConfig\n : {};\n const { height } = defaultConfig?.size || {};\n const newNode = {\n id: node.id,\n ...(height\n ? { height: height / CONTROL_PANEL_GRID_CONFIG.rowHeight }\n : {}),\n };\n set(({ controlPanel }) => ({\n controlPanel: {\n ...controlPanel,\n nodes: [...controlPanel.nodes, newNode],\n },\n }));\n },\n removeNodeFromControlPanel: (node) =>\n get().removeNodesFromControlPanel([node]),\n removeNodesFromControlPanel: (nodes) => {\n const nodeIds = nodes.map(({ id }) => id);\n set(({ controlPanel }) => {\n const nodes = controlPanel.nodes.filter(\n ({ id }) => !nodeIds.includes(id),\n );\n return {\n controlPanel: {\n ...controlPanel,\n nodes,\n },\n };\n });\n },\n setControlPanelNodes: (nodes) => {\n set(({ controlPanel }) => {\n return {\n controlPanel: {\n ...controlPanel,\n nodes,\n },\n };\n });\n },\n setControlPanelSize: (size) => {\n set(({ controlPanel }) => {\n return {\n controlPanel: {\n ...controlPanel,\n size,\n },\n };\n });\n },\n\n viewport: { x: 0, y: 0, zoom: 1 },\n setViewport: (viewport) => set({ viewport }),\n };\n};\n\nconst useStore = create<StoreState>(audioPatch(history(stateCreator)));\n\nexport default useStore;\n","export {\n default as createPatch,\n type Patch,\n type AudioNodeState,\n} from \"./src/createPatch\";\nexport {\n setAudioNodeTypes,\n getAudioNodeType,\n type AudioNodeTypes,\n} from \"./src/audioNodeTypes\";\n","import type {\n InputPort,\n OutputPort,\n WNAudioNode,\n TWNEdge as WNEdge,\n TWNNode as WNNode,\n} from \"@web-noise/core\";\n\nimport { getAudioNodeType } from \"./audioNodeTypes\";\n\n//@ts-ignore\nimport dumpNodeWorkletUrl from \"worklet:./dumpNodeWorklet.ts\";\nconst dumpNodeWorklet = new URL(dumpNodeWorkletUrl, import.meta.url);\n\ninterface AudioNodeLoadingState {\n loading: true;\n error: null;\n node: null;\n}\n\ninterface AudioNodeErrorState {\n loading: false;\n error: Error;\n node: null;\n}\n\ninterface AudioNodeLoadedState<T> {\n loading: false;\n error: null;\n node: T;\n}\n\nexport type AudioNodeState<T> =\n | AudioNodeLoadingState\n | AudioNodeErrorState\n | AudioNodeLoadedState<T>;\n\ntype AudioNodes = Map<string, AudioNodeState<WNAudioNode>>;\ntype RegisterAudioNode = (node: WNNode) => Promise<void>;\ntype RegisterAudioNodes = (nodes: WNNode[]) => Promise<void[]>;\ntype UnregisterAudioNode = (node: WNNode) => void;\ntype UnregisterAudioNodes = (node: WNNode[]) => void;\n\ntype AudioConnections = Map<string, { output: OutputPort; input: InputPort }>;\ntype RegisterAudioConnection = (edge: WNEdge) => void;\ntype RegisterAudioConnections = (edge: WNEdge[]) => void[];\ntype UnregisterAudioConnection = (edge: WNEdge) => void;\ntype UnregisterAudioConnections = (edge: WNEdge[]) => void[];\n\nexport interface Patch {\n audioContext: AudioContext;\n audioNodes: AudioNodes;\n registerAudioNode: RegisterAudioNode;\n registerAudioNodes: RegisterAudioNodes;\n unregisterAudioNode: (node: WNNode) => void;\n unregisterAudioNodes: (nodes: WNNode[]) => void;\n audioConnections: AudioConnections;\n registerAudioConnection: RegisterAudioConnection;\n registerAudioConnections: RegisterAudioConnections;\n unregisterAudioConnection: (edge: WNEdge) => void;\n unregisterAudioConnections: (edges: WNEdge[]) => void;\n}\n\ntype CreatePatch = (audioContext?: AudioContext) => Patch;\n\nconst createPatch: CreatePatch = (audioContext = new AudioContext()) => {\n /*\n * due to bug in chrome we need to kickstart worklet outputs\n * by connecting it to an input\n * */\n const dumpNodePromise: Promise<AudioWorkletNode> = audioContext.audioWorklet\n .addModule(dumpNodeWorklet)\n .then(() => {\n return new AudioWorkletNode(audioContext, \"dump-node-processor\");\n });\n\n const audioNodes: AudioNodes = new Map();\n const audioConnections: AudioConnections = new Map();\n\n const registerAudioNode: RegisterAudioNode = async (node) => {\n const { id, type, data } = node;\n if (!type) {\n audioNodes.set(id, {\n loading: false,\n error: new Error(`Node: ${id} has no type`),\n node: null,\n });\n return;\n }\n const nodeCreator = getAudioNodeType(type);\n if (nodeCreator === false) {\n return;\n }\n const createNode = nodeCreator;\n if (!createNode) {\n audioNodes.set(id, {\n loading: false,\n error: new Error(`Could not find handler for audio type ${type}`),\n node: null,\n });\n return;\n }\n audioNodes.set(id, {\n loading: true,\n error: null,\n node: null,\n });\n try {\n const audioNode = await createNode(audioContext, data);\n const dumpNode = await dumpNodePromise;\n audioNodes.set(id, {\n loading: false,\n error: null,\n node: audioNode,\n });\n\n // Kickstart worklet outputs\n Object.values(audioNode.outputs || []).forEach(({ port }) => {\n if (!dumpNode) {\n return;\n }\n if (port instanceof AudioWorkletNode) {\n port.connect(dumpNode);\n }\n if (Array.isArray(port) && port[0] instanceof AudioWorkletNode) {\n port[0].connect(dumpNode, port[1]);\n }\n });\n } catch (error) {\n audioNodes.set(id, {\n loading: false,\n error: error as Error,\n node: null,\n });\n }\n };\n\n const registerAudioNodes: RegisterAudioNodes = async (nodes) => {\n return Promise.all(nodes.map(registerAudioNode));\n };\n\n const unregisterAudioNode: UnregisterAudioNode = (props) => {\n const { id, data } = props;\n const audioNode = audioNodes.get(id);\n if (!audioNode) {\n console.error(`Audio node #${id} does not exist`);\n return;\n }\n const { loading, error, node } = audioNode;\n\n if (loading) {\n console.error(`Audio node #${id} is yet not loaded`);\n return;\n }\n\n if (error) {\n console.error(`Audio node #${id} is in error state: ${error.toString()}`);\n return;\n }\n\n node.destroy && node.destroy();\n\n //disconnect all ports\n Object.values(node.inputs || {}).forEach(\n ({ port }) =>\n port instanceof AudioNode && port.disconnect && port.disconnect(),\n );\n\n Object.values(node.outputs || {}).forEach(\n ({ port }) =>\n port instanceof AudioNode && port.disconnect && port.disconnect(),\n );\n\n audioNodes.delete(id);\n };\n\n const unregisterAudioNodes: UnregisterAudioNodes = (nodes) => {\n return nodes.map(unregisterAudioNode);\n };\n\n const registerAudioConnection: RegisterAudioConnection = (edge) => {\n const { source, sourceHandle, target, targetHandle, id } = edge;\n const { node: sourceNode } = audioNodes.get(source) || {};\n\n if (!sourceNode) {\n console.error(`can't find source node ${source}`);\n return;\n }\n if (!sourceHandle) {\n console.error(`source handle is not defined in node ${source}`);\n return;\n }\n const outputNode = sourceNode.outputs?.[sourceHandle];\n const outputNodePort = outputNode?.port;\n\n const { node: targetNode } = audioNodes.get(target) || {};\n if (!targetNode) {\n console.error(`can't find target node ${targetNode}`);\n return;\n }\n if (!targetHandle) {\n console.error(`source handle is not defined in node ${sourceNode}`);\n return;\n }\n const inputNode = targetNode.inputs?.[targetHandle];\n const inputNodePort = inputNode?.port;\n\n if (!outputNodePort) {\n console.error(`Can't find output port: ${source}:${sourceHandle}`);\n return;\n }\n\n if (!inputNodePort) {\n console.error(`Can't find input port: ${target}:${targetHandle}`);\n return;\n }\n\n const isInputNode = inputNodePort instanceof AudioNode;\n const isInputParam = inputNodePort instanceof AudioParam;\n const isInputArray = inputNodePort instanceof Array;\n const isInputSimple = isInputNode || isInputParam;\n\n const isOutputNode = outputNodePort instanceof AudioNode;\n const isOutputArray = outputNodePort instanceof Array;\n\n if (isOutputNode && isInputSimple) {\n //@ts-ignore inputNode can actually be AudioParam\n outputNodePort.connect(inputNodePort);\n } else if (isOutputNode && isInputArray) {\n outputNodePort.connect(inputNodePort[0], 0, inputNodePort[1]);\n } else if (isOutputArray && isInputSimple) {\n //@ts-ignore inputNode can actually be AudioParam\n outputNodePort[0].connect(inputNodePort, outputNodePort[1]);\n } else if (isOutputArray && isInputArray) {\n outputNodePort[0].connect(\n inputNodePort[0],\n outputNodePort[1],\n inputNodePort[1],\n );\n } else {\n console.log(outputNodePort, inputNodePort);\n console.error(`ports can be only AudioNode or AudioNodeChannel`);\n }\n\n audioConnections.set(id, { output: outputNode, input: inputNode });\n };\n\n const registerAudioConnections: RegisterAudioConnections = (edges) => {\n return edges.map(registerAudioConnection);\n };\n\n const unregisterAudioConnection: UnregisterAudioConnection = (edge) => {\n const { id, data } = edge;\n const audioConnection = audioConnections.get(id);\n if (!audioConnection) {\n console.error(`can't find connection with id: ${id}`);\n return;\n }\n\n const {\n input: { port: inputNodePort },\n output: { port: outputNodePort },\n } = audioConnection;\n const isInputNode = inputNodePort instanceof AudioNode;\n const isInputParam = inputNodePort instanceof AudioParam;\n const isInputArray = inputNodePort instanceof Array;\n const isInputSimple = isInputNode || isInputParam;\n\n const isOutputNode = outputNodePort instanceof AudioNode;\n const isOutputArray = outputNodePort instanceof Array;\n\n if (isOutputNode && isInputSimple) {\n //@ts-ignore inputNode can actually be AudioParam\n outputNodePort.disconnect(inputNodePort);\n } else if (isOutputNode && isInputArray) {\n outputNodePort.disconnect(inputNodePort[0], 0, inputNodePort[1]);\n } else if (isOutputArray && isInputSimple) {\n //@ts-ignore inputNode can actually be AudioParam\n outputNodePort[0].disconnect(inputNodePort, outputNodePort[1]);\n } else if (isOutputArray && isInputArray) {\n outputNodePort[0].disconnect(\n inputNodePort[0],\n outputNodePort[1],\n inputNodePort[1],\n );\n } else {\n console.log(outputNodePort, inputNodePort);\n throw new Error(\n `output port can not be only AudioNode or AudioNodeChannel`,\n );\n }\n audioConnections.delete(id);\n };\n\n const unregisterAudioConnections: UnregisterAudioConnections = (edges) => {\n return edges.map(unregisterAudioConnection);\n };\n\n return {\n audioContext,\n audioNodes,\n registerAudioNode,\n registerAudioNodes,\n unregisterAudioNode,\n unregisterAudioNodes,\n audioConnections,\n registerAudioConnection,\n registerAudioConnections,\n unregisterAudioConnection,\n unregisterAudioConnections,\n };\n};\n\nexport default createPatch;\n","import type { CreateWNAudioNode } from \"@web-noise/core\";\n\nexport interface AudioNodeTypes\n extends Record<string, CreateWNAudioNode | false> {}\n\nexport type GetAudioNodeType = (type: string) => CreateWNAudioNode | false;\nexport const audioNodeTypes: AudioNodeTypes = {};\n\nexport const setAudioNodeTypes = (newAudioNodeTypes: AudioNodeTypes) => {\n Object.assign(audioNodeTypes, newAudioNodeTypes);\n};\n\nexport const getAudioNodeType: GetAudioNodeType = (type) =>\n audioNodeTypes[type];\n","module.exports = \"abe416d54e6a969f\";","export const DRAG_HANDLE_CLASS = \"web-noise-drag-handle\";\nexport const DRAG_HANDLE_SELECTOR = `.${DRAG_HANDLE_CLASS}`;\n\nexport const CONTROL_PANEL_GRID_CONFIG = {\n rowHeight: 10,\n cols: 4,\n};\n\nexport enum PortType {\n Gate = \"gate\",\n Number = \"number\",\n Audio = \"audio\",\n Any = \"any\",\n}\n","import { WNNode } from \"../types\";\n\nconst generateNodeId = (node?: Partial<WNNode>): WNNode[\"id\"] => {\n const random = +new Date() + Math.floor(Math.random() * 1000);\n if (!node?.type) {\n return random.toString();\n }\n return `${node.type}-${random}`;\n};\n\nexport default generateNodeId;\n","import {\n addEdge,\n applyEdgeChanges,\n applyNodeChanges,\n OnConnect,\n OnEdgesChange,\n OnNodesChange,\n NodeTypes,\n} from \"reactflow\";\nimport { StateCreator } from \"zustand\";\nimport { DRAG_HANDLE_SELECTOR } from \"../constants\";\nimport type { WNNode, WNNodeData, WNEdge, GraphState } from \"../types\";\n\n//@TODO: rename to NodesStore\nexport interface NodesState {\n nodes: WNNode[];\n edges: WNEdge[];\n onNodesChange: OnNodesChange;\n onEdgesChange: OnEdgesChange;\n onConnect: OnConnect;\n addNode: (node: WNNode) => void;\n setNodes: (nodes: WNNode[]) => void;\n setEdges: (edges: WNEdge[]) => void;\n setNodesAndEdges: (elements: GraphState) => void;\n getNodesAndEdges: () => GraphState;\n clearElements: () => void;\n getNode: (id: string) => WNNode | null;\n updateNodeData: (id: string, data: Partial<WNNodeData>) => void;\n nodeTypes: NodeTypes;\n setNodeTypes: (nodeTypes: NodeTypes) => void;\n}\n\nconst nodesStateCreator: StateCreator<NodesState> = (set, get) => ({\n nodes: [],\n edges: [],\n onNodesChange: (changes) => {\n set(({ nodes }) => ({\n nodes: applyNodeChanges(changes, nodes).map((node) => ({\n dragHandle: DRAG_HANDLE_SELECTOR,\n ...node,\n })),\n }));\n },\n onEdgesChange: (changes) => {\n set(({ edges }) => ({\n edges: applyEdgeChanges(changes, edges),\n }));\n },\n onConnect: (connection) => {\n set(({ edges }) => ({\n edges: addEdge(connection, edges),\n }));\n },\n addNode: (node) => {\n set(({ nodes }) => ({\n nodes: nodes.concat(node),\n }));\n },\n setNodes: (nodes) => {\n set({\n nodes,\n });\n },\n setEdges: (edges) => {\n set({\n edges,\n });\n },\n setNodesAndEdges: ({ nodes, edges }) => {\n set({\n nodes,\n edges,\n });\n },\n getNodesAndEdges: () => {\n const { nodes, edges } = get();\n return { nodes, edges };\n },\n clearElements: () => {\n set({\n nodes: [],\n edges: [],\n });\n },\n getNode: (id) => {\n const { nodes } = get();\n const node = nodes.find((node) => node.id === id);\n return node || null;\n },\n updateNodeData: (id, data) => {\n set(({ nodes }) => {\n return {\n nodes: nodes.map((node) => {\n if (node.id === id) {\n return {\n ...node,\n data: {\n ...node.data,\n ...data,\n },\n };\n }\n\n return node;\n }),\n };\n });\n },\n nodeTypes: {},\n setNodeTypes: (nodeTypes) => set({ nodeTypes }),\n});\n\nexport default nodesStateCreator;\n","import type { StateCreator } from \"zustand\";\nimport type { StoreState } from \"../\";\nimport * as jsondiffpatch from \"jsondiffpatch\";\nimport type { Delta, FilterContext } from \"jsondiffpatch\";\n\nexport interface HistoryState {\n history: {\n maxHistoryLength: number;\n buffer: Array<Delta>;\n pointer: number;\n skipCollect: boolean;\n push: (changes: Delta) => void;\n back: () => void;\n forward: () => void;\n clear: () => void;\n };\n}\n\nconst cloneObject = <T = unknown>(input: T): T => {\n return JSON.parse(JSON.stringify(input));\n};\n\nexport const historyStateCreator: StateCreator<HistoryState> = (set, get) => ({\n history: {\n maxHistoryLength: 5,\n buffer: [],\n pointer: 0,\n skipCollect: false,\n push: (changes: Delta) => {\n const { history } = get();\n const { maxHistoryLength, skipCollect } = history;\n\n if (skipCollect) {\n set({\n history: {\n ...history,\n skipCollect: false,\n },\n });\n return;\n }\n\n set(({ history }) => {\n if (!history) {\n return {};\n }\n const { buffer, pointer } = history;\n\n const newBuffer = buffer.slice(\n Math.max(pointer - maxHistoryLength + 1, 0),\n pointer,\n );\n\n return {\n history: {\n ...history,\n buffer: [...newBuffer, changes],\n pointer: Math.min(pointer + 1, maxHistoryLength),\n },\n };\n });\n },\n back: () => {\n const { nodes, edges, controlPanel, history } = get() as StoreState;\n const { buffer, pointer } = history;\n\n const patchData = buffer[pointer - 1];\n if (!patchData) {\n return;\n }\n\n const reversedPatchData = jsondiffpatch.reverse(patchData);\n if (!reversedPatchData) {\n return;\n }\n\n const updates = cloneObject({\n nodes,\n edges,\n controlPanel,\n });\n\n const patch = jsondiffpatch.patch(updates, reversedPatchData);\n\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer - 1,\n skipCollect: true,\n },\n });\n },\n forward: () => {\n const { nodes, edges, controlPanel, history } = get() as StoreState;\n const { buffer, pointer } = history;\n\n const patchData = buffer[pointer];\n if (!patchData) {\n return;\n }\n\n const updates = cloneObject({\n nodes,\n edges,\n controlPanel,\n });\n\n const patch = jsondiffpatch.patch(updates, patchData);\n\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer + 1,\n skipCollect: true,\n },\n });\n },\n // @TODO: remove this method and store history per file\n clear: () => {\n const { history } = get();\n set({\n history: {\n ...history,\n buffer: [],\n pointer: 0,\n skipCollect: true,\n },\n });\n },\n },\n});\n\nconst COLLECT_CHANGES_DEBOUNCE_TIME = 500;\n\nexport const createChangesCollector = (set: any, get: () => StoreState) => {\n const jsondiffpatchInstance = jsondiffpatch.create({\n propertyFilter: (name: string, context: FilterContext) => {\n //@TODO: rework this function, find better solution\n if (context.parent?.parent?.childName === \"controlPanel\") {\n return true;\n }\n if (\n // @ts-ignore\n [\"data\", \"position\", \"controlPanel\"].includes(context.parent?.childName)\n ) {\n return true;\n }\n return [\n \"controlPanel\",\n \"size\",\n \"edges\",\n\n \"nodes\",\n \"data\",\n \"label\",\n \"config\",\n \"values\",\n\n \"position\",\n \"x\",\n \"y\",\n ].includes(name);\n },\n });\n let oldState: StoreState | null = get();\n let timer: any;\n\n return (state: StoreState, prevState: StoreState) => {\n if (state.currentFileIndex !== prevState.currentFileIndex) {\n get().history.clear();\n }\n clearTimeout(timer);\n if (!oldState) {\n oldState = prevState;\n }\n timer = setTimeout(() => {\n const changes = jsondiffpatchInstance.diff(oldState, state);\n oldState = null;\n\n if (changes) {\n get().history.push(changes);\n }\n }, COLLECT_CHANGES_DEBOUNCE_TIME);\n };\n};\n\ntype StoreStateCreator = StateCreator<StoreState>;\n\nconst history =\n (config: StoreStateCreator): StoreStateCreator =>\n (set, get, api) => {\n const collectChanges = createChangesCollector(set, get);\n api.subscribe(collectChanges);\n return config((...args) => set(...args), get, api);\n };\n\nexport default history;\n","import { createPatch, Patch } from \"@web-noise/patch\";\nimport type { StateCreator } from \"zustand\";\nimport type { StoreState } from \"../\";\nimport { compareGraphs } from \"./compareGraphs\";\n\ntype StoreStateCreator = StateCreator<StoreState>;\nexport interface AudioPatchState {\n patch: Patch;\n nodesState: Record<string, any>;\n}\n\nexport const audioPatchStateCreator: StateCreator<AudioPatchState> = (\n set,\n get,\n) => ({\n patch: createPatch(),\n nodesState: {},\n});\n\nconst audioPatch =\n (config: StoreStateCreator): StoreStateCreator =>\n (set, get, api) => {\n api.subscribe(async (state, prevState) => {});\n\n const promises = new Set<Promise<unknown>>();\n\n let currentState = {\n ...get(),\n nodes: [],\n edges: [],\n };\n\n return config(\n async (...args) => {\n const oldState = get();\n const [storeChanges] = args;\n\n //@ts-ignore\n const newState = {\n ...currentState,\n ...(typeof storeChanges === \"function\"\n ? storeChanges({ ...currentState })\n : storeChanges),\n };\n\n const nodeChanges = compareGraphs(currentState.nodes, newState.nodes);\n const edgeChanges = compareGraphs(currentState.edges, newState.edges);\n\n //@ts-ignore\n currentState = newState;\n\n const newNodes = nodeChanges.added;\n const newEdges = edgeChanges.added;\n const removedEdges = edgeChanges.removed;\n const removedNodes = nodeChanges.removed;\n\n const { patch } = oldState;\n\n if (newNodes.length) {\n const promise = patch.registerAudioNodes(\n //@ts-ignore\n newNodes,\n );\n promises.add(promise);\n await promise;\n promises.delete(promise);\n }\n\n if (!(newEdges.length || removedEdges.length || removedNodes.length)) {\n set(...args);\n return;\n }\n\n if (promises.size) {\n try {\n await Promise.all([...promises.values()]);\n } catch (e) {\n console.log(\"some error\", e);\n }\n }\n\n if (newEdges.length) {\n patch.registerAudioConnections(\n //@ts-ignore\n newEdges,\n );\n }\n\n if (removedEdges.length) {\n //@ts-ignore\n patch.unregisterAudioConnections(removedEdges);\n }\n\n if (removedNodes.length) {\n //@ts-ignore\n patch.unregisterAudioNodes(removedNodes);\n }\n\n set(...args);\n },\n get,\n api,\n );\n };\n\nexport default audioPatch;\n","import { WNEdge, WNNode } from \"../../types\";\n\nexport type GraphItems = Array<WNNode | WNEdge>;\n\nexport interface GraphComparisonResult {\n added: GraphItems;\n removed: GraphItems;\n}\n\nexport const compareGraphs = (\n left: GraphItems,\n right: GraphItems,\n): GraphComparisonResult => {\n const setLeft = new Set(left.map((item) => item.id));\n const setRight = new Set(right.map((item) => item.id));\n\n const added = right.filter((item) => !setLeft.has(item.id));\n const removed = left.filter((item) => !setRight.has(item.id));\n\n return { added, removed };\n};\n","import { StateCreator } from \"zustand\";\nimport type { EditorState, Project, ProjectFile } from \"../types\";\nimport type { StoreState } from \"./\";\n\nexport interface ProjectState {\n project: Project;\n setProject: (project: Project) => void;\n getProject: () => Project;\n\n pullEditorChanges: () => void;\n\n //@TODO: move inside project\n currentFileIndex: number;\n setCurrentFileIndex: (index: number) => void;\n\n updateFileContent: (fileIndex: number, file: ProjectFile) => void;\n updateFileName: (fileIndex: number, fileName: string) => void;\n addFile: (file: ProjectFile, name?: string) => void;\n deleteFile: (fileIndex: number) => void;\n}\n\nconst projectStateCreator: StateCreator<ProjectState> = (set, get) => ({\n project: { files: [] },\n setProject(project) {\n set({ project, currentFileIndex: 0 });\n },\n getProject() {\n return get().project;\n },\n\n pullEditorChanges() {\n const { getEditorState, currentFileIndex, updateFileContent, project } =\n get() as StoreState;\n const currentFile = project.files[currentFileIndex];\n updateFileContent(currentFileIndex, {\n ...currentFile,\n file: getEditorState(),\n });\n },\n\n currentFileIndex: 0,\n setCurrentFileIndex(newFileIndex) {\n const { currentFileIndex } = get();\n if (newFileIndex === currentFileIndex) {\n return;\n }\n set({ currentFileIndex: newFileIndex });\n },\n\n updateFileContent(index, file) {\n const { project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i) => {\n if (i === index) {\n return {\n // @TODO check again if merging is really needed here\n ...f,\n ...file,\n };\n }\n return f;\n }),\n },\n });\n },\n updateFileName(index, fileName) {\n const { project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i) => {\n if (i === index) {\n return {\n ...f,\n name: fileName,\n };\n }\n return f;\n }),\n },\n });\n },\n addFile(file) {\n const { project } = get();\n const files = [...project.files, file];\n set({\n project: {\n ...project,\n files,\n },\n currentFileIndex: files.length - 1,\n });\n },\n deleteFile: (fileIndex) => {\n const { project, currentFileIndex } = get();\n\n set({\n project: {\n ...project,\n files: project.files.filter((_, index) => fileIndex !== index),\n },\n });\n\n if (fileIndex <= currentFileIndex) {\n set({ currentFileIndex: currentFileIndex - 1 });\n }\n },\n});\n\nexport default projectStateCreator;\n","import { injectGlobal } from \"@emotion/css\";\nimport theme from \"./theme\";\n\ninjectGlobal`\n .react-flow {\n .react-flow__pane {\n /* background: rgb(106 106 106); */\n /* background: \"white\"; */\n // background: #292d39;\n background: ${theme.colors.elevation3};\n }\n\n .react-flow__background {\n /* background: #efefef; */\n stroke: white;\n }\n\n .react-flow__node-default {\n background: #292d39;\n color: white;\n border: none;\n /* background: transparent; */\n }\n\n .react-flow__node {\n padding: 0;\n width: auto;\n }\n\n .react-flow__edge-path {\n stroke: ${theme.colors.accent2};\n }\n\n .react-flow__node.selected {\n border: 1px solid ${theme.colors.accent2};\n box-shadow: 0 0 0 0.5px #${theme.colors.accent2};\n }\n\n .react-flow__node-default.selected, .react-flow__node-default.selected:hover {\n box-shadow: 0 0 0 0.5px #${theme.colors.accent2};\n }\n\n /* .react-flow__minimap-mask {\n fill: ${theme.colors.elevation1}\n }\n\n .react-flow__minimap-node {\n fill:${theme.colors.accent2}\n } */\n }\n\n`;\n","const LEVA_COLOR_ACCENT2_BLUE = \"#007bff\";\nconst COLOR_GREEN_PRIMARY = \"#14df42\";\nconst COLOR_WHITE_PRIMARY = \"#ffffff\";\n\nconst colors = <const>{\n elevation1: \"#292d39\", // bg color of the root panel (main title bar)\n elevation2: \"#181c20\", // bg color of the rows (main panel color)\n elevation3: \"#373c4b\", // bg color of the inputs\n accent1: \"#0066dc\",\n accent2: LEVA_COLOR_ACCENT2_BLUE,\n accent3: \"#3c93ff\",\n highlight1: \"#535760\",\n highlight2: \"#8c92a4\",\n highlight3: \"#fefefe\",\n vivid1: COLOR_GREEN_PRIMARY,\n whitePrimary: COLOR_WHITE_PRIMARY,\n error: \"#db5353\",\n};\n\nconst zIndex = <const>{\n modal: 9998,\n controlPanel: 9999,\n resumeContextLayout: 10003,\n};\n\nconst theme = {\n colors,\n zIndex,\n};\n\nexport type Theme = typeof theme;\n\nexport default theme;\n","import {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport ReactFlow, {\n Background,\n BackgroundVariant,\n Controls,\n MiniMap,\n ReactFlowInstance,\n ReactFlowProvider,\n useOnViewportChange,\n} from \"reactflow\";\nimport \"reactflow/dist/style.css\";\nimport useStore from \"../../store\";\nimport type { EditorState, PluginConfig } from \"../../types\";\nimport EdgeContextMenu, {\n useEdgeContextMenu,\n} from \"../contextMenu/EdgeContextMenu\";\nimport EditorContextMenu, {\n useEditorContextMenu,\n} from \"../contextMenu/EditorContextMenu\";\nimport NodeContextMenu, {\n useNodeContextMenu,\n} from \"../contextMenu/NodeContextMenu\";\nimport ControlPanel from \"../ControlPanel\";\nimport { HelpButton, HelpModal } from \"../Help\";\nimport ResumeContext from \"../ResumeContext\";\nimport ToggleMinimap from \"../ToggleMinimap\";\nimport Wire from \"../Wire\";\n\nconst onNodeDragStop = (_event: any, node: any) =>\n console.log(\"drag stop\", node);\nconst onNodeClick = (_event: any, element: any) =>\n console.log(\"click\", element);\n\nconst snapGrid: [number, number] = [20, 20];\n\ninterface EditorProps {\n editorState?: EditorState;\n plugins?: Array<PluginConfig>;\n editorContextMenu?: Array<ReactNode>;\n onChange?: ({ nodes, edges, controlPanel }: EditorState) => void;\n}\n\nexport const EditorPane = ({\n editorState,\n plugins = [],\n editorContextMenu = [],\n onChange = () => {},\n}: EditorProps) => {\n const edgeTypes = useMemo(\n () => ({\n wire: Wire,\n }),\n [],\n );\n\n const {\n nodes,\n edges,\n controlPanel,\n onNodesChange,\n onNodesDelete,\n onEdgesChange,\n onEdgesDelete,\n onConnect,\n setEditorState,\n setPlugins,\n setViewport,\n viewport,\n } = useStore();\n\n const editorConfig = useStore(({ config }) => config);\n\n const nodeTypes = useStore(({ nodeTypes }) => nodeTypes);\n\n useEffect(() => {\n setPlugins(plugins);\n }, [plugins]);\n\n useEffect(() => {\n if (editorState) {\n setEditorState(editorState);\n }\n }, [editorState, setEditorState]);\n\n const [reactflowInstance, setReactflowInstance] =\n useState<ReactFlowInstance | null>(null);\n\n useEffect(() => {\n if (!reactflowInstance) {\n return;\n }\n onChange({\n nodes,\n edges,\n controlPanel,\n viewport,\n });\n }, [nodes, edges, controlPanel, viewport]);\n\n const onInit = useCallback(\n (rfi: ReactFlowInstance) => {\n if (!reactflowInstance) {\n setReactflowInstance(rfi);\n console.log(\"flow loaded:\", rfi);\n }\n },\n [reactflowInstance],\n );\n\n const { onContextMenu: onEditorContextMenu } = useEditorContextMenu();\n const { onContextMenu: onNodeContextMenu } = useNodeContextMenu();\n const { onContextMenu: onEdgeContextMenu } = useEdgeContextMenu();\n\n useEffect(() => {\n if (!viewport) {\n return;\n }\n reactflowInstance?.setViewport(viewport);\n }, [viewport, reactflowInstance]);\n\n useOnViewportChange({\n onEnd: setViewport,\n });\n\n return (\n <ReactFlow\n nodes={nodes}\n edges={edges}\n onNodesChange={onNodesChange}\n onNodesDelete={onNodesDelete}\n onEdgesChange={onEdgesChange}\n onConnect={onConnect}\n onNodeDragStop={onNodeDragStop}\n onEdgesDelete={onEdgesDelete}\n onInit={onInit}\n onNodeClick={onNodeClick}\n onContextMenu={onEditorContextMenu}\n onNodeContextMenu={onNodeContextMenu}\n onEdgeContextMenu={onEdgeContextMenu}\n nodeTypes={nodeTypes}\n edgeTypes={edgeTypes}\n snapGrid={snapGrid}\n defaultViewport={editorState?.viewport}\n defaultEdgeOptions={{ type: \"wire\" }}\n snapToGrid\n fitView\n disableKeyboardA11y\n >\n <Background variant={BackgroundVariant.Dots} gap={12} />\n {editorConfig.showMinimap ? <MiniMap /> : null}\n\n <Controls\n style={{\n right: \"1rem\",\n left: \"initial\",\n bottom: \"40%\",\n top: \"initial\",\n }}\n showInteractive={false}\n >\n <ToggleMinimap />\n <HelpButton />\n </Controls>\n\n <ResumeContext />\n <ControlPanel />\n <HelpModal />\n <EditorContextMenu editorContextMenu={editorContextMenu} />\n <NodeContextMenu />\n <EdgeContextMenu />\n </ReactFlow>\n );\n};\n\nexport const Editor = (props: EditorProps) => (\n <ReactFlowProvider>\n <EditorPane {...props} />\n </ReactFlowProvider>\n);\n\nexport default Editor;\n","import { useCallback } from \"react\";\nimport { useContextMenu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\nexport const MENU_ID = \"editor-edge-menu\";\n\nexport const useEdgeContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n const onContextMenu = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>, edge: unknown) => {\n event.stopPropagation();\n show(event, { props: { edge } });\n },\n [show],\n );\n\n return { onContextMenu };\n};\n\nconst EdgeContextMenu = () => {\n const theme = useTheme();\n\n const removeEdges = useStore((store) => store.removeEdges);\n\n return (\n <>\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper onClick={(event) => removeEdges([event.props.edge])}>\n Delete Edge (DEL)\n </ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default EdgeContextMenu;\n","import { useTheme as useEmotionTheme } from \"@emotion/react\";\nimport type { Theme } from '../theme';\n\nconst useTheme = () => {\n return useEmotionTheme() as Theme;\n}\n\nexport default useTheme;\n","import styled from \"@emotion/styled\";\nimport { Item, Menu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { Theme } from \"../../theme\";\n\n\nexport const ItemWrapper = styled(Item)``;\n\nexport const MenuWrapper = styled(Menu)<{ colors: Theme[\"colors\"] }>`\n background: ${({ colors }) => colors.elevation2};\n padding: 0;\n border-radius: 0;\n\n .react-contexify__item__content {\n color: ${({ colors }) => colors.whitePrimary};\n }\n\n .react-contexify__separator {\n background-color: ${({ colors }) => colors.elevation1};\n margin: 0;\n }\n`;\n","import downloadFile from \"js-file-download\";\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Separator, useContextMenu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { useReactFlow, type XYPosition } from \"reactflow\";\nimport hotkeys from \"hotkeys-js\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport AddNode from \"../AddNode\";\nimport UploadPatch from \"../UploadPatch\";\nimport UploadProject from \"../UploadProject\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\ntype MousePosition = {\n x: number;\n y: number;\n};\n\nexport const MENU_ID = \"editor-menu\";\n\nexport const useEditorContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n return { onContextMenu: show };\n};\n\nconst EditorContextMenu = ({\n editorContextMenu = [],\n}: {\n editorContextMenu?: Array<ReactNode>;\n}) => {\n const theme = useTheme();\n\n const [mousePosition, setMousePosition] = useState<MousePosition>({\n x: 0,\n y: 0,\n });\n const [showAddNode, setShowAddNode] = useState(false);\n const [showUploadPatch, setShowUploadPatch] = useState(false);\n const [showUploadProject, setShowUploadProject] = useState(false);\n\n const addNodeHandler = useCallback(\n (x: number, y: number) => {\n setMousePosition({ x, y });\n setShowAddNode(true);\n },\n [setShowAddNode],\n );\n\n const pasteBuffer = useStore((store) => store.pasteBuffer);\n const { screenToFlowPosition } = useReactFlow();\n const pasteBufferHandler = useCallback(\n (mousePosition: XYPosition) => {\n const { x, y } = screenToFlowPosition(mousePosition);\n pasteBuffer(x, y);\n },\n [setShowAddNode, screenToFlowPosition],\n );\n\n const clearGraph = useStore(({ clearGraph }) => clearGraph);\n\n const getEditorState = useStore((store) => store.getEditorState);\n const getProject = useStore((store) => store.getProject);\n\n const deleteAllHandler = useCallback(() => {\n clearGraph();\n }, [clearGraph]);\n\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n const historyBack = useStore((store) => store.history.back);\n const historyForward = useStore((store) => store.history.forward);\n const historyPointer = useStore((store) => store.history.pointer);\n const historyBuffer = useStore((store) => store.history.buffer);\n\n const copySelectedItems = useStore((store) => store.copySelectedItems);\n const nodes = useStore((store) => store.nodes);\n const selectedNodes = useMemo(\n () => nodes.filter(({ selected }) => selected),\n [nodes],\n );\n const currentCopyBuffer = useStore((store) => store.copyBuffer);\n\n const reactFlowInstance = useReactFlow();\n\n const downloadPatchHandler = useCallback(() => {\n const fileName = \"web-noise-patch.json\";\n const editorState = getEditorState();\n const data = {\n ...editorState,\n };\n downloadFile(JSON.stringify(data, null, 2), fileName);\n }, [getEditorState, reactFlowInstance]);\n\n const downloadProjectHandler = useCallback(() => {\n const fileName = \"web-noise-project.json\";\n const projectState = getProject();\n const data = {\n ...projectState,\n };\n downloadFile(JSON.stringify(data, null, 2), fileName);\n }, [getEditorState, reactFlowInstance]);\n\n useEffect(() => {\n hotkeys(\"command+shift+a\", () => {\n addNodeHandler(200, 50);\n return false;\n });\n //@TODO: find more elegant way to handle ?\n hotkeys(\"shift+/\", () => {\n toggleHelp();\n return false;\n });\n hotkeys(\"command+z\", () => {\n historyBack();\n return false;\n });\n hotkeys(\"command+shift+z\", () => {\n historyForward();\n return false;\n });\n hotkeys(\"command+c\", () => {\n copySelectedItems();\n return false;\n });\n hotkeys(\"command+v\", () => {\n pasteBufferHandler({ x: 200, y: 50 });\n return false;\n });\n return () => {\n hotkeys.unbind();\n };\n }, [addNodeHandler, pasteBufferHandler]);\n\n return (\n <>\n <AddNode\n isOpen={showAddNode}\n closeMenu={() => setShowAddNode(false)}\n mousePosition={mousePosition}\n />\n <UploadPatch\n isOpen={showUploadPatch}\n closeMenu={() => setShowUploadPatch(false)}\n />\n <UploadProject\n isOpen={showUploadProject}\n closeMenu={() => setShowUploadProject(false)}\n />\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper\n onClick={({ triggerEvent: { clientX, clientY } }) =>\n addNodeHandler(clientX, clientY)\n }\n >\n Add Node (⌘+⇧+A)\n </ItemWrapper>\n <Separator />\n <ItemWrapper onClick={deleteAllHandler}>Delete All</ItemWrapper>\n <Separator />\n <ItemWrapper onClick={downloadPatchHandler}>Download patch</ItemWrapper>\n <ItemWrapper onClick={() => setShowUploadPatch(true)}>\n Upload patch\n </ItemWrapper>\n <Separator />\n <ItemWrapper onClick={downloadProjectHandler}>\n Download project\n </ItemWrapper>\n <ItemWrapper onClick={() => setShowUploadProject(true)}>\n Upload project\n </ItemWrapper>\n <Separator />\n <ItemWrapper disabled={historyPointer === 0} onClick={historyBack}>\n Undo (⌘+z)\n </ItemWrapper>\n <ItemWrapper\n disabled={historyPointer === historyBuffer.length}\n onClick={historyForward}\n >\n Redo (⌘+⇧+Z)\n </ItemWrapper>\n <Separator />\n <ItemWrapper\n disabled={!selectedNodes.length}\n onClick={copySelectedItems}\n >\n Copy Selected (⌘+c)\n </ItemWrapper>\n <ItemWrapper\n disabled={!currentCopyBuffer.nodes.length}\n onClick={({ triggerEvent: { clientX: x, clientY: y } }) =>\n pasteBufferHandler({ x, y })\n }\n >\n Paste (⌘+v)\n </ItemWrapper>\n <Separator />\n {editorContextMenu.map((item, index) => (\n <ItemWrapper key={index}>{item}</ItemWrapper>\n ))}\n <Separator />\n <ItemWrapper onClick={toggleHelp}>Help (⇧+?)</ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default EditorContextMenu;\n","import styled from \"@emotion/styled\";\nimport { MouseEvent, useCallback, useState } from \"react\";\nimport { Position, useReactFlow } from \"reactflow\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginComponent } from \"../../types\";\nimport Modal from \"../Modal\";\nimport Filters, { FiltersState } from \"./Filters\";\nimport Plugins from \"./Plugins\";\n\ninterface AddNodeProps {\n isOpen: boolean;\n closeMenu: () => void;\n mousePosition: MousePosition;\n}\n\ntype MousePosition = {\n x: number;\n y: number;\n};\n\nconst AddNodeWrapper = styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n display: flex;\n gap: 1rem;\n`;\n\nconst PluginsPanel = styled.div<{ theme: Theme }>`\n flex-grow: 1;\n height: 100%;\n overflow-y: scroll;\n`;\n\nconst AddNode = ({ isOpen, closeMenu, mousePosition }: AddNodeProps) => {\n const theme = useTheme();\n const { screenToFlowPosition } = useReactFlow();\n\n const { createNode } = useStore(({ createNode }) => ({\n createNode,\n }));\n\n const [filtersState, setFiltersState] = useState<FiltersState>({});\n\n const onComponentClick = useCallback(\n ({ type }: PluginComponent) => {\n const { x, y } = screenToFlowPosition(mousePosition);\n const newNode = {\n //@TODO: generate node id in `createNode` function\n id: `${type}-${+new Date()}`,\n type,\n data: { label: type },\n position: {\n x,\n y,\n },\n targetPosition: Position.Left,\n sourcePosition: Position.Right,\n };\n createNode(newNode);\n closeMenu();\n },\n [mousePosition, screenToFlowPosition, createNode, closeMenu, mousePosition],\n );\n\n return isOpen ? (\n <Modal\n onClose={() => {\n closeMenu();\n setFiltersState({});\n }}\n >\n <AddNodeWrapper theme={theme}>\n <Filters onChange={setFiltersState} value={filtersState} />\n <PluginsPanel theme={theme}>\n <Plugins\n filters={filtersState}\n onComponentClick={(component) => {\n onComponentClick(component);\n setFiltersState({});\n }}\n />\n </PluginsPanel>\n </AddNodeWrapper>\n </Modal>\n ) : null;\n};\n\nexport default AddNode;\n","import styled from \"@emotion/styled\";\nimport { type ReactNode, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport useTheme from \"../hooks/useTheme\";\nimport { Theme } from \"../theme\";\n\nconst ModalOuter = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: ${({ theme }) => theme.zIndex.modal};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: ${({ theme }) => theme.colors.elevation3}cc;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst ModalInner = styled.div<{ theme: Theme }>`\n background: ${({ theme }) => theme.colors.elevation2};\n box-shadow: 1px 1px 1px 1px ${({ theme }) => theme.colors.elevation1};\n color: white;\n width: 70%;\n height: 80%;\n overflow-y: scroll;\n position: relative;\n`;\n\nconst ModalCloser = styled(CloseIcon)<{ theme: Theme }>`\n position: absolute;\n top: 0.2rem;\n right: 0.2rem;\n cursor: pointer;\n`;\n\ninterface ModalProps {\n onClose?: () => void;\n children: ReactNode;\n}\n\nconst Modal = ({ children, onClose, ...props }: ModalProps) => {\n const theme = useTheme();\n\n useEffect(() => {\n const escHandler = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n onClose?.();\n }\n };\n document.addEventListener(\"keydown\", escHandler);\n return () => {\n document.removeEventListener(\"keydown\", escHandler);\n };\n }, [onClose]);\n\n return createPortal(\n <ModalOuter theme={theme} onClick={onClose}>\n <ModalInner\n {...props}\n onClick={(e) => {\n e.stopPropagation();\n }}\n theme={theme}\n >\n {children}\n <ModalCloser theme={theme} onClick={onClose} />\n </ModalInner>\n </ModalOuter>,\n document.body,\n );\n};\n\nexport default Modal;\n","import styled from \"@emotion/styled\";\nimport { useEffect, useRef } from \"react\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\n\nconst InputWrapper = styled.div`\n display: flex;\n position: relative;\n`;\n\nconst InputInner = styled.input<{ theme: Theme }>`\n padding-right: 2rem;\n padding-left: 0.3rem;\n width: 100%;\n appearance: textfield;\n font-size: inherit;\n background: none;\n border: none;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n appearance: textfield;\n cursor: auto;\n background-color: ${({ theme }) => theme.colors.elevation3};\n border-radius: 0.1rem;\n height: 2rem;\n color: ${({ theme }) => theme.colors.highlight2};\n\n &:focus,\n &:hover {\n box-shadow: 0 0 0 var(--leva-borderWidths-focus)\n ${({ theme }) => theme.colors.accent2};\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin-right: 1rem;\n }\n`;\n\nconst FiltersWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n padding: 0.6rem;\n gap: 0.6rem;\n border-right: 1px solid ${({ theme }) => theme.colors.elevation3};\n min-width: 14rem;\n`;\n\nconst PluginName = styled.label<{ theme: Theme }>`\n user-select: none;\n input {\n display: none;\n }\n input:checked + span {\n color: ${({ theme }) => theme.colors.accent2};\n }\n &:hover {\n color: ${({ theme }) => theme.colors.accent3};\n cursor: pointer;\n }\n`;\n\nexport interface FiltersState {\n search?: string;\n plugin?: string | null;\n}\n\ninterface FiltersProps {\n value: FiltersState;\n onChange: (filters: FiltersState) => void;\n}\n\nconst Filters = ({ onChange, value }: FiltersProps) => {\n const theme = useTheme();\n const plugins = useStore(({ plugins }) => plugins);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!inputRef.current) {\n return;\n }\n inputRef.current.focus();\n }, [inputRef]);\n\n return (\n <FiltersWrapper theme={theme}>\n <InputWrapper>\n <InputInner\n ref={inputRef}\n theme={theme}\n value={value.search || \"\"}\n placeholder=\"search...\"\n onChange={(event) =>\n onChange({ ...value, search: event.target.value })\n }\n />\n </InputWrapper>\n {plugins.map(({ name, components }, index) => {\n if (!name) {\n return null;\n }\n return (\n <PluginName theme={theme} key={index}>\n <input\n type=\"checkbox\"\n name=\"plugin\"\n value={name}\n checked={name === value.plugin}\n onChange={() => {\n onChange({\n ...value,\n plugin: name === value.plugin ? null : name,\n });\n }}\n />\n <span>{name}</span>\n </PluginName>\n );\n })}\n </FiltersWrapper>\n );\n};\n\nexport default Filters;\n","import styled from \"@emotion/styled\";\nimport { useMemo } from \"react\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginComponent } from \"../../types\";\nimport { FiltersState } from \"./Filters\";\nimport { withTheme } from \"@emotion/react\";\n\nconst PluginsWrapper = withTheme(styled.div<{ theme: Theme }>`\n width: 100%;\n`);\n\nconst PluginWrapper = withTheme(styled.div<{ theme: Theme }>`\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n`);\n\nconst NodesList = withTheme(styled.ul<{ theme: Theme }>`\n list-style: none;\n margin: 0;\n padding: 0;\n padding-bottom: 10px;\n columns: 2;\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid ${({ theme }) => theme.colors.elevation3};\n border-radius: 4px;\n margin-bottom: 0.5rem;\n &:hover {\n border-color: ${({ theme }) => theme.colors.accent2};\n cursor: pointer;\n }\n }\n`);\n\nconst NodeTitle = withTheme(styled.div<{ theme: Theme }>`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`);\n\nconst NodeDescription = withTheme(styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.highlight2};\n font-size: 12px;\n`);\n\nconst PluginHeader = withTheme(styled.div<{ theme: Theme }>``);\n\nconst PluginTitle = withTheme(styled.div<{ theme: Theme }>`\n font-size: 1.1rem;\n padding: 0.25rem 0;\n color: ${({ theme }) => theme.colors.highlight3};\n`);\n\nconst PluginDescription = withTheme(styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.highlight2};\n font-size: 12px;\n`);\n\ninterface PluginsProps {\n filters: FiltersState;\n onComponentClick: (component: PluginComponent) => void;\n}\n\nconst Plugins = ({\n onComponentClick,\n filters: { plugin, search },\n}: PluginsProps) => {\n const plugins = useStore(({ plugins }) => plugins);\n\n const pluginsGroup = useMemo(() => {\n if (!plugin) {\n return plugins;\n }\n return plugins.filter(({ name }) => name === plugin);\n // return plugins.filter(({ type }) => type === )\n }, [plugins, plugin]);\n\n const filteredPlugins = useMemo(() => {\n if (!search) {\n return pluginsGroup;\n }\n return pluginsGroup.map((plugin) => ({\n ...plugin,\n components: plugin.components.filter(\n ({ type, name }) =>\n type.toLocaleLowerCase().includes(search.toLocaleLowerCase()) ||\n name?.toLocaleLowerCase().includes(search.toLocaleLowerCase()),\n ),\n }));\n }, [pluginsGroup, search]);\n\n return (\n <PluginsWrapper>\n {filteredPlugins.map(({ name, description, components }, index) => {\n if (!components.length) {\n return null;\n }\n return (\n <PluginWrapper key={index}>\n <PluginHeader>\n <PluginTitle>{name}</PluginTitle>\n <PluginDescription>{description}</PluginDescription>\n </PluginHeader>\n <NodesList>\n {components\n .sort((a, b) =>\n a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1,\n )\n .map((component, idx) => (\n <li onClick={() => onComponentClick(component)} key={idx}>\n <NodeTitle>{component.name || component.type}</NodeTitle>\n {component.description && (\n <NodeDescription>{component.description}</NodeDescription>\n )}\n </li>\n ))}\n </NodesList>\n </PluginWrapper>\n );\n })}\n </PluginsWrapper>\n );\n};\n\nexport default Plugins;\n","import styled from \"@emotion/styled\";\nimport { MouseEvent, useCallback, useState, useRef, ChangeEvent } from \"react\";\nimport { FileDrop } from \"react-file-drop\";\nimport { FaFileUpload } from \"react-icons/fa\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\nimport { Theme } from \"../theme\";\nimport Modal from \"./Modal\";\n\ninterface UploadPatchProps {\n isOpen: boolean;\n closeMenu: () => void;\n}\n\nconst UploadPatchWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme }) => theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\n\nconst DropZoneInner = styled.div<{ theme: Theme }>`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\n\nconst FileUploadIcon = styled(FaFileUpload)`\n width: 100%;\n height: 8rem;\n`;\n\nconst FileUploadMessage = styled.div`\n font-size: 2rem;\n`;\n\nconst UploadPatch = ({ isOpen, closeMenu }: UploadPatchProps) => {\n const theme = useTheme();\n\n const setGraph = useStore(({ setGraph }) => setGraph);\n const setEditorState = useStore((store) => store.setEditorState);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const uploadFile = useCallback(\n (files: FileList | null) => {\n const [file] = files || [];\n file\n .text()\n .then(JSON.parse)\n .then((editorState) => {\n setEditorState(editorState);\n closeMenu();\n })\n .catch(console.error);\n },\n [setGraph, closeMenu],\n );\n\n const onTargetClick = () => {\n fileInputRef.current?.click();\n };\n\n return isOpen ? (\n <Modal onClose={closeMenu}>\n <UploadPatchWrapper theme={theme}>\n <input\n onChange={({ target: { files } }) => uploadFile(files)}\n ref={fileInputRef}\n type=\"file\"\n className=\"hidden\"\n style={{ display: \"none\" }}\n accept=\".json\"\n />\n <FileDrop\n className=\"drop-zone-wrapper\"\n targetClassName=\"drop-zone\"\n draggingOverTargetClassName=\"drop-zone-drag-over\"\n onTargetClick={onTargetClick}\n onDrop={(files) => uploadFile(files)}\n >\n <DropZoneInner theme={theme}>\n <FileUploadIcon />\n <FileUploadMessage>click or drop file here</FileUploadMessage>\n </DropZoneInner>\n </FileDrop>\n </UploadPatchWrapper>\n </Modal>\n ) : null;\n};\n\nexport default UploadPatch;\n","import styled from \"@emotion/styled\";\nimport { useCallback, useRef } from \"react\";\nimport { FileDrop } from \"react-file-drop\";\nimport { FaFileUpload } from \"react-icons/fa\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\nimport { Theme } from \"../theme\";\nimport Modal from \"./Modal\";\n\ninterface UploadProjectProps {\n isOpen: boolean;\n closeMenu: () => void;\n}\n\nconst UploadProjectWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme }) => theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\n\nconst DropZoneInner = styled.div<{ theme: Theme }>`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\n\nconst FileUploadIcon = styled(FaFileUpload)`\n width: 100%;\n height: 8rem;\n`;\n\nconst FileUploadMessage = styled.div`\n font-size: 2rem;\n`;\n\n// @TODO: unify with upload file\nconst UploadProject = ({ isOpen, closeMenu }: UploadProjectProps) => {\n const theme = useTheme();\n\n const setProject = useStore((store) => store.setProject);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const uploadFile = useCallback(\n (files: FileList | null) => {\n const [file] = files || [];\n file\n .text()\n .then(JSON.parse)\n .then((projectState) => {\n setProject(projectState);\n closeMenu();\n })\n .catch(console.error);\n },\n [setProject, closeMenu],\n );\n\n const onTargetClick = () => {\n fileInputRef.current?.click();\n };\n\n return isOpen ? (\n <Modal onClose={closeMenu}>\n <UploadProjectWrapper theme={theme}>\n <input\n onChange={({ target: { files } }) => uploadFile(files)}\n ref={fileInputRef}\n type=\"file\"\n className=\"hidden\"\n style={{ display: \"none\" }}\n accept=\".json\"\n />\n <FileDrop\n className=\"drop-zone-wrapper\"\n targetClassName=\"drop-zone\"\n draggingOverTargetClassName=\"drop-zone-drag-over\"\n onTargetClick={onTargetClick}\n onDrop={(files) => uploadFile(files)}\n >\n <DropZoneInner theme={theme}>\n <FileUploadIcon />\n <FileUploadMessage>click or drop file here</FileUploadMessage>\n </DropZoneInner>\n </FileDrop>\n </UploadProjectWrapper>\n </Modal>\n ) : null;\n};\n\nexport default UploadProject;\n","import { useCallback } from \"react\";\nimport { useContextMenu, PredicateParams } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { WNNode } from \"../../types\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\nexport const MENU_ID = \"editor-node-menu\";\n\nexport const useNodeContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n const onContextMenu = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>, node: unknown) => {\n event.stopPropagation();\n show(event, { props: { node } });\n },\n [],\n );\n\n return { onContextMenu };\n};\n\nconst NodeContextMenu = (args: unknown) => {\n const theme = useTheme();\n\n const removeNodes = useStore((store) => store.removeNodes);\n const addNodeToControlPanel = useStore(\n (store) => store.addNodeToControlPanel,\n );\n const removeNodeFromControlPanel = useStore(\n (store) => store.removeNodeFromControlPanel,\n );\n const copy = useStore((store) => store.copy);\n const nodesConfiguration = useStore((store) => store.nodesConfiguration);\n const controlPanelNodes = useStore((store) => store.controlPanel.nodes);\n\n const isOnControlPanel = useCallback(\n ({ props }: PredicateParams<{ node: WNNode }>) => {\n if (!props?.node.type) {\n return false;\n }\n return !!controlPanelNodes.find(({ id }) => id === props.node.id);\n },\n [controlPanelNodes],\n );\n\n const hasControlPanelNode = useCallback(\n ({ props }: PredicateParams<{ node: WNNode }>) => {\n if (!props?.node.type) {\n return false;\n }\n const nodeConfiguration = nodesConfiguration[props.node.type];\n return !!nodeConfiguration?.controlPanelNode;\n },\n [nodesConfiguration],\n );\n\n return (\n <>\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper onClick={(event) => removeNodes([event.props.node])}>\n Delete Node (DEL)\n </ItemWrapper>\n <ItemWrapper\n hidden={(...args) =>\n !hasControlPanelNode(...args) || isOnControlPanel(...args)\n }\n onClick={(event) => addNodeToControlPanel(event.props.node)}\n >\n Add To Control Panel\n </ItemWrapper>\n <ItemWrapper\n hidden={(...args) =>\n !hasControlPanelNode(...args) || !isOnControlPanel(...args)\n }\n onClick={(event) => removeNodeFromControlPanel(event.props.node)}\n >\n Remove From Control Panel\n </ItemWrapper>\n <ItemWrapper\n onClick={(event) => copy({ nodes: [event.props.node], edges: [] })}\n >\n Copy (⌘+c)\n </ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default NodeContextMenu;\n","import styled from \"@emotion/styled\";\nimport { Resizable } from \"re-resizable\";\nimport { useMemo, useRef, useState } from \"react\";\nimport GridLayout from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport {\n AiFillLock as LockIcon,\n AiFillUnlock as UnlockIcon,\n} from \"react-icons/ai\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport { RxDashboard as ControlPanelIcon } from \"react-icons/rx\";\nimport Drawer from \"react-modern-drawer\";\nimport \"react-modern-drawer/dist/index.css\";\nimport { CONTROL_PANEL_GRID_CONFIG } from \"../../constants\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport ControlPanelItem from \"./ControlPanelItem\";\nimport { IconsBar, IconWrapper, PanelTitle, TitleBarWrapper } from \"./styles\";\n\nconst ControlPanelIconWrapper = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: 5;\n box-shadow: 0px 1px 2px ${({ theme }) => theme.colors.elevation2};\n left: 1rem;\n top: 4rem;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${({ theme }) => theme.colors.elevation1};\n color: ${({ theme }) => theme.colors.highlight1};\n\n :hover {\n color: ${({ theme }) => theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n\nconst ControlPanelIconsBar = styled(IconsBar)`\n height: 80%;\n`;\n\nconst CloseIconWrapper = styled(IconWrapper)`\n font-size: 1rem;\n display: flex;\n align-items: center;\n`;\n\nconst ControlPanelHeader = styled(TitleBarWrapper)<{ theme: Theme }>`\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid ${({ theme }) => theme.colors.elevation3};\n font-size: 0.7rem;\n`;\n\nconst ControlPanelTitle = styled(PanelTitle)`\n text-align: center;\n`;\n\nconst ControlPanelWrapper = styled.div`\n height: 100%;\n width: 100%;\n padding: 0.3rem 0.4rem;\n box-sizing: border-box;\n`;\n\nconst ControlPanelBody = styled.div<{ theme: Theme }>`\n height: auto;\n padding: 0;\n max-height: 95vh;\n overflow-y: scroll;\n border: 1px solid ${({ theme }) => theme.colors.elevation3};\n`;\n\nconst ControlPanelSettings = styled.div`\n padding: 1rem 0;\n font-family: var(--leva-fonts-mono);\n font-size: 0.8rem;\n`;\n\nconst LockGridWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.highlight2};\n }\n`;\n\nconst GridResizeHandle = styled.div<{ theme: Theme }>`\n position: absolute;\n height: 1rem;\n top: 0;\n bottom: 0;\n margin: auto;\n left: 0.5rem;\n border-right: 1px solid ${({ theme }) => theme.colors.whitePrimary};\n`;\n\nconst ControlPanelItemWrapper = styled.div<{ theme: Theme }>`\n box-sizing: border-box;\n overflow: hidden;\n .react-resizable-handle:after {\n border-color: ${({ theme }) => theme.colors.whitePrimary};\n border-width: 1px;\n }\n`;\n\nconst ControlPanel = () => {\n const theme = useTheme();\n const nodeRef = useRef(null);\n const nodes = useStore((store) => store.nodes);\n const {\n show,\n nodes: controlPanelNodes,\n size,\n } = useStore((store) => store.controlPanel);\n\n const { width = 200, height } = size;\n\n const filteredNodes = useMemo(() => {\n const nodeIds = controlPanelNodes.map(({ id }) => id);\n return nodes.filter(({ id }) => nodeIds.includes(id));\n }, [nodes, controlPanelNodes]);\n\n const showControlPanel = useStore((store) => store.showControlPanel);\n const hideControlPanel = useStore((store) => store.hideControlPanel);\n const setControlPanelNodes = useStore((store) => store.setControlPanelNodes);\n const setControlPanelSize = useStore((store) => store.setControlPanelSize);\n const removeNodeFromControlPanel = useStore(\n (store) => store.removeNodeFromControlPanel,\n );\n\n const [isGridLocked, setGridLocked] = useState(true);\n\n const layout = useMemo(() => {\n const fallbackY = controlPanelNodes.reduce(\n (acc, { height = CONTROL_PANEL_GRID_CONFIG.rowHeight, x, y = 0 }) => {\n const Y = y + height;\n return Y > acc ? Y : acc;\n },\n 0,\n );\n return controlPanelNodes.map(({ id: i, width, height, x, y }) => {\n return {\n i,\n w: width || CONTROL_PANEL_GRID_CONFIG.cols,\n h: height || 6,\n x: x ?? 0,\n y: y ?? fallbackY,\n };\n });\n }, [controlPanelNodes]);\n\n if (!filteredNodes.length) {\n return null;\n }\n\n return (\n <>\n <ControlPanelIconWrapper\n theme={theme}\n ref={nodeRef}\n onClick={showControlPanel}\n >\n <ControlPanelIcon />\n </ControlPanelIconWrapper>\n <Drawer\n open={show}\n onClose={hideControlPanel}\n direction=\"left\"\n className=\"\"\n size=\"auto\"\n enableOverlay={false}\n style={{\n background: theme.colors.elevation1,\n position: \"absolute\",\n }}\n >\n <ControlPanelHeader theme={theme}>\n <ControlPanelTitle>Control Panel</ControlPanelTitle>\n <ControlPanelIconsBar>\n <CloseIconWrapper onClick={hideControlPanel} theme={theme}>\n <CloseIcon />\n </CloseIconWrapper>\n </ControlPanelIconsBar>\n </ControlPanelHeader>\n\n <ControlPanelWrapper>\n <ControlPanelSettings>\n {isGridLocked ? (\n <LockGridWrapper\n theme={theme}\n onClick={() => setGridLocked(false)}\n >\n <LockIcon />\n Unlock grid\n </LockGridWrapper>\n ) : (\n <LockGridWrapper\n theme={theme}\n onClick={() => setGridLocked(true)}\n >\n <UnlockIcon />\n Lock grid\n </LockGridWrapper>\n )}\n </ControlPanelSettings>\n <Resizable\n enable={{\n top: false,\n right: !isGridLocked,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false,\n }}\n handleComponent={{\n right: <GridResizeHandle theme={theme} />,\n }}\n minWidth={120}\n size={{ width, height: \"auto\" }}\n onResizeStop={(e, direction, ref, d) => {\n setControlPanelSize({\n width: width + d.width,\n height: height + d.height,\n });\n }}\n >\n <ControlPanelBody theme={theme}>\n {/* @ts-ignore */}\n <GridLayout\n layout={layout}\n className=\"layout\"\n cols={CONTROL_PANEL_GRID_CONFIG.cols}\n rowHeight={CONTROL_PANEL_GRID_CONFIG.rowHeight}\n width={width}\n margin={[0, 0]}\n isResizable={!isGridLocked}\n draggableHandle=\".grid-item-handle\"\n onLayoutChange={(nodes) => {\n requestAnimationFrame(() => {\n setControlPanelNodes(\n nodes.map(({ i, w, h, x, y }) => ({\n id: i,\n width: w,\n height: h,\n x,\n y,\n })),\n );\n });\n }}\n >\n {filteredNodes.map((node) => {\n return (\n <ControlPanelItemWrapper key={node.id} theme={theme}>\n <ControlPanelItem\n node={node}\n showControls={!isGridLocked}\n onDelete={removeNodeFromControlPanel}\n />\n </ControlPanelItemWrapper>\n );\n })}\n </GridLayout>\n </ControlPanelBody>\n </Resizable>\n </ControlPanelWrapper>\n </Drawer>\n </>\n );\n};\n\nexport default ControlPanel;\n","import { useMemo } from \"react\";\n\nimport styled from \"@emotion/styled\";\nimport \"react-grid-layout/css/styles.css\";\nimport { MdDragHandle as DragIcon } from \"react-icons/md\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport useAudioNode from \"../../hooks/useAudioNode\";\nimport useNode from \"../../hooks/useNode\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { WNNode, ControlPanelNodeProps } from \"../../types\";\nimport { IconsBar, IconWrapper, PanelTitle, TitleBarWrapper } from \"./styles\";\n\nconst ControlPanelNodeWrapper = styled.div<{ theme: Theme }>`\n height: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n`;\n\nconst PanelNode = (props: ControlPanelNodeProps) => {\n const { node } = props;\n\n const getControlPanelNode = useStore((store) => store.getControlPanelNode);\n\n const ControlPanelNode = useMemo(() => getControlPanelNode(node), [node]);\n\n if (!ControlPanelNode) {\n return null;\n }\n\n return <ControlPanelNode {...props} />;\n};\n\ninterface ControlPanelItemProps {\n node: WNNode;\n showControls: boolean;\n onDelete: (node: WNNode) => void;\n}\n\nconst ControlPanelItem = (props: ControlPanelItemProps) => {\n const { node, showControls, onDelete } = props;\n const theme = useTheme();\n\n const { id } = node;\n const { node: audioNode } = useAudioNode(id) || {};\n const { updateNodeValues } = useNode(id);\n\n return (\n <ControlPanelNodeWrapper theme={theme}>\n <TitleBarWrapper theme={theme}>\n <PanelTitle>{node.data.label}</PanelTitle>\n {showControls && (\n <IconsBar>\n <IconWrapper theme={theme}>\n <DragIcon className=\"grid-item-handle\" />\n </IconWrapper>\n <IconWrapper theme={theme}>\n <CloseIcon onClick={() => onDelete(node)} />\n </IconWrapper>\n </IconsBar>\n )}\n </TitleBarWrapper>\n <PanelNode\n node={node}\n audioNode={audioNode}\n updateNodeValues={updateNodeValues}\n />\n </ControlPanelNodeWrapper>\n );\n};\n\nexport default ControlPanelItem;\n","import { AudioNodeState } from \"@web-noise/patch\";\nimport useStore from \"../store\";\nimport type { WNAudioNode } from \"../types\";\n\nconst useAudioNode = <T = WNAudioNode>(id: string) => {\n const patch = useStore(({ patch }) => patch);\n return patch.audioNodes.get(id) as AudioNodeState<T> | undefined;\n};\n\nexport default useAudioNode;\n","import { useCallback } from \"react\";\nimport useStore from \"../store\";\nimport { WNNodeData } from \"../types\";\n\nconst useNode = (id: string) => {\n const updateNodeData = useStore(({ updateNodeData }) => updateNodeData);\n\n const updateNodeValues = useCallback(\n (values: WNNodeData[\"values\"]) => updateNodeData(id, { values }),\n [id, updateNodeData]\n );\n const updateNodeConfig = useCallback(\n (config: WNNodeData[\"config\"]) => updateNodeData(id, { config }),\n [id, updateNodeData]\n );\n const updateNodeLabel = useCallback(\n (label: string) => updateNodeData(id, { label }),\n [id, updateNodeData]\n );\n\n return {\n updateNodeValues,\n updateNodeConfig,\n updateNodeLabel,\n };\n};\n\nexport default useNode;\n","import styled from \"@emotion/styled\";\nimport \"react-grid-layout/css/styles.css\";\nimport { Theme } from \"../../theme\";\nimport { TitleBar } from \"../Node\";\n\nexport const PanelTitle = styled.div`\n width: 100%;\n padding: 0.4rem 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nexport const TitleBarWrapper = styled(TitleBar)<{ theme: Theme }>`\n display: flex;\n gap: 0.1rem;\n padding: 0 0.4rem;\n justify-content: start;\n font-size: 0.6rem;\n height: auto;\n min-width: 0;\n`;\n\nexport const IconsBar = styled.div`\n display: flex;\n align-items: center;\n height: 70%;\n width: auto;\n gap: 0.4rem;\n`;\n\nexport const IconWrapper = styled.span<{ theme: Theme }>`\n width: auto;\n height: 100%;\n cursor: pointer;\n svg {\n width: auto;\n height: 100%;\n }\n &:hover {\n color: ${({ theme }) => theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n","import styled from \"@emotion/styled\";\nimport { withTheme } from \"@emotion/react\";\nimport { Resizable } from \"re-resizable\";\nimport { ComponentProps, useMemo, useState } from \"react\";\nimport {\n MdSettings as SettingsIcon,\n MdInfoOutline as InfoIcon,\n} from \"react-icons/md\";\nimport { Handle, HandleProps, NodeProps, Position } from \"reactflow\";\nimport { DRAG_HANDLE_CLASS, PortType } from \"../../constants\";\nimport useAudioNode from \"../../hooks/useAudioNode\";\nimport useNode from \"../../hooks/useNode\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { AudioPort, WNNodeData } from \"../../types\";\nimport EditableLabel from \"../EditableLabel\";\nimport NodeInfoModal from \"../NodeInfoModal\";\n\nconst NodeWrapper = styled.div`\n background-color: var(--leva-colors-elevation1);\n`;\n\nconst NodeLoaderWrapper = styled(NodeWrapper)`\n padding: 2rem 5rem;\n`;\n\nconst NodeErrorWrapper = styled(NodeWrapper)`\n padding: 1rem 2rem;\n`;\n\nconst SettingsIconWrapper = styled(SettingsIcon)`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\n\nconst InfoIconWrapper = styled(InfoIcon)`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\n\nconst Section = styled.div`\n position: relative;\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n background-color: var(--leva-colors-elevation1);\n`;\n\nexport const TitleBarInner = styled(Section)`\n display: flex;\n height: var(--leva-sizes-titleBarHeight);\n touch-action: none;\n align-items: center;\n justify-content: center;\n flex: 1 1 0%;\n color: var(--leva-colors-highlight1);\n padding: 0 0.4rem;\n gap: 0.3rem;\n`;\n\nexport const PortsPanel = styled(Section)<{ theme: Theme }>(\n ({ theme }) => `\n display: grid;\n grid-template-areas: \"inputs outputs\";\n background: ${theme.colors.elevation2};\n border-bottom: 1px solid ${theme.colors.elevation1};\n color: ${theme.colors.highlight3};\n font-size: 0.6rem;\n`,\n);\n\nexport const InputPorts = styled.div`\n grid-area: inputs;\n text-align: left;\n`;\n\nexport const OutputPorts = styled.div`\n grid-area: outputs;\n text-align: right;\n`;\n\nexport const Port = styled.div`\n position: relative;\n padding: 5px 10px;\n`;\n\nconst portColors = {\n [PortType.Audio]: \"#4ade80\", // vibrant green\n [PortType.Gate]: \"#c084fc\", // rich purple\n [PortType.Number]: \"#38bdf8\", // bright blue\n [PortType.Any]: \"#fb923c\", // warm orange\n};\n\nconst StyledHandle = withTheme(styled(Handle, {\n shouldForwardProp: (prop) => prop !== \"portType\",\n})<{ portType?: AudioPort[\"type\"]; theme: Theme }>`\n --port-color: ${(props) => {\n if (!props.portType) return props.theme.colors.highlight2;\n if (Array.isArray(props.portType)) {\n const colors = props.portType.map((type) => portColors[type]);\n return `linear-gradient(0.25turn, ${colors.join(\", \")});`;\n } else {\n return portColors[props.portType];\n }\n }};\n border-color: var(--port-color);\n background: var(--port-color);\n box-shadow: 0px 0px 0px 1px ${({ theme }) => theme.colors.elevation2} inset;\n`);\n\nconst StyledInputHandle = withTheme(styled(StyledHandle)`\n left: -3px;\n`);\n\nexport const InputHandle = ({\n ...props\n}: Partial<HandleProps & ComponentProps<typeof StyledInputHandle>>) => (\n <StyledInputHandle {...props} type=\"target\" position={Position.Left} />\n);\n\nexport const StyledOutputHandle = withTheme(styled(StyledHandle)`\n right: -3px;\n`);\n\nexport const OutputHandle = (\n props: Partial<HandleProps & ComponentProps<typeof StyledOutputHandle>>,\n) => <StyledOutputHandle {...props} type=\"source\" position={Position.Right} />;\n\nexport type WNNodeProps<T = Record<string, unknown>> = NodeProps<\n T & WNNodeData\n>;\n\nexport interface TitleBarProps {\n className?: string;\n [key: string]: unknown;\n}\n\nexport const TitleBar = ({ className, ...props }: TitleBarProps) => (\n <TitleBarInner\n {...props}\n className={[className, DRAG_HANDLE_CLASS].join(\" \")}\n />\n);\n\nexport interface WNNodeParameters extends NodeProps {\n children?: any;\n}\n\nconst useNodeManifest = (type: string) => {\n const data = useStore((store) => store.nodesConfiguration[type]);\n\n return data;\n};\n\nconst useConfigNode = (type: string) => {\n const { configNode: ConfigNode } = useNodeManifest(type);\n\n return {\n ConfigNode,\n };\n};\n\nexport const WNNode = (props: WNNodeParameters) => {\n const { id, children, selected, ...rest } = props;\n const theme = useTheme();\n const getNode = useStore(({ getNode }) => getNode);\n const nodesConfiguration = useStore((store) => store.nodesConfiguration);\n\n const [isInfoModalShown, setIsInfoModalShown] = useState(false);\n\n const { info } = useNodeManifest(props.type);\n\n const isResizeable = useMemo(\n () => nodesConfiguration[props.type].resizable ?? false,\n [nodesConfiguration, props.type],\n );\n\n const { updateNodeLabel, updateNodeConfig } = useNode(id);\n const { data } = getNode(id) || {};\n const audioNode = useAudioNode(id);\n const { ConfigNode } = useConfigNode(rest.type);\n\n const [configMode, setShowConfigMode] = useState(false);\n\n if (!audioNode) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n can't find audio node\n </NodeLoaderWrapper>\n );\n }\n\n if (audioNode.loading) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n loading\n </NodeLoaderWrapper>\n );\n }\n\n if (audioNode.error) {\n return (\n <NodeErrorWrapper className={DRAG_HANDLE_CLASS}>\n error: {audioNode.error.toString()}\n </NodeErrorWrapper>\n );\n }\n\n if (!audioNode.node) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n can't find audio node\n </NodeLoaderWrapper>\n );\n }\n\n const size = data?.config?.size as\n | { width: number; height: number }\n | undefined;\n\n const {\n node: { inputs, outputs },\n } = audioNode;\n\n return (\n <NodeWrapper>\n <TitleBar>\n {info && (\n <InfoIconWrapper onClickCapture={() => setIsInfoModalShown(true)} />\n )}\n <EditableLabel\n value={data?.label ?? \"No Name\"}\n onChange={updateNodeLabel}\n />\n {ConfigNode && (\n <SettingsIconWrapper\n onClickCapture={() => setShowConfigMode((isShown) => !isShown)}\n />\n )}\n </TitleBar>\n <PortsPanel theme={theme}>\n <InputPorts>\n {inputs\n ? Object.keys(inputs).map((key, index) => (\n <Port key={index}>\n <InputHandle id={key} portType={inputs[key].type} />\n <span>{key}</span>\n </Port>\n ))\n : null}\n </InputPorts>\n <OutputPorts>\n {outputs\n ? Object.keys(outputs).map((key, index) => (\n <Port key={index}>\n <OutputHandle id={key} portType={outputs[key].type} />\n <span>{key}</span>\n </Port>\n ))\n : null}\n </OutputPorts>\n </PortsPanel>\n {ConfigNode && configMode && selected ? (\n <ConfigNode {...props} />\n ) : isResizeable ? (\n <Resizable\n size={size}\n minWidth={180}\n minHeight={30}\n enable={{\n bottom: true,\n bottomRight: true,\n right: true,\n }}\n onResizeStop={(e, direction, ref, d) => {\n const newSize = size\n ? {\n width: size.width + d.width,\n height: size.height + d.height,\n }\n : ref.getBoundingClientRect();\n updateNodeConfig({\n ...data?.config,\n size: newSize,\n });\n }}\n >\n {children}\n </Resizable>\n ) : (\n children\n )}\n <NodeInfoModal\n isOpen={isInfoModalShown}\n type={props.type}\n onClose={() => setIsInfoModalShown(false)}\n node={audioNode.node}\n />\n </NodeWrapper>\n );\n};\n","import styled from \"@emotion/styled\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport const TitleBarLabel = styled.input`\n width: 100%;\n background: none;\n border: none;\n text-align: center;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n\n &:focus {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-within {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-vissible {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:not([readonly]):focus {\n color: #fff;\n appearance: none;\n cursor: auto;\n background-color: var(--leva-colors-elevation2);\n padding: 0.3rem;\n border-radius: 0.2rem;\n }\n`;\n\ninterface EditableLabelProps {\n onChange: (value: string) => void;\n value?: string;\n className?: string;\n}\n\nconst EditableLabel = ({\n onChange,\n value = \"\",\n className,\n}: EditableLabelProps) => {\n const labelInputRef = useRef<HTMLInputElement>(null);\n\n const [labelEditMode, setLabelEditMode] = useState(false);\n const editNodeLabel = useCallback(\n (event: React.MouseEvent) => {\n //@ts-ignore\n event.target?.select();\n setLabelEditMode(true);\n },\n [setLabelEditMode],\n );\n\n const exitEditMode = useCallback(() => {\n window.getSelection()?.collapseToEnd();\n setLabelEditMode(false);\n }, [setLabelEditMode]);\n\n const saveNodeLabel = useCallback(() => {\n exitEditMode();\n if (labelInputRef.current) {\n onChange(labelInputRef.current.value);\n }\n }, [labelInputRef, exitEditMode, onChange]);\n\n const cancelNodeLabelEdit = useCallback(() => {\n exitEditMode();\n if (labelInputRef.current && value) {\n labelInputRef.current.value = value;\n }\n }, [labelInputRef, exitEditMode, value]);\n\n useEffect(() => {\n if (!labelInputRef.current) {\n return;\n }\n labelInputRef.current.value = value;\n }, [value, labelInputRef]);\n\n return (\n <TitleBarLabel\n ref={labelInputRef}\n type=\"text\"\n readOnly={!labelEditMode}\n onDoubleClick={(event) => editNodeLabel(event)}\n onBlur={saveNodeLabel}\n onKeyDown={(event) => {\n switch (event.key) {\n case \"Escape\":\n cancelNodeLabelEdit();\n break;\n case \"Enter\":\n saveNodeLabel();\n break;\n }\n }}\n className={className}\n />\n );\n};\n\nexport default EditableLabel;\n","import styled from \"@emotion/styled\";\nimport Modal from \"./Modal\";\nimport { marked } from \"marked\";\nimport useStore from \"../store\";\nimport { withTheme } from \"@emotion/react\";\nimport { useMemo } from \"react\";\nimport { WNAudioNode } from \"../types\";\nimport { Theme } from \"../theme\";\n\ninterface NodeInfoModalProps {\n isOpen: boolean;\n onClose: () => void;\n type: string;\n node: WNAudioNode;\n}\n\nconst NodeInfoWrapper = withTheme(styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n overflow: scroll;\n padding: 0.6rem;\n box-sizing: border-box;\n\n hr {\n border: none;\n border-bottom: 1px solid ${({ theme }) => theme.colors.elevation3};\n }\n\n code {\n background-color: ${({ theme }) => theme.colors.elevation3};\n color: ${({ theme }) => theme.colors.highlight3};\n font-family:\n source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n }\n\n pre {\n background-color: ${({ theme }) => theme.colors.elevation3};\n padding: 0.2rem 0.3rem;\n border-radius: 1px;\n }\n\n a {\n color: ${({ theme }) => theme.colors.accent1};\n }\n`);\n\nconst useNodeManifest = (type: string) => {\n const data = useStore((store) => store.nodesConfiguration[type]);\n return data;\n};\n\nconst NodeInfoModal = ({\n isOpen,\n onClose,\n type: nodeType,\n node,\n}: NodeInfoModalProps) => {\n const { info, portsDescription } = useNodeManifest(nodeType);\n\n const portsInfo = useMemo(() => {\n const parts: string[] = [];\n\n const inputPorts = node.inputs;\n if (inputPorts) {\n parts.push(`## Inputs`);\n for (const portName in inputPorts) {\n const port = inputPorts[portName];\n parts.push(`### *${portName}*`);\n\n const description = portsDescription?.inputs?.[portName];\n\n if (description) {\n parts.push(description);\n }\n\n if (Array.isArray(port.type)) {\n parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n } else {\n parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n }\n\n if (port.range) {\n parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n }\n\n if (port.defaultValue !== undefined) {\n parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n }\n\n const outputPorts = node.outputs;\n if (outputPorts) {\n parts.push(`## Outputs`);\n for (const portName in outputPorts) {\n const port = outputPorts[portName];\n parts.push(`### *${portName}*`);\n\n const description = portsDescription?.outputs?.[portName];\n\n if (description) {\n parts.push(description);\n }\n\n if (Array.isArray(port.type)) {\n parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n } else {\n parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n }\n\n if (port.range) {\n parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n }\n\n if (port.defaultValue !== undefined) {\n parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n }\n return parts.join(\"\\n\\n\");\n }, [node, portsDescription]);\n\n const combinedInfo = (info || \"\") + \"\\n\\n\" + portsInfo;\n\n return isOpen ? (\n <Modal onClose={onClose}>\n <NodeInfoWrapper\n dangerouslySetInnerHTML={{ __html: marked(combinedInfo || \"\") }}\n />\n </Modal>\n ) : null;\n};\n\nexport default NodeInfoModal;\n","import { FaQuestion } from \"react-icons/fa\";\nimport { ControlButton } from \"reactflow\";\nimport useStore from \"../../store\";\nimport HelpModal from './HelpModal';\n\n\nconst HelpButton = () => {\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n return (\n <>\n <ControlButton onClick={toggleHelp}>\n <FaQuestion />\n </ControlButton>\n </>\n );\n};\n\nexport { HelpModal, HelpButton };\n\n","import { withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\n// @ts-ignore\nimport { marked } from \"marked\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport Modal from \"../Modal\";\n\n//@ts-ignore\nimport HELP from \"bundle-text:./HELP.md\";\n\nconst MdPreview = withTheme(styled.div<{ theme: Theme }>`\n font-family: var(--leva-fonts-mono);\n font-size: 0.7rem;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n overflow: scroll;\n color: ${({ theme }) => theme.colors.whitePrimary};\n padding: 0 0.5rem;\n\n code {\n color: ${({ theme }) => theme.colors.accent3};\n filter: hue-rotate(180deg);\n }\n`);\n\nconst ModalContent = withTheme(styled.div<{ theme: Theme }>`\n padding: 1rem;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n overflow: hidden;\n`);\n\nconst HelpModal = () => {\n const isHelpShown = useStore((store) => store.isHelpShown);\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n if (!isHelpShown) {\n return null;\n }\n\n return (\n <Modal\n onClose={() => {\n toggleHelp();\n }}\n >\n <ModalContent>\n <MdPreview\n dangerouslySetInnerHTML={{ __html: marked(HELP) }}\n onWheelCapture={(event) => event.stopPropagation()}\n ></MdPreview>\n </ModalContent>\n </Modal>\n );\n};\n\nexport default HelpModal;\n","module.exports = \"ecc57e431820aa34\";","import styled from \"@emotion/styled\";\nimport { useState } from \"react\";\nimport { FaVolumeOff as IconUnmute } from \"react-icons/fa\";\nimport useStore from \"../store\";\nimport useTheme from \"../hooks/useTheme\";\nimport { Theme } from \"../theme\";\n\n\nconst Layout = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: ${({ theme }) => theme.zIndex.resumeContextLayout};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgb(24 28 32 / 90%);\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n color: ${({ theme }) => theme.colors.whitePrimary};\n cursor: pointer;\n`;\n\nconst Row = styled.div`\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n`;\n\nconst Message = styled.div<{ theme: Theme }>`\n font-family: var(--leva-fonts-mono);\n font-size: 2rem;\n`;\n\nconst Icon = styled(IconUnmute)`\n width: 7rem;\n height: 7rem;\n`;\n\nconst ResumeContext = () => {\n const theme = useTheme();\n const patch = useStore(({ patch }) => patch);\n const audioContext = patch.audioContext;\n const [isContextResumed, setIsContextResumed] = useState<boolean>(\n audioContext.state === \"running\",\n );\n\n if (isContextResumed) {\n return null;\n }\n\n return (\n <Layout\n theme={theme}\n onClick={() => {\n audioContext.resume();\n setIsContextResumed(true);\n }}\n >\n <Row>\n <Message theme={theme}>Click anywhere to resume audio context</Message>\n </Row>\n <Row>\n <Icon />\n </Row>\n </Layout>\n );\n};\n\nexport default ResumeContext;\n","import { FaMap, FaRegMap } from \"react-icons/fa\";\nimport { ControlButton } from \"reactflow\";\nimport useStore from \"../store\";\n\nconst ToggleMinimap = () => {\n const setConfig = useStore(({ setConfig }) => setConfig);\n const { showMinimap } = useStore(({ config }) => config);\n\n return (\n <ControlButton onClick={() => setConfig({ showMinimap: !showMinimap })}>\n {showMinimap ? <FaMap /> : <FaRegMap />}\n </ControlButton>\n );\n};\n\nexport default ToggleMinimap;\n","import { useEffect, useMemo } from \"react\";\nimport { EdgeProps, getBezierPath, getConnectedEdges } from \"reactflow\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\n\nconst Wire = ({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourcePosition,\n targetPosition,\n style = {},\n data,\n markerStart,\n markerEnd,\n source,\n target,\n sourceHandleId,\n targetHandleId,\n selected,\n}: EdgeProps) => {\n const theme = useTheme();\n const getNode = useStore(({ getNode }) => getNode);\n const sourceNode = getNode(source);\n const targetNode = getNode(target);\n const isConnectedToSelected = sourceNode?.selected || targetNode?.selected;\n useEffect(() => {\n if (!sourceHandleId || !targetHandleId) {\n return;\n }\n console.log(`connected ${source} to ${target}`);\n return () => {\n console.log(`disconnected ${source} from ${target}`);\n };\n }, [source, sourceHandleId, target, targetHandleId]);\n\n const [edgePath] = getBezierPath({\n targetX,\n targetY,\n targetPosition,\n sourceX,\n sourceY,\n sourcePosition,\n });\n\n return (\n <>\n <path\n id={id}\n style={{\n ...style,\n stroke: selected\n ? theme.colors.accent2\n : isConnectedToSelected\n ? theme.colors.highlight3\n : theme.colors.highlight2,\n }}\n className=\"react-flow__edge-path Wire\"\n d={edgePath}\n markerEnd={markerEnd}\n />\n <path\n style={{\n ...style,\n strokeWidth: 8,\n color: \"transparent\",\n opacity: 0,\n cursor: \"pointer\",\n }}\n d={edgePath}\n markerEnd={markerEnd}\n />\n </>\n );\n};\n\nexport default Wire;\n"],"names":["config","jsxs","$djR0r$jsxs","jsx","$djR0r$jsx","Fragment","$djR0r$Fragment","withTheme","$djR0r$withTheme","ThemeProvider","$djR0r$ThemeProvider","Global","$djR0r$Global","css","$djR0r$css","useTheme","$djR0r$useTheme","$djR0r$emotionstyled","nanoid","$djR0r$nanoid","useState","$djR0r$useState","useEffect","$djR0r$useEffect","useMemo","$djR0r$useMemo","useCallback","$djR0r$useCallback","useRef","$djR0r$useRef","FaPlus","$djR0r$FaPlus","MdClose","$djR0r$MdClose","MdDragHandle","$djR0r$MdDragHandle","MdSettings","$djR0r$MdSettings","MdInfoOutline","$djR0r$MdInfoOutline","$djR0r$reactflow","getConnectedEdges","$djR0r$getConnectedEdges","addEdge","$djR0r$addEdge","applyNodeChanges","$djR0r$applyNodeChanges","applyEdgeChanges","$djR0r$applyEdgeChanges","useOnViewportChange","$djR0r$useOnViewportChange","Background","$djR0r$Background","BackgroundVariant","$djR0r$BackgroundVariant","MiniMap","$djR0r$MiniMap","Controls","$djR0r$Controls","ReactFlowProvider","$djR0r$ReactFlowProvider","useReactFlow","$djR0r$useReactFlow","Position","$djR0r$Position","Handle","$djR0r$Handle","ControlButton","$djR0r$ControlButton","getBezierPath","$djR0r$getBezierPath","create","$djR0r$create","reverse","$djR0r$reverse","patch","$djR0r$patch","$djR0r$create1","injectGlobal","$djR0r$injectGlobal","useContextMenu","$djR0r$useContextMenu","Item","$djR0r$Item","Menu","$djR0r$Menu","Separator","$djR0r$Separator","$djR0r$jsfiledownload","$djR0r$hotkeysjs","createPortal","$djR0r$createPortal","FileDrop","$djR0r$FileDrop","FaFileUpload","$djR0r$FaFileUpload","FaQuestion","$djR0r$FaQuestion","FaVolumeOff","$djR0r$FaVolumeOff","FaMap","$djR0r$FaMap","FaRegMap","$djR0r$FaRegMap","Resizable","$djR0r$Resizable","$djR0r$reactgridlayout","AiFillLock","$djR0r$AiFillLock","AiFillUnlock","$djR0r$AiFillUnlock","RxDashboard","$djR0r$RxDashboard","$djR0r$reactmoderndrawer","marked","$djR0r$marked","$parcel$interopDefault","a","__esModule","default","$4165c1239dbc641a$var$customFetchers","$059c7a7b96627b87$export$64e2564cc3ca44e9","$4bc43559bc9437b5$var$dumpNodeWorklet","URL","$9738c58e5420c085$export$956b3cf15d7c363","$9738c58e5420c085$export$21d634b1d5d9bee3","PortType","$9738c58e5420c085$export$b0b7b95ee465c83c","$15640845882b881f$var$cloneObject","input","JSON","parse","stringify","$1efbebe6ffe1c168$export$e364ea0c1dfb25e5","left","right","setLeft","Set","map","item","id","setRight","added","filter","has","removed","$6f5e1924a22d258c$export$2e2bcd8739ae039","args","set","get","nodes","edges","onNodesChange","changes","node","dragHandle","onEdgesChange","onConnect","connection","addNode","concat","setNodes","setEdges","setNodesAndEdges","getNodesAndEdges","clearElements","getNode","find","updateNodeData","data","nodeTypes","setNodeTypes","history","maxHistoryLength","buffer","pointer","skipCollect","push","newBuffer","slice","Math","max","min","back","controlPanel","patchData","reversedPatchData","forward","clear","audioContext","AudioContext","dumpNodePromise","audioWorklet","addModule","then","AudioWorkletNode","audioNodes","Map","audioConnections","registerAudioNode","type","loading","error","Error","nodeCreator","audioNode","createNode","dumpNode","Object","values","outputs","forEach","port","connect","Array","isArray","registerAudioNodes","Promise","all","unregisterAudioNode","props","console","toString","destroy","inputs","AudioNode","disconnect","delete","registerAudioConnection","edge","source","sourceHandle","target","targetHandle","sourceNode","outputNode","outputNodePort","targetNode","inputNode","inputNodePort","isInputNode","isInputParam","AudioParam","isInputArray","isInputSimple","isOutputNode","isOutputArray","log","output","unregisterAudioConnection","audioConnection","unregisterAudioNodes","registerAudioConnections","unregisterAudioConnections","nodesState","project","files","setProject","currentFileIndex","getProject","pullEditorChanges","getEditorState","updateFileContent","currentFile","file","setCurrentFileIndex","newFileIndex","index","f","i","updateFileName","fileName","name","addFile","length","deleteFile","fileIndex","_","setGraph","createNodes","createEdges","activeNodes","activeEdges","clearGraph","nodeData","nodesConfiguration","defaultConfig","removeNode","removeNodes","currentNodes","onNodesDelete","removeEdges","removeNodesFromControlPanel","parentNodeIds","resultingNodes","parentNode","includes","nodeIds","currentEdges","onEdgesDelete","edgeIds","newEdges","plugins","setPlugins","nodesConf","reduce","acc","plugin","components","subAcc","keys","assign","showMinimap","setConfig","viewport","setEditorState","r","setTimeout","isHelpShown","toggleHelp","showHelp","copyBuffer","copy","elements","copySelectedItems","selected","pasteBuffer","x","y","nodesToCopy","edgesToCopy","topLeftNode","position","xDelta","yDelta","newNodes","mapping","newNodeId","random","Date","floor","replace","getControlPanelNode","controlPanelNode","show","size","width","height","showControlPanel","hideControlPanel","addNodeToControlPanel","newNode","removeNodeFromControlPanel","setControlPanelNodes","setControlPanelSize","zoom","setViewport","api","collectChanges","$15640845882b881f$export$4e64751394766316","timer","jsondiffpatchInstance","propertyFilter","context","parent","childName","oldState","state","prevState","clearTimeout","diff","subscribe","promises","currentState","storeChanges","newState","nodeChanges","edgeChanges","removedEdges","removedNodes","promise","add","e","$de1eff52c6419df8$export$2e2bcd8739ae039","colors","elevation1","elevation2","elevation3","accent1","accent2","accent3","highlight1","highlight2","highlight3","vivid1","whitePrimary","zIndex","modal","resumeContextLayout","$40266ad71a95dba8$export$2e2bcd8739ae039","$ee2caa06ac02c5bc$export$ef9839ae55b8ba40","$ee2caa06ac02c5bc$export$98eff9c5659394e3","$b2eaa5961e75d009$export$d4cd258d01c03112","$b2eaa5961e75d009$export$2e2bcd8739ae039","theme","store","children","animation","onClick","event","$96e3c18b52e89add$var$ModalOuter","div","$96e3c18b52e89add$var$ModalInner","$96e3c18b52e89add$var$ModalCloser","$96e3c18b52e89add$export$2e2bcd8739ae039","onClose","escHandler","key","document","addEventListener","removeEventListener","stopPropagation","body","$7eaa077f1f9bb73b$var$InputWrapper","$7eaa077f1f9bb73b$var$InputInner","$7eaa077f1f9bb73b$var$FiltersWrapper","$7eaa077f1f9bb73b$var$PluginName","label","$7eaa077f1f9bb73b$export$2e2bcd8739ae039","onChange","value","inputRef","current","focus","ref","search","placeholder","checked","$682a69da6ef2887d$var$PluginsWrapper","$682a69da6ef2887d$var$PluginWrapper","$682a69da6ef2887d$var$NodesList","ul","$682a69da6ef2887d$var$NodeTitle","$682a69da6ef2887d$var$NodeDescription","$682a69da6ef2887d$var$PluginHeader","$682a69da6ef2887d$var$PluginTitle","$682a69da6ef2887d$var$PluginDescription","$682a69da6ef2887d$export$2e2bcd8739ae039","onComponentClick","filters","pluginsGroup","filteredPlugins","toLocaleLowerCase","description","sort","b","toLowerCase","component","idx","$881ab8dac829e111$var$AddNodeWrapper","$881ab8dac829e111$var$PluginsPanel","$881ab8dac829e111$export$2e2bcd8739ae039","isOpen","closeMenu","mousePosition","screenToFlowPosition","filtersState","setFiltersState","targetPosition","Left","sourcePosition","Right","$7f7ac6f44564377e$var$UploadPatchWrapper","$7f7ac6f44564377e$var$DropZoneInner","$7f7ac6f44564377e$var$FileUploadIcon","$7f7ac6f44564377e$var$FileUploadMessage","$7f7ac6f44564377e$export$2e2bcd8739ae039","fileInputRef","uploadFile","text","editorState","catch","className","style","display","accept","targetClassName","draggingOverTargetClassName","onTargetClick","click","onDrop","$5da3065ea9b7ce79$var$UploadProjectWrapper","$5da3065ea9b7ce79$var$DropZoneInner","$5da3065ea9b7ce79$var$FileUploadIcon","$5da3065ea9b7ce79$var$FileUploadMessage","$5da3065ea9b7ce79$export$2e2bcd8739ae039","projectState","$28ba16bd16f671c0$export$d4cd258d01c03112","$28ba16bd16f671c0$export$2e2bcd8739ae039","editorContextMenu","setMousePosition","showAddNode","setShowAddNode","showUploadPatch","setShowUploadPatch","showUploadProject","setShowUploadProject","addNodeHandler","pasteBufferHandler","deleteAllHandler","historyBack","historyForward","historyPointer","historyBuffer","selectedNodes","currentCopyBuffer","reactFlowInstance","downloadPatchHandler","downloadProjectHandler","unbind","triggerEvent","clientX","clientY","disabled","$0ffe51df9638a254$export$d4cd258d01c03112","$0ffe51df9638a254$export$2e2bcd8739ae039","controlPanelNodes","isOnControlPanel","hasControlPanelNode","nodeConfiguration","hidden","$607523634e2ef7fa$export$2e2bcd8739ae039","$c2be4ce66a537e42$export$2e2bcd8739ae039","updateNodeValues","updateNodeConfig","updateNodeLabel","$61078804f94ec8d6$export$5abe11f802ebd1f2","$61078804f94ec8d6$export$2e2bcd8739ae039","labelInputRef","labelEditMode","setLabelEditMode","editNodeLabel","select","exitEditMode","window","getSelection","collapseToEnd","saveNodeLabel","cancelNodeLabelEdit","readOnly","onDoubleClick","onBlur","onKeyDown","$de6d95f0aff74a75$var$NodeInfoWrapper","$de6d95f0aff74a75$export$2e2bcd8739ae039","nodeType","info","portsDescription","portsInfo","parts","inputPorts","portName","join","range","undefined","defaultValue","outputPorts","dangerouslySetInnerHTML","__html","combinedInfo","$8d34719b9811e505$var$NodeWrapper","$8d34719b9811e505$var$NodeLoaderWrapper","$8d34719b9811e505$var$NodeErrorWrapper","$8d34719b9811e505$var$SettingsIconWrapper","$8d34719b9811e505$var$InfoIconWrapper","$8d34719b9811e505$var$Section","$8d34719b9811e505$export$1bdb8f2d1fe25c22","$8d34719b9811e505$export$bfd3bd1fa283e3c6","$8d34719b9811e505$export$f1afba0ff9ea1277","$8d34719b9811e505$export$af4f9b41fc32ed9e","$8d34719b9811e505$export$a2d375858cc72119","$8d34719b9811e505$var$portColors","Audio","Gate","Number","Any","$8d34719b9811e505$var$StyledHandle","shouldForwardProp","prop","portType","$8d34719b9811e505$var$StyledInputHandle","$8d34719b9811e505$export$9ea0feffc20ee81","$8d34719b9811e505$export$222539e2a2fac4e0","$8d34719b9811e505$export$496e5e1ee1696f64","$8d34719b9811e505$export$7e0b3af1e60a3273","$8d34719b9811e505$var$useNodeManifest","$8d34719b9811e505$export$361064385d50ec44","rest","isInfoModalShown","setIsInfoModalShown","isResizeable","resizable","ConfigNode","$8d34719b9811e505$var$useConfigNode","configNode","configMode","setShowConfigMode","onClickCapture","isShown","minWidth","minHeight","enable","bottom","bottomRight","onResizeStop","direction","d","newSize","getBoundingClientRect","$10a9c816b85d070f$export$86de09faaa70680d","$10a9c816b85d070f$export$548ca3bae446ddc2","$10a9c816b85d070f$export$9fb15e3cc717240","$10a9c816b85d070f$export$be58b4326e23250f","span","$78800a41ab03e65a$var$ControlPanelNodeWrapper","$78800a41ab03e65a$var$PanelNode","ControlPanelNode","$78800a41ab03e65a$export$2e2bcd8739ae039","showControls","onDelete","$aa370ed1795ceb6e$var$ControlPanelIconWrapper","$aa370ed1795ceb6e$var$ControlPanelIconsBar","$aa370ed1795ceb6e$var$CloseIconWrapper","$aa370ed1795ceb6e$var$ControlPanelHeader","$aa370ed1795ceb6e$var$ControlPanelTitle","$aa370ed1795ceb6e$var$ControlPanelWrapper","$aa370ed1795ceb6e$var$ControlPanelBody","$aa370ed1795ceb6e$var$ControlPanelSettings","$aa370ed1795ceb6e$var$LockGridWrapper","$aa370ed1795ceb6e$var$GridResizeHandle","$aa370ed1795ceb6e$var$ControlPanelItemWrapper","$aa370ed1795ceb6e$export$2e2bcd8739ae039","nodeRef","filteredNodes","isGridLocked","setGridLocked","layout","fallbackY","Y","w","h","open","enableOverlay","background","top","topRight","bottomLeft","topLeft","handleComponent","cols","rowHeight","margin","isResizable","draggableHandle","onLayoutChange","requestAnimationFrame","$e94dbfe8457a1793$exports","$0d9fa38071943b2c$var$MdPreview","$0d9fa38071943b2c$var$ModalContent","$0d9fa38071943b2c$export$2e2bcd8739ae039","onWheelCapture","$978ea880a50613b0$export$78bddedbcf2939ac","$8555f8953ca3d620$var$Layout","$8555f8953ca3d620$var$Row","$8555f8953ca3d620$var$Message","$8555f8953ca3d620$var$Icon","$8555f8953ca3d620$export$2e2bcd8739ae039","isContextResumed","setIsContextResumed","resume","$a86b09d17e46bbc8$export$2e2bcd8739ae039","$ea8f5cfca6de366a$export$2e2bcd8739ae039","sourceX","sourceY","targetX","targetY","markerStart","markerEnd","sourceHandleId","targetHandleId","isConnectedToSelected","edgePath","stroke","strokeWidth","color","opacity","cursor","$34040b5af26d0b8a$var$onNodeDragStop","_event","$34040b5af26d0b8a$var$onNodeClick","element","$34040b5af26d0b8a$var$snapGrid","$34040b5af26d0b8a$export$72cb76f559fbafcf","edgeTypes","wire","editorConfig","reactflowInstance","setReactflowInstance","onInit","rfi","onContextMenu","onEditorContextMenu","onNodeContextMenu","onEdgeContextMenu","onEnd","onNodeDragStop","onNodeClick","snapGrid","defaultViewport","defaultEdgeOptions","snapToGrid","fitView","disableKeyboardA11y","variant","Dots","gap","showInteractive","$34040b5af26d0b8a$export$7cda8d932e2f33c0","$682f9b4ff493f2ac$export$d31000d36961d6c2","$682f9b4ff493f2ac$export$6cd5d5c1dae69a36","$682f9b4ff493f2ac$export$b38a2fd24b22fb35","$682f9b4ff493f2ac$export$8c347812506d5ac9","$682f9b4ff493f2ac$export$2206531ad8592d57","$682f9b4ff493f2ac$export$3e41faf802a29e71","active","$682f9b4ff493f2ac$export$61e5b3c7bace77b8","$682f9b4ff493f2ac$export$3aef34186a092045","$682f9b4ff493f2ac$export$cae179f078f4b4a4","$682f9b4ff493f2ac$var$generateEmptyFile","$682f9b4ff493f2ac$export$2e2bcd8739ae039","showLoader","setShowLoader","fetcher","request","Request","url","Response","styles","val","confirm","Editor","EDITOR_DEFAULTS","Wire","WNNode","TitleBar","PortsPanel","OutputPorts","OutputHandle","InputPorts","InputHandle","Port","Modal","EditableLabel","useAudioNode","useNode","useStore"],"version":3,"file":"module.js.map"}
1
+ {"mappings":"Ia+LG,EC3KA,C,Q,O,C,C,Q,C,C,Y,C,K,mB,A,Q,a,C,C,iB,C,C,U,C,C,O,C,C,Y,C,K,gB,A,Q,M,iB,A,Q,U,C,K,Q,A,Q,Y,C,C,a,C,C,W,C,C,e,C,C,U,C,K,O,A,Q,U,C,K,iB,A,Q,W,C,C,gB,C,C,c,C,C,iB,C,K,gB,A,O,0B,A,Q,G,qB,C,C,W,C,C,oB,C,C,oB,C,C,uB,C,C,c,C,C,qB,C,C,W,C,C,Y,C,C,qB,C,C,gB,C,C,Y,C,C,U,C,C,iB,C,C,iB,C,K,W,A,Q,U,C,K,S,A,Q,W,C,C,S,C,C,U,C,K,e,A,Q,gB,C,K,c,A,Q,kB,C,C,Q,C,C,Q,C,C,a,C,K,iB,A,O,yC,A,Q,M,kB,A,Q,M,Y,A,Q,gB,C,K,W,A,Q,Y,C,K,iB,A,Q,gB,C,C,c,C,C,e,C,C,S,E,C,Y,E,K,gB,A,Q,a,E,K,c,A,Q,O,mB,A,O,kC,A,Q,c,E,C,gB,E,K,gB,A,Q,e,E,K,gB,A,Q,O,qB,A,O,oC,A,Q,U,E,K,Q,C,S,G,C,E,O,G,E,U,C,E,O,C,C,CXhBH,IAAM,GAAyC,EAAE,CKEpC,GAAiC,CAAA,EDM9C,IAAM,GAAkB,IAAI,IAAI,GEZf,8MFYjB,6CGZa,GAAoB,wBACpB,GAAuB,CAAA,CAAA,EAAI,GAAA,CAAmB,IAG9C,E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.ts","packages/fetch/lib.ts","packages/core/src/store/index.ts","packages/patch/index.ts","packages/patch/src/createPatch.ts","packages/patch/src/audioNodeTypes.ts","node_modules/@parcel/runtime-js/lib/bundles/runtime-46fa6afb492e1190.js","packages/core/src/constants.ts","packages/core/src/helpers/generateNodeId.ts","packages/core/src/store/nodesStore.ts","packages/core/src/store/history/index.ts","packages/core/src/store/audioPatch/index.ts","packages/core/src/store/audioPatch/compareGraphs.ts","packages/core/src/store/projectStore.ts","packages/core/src/helpers/projectFile.ts","packages/core/src/styles.ts","packages/core/src/theme.ts","packages/core/src/components/Editor/index.tsx","packages/core/src/components/contextMenu/EdgeContextMenu.tsx","packages/core/src/hooks/useTheme.ts","packages/core/src/components/contextMenu/styles.tsx","packages/core/src/components/contextMenu/EditorContextMenu.tsx","packages/core/src/components/AddNode/index.tsx","packages/core/src/components/Modal.tsx","packages/core/src/components/AddNode/Filters.tsx","packages/core/src/components/AddNode/Plugins.tsx","packages/core/src/components/UploadPatch.tsx","packages/core/src/components/UploadProject.tsx","packages/core/src/components/contextMenu/NodeContextMenu.tsx","packages/core/src/components/ControlPanel/index.tsx","packages/core/src/components/ControlPanel/ControlPanelItem.tsx","packages/core/src/hooks/useAudioNode.ts","packages/core/src/hooks/useNode.ts","packages/core/src/components/ControlPanel/styles.tsx","packages/core/src/components/Node/index.tsx","packages/core/src/components/EditableLabel.tsx","packages/core/src/components/NodeInfoModal.tsx","packages/core/src/components/Help/index.tsx","packages/core/src/components/Help/HelpModal.tsx","node_modules/@parcel/runtime-js/lib/bundles/runtime-64181e2ef3200fa7.js","packages/core/src/components/ResumeContext.tsx","packages/core/src/components/ToggleMinimap.tsx","packages/core/src/components/Wire.tsx"],"sourcesContent":["import {jsx as $djR0r$jsx, jsxs as $djR0r$jsxs, Fragment as $djR0r$Fragment} from \"react/jsx-runtime\";\nimport {withTheme as $djR0r$withTheme, ThemeProvider as $djR0r$ThemeProvider, Global as $djR0r$Global, css as $djR0r$css, useTheme as $djR0r$useTheme} from \"@emotion/react\";\nimport $djR0r$emotionstyled from \"@emotion/styled\";\nimport {nanoid as $djR0r$nanoid} from \"nanoid\";\nimport {useState as $djR0r$useState, useEffect as $djR0r$useEffect, useMemo as $djR0r$useMemo, useCallback as $djR0r$useCallback, useRef as $djR0r$useRef} from \"react\";\nimport {FaPlus as $djR0r$FaPlus} from \"react-icons/fa6\";\nimport {MdClose as $djR0r$MdClose, MdDragHandle as $djR0r$MdDragHandle, MdSettings as $djR0r$MdSettings, MdInfoOutline as $djR0r$MdInfoOutline} from \"react-icons/md\";\nimport \"reactflow/dist/style.css\";\nimport $djR0r$reactflow, {getConnectedEdges as $djR0r$getConnectedEdges, addEdge as $djR0r$addEdge, applyNodeChanges as $djR0r$applyNodeChanges, applyEdgeChanges as $djR0r$applyEdgeChanges, useOnViewportChange as $djR0r$useOnViewportChange, Background as $djR0r$Background, BackgroundVariant as $djR0r$BackgroundVariant, MiniMap as $djR0r$MiniMap, Controls as $djR0r$Controls, ReactFlowProvider as $djR0r$ReactFlowProvider, useReactFlow as $djR0r$useReactFlow, Position as $djR0r$Position, Handle as $djR0r$Handle, ControlButton as $djR0r$ControlButton, getBezierPath as $djR0r$getBezierPath} from \"reactflow\";\nimport {create as $djR0r$create} from \"zustand\";\nimport {reverse as $djR0r$reverse, patch as $djR0r$patch, create as $djR0r$create1} from \"jsondiffpatch\";\nimport {injectGlobal as $djR0r$injectGlobal} from \"@emotion/css\";\nimport {useContextMenu as $djR0r$useContextMenu, Item as $djR0r$Item, Menu as $djR0r$Menu, Separator as $djR0r$Separator} from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport $djR0r$jsfiledownload from \"js-file-download\";\nimport $djR0r$hotkeysjs from \"hotkeys-js\";\nimport {createPortal as $djR0r$createPortal} from \"react-dom\";\nimport {FileDrop as $djR0r$FileDrop} from \"react-file-drop\";\nimport {FaFileUpload as $djR0r$FaFileUpload, FaQuestion as $djR0r$FaQuestion, FaVolumeOff as $djR0r$FaVolumeOff, FaMap as $djR0r$FaMap, FaRegMap as $djR0r$FaRegMap} from \"react-icons/fa\";\nimport {Resizable as $djR0r$Resizable} from \"re-resizable\";\nimport $djR0r$reactgridlayout from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport {AiFillLock as $djR0r$AiFillLock, AiFillUnlock as $djR0r$AiFillUnlock} from \"react-icons/ai\";\nimport {RxDashboard as $djR0r$RxDashboard} from \"react-icons/rx\";\nimport $djR0r$reactmoderndrawer from \"react-modern-drawer\";\nimport \"react-modern-drawer/dist/index.css\";\nimport {marked as $djR0r$marked} from \"marked\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n\n\n\n\n\n\n\nconst $4df9b03f6b65375a$export$4659b591c19bdf3d = (url, pattern)=>{\n // Escape special characters in the pattern, except for '*'\n const escapedPattern = pattern.replace(/([.+?^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\n // Replace '*' with '.*' to match any sequence of characters\n const regexPattern = escapedPattern.replace(/\\*/g, '.*');\n // Create a regular expression from the pattern, ensuring it matches the entire URL\n const regex = new RegExp(`^${regexPattern}$`);\n // Test if the URL matches the pattern\n return regex.test(url);\n};\n\n\nconst $4165c1239dbc641a$var$customFetchers = [];\nconst $4165c1239dbc641a$export$9e4ff1580457920e = (matcher, fetcher)=>{\n $4165c1239dbc641a$var$customFetchers.push([\n matcher,\n fetcher\n ]);\n return ()=>{\n //delete fetcher\n };\n};\nconst $4165c1239dbc641a$var$getFetcher = (url)=>{\n return [\n ...$4165c1239dbc641a$var$customFetchers\n ].reverse().find(([matcher])=>{\n return (0, $4df9b03f6b65375a$export$4659b591c19bdf3d)(url, matcher);\n })?.[1];\n};\nconst $4165c1239dbc641a$var$webNoiseFetch = (...args)=>{\n const request = new Request(...args);\n const fetcher = $4165c1239dbc641a$var$getFetcher(request.url);\n if (fetcher) return fetcher(...args);\n return fetch(...args);\n};\nvar $4165c1239dbc641a$export$2e2bcd8739ae039 = $4165c1239dbc641a$var$webNoiseFetch;\n\n\n\n\nconst $059c7a7b96627b87$export$64e2564cc3ca44e9 = {};\nconst $059c7a7b96627b87$export$ff7e9ed3f5c574f2 = (newAudioNodeTypes)=>{\n Object.assign($059c7a7b96627b87$export$64e2564cc3ca44e9, newAudioNodeTypes);\n};\nconst $059c7a7b96627b87$export$6bf50e9be02d9812 = (type)=>$059c7a7b96627b87$export$64e2564cc3ca44e9[type];\n\n\nvar $8cea846e06c7f3f1$exports = {};\n$8cea846e06c7f3f1$exports = \"data:application/javascript,class%20e%20extends%20AudioWorkletProcessor%7Bprocess%28%29%7Breturn%210%7D%7DregisterProcessor%28%22dump-node-processor%22%2Ce%29%3Bexport%7Be%20as%20DumpNodeProcessor%7D%3B\";\n\n\nconst $4bc43559bc9437b5$var$dumpNodeWorklet = new URL((0, (/*@__PURE__*/$parcel$interopDefault($8cea846e06c7f3f1$exports))), \"file:///packages/patch/src/createPatch.ts\");\nconst $4bc43559bc9437b5$var$createPatch = (audioContext = new AudioContext())=>{\n /*\n * due to bug in chrome we need to kickstart worklet outputs\n * by connecting it to an input\n * */ const dumpNodePromise = audioContext.audioWorklet.addModule($4bc43559bc9437b5$var$dumpNodeWorklet).then(()=>{\n return new AudioWorkletNode(audioContext, \"dump-node-processor\");\n });\n const audioNodes = new Map();\n const audioConnections = new Map();\n const registerAudioNode = async (node)=>{\n const { id: id, type: type, data: data } = node;\n if (!type) {\n audioNodes.set(id, {\n loading: false,\n error: new Error(`Node: ${id} has no type`),\n node: null\n });\n return;\n }\n const nodeCreator = (0, $059c7a7b96627b87$export$6bf50e9be02d9812)(type);\n if (nodeCreator === false) return;\n const createNode = nodeCreator;\n if (!createNode) {\n audioNodes.set(id, {\n loading: false,\n error: new Error(`Could not find handler for audio type ${type}`),\n node: null\n });\n return;\n }\n audioNodes.set(id, {\n loading: true,\n error: null,\n node: null\n });\n try {\n const audioNode = await createNode(audioContext, data);\n const dumpNode = await dumpNodePromise;\n audioNodes.set(id, {\n loading: false,\n error: null,\n node: audioNode\n });\n // Kickstart worklet outputs\n Object.values(audioNode.outputs || []).forEach(({ port: port })=>{\n if (!dumpNode) return;\n if (port instanceof AudioWorkletNode) port.connect(dumpNode);\n if (Array.isArray(port) && port[0] instanceof AudioWorkletNode) port[0].connect(dumpNode, port[1]);\n });\n } catch (error) {\n audioNodes.set(id, {\n loading: false,\n error: error,\n node: null\n });\n }\n };\n const registerAudioNodes = async (nodes)=>{\n return Promise.all(nodes.map(registerAudioNode));\n };\n const unregisterAudioNode = (props)=>{\n const { id: id, data: data } = props;\n const audioNode = audioNodes.get(id);\n if (!audioNode) {\n console.error(`Audio node #${id} does not exist`);\n return;\n }\n const { loading: loading, error: error, node: node } = audioNode;\n if (loading) {\n console.error(`Audio node #${id} is yet not loaded`);\n return;\n }\n if (error) {\n console.error(`Audio node #${id} is in error state: ${error.toString()}`);\n return;\n }\n node.destroy && node.destroy();\n //disconnect all ports\n Object.values(node.inputs || {}).forEach(({ port: port })=>port instanceof AudioNode && port.disconnect && port.disconnect());\n Object.values(node.outputs || {}).forEach(({ port: port })=>port instanceof AudioNode && port.disconnect && port.disconnect());\n audioNodes.delete(id);\n };\n const unregisterAudioNodes = (nodes)=>{\n return nodes.map(unregisterAudioNode);\n };\n const registerAudioConnection = (edge)=>{\n const { source: source, sourceHandle: sourceHandle, target: target, targetHandle: targetHandle, id: id } = edge;\n const { node: sourceNode } = audioNodes.get(source) || {};\n if (!sourceNode) {\n console.error(`can't find source node ${source}`);\n return;\n }\n if (!sourceHandle) {\n console.error(`source handle is not defined in node ${source}`);\n return;\n }\n const outputNode = sourceNode.outputs?.[sourceHandle];\n const outputNodePort = outputNode?.port;\n const { node: targetNode } = audioNodes.get(target) || {};\n if (!targetNode) {\n console.error(`can't find target node ${targetNode}`);\n return;\n }\n if (!targetHandle) {\n console.error(`source handle is not defined in node ${sourceNode}`);\n return;\n }\n const inputNode = targetNode.inputs?.[targetHandle];\n const inputNodePort = inputNode?.port;\n if (!outputNodePort) {\n console.error(`Can't find output port: ${source}:${sourceHandle}`);\n return;\n }\n if (!inputNodePort) {\n console.error(`Can't find input port: ${target}:${targetHandle}`);\n return;\n }\n const isInputNode = inputNodePort instanceof AudioNode;\n const isInputParam = inputNodePort instanceof AudioParam;\n const isInputArray = inputNodePort instanceof Array;\n const isInputSimple = isInputNode || isInputParam;\n const isOutputNode = outputNodePort instanceof AudioNode;\n const isOutputArray = outputNodePort instanceof Array;\n if (isOutputNode && isInputSimple) //@ts-ignore inputNode can actually be AudioParam\n outputNodePort.connect(inputNodePort);\n else if (isOutputNode && isInputArray) outputNodePort.connect(inputNodePort[0], 0, inputNodePort[1]);\n else if (isOutputArray && isInputSimple) //@ts-ignore inputNode can actually be AudioParam\n outputNodePort[0].connect(inputNodePort, outputNodePort[1]);\n else if (isOutputArray && isInputArray) outputNodePort[0].connect(inputNodePort[0], outputNodePort[1], inputNodePort[1]);\n else {\n console.log(outputNodePort, inputNodePort);\n console.error(`ports can be only AudioNode or AudioNodeChannel`);\n }\n audioConnections.set(id, {\n output: outputNode,\n input: inputNode\n });\n };\n const registerAudioConnections = (edges)=>{\n return edges.map(registerAudioConnection);\n };\n const unregisterAudioConnection = (edge)=>{\n const { id: id, data: data } = edge;\n const audioConnection = audioConnections.get(id);\n if (!audioConnection) {\n console.error(`can't find connection with id: ${id}`);\n return;\n }\n const { input: { port: inputNodePort }, output: { port: outputNodePort } } = audioConnection;\n const isInputNode = inputNodePort instanceof AudioNode;\n const isInputParam = inputNodePort instanceof AudioParam;\n const isInputArray = inputNodePort instanceof Array;\n const isInputSimple = isInputNode || isInputParam;\n const isOutputNode = outputNodePort instanceof AudioNode;\n const isOutputArray = outputNodePort instanceof Array;\n if (isOutputNode && isInputSimple) //@ts-ignore inputNode can actually be AudioParam\n outputNodePort.disconnect(inputNodePort);\n else if (isOutputNode && isInputArray) outputNodePort.disconnect(inputNodePort[0], 0, inputNodePort[1]);\n else if (isOutputArray && isInputSimple) //@ts-ignore inputNode can actually be AudioParam\n outputNodePort[0].disconnect(inputNodePort, outputNodePort[1]);\n else if (isOutputArray && isInputArray) outputNodePort[0].disconnect(inputNodePort[0], outputNodePort[1], inputNodePort[1]);\n else {\n console.log(outputNodePort, inputNodePort);\n throw new Error(`output port can not be only AudioNode or AudioNodeChannel`);\n }\n audioConnections.delete(id);\n };\n const unregisterAudioConnections = (edges)=>{\n return edges.map(unregisterAudioConnection);\n };\n return {\n audioContext: audioContext,\n audioNodes: audioNodes,\n registerAudioNode: registerAudioNode,\n registerAudioNodes: registerAudioNodes,\n unregisterAudioNode: unregisterAudioNode,\n unregisterAudioNodes: unregisterAudioNodes,\n audioConnections: audioConnections,\n registerAudioConnection: registerAudioConnection,\n registerAudioConnections: registerAudioConnections,\n unregisterAudioConnection: unregisterAudioConnection,\n unregisterAudioConnections: unregisterAudioConnections\n };\n};\nvar $4bc43559bc9437b5$export$2e2bcd8739ae039 = $4bc43559bc9437b5$var$createPatch;\n\n\n\n\n\nconst $9738c58e5420c085$export$956b3cf15d7c363 = \"web-noise-drag-handle\";\nconst $9738c58e5420c085$export$21d634b1d5d9bee3 = `.${$9738c58e5420c085$export$956b3cf15d7c363}`;\nconst $9738c58e5420c085$export$9f05d3e6ade4c09e = {\n rowHeight: 10,\n cols: 4\n};\nvar $9738c58e5420c085$export$b0b7b95ee465c83c;\n(function(PortType) {\n PortType[\"Gate\"] = \"gate\";\n PortType[\"Number\"] = \"number\";\n PortType[\"Audio\"] = \"audio\";\n PortType[\"Any\"] = \"any\";\n})($9738c58e5420c085$export$b0b7b95ee465c83c || ($9738c58e5420c085$export$b0b7b95ee465c83c = {}));\n\n\nconst $5c30fde65a1f208b$var$generateNodeId = (node)=>{\n const random = +new Date() + Math.floor(Math.random() * 1000);\n if (!node?.type) return random.toString();\n return `${node.type}-${random}`;\n};\nvar $5c30fde65a1f208b$export$2e2bcd8739ae039 = $5c30fde65a1f208b$var$generateNodeId;\n\n\n\n\nconst $647d11026d55ca5b$var$nodesStateCreator = (set, get)=>({\n nodes: [],\n edges: [],\n onNodesChange: (changes)=>{\n set(({ nodes: nodes })=>({\n nodes: (0, $djR0r$applyNodeChanges)(changes, nodes).map((node)=>({\n dragHandle: (0, $9738c58e5420c085$export$21d634b1d5d9bee3),\n ...node\n }))\n }));\n },\n onEdgesChange: (changes)=>{\n set(({ edges: edges })=>({\n edges: (0, $djR0r$applyEdgeChanges)(changes, edges)\n }));\n },\n onConnect: (connection)=>{\n set(({ edges: edges })=>({\n edges: (0, $djR0r$addEdge)(connection, edges)\n }));\n },\n addNode: (node)=>{\n set(({ nodes: nodes })=>({\n nodes: nodes.concat(node)\n }));\n },\n setNodes: (nodes)=>{\n set({\n nodes: nodes\n });\n },\n setEdges: (edges)=>{\n set({\n edges: edges\n });\n },\n setNodesAndEdges: ({ nodes: nodes, edges: edges })=>{\n set({\n nodes: nodes,\n edges: edges\n });\n },\n getNodesAndEdges: ()=>{\n const { nodes: nodes, edges: edges } = get();\n return {\n nodes: nodes,\n edges: edges\n };\n },\n clearElements: ()=>{\n set({\n nodes: [],\n edges: []\n });\n },\n getNode: (id)=>{\n const { nodes: nodes } = get();\n const node = nodes.find((node)=>node.id === id);\n return node || null;\n },\n updateNodeData: (id, data)=>{\n set(({ nodes: nodes })=>{\n return {\n nodes: nodes.map((node)=>{\n if (node.id === id) return {\n ...node,\n data: {\n ...node.data,\n ...data\n }\n };\n return node;\n })\n };\n });\n },\n nodeTypes: {},\n setNodeTypes: (nodeTypes)=>set({\n nodeTypes: nodeTypes\n })\n });\nvar $647d11026d55ca5b$export$2e2bcd8739ae039 = $647d11026d55ca5b$var$nodesStateCreator;\n\n\n\nconst $15640845882b881f$var$cloneObject = (input)=>{\n return JSON.parse(JSON.stringify(input));\n};\nconst $15640845882b881f$export$b1b92d12d1c2ae0e = (set, get)=>({\n history: {\n maxHistoryLength: 5,\n buffer: [],\n pointer: 0,\n skipCollect: false,\n push: (changes)=>{\n const { history: history } = get();\n const { maxHistoryLength: maxHistoryLength, skipCollect: skipCollect } = history;\n if (skipCollect) {\n set({\n history: {\n ...history,\n skipCollect: false\n }\n });\n return;\n }\n set(({ history: history })=>{\n if (!history) return {};\n const { buffer: buffer, pointer: pointer } = history;\n const newBuffer = buffer.slice(Math.max(pointer - maxHistoryLength + 1, 0), pointer);\n return {\n history: {\n ...history,\n buffer: [\n ...newBuffer,\n changes\n ],\n pointer: Math.min(pointer + 1, maxHistoryLength)\n }\n };\n });\n },\n back: ()=>{\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, history: history } = get();\n const { buffer: buffer, pointer: pointer } = history;\n const patchData = buffer[pointer - 1];\n if (!patchData) return;\n const reversedPatchData = $djR0r$reverse(patchData);\n if (!reversedPatchData) return;\n const updates = $15640845882b881f$var$cloneObject({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel\n });\n const patch = $djR0r$patch(updates, reversedPatchData);\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer - 1,\n skipCollect: true\n }\n });\n },\n forward: ()=>{\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, history: history } = get();\n const { buffer: buffer, pointer: pointer } = history;\n const patchData = buffer[pointer];\n if (!patchData) return;\n const updates = $15640845882b881f$var$cloneObject({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel\n });\n const patch = $djR0r$patch(updates, patchData);\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer + 1,\n skipCollect: true\n }\n });\n },\n // @TODO: remove this method and store history per file\n clear: ()=>{\n const { history: history } = get();\n set({\n history: {\n ...history,\n buffer: [],\n pointer: 0,\n skipCollect: true\n }\n });\n }\n }\n });\nconst $15640845882b881f$var$COLLECT_CHANGES_DEBOUNCE_TIME = 500;\nconst $15640845882b881f$export$4e64751394766316 = (set, get)=>{\n const jsondiffpatchInstance = $djR0r$create1({\n propertyFilter: (name, context)=>{\n //@TODO: rework this function, find better solution\n if (context.parent?.parent?.childName === \"controlPanel\") return true;\n if (// @ts-ignore\n [\n \"data\",\n \"position\",\n \"controlPanel\"\n ].includes(context.parent?.childName)) return true;\n return [\n \"controlPanel\",\n \"size\",\n \"edges\",\n \"nodes\",\n \"data\",\n \"label\",\n \"config\",\n \"values\",\n \"position\",\n \"x\",\n \"y\"\n ].includes(name);\n }\n });\n let oldState = get();\n let timer;\n return (state, prevState)=>{\n if (state.currentFileIndex !== prevState.currentFileIndex) get().history.clear();\n clearTimeout(timer);\n if (!oldState) oldState = prevState;\n timer = setTimeout(()=>{\n const changes = jsondiffpatchInstance.diff(oldState, state);\n oldState = null;\n if (changes) get().history.push(changes);\n }, $15640845882b881f$var$COLLECT_CHANGES_DEBOUNCE_TIME);\n };\n};\nconst $15640845882b881f$var$history = (config)=>(set, get, api)=>{\n const collectChanges = $15640845882b881f$export$4e64751394766316(set, get);\n api.subscribe(collectChanges);\n return config((...args)=>set(...args), get, api);\n };\nvar $15640845882b881f$export$2e2bcd8739ae039 = $15640845882b881f$var$history;\n\n\n\nconst $1efbebe6ffe1c168$export$e364ea0c1dfb25e5 = (left, right)=>{\n const setLeft = new Set(left.map((item)=>item.id));\n const setRight = new Set(right.map((item)=>item.id));\n const added = right.filter((item)=>!setLeft.has(item.id));\n const removed = left.filter((item)=>!setRight.has(item.id));\n return {\n added: added,\n removed: removed\n };\n};\n\n\nconst $64d14d164a029007$export$62647b40ff8aed70 = (set, get)=>({\n patch: (0, $4bc43559bc9437b5$export$2e2bcd8739ae039)(),\n nodesState: {}\n });\nconst $64d14d164a029007$var$audioPatch = (config)=>(set, get, api)=>{\n api.subscribe(async (state, prevState)=>{});\n const promises = new Set();\n let currentState = {\n ...get(),\n nodes: [],\n edges: []\n };\n return config(async (...args)=>{\n const oldState = get();\n const [storeChanges] = args;\n //@ts-ignore\n const newState = {\n ...currentState,\n ...typeof storeChanges === \"function\" ? storeChanges({\n ...currentState\n }) : storeChanges\n };\n const nodeChanges = (0, $1efbebe6ffe1c168$export$e364ea0c1dfb25e5)(currentState.nodes, newState.nodes);\n const edgeChanges = (0, $1efbebe6ffe1c168$export$e364ea0c1dfb25e5)(currentState.edges, newState.edges);\n //@ts-ignore\n currentState = newState;\n const newNodes = nodeChanges.added;\n const newEdges = edgeChanges.added;\n const removedEdges = edgeChanges.removed;\n const removedNodes = nodeChanges.removed;\n const { patch: patch } = oldState;\n if (newNodes.length) {\n const promise = patch.registerAudioNodes(//@ts-ignore\n newNodes);\n promises.add(promise);\n await promise;\n promises.delete(promise);\n }\n if (!(newEdges.length || removedEdges.length || removedNodes.length)) {\n set(...args);\n return;\n }\n if (promises.size) try {\n await Promise.all([\n ...promises.values()\n ]);\n } catch (e) {\n console.log(\"some error\", e);\n }\n if (newEdges.length) patch.registerAudioConnections(//@ts-ignore\n newEdges);\n if (removedEdges.length) //@ts-ignore\n patch.unregisterAudioConnections(removedEdges);\n if (removedNodes.length) //@ts-ignore\n patch.unregisterAudioNodes(removedNodes);\n set(...args);\n }, get, api);\n };\nvar $64d14d164a029007$export$2e2bcd8739ae039 = $64d14d164a029007$var$audioPatch;\n\n\nconst $9117b026061a386b$export$e698b79c63b74136 = (file)=>!(\"type\" in file) || file.type === \"patch\";\nconst $9117b026061a386b$export$31c2336f657dc59f = (file)=>file.type === \"audio\";\n\n\nconst $e615699a379fa930$var$projectStateCreator = (set, get)=>({\n project: {\n files: []\n },\n setProject (project) {\n set({\n project: project,\n currentFileIndex: 0\n });\n },\n getProject () {\n return get().project;\n },\n pullEditorChanges () {\n const { getEditorState: getEditorState, currentFileIndex: currentFileIndex, updateFileContent: updateFileContent, project: project } = get();\n const currentFile = project.files[currentFileIndex];\n if ((0, $9117b026061a386b$export$31c2336f657dc59f)(currentFile)) return;\n updateFileContent(currentFileIndex, {\n ...currentFile,\n file: getEditorState()\n });\n },\n syncEditorWithCurrentFile: ()=>{\n const { currentFileIndex: currentFileIndex, setEditorState: setEditorState, project: project } = get();\n const currentFile = project.files[currentFileIndex];\n if (currentFile.type === \"audio\") {\n console.log(\"audio file. skipping\");\n return;\n }\n setEditorState(currentFile.file);\n },\n currentFileIndex: 0,\n setCurrentFileIndex (newFileIndex) {\n const { currentFileIndex: currentFileIndex } = get();\n if (newFileIndex === currentFileIndex) return;\n set({\n currentFileIndex: newFileIndex\n });\n },\n updateFileContent (index, file) {\n const { project: project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i)=>{\n if (i === index) return {\n // @TODO check again if merging is really needed here\n ...f,\n ...file\n };\n return f;\n })\n }\n });\n },\n updateFileName (index, fileName) {\n const { project: project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i)=>{\n if (i === index) return {\n ...f,\n name: fileName\n };\n return f;\n })\n }\n });\n },\n addFile (file) {\n const { project: project } = get();\n const files = [\n ...project.files,\n file\n ];\n set({\n project: {\n ...project,\n files: files\n }\n });\n },\n deleteFile: (fileIndex)=>{\n const { project: project, currentFileIndex: currentFileIndex } = get();\n set({\n project: {\n ...project,\n files: project.files.filter((_, index)=>fileIndex !== index)\n }\n });\n if (fileIndex <= currentFileIndex) set({\n currentFileIndex: currentFileIndex - 1\n });\n }\n });\nvar $e615699a379fa930$export$2e2bcd8739ae039 = $e615699a379fa930$var$projectStateCreator;\n\n\nconst $6f5e1924a22d258c$export$34c5bc865219488e = (...args)=>{\n const [set, get] = args;\n return {\n ...(0, $647d11026d55ca5b$export$2e2bcd8739ae039)(...args),\n ...(0, $15640845882b881f$export$b1b92d12d1c2ae0e)(...args),\n ...(0, $64d14d164a029007$export$62647b40ff8aed70)(...args),\n ...(0, $e615699a379fa930$export$2e2bcd8739ae039)(...args),\n setGraph: async ({ nodes: nodes, edges: edges })=>{\n const { patch: patch, createNodes: createNodes, createEdges: createEdges, setNodesAndEdges: setNodesAndEdges, nodes: activeNodes, edges: activeEdges } = get();\n setNodesAndEdges({\n nodes: [],\n edges: []\n });\n await createNodes(nodes);\n createEdges(edges);\n },\n clearGraph: ()=>{\n const { setGraph: setGraph } = get();\n setGraph({\n nodes: [],\n edges: []\n });\n },\n createNodes: async (nodes)=>{\n const { createNode: createNode } = get();\n await Promise.all(nodes.map((node)=>createNode(node)));\n },\n createNode: (nodeData)=>{\n const { addNode: addNode, nodesConfiguration: nodesConfiguration } = get();\n const { type: type, id: id, data: data } = nodeData;\n if (typeof type === \"undefined\") throw new Error(`node type is not defined for node: ${id}`);\n const node = {\n ...nodeData,\n data: {\n ...data,\n config: {\n ...nodesConfiguration[type]?.defaultConfig,\n ...data?.config\n }\n }\n };\n addNode(node);\n },\n removeNode: (node)=>get().removeNodes([\n node\n ]),\n removeNodes: (nodes)=>{\n const { edges: edges, nodes: currentNodes, onNodesDelete: onNodesDelete, removeEdges: removeEdges, removeNodesFromControlPanel: removeNodesFromControlPanel } = get();\n const parentNodeIds = nodes.map(({ id: id })=>id);\n const children = currentNodes.filter(({ parentNode: parentNode })=>parentNode && parentNodeIds.includes(parentNode));\n const resultingNodes = [\n ...nodes,\n ...children\n ];\n removeNodesFromControlPanel(resultingNodes);\n const connectedEdges = (0, $djR0r$getConnectedEdges)(resultingNodes, edges);\n removeEdges(connectedEdges);\n onNodesDelete(resultingNodes);\n const nodeIds = resultingNodes.map(({ id: id })=>id);\n set({\n nodes: currentNodes.filter(({ id: id })=>!nodeIds.includes(id))\n });\n },\n removeEdges: (edges)=>{\n const { edges: currentEdges, onEdgesDelete: onEdgesDelete } = get();\n const edgeIds = edges.map(({ id: id })=>id);\n onEdgesDelete(edges);\n set({\n edges: currentEdges.filter(({ id: id })=>!edgeIds.includes(id))\n });\n },\n createEdges: (newEdges)=>{\n const { patch: patch, edges: edges, setEdges: setEdges } = get();\n setEdges(newEdges);\n },\n onConnect: async (connection)=>{\n const { edges: edges, createEdges: createEdges } = get();\n const newEdges = (0, $djR0r$addEdge)(connection, edges);\n createEdges(newEdges);\n },\n onEdgesDelete: (edges)=>{\n const { patch: patch } = get();\n },\n onNodesDelete: async (nodes)=>{\n const { removeNodesFromControlPanel: removeNodesFromControlPanel, patch: patch } = get();\n removeNodesFromControlPanel(nodes);\n },\n plugins: [],\n setPlugins: async (plugins)=>{\n const { setNodeTypes: setNodeTypes } = get();\n set({\n plugins: plugins\n });\n const nodesConf = plugins.reduce((acc, plugin)=>{\n return {\n ...acc,\n ...plugin.components.reduce((subAcc, item)=>({\n ...subAcc,\n [item.type]: item\n }), {})\n };\n }, {});\n const nodeTypes = Object.keys(nodesConf).reduce((acc, type)=>{\n return {\n ...acc,\n [type]: nodesConf[type].node\n };\n }, {});\n const audioNodeTypes = Object.keys(nodesConf).reduce((acc, type)=>{\n return {\n ...acc,\n [type]: nodesConf[type].audioNode\n };\n }, {});\n (0, $059c7a7b96627b87$export$ff7e9ed3f5c574f2)(audioNodeTypes);\n setNodeTypes(nodeTypes);\n set(({ nodesConfiguration: nodesConfiguration })=>({\n nodesConfiguration: {\n ...nodesConfiguration,\n ...nodesConf\n }\n }));\n },\n nodesConfiguration: {},\n config: {\n showMinimap: false\n },\n setConfig: (changes)=>{\n set(({ config: config })=>({\n config: {\n ...config,\n ...changes\n }\n }));\n },\n getEditorState: ()=>{\n const { getNodesAndEdges: getNodesAndEdges, controlPanel: controlPanel, viewport: viewport } = get();\n return {\n ...getNodesAndEdges(),\n controlPanel: controlPanel,\n viewport: viewport\n };\n },\n setEditorState: async ({ nodes: nodes, edges: edges, controlPanel: controlPanel, viewport: viewport })=>{\n const { setGraph: setGraph } = get();\n await setGraph({\n nodes: nodes,\n edges: edges\n });\n // @TODO: remove this line once audio patch initialisation is reworked\n await new Promise((r)=>setTimeout(r, 1000));\n set({\n controlPanel: controlPanel,\n viewport: viewport\n });\n },\n isHelpShown: false,\n toggleHelp: ()=>{\n const { isHelpShown: showHelp } = get();\n set({\n isHelpShown: !showHelp\n });\n },\n copyBuffer: {\n nodes: [],\n edges: []\n },\n copy: (elements)=>{\n set({\n copyBuffer: elements\n });\n },\n copySelectedItems: ()=>{\n const { nodes: currentNodes, edges: currentEdges, copy: copy } = get();\n const nodes = currentNodes.filter(({ selected: selected })=>selected);\n const edges = currentEdges.filter(({ selected: selected })=>selected);\n if (!nodes.length) return;\n copy({\n nodes: nodes,\n edges: edges\n });\n },\n pasteBuffer: (x = 0, y = 0)=>{\n const { copyBuffer: copyBuffer, createNodes: createNodes, setEdges: setEdges, nodes: nodes, edges: edges } = get();\n const { nodes: nodesToCopy, edges: edgesToCopy } = copyBuffer;\n if (!nodesToCopy.length) return;\n set({\n nodes: nodes.map((node)=>({\n ...node,\n selected: false\n }))\n });\n const topLeftNode = nodesToCopy.reduce((acc, node)=>{\n if (!acc) return node;\n if (node.position.x < acc.position.x && node.position.y < acc.position.y) return node;\n return acc;\n });\n const xDelta = topLeftNode.position.x - x;\n const yDelta = topLeftNode.position.y - y;\n const { nodes: newNodes, mapping: mapping } = nodesToCopy.reduce((acc, node)=>{\n const newNodeId = (0, $5c30fde65a1f208b$export$2e2bcd8739ae039)(node);\n return {\n nodes: [\n ...acc.nodes,\n {\n ...node,\n id: newNodeId,\n position: {\n x: node.position.x - xDelta,\n y: node.position.y - yDelta\n },\n selected: true\n }\n ],\n mapping: {\n ...acc.mapping,\n [node.id]: newNodeId\n }\n };\n }, {\n nodes: [],\n mapping: {}\n });\n createNodes(newNodes);\n const newEdges = edgesToCopy.map((edge)=>{\n const source = mapping[edge.source] || edge.source;\n const target = mapping[edge.target] || edge.target;\n return {\n ...edge,\n id: edge.id.replace(edge.source, source).replace(edge.target, target),\n source: source,\n target: target,\n selected: true\n };\n });\n setEdges([\n ...edges.map((edge)=>({\n ...edge,\n selected: false\n })),\n ...newEdges\n ]);\n },\n getControlPanelNode: (node)=>{\n const { nodesConfiguration: nodesConfiguration } = get();\n const { type: type } = node;\n if (!type) return null;\n const controlPanelNode = nodesConfiguration[type]?.controlPanelNode;\n if (!controlPanelNode) {\n console.error(`could not find node for type ${type}`);\n return null;\n }\n return controlPanelNode;\n },\n controlPanel: {\n show: true,\n nodes: [],\n size: {\n width: 200,\n height: 100\n }\n },\n showControlPanel: ()=>set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n show: true\n }\n })),\n hideControlPanel: ()=>set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n show: false\n }\n })),\n addNodeToControlPanel: (node)=>{\n const { nodesConfiguration: nodesConfiguration } = get();\n const defaultConfig = node.type ? nodesConfiguration[node.type]?.defaultConfig : {};\n const { height: height } = defaultConfig?.size || {};\n const newNode = {\n id: node.id,\n ...height ? {\n height: height / (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).rowHeight\n } : {}\n };\n set(({ controlPanel: controlPanel })=>({\n controlPanel: {\n ...controlPanel,\n nodes: [\n ...controlPanel.nodes,\n newNode\n ]\n }\n }));\n },\n removeNodeFromControlPanel: (node)=>get().removeNodesFromControlPanel([\n node\n ]),\n removeNodesFromControlPanel: (nodes)=>{\n const nodeIds = nodes.map(({ id: id })=>id);\n set(({ controlPanel: controlPanel })=>{\n const nodes = controlPanel.nodes.filter(({ id: id })=>!nodeIds.includes(id));\n return {\n controlPanel: {\n ...controlPanel,\n nodes: nodes\n }\n };\n });\n },\n setControlPanelNodes: (nodes)=>{\n set(({ controlPanel: controlPanel })=>{\n return {\n controlPanel: {\n ...controlPanel,\n nodes: nodes\n }\n };\n });\n },\n setControlPanelSize: (size)=>{\n set(({ controlPanel: controlPanel })=>{\n return {\n controlPanel: {\n ...controlPanel,\n size: size\n }\n };\n });\n },\n viewport: {\n x: 0,\n y: 0,\n zoom: 1\n },\n setViewport: (viewport)=>set({\n viewport: viewport\n })\n };\n};\nconst $6f5e1924a22d258c$var$useStore = (0, $djR0r$create)((0, $64d14d164a029007$export$2e2bcd8739ae039)((0, $15640845882b881f$export$2e2bcd8739ae039)($6f5e1924a22d258c$export$34c5bc865219488e)));\nvar $6f5e1924a22d258c$export$2e2bcd8739ae039 = $6f5e1924a22d258c$var$useStore;\n\n\n\nconst $de1eff52c6419df8$var$LEVA_COLOR_ACCENT2_BLUE = \"#007bff\";\nconst $de1eff52c6419df8$var$COLOR_GREEN_PRIMARY = \"#14df42\";\nconst $de1eff52c6419df8$var$COLOR_WHITE_PRIMARY = \"#ffffff\";\nconst $de1eff52c6419df8$var$colors = {\n elevation1: \"#292d39\",\n elevation2: \"#181c20\",\n elevation3: \"#373c4b\",\n accent1: \"#0066dc\",\n accent2: $de1eff52c6419df8$var$LEVA_COLOR_ACCENT2_BLUE,\n accent3: \"#3c93ff\",\n highlight1: \"#535760\",\n highlight2: \"#8c92a4\",\n highlight3: \"#fefefe\",\n vivid1: $de1eff52c6419df8$var$COLOR_GREEN_PRIMARY,\n whitePrimary: $de1eff52c6419df8$var$COLOR_WHITE_PRIMARY,\n error: \"#db5353\"\n};\nconst $de1eff52c6419df8$var$zIndex = {\n modal: 9998,\n controlPanel: 9999,\n resumeContextLayout: 10003\n};\nconst $de1eff52c6419df8$var$theme = {\n colors: $de1eff52c6419df8$var$colors,\n zIndex: $de1eff52c6419df8$var$zIndex\n};\nvar $de1eff52c6419df8$export$2e2bcd8739ae039 = $de1eff52c6419df8$var$theme;\n\n\n(0, $djR0r$injectGlobal)`\n .react-flow {\n .react-flow__pane {\n /* background: rgb(106 106 106); */\n /* background: \"white\"; */\n // background: #292d39;\n background: ${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.elevation3};\n }\n\n .react-flow__background {\n /* background: #efefef; */\n stroke: white;\n }\n\n .react-flow__node-default {\n background: #292d39;\n color: white;\n border: none;\n /* background: transparent; */\n }\n\n .react-flow__node {\n padding: 0;\n width: auto;\n }\n\n .react-flow__edge-path {\n stroke: ${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2};\n }\n\n .react-flow__node.selected {\n border: 1px solid ${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2};\n box-shadow: 0 0 0 0.5px #${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2};\n }\n\n .react-flow__node-default.selected, .react-flow__node-default.selected:hover {\n box-shadow: 0 0 0 0.5px #${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2};\n }\n\n /* .react-flow__minimap-mask {\n fill: ${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.elevation1}\n }\n\n .react-flow__minimap-node {\n fill:${(0, $de1eff52c6419df8$export$2e2bcd8739ae039).colors.accent2}\n } */\n }\n\n`;\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $40266ad71a95dba8$var$useTheme = ()=>{\n return (0, $djR0r$useTheme)();\n};\nvar $40266ad71a95dba8$export$2e2bcd8739ae039 = $40266ad71a95dba8$var$useTheme;\n\n\n\n\n\n\nconst $ee2caa06ac02c5bc$export$ef9839ae55b8ba40 = (0, $djR0r$emotionstyled)((0, $djR0r$Item))``;\nconst $ee2caa06ac02c5bc$export$98eff9c5659394e3 = (0, $djR0r$emotionstyled)((0, $djR0r$Menu))`\n background: ${({ colors: colors })=>colors.elevation2};\n padding: 0;\n border-radius: 0;\n\n .react-contexify__item__content {\n color: ${({ colors: colors })=>colors.whitePrimary};\n }\n\n .react-contexify__separator {\n background-color: ${({ colors: colors })=>colors.elevation1};\n margin: 0;\n }\n`;\n\n\nconst $b2eaa5961e75d009$export$d4cd258d01c03112 = \"editor-edge-menu\";\nconst $b2eaa5961e75d009$export$8b2e4a15453bac1e = ()=>{\n const { show: show } = (0, $djR0r$useContextMenu)({\n id: $b2eaa5961e75d009$export$d4cd258d01c03112\n });\n const onContextMenu = (0, $djR0r$useCallback)((event, edge)=>{\n event.stopPropagation();\n show(event, {\n props: {\n edge: edge\n }\n });\n }, [\n show\n ]);\n return {\n onContextMenu: onContextMenu\n };\n};\nconst $b2eaa5961e75d009$var$EdgeContextMenu = ()=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const removeEdges = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.removeEdges);\n return (0, $djR0r$jsx)((0, $djR0r$Fragment), {\n children: (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$98eff9c5659394e3), {\n id: $b2eaa5961e75d009$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: (event)=>removeEdges([\n event.props.edge\n ]),\n children: \"Delete Edge (DEL)\"\n })\n })\n });\n};\nvar $b2eaa5961e75d009$export$2e2bcd8739ae039 = $b2eaa5961e75d009$var$EdgeContextMenu;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $96e3c18b52e89add$var$ModalOuter = (0, $djR0r$emotionstyled).div`\n position: fixed;\n z-index: ${({ theme: theme })=>theme.zIndex.modal};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: ${({ theme: theme })=>theme.colors.elevation3}cc;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\nconst $96e3c18b52e89add$var$ModalInner = (0, $djR0r$emotionstyled).div`\n background: ${({ theme: theme })=>theme.colors.elevation2};\n box-shadow: 1px 1px 1px 1px ${({ theme: theme })=>theme.colors.elevation1};\n color: white;\n width: 70%;\n height: 80%;\n overflow-y: scroll;\n position: relative;\n`;\nconst $96e3c18b52e89add$var$ModalCloser = (0, $djR0r$emotionstyled)((0, $djR0r$MdClose))`\n position: absolute;\n top: 0.2rem;\n right: 0.2rem;\n cursor: pointer;\n`;\nconst $96e3c18b52e89add$var$Modal = ({ children: children, onClose: onClose, ...props })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n (0, $djR0r$useEffect)(()=>{\n const escHandler = (event)=>{\n if (event.key === \"Escape\") onClose?.();\n };\n document.addEventListener(\"keydown\", escHandler);\n return ()=>{\n document.removeEventListener(\"keydown\", escHandler);\n };\n }, [\n onClose\n ]);\n return /*#__PURE__*/ (0, $djR0r$createPortal)((0, $djR0r$jsx)($96e3c18b52e89add$var$ModalOuter, {\n theme: theme,\n onClick: onClose,\n children: (0, $djR0r$jsxs)($96e3c18b52e89add$var$ModalInner, {\n ...props,\n onClick: (e)=>{\n e.stopPropagation();\n },\n theme: theme,\n children: [\n children,\n (0, $djR0r$jsx)($96e3c18b52e89add$var$ModalCloser, {\n theme: theme,\n onClick: onClose\n })\n ]\n })\n }), document.body);\n};\nvar $96e3c18b52e89add$export$2e2bcd8739ae039 = $96e3c18b52e89add$var$Modal;\n\n\n\n\n\n\n\nconst $7eaa077f1f9bb73b$var$InputWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n position: relative;\n`;\nconst $7eaa077f1f9bb73b$var$InputInner = (0, $djR0r$emotionstyled).input`\n padding-right: 2rem;\n padding-left: 0.3rem;\n width: 100%;\n appearance: textfield;\n font-size: inherit;\n background: none;\n border: none;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n appearance: textfield;\n cursor: auto;\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n border-radius: 0.1rem;\n height: 2rem;\n color: ${({ theme: theme })=>theme.colors.highlight2};\n\n &:focus,\n &:hover {\n box-shadow: 0 0 0 var(--leva-borderWidths-focus)\n ${({ theme: theme })=>theme.colors.accent2};\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin-right: 1rem;\n }\n`;\nconst $7eaa077f1f9bb73b$var$FiltersWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n flex-direction: column;\n padding: 0.6rem;\n gap: 0.6rem;\n border-right: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n min-width: 14rem;\n`;\nconst $7eaa077f1f9bb73b$var$PluginName = (0, $djR0r$emotionstyled).label`\n user-select: none;\n input {\n display: none;\n }\n input:checked + span {\n color: ${({ theme: theme })=>theme.colors.accent2};\n }\n &:hover {\n color: ${({ theme: theme })=>theme.colors.accent3};\n cursor: pointer;\n }\n`;\nconst $7eaa077f1f9bb73b$var$Filters = ({ onChange: onChange, value: value })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const plugins = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ plugins: plugins })=>plugins);\n const inputRef = (0, $djR0r$useRef)(null);\n (0, $djR0r$useEffect)(()=>{\n if (!inputRef.current) return;\n inputRef.current.focus();\n }, [\n inputRef\n ]);\n return (0, $djR0r$jsxs)($7eaa077f1f9bb73b$var$FiltersWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($7eaa077f1f9bb73b$var$InputWrapper, {\n children: (0, $djR0r$jsx)($7eaa077f1f9bb73b$var$InputInner, {\n ref: inputRef,\n theme: theme,\n value: value.search || \"\",\n placeholder: \"search...\",\n onChange: (event)=>onChange({\n ...value,\n search: event.target.value\n })\n })\n }),\n plugins.map(({ name: name, components: components }, index)=>{\n if (!name) return null;\n return (0, $djR0r$jsxs)($7eaa077f1f9bb73b$var$PluginName, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)(\"input\", {\n type: \"checkbox\",\n name: \"plugin\",\n value: name,\n checked: name === value.plugin,\n onChange: ()=>{\n onChange({\n ...value,\n plugin: name === value.plugin ? null : name\n });\n }\n }),\n (0, $djR0r$jsx)(\"span\", {\n children: name\n })\n ]\n }, index);\n })\n ]\n });\n};\nvar $7eaa077f1f9bb73b$export$2e2bcd8739ae039 = $7eaa077f1f9bb73b$var$Filters;\n\n\n\n\n\n\n\nconst $682a69da6ef2887d$var$PluginsWrapper = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n width: 100%;\n`);\nconst $682a69da6ef2887d$var$PluginWrapper = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n`);\nconst $682a69da6ef2887d$var$NodesList = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).ul`\n list-style: none;\n margin: 0;\n padding: 0;\n padding-bottom: 10px;\n columns: 2;\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n border-radius: 4px;\n margin-bottom: 0.5rem;\n &:hover {\n border-color: ${({ theme: theme })=>theme.colors.accent2};\n cursor: pointer;\n }\n }\n`);\nconst $682a69da6ef2887d$var$NodeTitle = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`);\nconst $682a69da6ef2887d$var$NodeDescription = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n color: ${({ theme: theme })=>theme.colors.highlight2};\n font-size: 12px;\n`);\nconst $682a69da6ef2887d$var$PluginHeader = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div``);\nconst $682a69da6ef2887d$var$PluginTitle = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n font-size: 1.1rem;\n padding: 0.25rem 0;\n color: ${({ theme: theme })=>theme.colors.highlight3};\n`);\nconst $682a69da6ef2887d$var$PluginDescription = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n color: ${({ theme: theme })=>theme.colors.highlight2};\n font-size: 12px;\n`);\nconst $682a69da6ef2887d$var$Plugins = ({ onComponentClick: onComponentClick, filters: { plugin: plugin, search: search } })=>{\n const plugins = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ plugins: plugins })=>plugins);\n const pluginsGroup = (0, $djR0r$useMemo)(()=>{\n if (!plugin) return plugins;\n return plugins.filter(({ name: name })=>name === plugin);\n // return plugins.filter(({ type }) => type === )\n }, [\n plugins,\n plugin\n ]);\n const filteredPlugins = (0, $djR0r$useMemo)(()=>{\n if (!search) return pluginsGroup;\n return pluginsGroup.map((plugin)=>({\n ...plugin,\n components: plugin.components.filter(({ type: type, name: name })=>type.toLocaleLowerCase().includes(search.toLocaleLowerCase()) || name?.toLocaleLowerCase().includes(search.toLocaleLowerCase()))\n }));\n }, [\n pluginsGroup,\n search\n ]);\n return (0, $djR0r$jsx)($682a69da6ef2887d$var$PluginsWrapper, {\n children: filteredPlugins.map(({ name: name, description: description, components: components }, index)=>{\n if (!components.length) return null;\n return (0, $djR0r$jsxs)($682a69da6ef2887d$var$PluginWrapper, {\n children: [\n (0, $djR0r$jsxs)($682a69da6ef2887d$var$PluginHeader, {\n children: [\n (0, $djR0r$jsx)($682a69da6ef2887d$var$PluginTitle, {\n children: name\n }),\n (0, $djR0r$jsx)($682a69da6ef2887d$var$PluginDescription, {\n children: description\n })\n ]\n }),\n (0, $djR0r$jsx)($682a69da6ef2887d$var$NodesList, {\n children: components.sort((a, b)=>a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1).map((component, idx)=>(0, $djR0r$jsxs)(\"li\", {\n onClick: ()=>onComponentClick(component),\n children: [\n (0, $djR0r$jsx)($682a69da6ef2887d$var$NodeTitle, {\n children: component.name || component.type\n }),\n component.description && (0, $djR0r$jsx)($682a69da6ef2887d$var$NodeDescription, {\n children: component.description\n })\n ]\n }, idx))\n })\n ]\n }, index);\n })\n });\n};\nvar $682a69da6ef2887d$export$2e2bcd8739ae039 = $682a69da6ef2887d$var$Plugins;\n\n\nconst $881ab8dac829e111$var$AddNodeWrapper = (0, $djR0r$emotionstyled).div`\n height: 100%;\n width: 100%;\n display: flex;\n gap: 1rem;\n`;\nconst $881ab8dac829e111$var$PluginsPanel = (0, $djR0r$emotionstyled).div`\n flex-grow: 1;\n height: 100%;\n overflow-y: scroll;\n`;\nconst $881ab8dac829e111$var$AddNode = ({ isOpen: isOpen, closeMenu: closeMenu, mousePosition: mousePosition })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const { screenToFlowPosition: screenToFlowPosition } = (0, $djR0r$useReactFlow)();\n const { createNode: createNode } = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ createNode: createNode })=>({\n createNode: createNode\n }));\n const [filtersState, setFiltersState] = (0, $djR0r$useState)({});\n const onComponentClick = (0, $djR0r$useCallback)(({ type: type })=>{\n const { x: x, y: y } = screenToFlowPosition(mousePosition);\n const newNode = {\n //@TODO: generate node id in `createNode` function\n id: `${type}-${+new Date()}`,\n type: type,\n data: {\n label: type\n },\n position: {\n x: x,\n y: y\n },\n targetPosition: (0, $djR0r$Position).Left,\n sourcePosition: (0, $djR0r$Position).Right\n };\n createNode(newNode);\n closeMenu();\n }, [\n mousePosition,\n screenToFlowPosition,\n createNode,\n closeMenu,\n mousePosition\n ]);\n return isOpen ? (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: ()=>{\n closeMenu();\n setFiltersState({});\n },\n children: (0, $djR0r$jsxs)($881ab8dac829e111$var$AddNodeWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)((0, $7eaa077f1f9bb73b$export$2e2bcd8739ae039), {\n onChange: setFiltersState,\n value: filtersState\n }),\n (0, $djR0r$jsx)($881ab8dac829e111$var$PluginsPanel, {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $682a69da6ef2887d$export$2e2bcd8739ae039), {\n filters: filtersState,\n onComponentClick: (component)=>{\n onComponentClick(component);\n setFiltersState({});\n }\n })\n })\n ]\n })\n }) : null;\n};\nvar $881ab8dac829e111$export$2e2bcd8739ae039 = $881ab8dac829e111$var$AddNode;\n\n\n\n\n\n\n\n\n\n\nconst $7f7ac6f44564377e$var$UploadPatchWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme: theme })=>theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\nconst $7f7ac6f44564377e$var$DropZoneInner = (0, $djR0r$emotionstyled).div`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\nconst $7f7ac6f44564377e$var$FileUploadIcon = (0, $djR0r$emotionstyled)((0, $djR0r$FaFileUpload))`\n width: 100%;\n height: 8rem;\n`;\nconst $7f7ac6f44564377e$var$FileUploadMessage = (0, $djR0r$emotionstyled).div`\n font-size: 2rem;\n`;\nconst $7f7ac6f44564377e$var$UploadPatch = ({ isOpen: isOpen, closeMenu: closeMenu })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const setGraph = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ setGraph: setGraph })=>setGraph);\n const setEditorState = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setEditorState);\n const fileInputRef = (0, $djR0r$useRef)(null);\n const uploadFile = (0, $djR0r$useCallback)((files)=>{\n const [file] = files || [];\n file.text().then(JSON.parse).then((editorState)=>{\n setEditorState(editorState);\n closeMenu();\n }).catch(console.error);\n }, [\n setGraph,\n closeMenu\n ]);\n const onTargetClick = ()=>{\n fileInputRef.current?.click();\n };\n return isOpen ? (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: closeMenu,\n children: (0, $djR0r$jsxs)($7f7ac6f44564377e$var$UploadPatchWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)(\"input\", {\n onChange: ({ target: { files: files } })=>uploadFile(files),\n ref: fileInputRef,\n type: \"file\",\n className: \"hidden\",\n style: {\n display: \"none\"\n },\n accept: \".json\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$FileDrop), {\n className: \"drop-zone-wrapper\",\n targetClassName: \"drop-zone\",\n draggingOverTargetClassName: \"drop-zone-drag-over\",\n onTargetClick: onTargetClick,\n onDrop: (files)=>uploadFile(files),\n children: (0, $djR0r$jsxs)($7f7ac6f44564377e$var$DropZoneInner, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($7f7ac6f44564377e$var$FileUploadIcon, {}),\n (0, $djR0r$jsx)($7f7ac6f44564377e$var$FileUploadMessage, {\n children: \"click or drop file here\"\n })\n ]\n })\n })\n ]\n })\n }) : null;\n};\nvar $7f7ac6f44564377e$export$2e2bcd8739ae039 = $7f7ac6f44564377e$var$UploadPatch;\n\n\n\n\n\n\n\n\n\n\nconst $5da3065ea9b7ce79$var$UploadProjectWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme: theme })=>theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\nconst $5da3065ea9b7ce79$var$DropZoneInner = (0, $djR0r$emotionstyled).div`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\nconst $5da3065ea9b7ce79$var$FileUploadIcon = (0, $djR0r$emotionstyled)((0, $djR0r$FaFileUpload))`\n width: 100%;\n height: 8rem;\n`;\nconst $5da3065ea9b7ce79$var$FileUploadMessage = (0, $djR0r$emotionstyled).div`\n font-size: 2rem;\n`;\n// @TODO: unify with upload file\nconst $5da3065ea9b7ce79$var$UploadProject = ({ isOpen: isOpen, closeMenu: closeMenu })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const setProject = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setProject);\n const fileInputRef = (0, $djR0r$useRef)(null);\n const uploadFile = (0, $djR0r$useCallback)((files)=>{\n const [file] = files || [];\n file.text().then(JSON.parse).then((projectState)=>{\n setProject(projectState);\n closeMenu();\n }).catch(console.error);\n }, [\n setProject,\n closeMenu\n ]);\n const onTargetClick = ()=>{\n fileInputRef.current?.click();\n };\n return isOpen ? (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: closeMenu,\n children: (0, $djR0r$jsxs)($5da3065ea9b7ce79$var$UploadProjectWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)(\"input\", {\n onChange: ({ target: { files: files } })=>uploadFile(files),\n ref: fileInputRef,\n type: \"file\",\n className: \"hidden\",\n style: {\n display: \"none\"\n },\n accept: \".json\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$FileDrop), {\n className: \"drop-zone-wrapper\",\n targetClassName: \"drop-zone\",\n draggingOverTargetClassName: \"drop-zone-drag-over\",\n onTargetClick: onTargetClick,\n onDrop: (files)=>uploadFile(files),\n children: (0, $djR0r$jsxs)($5da3065ea9b7ce79$var$DropZoneInner, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($5da3065ea9b7ce79$var$FileUploadIcon, {}),\n (0, $djR0r$jsx)($5da3065ea9b7ce79$var$FileUploadMessage, {\n children: \"click or drop file here\"\n })\n ]\n })\n })\n ]\n })\n }) : null;\n};\nvar $5da3065ea9b7ce79$export$2e2bcd8739ae039 = $5da3065ea9b7ce79$var$UploadProject;\n\n\n\nconst $28ba16bd16f671c0$export$d4cd258d01c03112 = \"editor-menu\";\nconst $28ba16bd16f671c0$export$59ce2a6808e35a29 = ()=>{\n const { show: show } = (0, $djR0r$useContextMenu)({\n id: $28ba16bd16f671c0$export$d4cd258d01c03112\n });\n return {\n onContextMenu: show\n };\n};\nconst $28ba16bd16f671c0$var$EditorContextMenu = ({ editorContextMenu: editorContextMenu = [] })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const [mousePosition, setMousePosition] = (0, $djR0r$useState)({\n x: 0,\n y: 0\n });\n const [showAddNode, setShowAddNode] = (0, $djR0r$useState)(false);\n const [showUploadPatch, setShowUploadPatch] = (0, $djR0r$useState)(false);\n const [showUploadProject, setShowUploadProject] = (0, $djR0r$useState)(false);\n const addNodeHandler = (0, $djR0r$useCallback)((x, y)=>{\n setMousePosition({\n x: x,\n y: y\n });\n setShowAddNode(true);\n }, [\n setShowAddNode\n ]);\n const pasteBuffer = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.pasteBuffer);\n const { screenToFlowPosition: screenToFlowPosition } = (0, $djR0r$useReactFlow)();\n const pasteBufferHandler = (0, $djR0r$useCallback)((mousePosition)=>{\n const { x: x, y: y } = screenToFlowPosition(mousePosition);\n pasteBuffer(x, y);\n }, [\n setShowAddNode,\n screenToFlowPosition\n ]);\n const clearGraph = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ clearGraph: clearGraph })=>clearGraph);\n const getEditorState = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.getEditorState);\n const getProject = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.getProject);\n const deleteAllHandler = (0, $djR0r$useCallback)(()=>{\n clearGraph();\n }, [\n clearGraph\n ]);\n const toggleHelp = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n const historyBack = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.history.back);\n const historyForward = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.history.forward);\n const historyPointer = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.history.pointer);\n const historyBuffer = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.history.buffer);\n const copySelectedItems = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.copySelectedItems);\n const nodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodes);\n const selectedNodes = (0, $djR0r$useMemo)(()=>nodes.filter(({ selected: selected })=>selected), [\n nodes\n ]);\n const currentCopyBuffer = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.copyBuffer);\n const reactFlowInstance = (0, $djR0r$useReactFlow)();\n const downloadPatchHandler = (0, $djR0r$useCallback)(()=>{\n const fileName = \"web-noise-patch.json\";\n const editorState = getEditorState();\n const data = {\n ...editorState\n };\n (0, $djR0r$jsfiledownload)(JSON.stringify(data, null, 2), fileName);\n }, [\n getEditorState,\n reactFlowInstance\n ]);\n const downloadProjectHandler = (0, $djR0r$useCallback)(()=>{\n const fileName = \"web-noise-project.json\";\n const projectState = getProject();\n const data = {\n ...projectState\n };\n (0, $djR0r$jsfiledownload)(JSON.stringify(data, null, 2), fileName);\n }, [\n getEditorState,\n reactFlowInstance\n ]);\n (0, $djR0r$useEffect)(()=>{\n (0, $djR0r$hotkeysjs)(\"command+shift+a\", ()=>{\n addNodeHandler(200, 50);\n return false;\n });\n //@TODO: find more elegant way to handle ?\n (0, $djR0r$hotkeysjs)(\"shift+/\", ()=>{\n toggleHelp();\n return false;\n });\n (0, $djR0r$hotkeysjs)(\"command+z\", ()=>{\n historyBack();\n return false;\n });\n (0, $djR0r$hotkeysjs)(\"command+shift+z\", ()=>{\n historyForward();\n return false;\n });\n (0, $djR0r$hotkeysjs)(\"command+c\", ()=>{\n copySelectedItems();\n return false;\n });\n (0, $djR0r$hotkeysjs)(\"command+v\", ()=>{\n pasteBufferHandler({\n x: 200,\n y: 50\n });\n return false;\n });\n return ()=>{\n (0, $djR0r$hotkeysjs).unbind();\n };\n }, [\n addNodeHandler,\n pasteBufferHandler\n ]);\n return (0, $djR0r$jsxs)((0, $djR0r$Fragment), {\n children: [\n (0, $djR0r$jsx)((0, $881ab8dac829e111$export$2e2bcd8739ae039), {\n isOpen: showAddNode,\n closeMenu: ()=>setShowAddNode(false),\n mousePosition: mousePosition\n }),\n (0, $djR0r$jsx)((0, $7f7ac6f44564377e$export$2e2bcd8739ae039), {\n isOpen: showUploadPatch,\n closeMenu: ()=>setShowUploadPatch(false)\n }),\n (0, $djR0r$jsx)((0, $5da3065ea9b7ce79$export$2e2bcd8739ae039), {\n isOpen: showUploadProject,\n closeMenu: ()=>setShowUploadProject(false)\n }),\n (0, $djR0r$jsxs)((0, $ee2caa06ac02c5bc$export$98eff9c5659394e3), {\n id: $28ba16bd16f671c0$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: [\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: ({ triggerEvent: { clientX: clientX, clientY: clientY } })=>addNodeHandler(clientX, clientY),\n children: \"Add Node (\\u2318+\\u21E7+A)\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: deleteAllHandler,\n children: \"Delete All\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: downloadPatchHandler,\n children: \"Download patch\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: ()=>setShowUploadPatch(true),\n children: \"Upload patch\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: downloadProjectHandler,\n children: \"Download project\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: ()=>setShowUploadProject(true),\n children: \"Upload project\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n disabled: historyPointer === 0,\n onClick: historyBack,\n children: \"Undo (\\u2318+z)\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n disabled: historyPointer === historyBuffer.length,\n onClick: historyForward,\n children: \"Redo (\\u2318+\\u21E7+Z)\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n disabled: !selectedNodes.length,\n onClick: copySelectedItems,\n children: \"Copy Selected (\\u2318+c)\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n disabled: !currentCopyBuffer.nodes.length,\n onClick: ({ triggerEvent: { clientX: x, clientY: y } })=>pasteBufferHandler({\n x: x,\n y: y\n }),\n children: \"Paste (\\u2318+v)\"\n }),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n editorContextMenu.map((item, index)=>(0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n children: item\n }, index)),\n (0, $djR0r$jsx)((0, $djR0r$Separator), {}),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: toggleHelp,\n children: \"Help (\\u21E7+?)\"\n })\n ]\n })\n ]\n });\n};\nvar $28ba16bd16f671c0$export$2e2bcd8739ae039 = $28ba16bd16f671c0$var$EditorContextMenu;\n\n\n\n\n\n\n\n\n\nconst $0ffe51df9638a254$export$d4cd258d01c03112 = \"editor-node-menu\";\nconst $0ffe51df9638a254$export$cbbbfb9fb15f3780 = ()=>{\n const { show: show } = (0, $djR0r$useContextMenu)({\n id: $0ffe51df9638a254$export$d4cd258d01c03112\n });\n const onContextMenu = (0, $djR0r$useCallback)((event, node)=>{\n event.stopPropagation();\n show(event, {\n props: {\n node: node\n }\n });\n }, []);\n return {\n onContextMenu: onContextMenu\n };\n};\nconst $0ffe51df9638a254$var$NodeContextMenu = (args)=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const removeNodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.removeNodes);\n const addNodeToControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.addNodeToControlPanel);\n const removeNodeFromControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.removeNodeFromControlPanel);\n const copy = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.copy);\n const nodesConfiguration = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration);\n const controlPanelNodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.controlPanel.nodes);\n const isOnControlPanel = (0, $djR0r$useCallback)(({ props: props })=>{\n if (!props?.node.type) return false;\n return !!controlPanelNodes.find(({ id: id })=>id === props.node.id);\n }, [\n controlPanelNodes\n ]);\n const hasControlPanelNode = (0, $djR0r$useCallback)(({ props: props })=>{\n if (!props?.node.type) return false;\n const nodeConfiguration = nodesConfiguration[props.node.type];\n return !!nodeConfiguration?.controlPanelNode;\n }, [\n nodesConfiguration\n ]);\n return (0, $djR0r$jsx)((0, $djR0r$Fragment), {\n children: (0, $djR0r$jsxs)((0, $ee2caa06ac02c5bc$export$98eff9c5659394e3), {\n id: $0ffe51df9638a254$export$d4cd258d01c03112,\n animation: false,\n colors: theme.colors,\n children: [\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: (event)=>removeNodes([\n event.props.node\n ]),\n children: \"Delete Node (DEL)\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n hidden: (...args)=>!hasControlPanelNode(...args) || isOnControlPanel(...args),\n onClick: (event)=>addNodeToControlPanel(event.props.node),\n children: \"Add To Control Panel\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n hidden: (...args)=>!hasControlPanelNode(...args) || !isOnControlPanel(...args),\n onClick: (event)=>removeNodeFromControlPanel(event.props.node),\n children: \"Remove From Control Panel\"\n }),\n (0, $djR0r$jsx)((0, $ee2caa06ac02c5bc$export$ef9839ae55b8ba40), {\n onClick: (event)=>copy({\n nodes: [\n event.props.node\n ],\n edges: []\n }),\n children: \"Copy (\\u2318+c)\"\n })\n ]\n })\n });\n};\nvar $0ffe51df9638a254$export$2e2bcd8739ae039 = $0ffe51df9638a254$var$NodeContextMenu;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $607523634e2ef7fa$var$useAudioNode = (id)=>{\n const patch = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ patch: patch })=>patch);\n return patch.audioNodes.get(id);\n};\nvar $607523634e2ef7fa$export$2e2bcd8739ae039 = $607523634e2ef7fa$var$useAudioNode;\n\n\n\n\nconst $c2be4ce66a537e42$var$useNode = (id)=>{\n const updateNodeData = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ updateNodeData: updateNodeData })=>updateNodeData);\n const updateNodeValues = (0, $djR0r$useCallback)((values)=>updateNodeData(id, {\n values: values\n }), [\n id,\n updateNodeData\n ]);\n const updateNodeConfig = (0, $djR0r$useCallback)((config)=>updateNodeData(id, {\n config: config\n }), [\n id,\n updateNodeData\n ]);\n const updateNodeLabel = (0, $djR0r$useCallback)((label)=>updateNodeData(id, {\n label: label\n }), [\n id,\n updateNodeData\n ]);\n return {\n updateNodeValues: updateNodeValues,\n updateNodeConfig: updateNodeConfig,\n updateNodeLabel: updateNodeLabel\n };\n};\nvar $c2be4ce66a537e42$export$2e2bcd8739ae039 = $c2be4ce66a537e42$var$useNode;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst $61078804f94ec8d6$export$5abe11f802ebd1f2 = (0, $djR0r$emotionstyled).input`\n width: 100%;\n background: none;\n border: none;\n text-align: center;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n\n &:focus {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-within {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-vissible {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:not([readonly]):focus {\n color: #fff;\n appearance: none;\n cursor: auto;\n background-color: var(--leva-colors-elevation2);\n padding: 0.3rem;\n border-radius: 0.2rem;\n }\n`;\nconst $61078804f94ec8d6$var$EditableLabel = ({ onChange: onChange, value: value = \"\", className: className })=>{\n const labelInputRef = (0, $djR0r$useRef)(null);\n const [labelEditMode, setLabelEditMode] = (0, $djR0r$useState)(false);\n const editNodeLabel = (0, $djR0r$useCallback)((event)=>{\n //@ts-ignore\n event.target?.select();\n setLabelEditMode(true);\n }, [\n setLabelEditMode\n ]);\n const exitEditMode = (0, $djR0r$useCallback)(()=>{\n window.getSelection()?.collapseToEnd();\n setLabelEditMode(false);\n }, [\n setLabelEditMode\n ]);\n const saveNodeLabel = (0, $djR0r$useCallback)(()=>{\n exitEditMode();\n if (labelInputRef.current) onChange(labelInputRef.current.value);\n }, [\n labelInputRef,\n exitEditMode,\n onChange\n ]);\n const cancelNodeLabelEdit = (0, $djR0r$useCallback)(()=>{\n exitEditMode();\n if (labelInputRef.current && value) labelInputRef.current.value = value;\n }, [\n labelInputRef,\n exitEditMode,\n value\n ]);\n (0, $djR0r$useEffect)(()=>{\n if (!labelInputRef.current) return;\n labelInputRef.current.value = value;\n }, [\n value,\n labelInputRef\n ]);\n return (0, $djR0r$jsx)($61078804f94ec8d6$export$5abe11f802ebd1f2, {\n ref: labelInputRef,\n type: \"text\",\n readOnly: !labelEditMode,\n onDoubleClick: (event)=>editNodeLabel(event),\n onBlur: saveNodeLabel,\n onKeyDown: (event)=>{\n switch(event.key){\n case \"Escape\":\n cancelNodeLabelEdit();\n break;\n case \"Enter\":\n saveNodeLabel();\n break;\n }\n },\n className: className\n });\n};\nvar $61078804f94ec8d6$export$2e2bcd8739ae039 = $61078804f94ec8d6$var$EditableLabel;\n\n\n\n\n\n\n\n\n\nconst $de6d95f0aff74a75$var$NodeInfoWrapper = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n height: 100%;\n width: 100%;\n overflow: scroll;\n padding: 0.6rem;\n box-sizing: border-box;\n\n hr {\n border: none;\n border-bottom: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n }\n\n code {\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n color: ${({ theme: theme })=>theme.colors.highlight3};\n font-family:\n source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n }\n\n pre {\n background-color: ${({ theme: theme })=>theme.colors.elevation3};\n padding: 0.2rem 0.3rem;\n border-radius: 1px;\n }\n\n a {\n color: ${({ theme: theme })=>theme.colors.accent1};\n }\n`);\nconst $de6d95f0aff74a75$var$useNodeManifest = (type)=>{\n const data = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration[type]);\n return data;\n};\nconst $de6d95f0aff74a75$var$NodeInfoModal = ({ isOpen: isOpen, onClose: onClose, type: nodeType, node: node })=>{\n const { info: info, portsDescription: portsDescription } = $de6d95f0aff74a75$var$useNodeManifest(nodeType);\n const portsInfo = (0, $djR0r$useMemo)(()=>{\n const parts = [];\n const inputPorts = node.inputs;\n if (inputPorts) {\n parts.push(`## Inputs`);\n for(const portName in inputPorts){\n const port = inputPorts[portName];\n parts.push(`### *${portName}*`);\n const description = portsDescription?.inputs?.[portName];\n if (description) parts.push(description);\n if (Array.isArray(port.type)) parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n else parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n if (port.range) parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n if (port.defaultValue !== undefined) parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n const outputPorts = node.outputs;\n if (outputPorts) {\n parts.push(`## Outputs`);\n for(const portName in outputPorts){\n const port = outputPorts[portName];\n parts.push(`### *${portName}*`);\n const description = portsDescription?.outputs?.[portName];\n if (description) parts.push(description);\n if (Array.isArray(port.type)) parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n else parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n if (port.range) parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n if (port.defaultValue !== undefined) parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n return parts.join(\"\\n\\n\");\n }, [\n node,\n portsDescription\n ]);\n const combinedInfo = (info || \"\") + \"\\n\\n\" + portsInfo;\n return isOpen ? (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: onClose,\n children: (0, $djR0r$jsx)($de6d95f0aff74a75$var$NodeInfoWrapper, {\n dangerouslySetInnerHTML: {\n __html: (0, $djR0r$marked)(combinedInfo || \"\")\n }\n })\n }) : null;\n};\nvar $de6d95f0aff74a75$export$2e2bcd8739ae039 = $de6d95f0aff74a75$var$NodeInfoModal;\n\n\nconst $8d34719b9811e505$var$NodeWrapper = (0, $djR0r$emotionstyled).div`\n background-color: var(--leva-colors-elevation1);\n`;\nconst $8d34719b9811e505$var$NodeLoaderWrapper = (0, $djR0r$emotionstyled)($8d34719b9811e505$var$NodeWrapper)`\n padding: 2rem 5rem;\n`;\nconst $8d34719b9811e505$var$NodeErrorWrapper = (0, $djR0r$emotionstyled)($8d34719b9811e505$var$NodeWrapper)`\n padding: 1rem 2rem;\n`;\nconst $8d34719b9811e505$var$SettingsIconWrapper = (0, $djR0r$emotionstyled)((0, $djR0r$MdSettings))`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\nconst $8d34719b9811e505$var$InfoIconWrapper = (0, $djR0r$emotionstyled)((0, $djR0r$MdInfoOutline))`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\nconst $8d34719b9811e505$var$Section = (0, $djR0r$emotionstyled).div`\n position: relative;\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n background-color: var(--leva-colors-elevation1);\n`;\nconst $8d34719b9811e505$export$1bdb8f2d1fe25c22 = (0, $djR0r$emotionstyled)($8d34719b9811e505$var$Section)`\n display: flex;\n height: var(--leva-sizes-titleBarHeight);\n touch-action: none;\n align-items: center;\n justify-content: center;\n flex: 1 1 0%;\n color: var(--leva-colors-highlight1);\n padding: 0 0.4rem;\n gap: 0.3rem;\n`;\nconst $8d34719b9811e505$export$bfd3bd1fa283e3c6 = (0, $djR0r$emotionstyled)($8d34719b9811e505$var$Section)(({ theme: theme })=>`\n display: grid;\n grid-template-areas: \"inputs outputs\";\n background: ${theme.colors.elevation2};\n border-bottom: 1px solid ${theme.colors.elevation1};\n color: ${theme.colors.highlight3};\n font-size: 0.6rem;\n`);\nconst $8d34719b9811e505$export$f1afba0ff9ea1277 = (0, $djR0r$emotionstyled).div`\n grid-area: inputs;\n text-align: left;\n`;\nconst $8d34719b9811e505$export$af4f9b41fc32ed9e = (0, $djR0r$emotionstyled).div`\n grid-area: outputs;\n text-align: right;\n`;\nconst $8d34719b9811e505$export$a2d375858cc72119 = (0, $djR0r$emotionstyled).div`\n position: relative;\n padding: 5px 10px;\n`;\nconst $8d34719b9811e505$var$portColors = {\n [(0, $9738c58e5420c085$export$b0b7b95ee465c83c).Audio]: \"#4ade80\",\n [(0, $9738c58e5420c085$export$b0b7b95ee465c83c).Gate]: \"#c084fc\",\n [(0, $9738c58e5420c085$export$b0b7b95ee465c83c).Number]: \"#38bdf8\",\n [(0, $9738c58e5420c085$export$b0b7b95ee465c83c).Any]: \"#ffffff\"\n};\nconst $8d34719b9811e505$var$StyledHandle = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)((0, $djR0r$Handle), {\n shouldForwardProp: (prop)=>prop !== \"portType\"\n})`\n --port-color: ${(props)=>{\n if (!props.portType) return props.theme.colors.highlight2;\n if (Array.isArray(props.portType)) {\n const colors = props.portType.map((type)=>$8d34719b9811e505$var$portColors[type]);\n return `linear-gradient(0.25turn, ${colors.join(\", \")});`;\n } else return $8d34719b9811e505$var$portColors[props.portType];\n}};\n border-color: var(--port-color);\n background: var(--port-color);\n box-shadow: 0px 0px 0px 1px ${({ theme: theme })=>theme.colors.elevation2} inset;\n`);\nconst $8d34719b9811e505$var$StyledInputHandle = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)($8d34719b9811e505$var$StyledHandle)`\n left: -3px;\n`);\nconst $8d34719b9811e505$export$9ea0feffc20ee81 = ({ ...props })=>(0, $djR0r$jsx)($8d34719b9811e505$var$StyledInputHandle, {\n ...props,\n type: \"target\",\n position: (0, $djR0r$Position).Left\n });\nconst $8d34719b9811e505$export$222539e2a2fac4e0 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)($8d34719b9811e505$var$StyledHandle)`\n right: -3px;\n`);\nconst $8d34719b9811e505$export$496e5e1ee1696f64 = (props)=>(0, $djR0r$jsx)($8d34719b9811e505$export$222539e2a2fac4e0, {\n ...props,\n type: \"source\",\n position: (0, $djR0r$Position).Right\n });\nconst $8d34719b9811e505$export$7e0b3af1e60a3273 = ({ className: className, ...props })=>(0, $djR0r$jsx)($8d34719b9811e505$export$1bdb8f2d1fe25c22, {\n ...props,\n className: [\n className,\n (0, $9738c58e5420c085$export$956b3cf15d7c363)\n ].join(\" \")\n });\nconst $8d34719b9811e505$var$useNodeManifest = (type)=>{\n const data = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration[type]);\n return data;\n};\nconst $8d34719b9811e505$var$useConfigNode = (type)=>{\n const { configNode: ConfigNode } = $8d34719b9811e505$var$useNodeManifest(type);\n return {\n ConfigNode: ConfigNode\n };\n};\nconst $8d34719b9811e505$export$361064385d50ec44 = (props)=>{\n const { id: id, children: children, selected: selected, ...rest } = props;\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const getNode = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ getNode: getNode })=>getNode);\n const nodesConfiguration = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodesConfiguration);\n const [isInfoModalShown, setIsInfoModalShown] = (0, $djR0r$useState)(false);\n const { info: info } = $8d34719b9811e505$var$useNodeManifest(props.type);\n const isResizeable = (0, $djR0r$useMemo)(()=>nodesConfiguration[props.type].resizable ?? false, [\n nodesConfiguration,\n props.type\n ]);\n const { updateNodeLabel: updateNodeLabel, updateNodeConfig: updateNodeConfig } = (0, $c2be4ce66a537e42$export$2e2bcd8739ae039)(id);\n const { data: data } = getNode(id) || {};\n const audioNode = (0, $607523634e2ef7fa$export$2e2bcd8739ae039)(id);\n const { ConfigNode: ConfigNode } = $8d34719b9811e505$var$useConfigNode(rest.type);\n const [configMode, setShowConfigMode] = (0, $djR0r$useState)(false);\n if (!audioNode) return (0, $djR0r$jsx)($8d34719b9811e505$var$NodeLoaderWrapper, {\n className: (0, $9738c58e5420c085$export$956b3cf15d7c363),\n children: \"can't find audio node\"\n });\n if (audioNode.loading) return (0, $djR0r$jsx)($8d34719b9811e505$var$NodeLoaderWrapper, {\n className: (0, $9738c58e5420c085$export$956b3cf15d7c363),\n children: \"loading\"\n });\n if (audioNode.error) return (0, $djR0r$jsxs)($8d34719b9811e505$var$NodeErrorWrapper, {\n className: (0, $9738c58e5420c085$export$956b3cf15d7c363),\n children: [\n \"error: \",\n audioNode.error.toString()\n ]\n });\n if (!audioNode.node) return (0, $djR0r$jsx)($8d34719b9811e505$var$NodeLoaderWrapper, {\n className: (0, $9738c58e5420c085$export$956b3cf15d7c363),\n children: \"can't find audio node\"\n });\n const size = data?.config?.size;\n const { node: { inputs: inputs, outputs: outputs } } = audioNode;\n return (0, $djR0r$jsxs)($8d34719b9811e505$var$NodeWrapper, {\n children: [\n (0, $djR0r$jsxs)($8d34719b9811e505$export$7e0b3af1e60a3273, {\n children: [\n info && (0, $djR0r$jsx)($8d34719b9811e505$var$InfoIconWrapper, {\n onClickCapture: ()=>setIsInfoModalShown(true)\n }),\n (0, $djR0r$jsx)((0, $61078804f94ec8d6$export$2e2bcd8739ae039), {\n value: data?.label ?? \"No Name\",\n onChange: updateNodeLabel\n }),\n ConfigNode && (0, $djR0r$jsx)($8d34719b9811e505$var$SettingsIconWrapper, {\n onClickCapture: ()=>setShowConfigMode((isShown)=>!isShown)\n })\n ]\n }),\n (0, $djR0r$jsxs)($8d34719b9811e505$export$bfd3bd1fa283e3c6, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($8d34719b9811e505$export$f1afba0ff9ea1277, {\n children: inputs ? Object.keys(inputs).map((key, index)=>(0, $djR0r$jsxs)($8d34719b9811e505$export$a2d375858cc72119, {\n children: [\n (0, $djR0r$jsx)($8d34719b9811e505$export$9ea0feffc20ee81, {\n id: key,\n portType: inputs[key].type\n }),\n (0, $djR0r$jsx)(\"span\", {\n children: key\n })\n ]\n }, index)) : null\n }),\n (0, $djR0r$jsx)($8d34719b9811e505$export$af4f9b41fc32ed9e, {\n children: outputs ? Object.keys(outputs).map((key, index)=>(0, $djR0r$jsxs)($8d34719b9811e505$export$a2d375858cc72119, {\n children: [\n (0, $djR0r$jsx)($8d34719b9811e505$export$496e5e1ee1696f64, {\n id: key,\n portType: outputs[key].type\n }),\n (0, $djR0r$jsx)(\"span\", {\n children: key\n })\n ]\n }, index)) : null\n })\n ]\n }),\n ConfigNode && configMode && selected ? (0, $djR0r$jsx)(ConfigNode, {\n ...props\n }) : isResizeable ? (0, $djR0r$jsx)((0, $djR0r$Resizable), {\n size: size,\n minWidth: 180,\n minHeight: 30,\n enable: {\n bottom: true,\n bottomRight: true,\n right: true\n },\n onResizeStop: (e, direction, ref, d)=>{\n const newSize = size ? {\n width: size.width + d.width,\n height: size.height + d.height\n } : ref.getBoundingClientRect();\n updateNodeConfig({\n ...data?.config,\n size: newSize\n });\n },\n children: children\n }) : children,\n (0, $djR0r$jsx)((0, $de6d95f0aff74a75$export$2e2bcd8739ae039), {\n isOpen: isInfoModalShown,\n type: props.type,\n onClose: ()=>setIsInfoModalShown(false),\n node: audioNode.node\n })\n ]\n });\n};\n\n\nconst $10a9c816b85d070f$export$86de09faaa70680d = (0, $djR0r$emotionstyled).div`\n width: 100%;\n padding: 0.4rem 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\nconst $10a9c816b85d070f$export$548ca3bae446ddc2 = (0, $djR0r$emotionstyled)((0, $8d34719b9811e505$export$7e0b3af1e60a3273))`\n display: flex;\n gap: 0.1rem;\n padding: 0 0.4rem;\n justify-content: start;\n font-size: 0.6rem;\n height: auto;\n min-width: 0;\n`;\nconst $10a9c816b85d070f$export$9fb15e3cc717240 = (0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n height: 70%;\n width: auto;\n gap: 0.4rem;\n`;\nconst $10a9c816b85d070f$export$be58b4326e23250f = (0, $djR0r$emotionstyled).span`\n width: auto;\n height: 100%;\n cursor: pointer;\n svg {\n width: auto;\n height: 100%;\n }\n &:hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n\n\nconst $78800a41ab03e65a$var$ControlPanelNodeWrapper = (0, $djR0r$emotionstyled).div`\n height: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n`;\nconst $78800a41ab03e65a$var$PanelNode = (props)=>{\n const { node: node } = props;\n const getControlPanelNode = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.getControlPanelNode);\n const ControlPanelNode = (0, $djR0r$useMemo)(()=>getControlPanelNode(node), [\n node\n ]);\n if (!ControlPanelNode) return null;\n return (0, $djR0r$jsx)(ControlPanelNode, {\n ...props\n });\n};\nconst $78800a41ab03e65a$var$ControlPanelItem = (props)=>{\n const { node: node, showControls: showControls, onDelete: onDelete } = props;\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const { id: id } = node;\n const { node: audioNode } = (0, $607523634e2ef7fa$export$2e2bcd8739ae039)(id) || {};\n const { updateNodeValues: updateNodeValues } = (0, $c2be4ce66a537e42$export$2e2bcd8739ae039)(id);\n return (0, $djR0r$jsxs)($78800a41ab03e65a$var$ControlPanelNodeWrapper, {\n theme: theme,\n children: [\n (0, $djR0r$jsxs)((0, $10a9c816b85d070f$export$548ca3bae446ddc2), {\n theme: theme,\n children: [\n (0, $djR0r$jsx)((0, $10a9c816b85d070f$export$86de09faaa70680d), {\n children: node.data.label\n }),\n showControls && (0, $djR0r$jsxs)((0, $10a9c816b85d070f$export$9fb15e3cc717240), {\n children: [\n (0, $djR0r$jsx)((0, $10a9c816b85d070f$export$be58b4326e23250f), {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $djR0r$MdDragHandle), {\n className: \"grid-item-handle\"\n })\n }),\n (0, $djR0r$jsx)((0, $10a9c816b85d070f$export$be58b4326e23250f), {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $djR0r$MdClose), {\n onClick: ()=>onDelete(node)\n })\n })\n ]\n })\n ]\n }),\n (0, $djR0r$jsx)($78800a41ab03e65a$var$PanelNode, {\n node: node,\n audioNode: audioNode,\n updateNodeValues: updateNodeValues\n })\n ]\n });\n};\nvar $78800a41ab03e65a$export$2e2bcd8739ae039 = $78800a41ab03e65a$var$ControlPanelItem;\n\n\n\nconst $aa370ed1795ceb6e$var$ControlPanelIconWrapper = (0, $djR0r$emotionstyled).div`\n position: fixed;\n z-index: 5;\n box-shadow: 0px 1px 2px ${({ theme: theme })=>theme.colors.elevation2};\n left: 1rem;\n top: 4rem;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${({ theme: theme })=>theme.colors.elevation1};\n color: ${({ theme: theme })=>theme.colors.highlight1};\n\n :hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n cursor: pointer;\n }\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelIconsBar = (0, $djR0r$emotionstyled)((0, $10a9c816b85d070f$export$9fb15e3cc717240))`\n height: 80%;\n`;\nconst $aa370ed1795ceb6e$var$CloseIconWrapper = (0, $djR0r$emotionstyled)((0, $10a9c816b85d070f$export$be58b4326e23250f))`\n font-size: 1rem;\n display: flex;\n align-items: center;\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelHeader = (0, $djR0r$emotionstyled)((0, $10a9c816b85d070f$export$548ca3bae446ddc2))`\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n font-size: 0.7rem;\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelTitle = (0, $djR0r$emotionstyled)((0, $10a9c816b85d070f$export$86de09faaa70680d))`\n text-align: center;\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelWrapper = (0, $djR0r$emotionstyled).div`\n height: 100%;\n width: 100%;\n padding: 0.3rem 0.4rem;\n box-sizing: border-box;\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelBody = (0, $djR0r$emotionstyled).div`\n height: auto;\n padding: 0;\n max-height: 95vh;\n overflow-y: scroll;\n border: 1px solid ${({ theme: theme })=>theme.colors.elevation3};\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelSettings = (0, $djR0r$emotionstyled).div`\n padding: 1rem 0;\n font-family: var(--leva-fonts-mono);\n font-size: 0.8rem;\n`;\nconst $aa370ed1795ceb6e$var$LockGridWrapper = (0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.highlight2};\n }\n`;\nconst $aa370ed1795ceb6e$var$GridResizeHandle = (0, $djR0r$emotionstyled).div`\n position: absolute;\n height: 1rem;\n top: 0;\n bottom: 0;\n margin: auto;\n left: 0.5rem;\n border-right: 1px solid ${({ theme: theme })=>theme.colors.whitePrimary};\n`;\nconst $aa370ed1795ceb6e$var$ControlPanelItemWrapper = (0, $djR0r$emotionstyled).div`\n box-sizing: border-box;\n overflow: hidden;\n .react-resizable-handle:after {\n border-color: ${({ theme: theme })=>theme.colors.whitePrimary};\n border-width: 1px;\n }\n`;\nconst $aa370ed1795ceb6e$var$ControlPanel = ()=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const nodeRef = (0, $djR0r$useRef)(null);\n const nodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.nodes);\n const { show: show, nodes: controlPanelNodes, size: size } = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.controlPanel);\n const { width: width = 200, height: height } = size;\n const filteredNodes = (0, $djR0r$useMemo)(()=>{\n const nodeIds = controlPanelNodes.map(({ id: id })=>id);\n return nodes.filter(({ id: id })=>nodeIds.includes(id));\n }, [\n nodes,\n controlPanelNodes\n ]);\n const showControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.showControlPanel);\n const hideControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.hideControlPanel);\n const setControlPanelNodes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setControlPanelNodes);\n const setControlPanelSize = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setControlPanelSize);\n const removeNodeFromControlPanel = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.removeNodeFromControlPanel);\n const [isGridLocked, setGridLocked] = (0, $djR0r$useState)(true);\n const layout = (0, $djR0r$useMemo)(()=>{\n const fallbackY = controlPanelNodes.reduce((acc, { height: height = (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).rowHeight, x: x, y: y = 0 })=>{\n const Y = y + height;\n return Y > acc ? Y : acc;\n }, 0);\n return controlPanelNodes.map(({ id: i, width: width, height: height, x: x, y: y })=>{\n return {\n i: i,\n w: width || (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).cols,\n h: height || 6,\n x: x ?? 0,\n y: y ?? fallbackY\n };\n });\n }, [\n controlPanelNodes\n ]);\n if (!filteredNodes.length) return null;\n return (0, $djR0r$jsxs)((0, $djR0r$Fragment), {\n children: [\n (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelIconWrapper, {\n theme: theme,\n ref: nodeRef,\n onClick: showControlPanel,\n children: (0, $djR0r$jsx)((0, $djR0r$RxDashboard), {})\n }),\n (0, $djR0r$jsxs)((0, $djR0r$reactmoderndrawer), {\n open: show,\n onClose: hideControlPanel,\n direction: \"left\",\n className: \"\",\n size: \"auto\",\n enableOverlay: false,\n style: {\n background: theme.colors.elevation1,\n position: \"absolute\"\n },\n children: [\n (0, $djR0r$jsxs)($aa370ed1795ceb6e$var$ControlPanelHeader, {\n theme: theme,\n children: [\n (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelTitle, {\n children: \"Control Panel\"\n }),\n (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelIconsBar, {\n children: (0, $djR0r$jsx)($aa370ed1795ceb6e$var$CloseIconWrapper, {\n onClick: hideControlPanel,\n theme: theme,\n children: (0, $djR0r$jsx)((0, $djR0r$MdClose), {})\n })\n })\n ]\n }),\n (0, $djR0r$jsxs)($aa370ed1795ceb6e$var$ControlPanelWrapper, {\n children: [\n (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelSettings, {\n children: isGridLocked ? (0, $djR0r$jsxs)($aa370ed1795ceb6e$var$LockGridWrapper, {\n theme: theme,\n onClick: ()=>setGridLocked(false),\n children: [\n (0, $djR0r$jsx)((0, $djR0r$AiFillLock), {}),\n \"Unlock grid\"\n ]\n }) : (0, $djR0r$jsxs)($aa370ed1795ceb6e$var$LockGridWrapper, {\n theme: theme,\n onClick: ()=>setGridLocked(true),\n children: [\n (0, $djR0r$jsx)((0, $djR0r$AiFillUnlock), {}),\n \"Lock grid\"\n ]\n })\n }),\n (0, $djR0r$jsx)((0, $djR0r$Resizable), {\n enable: {\n top: false,\n right: !isGridLocked,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false\n },\n handleComponent: {\n right: (0, $djR0r$jsx)($aa370ed1795ceb6e$var$GridResizeHandle, {\n theme: theme\n })\n },\n minWidth: 120,\n size: {\n width: width,\n height: \"auto\"\n },\n onResizeStop: (e, direction, ref, d)=>{\n setControlPanelSize({\n width: width + d.width,\n height: height + d.height\n });\n },\n children: (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelBody, {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $djR0r$reactgridlayout), {\n layout: layout,\n className: \"layout\",\n cols: (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).cols,\n rowHeight: (0, $9738c58e5420c085$export$9f05d3e6ade4c09e).rowHeight,\n width: width,\n margin: [\n 0,\n 0\n ],\n isResizable: !isGridLocked,\n draggableHandle: \".grid-item-handle\",\n onLayoutChange: (nodes)=>{\n requestAnimationFrame(()=>{\n setControlPanelNodes(nodes.map(({ i: i, w: w, h: h, x: x, y: y })=>({\n id: i,\n width: w,\n height: h,\n x: x,\n y: y\n })));\n });\n },\n children: filteredNodes.map((node)=>{\n return (0, $djR0r$jsx)($aa370ed1795ceb6e$var$ControlPanelItemWrapper, {\n theme: theme,\n children: (0, $djR0r$jsx)((0, $78800a41ab03e65a$export$2e2bcd8739ae039), {\n node: node,\n showControls: !isGridLocked,\n onDelete: removeNodeFromControlPanel\n })\n }, node.id);\n })\n })\n })\n })\n ]\n })\n ]\n })\n ]\n });\n};\nvar $aa370ed1795ceb6e$export$2e2bcd8739ae039 = $aa370ed1795ceb6e$var$ControlPanel;\n\n\n\n\n\n\n\n\n\n\n\n\nvar $e94dbfe8457a1793$exports = {};\n$e94dbfe8457a1793$exports = \"# Quick start\\n\\n## Add node\\n - Mouse right click\\n - Select **'Add Node'** from context menu\\n\\n ### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or\\n\\n - Press `CMD+SHIFT+A`\\n\\n<br/>\\n\\n## Connect nodes\\n - Mouse left click and hold on source port\\n - Drop on target port\\n\\n<br/>\\n\\n## Delete Node or Connection\\n - Mouse right click on node/connection\\n - Select **'Delete Node'**/**'Delete Connection'** from context menu\\n\\n ### &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or\\n\\n - Mouse left click on node/connection, then press `Backspace`\\n\\n<br/>\\n\\n\\n## Move node\\n - Drag and Drop\\n\\n\";\n\n\nconst $0d9fa38071943b2c$var$MdPreview = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n font-family: var(--leva-fonts-mono);\n font-size: 0.7rem;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n overflow: scroll;\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n padding: 0 0.5rem;\n\n code {\n color: ${({ theme: theme })=>theme.colors.accent3};\n filter: hue-rotate(180deg);\n }\n`);\nconst $0d9fa38071943b2c$var$ModalContent = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n padding: 1rem;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n overflow: hidden;\n`);\nconst $0d9fa38071943b2c$var$HelpModal = ()=>{\n const isHelpShown = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.isHelpShown);\n const toggleHelp = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n if (!isHelpShown) return null;\n return (0, $djR0r$jsx)((0, $96e3c18b52e89add$export$2e2bcd8739ae039), {\n onClose: ()=>{\n toggleHelp();\n },\n children: (0, $djR0r$jsx)($0d9fa38071943b2c$var$ModalContent, {\n children: (0, $djR0r$jsx)($0d9fa38071943b2c$var$MdPreview, {\n dangerouslySetInnerHTML: {\n __html: (0, $djR0r$marked)((0, (/*@__PURE__*/$parcel$interopDefault($e94dbfe8457a1793$exports))))\n },\n onWheelCapture: (event)=>event.stopPropagation()\n })\n })\n });\n};\nvar $0d9fa38071943b2c$export$2e2bcd8739ae039 = $0d9fa38071943b2c$var$HelpModal;\n\n\nconst $978ea880a50613b0$export$78bddedbcf2939ac = ()=>{\n const toggleHelp = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.toggleHelp);\n return (0, $djR0r$jsx)((0, $djR0r$Fragment), {\n children: (0, $djR0r$jsx)((0, $djR0r$ControlButton), {\n onClick: toggleHelp,\n children: (0, $djR0r$jsx)((0, $djR0r$FaQuestion), {})\n })\n });\n};\n\n\n\n\n\n\n\n\nconst $8555f8953ca3d620$var$Layout = (0, $djR0r$emotionstyled).div`\n position: fixed;\n z-index: ${({ theme: theme })=>theme.zIndex.resumeContextLayout};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgb(24 28 32 / 90%);\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n cursor: pointer;\n`;\nconst $8555f8953ca3d620$var$Row = (0, $djR0r$emotionstyled).div`\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n`;\nconst $8555f8953ca3d620$var$Message = (0, $djR0r$emotionstyled).div`\n font-family: var(--leva-fonts-mono);\n font-size: 2rem;\n`;\nconst $8555f8953ca3d620$var$Icon = (0, $djR0r$emotionstyled)((0, $djR0r$FaVolumeOff))`\n width: 7rem;\n height: 7rem;\n`;\nconst $8555f8953ca3d620$var$ResumeContext = ()=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const patch = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ patch: patch })=>patch);\n const audioContext = patch.audioContext;\n const [isContextResumed, setIsContextResumed] = (0, $djR0r$useState)(audioContext.state === \"running\");\n if (isContextResumed) return null;\n return (0, $djR0r$jsxs)($8555f8953ca3d620$var$Layout, {\n theme: theme,\n onClick: ()=>{\n audioContext.resume();\n setIsContextResumed(true);\n },\n children: [\n (0, $djR0r$jsx)($8555f8953ca3d620$var$Row, {\n children: (0, $djR0r$jsx)($8555f8953ca3d620$var$Message, {\n theme: theme,\n children: \"Click anywhere to resume audio context\"\n })\n }),\n (0, $djR0r$jsx)($8555f8953ca3d620$var$Row, {\n children: (0, $djR0r$jsx)($8555f8953ca3d620$var$Icon, {})\n })\n ]\n });\n};\nvar $8555f8953ca3d620$export$2e2bcd8739ae039 = $8555f8953ca3d620$var$ResumeContext;\n\n\n\n\n\n\nconst $a86b09d17e46bbc8$var$ToggleMinimap = ()=>{\n const setConfig = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ setConfig: setConfig })=>setConfig);\n const { showMinimap: showMinimap } = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ config: config })=>config);\n return (0, $djR0r$jsx)((0, $djR0r$ControlButton), {\n onClick: ()=>setConfig({\n showMinimap: !showMinimap\n }),\n children: showMinimap ? (0, $djR0r$jsx)((0, $djR0r$FaMap), {}) : (0, $djR0r$jsx)((0, $djR0r$FaRegMap), {})\n });\n};\nvar $a86b09d17e46bbc8$export$2e2bcd8739ae039 = $a86b09d17e46bbc8$var$ToggleMinimap;\n\n\n\n\n\n\n\nconst $ea8f5cfca6de366a$var$Wire = ({ id: id, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, style: style = {}, data: data, markerStart: markerStart, markerEnd: markerEnd, source: source, target: target, sourceHandleId: sourceHandleId, targetHandleId: targetHandleId, selected: selected })=>{\n const theme = (0, $40266ad71a95dba8$export$2e2bcd8739ae039)();\n const getNode = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ getNode: getNode })=>getNode);\n const sourceNode = getNode(source);\n const targetNode = getNode(target);\n const isConnectedToSelected = sourceNode?.selected || targetNode?.selected;\n (0, $djR0r$useEffect)(()=>{\n if (!sourceHandleId || !targetHandleId) return;\n console.log(`connected ${source} to ${target}`);\n return ()=>{\n console.log(`disconnected ${source} from ${target}`);\n };\n }, [\n source,\n sourceHandleId,\n target,\n targetHandleId\n ]);\n const [edgePath] = (0, $djR0r$getBezierPath)({\n targetX: targetX,\n targetY: targetY,\n targetPosition: targetPosition,\n sourceX: sourceX,\n sourceY: sourceY,\n sourcePosition: sourcePosition\n });\n return (0, $djR0r$jsxs)((0, $djR0r$Fragment), {\n children: [\n (0, $djR0r$jsx)(\"path\", {\n id: id,\n style: {\n ...style,\n stroke: selected ? theme.colors.accent2 : isConnectedToSelected ? theme.colors.highlight3 : theme.colors.highlight2\n },\n className: \"react-flow__edge-path Wire\",\n d: edgePath,\n markerEnd: markerEnd\n }),\n (0, $djR0r$jsx)(\"path\", {\n style: {\n ...style,\n strokeWidth: 8,\n color: \"transparent\",\n opacity: 0,\n cursor: \"pointer\"\n },\n d: edgePath,\n markerEnd: markerEnd\n })\n ]\n });\n};\nvar $ea8f5cfca6de366a$export$2e2bcd8739ae039 = $ea8f5cfca6de366a$var$Wire;\n\n\nconst $34040b5af26d0b8a$var$onNodeDragStop = (_event, node)=>console.log(\"drag stop\", node);\nconst $34040b5af26d0b8a$var$onNodeClick = (_event, element)=>console.log(\"click\", element);\nconst $34040b5af26d0b8a$var$snapGrid = [\n 20,\n 20\n];\nconst $34040b5af26d0b8a$export$72cb76f559fbafcf = ({ editorState: editorState, plugins: plugins = [], editorContextMenu: editorContextMenu = [], onChange: onChange = ()=>{}, ...props })=>{\n const edgeTypes = (0, $djR0r$useMemo)(()=>({\n wire: (0, $ea8f5cfca6de366a$export$2e2bcd8739ae039)\n }), []);\n const { nodes: nodes, edges: edges, controlPanel: controlPanel, onNodesChange: onNodesChange, onNodesDelete: onNodesDelete, onEdgesChange: onEdgesChange, onEdgesDelete: onEdgesDelete, onConnect: onConnect, setPlugins: setPlugins, setViewport: setViewport, viewport: viewport } = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)();\n const editorConfig = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ config: config })=>config);\n const nodeTypes = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)(({ nodeTypes: nodeTypes })=>nodeTypes);\n (0, $djR0r$useEffect)(()=>{\n setPlugins(plugins);\n }, [\n plugins\n ]);\n const [reactflowInstance, setReactflowInstance] = (0, $djR0r$useState)(null);\n (0, $djR0r$useEffect)(()=>{\n if (!reactflowInstance) return;\n onChange({\n nodes: nodes,\n edges: edges,\n controlPanel: controlPanel,\n viewport: viewport\n });\n }, [\n nodes,\n edges,\n controlPanel,\n viewport\n ]);\n const onInit = (0, $djR0r$useCallback)((rfi)=>{\n if (!reactflowInstance) {\n setReactflowInstance(rfi);\n console.log(\"flow loaded:\", rfi);\n }\n }, [\n reactflowInstance\n ]);\n const { onContextMenu: onEditorContextMenu } = (0, $28ba16bd16f671c0$export$59ce2a6808e35a29)();\n const { onContextMenu: onNodeContextMenu } = (0, $0ffe51df9638a254$export$cbbbfb9fb15f3780)();\n const { onContextMenu: onEdgeContextMenu } = (0, $b2eaa5961e75d009$export$8b2e4a15453bac1e)();\n (0, $djR0r$useEffect)(()=>{\n if (!viewport) return;\n reactflowInstance?.setViewport(viewport);\n }, [\n viewport,\n reactflowInstance\n ]);\n (0, $djR0r$useOnViewportChange)({\n onEnd: setViewport\n });\n return (0, $djR0r$jsxs)((0, $djR0r$reactflow), {\n nodes: nodes,\n edges: edges,\n onNodesChange: onNodesChange,\n onNodesDelete: onNodesDelete,\n onEdgesChange: onEdgesChange,\n onConnect: onConnect,\n onNodeDragStop: $34040b5af26d0b8a$var$onNodeDragStop,\n onEdgesDelete: onEdgesDelete,\n onInit: onInit,\n onNodeClick: $34040b5af26d0b8a$var$onNodeClick,\n onContextMenu: onEditorContextMenu,\n onNodeContextMenu: onNodeContextMenu,\n onEdgeContextMenu: onEdgeContextMenu,\n nodeTypes: nodeTypes,\n edgeTypes: edgeTypes,\n snapGrid: $34040b5af26d0b8a$var$snapGrid,\n defaultViewport: editorState?.viewport,\n defaultEdgeOptions: {\n type: \"wire\"\n },\n snapToGrid: true,\n fitView: true,\n disableKeyboardA11y: true,\n children: [\n (0, $djR0r$jsx)((0, $djR0r$Background), {\n variant: (0, $djR0r$BackgroundVariant).Dots,\n gap: 12\n }),\n editorConfig.showMinimap ? (0, $djR0r$jsx)((0, $djR0r$MiniMap), {}) : null,\n (0, $djR0r$jsxs)((0, $djR0r$Controls), {\n style: {\n right: \"1rem\",\n left: \"initial\",\n bottom: \"40%\",\n top: \"initial\"\n },\n showInteractive: false,\n children: [\n (0, $djR0r$jsx)((0, $a86b09d17e46bbc8$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $978ea880a50613b0$export$78bddedbcf2939ac), {})\n ]\n }),\n (0, $djR0r$jsx)((0, $8555f8953ca3d620$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $aa370ed1795ceb6e$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $0d9fa38071943b2c$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $28ba16bd16f671c0$export$2e2bcd8739ae039), {\n editorContextMenu: editorContextMenu\n }),\n (0, $djR0r$jsx)((0, $0ffe51df9638a254$export$2e2bcd8739ae039), {}),\n (0, $djR0r$jsx)((0, $b2eaa5961e75d009$export$2e2bcd8739ae039), {})\n ]\n });\n};\nconst $34040b5af26d0b8a$export$7cda8d932e2f33c0 = (props)=>(0, $djR0r$jsx)((0, $djR0r$ReactFlowProvider), {\n children: (0, $djR0r$jsx)($34040b5af26d0b8a$export$72cb76f559fbafcf, {\n ...props\n })\n });\nvar $34040b5af26d0b8a$export$2e2bcd8739ae039 = $34040b5af26d0b8a$export$7cda8d932e2f33c0;\n\n\n\n\nconst $682f9b4ff493f2ac$export$d31000d36961d6c2 = {\n nodes: [],\n edges: [],\n controlPanel: {\n nodes: [],\n show: false,\n size: {\n width: 200,\n height: 100\n }\n },\n viewport: {\n x: 0,\n y: 0,\n zoom: 1.5\n }\n};\nconst $682f9b4ff493f2ac$export$6cd5d5c1dae69a36 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`);\nconst $682f9b4ff493f2ac$export$8d546ef2006cd0a2 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n height: 100%;\n width: 100%;\n display: flex;\n position: relative;\n`);\nconst $682f9b4ff493f2ac$export$10efbd348f877f87 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n background: ${({ theme: theme })=>theme.colors.elevation3};\n`);\nconst $682f9b4ff493f2ac$export$8c347812506d5ac9 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n background: ${({ theme: theme })=>theme.colors.elevation2};\n opacity: 0.7;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n font-family: var(--leva-fonts-mono);\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n display: ${({ show: show })=>show ? \"flex\" : \"none\"};\n align-items: center;\n justify-content: center;\n font-size: 6rem;\n`);\nconst $682f9b4ff493f2ac$export$b38a2fd24b22fb35 = (props)=>{\n const pullEditorChanges = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.pullEditorChanges);\n const currentFileIndex = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.currentFileIndex);\n const [showLoader, setShowLoader] = (0, $djR0r$useState)(true);\n (0, $djR0r$useEffect)(()=>{\n setShowLoader(true);\n setTimeout(()=>{\n setShowLoader(false);\n }, 1600);\n }, [\n currentFileIndex\n ]);\n const { file: file } = props;\n if (!file) return null;\n if (file.type === \"audio\") return (0, $djR0r$jsx)($682f9b4ff493f2ac$export$10efbd348f877f87, {\n children: (0, $djR0r$jsx)(\"audio\", {\n src: file.file,\n controls: true\n })\n });\n return (0, $djR0r$jsxs)((0, $djR0r$Fragment), {\n children: [\n (0, $djR0r$jsx)((0, $34040b5af26d0b8a$export$7cda8d932e2f33c0), {\n ...props,\n onChange: (state)=>{\n pullEditorChanges();\n },\n editorState: file.file || $682f9b4ff493f2ac$export$d31000d36961d6c2\n }),\n (0, $djR0r$jsx)($682f9b4ff493f2ac$export$8c347812506d5ac9, {\n show: showLoader,\n children: \"Loading...\"\n })\n ]\n });\n};\nconst $682f9b4ff493f2ac$export$2206531ad8592d57 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n height: 2rem;\n display: flex;\n align-items: center;\n background: ${({ theme: theme })=>theme.colors.elevation2};\n`);\nconst $682f9b4ff493f2ac$export$3e41faf802a29e71 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 100%;\n box-sizing: border-box;\n padding: 0.3rem 0.4rem;\n\n border-right: 1px solid ${({ theme: theme })=>theme.colors.elevation1};\n\n input {\n color: ${({ theme: theme, active: active })=>active ? theme.colors.whitePrimary : theme.colors.highlight1};\n\n &:not([readonly]):focus {\n background-color: ${({ theme: theme })=>theme.colors.elevation1};\n }\n }\n`);\nconst $682f9b4ff493f2ac$export$61e5b3c7bace77b8 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled).div`\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 0.5rem;\n cursor: pointer;\n\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n`);\nconst $682f9b4ff493f2ac$export$3aef34186a092045 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)((0, $djR0r$FaPlus))`\n height: 40%;\n width: auto;\n`);\nconst $682f9b4ff493f2ac$export$cae179f078f4b4a4 = (0, $djR0r$withTheme)((0, $djR0r$emotionstyled)((0, $djR0r$MdClose))`\n height: 70%;\n width: auto;\n cursor: pointer;\n color: ${({ theme: theme })=>theme.colors.highlight1};\n &:hover {\n color: ${({ theme: theme })=>theme.colors.whitePrimary};\n }\n`);\nconst $682f9b4ff493f2ac$var$generateId = ()=>{\n return (0, $djR0r$nanoid)();\n};\nconst $682f9b4ff493f2ac$var$generateEmptyFile = ()=>({\n file: $682f9b4ff493f2ac$export$d31000d36961d6c2,\n name: \"Unnamed\",\n type: \"patch\",\n id: $682f9b4ff493f2ac$var$generateId()\n });\nconst $682f9b4ff493f2ac$export$86fbec116b87613f = ({ ...props })=>{\n const { projectState: projectState, theme: theme } = props;\n const currentFileIndex = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.currentFileIndex);\n const currentFile = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.project.files[store.currentFileIndex]);\n const setCurrentFileIndex = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setCurrentFileIndex);\n const project = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.project);\n const setProject = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setProject);\n const getProject = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.getProject);\n const updateFileName = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.updateFileName);\n const addFile = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.addFile);\n const deleteFile = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.deleteFile);\n const syncEditorWithCurrentFile = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.syncEditorWithCurrentFile);\n const setEditorState = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.setEditorState);\n const pullEditorChanges = (0, $6f5e1924a22d258c$export$2e2bcd8739ae039)((store)=>store.pullEditorChanges);\n (0, $djR0r$useEffect)(()=>{\n setProject(projectState || {\n files: [\n $682f9b4ff493f2ac$var$generateEmptyFile()\n ]\n });\n const file = projectState?.files[0];\n file?.file && file?.type !== \"audio\" && setEditorState(file.file);\n }, [\n projectState\n ]);\n // EXPERIMENTAL CODE\n (0, $djR0r$useEffect)(()=>{\n const fetcher = async (...args)=>{\n const request = new Request(...args);\n const files = getProject().files;\n const index = request.url.replace(\"project://\", \"\");\n const file = files.find(({ id: id })=>id === index);\n if (!file) return new Response(`File not found: ${request.url}`, {\n status: 404\n });\n if ((0, $9117b026061a386b$export$e698b79c63b74136)(file)) return new Response(JSON.stringify(file.file ?? null));\n if ((0, $9117b026061a386b$export$31c2336f657dc59f)(file)) return fetch(file.file);\n return new Response(null);\n };\n (0, $4165c1239dbc641a$export$9e4ff1580457920e)(\"project://*\", fetcher);\n return ()=>{\n //unregister here\n };\n }, [\n getProject\n ]);\n (0, $djR0r$useEffect)(()=>{\n syncEditorWithCurrentFile();\n }, [\n currentFileIndex,\n syncEditorWithCurrentFile\n ]);\n return (0, $djR0r$jsxs)((0, $djR0r$ThemeProvider), {\n theme: theme || (0, $de1eff52c6419df8$export$2e2bcd8739ae039),\n children: [\n (0, $djR0r$jsx)((0, $djR0r$Global), {\n styles: (0, $djR0r$css)`\n :root {\n --leva-colors-elevation1: #292d39;\n --leva-colors-elevation2: #181c20;\n --leva-colors-elevation3: #373c4b;\n --leva-colors-accent1: #0066dc;\n --leva-colors-accent2: #007bff;\n --leva-colors-accent3: #3c93ff;\n --leva-colors-highlight1: #535760;\n --leva-colors-highlight2: #8c92a4;\n --leva-colors-highlight3: #fefefe;\n --leva-colors-vivid1: #ffcc00;\n --leva-colors-folderWidgetColor: var(--leva-colors-highlight2);\n --leva-colors-folderTextColor: var(--leva-colors-highlight3);\n --leva-colors-toolTipBackground: var(--leva-colors-highlight3);\n --leva-colors-toolTipText: var(--leva-colors-elevation2);\n --leva-radii-xs: 2px;\n --leva-radii-sm: 3px;\n --leva-radii-lg: 10px;\n --leva-space-xs: 3px;\n --leva-space-sm: 6px;\n --leva-space-md: 10px;\n --leva-space-rowGap: 7px;\n --leva-space-colGap: 7px;\n --leva-fonts-mono:\n ui-monospace, SFMono-Regular, Menlo, \"Roboto Mono\", monospace;\n --leva-fonts-sans: system-ui, sans-serif;\n --leva-fontSizes-root: 11px;\n --leva-fontSizes-toolTip: var(--leva-fontSizes-root);\n --leva-sizes-rootWidth: 280px;\n --leva-sizes-controlWidth: 160px;\n --leva-sizes-numberInputMinWidth: 38px;\n --leva-sizes-scrubberWidth: 8px;\n --leva-sizes-scrubberHeight: 16px;\n --leva-sizes-rowHeight: 24px;\n --leva-sizes-folderTitleHeight: 20px;\n --leva-sizes-checkboxSize: 16px;\n --leva-sizes-joystickWidth: 100px;\n --leva-sizes-joystickHeight: 100px;\n --leva-sizes-colorPickerWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-colorPickerHeight: 100px;\n --leva-sizes-imagePreviewWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-imagePreviewHeight: 100px;\n --leva-sizes-monitorHeight: 60px;\n --leva-sizes-titleBarHeight: 39px;\n --leva-shadows-level1: 0 0 9px 0 #00000088;\n --leva-shadows-level2: 0 4px 14px #00000033;\n --leva-borderWidths-root: 0px;\n --leva-borderWidths-input: 1px;\n --leva-borderWidths-focus: 1px;\n --leva-borderWidths-hover: 1px;\n --leva-borderWidths-active: 1px;\n --leva-borderWidths-folder: 1px;\n --leva-fontWeights-label: normal;\n --leva-fontWeights-folder: normal;\n --leva-fontWeights-button: normal;\n }\n `\n }),\n (0, $djR0r$jsxs)($682f9b4ff493f2ac$export$6cd5d5c1dae69a36, {\n children: [\n (0, $djR0r$jsxs)($682f9b4ff493f2ac$export$2206531ad8592d57, {\n children: [\n project.files.map((file, index)=>(0, $djR0r$jsxs)($682f9b4ff493f2ac$export$3e41faf802a29e71, {\n onClick: ()=>{\n setCurrentFileIndex(index);\n },\n active: index === currentFileIndex,\n children: [\n (0, $djR0r$jsx)((0, $61078804f94ec8d6$export$2e2bcd8739ae039), {\n onChange: (val)=>updateFileName(index, val),\n value: file.name || \"Unnamed\"\n }),\n (0, $djR0r$jsx)($682f9b4ff493f2ac$export$cae179f078f4b4a4, {\n onClick: (event)=>{\n event.stopPropagation();\n if (!window.confirm(\"Do you really want to delete this file?\")) return;\n deleteFile(index);\n }\n })\n ]\n }, index)),\n (0, $djR0r$jsx)($682f9b4ff493f2ac$export$61e5b3c7bace77b8, {\n onClick: ()=>{\n addFile($682f9b4ff493f2ac$var$generateEmptyFile());\n setCurrentFileIndex(project.files.length);\n },\n children: (0, $djR0r$jsx)($682f9b4ff493f2ac$export$3aef34186a092045, {})\n })\n ]\n }),\n (0, $djR0r$jsx)($682f9b4ff493f2ac$export$8d546ef2006cd0a2, {\n children: (0, $djR0r$jsx)($682f9b4ff493f2ac$export$b38a2fd24b22fb35, {\n file: currentFile,\n ...props\n })\n })\n ]\n })\n ]\n });\n};\nvar $682f9b4ff493f2ac$export$2e2bcd8739ae039 = $682f9b4ff493f2ac$export$86fbec116b87613f;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nexport {$682f9b4ff493f2ac$export$2e2bcd8739ae039 as Editor, $682f9b4ff493f2ac$export$d31000d36961d6c2 as EDITOR_DEFAULTS, $ea8f5cfca6de366a$export$2e2bcd8739ae039 as Wire, $8d34719b9811e505$export$361064385d50ec44 as WNNode, $8d34719b9811e505$export$7e0b3af1e60a3273 as TitleBar, $8d34719b9811e505$export$bfd3bd1fa283e3c6 as PortsPanel, $8d34719b9811e505$export$af4f9b41fc32ed9e as OutputPorts, $8d34719b9811e505$export$496e5e1ee1696f64 as OutputHandle, $8d34719b9811e505$export$f1afba0ff9ea1277 as InputPorts, $8d34719b9811e505$export$9ea0feffc20ee81 as InputHandle, $8d34719b9811e505$export$a2d375858cc72119 as Port, $96e3c18b52e89add$export$2e2bcd8739ae039 as Modal, $61078804f94ec8d6$export$2e2bcd8739ae039 as EditableLabel, $607523634e2ef7fa$export$2e2bcd8739ae039 as useAudioNode, $c2be4ce66a537e42$export$2e2bcd8739ae039 as useNode, $40266ad71a95dba8$export$2e2bcd8739ae039 as useTheme, $6f5e1924a22d258c$export$2e2bcd8739ae039 as useStore, $de1eff52c6419df8$export$2e2bcd8739ae039 as theme, $9117b026061a386b$export$31c2336f657dc59f as isAudio, $9117b026061a386b$export$e698b79c63b74136 as isPatch, $9738c58e5420c085$export$b0b7b95ee465c83c as PortType};\n//# sourceMappingURL=module.js.map\n","export { default as Editor, EDITOR_DEFAULTS } from \"./src/components/App\";\nexport { default as Wire } from \"./src/components/Wire\";\nexport {\n WNNode,\n TitleBar,\n type WNNodeProps,\n PortsPanel,\n OutputPorts,\n OutputHandle,\n InputPorts,\n InputHandle,\n Port,\n} from \"./src/components/Node\";\nexport { default as Modal } from \"./src/components/Modal\";\nexport { default as EditableLabel } from \"./src/components/EditableLabel\";\nexport { default as useAudioNode } from \"./src/hooks/useAudioNode\";\nexport { default as useNode } from \"./src/hooks/useNode\";\nexport { default as useTheme } from \"./src/hooks/useTheme\";\nexport { default as useStore } from \"./src/store\";\nexport { default as theme } from \"./src/theme\";\nexport { isAudio, isPatch } from \"./src/helpers/projectFile\";\n\nexport { PortType } from \"./src/constants\";\n\nexport type {\n WNAudioNode,\n CreateWNAudioNode,\n ControlPanelNodeProps,\n PluginConfig,\n PluginComponent,\n ControlPanelNode,\n WNNodeData,\n WNNode as TWNNode,\n InputPort,\n OutputPort,\n EditorState,\n Project,\n WNEdge as TWNEdge,\n EditorStoreState,\n} from \"./src/types\";\n\nexport type { Theme } from \"./src/theme\";\n","import { css, Global, ThemeProvider, withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\nimport { nanoid } from \"nanoid\";\nimport { ComponentProps, ReactNode, useEffect, useMemo, useState } from \"react\";\nimport { FaPlus as IconAdd } from \"react-icons/fa6\";\nimport { MdClose } from \"react-icons/md\";\nimport \"reactflow/dist/style.css\";\nimport { registerFetcher } from \"@web-noise/fetch\";\nimport useStore from \"../store\";\nimport \"../styles\";\nimport defaultTheme, { Theme } from \"../theme\";\nimport type {\n EditorFile,\n EditorState,\n PluginConfig,\n Project,\n ProjectFile,\n} from \"../types\";\nimport { Editor } from \"./Editor\";\nimport EditableLabel from \"./EditableLabel\";\nimport { isAudio, isPatch } from \"../helpers/projectFile\";\n\n// @TODO: move default state to editor\nexport const EDITOR_DEFAULTS = {\n nodes: [],\n edges: [],\n controlPanel: {\n nodes: [],\n show: false,\n size: {\n width: 200,\n height: 100,\n },\n },\n viewport: { x: 0, y: 0, zoom: 1.5 },\n};\n\nexport const AppWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n`);\n\nexport const EditorContainerWrapper = withTheme(styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n display: flex;\n position: relative;\n`);\n\nexport const AudioTabWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n background: ${({ theme }) => theme.colors.elevation3};\n`);\n\nexport const EditorLoadingOverlay = withTheme(styled.div<{\n theme: Theme;\n show: boolean;\n}>`\n background: ${({ theme }) => theme.colors.elevation2};\n opacity: 0.7;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n font-family: var(--leva-fonts-mono);\n color: ${({ theme }) => theme.colors.whitePrimary};\n display: ${({ show }) => (show ? \"flex\" : \"none\")};\n align-items: center;\n justify-content: center;\n font-size: 6rem;\n`);\n\ntype EditorContainerProps = AppProps & {\n file: ProjectFile;\n};\n\nexport const EditorContainer = (props: EditorContainerProps) => {\n const pullEditorChanges = useStore((store) => store.pullEditorChanges);\n const currentFileIndex = useStore((store) => store.currentFileIndex);\n\n const [showLoader, setShowLoader] = useState(true);\n\n useEffect(() => {\n setShowLoader(true);\n setTimeout(() => {\n setShowLoader(false);\n }, 1600);\n }, [currentFileIndex]);\n\n const { file } = props;\n if (!file) return null;\n\n if (file.type === \"audio\") {\n return (\n <AudioTabWrapper>\n <audio src={file.file} controls />\n </AudioTabWrapper>\n );\n }\n\n return (\n <>\n <Editor\n {...props}\n onChange={(state) => {\n pullEditorChanges();\n }}\n editorState={(file as EditorFile).file || EDITOR_DEFAULTS}\n />\n\n <EditorLoadingOverlay show={showLoader}>Loading...</EditorLoadingOverlay>\n </>\n );\n};\n\nexport const TabsContainer = withTheme(styled.div<{ theme: Theme }>`\n height: 2rem;\n display: flex;\n align-items: center;\n background: ${({ theme }) => theme.colors.elevation2};\n`);\n\nexport const Tab = withTheme(styled.div<{ theme: Theme; active?: boolean }>`\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 100%;\n box-sizing: border-box;\n padding: 0.3rem 0.4rem;\n\n border-right: 1px solid ${({ theme }) => theme.colors.elevation1};\n\n input {\n color: ${({ theme, active }) =>\n active ? theme.colors.whitePrimary : theme.colors.highlight1};\n\n &:not([readonly]):focus {\n background-color: ${({ theme }) => theme.colors.elevation1};\n }\n }\n`);\n\nexport const TabIconWrapper = withTheme(styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 0.5rem;\n cursor: pointer;\n\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n`);\n\nexport const AddFileIcon = withTheme(styled(IconAdd)<{ theme: Theme }>`\n height: 40%;\n width: auto;\n`);\n\nexport const CloseIcon = withTheme(styled(MdClose)<{ theme: Theme }>`\n height: 70%;\n width: auto;\n cursor: pointer;\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n`);\n\nconst generateId = (): string => {\n return nanoid();\n};\n\nconst generateEmptyFile = (): ProjectFile => ({\n file: EDITOR_DEFAULTS,\n name: \"Unnamed\",\n type: \"patch\",\n id: generateId(),\n});\n\ninterface AppProps {\n projectState?: Project;\n plugins?: Array<PluginConfig>;\n editorContextMenu?: Array<ReactNode>;\n onChange?: ({ nodes, edges, controlPanel }: EditorState) => void;\n theme?: Theme;\n}\n\nexport const App = ({ ...props }: AppProps) => {\n const { projectState, theme } = props;\n const currentFileIndex = useStore((store) => store.currentFileIndex);\n const currentFile = useStore(\n (store) => store.project.files[store.currentFileIndex],\n );\n const setCurrentFileIndex = useStore((store) => store.setCurrentFileIndex);\n\n const project = useStore((store) => store.project);\n const setProject = useStore((store) => store.setProject);\n const getProject = useStore((store) => store.getProject);\n const updateFileName = useStore((store) => store.updateFileName);\n\n const addFile = useStore((store) => store.addFile);\n const deleteFile = useStore((store) => store.deleteFile);\n const syncEditorWithCurrentFile = useStore(\n (store) => store.syncEditorWithCurrentFile,\n );\n\n const setEditorState = useStore((store) => store.setEditorState);\n const pullEditorChanges = useStore((store) => store.pullEditorChanges);\n\n useEffect(() => {\n setProject(\n projectState || {\n files: [generateEmptyFile()],\n },\n );\n const file = projectState?.files[0];\n file?.file && file?.type !== \"audio\" && setEditorState(file.file);\n }, [projectState]);\n\n // EXPERIMENTAL CODE\n useEffect(() => {\n const fetcher: typeof fetch = async (...args) => {\n const request = new Request(...args);\n const files = getProject().files;\n const index = request.url.replace(\"project://\", \"\");\n const file = files.find(({ id }) => id === index);\n\n if (!file) {\n return new Response(`File not found: ${request.url}`, { status: 404 });\n }\n\n if (isPatch(file)) {\n return new Response(JSON.stringify(file.file ?? null));\n }\n\n if (isAudio(file)) {\n return fetch(file.file);\n }\n\n return new Response(null);\n };\n registerFetcher(\"project://*\", fetcher);\n return () => {\n //unregister here\n };\n }, [getProject]);\n\n useEffect(() => {\n syncEditorWithCurrentFile();\n }, [currentFileIndex, syncEditorWithCurrentFile]);\n\n return (\n <ThemeProvider theme={theme || defaultTheme}>\n <Global\n styles={css`\n :root {\n --leva-colors-elevation1: #292d39;\n --leva-colors-elevation2: #181c20;\n --leva-colors-elevation3: #373c4b;\n --leva-colors-accent1: #0066dc;\n --leva-colors-accent2: #007bff;\n --leva-colors-accent3: #3c93ff;\n --leva-colors-highlight1: #535760;\n --leva-colors-highlight2: #8c92a4;\n --leva-colors-highlight3: #fefefe;\n --leva-colors-vivid1: #ffcc00;\n --leva-colors-folderWidgetColor: var(--leva-colors-highlight2);\n --leva-colors-folderTextColor: var(--leva-colors-highlight3);\n --leva-colors-toolTipBackground: var(--leva-colors-highlight3);\n --leva-colors-toolTipText: var(--leva-colors-elevation2);\n --leva-radii-xs: 2px;\n --leva-radii-sm: 3px;\n --leva-radii-lg: 10px;\n --leva-space-xs: 3px;\n --leva-space-sm: 6px;\n --leva-space-md: 10px;\n --leva-space-rowGap: 7px;\n --leva-space-colGap: 7px;\n --leva-fonts-mono:\n ui-monospace, SFMono-Regular, Menlo, \"Roboto Mono\", monospace;\n --leva-fonts-sans: system-ui, sans-serif;\n --leva-fontSizes-root: 11px;\n --leva-fontSizes-toolTip: var(--leva-fontSizes-root);\n --leva-sizes-rootWidth: 280px;\n --leva-sizes-controlWidth: 160px;\n --leva-sizes-numberInputMinWidth: 38px;\n --leva-sizes-scrubberWidth: 8px;\n --leva-sizes-scrubberHeight: 16px;\n --leva-sizes-rowHeight: 24px;\n --leva-sizes-folderTitleHeight: 20px;\n --leva-sizes-checkboxSize: 16px;\n --leva-sizes-joystickWidth: 100px;\n --leva-sizes-joystickHeight: 100px;\n --leva-sizes-colorPickerWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-colorPickerHeight: 100px;\n --leva-sizes-imagePreviewWidth: var(--leva-sizes-controlWidth);\n --leva-sizes-imagePreviewHeight: 100px;\n --leva-sizes-monitorHeight: 60px;\n --leva-sizes-titleBarHeight: 39px;\n --leva-shadows-level1: 0 0 9px 0 #00000088;\n --leva-shadows-level2: 0 4px 14px #00000033;\n --leva-borderWidths-root: 0px;\n --leva-borderWidths-input: 1px;\n --leva-borderWidths-focus: 1px;\n --leva-borderWidths-hover: 1px;\n --leva-borderWidths-active: 1px;\n --leva-borderWidths-folder: 1px;\n --leva-fontWeights-label: normal;\n --leva-fontWeights-folder: normal;\n --leva-fontWeights-button: normal;\n }\n `}\n />\n <AppWrapper>\n <TabsContainer>\n {project.files.map((file, index) => (\n <Tab\n onClick={() => {\n setCurrentFileIndex(index);\n }}\n key={index}\n active={index === currentFileIndex}\n >\n <EditableLabel\n onChange={(val) => updateFileName(index, val)}\n value={file.name || \"Unnamed\"}\n />\n <CloseIcon\n onClick={(event) => {\n event.stopPropagation();\n if (\n !window.confirm(\"Do you really want to delete this file?\")\n ) {\n return;\n }\n deleteFile(index);\n }}\n />\n </Tab>\n ))}\n <TabIconWrapper\n onClick={() => {\n addFile(generateEmptyFile());\n setCurrentFileIndex(project.files.length);\n }}\n >\n <AddFileIcon />\n </TabIconWrapper>\n </TabsContainer>\n <EditorContainerWrapper>\n <EditorContainer file={currentFile!} {...props} />\n </EditorContainerWrapper>\n </AppWrapper>\n </ThemeProvider>\n );\n};\n\nexport default App;\n","import { match } from './lib';\n\ntype Fetch = typeof fetch;\n\nconst customFetchers: Array<[string, Fetch]> = [];\n\ntype RegisterFetcher = (matcher: string, fetcher: Fetch) => void;\n\nexport const registerFetcher: RegisterFetcher = (matcher, fetcher) => {\n customFetchers.push([matcher, fetcher]);\n return () => {\n //delete fetcher\n };\n};\n\nconst getFetcher = (url: string): Fetch | void => {\n return [...customFetchers].reverse().find(([matcher]) => {\n return match(url, matcher);\n })?.[1];\n};\n\nconst webNoiseFetch: Fetch = (...args) => {\n const request = new Request(...args);\n const fetcher = getFetcher(request.url);\n if (fetcher) {\n return fetcher(...args);\n }\n return fetch(...args);\n};\n\nexport default webNoiseFetch;\n","export const match = (url: string, pattern: string): boolean => {\n // Escape special characters in the pattern, except for '*'\n const escapedPattern = pattern.replace(/([.+?^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\n\n // Replace '*' with '.*' to match any sequence of characters\n const regexPattern = escapedPattern.replace(/\\*/g, '.*');\n\n // Create a regular expression from the pattern, ensuring it matches the entire URL\n const regex = new RegExp(`^${regexPattern}$`);\n\n // Test if the URL matches the pattern\n return regex.test(url);\n};\n","import {\n addEdge,\n getConnectedEdges,\n NodeTypes,\n OnConnect,\n Viewport,\n} from \"reactflow\";\nimport { create, StateCreator } from \"zustand\";\nimport { setAudioNodeTypes, AudioNodeTypes } from \"@web-noise/patch\";\nimport { CONTROL_PANEL_GRID_CONFIG } from \"../constants\";\nimport generateNodeId from \"../helpers/generateNodeId\";\nimport {\n ControlPanelNode,\n ControlPanelNodes,\n PluginComponent,\n PluginConfig,\n WNEdge,\n WNNode,\n GraphState,\n EditorState,\n ControlPanelState,\n EditorStoreState,\n} from \"../types\";\nimport nodesStateCreator, { NodesState } from \"./nodesStore\";\nimport history, { historyStateCreator, HistoryState } from \"./history\";\nimport audioPatch, {\n AudioPatchState,\n audioPatchStateCreator,\n} from \"./audioPatch\";\nimport projectStateCreator, { ProjectState } from \"./projectStore\";\n\nexport type { AudioNodeTypes, NodesState, GraphState };\n\ninterface EditorConfig {\n showMinimap: boolean;\n}\n\ntype NodesConfiguration = Record<string, PluginComponent>;\n\nexport type StoreState = NodesState &\n HistoryState &\n ProjectState &\n AudioPatchState & {\n setGraph: (elements: { nodes: WNNode[]; edges: WNEdge[] }) => Promise<void>;\n clearGraph: () => void;\n createNode: (node: WNNode) => void;\n createNodes: (node: WNNode[]) => Promise<void>;\n removeNode: (node: WNNode) => void;\n removeNodes: (nodes: WNNode[]) => void;\n removeEdges: (nodes: WNEdge[]) => void;\n onConnect: OnConnect;\n createEdges: (edge: WNEdge[]) => void;\n onEdgesDelete: (edges: WNEdge[]) => void;\n onNodesDelete: (nodes: WNNode[]) => Promise<void>;\n plugins: Array<PluginConfig>;\n setPlugins: (plugins: Array<PluginConfig>) => void;\n nodesConfiguration: NodesConfiguration;\n config: EditorConfig;\n setConfig: (config: Partial<EditorConfig>) => void;\n getEditorState: () => EditorState;\n setEditorState: (state: EditorState) => Promise<void>;\n isHelpShown: boolean;\n toggleHelp: () => void;\n copyBuffer: { nodes: WNNode[]; edges: WNEdge[] };\n copy: (elements: { nodes: WNNode[]; edges: WNEdge[] }) => void;\n copySelectedItems: () => void;\n pasteBuffer: (x: number, y: number) => void;\n /* move to control panel store */\n getControlPanelNode: (node: WNNode) => ControlPanelNode | null;\n controlPanel: ControlPanelState;\n setControlPanelNodes: (nodes: ControlPanelNodes) => void;\n showControlPanel: () => void;\n hideControlPanel: () => void;\n setControlPanelSize: (width: { width: number; height: number }) => void;\n addNodeToControlPanel: (node: WNNode) => void;\n removeNodeFromControlPanel: (node: WNNode) => void;\n removeNodesFromControlPanel: (nodes: WNNode[]) => void;\n /* / move to control panel store */\n viewport: Viewport;\n setViewport: (viewport: Viewport) => void;\n };\n\nexport const stateCreator: StateCreator<StoreState> = (...args) => {\n const [set, get] = args;\n return {\n ...nodesStateCreator(...args),\n ...historyStateCreator(...args),\n ...audioPatchStateCreator(...args),\n ...projectStateCreator(...args),\n\n setGraph: async ({ nodes, edges }) => {\n const {\n patch,\n createNodes,\n createEdges,\n setNodesAndEdges,\n nodes: activeNodes,\n edges: activeEdges,\n } = get();\n setNodesAndEdges({ nodes: [], edges: [] });\n\n await createNodes(nodes);\n createEdges(edges);\n },\n clearGraph: () => {\n const { setGraph } = get();\n setGraph({ nodes: [], edges: [] });\n },\n createNodes: async (nodes) => {\n const { createNode } = get();\n await Promise.all(nodes.map((node) => createNode(node)));\n },\n createNode: (nodeData) => {\n const { addNode, nodesConfiguration } = get();\n\n const { type, id, data } = nodeData;\n\n if (typeof type === \"undefined\") {\n throw new Error(`node type is not defined for node: ${id}`);\n }\n\n const node = {\n ...nodeData,\n data: {\n ...data,\n config: {\n ...nodesConfiguration[type]?.defaultConfig,\n ...data?.config,\n },\n },\n };\n\n addNode(node);\n },\n removeNode: (node) => get().removeNodes([node]),\n removeNodes: (nodes) => {\n const {\n edges,\n nodes: currentNodes,\n onNodesDelete,\n removeEdges,\n removeNodesFromControlPanel,\n } = get();\n const parentNodeIds = nodes.map(({ id }) => id);\n const children = currentNodes.filter(\n ({ parentNode }) => parentNode && parentNodeIds.includes(parentNode),\n );\n const resultingNodes = [...nodes, ...children];\n removeNodesFromControlPanel(resultingNodes);\n const connectedEdges = getConnectedEdges(resultingNodes, edges);\n removeEdges(connectedEdges);\n onNodesDelete(resultingNodes);\n const nodeIds = resultingNodes.map(({ id }) => id);\n set({\n nodes: currentNodes.filter(({ id }) => !nodeIds.includes(id)),\n });\n },\n removeEdges: (edges) => {\n const { edges: currentEdges, onEdgesDelete } = get();\n const edgeIds = edges.map(({ id }) => id);\n onEdgesDelete(edges);\n set({\n edges: currentEdges.filter(({ id }) => !edgeIds.includes(id)),\n });\n },\n createEdges: (newEdges) => {\n const { patch, edges, setEdges } = get();\n setEdges(newEdges);\n },\n onConnect: async (connection) => {\n const { edges, createEdges } = get();\n const newEdges = addEdge(connection, edges);\n createEdges(newEdges);\n },\n onEdgesDelete: (edges) => {\n const { patch } = get();\n },\n onNodesDelete: async (nodes) => {\n const { removeNodesFromControlPanel, patch } = get();\n removeNodesFromControlPanel(nodes);\n },\n plugins: [],\n setPlugins: async (plugins) => {\n const { setNodeTypes } = get();\n set({ plugins });\n\n const nodesConf: NodesConfiguration = plugins.reduce((acc, plugin) => {\n return {\n ...acc,\n ...plugin.components.reduce(\n (subAcc, item) => ({\n ...subAcc,\n [item.type]: item,\n }),\n {},\n ),\n };\n }, {});\n\n const nodeTypes: NodeTypes = Object.keys(nodesConf).reduce(\n (acc, type) => {\n return {\n ...acc,\n [type]: nodesConf[type].node,\n };\n },\n {},\n );\n\n const audioNodeTypes: AudioNodeTypes = Object.keys(nodesConf).reduce(\n (acc, type) => {\n return {\n ...acc,\n [type]: nodesConf[type].audioNode,\n };\n },\n {},\n );\n\n setAudioNodeTypes(audioNodeTypes);\n setNodeTypes(nodeTypes);\n\n set(({ nodesConfiguration }) => ({\n nodesConfiguration: { ...nodesConfiguration, ...nodesConf },\n }));\n },\n nodesConfiguration: {},\n config: { showMinimap: false },\n setConfig: (changes) => {\n set(({ config }) => ({ config: { ...config, ...changes } }));\n },\n getEditorState: () => {\n const { getNodesAndEdges, controlPanel, viewport } = get();\n return {\n ...getNodesAndEdges(),\n controlPanel,\n viewport,\n };\n },\n setEditorState: async ({ nodes, edges, controlPanel, viewport }) => {\n const { setGraph } = get();\n await setGraph({ nodes, edges });\n // @TODO: remove this line once audio patch initialisation is reworked\n await new Promise((r) => setTimeout(r, 1000));\n set({\n controlPanel,\n viewport,\n });\n },\n isHelpShown: false,\n toggleHelp: () => {\n const { isHelpShown: showHelp } = get();\n set({ isHelpShown: !showHelp });\n },\n copyBuffer: { nodes: [], edges: [] },\n copy: (elements) => {\n set({ copyBuffer: elements });\n },\n copySelectedItems: () => {\n const { nodes: currentNodes, edges: currentEdges, copy } = get();\n const nodes = currentNodes.filter(({ selected }) => selected);\n const edges = currentEdges.filter(({ selected }) => selected);\n if (!nodes.length) {\n return;\n }\n copy({ nodes, edges });\n },\n pasteBuffer: (x = 0, y = 0) => {\n const { copyBuffer, createNodes, setEdges, nodes, edges } = get();\n const { nodes: nodesToCopy, edges: edgesToCopy } = copyBuffer;\n\n if (!nodesToCopy.length) {\n return;\n }\n\n set({\n nodes: nodes.map((node) => ({ ...node, selected: false })),\n });\n\n const topLeftNode = nodesToCopy.reduce((acc, node) => {\n if (!acc) {\n return node;\n }\n if (\n node.position.x < acc.position.x &&\n node.position.y < acc.position.y\n ) {\n return node;\n }\n return acc;\n });\n\n const xDelta = topLeftNode.position.x - x;\n const yDelta = topLeftNode.position.y - y;\n\n const { nodes: newNodes, mapping } = nodesToCopy.reduce(\n (acc, node) => {\n const newNodeId = generateNodeId(node);\n return {\n nodes: [\n ...acc.nodes,\n {\n ...node,\n id: newNodeId,\n position: {\n x: node.position.x - xDelta,\n y: node.position.y - yDelta,\n },\n selected: true,\n },\n ],\n mapping: {\n ...acc.mapping,\n [node.id]: newNodeId,\n },\n };\n },\n { nodes: [], mapping: {} } as {\n nodes: Array<WNNode>;\n mapping: Record<WNNode[\"id\"], WNNode[\"id\"]>;\n },\n );\n createNodes(newNodes);\n\n const newEdges = edgesToCopy.map((edge) => {\n const source = mapping[edge.source] || edge.source;\n const target = mapping[edge.target] || edge.target;\n return {\n ...edge,\n id: edge.id.replace(edge.source, source).replace(edge.target, target),\n source,\n target,\n selected: true,\n };\n });\n setEdges([\n ...edges.map((edge) => ({ ...edge, selected: false })),\n ...newEdges,\n ]);\n },\n getControlPanelNode: (node) => {\n const { nodesConfiguration } = get();\n const { type } = node;\n if (!type) {\n return null;\n }\n const controlPanelNode = nodesConfiguration[type]?.controlPanelNode;\n if (!controlPanelNode) {\n console.error(`could not find node for type ${type}`);\n return null;\n }\n return controlPanelNode;\n },\n controlPanel: {\n show: true,\n nodes: [],\n size: {\n width: 200,\n height: 100,\n },\n },\n showControlPanel: () =>\n set(({ controlPanel }) => ({\n controlPanel: { ...controlPanel, show: true },\n })),\n hideControlPanel: () =>\n set(({ controlPanel }) => ({\n controlPanel: { ...controlPanel, show: false },\n })),\n addNodeToControlPanel: (node) => {\n const { nodesConfiguration } = get();\n const defaultConfig = node.type\n ? nodesConfiguration[node.type]?.defaultConfig\n : {};\n const { height } = defaultConfig?.size || {};\n const newNode = {\n id: node.id,\n ...(height\n ? { height: height / CONTROL_PANEL_GRID_CONFIG.rowHeight }\n : {}),\n };\n set(({ controlPanel }) => ({\n controlPanel: {\n ...controlPanel,\n nodes: [...controlPanel.nodes, newNode],\n },\n }));\n },\n removeNodeFromControlPanel: (node) =>\n get().removeNodesFromControlPanel([node]),\n removeNodesFromControlPanel: (nodes) => {\n const nodeIds = nodes.map(({ id }) => id);\n set(({ controlPanel }) => {\n const nodes = controlPanel.nodes.filter(\n ({ id }) => !nodeIds.includes(id),\n );\n return {\n controlPanel: {\n ...controlPanel,\n nodes,\n },\n };\n });\n },\n setControlPanelNodes: (nodes) => {\n set(({ controlPanel }) => {\n return {\n controlPanel: {\n ...controlPanel,\n nodes,\n },\n };\n });\n },\n setControlPanelSize: (size) => {\n set(({ controlPanel }) => {\n return {\n controlPanel: {\n ...controlPanel,\n size,\n },\n };\n });\n },\n\n viewport: { x: 0, y: 0, zoom: 1 },\n setViewport: (viewport) => set({ viewport }),\n };\n};\n\nconst useStore = create<StoreState>(audioPatch(history(stateCreator)));\n\nexport default useStore;\n","export {\n default as createPatch,\n type Patch,\n type AudioNodeState,\n} from \"./src/createPatch\";\nexport {\n setAudioNodeTypes,\n getAudioNodeType,\n type AudioNodeTypes,\n} from \"./src/audioNodeTypes\";\n","import type {\n InputPort,\n OutputPort,\n WNAudioNode,\n TWNEdge as WNEdge,\n TWNNode as WNNode,\n} from \"@web-noise/core\";\n\nimport { getAudioNodeType } from \"./audioNodeTypes\";\n\n//@ts-ignore\nimport dumpNodeWorkletUrl from \"worklet:./dumpNodeWorklet.ts\";\nconst dumpNodeWorklet = new URL(dumpNodeWorkletUrl, import.meta.url);\n\ninterface AudioNodeLoadingState {\n loading: true;\n error: null;\n node: null;\n}\n\ninterface AudioNodeErrorState {\n loading: false;\n error: Error;\n node: null;\n}\n\ninterface AudioNodeLoadedState<T> {\n loading: false;\n error: null;\n node: T;\n}\n\nexport type AudioNodeState<T> =\n | AudioNodeLoadingState\n | AudioNodeErrorState\n | AudioNodeLoadedState<T>;\n\ntype AudioNodes = Map<string, AudioNodeState<WNAudioNode>>;\ntype RegisterAudioNode = (node: WNNode) => Promise<void>;\ntype RegisterAudioNodes = (nodes: WNNode[]) => Promise<void[]>;\ntype UnregisterAudioNode = (node: WNNode) => void;\ntype UnregisterAudioNodes = (node: WNNode[]) => void;\n\ntype AudioConnections = Map<string, { output: OutputPort; input: InputPort }>;\ntype RegisterAudioConnection = (edge: WNEdge) => void;\ntype RegisterAudioConnections = (edge: WNEdge[]) => void[];\ntype UnregisterAudioConnection = (edge: WNEdge) => void;\ntype UnregisterAudioConnections = (edge: WNEdge[]) => void[];\n\nexport interface Patch {\n audioContext: AudioContext;\n audioNodes: AudioNodes;\n registerAudioNode: RegisterAudioNode;\n registerAudioNodes: RegisterAudioNodes;\n unregisterAudioNode: (node: WNNode) => void;\n unregisterAudioNodes: (nodes: WNNode[]) => void;\n audioConnections: AudioConnections;\n registerAudioConnection: RegisterAudioConnection;\n registerAudioConnections: RegisterAudioConnections;\n unregisterAudioConnection: (edge: WNEdge) => void;\n unregisterAudioConnections: (edges: WNEdge[]) => void;\n}\n\ntype CreatePatch = (audioContext?: AudioContext) => Patch;\n\nconst createPatch: CreatePatch = (audioContext = new AudioContext()) => {\n /*\n * due to bug in chrome we need to kickstart worklet outputs\n * by connecting it to an input\n * */\n const dumpNodePromise: Promise<AudioWorkletNode> = audioContext.audioWorklet\n .addModule(dumpNodeWorklet)\n .then(() => {\n return new AudioWorkletNode(audioContext, \"dump-node-processor\");\n });\n\n const audioNodes: AudioNodes = new Map();\n const audioConnections: AudioConnections = new Map();\n\n const registerAudioNode: RegisterAudioNode = async (node) => {\n const { id, type, data } = node;\n if (!type) {\n audioNodes.set(id, {\n loading: false,\n error: new Error(`Node: ${id} has no type`),\n node: null,\n });\n return;\n }\n const nodeCreator = getAudioNodeType(type);\n if (nodeCreator === false) {\n return;\n }\n const createNode = nodeCreator;\n if (!createNode) {\n audioNodes.set(id, {\n loading: false,\n error: new Error(`Could not find handler for audio type ${type}`),\n node: null,\n });\n return;\n }\n audioNodes.set(id, {\n loading: true,\n error: null,\n node: null,\n });\n try {\n const audioNode = await createNode(audioContext, data);\n const dumpNode = await dumpNodePromise;\n audioNodes.set(id, {\n loading: false,\n error: null,\n node: audioNode,\n });\n\n // Kickstart worklet outputs\n Object.values(audioNode.outputs || []).forEach(({ port }) => {\n if (!dumpNode) {\n return;\n }\n if (port instanceof AudioWorkletNode) {\n port.connect(dumpNode);\n }\n if (Array.isArray(port) && port[0] instanceof AudioWorkletNode) {\n port[0].connect(dumpNode, port[1]);\n }\n });\n } catch (error) {\n audioNodes.set(id, {\n loading: false,\n error: error as Error,\n node: null,\n });\n }\n };\n\n const registerAudioNodes: RegisterAudioNodes = async (nodes) => {\n return Promise.all(nodes.map(registerAudioNode));\n };\n\n const unregisterAudioNode: UnregisterAudioNode = (props) => {\n const { id, data } = props;\n const audioNode = audioNodes.get(id);\n if (!audioNode) {\n console.error(`Audio node #${id} does not exist`);\n return;\n }\n const { loading, error, node } = audioNode;\n\n if (loading) {\n console.error(`Audio node #${id} is yet not loaded`);\n return;\n }\n\n if (error) {\n console.error(`Audio node #${id} is in error state: ${error.toString()}`);\n return;\n }\n\n node.destroy && node.destroy();\n\n //disconnect all ports\n Object.values(node.inputs || {}).forEach(\n ({ port }) =>\n port instanceof AudioNode && port.disconnect && port.disconnect(),\n );\n\n Object.values(node.outputs || {}).forEach(\n ({ port }) =>\n port instanceof AudioNode && port.disconnect && port.disconnect(),\n );\n\n audioNodes.delete(id);\n };\n\n const unregisterAudioNodes: UnregisterAudioNodes = (nodes) => {\n return nodes.map(unregisterAudioNode);\n };\n\n const registerAudioConnection: RegisterAudioConnection = (edge) => {\n const { source, sourceHandle, target, targetHandle, id } = edge;\n const { node: sourceNode } = audioNodes.get(source) || {};\n\n if (!sourceNode) {\n console.error(`can't find source node ${source}`);\n return;\n }\n if (!sourceHandle) {\n console.error(`source handle is not defined in node ${source}`);\n return;\n }\n const outputNode = sourceNode.outputs?.[sourceHandle];\n const outputNodePort = outputNode?.port;\n\n const { node: targetNode } = audioNodes.get(target) || {};\n if (!targetNode) {\n console.error(`can't find target node ${targetNode}`);\n return;\n }\n if (!targetHandle) {\n console.error(`source handle is not defined in node ${sourceNode}`);\n return;\n }\n const inputNode = targetNode.inputs?.[targetHandle];\n const inputNodePort = inputNode?.port;\n\n if (!outputNodePort) {\n console.error(`Can't find output port: ${source}:${sourceHandle}`);\n return;\n }\n\n if (!inputNodePort) {\n console.error(`Can't find input port: ${target}:${targetHandle}`);\n return;\n }\n\n const isInputNode = inputNodePort instanceof AudioNode;\n const isInputParam = inputNodePort instanceof AudioParam;\n const isInputArray = inputNodePort instanceof Array;\n const isInputSimple = isInputNode || isInputParam;\n\n const isOutputNode = outputNodePort instanceof AudioNode;\n const isOutputArray = outputNodePort instanceof Array;\n\n if (isOutputNode && isInputSimple) {\n //@ts-ignore inputNode can actually be AudioParam\n outputNodePort.connect(inputNodePort);\n } else if (isOutputNode && isInputArray) {\n outputNodePort.connect(inputNodePort[0], 0, inputNodePort[1]);\n } else if (isOutputArray && isInputSimple) {\n //@ts-ignore inputNode can actually be AudioParam\n outputNodePort[0].connect(inputNodePort, outputNodePort[1]);\n } else if (isOutputArray && isInputArray) {\n outputNodePort[0].connect(\n inputNodePort[0],\n outputNodePort[1],\n inputNodePort[1],\n );\n } else {\n console.log(outputNodePort, inputNodePort);\n console.error(`ports can be only AudioNode or AudioNodeChannel`);\n }\n\n audioConnections.set(id, { output: outputNode, input: inputNode });\n };\n\n const registerAudioConnections: RegisterAudioConnections = (edges) => {\n return edges.map(registerAudioConnection);\n };\n\n const unregisterAudioConnection: UnregisterAudioConnection = (edge) => {\n const { id, data } = edge;\n const audioConnection = audioConnections.get(id);\n if (!audioConnection) {\n console.error(`can't find connection with id: ${id}`);\n return;\n }\n\n const {\n input: { port: inputNodePort },\n output: { port: outputNodePort },\n } = audioConnection;\n const isInputNode = inputNodePort instanceof AudioNode;\n const isInputParam = inputNodePort instanceof AudioParam;\n const isInputArray = inputNodePort instanceof Array;\n const isInputSimple = isInputNode || isInputParam;\n\n const isOutputNode = outputNodePort instanceof AudioNode;\n const isOutputArray = outputNodePort instanceof Array;\n\n if (isOutputNode && isInputSimple) {\n //@ts-ignore inputNode can actually be AudioParam\n outputNodePort.disconnect(inputNodePort);\n } else if (isOutputNode && isInputArray) {\n outputNodePort.disconnect(inputNodePort[0], 0, inputNodePort[1]);\n } else if (isOutputArray && isInputSimple) {\n //@ts-ignore inputNode can actually be AudioParam\n outputNodePort[0].disconnect(inputNodePort, outputNodePort[1]);\n } else if (isOutputArray && isInputArray) {\n outputNodePort[0].disconnect(\n inputNodePort[0],\n outputNodePort[1],\n inputNodePort[1],\n );\n } else {\n console.log(outputNodePort, inputNodePort);\n throw new Error(\n `output port can not be only AudioNode or AudioNodeChannel`,\n );\n }\n audioConnections.delete(id);\n };\n\n const unregisterAudioConnections: UnregisterAudioConnections = (edges) => {\n return edges.map(unregisterAudioConnection);\n };\n\n return {\n audioContext,\n audioNodes,\n registerAudioNode,\n registerAudioNodes,\n unregisterAudioNode,\n unregisterAudioNodes,\n audioConnections,\n registerAudioConnection,\n registerAudioConnections,\n unregisterAudioConnection,\n unregisterAudioConnections,\n };\n};\n\nexport default createPatch;\n","import type { CreateWNAudioNode } from \"@web-noise/core\";\n\nexport interface AudioNodeTypes\n extends Record<string, CreateWNAudioNode | false> {}\n\nexport type GetAudioNodeType = (type: string) => CreateWNAudioNode | false;\nexport const audioNodeTypes: AudioNodeTypes = {};\n\nexport const setAudioNodeTypes = (newAudioNodeTypes: AudioNodeTypes) => {\n Object.assign(audioNodeTypes, newAudioNodeTypes);\n};\n\nexport const getAudioNodeType: GetAudioNodeType = (type) =>\n audioNodeTypes[type];\n","module.exports = \"abe416d54e6a969f\";","export const DRAG_HANDLE_CLASS = \"web-noise-drag-handle\";\nexport const DRAG_HANDLE_SELECTOR = `.${DRAG_HANDLE_CLASS}`;\n\nexport const CONTROL_PANEL_GRID_CONFIG = {\n rowHeight: 10,\n cols: 4,\n};\n\nexport enum PortType {\n Gate = \"gate\",\n Number = \"number\",\n Audio = \"audio\",\n Any = \"any\",\n}\n","import { WNNode } from \"../types\";\n\nconst generateNodeId = (node?: Partial<WNNode>): WNNode[\"id\"] => {\n const random = +new Date() + Math.floor(Math.random() * 1000);\n if (!node?.type) {\n return random.toString();\n }\n return `${node.type}-${random}`;\n};\n\nexport default generateNodeId;\n","import {\n addEdge,\n applyEdgeChanges,\n applyNodeChanges,\n OnConnect,\n OnEdgesChange,\n OnNodesChange,\n NodeTypes,\n} from \"reactflow\";\nimport { StateCreator } from \"zustand\";\nimport { DRAG_HANDLE_SELECTOR } from \"../constants\";\nimport type { WNNode, WNNodeData, WNEdge, GraphState } from \"../types\";\n\n//@TODO: rename to NodesStore\nexport interface NodesState {\n nodes: WNNode[];\n edges: WNEdge[];\n onNodesChange: OnNodesChange;\n onEdgesChange: OnEdgesChange;\n onConnect: OnConnect;\n addNode: (node: WNNode) => void;\n setNodes: (nodes: WNNode[]) => void;\n setEdges: (edges: WNEdge[]) => void;\n setNodesAndEdges: (elements: GraphState) => void;\n getNodesAndEdges: () => GraphState;\n clearElements: () => void;\n getNode: (id: string) => WNNode | null;\n updateNodeData: (id: string, data: Partial<WNNodeData>) => void;\n nodeTypes: NodeTypes;\n setNodeTypes: (nodeTypes: NodeTypes) => void;\n}\n\nconst nodesStateCreator: StateCreator<NodesState> = (set, get) => ({\n nodes: [],\n edges: [],\n onNodesChange: (changes) => {\n set(({ nodes }) => ({\n nodes: applyNodeChanges(changes, nodes).map((node) => ({\n dragHandle: DRAG_HANDLE_SELECTOR,\n ...node,\n })),\n }));\n },\n onEdgesChange: (changes) => {\n set(({ edges }) => ({\n edges: applyEdgeChanges(changes, edges),\n }));\n },\n onConnect: (connection) => {\n set(({ edges }) => ({\n edges: addEdge(connection, edges),\n }));\n },\n addNode: (node) => {\n set(({ nodes }) => ({\n nodes: nodes.concat(node),\n }));\n },\n setNodes: (nodes) => {\n set({\n nodes,\n });\n },\n setEdges: (edges) => {\n set({\n edges,\n });\n },\n setNodesAndEdges: ({ nodes, edges }) => {\n set({\n nodes,\n edges,\n });\n },\n getNodesAndEdges: () => {\n const { nodes, edges } = get();\n return { nodes, edges };\n },\n clearElements: () => {\n set({\n nodes: [],\n edges: [],\n });\n },\n getNode: (id) => {\n const { nodes } = get();\n const node = nodes.find((node) => node.id === id);\n return node || null;\n },\n updateNodeData: (id, data) => {\n set(({ nodes }) => {\n return {\n nodes: nodes.map((node) => {\n if (node.id === id) {\n return {\n ...node,\n data: {\n ...node.data,\n ...data,\n },\n };\n }\n\n return node;\n }),\n };\n });\n },\n nodeTypes: {},\n setNodeTypes: (nodeTypes) => set({ nodeTypes }),\n});\n\nexport default nodesStateCreator;\n","import type { StateCreator } from \"zustand\";\nimport type { StoreState } from \"../\";\nimport * as jsondiffpatch from \"jsondiffpatch\";\nimport type { Delta, FilterContext } from \"jsondiffpatch\";\n\nexport interface HistoryState {\n history: {\n maxHistoryLength: number;\n buffer: Array<Delta>;\n pointer: number;\n skipCollect: boolean;\n push: (changes: Delta) => void;\n back: () => void;\n forward: () => void;\n clear: () => void;\n };\n}\n\nconst cloneObject = <T = unknown>(input: T): T => {\n return JSON.parse(JSON.stringify(input));\n};\n\nexport const historyStateCreator: StateCreator<HistoryState> = (set, get) => ({\n history: {\n maxHistoryLength: 5,\n buffer: [],\n pointer: 0,\n skipCollect: false,\n push: (changes: Delta) => {\n const { history } = get();\n const { maxHistoryLength, skipCollect } = history;\n\n if (skipCollect) {\n set({\n history: {\n ...history,\n skipCollect: false,\n },\n });\n return;\n }\n\n set(({ history }) => {\n if (!history) {\n return {};\n }\n const { buffer, pointer } = history;\n\n const newBuffer = buffer.slice(\n Math.max(pointer - maxHistoryLength + 1, 0),\n pointer,\n );\n\n return {\n history: {\n ...history,\n buffer: [...newBuffer, changes],\n pointer: Math.min(pointer + 1, maxHistoryLength),\n },\n };\n });\n },\n back: () => {\n const { nodes, edges, controlPanel, history } = get() as StoreState;\n const { buffer, pointer } = history;\n\n const patchData = buffer[pointer - 1];\n if (!patchData) {\n return;\n }\n\n const reversedPatchData = jsondiffpatch.reverse(patchData);\n if (!reversedPatchData) {\n return;\n }\n\n const updates = cloneObject({\n nodes,\n edges,\n controlPanel,\n });\n\n const patch = jsondiffpatch.patch(updates, reversedPatchData);\n\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer - 1,\n skipCollect: true,\n },\n });\n },\n forward: () => {\n const { nodes, edges, controlPanel, history } = get() as StoreState;\n const { buffer, pointer } = history;\n\n const patchData = buffer[pointer];\n if (!patchData) {\n return;\n }\n\n const updates = cloneObject({\n nodes,\n edges,\n controlPanel,\n });\n\n const patch = jsondiffpatch.patch(updates, patchData);\n\n set({\n ...patch,\n history: {\n ...history,\n pointer: pointer + 1,\n skipCollect: true,\n },\n });\n },\n // @TODO: remove this method and store history per file\n clear: () => {\n const { history } = get();\n set({\n history: {\n ...history,\n buffer: [],\n pointer: 0,\n skipCollect: true,\n },\n });\n },\n },\n});\n\nconst COLLECT_CHANGES_DEBOUNCE_TIME = 500;\n\nexport const createChangesCollector = (set: any, get: () => StoreState) => {\n const jsondiffpatchInstance = jsondiffpatch.create({\n propertyFilter: (name: string, context: FilterContext) => {\n //@TODO: rework this function, find better solution\n if (context.parent?.parent?.childName === \"controlPanel\") {\n return true;\n }\n if (\n // @ts-ignore\n [\"data\", \"position\", \"controlPanel\"].includes(context.parent?.childName)\n ) {\n return true;\n }\n return [\n \"controlPanel\",\n \"size\",\n \"edges\",\n\n \"nodes\",\n \"data\",\n \"label\",\n \"config\",\n \"values\",\n\n \"position\",\n \"x\",\n \"y\",\n ].includes(name);\n },\n });\n let oldState: StoreState | null = get();\n let timer: any;\n\n return (state: StoreState, prevState: StoreState) => {\n if (state.currentFileIndex !== prevState.currentFileIndex) {\n get().history.clear();\n }\n clearTimeout(timer);\n if (!oldState) {\n oldState = prevState;\n }\n timer = setTimeout(() => {\n const changes = jsondiffpatchInstance.diff(oldState, state);\n oldState = null;\n\n if (changes) {\n get().history.push(changes);\n }\n }, COLLECT_CHANGES_DEBOUNCE_TIME);\n };\n};\n\ntype StoreStateCreator = StateCreator<StoreState>;\n\nconst history =\n (config: StoreStateCreator): StoreStateCreator =>\n (set, get, api) => {\n const collectChanges = createChangesCollector(set, get);\n api.subscribe(collectChanges);\n return config((...args) => set(...args), get, api);\n };\n\nexport default history;\n","import { createPatch, Patch } from \"@web-noise/patch\";\nimport type { StateCreator } from \"zustand\";\nimport type { StoreState } from \"../\";\nimport { compareGraphs } from \"./compareGraphs\";\n\ntype StoreStateCreator = StateCreator<StoreState>;\nexport interface AudioPatchState {\n patch: Patch;\n nodesState: Record<string, any>;\n}\n\nexport const audioPatchStateCreator: StateCreator<AudioPatchState> = (\n set,\n get,\n) => ({\n patch: createPatch(),\n nodesState: {},\n});\n\nconst audioPatch =\n (config: StoreStateCreator): StoreStateCreator =>\n (set, get, api) => {\n api.subscribe(async (state, prevState) => {});\n\n const promises = new Set<Promise<unknown>>();\n\n let currentState = {\n ...get(),\n nodes: [],\n edges: [],\n };\n\n return config(\n async (...args) => {\n const oldState = get();\n const [storeChanges] = args;\n\n //@ts-ignore\n const newState = {\n ...currentState,\n ...(typeof storeChanges === \"function\"\n ? storeChanges({ ...currentState })\n : storeChanges),\n };\n\n const nodeChanges = compareGraphs(currentState.nodes, newState.nodes);\n const edgeChanges = compareGraphs(currentState.edges, newState.edges);\n\n //@ts-ignore\n currentState = newState;\n\n const newNodes = nodeChanges.added;\n const newEdges = edgeChanges.added;\n const removedEdges = edgeChanges.removed;\n const removedNodes = nodeChanges.removed;\n\n const { patch } = oldState;\n\n if (newNodes.length) {\n const promise = patch.registerAudioNodes(\n //@ts-ignore\n newNodes,\n );\n promises.add(promise);\n await promise;\n promises.delete(promise);\n }\n\n if (!(newEdges.length || removedEdges.length || removedNodes.length)) {\n set(...args);\n return;\n }\n\n if (promises.size) {\n try {\n await Promise.all([...promises.values()]);\n } catch (e) {\n console.log(\"some error\", e);\n }\n }\n\n if (newEdges.length) {\n patch.registerAudioConnections(\n //@ts-ignore\n newEdges,\n );\n }\n\n if (removedEdges.length) {\n //@ts-ignore\n patch.unregisterAudioConnections(removedEdges);\n }\n\n if (removedNodes.length) {\n //@ts-ignore\n patch.unregisterAudioNodes(removedNodes);\n }\n\n set(...args);\n },\n get,\n api,\n );\n };\n\nexport default audioPatch;\n","import { WNEdge, WNNode } from \"../../types\";\n\nexport type GraphItems = Array<WNNode | WNEdge>;\n\nexport interface GraphComparisonResult {\n added: GraphItems;\n removed: GraphItems;\n}\n\nexport const compareGraphs = (\n left: GraphItems,\n right: GraphItems,\n): GraphComparisonResult => {\n const setLeft = new Set(left.map((item) => item.id));\n const setRight = new Set(right.map((item) => item.id));\n\n const added = right.filter((item) => !setLeft.has(item.id));\n const removed = left.filter((item) => !setRight.has(item.id));\n\n return { added, removed };\n};\n","import { StateCreator } from \"zustand\";\nimport type { EditorState, Project, ProjectFile } from \"../types\";\nimport type { StoreState } from \"./\";\nimport { isAudio } from \"../helpers/projectFile\";\n\nexport interface ProjectState {\n project: Project;\n setProject: (project: Project) => void;\n getProject: () => Project;\n\n pullEditorChanges: () => void;\n syncEditorWithCurrentFile: () => void;\n\n //@TODO: move inside project\n currentFileIndex: number;\n setCurrentFileIndex: (index: number) => void;\n\n updateFileContent: (fileIndex: number, file: ProjectFile) => void;\n updateFileName: (fileIndex: number, fileName: string) => void;\n addFile: (file: ProjectFile, name?: string) => void;\n deleteFile: (fileIndex: number) => void;\n}\n\nconst projectStateCreator: StateCreator<ProjectState> = (set, get) => ({\n project: { files: [] },\n setProject(project) {\n set({ project, currentFileIndex: 0 });\n },\n getProject() {\n return get().project;\n },\n\n pullEditorChanges() {\n const { getEditorState, currentFileIndex, updateFileContent, project } =\n get() as StoreState;\n const currentFile = project.files[currentFileIndex];\n if (isAudio(currentFile)) {\n return;\n }\n updateFileContent(currentFileIndex, {\n ...currentFile,\n file: getEditorState(),\n });\n },\n\n syncEditorWithCurrentFile: () => {\n const { currentFileIndex, setEditorState, project } = get() as StoreState;\n const currentFile = project.files[currentFileIndex];\n if (currentFile.type === \"audio\") {\n console.log(\"audio file. skipping\");\n return;\n }\n setEditorState(currentFile.file);\n },\n\n currentFileIndex: 0,\n setCurrentFileIndex(newFileIndex) {\n const { currentFileIndex } = get();\n if (newFileIndex === currentFileIndex) {\n return;\n }\n set({ currentFileIndex: newFileIndex });\n },\n\n updateFileContent(index, file) {\n const { project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i) => {\n if (i === index) {\n return {\n // @TODO check again if merging is really needed here\n ...f,\n ...file,\n };\n }\n return f;\n }),\n },\n });\n },\n updateFileName(index, fileName) {\n const { project } = get();\n set({\n project: {\n ...project,\n files: project.files.map((f, i) => {\n if (i === index) {\n return {\n ...f,\n name: fileName,\n };\n }\n return f;\n }),\n },\n });\n },\n addFile(file) {\n const { project } = get();\n const files = [...project.files, file];\n set({\n project: {\n ...project,\n files,\n },\n });\n },\n deleteFile: (fileIndex) => {\n const { project, currentFileIndex } = get();\n\n set({\n project: {\n ...project,\n files: project.files.filter((_, index) => fileIndex !== index),\n },\n });\n\n if (fileIndex <= currentFileIndex) {\n set({ currentFileIndex: currentFileIndex - 1 });\n }\n },\n});\n\nexport default projectStateCreator;\n","import type { AudioFile, EditorFile, ProjectFile } from \"../types\";\n\nexport const isPatch = (file: ProjectFile): file is EditorFile =>\n !(\"type\" in file) || file.type === \"patch\";\n\nexport const isAudio = (file: ProjectFile): file is AudioFile =>\n file.type === \"audio\";\n","import { injectGlobal } from \"@emotion/css\";\nimport theme from \"./theme\";\n\ninjectGlobal`\n .react-flow {\n .react-flow__pane {\n /* background: rgb(106 106 106); */\n /* background: \"white\"; */\n // background: #292d39;\n background: ${theme.colors.elevation3};\n }\n\n .react-flow__background {\n /* background: #efefef; */\n stroke: white;\n }\n\n .react-flow__node-default {\n background: #292d39;\n color: white;\n border: none;\n /* background: transparent; */\n }\n\n .react-flow__node {\n padding: 0;\n width: auto;\n }\n\n .react-flow__edge-path {\n stroke: ${theme.colors.accent2};\n }\n\n .react-flow__node.selected {\n border: 1px solid ${theme.colors.accent2};\n box-shadow: 0 0 0 0.5px #${theme.colors.accent2};\n }\n\n .react-flow__node-default.selected, .react-flow__node-default.selected:hover {\n box-shadow: 0 0 0 0.5px #${theme.colors.accent2};\n }\n\n /* .react-flow__minimap-mask {\n fill: ${theme.colors.elevation1}\n }\n\n .react-flow__minimap-node {\n fill:${theme.colors.accent2}\n } */\n }\n\n`;\n","const LEVA_COLOR_ACCENT2_BLUE = \"#007bff\";\nconst COLOR_GREEN_PRIMARY = \"#14df42\";\nconst COLOR_WHITE_PRIMARY = \"#ffffff\";\n\nconst colors = <const>{\n elevation1: \"#292d39\", // bg color of the root panel (main title bar)\n elevation2: \"#181c20\", // bg color of the rows (main panel color)\n elevation3: \"#373c4b\", // bg color of the inputs\n accent1: \"#0066dc\",\n accent2: LEVA_COLOR_ACCENT2_BLUE,\n accent3: \"#3c93ff\",\n highlight1: \"#535760\",\n highlight2: \"#8c92a4\",\n highlight3: \"#fefefe\",\n vivid1: COLOR_GREEN_PRIMARY,\n whitePrimary: COLOR_WHITE_PRIMARY,\n error: \"#db5353\",\n};\n\nconst zIndex = <const>{\n modal: 9998,\n controlPanel: 9999,\n resumeContextLayout: 10003,\n};\n\nconst theme = {\n colors,\n zIndex,\n};\n\nexport type Theme = typeof theme;\n\nexport default theme;\n","import {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport ReactFlow, {\n Background,\n BackgroundVariant,\n Controls,\n MiniMap,\n ReactFlowInstance,\n ReactFlowProvider,\n useOnViewportChange,\n} from \"reactflow\";\nimport \"reactflow/dist/style.css\";\nimport useStore from \"../../store\";\nimport type { EditorState, PluginConfig } from \"../../types\";\nimport EdgeContextMenu, {\n useEdgeContextMenu,\n} from \"../contextMenu/EdgeContextMenu\";\nimport EditorContextMenu, {\n useEditorContextMenu,\n} from \"../contextMenu/EditorContextMenu\";\nimport NodeContextMenu, {\n useNodeContextMenu,\n} from \"../contextMenu/NodeContextMenu\";\nimport ControlPanel from \"../ControlPanel\";\nimport { HelpButton, HelpModal } from \"../Help\";\nimport ResumeContext from \"../ResumeContext\";\nimport ToggleMinimap from \"../ToggleMinimap\";\nimport Wire from \"../Wire\";\n\nconst onNodeDragStop = (_event: any, node: any) =>\n console.log(\"drag stop\", node);\nconst onNodeClick = (_event: any, element: any) =>\n console.log(\"click\", element);\n\nconst snapGrid: [number, number] = [20, 20];\n\ninterface EditorProps {\n editorState?: EditorState;\n plugins?: Array<PluginConfig>;\n editorContextMenu?: Array<ReactNode>;\n onChange?: ({ nodes, edges, controlPanel }: EditorState) => void;\n}\n\nexport const EditorPane = ({\n editorState,\n plugins = [],\n editorContextMenu = [],\n onChange = () => {},\n ...props\n}: EditorProps) => {\n const edgeTypes = useMemo(\n () => ({\n wire: Wire,\n }),\n [],\n );\n\n const {\n nodes,\n edges,\n controlPanel,\n onNodesChange,\n onNodesDelete,\n onEdgesChange,\n onEdgesDelete,\n onConnect,\n setPlugins,\n setViewport,\n viewport,\n } = useStore();\n\n const editorConfig = useStore(({ config }) => config);\n\n const nodeTypes = useStore(({ nodeTypes }) => nodeTypes);\n\n useEffect(() => {\n setPlugins(plugins);\n }, [plugins]);\n\n const [reactflowInstance, setReactflowInstance] =\n useState<ReactFlowInstance | null>(null);\n\n useEffect(() => {\n if (!reactflowInstance) {\n return;\n }\n onChange({\n nodes,\n edges,\n controlPanel,\n viewport,\n });\n }, [nodes, edges, controlPanel, viewport]);\n\n const onInit = useCallback(\n (rfi: ReactFlowInstance) => {\n if (!reactflowInstance) {\n setReactflowInstance(rfi);\n console.log(\"flow loaded:\", rfi);\n }\n },\n [reactflowInstance],\n );\n\n const { onContextMenu: onEditorContextMenu } = useEditorContextMenu();\n const { onContextMenu: onNodeContextMenu } = useNodeContextMenu();\n const { onContextMenu: onEdgeContextMenu } = useEdgeContextMenu();\n\n useEffect(() => {\n if (!viewport) {\n return;\n }\n reactflowInstance?.setViewport(viewport);\n }, [viewport, reactflowInstance]);\n\n useOnViewportChange({\n onEnd: setViewport,\n });\n\n return (\n <ReactFlow\n nodes={nodes}\n edges={edges}\n onNodesChange={onNodesChange}\n onNodesDelete={onNodesDelete}\n onEdgesChange={onEdgesChange}\n onConnect={onConnect}\n onNodeDragStop={onNodeDragStop}\n onEdgesDelete={onEdgesDelete}\n onInit={onInit}\n onNodeClick={onNodeClick}\n onContextMenu={onEditorContextMenu}\n onNodeContextMenu={onNodeContextMenu}\n onEdgeContextMenu={onEdgeContextMenu}\n nodeTypes={nodeTypes}\n edgeTypes={edgeTypes}\n snapGrid={snapGrid}\n defaultViewport={editorState?.viewport}\n defaultEdgeOptions={{ type: \"wire\" }}\n snapToGrid\n fitView\n disableKeyboardA11y\n >\n <Background variant={BackgroundVariant.Dots} gap={12} />\n {editorConfig.showMinimap ? <MiniMap /> : null}\n\n <Controls\n style={{\n right: \"1rem\",\n left: \"initial\",\n bottom: \"40%\",\n top: \"initial\",\n }}\n showInteractive={false}\n >\n <ToggleMinimap />\n <HelpButton />\n </Controls>\n\n <ResumeContext />\n <ControlPanel />\n <HelpModal />\n <EditorContextMenu editorContextMenu={editorContextMenu} />\n <NodeContextMenu />\n <EdgeContextMenu />\n </ReactFlow>\n );\n};\n\nexport const Editor = (props: EditorProps) => (\n <ReactFlowProvider>\n <EditorPane {...props} />\n </ReactFlowProvider>\n);\n\nexport default Editor;\n","import { useCallback } from \"react\";\nimport { useContextMenu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\nexport const MENU_ID = \"editor-edge-menu\";\n\nexport const useEdgeContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n const onContextMenu = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>, edge: unknown) => {\n event.stopPropagation();\n show(event, { props: { edge } });\n },\n [show],\n );\n\n return { onContextMenu };\n};\n\nconst EdgeContextMenu = () => {\n const theme = useTheme();\n\n const removeEdges = useStore((store) => store.removeEdges);\n\n return (\n <>\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper onClick={(event) => removeEdges([event.props.edge])}>\n Delete Edge (DEL)\n </ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default EdgeContextMenu;\n","import { useTheme as useEmotionTheme } from \"@emotion/react\";\nimport type { Theme } from '../theme';\n\nconst useTheme = () => {\n return useEmotionTheme() as Theme;\n}\n\nexport default useTheme;\n","import styled from \"@emotion/styled\";\nimport { Item, Menu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { Theme } from \"../../theme\";\n\n\nexport const ItemWrapper = styled(Item)``;\n\nexport const MenuWrapper = styled(Menu)<{ colors: Theme[\"colors\"] }>`\n background: ${({ colors }) => colors.elevation2};\n padding: 0;\n border-radius: 0;\n\n .react-contexify__item__content {\n color: ${({ colors }) => colors.whitePrimary};\n }\n\n .react-contexify__separator {\n background-color: ${({ colors }) => colors.elevation1};\n margin: 0;\n }\n`;\n","import downloadFile from \"js-file-download\";\nimport {\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Separator, useContextMenu } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { useReactFlow, type XYPosition } from \"reactflow\";\nimport hotkeys from \"hotkeys-js\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport AddNode from \"../AddNode\";\nimport UploadPatch from \"../UploadPatch\";\nimport UploadProject from \"../UploadProject\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\ntype MousePosition = {\n x: number;\n y: number;\n};\n\nexport const MENU_ID = \"editor-menu\";\n\nexport const useEditorContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n return { onContextMenu: show };\n};\n\nconst EditorContextMenu = ({\n editorContextMenu = [],\n}: {\n editorContextMenu?: Array<ReactNode>;\n}) => {\n const theme = useTheme();\n\n const [mousePosition, setMousePosition] = useState<MousePosition>({\n x: 0,\n y: 0,\n });\n const [showAddNode, setShowAddNode] = useState(false);\n const [showUploadPatch, setShowUploadPatch] = useState(false);\n const [showUploadProject, setShowUploadProject] = useState(false);\n\n const addNodeHandler = useCallback(\n (x: number, y: number) => {\n setMousePosition({ x, y });\n setShowAddNode(true);\n },\n [setShowAddNode],\n );\n\n const pasteBuffer = useStore((store) => store.pasteBuffer);\n const { screenToFlowPosition } = useReactFlow();\n const pasteBufferHandler = useCallback(\n (mousePosition: XYPosition) => {\n const { x, y } = screenToFlowPosition(mousePosition);\n pasteBuffer(x, y);\n },\n [setShowAddNode, screenToFlowPosition],\n );\n\n const clearGraph = useStore(({ clearGraph }) => clearGraph);\n\n const getEditorState = useStore((store) => store.getEditorState);\n const getProject = useStore((store) => store.getProject);\n\n const deleteAllHandler = useCallback(() => {\n clearGraph();\n }, [clearGraph]);\n\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n const historyBack = useStore((store) => store.history.back);\n const historyForward = useStore((store) => store.history.forward);\n const historyPointer = useStore((store) => store.history.pointer);\n const historyBuffer = useStore((store) => store.history.buffer);\n\n const copySelectedItems = useStore((store) => store.copySelectedItems);\n const nodes = useStore((store) => store.nodes);\n const selectedNodes = useMemo(\n () => nodes.filter(({ selected }) => selected),\n [nodes],\n );\n const currentCopyBuffer = useStore((store) => store.copyBuffer);\n\n const reactFlowInstance = useReactFlow();\n\n const downloadPatchHandler = useCallback(() => {\n const fileName = \"web-noise-patch.json\";\n const editorState = getEditorState();\n const data = {\n ...editorState,\n };\n downloadFile(JSON.stringify(data, null, 2), fileName);\n }, [getEditorState, reactFlowInstance]);\n\n const downloadProjectHandler = useCallback(() => {\n const fileName = \"web-noise-project.json\";\n const projectState = getProject();\n const data = {\n ...projectState,\n };\n downloadFile(JSON.stringify(data, null, 2), fileName);\n }, [getEditorState, reactFlowInstance]);\n\n useEffect(() => {\n hotkeys(\"command+shift+a\", () => {\n addNodeHandler(200, 50);\n return false;\n });\n //@TODO: find more elegant way to handle ?\n hotkeys(\"shift+/\", () => {\n toggleHelp();\n return false;\n });\n hotkeys(\"command+z\", () => {\n historyBack();\n return false;\n });\n hotkeys(\"command+shift+z\", () => {\n historyForward();\n return false;\n });\n hotkeys(\"command+c\", () => {\n copySelectedItems();\n return false;\n });\n hotkeys(\"command+v\", () => {\n pasteBufferHandler({ x: 200, y: 50 });\n return false;\n });\n return () => {\n hotkeys.unbind();\n };\n }, [addNodeHandler, pasteBufferHandler]);\n\n return (\n <>\n <AddNode\n isOpen={showAddNode}\n closeMenu={() => setShowAddNode(false)}\n mousePosition={mousePosition}\n />\n <UploadPatch\n isOpen={showUploadPatch}\n closeMenu={() => setShowUploadPatch(false)}\n />\n <UploadProject\n isOpen={showUploadProject}\n closeMenu={() => setShowUploadProject(false)}\n />\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper\n onClick={({ triggerEvent: { clientX, clientY } }) =>\n addNodeHandler(clientX, clientY)\n }\n >\n Add Node (⌘+⇧+A)\n </ItemWrapper>\n <Separator />\n <ItemWrapper onClick={deleteAllHandler}>Delete All</ItemWrapper>\n <Separator />\n <ItemWrapper onClick={downloadPatchHandler}>Download patch</ItemWrapper>\n <ItemWrapper onClick={() => setShowUploadPatch(true)}>\n Upload patch\n </ItemWrapper>\n <Separator />\n <ItemWrapper onClick={downloadProjectHandler}>\n Download project\n </ItemWrapper>\n <ItemWrapper onClick={() => setShowUploadProject(true)}>\n Upload project\n </ItemWrapper>\n <Separator />\n <ItemWrapper disabled={historyPointer === 0} onClick={historyBack}>\n Undo (⌘+z)\n </ItemWrapper>\n <ItemWrapper\n disabled={historyPointer === historyBuffer.length}\n onClick={historyForward}\n >\n Redo (⌘+⇧+Z)\n </ItemWrapper>\n <Separator />\n <ItemWrapper\n disabled={!selectedNodes.length}\n onClick={copySelectedItems}\n >\n Copy Selected (⌘+c)\n </ItemWrapper>\n <ItemWrapper\n disabled={!currentCopyBuffer.nodes.length}\n onClick={({ triggerEvent: { clientX: x, clientY: y } }) =>\n pasteBufferHandler({ x, y })\n }\n >\n Paste (⌘+v)\n </ItemWrapper>\n <Separator />\n {editorContextMenu.map((item, index) => (\n <ItemWrapper key={index}>{item}</ItemWrapper>\n ))}\n <Separator />\n <ItemWrapper onClick={toggleHelp}>Help (⇧+?)</ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default EditorContextMenu;\n","import styled from \"@emotion/styled\";\nimport { MouseEvent, useCallback, useState } from \"react\";\nimport { Position, useReactFlow } from \"reactflow\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginComponent } from \"../../types\";\nimport Modal from \"../Modal\";\nimport Filters, { FiltersState } from \"./Filters\";\nimport Plugins from \"./Plugins\";\n\ninterface AddNodeProps {\n isOpen: boolean;\n closeMenu: () => void;\n mousePosition: MousePosition;\n}\n\ntype MousePosition = {\n x: number;\n y: number;\n};\n\nconst AddNodeWrapper = styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n display: flex;\n gap: 1rem;\n`;\n\nconst PluginsPanel = styled.div<{ theme: Theme }>`\n flex-grow: 1;\n height: 100%;\n overflow-y: scroll;\n`;\n\nconst AddNode = ({ isOpen, closeMenu, mousePosition }: AddNodeProps) => {\n const theme = useTheme();\n const { screenToFlowPosition } = useReactFlow();\n\n const { createNode } = useStore(({ createNode }) => ({\n createNode,\n }));\n\n const [filtersState, setFiltersState] = useState<FiltersState>({});\n\n const onComponentClick = useCallback(\n ({ type }: PluginComponent) => {\n const { x, y } = screenToFlowPosition(mousePosition);\n const newNode = {\n //@TODO: generate node id in `createNode` function\n id: `${type}-${+new Date()}`,\n type,\n data: { label: type },\n position: {\n x,\n y,\n },\n targetPosition: Position.Left,\n sourcePosition: Position.Right,\n };\n createNode(newNode);\n closeMenu();\n },\n [mousePosition, screenToFlowPosition, createNode, closeMenu, mousePosition],\n );\n\n return isOpen ? (\n <Modal\n onClose={() => {\n closeMenu();\n setFiltersState({});\n }}\n >\n <AddNodeWrapper theme={theme}>\n <Filters onChange={setFiltersState} value={filtersState} />\n <PluginsPanel theme={theme}>\n <Plugins\n filters={filtersState}\n onComponentClick={(component) => {\n onComponentClick(component);\n setFiltersState({});\n }}\n />\n </PluginsPanel>\n </AddNodeWrapper>\n </Modal>\n ) : null;\n};\n\nexport default AddNode;\n","import styled from \"@emotion/styled\";\nimport { type ReactNode, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport useTheme from \"../hooks/useTheme\";\nimport { Theme } from \"../theme\";\n\nconst ModalOuter = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: ${({ theme }) => theme.zIndex.modal};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: ${({ theme }) => theme.colors.elevation3}cc;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst ModalInner = styled.div<{ theme: Theme }>`\n background: ${({ theme }) => theme.colors.elevation2};\n box-shadow: 1px 1px 1px 1px ${({ theme }) => theme.colors.elevation1};\n color: white;\n width: 70%;\n height: 80%;\n overflow-y: scroll;\n position: relative;\n`;\n\nconst ModalCloser = styled(CloseIcon)<{ theme: Theme }>`\n position: absolute;\n top: 0.2rem;\n right: 0.2rem;\n cursor: pointer;\n`;\n\ninterface ModalProps {\n onClose?: () => void;\n children: ReactNode;\n}\n\nconst Modal = ({ children, onClose, ...props }: ModalProps) => {\n const theme = useTheme();\n\n useEffect(() => {\n const escHandler = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n onClose?.();\n }\n };\n document.addEventListener(\"keydown\", escHandler);\n return () => {\n document.removeEventListener(\"keydown\", escHandler);\n };\n }, [onClose]);\n\n return createPortal(\n <ModalOuter theme={theme} onClick={onClose}>\n <ModalInner\n {...props}\n onClick={(e) => {\n e.stopPropagation();\n }}\n theme={theme}\n >\n {children}\n <ModalCloser theme={theme} onClick={onClose} />\n </ModalInner>\n </ModalOuter>,\n document.body,\n );\n};\n\nexport default Modal;\n","import styled from \"@emotion/styled\";\nimport { useEffect, useRef } from \"react\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\n\nconst InputWrapper = styled.div`\n display: flex;\n position: relative;\n`;\n\nconst InputInner = styled.input<{ theme: Theme }>`\n padding-right: 2rem;\n padding-left: 0.3rem;\n width: 100%;\n appearance: textfield;\n font-size: inherit;\n background: none;\n border: none;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n appearance: textfield;\n cursor: auto;\n background-color: ${({ theme }) => theme.colors.elevation3};\n border-radius: 0.1rem;\n height: 2rem;\n color: ${({ theme }) => theme.colors.highlight2};\n\n &:focus,\n &:hover {\n box-shadow: 0 0 0 var(--leva-borderWidths-focus)\n ${({ theme }) => theme.colors.accent2};\n color: ${({ theme }) => theme.colors.whitePrimary};\n }\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin-right: 1rem;\n }\n`;\n\nconst FiltersWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n padding: 0.6rem;\n gap: 0.6rem;\n border-right: 1px solid ${({ theme }) => theme.colors.elevation3};\n min-width: 14rem;\n`;\n\nconst PluginName = styled.label<{ theme: Theme }>`\n user-select: none;\n input {\n display: none;\n }\n input:checked + span {\n color: ${({ theme }) => theme.colors.accent2};\n }\n &:hover {\n color: ${({ theme }) => theme.colors.accent3};\n cursor: pointer;\n }\n`;\n\nexport interface FiltersState {\n search?: string;\n plugin?: string | null;\n}\n\ninterface FiltersProps {\n value: FiltersState;\n onChange: (filters: FiltersState) => void;\n}\n\nconst Filters = ({ onChange, value }: FiltersProps) => {\n const theme = useTheme();\n const plugins = useStore(({ plugins }) => plugins);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!inputRef.current) {\n return;\n }\n inputRef.current.focus();\n }, [inputRef]);\n\n return (\n <FiltersWrapper theme={theme}>\n <InputWrapper>\n <InputInner\n ref={inputRef}\n theme={theme}\n value={value.search || \"\"}\n placeholder=\"search...\"\n onChange={(event) =>\n onChange({ ...value, search: event.target.value })\n }\n />\n </InputWrapper>\n {plugins.map(({ name, components }, index) => {\n if (!name) {\n return null;\n }\n return (\n <PluginName theme={theme} key={index}>\n <input\n type=\"checkbox\"\n name=\"plugin\"\n value={name}\n checked={name === value.plugin}\n onChange={() => {\n onChange({\n ...value,\n plugin: name === value.plugin ? null : name,\n });\n }}\n />\n <span>{name}</span>\n </PluginName>\n );\n })}\n </FiltersWrapper>\n );\n};\n\nexport default Filters;\n","import styled from \"@emotion/styled\";\nimport { useMemo } from \"react\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { PluginComponent } from \"../../types\";\nimport { FiltersState } from \"./Filters\";\nimport { withTheme } from \"@emotion/react\";\n\nconst PluginsWrapper = withTheme(styled.div<{ theme: Theme }>`\n width: 100%;\n`);\n\nconst PluginWrapper = withTheme(styled.div<{ theme: Theme }>`\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n`);\n\nconst NodesList = withTheme(styled.ul<{ theme: Theme }>`\n list-style: none;\n margin: 0;\n padding: 0;\n padding-bottom: 10px;\n columns: 2;\n\n li {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 4px;\n overflow: hidden;\n border: 1px solid ${({ theme }) => theme.colors.elevation3};\n border-radius: 4px;\n margin-bottom: 0.5rem;\n &:hover {\n border-color: ${({ theme }) => theme.colors.accent2};\n cursor: pointer;\n }\n }\n`);\n\nconst NodeTitle = withTheme(styled.div<{ theme: Theme }>`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`);\n\nconst NodeDescription = withTheme(styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.highlight2};\n font-size: 12px;\n`);\n\nconst PluginHeader = withTheme(styled.div<{ theme: Theme }>``);\n\nconst PluginTitle = withTheme(styled.div<{ theme: Theme }>`\n font-size: 1.1rem;\n padding: 0.25rem 0;\n color: ${({ theme }) => theme.colors.highlight3};\n`);\n\nconst PluginDescription = withTheme(styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.highlight2};\n font-size: 12px;\n`);\n\ninterface PluginsProps {\n filters: FiltersState;\n onComponentClick: (component: PluginComponent) => void;\n}\n\nconst Plugins = ({\n onComponentClick,\n filters: { plugin, search },\n}: PluginsProps) => {\n const plugins = useStore(({ plugins }) => plugins);\n\n const pluginsGroup = useMemo(() => {\n if (!plugin) {\n return plugins;\n }\n return plugins.filter(({ name }) => name === plugin);\n // return plugins.filter(({ type }) => type === )\n }, [plugins, plugin]);\n\n const filteredPlugins = useMemo(() => {\n if (!search) {\n return pluginsGroup;\n }\n return pluginsGroup.map((plugin) => ({\n ...plugin,\n components: plugin.components.filter(\n ({ type, name }) =>\n type.toLocaleLowerCase().includes(search.toLocaleLowerCase()) ||\n name?.toLocaleLowerCase().includes(search.toLocaleLowerCase()),\n ),\n }));\n }, [pluginsGroup, search]);\n\n return (\n <PluginsWrapper>\n {filteredPlugins.map(({ name, description, components }, index) => {\n if (!components.length) {\n return null;\n }\n return (\n <PluginWrapper key={index}>\n <PluginHeader>\n <PluginTitle>{name}</PluginTitle>\n <PluginDescription>{description}</PluginDescription>\n </PluginHeader>\n <NodesList>\n {components\n .sort((a, b) =>\n a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1,\n )\n .map((component, idx) => (\n <li onClick={() => onComponentClick(component)} key={idx}>\n <NodeTitle>{component.name || component.type}</NodeTitle>\n {component.description && (\n <NodeDescription>{component.description}</NodeDescription>\n )}\n </li>\n ))}\n </NodesList>\n </PluginWrapper>\n );\n })}\n </PluginsWrapper>\n );\n};\n\nexport default Plugins;\n","import styled from \"@emotion/styled\";\nimport { MouseEvent, useCallback, useState, useRef, ChangeEvent } from \"react\";\nimport { FileDrop } from \"react-file-drop\";\nimport { FaFileUpload } from \"react-icons/fa\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\nimport { Theme } from \"../theme\";\nimport Modal from \"./Modal\";\n\ninterface UploadPatchProps {\n isOpen: boolean;\n closeMenu: () => void;\n}\n\nconst UploadPatchWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme }) => theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\n\nconst DropZoneInner = styled.div<{ theme: Theme }>`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\n\nconst FileUploadIcon = styled(FaFileUpload)`\n width: 100%;\n height: 8rem;\n`;\n\nconst FileUploadMessage = styled.div`\n font-size: 2rem;\n`;\n\nconst UploadPatch = ({ isOpen, closeMenu }: UploadPatchProps) => {\n const theme = useTheme();\n\n const setGraph = useStore(({ setGraph }) => setGraph);\n const setEditorState = useStore((store) => store.setEditorState);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const uploadFile = useCallback(\n (files: FileList | null) => {\n const [file] = files || [];\n file\n .text()\n .then(JSON.parse)\n .then((editorState) => {\n setEditorState(editorState);\n closeMenu();\n })\n .catch(console.error);\n },\n [setGraph, closeMenu],\n );\n\n const onTargetClick = () => {\n fileInputRef.current?.click();\n };\n\n return isOpen ? (\n <Modal onClose={closeMenu}>\n <UploadPatchWrapper theme={theme}>\n <input\n onChange={({ target: { files } }) => uploadFile(files)}\n ref={fileInputRef}\n type=\"file\"\n className=\"hidden\"\n style={{ display: \"none\" }}\n accept=\".json\"\n />\n <FileDrop\n className=\"drop-zone-wrapper\"\n targetClassName=\"drop-zone\"\n draggingOverTargetClassName=\"drop-zone-drag-over\"\n onTargetClick={onTargetClick}\n onDrop={(files) => uploadFile(files)}\n >\n <DropZoneInner theme={theme}>\n <FileUploadIcon />\n <FileUploadMessage>click or drop file here</FileUploadMessage>\n </DropZoneInner>\n </FileDrop>\n </UploadPatchWrapper>\n </Modal>\n ) : null;\n};\n\nexport default UploadPatch;\n","import styled from \"@emotion/styled\";\nimport { useCallback, useRef } from \"react\";\nimport { FileDrop } from \"react-file-drop\";\nimport { FaFileUpload } from \"react-icons/fa\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\nimport { Theme } from \"../theme\";\nimport Modal from \"./Modal\";\n\ninterface UploadProjectProps {\n isOpen: boolean;\n closeMenu: () => void;\n}\n\nconst UploadProjectWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n\n .drop-zone-wrapper {\n width: 80%;\n height: 80%;\n }\n\n .drop-zone {\n height: 100%;\n width: 100%;\n border-style: dashed;\n border-width: 2px;\n border-color: ${({ theme }) => theme.colors.highlight2};\n opacity: 0.5;\n cursor: pointer;\n }\n\n .drop-zone:hover,\n .drop-zone-drag-over {\n opacity: 1;\n }\n`;\n\nconst DropZoneInner = styled.div<{ theme: Theme }>`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n`;\n\nconst FileUploadIcon = styled(FaFileUpload)`\n width: 100%;\n height: 8rem;\n`;\n\nconst FileUploadMessage = styled.div`\n font-size: 2rem;\n`;\n\n// @TODO: unify with upload file\nconst UploadProject = ({ isOpen, closeMenu }: UploadProjectProps) => {\n const theme = useTheme();\n\n const setProject = useStore((store) => store.setProject);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n const uploadFile = useCallback(\n (files: FileList | null) => {\n const [file] = files || [];\n file\n .text()\n .then(JSON.parse)\n .then((projectState) => {\n setProject(projectState);\n closeMenu();\n })\n .catch(console.error);\n },\n [setProject, closeMenu],\n );\n\n const onTargetClick = () => {\n fileInputRef.current?.click();\n };\n\n return isOpen ? (\n <Modal onClose={closeMenu}>\n <UploadProjectWrapper theme={theme}>\n <input\n onChange={({ target: { files } }) => uploadFile(files)}\n ref={fileInputRef}\n type=\"file\"\n className=\"hidden\"\n style={{ display: \"none\" }}\n accept=\".json\"\n />\n <FileDrop\n className=\"drop-zone-wrapper\"\n targetClassName=\"drop-zone\"\n draggingOverTargetClassName=\"drop-zone-drag-over\"\n onTargetClick={onTargetClick}\n onDrop={(files) => uploadFile(files)}\n >\n <DropZoneInner theme={theme}>\n <FileUploadIcon />\n <FileUploadMessage>click or drop file here</FileUploadMessage>\n </DropZoneInner>\n </FileDrop>\n </UploadProjectWrapper>\n </Modal>\n ) : null;\n};\n\nexport default UploadProject;\n","import { useCallback } from \"react\";\nimport { useContextMenu, PredicateParams } from \"react-contexify\";\nimport \"react-contexify/dist/ReactContexify.css\";\nimport { WNNode } from \"../../types\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { ItemWrapper, MenuWrapper } from \"./styles\";\n\nexport const MENU_ID = \"editor-node-menu\";\n\nexport const useNodeContextMenu = () => {\n const { show } = useContextMenu({\n id: MENU_ID,\n });\n\n const onContextMenu = useCallback(\n (event: React.MouseEvent<Element, MouseEvent>, node: unknown) => {\n event.stopPropagation();\n show(event, { props: { node } });\n },\n [],\n );\n\n return { onContextMenu };\n};\n\nconst NodeContextMenu = (args: unknown) => {\n const theme = useTheme();\n\n const removeNodes = useStore((store) => store.removeNodes);\n const addNodeToControlPanel = useStore(\n (store) => store.addNodeToControlPanel,\n );\n const removeNodeFromControlPanel = useStore(\n (store) => store.removeNodeFromControlPanel,\n );\n const copy = useStore((store) => store.copy);\n const nodesConfiguration = useStore((store) => store.nodesConfiguration);\n const controlPanelNodes = useStore((store) => store.controlPanel.nodes);\n\n const isOnControlPanel = useCallback(\n ({ props }: PredicateParams<{ node: WNNode }>) => {\n if (!props?.node.type) {\n return false;\n }\n return !!controlPanelNodes.find(({ id }) => id === props.node.id);\n },\n [controlPanelNodes],\n );\n\n const hasControlPanelNode = useCallback(\n ({ props }: PredicateParams<{ node: WNNode }>) => {\n if (!props?.node.type) {\n return false;\n }\n const nodeConfiguration = nodesConfiguration[props.node.type];\n return !!nodeConfiguration?.controlPanelNode;\n },\n [nodesConfiguration],\n );\n\n return (\n <>\n <MenuWrapper id={MENU_ID} animation={false} colors={theme.colors}>\n <ItemWrapper onClick={(event) => removeNodes([event.props.node])}>\n Delete Node (DEL)\n </ItemWrapper>\n <ItemWrapper\n hidden={(...args) =>\n !hasControlPanelNode(...args) || isOnControlPanel(...args)\n }\n onClick={(event) => addNodeToControlPanel(event.props.node)}\n >\n Add To Control Panel\n </ItemWrapper>\n <ItemWrapper\n hidden={(...args) =>\n !hasControlPanelNode(...args) || !isOnControlPanel(...args)\n }\n onClick={(event) => removeNodeFromControlPanel(event.props.node)}\n >\n Remove From Control Panel\n </ItemWrapper>\n <ItemWrapper\n onClick={(event) => copy({ nodes: [event.props.node], edges: [] })}\n >\n Copy (⌘+c)\n </ItemWrapper>\n </MenuWrapper>\n </>\n );\n};\n\nexport default NodeContextMenu;\n","import styled from \"@emotion/styled\";\nimport { Resizable } from \"re-resizable\";\nimport { useMemo, useRef, useState } from \"react\";\nimport GridLayout from \"react-grid-layout\";\nimport \"react-grid-layout/css/styles.css\";\nimport {\n AiFillLock as LockIcon,\n AiFillUnlock as UnlockIcon,\n} from \"react-icons/ai\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport { RxDashboard as ControlPanelIcon } from \"react-icons/rx\";\nimport Drawer from \"react-modern-drawer\";\nimport \"react-modern-drawer/dist/index.css\";\nimport { CONTROL_PANEL_GRID_CONFIG } from \"../../constants\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport ControlPanelItem from \"./ControlPanelItem\";\nimport { IconsBar, IconWrapper, PanelTitle, TitleBarWrapper } from \"./styles\";\n\nconst ControlPanelIconWrapper = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: 5;\n box-shadow: 0px 1px 2px ${({ theme }) => theme.colors.elevation2};\n left: 1rem;\n top: 4rem;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${({ theme }) => theme.colors.elevation1};\n color: ${({ theme }) => theme.colors.highlight1};\n\n :hover {\n color: ${({ theme }) => theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n\nconst ControlPanelIconsBar = styled(IconsBar)`\n height: 80%;\n`;\n\nconst CloseIconWrapper = styled(IconWrapper)`\n font-size: 1rem;\n display: flex;\n align-items: center;\n`;\n\nconst ControlPanelHeader = styled(TitleBarWrapper)<{ theme: Theme }>`\n grid-template-columns: 1fr auto;\n border-bottom: 1px solid ${({ theme }) => theme.colors.elevation3};\n font-size: 0.7rem;\n`;\n\nconst ControlPanelTitle = styled(PanelTitle)`\n text-align: center;\n`;\n\nconst ControlPanelWrapper = styled.div`\n height: 100%;\n width: 100%;\n padding: 0.3rem 0.4rem;\n box-sizing: border-box;\n`;\n\nconst ControlPanelBody = styled.div<{ theme: Theme }>`\n height: auto;\n padding: 0;\n max-height: 95vh;\n overflow-y: scroll;\n border: 1px solid ${({ theme }) => theme.colors.elevation3};\n`;\n\nconst ControlPanelSettings = styled.div`\n padding: 1rem 0;\n font-family: var(--leva-fonts-mono);\n font-size: 0.8rem;\n`;\n\nconst LockGridWrapper = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n color: ${({ theme }) => theme.colors.highlight1};\n &:hover {\n color: ${({ theme }) => theme.colors.highlight2};\n }\n`;\n\nconst GridResizeHandle = styled.div<{ theme: Theme }>`\n position: absolute;\n height: 1rem;\n top: 0;\n bottom: 0;\n margin: auto;\n left: 0.5rem;\n border-right: 1px solid ${({ theme }) => theme.colors.whitePrimary};\n`;\n\nconst ControlPanelItemWrapper = styled.div<{ theme: Theme }>`\n box-sizing: border-box;\n overflow: hidden;\n .react-resizable-handle:after {\n border-color: ${({ theme }) => theme.colors.whitePrimary};\n border-width: 1px;\n }\n`;\n\nconst ControlPanel = () => {\n const theme = useTheme();\n const nodeRef = useRef(null);\n const nodes = useStore((store) => store.nodes);\n const {\n show,\n nodes: controlPanelNodes,\n size,\n } = useStore((store) => store.controlPanel);\n\n const { width = 200, height } = size;\n\n const filteredNodes = useMemo(() => {\n const nodeIds = controlPanelNodes.map(({ id }) => id);\n return nodes.filter(({ id }) => nodeIds.includes(id));\n }, [nodes, controlPanelNodes]);\n\n const showControlPanel = useStore((store) => store.showControlPanel);\n const hideControlPanel = useStore((store) => store.hideControlPanel);\n const setControlPanelNodes = useStore((store) => store.setControlPanelNodes);\n const setControlPanelSize = useStore((store) => store.setControlPanelSize);\n const removeNodeFromControlPanel = useStore(\n (store) => store.removeNodeFromControlPanel,\n );\n\n const [isGridLocked, setGridLocked] = useState(true);\n\n const layout = useMemo(() => {\n const fallbackY = controlPanelNodes.reduce(\n (acc, { height = CONTROL_PANEL_GRID_CONFIG.rowHeight, x, y = 0 }) => {\n const Y = y + height;\n return Y > acc ? Y : acc;\n },\n 0,\n );\n return controlPanelNodes.map(({ id: i, width, height, x, y }) => {\n return {\n i,\n w: width || CONTROL_PANEL_GRID_CONFIG.cols,\n h: height || 6,\n x: x ?? 0,\n y: y ?? fallbackY,\n };\n });\n }, [controlPanelNodes]);\n\n if (!filteredNodes.length) {\n return null;\n }\n\n return (\n <>\n <ControlPanelIconWrapper\n theme={theme}\n ref={nodeRef}\n onClick={showControlPanel}\n >\n <ControlPanelIcon />\n </ControlPanelIconWrapper>\n <Drawer\n open={show}\n onClose={hideControlPanel}\n direction=\"left\"\n className=\"\"\n size=\"auto\"\n enableOverlay={false}\n style={{\n background: theme.colors.elevation1,\n position: \"absolute\",\n }}\n >\n <ControlPanelHeader theme={theme}>\n <ControlPanelTitle>Control Panel</ControlPanelTitle>\n <ControlPanelIconsBar>\n <CloseIconWrapper onClick={hideControlPanel} theme={theme}>\n <CloseIcon />\n </CloseIconWrapper>\n </ControlPanelIconsBar>\n </ControlPanelHeader>\n\n <ControlPanelWrapper>\n <ControlPanelSettings>\n {isGridLocked ? (\n <LockGridWrapper\n theme={theme}\n onClick={() => setGridLocked(false)}\n >\n <LockIcon />\n Unlock grid\n </LockGridWrapper>\n ) : (\n <LockGridWrapper\n theme={theme}\n onClick={() => setGridLocked(true)}\n >\n <UnlockIcon />\n Lock grid\n </LockGridWrapper>\n )}\n </ControlPanelSettings>\n <Resizable\n enable={{\n top: false,\n right: !isGridLocked,\n bottom: false,\n left: false,\n topRight: false,\n bottomRight: false,\n bottomLeft: false,\n topLeft: false,\n }}\n handleComponent={{\n right: <GridResizeHandle theme={theme} />,\n }}\n minWidth={120}\n size={{ width, height: \"auto\" }}\n onResizeStop={(e, direction, ref, d) => {\n setControlPanelSize({\n width: width + d.width,\n height: height + d.height,\n });\n }}\n >\n <ControlPanelBody theme={theme}>\n {/* @ts-ignore */}\n <GridLayout\n layout={layout}\n className=\"layout\"\n cols={CONTROL_PANEL_GRID_CONFIG.cols}\n rowHeight={CONTROL_PANEL_GRID_CONFIG.rowHeight}\n width={width}\n margin={[0, 0]}\n isResizable={!isGridLocked}\n draggableHandle=\".grid-item-handle\"\n onLayoutChange={(nodes) => {\n requestAnimationFrame(() => {\n setControlPanelNodes(\n nodes.map(({ i, w, h, x, y }) => ({\n id: i,\n width: w,\n height: h,\n x,\n y,\n })),\n );\n });\n }}\n >\n {filteredNodes.map((node) => {\n return (\n <ControlPanelItemWrapper key={node.id} theme={theme}>\n <ControlPanelItem\n node={node}\n showControls={!isGridLocked}\n onDelete={removeNodeFromControlPanel}\n />\n </ControlPanelItemWrapper>\n );\n })}\n </GridLayout>\n </ControlPanelBody>\n </Resizable>\n </ControlPanelWrapper>\n </Drawer>\n </>\n );\n};\n\nexport default ControlPanel;\n","import { useMemo } from \"react\";\n\nimport styled from \"@emotion/styled\";\nimport \"react-grid-layout/css/styles.css\";\nimport { MdDragHandle as DragIcon } from \"react-icons/md\";\nimport { MdClose as CloseIcon } from \"react-icons/md\";\nimport useAudioNode from \"../../hooks/useAudioNode\";\nimport useNode from \"../../hooks/useNode\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { WNNode, ControlPanelNodeProps } from \"../../types\";\nimport { IconsBar, IconWrapper, PanelTitle, TitleBarWrapper } from \"./styles\";\n\nconst ControlPanelNodeWrapper = styled.div<{ theme: Theme }>`\n height: 100%;\n display: grid;\n grid-template-rows: auto 1fr;\n`;\n\nconst PanelNode = (props: ControlPanelNodeProps) => {\n const { node } = props;\n\n const getControlPanelNode = useStore((store) => store.getControlPanelNode);\n\n const ControlPanelNode = useMemo(() => getControlPanelNode(node), [node]);\n\n if (!ControlPanelNode) {\n return null;\n }\n\n return <ControlPanelNode {...props} />;\n};\n\ninterface ControlPanelItemProps {\n node: WNNode;\n showControls: boolean;\n onDelete: (node: WNNode) => void;\n}\n\nconst ControlPanelItem = (props: ControlPanelItemProps) => {\n const { node, showControls, onDelete } = props;\n const theme = useTheme();\n\n const { id } = node;\n const { node: audioNode } = useAudioNode(id) || {};\n const { updateNodeValues } = useNode(id);\n\n return (\n <ControlPanelNodeWrapper theme={theme}>\n <TitleBarWrapper theme={theme}>\n <PanelTitle>{node.data.label}</PanelTitle>\n {showControls && (\n <IconsBar>\n <IconWrapper theme={theme}>\n <DragIcon className=\"grid-item-handle\" />\n </IconWrapper>\n <IconWrapper theme={theme}>\n <CloseIcon onClick={() => onDelete(node)} />\n </IconWrapper>\n </IconsBar>\n )}\n </TitleBarWrapper>\n <PanelNode\n node={node}\n audioNode={audioNode}\n updateNodeValues={updateNodeValues}\n />\n </ControlPanelNodeWrapper>\n );\n};\n\nexport default ControlPanelItem;\n","import { AudioNodeState } from \"@web-noise/patch\";\nimport useStore from \"../store\";\nimport type { WNAudioNode } from \"../types\";\n\nconst useAudioNode = <T = WNAudioNode>(id: string) => {\n const patch = useStore(({ patch }) => patch);\n return patch.audioNodes.get(id) as AudioNodeState<T> | undefined;\n};\n\nexport default useAudioNode;\n","import { useCallback } from \"react\";\nimport useStore from \"../store\";\nimport { WNNodeData } from \"../types\";\n\nconst useNode = (id: string) => {\n const updateNodeData = useStore(({ updateNodeData }) => updateNodeData);\n\n const updateNodeValues = useCallback(\n (values: WNNodeData[\"values\"]) => updateNodeData(id, { values }),\n [id, updateNodeData]\n );\n const updateNodeConfig = useCallback(\n (config: WNNodeData[\"config\"]) => updateNodeData(id, { config }),\n [id, updateNodeData]\n );\n const updateNodeLabel = useCallback(\n (label: string) => updateNodeData(id, { label }),\n [id, updateNodeData]\n );\n\n return {\n updateNodeValues,\n updateNodeConfig,\n updateNodeLabel,\n };\n};\n\nexport default useNode;\n","import styled from \"@emotion/styled\";\nimport \"react-grid-layout/css/styles.css\";\nimport { Theme } from \"../../theme\";\nimport { TitleBar } from \"../Node\";\n\nexport const PanelTitle = styled.div`\n width: 100%;\n padding: 0.4rem 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nexport const TitleBarWrapper = styled(TitleBar)<{ theme: Theme }>`\n display: flex;\n gap: 0.1rem;\n padding: 0 0.4rem;\n justify-content: start;\n font-size: 0.6rem;\n height: auto;\n min-width: 0;\n`;\n\nexport const IconsBar = styled.div`\n display: flex;\n align-items: center;\n height: 70%;\n width: auto;\n gap: 0.4rem;\n`;\n\nexport const IconWrapper = styled.span<{ theme: Theme }>`\n width: auto;\n height: 100%;\n cursor: pointer;\n svg {\n width: auto;\n height: 100%;\n }\n &:hover {\n color: ${({ theme }) => theme.colors.highlight2};\n cursor: pointer;\n }\n`;\n","import styled from \"@emotion/styled\";\nimport { withTheme } from \"@emotion/react\";\nimport { Resizable } from \"re-resizable\";\nimport { ComponentProps, useMemo, useState } from \"react\";\nimport {\n MdSettings as SettingsIcon,\n MdInfoOutline as InfoIcon,\n} from \"react-icons/md\";\nimport { Handle, HandleProps, NodeProps, Position } from \"reactflow\";\nimport { DRAG_HANDLE_CLASS, PortType } from \"../../constants\";\nimport useAudioNode from \"../../hooks/useAudioNode\";\nimport useNode from \"../../hooks/useNode\";\nimport useTheme from \"../../hooks/useTheme\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport { AudioPort, WNNodeData } from \"../../types\";\nimport EditableLabel from \"../EditableLabel\";\nimport NodeInfoModal from \"../NodeInfoModal\";\n\nconst NodeWrapper = styled.div`\n background-color: var(--leva-colors-elevation1);\n`;\n\nconst NodeLoaderWrapper = styled(NodeWrapper)`\n padding: 2rem 5rem;\n`;\n\nconst NodeErrorWrapper = styled(NodeWrapper)`\n padding: 1rem 2rem;\n`;\n\nconst SettingsIconWrapper = styled(SettingsIcon)`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\n\nconst InfoIconWrapper = styled(InfoIcon)`\n font-size: 1.2rem;\n opacity: 0.4;\n width: 1rem;\n &:hover {\n opacity: 1;\n cursor: pointer;\n }\n`;\n\nconst Section = styled.div`\n position: relative;\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n background-color: var(--leva-colors-elevation1);\n`;\n\nexport const TitleBarInner = styled(Section)`\n display: flex;\n height: var(--leva-sizes-titleBarHeight);\n touch-action: none;\n align-items: center;\n justify-content: center;\n flex: 1 1 0%;\n color: var(--leva-colors-highlight1);\n padding: 0 0.4rem;\n gap: 0.3rem;\n`;\n\nexport const PortsPanel = styled(Section)<{ theme: Theme }>(\n ({ theme }) => `\n display: grid;\n grid-template-areas: \"inputs outputs\";\n background: ${theme.colors.elevation2};\n border-bottom: 1px solid ${theme.colors.elevation1};\n color: ${theme.colors.highlight3};\n font-size: 0.6rem;\n`,\n);\n\nexport const InputPorts = styled.div`\n grid-area: inputs;\n text-align: left;\n`;\n\nexport const OutputPorts = styled.div`\n grid-area: outputs;\n text-align: right;\n`;\n\nexport const Port = styled.div`\n position: relative;\n padding: 5px 10px;\n`;\n\nconst portColors = {\n [PortType.Audio]: \"#4ade80\", // vibrant green\n [PortType.Gate]: \"#c084fc\", // rich purple\n [PortType.Number]: \"#38bdf8\", // bright blue\n [PortType.Any]: \"#ffffff\", // white\n};\n\nconst StyledHandle = withTheme(styled(Handle, {\n shouldForwardProp: (prop) => prop !== \"portType\",\n})<{ portType?: AudioPort[\"type\"]; theme: Theme }>`\n --port-color: ${(props) => {\n if (!props.portType) return props.theme.colors.highlight2;\n if (Array.isArray(props.portType)) {\n const colors = props.portType.map((type) => portColors[type]);\n return `linear-gradient(0.25turn, ${colors.join(\", \")});`;\n } else {\n return portColors[props.portType];\n }\n }};\n border-color: var(--port-color);\n background: var(--port-color);\n box-shadow: 0px 0px 0px 1px ${({ theme }) => theme.colors.elevation2} inset;\n`);\n\nconst StyledInputHandle = withTheme(styled(StyledHandle)`\n left: -3px;\n`);\n\nexport const InputHandle = ({\n ...props\n}: Partial<HandleProps & ComponentProps<typeof StyledInputHandle>>) => (\n <StyledInputHandle {...props} type=\"target\" position={Position.Left} />\n);\n\nexport const StyledOutputHandle = withTheme(styled(StyledHandle)`\n right: -3px;\n`);\n\nexport const OutputHandle = (\n props: Partial<HandleProps & ComponentProps<typeof StyledOutputHandle>>,\n) => <StyledOutputHandle {...props} type=\"source\" position={Position.Right} />;\n\nexport type WNNodeProps<T = Record<string, unknown>> = NodeProps<\n T & WNNodeData\n>;\n\nexport interface TitleBarProps {\n className?: string;\n [key: string]: unknown;\n}\n\nexport const TitleBar = ({ className, ...props }: TitleBarProps) => (\n <TitleBarInner\n {...props}\n className={[className, DRAG_HANDLE_CLASS].join(\" \")}\n />\n);\n\nexport interface WNNodeParameters extends NodeProps {\n children?: any;\n}\n\nconst useNodeManifest = (type: string) => {\n const data = useStore((store) => store.nodesConfiguration[type]);\n\n return data;\n};\n\nconst useConfigNode = (type: string) => {\n const { configNode: ConfigNode } = useNodeManifest(type);\n\n return {\n ConfigNode,\n };\n};\n\nexport const WNNode = (props: WNNodeParameters) => {\n const { id, children, selected, ...rest } = props;\n const theme = useTheme();\n const getNode = useStore(({ getNode }) => getNode);\n const nodesConfiguration = useStore((store) => store.nodesConfiguration);\n\n const [isInfoModalShown, setIsInfoModalShown] = useState(false);\n\n const { info } = useNodeManifest(props.type);\n\n const isResizeable = useMemo(\n () => nodesConfiguration[props.type].resizable ?? false,\n [nodesConfiguration, props.type],\n );\n\n const { updateNodeLabel, updateNodeConfig } = useNode(id);\n const { data } = getNode(id) || {};\n const audioNode = useAudioNode(id);\n const { ConfigNode } = useConfigNode(rest.type);\n\n const [configMode, setShowConfigMode] = useState(false);\n\n if (!audioNode) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n can't find audio node\n </NodeLoaderWrapper>\n );\n }\n\n if (audioNode.loading) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n loading\n </NodeLoaderWrapper>\n );\n }\n\n if (audioNode.error) {\n return (\n <NodeErrorWrapper className={DRAG_HANDLE_CLASS}>\n error: {audioNode.error.toString()}\n </NodeErrorWrapper>\n );\n }\n\n if (!audioNode.node) {\n return (\n <NodeLoaderWrapper className={DRAG_HANDLE_CLASS}>\n can't find audio node\n </NodeLoaderWrapper>\n );\n }\n\n const size = data?.config?.size as\n | { width: number; height: number }\n | undefined;\n\n const {\n node: { inputs, outputs },\n } = audioNode;\n\n return (\n <NodeWrapper>\n <TitleBar>\n {info && (\n <InfoIconWrapper onClickCapture={() => setIsInfoModalShown(true)} />\n )}\n <EditableLabel\n value={data?.label ?? \"No Name\"}\n onChange={updateNodeLabel}\n />\n {ConfigNode && (\n <SettingsIconWrapper\n onClickCapture={() => setShowConfigMode((isShown) => !isShown)}\n />\n )}\n </TitleBar>\n <PortsPanel theme={theme}>\n <InputPorts>\n {inputs\n ? Object.keys(inputs).map((key, index) => (\n <Port key={index}>\n <InputHandle id={key} portType={inputs[key].type} />\n <span>{key}</span>\n </Port>\n ))\n : null}\n </InputPorts>\n <OutputPorts>\n {outputs\n ? Object.keys(outputs).map((key, index) => (\n <Port key={index}>\n <OutputHandle id={key} portType={outputs[key].type} />\n <span>{key}</span>\n </Port>\n ))\n : null}\n </OutputPorts>\n </PortsPanel>\n {ConfigNode && configMode && selected ? (\n <ConfigNode {...props} />\n ) : isResizeable ? (\n <Resizable\n size={size}\n minWidth={180}\n minHeight={30}\n enable={{\n bottom: true,\n bottomRight: true,\n right: true,\n }}\n onResizeStop={(e, direction, ref, d) => {\n const newSize = size\n ? {\n width: size.width + d.width,\n height: size.height + d.height,\n }\n : ref.getBoundingClientRect();\n updateNodeConfig({\n ...data?.config,\n size: newSize,\n });\n }}\n >\n {children}\n </Resizable>\n ) : (\n children\n )}\n <NodeInfoModal\n isOpen={isInfoModalShown}\n type={props.type}\n onClose={() => setIsInfoModalShown(false)}\n node={audioNode.node}\n />\n </NodeWrapper>\n );\n};\n","import styled from \"@emotion/styled\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport const TitleBarLabel = styled.input`\n width: 100%;\n background: none;\n border: none;\n text-align: center;\n color: var(--leva-colors-highlight1);\n font-family: var(--leva-fonts-mono);\n font-size: var(--leva-fontSizes-root);\n cursor: inherit;\n text-overflow: ellipsis;\n outline: none;\n\n &:focus {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-within {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:focus-vissible {\n box-shadow: 0 0 0 green var(--leva-colors-accent2);\n }\n &:not([readonly]):focus {\n color: #fff;\n appearance: none;\n cursor: auto;\n background-color: var(--leva-colors-elevation2);\n padding: 0.3rem;\n border-radius: 0.2rem;\n }\n`;\n\ninterface EditableLabelProps {\n onChange: (value: string) => void;\n value?: string;\n className?: string;\n}\n\nconst EditableLabel = ({\n onChange,\n value = \"\",\n className,\n}: EditableLabelProps) => {\n const labelInputRef = useRef<HTMLInputElement>(null);\n\n const [labelEditMode, setLabelEditMode] = useState(false);\n const editNodeLabel = useCallback(\n (event: React.MouseEvent) => {\n //@ts-ignore\n event.target?.select();\n setLabelEditMode(true);\n },\n [setLabelEditMode],\n );\n\n const exitEditMode = useCallback(() => {\n window.getSelection()?.collapseToEnd();\n setLabelEditMode(false);\n }, [setLabelEditMode]);\n\n const saveNodeLabel = useCallback(() => {\n exitEditMode();\n if (labelInputRef.current) {\n onChange(labelInputRef.current.value);\n }\n }, [labelInputRef, exitEditMode, onChange]);\n\n const cancelNodeLabelEdit = useCallback(() => {\n exitEditMode();\n if (labelInputRef.current && value) {\n labelInputRef.current.value = value;\n }\n }, [labelInputRef, exitEditMode, value]);\n\n useEffect(() => {\n if (!labelInputRef.current) {\n return;\n }\n labelInputRef.current.value = value;\n }, [value, labelInputRef]);\n\n return (\n <TitleBarLabel\n ref={labelInputRef}\n type=\"text\"\n readOnly={!labelEditMode}\n onDoubleClick={(event) => editNodeLabel(event)}\n onBlur={saveNodeLabel}\n onKeyDown={(event) => {\n switch (event.key) {\n case \"Escape\":\n cancelNodeLabelEdit();\n break;\n case \"Enter\":\n saveNodeLabel();\n break;\n }\n }}\n className={className}\n />\n );\n};\n\nexport default EditableLabel;\n","import styled from \"@emotion/styled\";\nimport Modal from \"./Modal\";\nimport { marked } from \"marked\";\nimport useStore from \"../store\";\nimport { withTheme } from \"@emotion/react\";\nimport { useMemo } from \"react\";\nimport { WNAudioNode } from \"../types\";\nimport { Theme } from \"../theme\";\n\ninterface NodeInfoModalProps {\n isOpen: boolean;\n onClose: () => void;\n type: string;\n node: WNAudioNode;\n}\n\nconst NodeInfoWrapper = withTheme(styled.div<{ theme: Theme }>`\n height: 100%;\n width: 100%;\n overflow: scroll;\n padding: 0.6rem;\n box-sizing: border-box;\n\n hr {\n border: none;\n border-bottom: 1px solid ${({ theme }) => theme.colors.elevation3};\n }\n\n code {\n background-color: ${({ theme }) => theme.colors.elevation3};\n color: ${({ theme }) => theme.colors.highlight3};\n font-family:\n source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n }\n\n pre {\n background-color: ${({ theme }) => theme.colors.elevation3};\n padding: 0.2rem 0.3rem;\n border-radius: 1px;\n }\n\n a {\n color: ${({ theme }) => theme.colors.accent1};\n }\n`);\n\nconst useNodeManifest = (type: string) => {\n const data = useStore((store) => store.nodesConfiguration[type]);\n return data;\n};\n\nconst NodeInfoModal = ({\n isOpen,\n onClose,\n type: nodeType,\n node,\n}: NodeInfoModalProps) => {\n const { info, portsDescription } = useNodeManifest(nodeType);\n\n const portsInfo = useMemo(() => {\n const parts: string[] = [];\n\n const inputPorts = node.inputs;\n if (inputPorts) {\n parts.push(`## Inputs`);\n for (const portName in inputPorts) {\n const port = inputPorts[portName];\n parts.push(`### *${portName}*`);\n\n const description = portsDescription?.inputs?.[portName];\n\n if (description) {\n parts.push(description);\n }\n\n if (Array.isArray(port.type)) {\n parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n } else {\n parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n }\n\n if (port.range) {\n parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n }\n\n if (port.defaultValue !== undefined) {\n parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n }\n\n const outputPorts = node.outputs;\n if (outputPorts) {\n parts.push(`## Outputs`);\n for (const portName in outputPorts) {\n const port = outputPorts[portName];\n parts.push(`### *${portName}*`);\n\n const description = portsDescription?.outputs?.[portName];\n\n if (description) {\n parts.push(description);\n }\n\n if (Array.isArray(port.type)) {\n parts.push(`**Types**: \\`${port.type.join(\", \")}\\``);\n } else {\n parts.push(`**Type**: \\`${port.type || \"unknown\"}\\``);\n }\n\n if (port.range) {\n parts.push(`**Range**: \\`[${port.range[0]}, ${port.range[1]}]\\``);\n }\n\n if (port.defaultValue !== undefined) {\n parts.push(`**Default**: \\`${port.defaultValue}\\``);\n }\n }\n }\n return parts.join(\"\\n\\n\");\n }, [node, portsDescription]);\n\n const combinedInfo = (info || \"\") + \"\\n\\n\" + portsInfo;\n\n return isOpen ? (\n <Modal onClose={onClose}>\n <NodeInfoWrapper\n dangerouslySetInnerHTML={{ __html: marked(combinedInfo || \"\") }}\n />\n </Modal>\n ) : null;\n};\n\nexport default NodeInfoModal;\n","import { FaQuestion } from \"react-icons/fa\";\nimport { ControlButton } from \"reactflow\";\nimport useStore from \"../../store\";\nimport HelpModal from './HelpModal';\n\n\nconst HelpButton = () => {\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n return (\n <>\n <ControlButton onClick={toggleHelp}>\n <FaQuestion />\n </ControlButton>\n </>\n );\n};\n\nexport { HelpModal, HelpButton };\n\n","import { withTheme } from \"@emotion/react\";\nimport styled from \"@emotion/styled\";\n// @ts-ignore\nimport { marked } from \"marked\";\nimport useStore from \"../../store\";\nimport { Theme } from \"../../theme\";\nimport Modal from \"../Modal\";\n\n//@ts-ignore\nimport HELP from \"bundle-text:./HELP.md\";\n\nconst MdPreview = withTheme(styled.div<{ theme: Theme }>`\n font-family: var(--leva-fonts-mono);\n font-size: 0.7rem;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n overflow: scroll;\n color: ${({ theme }) => theme.colors.whitePrimary};\n padding: 0 0.5rem;\n\n code {\n color: ${({ theme }) => theme.colors.accent3};\n filter: hue-rotate(180deg);\n }\n`);\n\nconst ModalContent = withTheme(styled.div<{ theme: Theme }>`\n padding: 1rem;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n overflow: hidden;\n`);\n\nconst HelpModal = () => {\n const isHelpShown = useStore((store) => store.isHelpShown);\n const toggleHelp = useStore((store) => store.toggleHelp);\n\n if (!isHelpShown) {\n return null;\n }\n\n return (\n <Modal\n onClose={() => {\n toggleHelp();\n }}\n >\n <ModalContent>\n <MdPreview\n dangerouslySetInnerHTML={{ __html: marked(HELP) }}\n onWheelCapture={(event) => event.stopPropagation()}\n ></MdPreview>\n </ModalContent>\n </Modal>\n );\n};\n\nexport default HelpModal;\n","module.exports = \"ecc57e431820aa34\";","import styled from \"@emotion/styled\";\nimport { useState } from \"react\";\nimport { FaVolumeOff as IconUnmute } from \"react-icons/fa\";\nimport useStore from \"../store\";\nimport useTheme from \"../hooks/useTheme\";\nimport { Theme } from \"../theme\";\n\n\nconst Layout = styled.div<{ theme: Theme }>`\n position: fixed;\n z-index: ${({ theme }) => theme.zIndex.resumeContextLayout};\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background: rgb(24 28 32 / 90%);\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n color: ${({ theme }) => theme.colors.whitePrimary};\n cursor: pointer;\n`;\n\nconst Row = styled.div`\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n`;\n\nconst Message = styled.div<{ theme: Theme }>`\n font-family: var(--leva-fonts-mono);\n font-size: 2rem;\n`;\n\nconst Icon = styled(IconUnmute)`\n width: 7rem;\n height: 7rem;\n`;\n\nconst ResumeContext = () => {\n const theme = useTheme();\n const patch = useStore(({ patch }) => patch);\n const audioContext = patch.audioContext;\n const [isContextResumed, setIsContextResumed] = useState<boolean>(\n audioContext.state === \"running\",\n );\n\n if (isContextResumed) {\n return null;\n }\n\n return (\n <Layout\n theme={theme}\n onClick={() => {\n audioContext.resume();\n setIsContextResumed(true);\n }}\n >\n <Row>\n <Message theme={theme}>Click anywhere to resume audio context</Message>\n </Row>\n <Row>\n <Icon />\n </Row>\n </Layout>\n );\n};\n\nexport default ResumeContext;\n","import { FaMap, FaRegMap } from \"react-icons/fa\";\nimport { ControlButton } from \"reactflow\";\nimport useStore from \"../store\";\n\nconst ToggleMinimap = () => {\n const setConfig = useStore(({ setConfig }) => setConfig);\n const { showMinimap } = useStore(({ config }) => config);\n\n return (\n <ControlButton onClick={() => setConfig({ showMinimap: !showMinimap })}>\n {showMinimap ? <FaMap /> : <FaRegMap />}\n </ControlButton>\n );\n};\n\nexport default ToggleMinimap;\n","import { useEffect, useMemo } from \"react\";\nimport { EdgeProps, getBezierPath, getConnectedEdges } from \"reactflow\";\nimport useTheme from \"../hooks/useTheme\";\nimport useStore from \"../store\";\n\nconst Wire = ({\n id,\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourcePosition,\n targetPosition,\n style = {},\n data,\n markerStart,\n markerEnd,\n source,\n target,\n sourceHandleId,\n targetHandleId,\n selected,\n}: EdgeProps) => {\n const theme = useTheme();\n const getNode = useStore(({ getNode }) => getNode);\n const sourceNode = getNode(source);\n const targetNode = getNode(target);\n const isConnectedToSelected = sourceNode?.selected || targetNode?.selected;\n useEffect(() => {\n if (!sourceHandleId || !targetHandleId) {\n return;\n }\n console.log(`connected ${source} to ${target}`);\n return () => {\n console.log(`disconnected ${source} from ${target}`);\n };\n }, [source, sourceHandleId, target, targetHandleId]);\n\n const [edgePath] = getBezierPath({\n targetX,\n targetY,\n targetPosition,\n sourceX,\n sourceY,\n sourcePosition,\n });\n\n return (\n <>\n <path\n id={id}\n style={{\n ...style,\n stroke: selected\n ? theme.colors.accent2\n : isConnectedToSelected\n ? theme.colors.highlight3\n : theme.colors.highlight2,\n }}\n className=\"react-flow__edge-path Wire\"\n d={edgePath}\n markerEnd={markerEnd}\n />\n <path\n style={{\n ...style,\n strokeWidth: 8,\n color: \"transparent\",\n opacity: 0,\n cursor: \"pointer\",\n }}\n d={edgePath}\n markerEnd={markerEnd}\n />\n </>\n );\n};\n\nexport default Wire;\n"],"names":["config","jsx","$djR0r$jsx","jsxs","$djR0r$jsxs","Fragment","$djR0r$Fragment","withTheme","$djR0r$withTheme","ThemeProvider","$djR0r$ThemeProvider","Global","$djR0r$Global","css","$djR0r$css","useTheme","$djR0r$useTheme","$djR0r$emotionstyled","nanoid","$djR0r$nanoid","useState","$djR0r$useState","useEffect","$djR0r$useEffect","useMemo","$djR0r$useMemo","useCallback","$djR0r$useCallback","useRef","$djR0r$useRef","FaPlus","$djR0r$FaPlus","MdClose","$djR0r$MdClose","MdDragHandle","$djR0r$MdDragHandle","MdSettings","$djR0r$MdSettings","MdInfoOutline","$djR0r$MdInfoOutline","$djR0r$reactflow","getConnectedEdges","$djR0r$getConnectedEdges","addEdge","$djR0r$addEdge","applyNodeChanges","$djR0r$applyNodeChanges","applyEdgeChanges","$djR0r$applyEdgeChanges","useOnViewportChange","$djR0r$useOnViewportChange","Background","$djR0r$Background","BackgroundVariant","$djR0r$BackgroundVariant","MiniMap","$djR0r$MiniMap","Controls","$djR0r$Controls","ReactFlowProvider","$djR0r$ReactFlowProvider","useReactFlow","$djR0r$useReactFlow","Position","$djR0r$Position","Handle","$djR0r$Handle","ControlButton","$djR0r$ControlButton","getBezierPath","$djR0r$getBezierPath","create","$djR0r$create","reverse","$djR0r$reverse","patch","$djR0r$patch","$djR0r$create1","injectGlobal","$djR0r$injectGlobal","useContextMenu","$djR0r$useContextMenu","Item","$djR0r$Item","Menu","$djR0r$Menu","Separator","$djR0r$Separator","$djR0r$jsfiledownload","$djR0r$hotkeysjs","createPortal","$djR0r$createPortal","FileDrop","$djR0r$FileDrop","FaFileUpload","$djR0r$FaFileUpload","FaQuestion","$djR0r$FaQuestion","FaVolumeOff","$djR0r$FaVolumeOff","FaMap","$djR0r$FaMap","FaRegMap","$djR0r$FaRegMap","Resizable","$djR0r$Resizable","$djR0r$reactgridlayout","AiFillLock","$djR0r$AiFillLock","AiFillUnlock","$djR0r$AiFillUnlock","RxDashboard","$djR0r$RxDashboard","$djR0r$reactmoderndrawer","marked","$djR0r$marked","$parcel$interopDefault","a","__esModule","default","$4165c1239dbc641a$var$customFetchers","$059c7a7b96627b87$export$64e2564cc3ca44e9","$4bc43559bc9437b5$var$dumpNodeWorklet","URL","$9738c58e5420c085$export$956b3cf15d7c363","$9738c58e5420c085$export$21d634b1d5d9bee3","PortType","$9738c58e5420c085$export$b0b7b95ee465c83c","$15640845882b881f$var$cloneObject","input","JSON","parse","stringify","$1efbebe6ffe1c168$export$e364ea0c1dfb25e5","left","right","setLeft","Set","map","item","id","setRight","added","filter","has","removed","$9117b026061a386b$export$e698b79c63b74136","file","type","$9117b026061a386b$export$31c2336f657dc59f","$6f5e1924a22d258c$export$2e2bcd8739ae039","args","set","get","nodes","edges","onNodesChange","changes","node","dragHandle","onEdgesChange","onConnect","connection","addNode","concat","setNodes","setEdges","setNodesAndEdges","getNodesAndEdges","clearElements","getNode","find","updateNodeData","data","nodeTypes","setNodeTypes","history","maxHistoryLength","buffer","pointer","skipCollect","push","newBuffer","slice","Math","max","min","back","controlPanel","patchData","reversedPatchData","forward","clear","audioContext","AudioContext","dumpNodePromise","audioWorklet","addModule","then","AudioWorkletNode","audioNodes","Map","audioConnections","registerAudioNode","loading","error","Error","nodeCreator","audioNode","createNode","dumpNode","Object","values","outputs","forEach","port","connect","Array","isArray","registerAudioNodes","Promise","all","unregisterAudioNode","props","console","toString","destroy","inputs","AudioNode","disconnect","delete","registerAudioConnection","edge","source","sourceHandle","target","targetHandle","sourceNode","outputNode","outputNodePort","targetNode","inputNode","inputNodePort","isInputNode","isInputParam","AudioParam","isInputArray","isInputSimple","isOutputNode","isOutputArray","log","output","unregisterAudioConnection","audioConnection","unregisterAudioNodes","registerAudioConnections","unregisterAudioConnections","nodesState","project","files","setProject","currentFileIndex","getProject","pullEditorChanges","getEditorState","updateFileContent","currentFile","syncEditorWithCurrentFile","setEditorState","setCurrentFileIndex","newFileIndex","index","f","i","updateFileName","fileName","name","addFile","deleteFile","fileIndex","_","setGraph","createNodes","createEdges","activeNodes","activeEdges","clearGraph","nodeData","nodesConfiguration","defaultConfig","removeNode","removeNodes","currentNodes","onNodesDelete","removeEdges","removeNodesFromControlPanel","parentNodeIds","resultingNodes","parentNode","includes","nodeIds","currentEdges","onEdgesDelete","edgeIds","newEdges","plugins","setPlugins","nodesConf","reduce","acc","plugin","components","subAcc","keys","assign","showMinimap","setConfig","viewport","r","setTimeout","isHelpShown","toggleHelp","showHelp","copyBuffer","copy","elements","copySelectedItems","selected","length","pasteBuffer","x","y","nodesToCopy","edgesToCopy","topLeftNode","position","xDelta","yDelta","newNodes","mapping","newNodeId","random","Date","floor","replace","getControlPanelNode","controlPanelNode","show","size","width","height","showControlPanel","hideControlPanel","addNodeToControlPanel","newNode","removeNodeFromControlPanel","setControlPanelNodes","setControlPanelSize","zoom","setViewport","api","collectChanges","$15640845882b881f$export$4e64751394766316","timer","jsondiffpatchInstance","propertyFilter","context","parent","childName","oldState","state","prevState","clearTimeout","diff","subscribe","promises","currentState","storeChanges","newState","nodeChanges","edgeChanges","removedEdges","removedNodes","promise","add","e","$de1eff52c6419df8$export$2e2bcd8739ae039","colors","elevation1","elevation2","elevation3","accent1","accent2","accent3","highlight1","highlight2","highlight3","vivid1","whitePrimary","zIndex","modal","resumeContextLayout","$40266ad71a95dba8$export$2e2bcd8739ae039","$ee2caa06ac02c5bc$export$ef9839ae55b8ba40","$ee2caa06ac02c5bc$export$98eff9c5659394e3","$b2eaa5961e75d009$export$d4cd258d01c03112","$b2eaa5961e75d009$export$2e2bcd8739ae039","theme","store","children","animation","onClick","event","$96e3c18b52e89add$var$ModalOuter","div","$96e3c18b52e89add$var$ModalInner","$96e3c18b52e89add$var$ModalCloser","$96e3c18b52e89add$export$2e2bcd8739ae039","onClose","escHandler","key","document","addEventListener","removeEventListener","stopPropagation","body","$7eaa077f1f9bb73b$var$InputWrapper","$7eaa077f1f9bb73b$var$InputInner","$7eaa077f1f9bb73b$var$FiltersWrapper","$7eaa077f1f9bb73b$var$PluginName","label","$7eaa077f1f9bb73b$export$2e2bcd8739ae039","onChange","value","inputRef","current","focus","ref","search","placeholder","checked","$682a69da6ef2887d$var$PluginsWrapper","$682a69da6ef2887d$var$PluginWrapper","$682a69da6ef2887d$var$NodesList","ul","$682a69da6ef2887d$var$NodeTitle","$682a69da6ef2887d$var$NodeDescription","$682a69da6ef2887d$var$PluginHeader","$682a69da6ef2887d$var$PluginTitle","$682a69da6ef2887d$var$PluginDescription","$682a69da6ef2887d$export$2e2bcd8739ae039","onComponentClick","filters","pluginsGroup","filteredPlugins","toLocaleLowerCase","description","sort","b","toLowerCase","component","idx","$881ab8dac829e111$var$AddNodeWrapper","$881ab8dac829e111$var$PluginsPanel","$881ab8dac829e111$export$2e2bcd8739ae039","isOpen","closeMenu","mousePosition","screenToFlowPosition","filtersState","setFiltersState","targetPosition","Left","sourcePosition","Right","$7f7ac6f44564377e$var$UploadPatchWrapper","$7f7ac6f44564377e$var$DropZoneInner","$7f7ac6f44564377e$var$FileUploadIcon","$7f7ac6f44564377e$var$FileUploadMessage","$7f7ac6f44564377e$export$2e2bcd8739ae039","fileInputRef","uploadFile","text","editorState","catch","className","style","display","accept","targetClassName","draggingOverTargetClassName","onTargetClick","click","onDrop","$5da3065ea9b7ce79$var$UploadProjectWrapper","$5da3065ea9b7ce79$var$DropZoneInner","$5da3065ea9b7ce79$var$FileUploadIcon","$5da3065ea9b7ce79$var$FileUploadMessage","$5da3065ea9b7ce79$export$2e2bcd8739ae039","projectState","$28ba16bd16f671c0$export$d4cd258d01c03112","$28ba16bd16f671c0$export$2e2bcd8739ae039","editorContextMenu","setMousePosition","showAddNode","setShowAddNode","showUploadPatch","setShowUploadPatch","showUploadProject","setShowUploadProject","addNodeHandler","pasteBufferHandler","deleteAllHandler","historyBack","historyForward","historyPointer","historyBuffer","selectedNodes","currentCopyBuffer","reactFlowInstance","downloadPatchHandler","downloadProjectHandler","unbind","triggerEvent","clientX","clientY","disabled","$0ffe51df9638a254$export$d4cd258d01c03112","$0ffe51df9638a254$export$2e2bcd8739ae039","controlPanelNodes","isOnControlPanel","hasControlPanelNode","nodeConfiguration","hidden","$607523634e2ef7fa$export$2e2bcd8739ae039","$c2be4ce66a537e42$export$2e2bcd8739ae039","updateNodeValues","updateNodeConfig","updateNodeLabel","$61078804f94ec8d6$export$5abe11f802ebd1f2","$61078804f94ec8d6$export$2e2bcd8739ae039","labelInputRef","labelEditMode","setLabelEditMode","editNodeLabel","select","exitEditMode","window","getSelection","collapseToEnd","saveNodeLabel","cancelNodeLabelEdit","readOnly","onDoubleClick","onBlur","onKeyDown","$de6d95f0aff74a75$var$NodeInfoWrapper","$de6d95f0aff74a75$export$2e2bcd8739ae039","nodeType","info","portsDescription","portsInfo","parts","inputPorts","portName","join","range","undefined","defaultValue","outputPorts","dangerouslySetInnerHTML","__html","combinedInfo","$8d34719b9811e505$var$NodeWrapper","$8d34719b9811e505$var$NodeLoaderWrapper","$8d34719b9811e505$var$NodeErrorWrapper","$8d34719b9811e505$var$SettingsIconWrapper","$8d34719b9811e505$var$InfoIconWrapper","$8d34719b9811e505$var$Section","$8d34719b9811e505$export$1bdb8f2d1fe25c22","$8d34719b9811e505$export$bfd3bd1fa283e3c6","$8d34719b9811e505$export$f1afba0ff9ea1277","$8d34719b9811e505$export$af4f9b41fc32ed9e","$8d34719b9811e505$export$a2d375858cc72119","$8d34719b9811e505$var$portColors","Audio","Gate","Number","Any","$8d34719b9811e505$var$StyledHandle","shouldForwardProp","prop","portType","$8d34719b9811e505$var$StyledInputHandle","$8d34719b9811e505$export$9ea0feffc20ee81","$8d34719b9811e505$export$222539e2a2fac4e0","$8d34719b9811e505$export$496e5e1ee1696f64","$8d34719b9811e505$export$7e0b3af1e60a3273","$8d34719b9811e505$var$useNodeManifest","$8d34719b9811e505$export$361064385d50ec44","rest","isInfoModalShown","setIsInfoModalShown","isResizeable","resizable","ConfigNode","$8d34719b9811e505$var$useConfigNode","configNode","configMode","setShowConfigMode","onClickCapture","isShown","minWidth","minHeight","enable","bottom","bottomRight","onResizeStop","direction","d","newSize","getBoundingClientRect","$10a9c816b85d070f$export$86de09faaa70680d","$10a9c816b85d070f$export$548ca3bae446ddc2","$10a9c816b85d070f$export$9fb15e3cc717240","$10a9c816b85d070f$export$be58b4326e23250f","span","$78800a41ab03e65a$var$ControlPanelNodeWrapper","$78800a41ab03e65a$var$PanelNode","ControlPanelNode","$78800a41ab03e65a$export$2e2bcd8739ae039","showControls","onDelete","$aa370ed1795ceb6e$var$ControlPanelIconWrapper","$aa370ed1795ceb6e$var$ControlPanelIconsBar","$aa370ed1795ceb6e$var$CloseIconWrapper","$aa370ed1795ceb6e$var$ControlPanelHeader","$aa370ed1795ceb6e$var$ControlPanelTitle","$aa370ed1795ceb6e$var$ControlPanelWrapper","$aa370ed1795ceb6e$var$ControlPanelBody","$aa370ed1795ceb6e$var$ControlPanelSettings","$aa370ed1795ceb6e$var$LockGridWrapper","$aa370ed1795ceb6e$var$GridResizeHandle","$aa370ed1795ceb6e$var$ControlPanelItemWrapper","$aa370ed1795ceb6e$export$2e2bcd8739ae039","nodeRef","filteredNodes","isGridLocked","setGridLocked","layout","fallbackY","Y","w","h","open","enableOverlay","background","top","topRight","bottomLeft","topLeft","handleComponent","cols","rowHeight","margin","isResizable","draggableHandle","onLayoutChange","requestAnimationFrame","$e94dbfe8457a1793$exports","$0d9fa38071943b2c$var$MdPreview","$0d9fa38071943b2c$var$ModalContent","$0d9fa38071943b2c$export$2e2bcd8739ae039","onWheelCapture","$978ea880a50613b0$export$78bddedbcf2939ac","$8555f8953ca3d620$var$Layout","$8555f8953ca3d620$var$Row","$8555f8953ca3d620$var$Message","$8555f8953ca3d620$var$Icon","$8555f8953ca3d620$export$2e2bcd8739ae039","isContextResumed","setIsContextResumed","resume","$a86b09d17e46bbc8$export$2e2bcd8739ae039","$ea8f5cfca6de366a$export$2e2bcd8739ae039","sourceX","sourceY","targetX","targetY","markerStart","markerEnd","sourceHandleId","targetHandleId","isConnectedToSelected","edgePath","stroke","strokeWidth","color","opacity","cursor","$34040b5af26d0b8a$var$onNodeDragStop","_event","$34040b5af26d0b8a$var$onNodeClick","element","$34040b5af26d0b8a$var$snapGrid","$34040b5af26d0b8a$export$72cb76f559fbafcf","edgeTypes","wire","editorConfig","reactflowInstance","setReactflowInstance","onInit","rfi","onContextMenu","onEditorContextMenu","onNodeContextMenu","onEdgeContextMenu","onEnd","onNodeDragStop","onNodeClick","snapGrid","defaultViewport","defaultEdgeOptions","snapToGrid","fitView","disableKeyboardA11y","variant","Dots","gap","showInteractive","$34040b5af26d0b8a$export$7cda8d932e2f33c0","$682f9b4ff493f2ac$export$d31000d36961d6c2","$682f9b4ff493f2ac$export$6cd5d5c1dae69a36","$682f9b4ff493f2ac$export$8d546ef2006cd0a2","$682f9b4ff493f2ac$export$10efbd348f877f87","$682f9b4ff493f2ac$export$8c347812506d5ac9","$682f9b4ff493f2ac$export$b38a2fd24b22fb35","showLoader","setShowLoader","src","controls","$682f9b4ff493f2ac$export$2206531ad8592d57","$682f9b4ff493f2ac$export$3e41faf802a29e71","active","$682f9b4ff493f2ac$export$61e5b3c7bace77b8","$682f9b4ff493f2ac$export$3aef34186a092045","$682f9b4ff493f2ac$export$cae179f078f4b4a4","$682f9b4ff493f2ac$var$generateEmptyFile","$682f9b4ff493f2ac$export$2e2bcd8739ae039","fetcher","request","Request","url","Response","fetch","status","styles","val","confirm","Editor","EDITOR_DEFAULTS","Wire","WNNode","TitleBar","PortsPanel","OutputPorts","OutputHandle","InputPorts","InputHandle","Port","Modal","EditableLabel","useAudioNode","useNode","useStore","isAudio","isPatch"],"version":3,"file":"module.js.map"}