1 line
362 KiB
Plaintext
1 line
362 KiB
Plaintext
{"version":3,"file":"index-BD-Ia1C4.js","sources":["../../src/extensions/core/clipspace.ts","../../src/extensions/core/colorPalette.ts","../../src/extensions/core/contextMenuFilter.ts","../../src/extensions/core/dynamicPrompts.ts","../../src/extensions/core/editAttention.ts","../../src/extensions/core/widgetInputs.ts","../../src/extensions/core/groupNodeManage.ts","../../src/extensions/core/groupNode.ts","../../src/extensions/core/groupOptions.ts","../../src/extensions/core/invertMenuScrolling.ts","../../src/extensions/core/keybinds.ts","../../src/extensions/core/linkRenderMode.ts","../../src/extensions/core/maskeditor.ts","../../src/extensions/core/nodeTemplates.ts","../../src/extensions/core/noteNode.ts","../../src/extensions/core/rerouteNode.ts","../../src/extensions/core/saveImageExtraOutput.ts","../../src/extensions/core/simpleTouchSupport.ts","../../src/extensions/core/slotDefaults.ts","../../src/extensions/core/snapToGrid.ts","../../src/extensions/core/uploadImage.ts","../../src/extensions/core/webcamCapture.ts","../../src/extensions/core/uploadAudio.ts"],"sourcesContent":["import { app } from '../../scripts/app'\nimport { ComfyDialog, $el } from '../../scripts/ui'\nimport { ComfyApp } from '../../scripts/app'\n\nexport class ClipspaceDialog extends ComfyDialog {\n static items = []\n static instance = null\n\n static registerButton(name, contextPredicate, callback) {\n const item = $el('button', {\n type: 'button',\n textContent: name,\n contextPredicate: contextPredicate,\n onclick: callback\n })\n\n ClipspaceDialog.items.push(item)\n }\n\n static invalidatePreview() {\n if (\n ComfyApp.clipspace &&\n ComfyApp.clipspace.imgs &&\n ComfyApp.clipspace.imgs.length > 0\n ) {\n const img_preview = document.getElementById(\n 'clipspace_preview'\n ) as HTMLImageElement\n if (img_preview) {\n img_preview.src =\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src\n img_preview.style.maxHeight = '100%'\n img_preview.style.maxWidth = '100%'\n }\n }\n }\n\n static invalidate() {\n if (ClipspaceDialog.instance) {\n const self = ClipspaceDialog.instance\n // allow reconstruct controls when copying from non-image to image content.\n const children = $el('div.comfy-modal-content', [\n self.createImgSettings(),\n ...self.createButtons()\n ])\n\n if (self.element) {\n // update\n self.element.removeChild(self.element.firstChild)\n self.element.appendChild(children)\n } else {\n // new\n self.element = $el('div.comfy-modal', { parent: document.body }, [\n children\n ])\n }\n\n if (self.element.children[0].children.length <= 1) {\n self.element.children[0].appendChild(\n $el('p', {}, [\n 'Unable to find the features to edit content of a format stored in the current Clipspace.'\n ])\n )\n }\n\n ClipspaceDialog.invalidatePreview()\n }\n }\n\n constructor() {\n super()\n }\n\n createButtons() {\n const buttons = []\n\n for (let idx in ClipspaceDialog.items) {\n const item = ClipspaceDialog.items[idx]\n if (!item.contextPredicate || item.contextPredicate())\n buttons.push(ClipspaceDialog.items[idx])\n }\n\n buttons.push(\n $el('button', {\n type: 'button',\n textContent: 'Close',\n onclick: () => {\n this.close()\n }\n })\n )\n\n return buttons\n }\n\n createImgSettings() {\n if (ComfyApp.clipspace.imgs) {\n const combo_items = []\n const imgs = ComfyApp.clipspace.imgs\n\n for (let i = 0; i < imgs.length; i++) {\n combo_items.push($el('option', { value: i }, [`${i}`]))\n }\n\n const combo1 = $el(\n 'select',\n {\n id: 'clipspace_img_selector',\n onchange: (event) => {\n ComfyApp.clipspace['selectedIndex'] = event.target.selectedIndex\n ClipspaceDialog.invalidatePreview()\n }\n },\n combo_items\n )\n\n const row1 = $el('tr', {}, [\n $el('td', {}, [$el('font', { color: 'white' }, ['Select Image'])]),\n $el('td', {}, [combo1])\n ])\n\n const combo2 = $el(\n 'select',\n {\n id: 'clipspace_img_paste_mode',\n onchange: (event) => {\n ComfyApp.clipspace['img_paste_mode'] = event.target.value\n }\n },\n [\n $el('option', { value: 'selected' }, 'selected'),\n $el('option', { value: 'all' }, 'all')\n ]\n ) as HTMLSelectElement\n combo2.value = ComfyApp.clipspace['img_paste_mode']\n\n const row2 = $el('tr', {}, [\n $el('td', {}, [$el('font', { color: 'white' }, ['Paste Mode'])]),\n $el('td', {}, [combo2])\n ])\n\n const td = $el(\n 'td',\n { align: 'center', width: '100px', height: '100px', colSpan: '2' },\n [$el('img', { id: 'clipspace_preview', ondragstart: () => false }, [])]\n )\n\n const row3 = $el('tr', {}, [td])\n\n return $el('table', {}, [row1, row2, row3])\n } else {\n return []\n }\n }\n\n createImgPreview() {\n if (ComfyApp.clipspace.imgs) {\n return $el('img', { id: 'clipspace_preview', ondragstart: () => false })\n } else return []\n }\n\n show() {\n const img_preview = document.getElementById('clipspace_preview')\n ClipspaceDialog.invalidate()\n\n this.element.style.display = 'block'\n }\n}\n\napp.registerExtension({\n name: 'Comfy.Clipspace',\n init(app) {\n app.openClipspace = function () {\n if (!ClipspaceDialog.instance) {\n ClipspaceDialog.instance = new ClipspaceDialog()\n ComfyApp.clipspace_invalidate_handler = ClipspaceDialog.invalidate\n }\n\n if (ComfyApp.clipspace) {\n ClipspaceDialog.instance.show()\n } else app.ui.dialog.show('Clipspace is Empty!')\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport { $el } from '../../scripts/ui'\nimport type { ColorPalettes, Palette } from '@/types/colorPalette'\nimport { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'\n\n// Manage color palettes\n\nconst colorPalettes: ColorPalettes = {\n dark: {\n id: 'dark',\n name: 'Dark (Default)',\n colors: {\n node_slot: {\n CLIP: '#FFD500', // bright yellow\n CLIP_VISION: '#A8DADC', // light blue-gray\n CLIP_VISION_OUTPUT: '#ad7452', // rusty brown-orange\n CONDITIONING: '#FFA931', // vibrant orange-yellow\n CONTROL_NET: '#6EE7B7', // soft mint green\n IMAGE: '#64B5F6', // bright sky blue\n LATENT: '#FF9CF9', // light pink-purple\n MASK: '#81C784', // muted green\n MODEL: '#B39DDB', // light lavender-purple\n STYLE_MODEL: '#C2FFAE', // light green-yellow\n VAE: '#FF6E6E', // bright red\n NOISE: '#B0B0B0', // gray\n GUIDER: '#66FFFF', // cyan\n SAMPLER: '#ECB4B4', // very soft red\n SIGMAS: '#CDFFCD', // soft lime green\n TAESD: '#DCC274' // cheesecake\n },\n litegraph_base: {\n BACKGROUND_IMAGE:\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII=',\n CLEAR_BACKGROUND_COLOR: '#222',\n NODE_TITLE_COLOR: '#999',\n NODE_SELECTED_TITLE_COLOR: '#FFF',\n NODE_TEXT_SIZE: 14,\n NODE_TEXT_COLOR: '#AAA',\n NODE_SUBTEXT_SIZE: 12,\n NODE_DEFAULT_COLOR: '#333',\n NODE_DEFAULT_BGCOLOR: '#353535',\n NODE_DEFAULT_BOXCOLOR: '#666',\n NODE_DEFAULT_SHAPE: 'box',\n NODE_BOX_OUTLINE_COLOR: '#FFF',\n DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',\n DEFAULT_GROUP_FONT: 24,\n\n WIDGET_BGCOLOR: '#222',\n WIDGET_OUTLINE_COLOR: '#666',\n WIDGET_TEXT_COLOR: '#DDD',\n WIDGET_SECONDARY_TEXT_COLOR: '#999',\n\n LINK_COLOR: '#9A9',\n EVENT_LINK_COLOR: '#A86',\n CONNECTING_LINK_COLOR: '#AFA'\n },\n comfy_base: {\n 'fg-color': '#fff',\n 'bg-color': '#202020',\n 'comfy-menu-bg': '#353535',\n 'comfy-input-bg': '#222',\n 'input-text': '#ddd',\n 'descrip-text': '#999',\n 'drag-text': '#ccc',\n 'error-text': '#ff4444',\n 'border-color': '#4e4e4e',\n 'tr-even-bg-color': '#222',\n 'tr-odd-bg-color': '#353535',\n 'content-bg': '#4e4e4e',\n 'content-fg': '#fff',\n 'content-hover-bg': '#222',\n 'content-hover-fg': '#fff'\n }\n }\n },\n light: {\n id: 'light',\n name: 'Light',\n colors: {\n node_slot: {\n CLIP: '#FFA726', // orange\n CLIP_VISION: '#5C6BC0', // indigo\n CLIP_VISION_OUTPUT: '#8D6E63', // brown\n CONDITIONING: '#EF5350', // red\n CONTROL_NET: '#66BB6A', // green\n IMAGE: '#42A5F5', // blue\n LATENT: '#AB47BC', // purple\n MASK: '#9CCC65', // light green\n MODEL: '#7E57C2', // deep purple\n STYLE_MODEL: '#D4E157', // lime\n VAE: '#FF7043' // deep orange\n },\n litegraph_base: {\n BACKGROUND_IMAGE:\n 'data:image/gif;base64,R0lGODlhZABkALMAAAAAAP///+vr6+rq6ujo6Ofn5+bm5uXl5d3d3f///wAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAABkAGQAAAT/UMhJq7046827HkcoHkYxjgZhnGG6si5LqnIM0/fL4qwwIMAg0CAsEovBIxKhRDaNy2GUOX0KfVFrssrNdpdaqTeKBX+dZ+jYvEaTf+y4W66mC8PUdrE879f9d2mBeoNLfH+IhYBbhIx2jkiHiomQlGKPl4uZe3CaeZifnnijgkESBqipqqusra6vsLGys62SlZO4t7qbuby7CLa+wqGWxL3Gv3jByMOkjc2lw8vOoNSi0czAncXW3Njdx9Pf48/Z4Kbbx+fQ5evZ4u3k1fKR6cn03vHlp7T9/v8A/8Gbp4+gwXoFryXMB2qgwoMMHyKEqA5fxX322FG8tzBcRnMW/zlulPbRncmQGidKjMjyYsOSKEF2FBlJQMCbOHP6c9iSZs+UnGYCdbnSo1CZI5F64kn0p1KnTH02nSoV3dGTV7FFHVqVq1dtWcMmVQZTbNGu72zqXMuW7danVL+6e4t1bEy6MeueBYLXrNO5Ze36jQtWsOG97wIj1vt3St/DjTEORss4nNq2mDP3e7w4r1bFkSET5hy6s2TRlD2/mSxXtSHQhCunXo26NevCpmvD/UU6tuullzULH76q92zdZG/Ltv1a+W+osI/nRmyc+fRi1Xdbh+68+0vv10dH3+77KD/i6IdnX669/frn5Zsjh4/2PXju8+8bzc9/6fj27LFnX11/+IUnXWl7BJfegm79FyB9JOl3oHgSklefgxAC+FmFGpqHIYcCfkhgfCohSKKJVo044YUMttggiBkmp6KFXw1oII24oYhjiDByaKOOHcp3Y5BD/njikSkO+eBREQAAOw==',\n CLEAR_BACKGROUND_COLOR: 'lightgray',\n NODE_TITLE_COLOR: '#222',\n NODE_SELECTED_TITLE_COLOR: '#000',\n NODE_TEXT_SIZE: 14,\n NODE_TEXT_COLOR: '#444',\n NODE_SUBTEXT_SIZE: 12,\n NODE_DEFAULT_COLOR: '#F7F7F7',\n NODE_DEFAULT_BGCOLOR: '#F5F5F5',\n NODE_DEFAULT_BOXCOLOR: '#CCC',\n NODE_DEFAULT_SHAPE: 'box',\n NODE_BOX_OUTLINE_COLOR: '#000',\n DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.1)',\n DEFAULT_GROUP_FONT: 24,\n\n WIDGET_BGCOLOR: '#D4D4D4',\n WIDGET_OUTLINE_COLOR: '#999',\n WIDGET_TEXT_COLOR: '#222',\n WIDGET_SECONDARY_TEXT_COLOR: '#555',\n\n LINK_COLOR: '#4CAF50',\n EVENT_LINK_COLOR: '#FF9800',\n CONNECTING_LINK_COLOR: '#2196F3'\n },\n comfy_base: {\n 'fg-color': '#222',\n 'bg-color': '#DDD',\n 'comfy-menu-bg': '#F5F5F5',\n 'comfy-input-bg': '#C9C9C9',\n 'input-text': '#222',\n 'descrip-text': '#444',\n 'drag-text': '#555',\n 'error-text': '#F44336',\n 'border-color': '#888',\n 'tr-even-bg-color': '#f9f9f9',\n 'tr-odd-bg-color': '#fff',\n 'content-bg': '#e0e0e0',\n 'content-fg': '#222',\n 'content-hover-bg': '#adadad',\n 'content-hover-fg': '#222'\n }\n }\n },\n solarized: {\n id: 'solarized',\n name: 'Solarized',\n colors: {\n node_slot: {\n CLIP: '#2AB7CA', // light blue\n CLIP_VISION: '#6c71c4', // blue violet\n CLIP_VISION_OUTPUT: '#859900', // olive green\n CONDITIONING: '#d33682', // magenta\n CONTROL_NET: '#d1ffd7', // light mint green\n IMAGE: '#5940bb', // deep blue violet\n LATENT: '#268bd2', // blue\n MASK: '#CCC9E7', // light purple-gray\n MODEL: '#dc322f', // red\n STYLE_MODEL: '#1a998a', // teal\n UPSCALE_MODEL: '#054A29', // dark green\n VAE: '#facfad' // light pink-orange\n },\n litegraph_base: {\n NODE_TITLE_COLOR: '#fdf6e3', // Base3\n NODE_SELECTED_TITLE_COLOR: '#A9D400',\n NODE_TEXT_SIZE: 14,\n NODE_TEXT_COLOR: '#657b83', // Base00\n NODE_SUBTEXT_SIZE: 12,\n NODE_DEFAULT_COLOR: '#094656',\n NODE_DEFAULT_BGCOLOR: '#073642', // Base02\n NODE_DEFAULT_BOXCOLOR: '#839496', // Base0\n NODE_DEFAULT_SHAPE: 'box',\n NODE_BOX_OUTLINE_COLOR: '#fdf6e3', // Base3\n DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',\n DEFAULT_GROUP_FONT: 24,\n\n WIDGET_BGCOLOR: '#002b36', // Base03\n WIDGET_OUTLINE_COLOR: '#839496', // Base0\n WIDGET_TEXT_COLOR: '#fdf6e3', // Base3\n WIDGET_SECONDARY_TEXT_COLOR: '#93a1a1', // Base1\n\n LINK_COLOR: '#2aa198', // Solarized Cyan\n EVENT_LINK_COLOR: '#268bd2', // Solarized Blue\n CONNECTING_LINK_COLOR: '#859900' // Solarized Green\n },\n comfy_base: {\n 'fg-color': '#fdf6e3', // Base3\n 'bg-color': '#002b36', // Base03\n 'comfy-menu-bg': '#073642', // Base02\n 'comfy-input-bg': '#002b36', // Base03\n 'input-text': '#93a1a1', // Base1\n 'descrip-text': '#586e75', // Base01\n 'drag-text': '#839496', // Base0\n 'error-text': '#dc322f', // Solarized Red\n 'border-color': '#657b83', // Base00\n 'tr-even-bg-color': '#002b36',\n 'tr-odd-bg-color': '#073642',\n 'content-bg': '#657b83',\n 'content-fg': '#fdf6e3',\n 'content-hover-bg': '#002b36',\n 'content-hover-fg': '#fdf6e3'\n }\n }\n },\n arc: {\n id: 'arc',\n name: 'Arc',\n colors: {\n node_slot: {\n BOOLEAN: '',\n CLIP: '#eacb8b',\n CLIP_VISION: '#A8DADC',\n CLIP_VISION_OUTPUT: '#ad7452',\n CONDITIONING: '#cf876f',\n CONTROL_NET: '#00d78d',\n CONTROL_NET_WEIGHTS: '',\n FLOAT: '',\n GLIGEN: '',\n IMAGE: '#80a1c0',\n IMAGEUPLOAD: '',\n INT: '',\n LATENT: '#b38ead',\n LATENT_KEYFRAME: '',\n MASK: '#a3bd8d',\n MODEL: '#8978a7',\n SAMPLER: '',\n SIGMAS: '',\n STRING: '',\n STYLE_MODEL: '#C2FFAE',\n T2I_ADAPTER_WEIGHTS: '',\n TAESD: '#DCC274',\n TIMESTEP_KEYFRAME: '',\n UPSCALE_MODEL: '',\n VAE: '#be616b'\n },\n litegraph_base: {\n BACKGROUND_IMAGE:\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAABcklEQVR4nO3YMUoDARgF4RfxBqZI6/0vZqFn0MYtrLIQMFN8U6V4LAtD+Jm9XG/v30OGl2e/AP7yevz4+vx45nvgF/+QGITEICQGITEIiUFIjNNC3q43u3/YnRJyPOzeQ+0e220nhRzReC8e7R7bbdvl+Jal1Bs46jEIiUFIDEJiEBKDkBhKPbZT6qHdptRTu02p53DUYxASg5AYhMQgJAYhMZR6bKfUQ7tNqad2m1LP4ajHICQGITEIiUFIDEJiKPXYTqmHdptST+02pZ7DUY9BSAxCYhASg5AYhMRQ6rGdUg/tNqWe2m1KPYejHoOQGITEICQGITEIiaHUYzulHtptSj2125R6Dkc9BiExCIlBSAxCYhASQ6nHdko9tNuUemq3KfUcjnoMQmIQEoOQGITEICSGUo/tlHpotyn11G5T6jkc9RiExCAkBiExCIlBSAylHtsp9dBuU+qp3abUczjqMQiJQUgMQmIQEoOQGITE+AHFISNQrFTGuwAAAABJRU5ErkJggg==',\n CLEAR_BACKGROUND_COLOR: '#2b2f38',\n NODE_TITLE_COLOR: '#b2b7bd',\n NODE_SELECTED_TITLE_COLOR: '#FFF',\n NODE_TEXT_SIZE: 14,\n NODE_TEXT_COLOR: '#AAA',\n NODE_SUBTEXT_SIZE: 12,\n NODE_DEFAULT_COLOR: '#2b2f38',\n NODE_DEFAULT_BGCOLOR: '#242730',\n NODE_DEFAULT_BOXCOLOR: '#6e7581',\n NODE_DEFAULT_SHAPE: 'box',\n NODE_BOX_OUTLINE_COLOR: '#FFF',\n DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',\n DEFAULT_GROUP_FONT: 22,\n WIDGET_BGCOLOR: '#2b2f38',\n WIDGET_OUTLINE_COLOR: '#6e7581',\n WIDGET_TEXT_COLOR: '#DDD',\n WIDGET_SECONDARY_TEXT_COLOR: '#b2b7bd',\n LINK_COLOR: '#9A9',\n EVENT_LINK_COLOR: '#A86',\n CONNECTING_LINK_COLOR: '#AFA'\n },\n comfy_base: {\n 'fg-color': '#fff',\n 'bg-color': '#2b2f38',\n 'comfy-menu-bg': '#242730',\n 'comfy-input-bg': '#2b2f38',\n 'input-text': '#ddd',\n 'descrip-text': '#b2b7bd',\n 'drag-text': '#ccc',\n 'error-text': '#ff4444',\n 'border-color': '#6e7581',\n 'tr-even-bg-color': '#2b2f38',\n 'tr-odd-bg-color': '#242730',\n 'content-bg': '#6e7581',\n 'content-fg': '#fff',\n 'content-hover-bg': '#2b2f38',\n 'content-hover-fg': '#fff'\n }\n }\n },\n nord: {\n id: 'nord',\n name: 'Nord',\n colors: {\n node_slot: {\n BOOLEAN: '',\n CLIP: '#eacb8b',\n CLIP_VISION: '#A8DADC',\n CLIP_VISION_OUTPUT: '#ad7452',\n CONDITIONING: '#cf876f',\n CONTROL_NET: '#00d78d',\n CONTROL_NET_WEIGHTS: '',\n FLOAT: '',\n GLIGEN: '',\n IMAGE: '#80a1c0',\n IMAGEUPLOAD: '',\n INT: '',\n LATENT: '#b38ead',\n LATENT_KEYFRAME: '',\n MASK: '#a3bd8d',\n MODEL: '#8978a7',\n SAMPLER: '',\n SIGMAS: '',\n STRING: '',\n STYLE_MODEL: '#C2FFAE',\n T2I_ADAPTER_WEIGHTS: '',\n TAESD: '#DCC274',\n TIMESTEP_KEYFRAME: '',\n UPSCALE_MODEL: '',\n VAE: '#be616b'\n },\n litegraph_base: {\n BACKGROUND_IMAGE:\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0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3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo1MDQxYTJmYy0xMzc0LTE5NGQtYWVmOC02MTMzNTE1ZjY1MDAiIHN0RXZ0OndoZW49IjIwMjMtMTEtMTVUMDE6MjA6NDUrMDE6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz73jWg/AAAAyUlEQVR42u3WKwoAIBRFQRdiMb1idv9Lsxn9gEFw4Dbb8JCTojbbXEJwjJVL2HKwYMGCBQuWLbDmjr+9zrBGjHl1WVcvy2DBggULFizTWQpewSt4HzwsgwULFiwFr7MUvMtS8D54WLBgGSxYCl7BK3iXZbBgwYIFC5bpLAWv4BW8Dx6WwYIFC5aC11kK3mUpeB88LFiwDBYsBa/gFbzLMliwYMGCBct0loJX8AreBw/LYMGCBUvB6ywF77IUvA8eFixYBgsWrNfWAZPltufdad+1AAAAAElFTkSuQmCC',\n CLEAR_BACKGROUND_COLOR: '#212732',\n NODE_TITLE_COLOR: '#999',\n NODE_SELECTED_TITLE_COLOR: '#e5eaf0',\n NODE_TEXT_SIZE: 14,\n NODE_TEXT_COLOR: '#bcc2c8',\n NODE_SUBTEXT_SIZE: 12,\n NODE_DEFAULT_COLOR: '#2e3440',\n NODE_DEFAULT_BGCOLOR: '#161b22',\n NODE_DEFAULT_BOXCOLOR: '#545d70',\n NODE_DEFAULT_SHAPE: 'box',\n NODE_BOX_OUTLINE_COLOR: '#e5eaf0',\n DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',\n DEFAULT_GROUP_FONT: 24,\n WIDGET_BGCOLOR: '#2e3440',\n WIDGET_OUTLINE_COLOR: '#545d70',\n WIDGET_TEXT_COLOR: '#bcc2c8',\n WIDGET_SECONDARY_TEXT_COLOR: '#999',\n LINK_COLOR: '#9A9',\n EVENT_LINK_COLOR: '#A86',\n CONNECTING_LINK_COLOR: '#AFA'\n },\n comfy_base: {\n 'fg-color': '#e5eaf0',\n 'bg-color': '#2e3440',\n 'comfy-menu-bg': '#161b22',\n 'comfy-input-bg': '#2e3440',\n 'input-text': '#bcc2c8',\n 'descrip-text': '#999',\n 'drag-text': '#ccc',\n 'error-text': '#ff4444',\n 'border-color': '#545d70',\n 'tr-even-bg-color': '#2e3440',\n 'tr-odd-bg-color': '#161b22',\n 'content-bg': '#545d70',\n 'content-fg': '#e5eaf0',\n 'content-hover-bg': '#2e3440',\n 'content-hover-fg': '#e5eaf0'\n }\n }\n },\n github: {\n id: 'github',\n name: 'Github',\n colors: {\n node_slot: {\n BOOLEAN: '',\n CLIP: '#eacb8b',\n CLIP_VISION: '#A8DADC',\n CLIP_VISION_OUTPUT: '#ad7452',\n CONDITIONING: '#cf876f',\n CONTROL_NET: '#00d78d',\n CONTROL_NET_WEIGHTS: '',\n FLOAT: '',\n GLIGEN: '',\n IMAGE: '#80a1c0',\n IMAGEUPLOAD: '',\n INT: '',\n LATENT: '#b38ead',\n LATENT_KEYFRAME: '',\n MASK: '#a3bd8d',\n MODEL: '#8978a7',\n SAMPLER: '',\n SIGMAS: '',\n STRING: '',\n STYLE_MODEL: '#C2FFAE',\n T2I_ADAPTER_WEIGHTS: '',\n TAESD: '#DCC274',\n TIMESTEP_KEYFRAME: '',\n UPSCALE_MODEL: '',\n VAE: '#be616b'\n },\n litegraph_base: {\n BACKGROUND_IMAGE:\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGlmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGF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hbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4OTe6GAAAAx0lEQVR42u3WMQoAIQxFwRzJys77X8vSLiRgITif7bYbgrwYc/mKXyBoY4VVBgsWLFiwYFmOlTv+9jfDOjHmr8u6eVkGCxYsWLBgmc5S8ApewXvgYRksWLBgKXidpeBdloL3wMOCBctgwVLwCl7BuyyDBQsWLFiwTGcpeAWv4D3wsAwWLFiwFLzOUvAuS8F74GHBgmWwYCl4Ba/gXZbBggULFixYprMUvIJX8B54WAYLFixYCl5nKXiXpeA98LBgwTJYsGC9tg1o8f4TTtqzNQAAAABJRU5ErkJggg==',\n CLEAR_BACKGROUND_COLOR: '#040506',\n NODE_TITLE_COLOR: '#999',\n NODE_SELECTED_TITLE_COLOR: '#e5eaf0',\n NODE_TEXT_SIZE: 14,\n NODE_TEXT_COLOR: '#bcc2c8',\n NODE_SUBTEXT_SIZE: 12,\n NODE_DEFAULT_COLOR: '#161b22',\n NODE_DEFAULT_BGCOLOR: '#13171d',\n NODE_DEFAULT_BOXCOLOR: '#30363d',\n NODE_DEFAULT_SHAPE: 'box',\n NODE_BOX_OUTLINE_COLOR: '#e5eaf0',\n DEFAULT_SHADOW_COLOR: 'rgba(0,0,0,0.5)',\n DEFAULT_GROUP_FONT: 24,\n WIDGET_BGCOLOR: '#161b22',\n WIDGET_OUTLINE_COLOR: '#30363d',\n WIDGET_TEXT_COLOR: '#bcc2c8',\n WIDGET_SECONDARY_TEXT_COLOR: '#999',\n LINK_COLOR: '#9A9',\n EVENT_LINK_COLOR: '#A86',\n CONNECTING_LINK_COLOR: '#AFA'\n },\n comfy_base: {\n 'fg-color': '#e5eaf0',\n 'bg-color': '#161b22',\n 'comfy-menu-bg': '#13171d',\n 'comfy-input-bg': '#161b22',\n 'input-text': '#bcc2c8',\n 'descrip-text': '#999',\n 'drag-text': '#ccc',\n 'error-text': '#ff4444',\n 'border-color': '#30363d',\n 'tr-even-bg-color': '#161b22',\n 'tr-odd-bg-color': '#13171d',\n 'content-bg': '#30363d',\n 'content-fg': '#e5eaf0',\n 'content-hover-bg': '#161b22',\n 'content-hover-fg': '#e5eaf0'\n }\n }\n }\n}\n\nconst id = 'Comfy.ColorPalette'\nconst idCustomColorPalettes = 'Comfy.CustomColorPalettes'\nconst defaultColorPaletteId = 'dark'\nconst els: { select: HTMLSelectElement | null } = {\n select: null\n}\n// const ctxMenu = LiteGraph.ContextMenu;\napp.registerExtension({\n name: id,\n init() {\n /**\n * Changes the background color of the canvas.\n *\n * @method updateBackground\n * @param {image} String\n * @param {clearBackgroundColor} String\n */\n // @ts-expect-error\n LGraphCanvas.prototype.updateBackground = function (\n image,\n clearBackgroundColor\n ) {\n this._bg_img = new Image()\n this._bg_img.name = image\n this._bg_img.src = image\n this._bg_img.onload = () => {\n this.draw(true, true)\n }\n this.background_image = image\n\n this.clear_background = true\n this.clear_background_color = clearBackgroundColor\n this._pattern = null\n }\n },\n addCustomNodeDefs(node_defs) {\n const sortObjectKeys = (unordered) => {\n return Object.keys(unordered)\n .sort()\n .reduce((obj, key) => {\n obj[key] = unordered[key]\n return obj\n }, {})\n }\n\n function getSlotTypes() {\n var types = []\n\n const defs = node_defs\n for (const nodeId in defs) {\n const nodeData = defs[nodeId]\n\n var inputs = nodeData['input']['required']\n if (nodeData['input']['optional'] !== undefined) {\n inputs = Object.assign(\n {},\n nodeData['input']['required'],\n nodeData['input']['optional']\n )\n }\n\n for (const inputName in inputs) {\n const inputData = inputs[inputName]\n const type = inputData[0]\n\n if (!Array.isArray(type)) {\n types.push(type)\n }\n }\n\n for (const o in nodeData['output']) {\n const output = nodeData['output'][o]\n types.push(output)\n }\n }\n\n return types\n }\n\n function completeColorPalette(colorPalette) {\n var types = getSlotTypes()\n\n for (const type of types) {\n if (!colorPalette.colors.node_slot[type]) {\n colorPalette.colors.node_slot[type] = ''\n }\n }\n\n colorPalette.colors.node_slot = sortObjectKeys(\n colorPalette.colors.node_slot\n )\n\n return colorPalette\n }\n\n const getColorPaletteTemplate = async () => {\n let colorPalette = {\n id: 'my_color_palette_unique_id',\n name: 'My Color Palette',\n colors: {\n node_slot: {},\n litegraph_base: {},\n comfy_base: {}\n }\n }\n\n // Copy over missing keys from default color palette\n const defaultColorPalette = colorPalettes[defaultColorPaletteId]\n for (const key in defaultColorPalette.colors.litegraph_base) {\n if (!colorPalette.colors.litegraph_base[key]) {\n colorPalette.colors.litegraph_base[key] = ''\n }\n }\n for (const key in defaultColorPalette.colors.comfy_base) {\n if (!colorPalette.colors.comfy_base[key]) {\n colorPalette.colors.comfy_base[key] = ''\n }\n }\n\n return completeColorPalette(colorPalette)\n }\n\n const getCustomColorPalettes = (): ColorPalettes => {\n return app.ui.settings.getSettingValue(idCustomColorPalettes, {})\n }\n\n const setCustomColorPalettes = (customColorPalettes: ColorPalettes) => {\n return app.ui.settings.setSettingValue(\n idCustomColorPalettes,\n customColorPalettes\n )\n }\n\n const addCustomColorPalette = async (colorPalette) => {\n if (typeof colorPalette !== 'object') {\n alert('Invalid color palette.')\n return\n }\n\n if (!colorPalette.id) {\n alert('Color palette missing id.')\n return\n }\n\n if (!colorPalette.name) {\n alert('Color palette missing name.')\n return\n }\n\n if (!colorPalette.colors) {\n alert('Color palette missing colors.')\n return\n }\n\n if (\n colorPalette.colors.node_slot &&\n typeof colorPalette.colors.node_slot !== 'object'\n ) {\n alert('Invalid color palette colors.node_slot.')\n return\n }\n\n const customColorPalettes = getCustomColorPalettes()\n customColorPalettes[colorPalette.id] = colorPalette\n setCustomColorPalettes(customColorPalettes)\n\n for (const option of els.select.childNodes) {\n if (\n (option as HTMLOptionElement).value ===\n 'custom_' + colorPalette.id\n ) {\n els.select.removeChild(option)\n }\n }\n\n els.select.append(\n $el('option', {\n textContent: colorPalette.name + ' (custom)',\n value: 'custom_' + colorPalette.id,\n selected: true\n })\n )\n\n setColorPalette('custom_' + colorPalette.id)\n await loadColorPalette(colorPalette)\n }\n\n const deleteCustomColorPalette = async (colorPaletteId) => {\n const customColorPalettes = getCustomColorPalettes()\n delete customColorPalettes[colorPaletteId]\n setCustomColorPalettes(customColorPalettes)\n\n for (const opt of els.select.childNodes) {\n const option = opt as HTMLOptionElement\n if (option.value === defaultColorPaletteId) {\n option.selected = true\n }\n\n if (option.value === 'custom_' + colorPaletteId) {\n els.select.removeChild(option)\n }\n }\n\n setColorPalette(defaultColorPaletteId)\n await loadColorPalette(getColorPalette())\n }\n\n const loadColorPalette = async (colorPalette: Palette) => {\n colorPalette = await completeColorPalette(colorPalette)\n if (colorPalette.colors) {\n // Sets the colors of node slots and links\n if (colorPalette.colors.node_slot) {\n Object.assign(\n // @ts-expect-error\n app.canvas.default_connection_color_byType,\n colorPalette.colors.node_slot\n )\n Object.assign(\n LGraphCanvas.link_type_colors,\n colorPalette.colors.node_slot\n )\n }\n // Sets the colors of the LiteGraph objects\n if (colorPalette.colors.litegraph_base) {\n // Everything updates correctly in the loop, except the Node Title and Link Color for some reason\n app.canvas.node_title_color =\n colorPalette.colors.litegraph_base.NODE_TITLE_COLOR\n app.canvas.default_link_color =\n colorPalette.colors.litegraph_base.LINK_COLOR\n\n for (const key in colorPalette.colors.litegraph_base) {\n if (\n colorPalette.colors.litegraph_base.hasOwnProperty(key) &&\n LiteGraph.hasOwnProperty(key)\n ) {\n LiteGraph[key] = colorPalette.colors.litegraph_base[key]\n }\n }\n }\n // Sets the color of ComfyUI elements\n if (colorPalette.colors.comfy_base) {\n const rootStyle = document.documentElement.style\n for (const key in colorPalette.colors.comfy_base) {\n rootStyle.setProperty(\n '--' + key,\n colorPalette.colors.comfy_base[key]\n )\n }\n }\n app.canvas.draw(true, true)\n }\n }\n\n const getColorPalette = (colorPaletteId?) => {\n if (!colorPaletteId) {\n colorPaletteId = app.ui.settings.getSettingValue(\n id,\n defaultColorPaletteId\n )\n }\n\n if (colorPaletteId.startsWith('custom_')) {\n colorPaletteId = colorPaletteId.substr(7)\n let customColorPalettes = getCustomColorPalettes()\n if (customColorPalettes[colorPaletteId]) {\n return customColorPalettes[colorPaletteId]\n }\n }\n\n return colorPalettes[colorPaletteId]\n }\n\n const setColorPalette = (colorPaletteId) => {\n app.ui.settings.setSettingValue(id, colorPaletteId)\n }\n\n const fileInput = $el('input', {\n type: 'file',\n accept: '.json',\n style: { display: 'none' },\n parent: document.body,\n onchange: () => {\n const file = fileInput.files[0]\n if (file.type === 'application/json' || file.name.endsWith('.json')) {\n const reader = new FileReader()\n reader.onload = async () => {\n await addCustomColorPalette(JSON.parse(reader.result as string))\n }\n reader.readAsText(file)\n }\n }\n }) as HTMLInputElement\n\n app.ui.settings.addSetting({\n id,\n category: ['Comfy', 'ColorPalette'],\n name: 'Color Palette',\n type: (name, setter, value) => {\n const options = [\n ...Object.values(colorPalettes).map((c) =>\n $el('option', {\n textContent: c.name,\n value: c.id,\n selected: c.id === value\n })\n ),\n ...Object.values(getCustomColorPalettes()).map((c) =>\n $el('option', {\n textContent: `${c.name} (custom)`,\n value: `custom_${c.id}`,\n selected: `custom_${c.id}` === value\n })\n )\n ]\n\n els.select = $el(\n 'select',\n {\n style: {\n marginBottom: '0.15rem',\n width: '100%'\n },\n onchange: (e) => {\n setter(e.target.value)\n }\n },\n options\n ) as HTMLSelectElement\n\n return $el('tr', [\n $el('td', [\n els.select,\n $el(\n 'div',\n {\n style: {\n display: 'grid',\n gap: '4px',\n gridAutoFlow: 'column'\n }\n },\n [\n $el('input', {\n type: 'button',\n value: 'Export',\n onclick: async () => {\n const colorPaletteId = app.ui.settings.getSettingValue(\n id,\n defaultColorPaletteId\n )\n const colorPalette = await completeColorPalette(\n getColorPalette(colorPaletteId)\n )\n const json = JSON.stringify(colorPalette, null, 2) // convert the data to a JSON string\n const blob = new Blob([json], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = $el('a', {\n href: url,\n download: colorPaletteId + '.json',\n style: { display: 'none' },\n parent: document.body\n })\n a.click()\n setTimeout(function () {\n a.remove()\n window.URL.revokeObjectURL(url)\n }, 0)\n }\n }),\n $el('input', {\n type: 'button',\n value: 'Import',\n onclick: () => {\n fileInput.click()\n }\n }),\n $el('input', {\n type: 'button',\n value: 'Template',\n onclick: async () => {\n const colorPalette = await getColorPaletteTemplate()\n const json = JSON.stringify(colorPalette, null, 2) // convert the data to a JSON string\n const blob = new Blob([json], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = $el('a', {\n href: url,\n download: 'color_palette.json',\n style: { display: 'none' },\n parent: document.body\n })\n a.click()\n setTimeout(function () {\n a.remove()\n window.URL.revokeObjectURL(url)\n }, 0)\n }\n }),\n $el('input', {\n type: 'button',\n value: 'Delete',\n onclick: async () => {\n let colorPaletteId = app.ui.settings.getSettingValue(\n id,\n defaultColorPaletteId\n )\n\n if (colorPalettes[colorPaletteId]) {\n alert('You cannot delete a built-in color palette.')\n return\n }\n\n if (colorPaletteId.startsWith('custom_')) {\n colorPaletteId = colorPaletteId.substr(7)\n }\n\n await deleteCustomColorPalette(colorPaletteId)\n }\n })\n ]\n )\n ])\n ])\n },\n defaultValue: defaultColorPaletteId,\n async onChange(value) {\n if (!value) {\n return\n }\n\n let palette = colorPalettes[value]\n if (palette) {\n await loadColorPalette(palette)\n } else if (value.startsWith('custom_')) {\n value = value.substr(7)\n let customColorPalettes = getCustomColorPalettes()\n if (customColorPalettes[value]) {\n palette = customColorPalettes[value]\n await loadColorPalette(customColorPalettes[value])\n }\n }\n\n let { BACKGROUND_IMAGE, CLEAR_BACKGROUND_COLOR } =\n palette.colors.litegraph_base\n if (\n BACKGROUND_IMAGE === undefined ||\n CLEAR_BACKGROUND_COLOR === undefined\n ) {\n const base = colorPalettes['dark'].colors.litegraph_base\n BACKGROUND_IMAGE = base.BACKGROUND_IMAGE\n CLEAR_BACKGROUND_COLOR = base.CLEAR_BACKGROUND_COLOR\n }\n // @ts-expect-error\n // litegraph.extensions.js\n app.canvas.updateBackground(BACKGROUND_IMAGE, CLEAR_BACKGROUND_COLOR)\n }\n })\n }\n})\n","import { LiteGraph, LGraphCanvas } from '@comfyorg/litegraph'\nimport { app } from '../../scripts/app'\n\n// Adds filtering to combo context menus\n\nconst ext = {\n name: 'Comfy.ContextMenuFilter',\n init() {\n const ctxMenu = LiteGraph.ContextMenu\n // @ts-expect-error\n // TODO Very hacky way to modify Litegraph behaviour. Fix ctx later.\n LiteGraph.ContextMenu = function (values, options) {\n const ctx = new ctxMenu(values, options)\n\n // If we are a dark menu (only used for combo boxes) then add a filter input\n if (options?.className === 'dark' && values?.length > 4) {\n const filter = document.createElement('input')\n filter.classList.add('comfy-context-menu-filter')\n filter.placeholder = 'Filter list'\n ctx.root.prepend(filter)\n\n const items = Array.from(\n ctx.root.querySelectorAll('.litemenu-entry')\n ) as HTMLElement[]\n let displayedItems = [...items]\n let itemCount = displayedItems.length\n\n // We must request an animation frame for the current node of the active canvas to update.\n requestAnimationFrame(() => {\n // @ts-expect-error\n const currentNode = LGraphCanvas.active_canvas.current_node\n const clickedComboValue = currentNode.widgets\n ?.filter(\n (w) =>\n w.type === 'combo' && w.options.values.length === values.length\n )\n .find((w) =>\n w.options.values.every((v, i) => v === values[i])\n )?.value\n\n let selectedIndex = clickedComboValue\n ? values.findIndex((v) => v === clickedComboValue)\n : 0\n if (selectedIndex < 0) {\n selectedIndex = 0\n }\n let selectedItem = displayedItems[selectedIndex]\n updateSelected()\n\n // Apply highlighting to the selected item\n function updateSelected() {\n selectedItem?.style.setProperty('background-color', '')\n selectedItem?.style.setProperty('color', '')\n selectedItem = displayedItems[selectedIndex]\n selectedItem?.style.setProperty(\n 'background-color',\n '#ccc',\n 'important'\n )\n selectedItem?.style.setProperty('color', '#000', 'important')\n }\n\n const positionList = () => {\n const rect = ctx.root.getBoundingClientRect()\n\n // If the top is off-screen then shift the element with scaling applied\n if (rect.top < 0) {\n const scale =\n 1 -\n ctx.root.getBoundingClientRect().height / ctx.root.clientHeight\n const shift = (ctx.root.clientHeight * scale) / 2\n ctx.root.style.top = -shift + 'px'\n }\n }\n\n // Arrow up/down to select items\n filter.addEventListener('keydown', (event) => {\n switch (event.key) {\n case 'ArrowUp':\n event.preventDefault()\n if (selectedIndex === 0) {\n selectedIndex = itemCount - 1\n } else {\n selectedIndex--\n }\n updateSelected()\n break\n case 'ArrowRight':\n event.preventDefault()\n selectedIndex = itemCount - 1\n updateSelected()\n break\n case 'ArrowDown':\n event.preventDefault()\n if (selectedIndex === itemCount - 1) {\n selectedIndex = 0\n } else {\n selectedIndex++\n }\n updateSelected()\n break\n case 'ArrowLeft':\n event.preventDefault()\n selectedIndex = 0\n updateSelected()\n break\n case 'Enter':\n selectedItem?.click()\n break\n case 'Escape':\n ctx.close()\n break\n }\n })\n\n filter.addEventListener('input', () => {\n // Hide all items that don't match our filter\n const term = filter.value.toLocaleLowerCase()\n // When filtering, recompute which items are visible for arrow up/down and maintain selection.\n displayedItems = items.filter((item) => {\n const isVisible =\n !term || item.textContent.toLocaleLowerCase().includes(term)\n item.style.display = isVisible ? 'block' : 'none'\n return isVisible\n })\n\n selectedIndex = 0\n if (displayedItems.includes(selectedItem)) {\n selectedIndex = displayedItems.findIndex(\n (d) => d === selectedItem\n )\n }\n itemCount = displayedItems.length\n\n updateSelected()\n\n // If we have an event then we can try and position the list under the source\n if (options.event) {\n let top = options.event.clientY - 10\n\n const bodyRect = document.body.getBoundingClientRect()\n const rootRect = ctx.root.getBoundingClientRect()\n if (\n bodyRect.height &&\n top > bodyRect.height - rootRect.height - 10\n ) {\n top = Math.max(0, bodyRect.height - rootRect.height - 10)\n }\n\n ctx.root.style.top = top + 'px'\n positionList()\n }\n })\n\n requestAnimationFrame(() => {\n // Focus the filter box when opening\n filter.focus()\n\n positionList()\n })\n })\n }\n\n return ctx\n }\n\n LiteGraph.ContextMenu.prototype = ctxMenu.prototype\n }\n}\n\napp.registerExtension(ext)\n","import { app } from '../../scripts/app'\n\n// Allows for simple dynamic prompt replacement\n// Inputs in the format {a|b} will have a random value of a or b chosen when the prompt is queued.\n\n/*\n * Strips C-style line and block comments from a string\n */\nfunction stripComments(str) {\n return str.replace(/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*/g, '')\n}\n\napp.registerExtension({\n name: 'Comfy.DynamicPrompts',\n nodeCreated(node) {\n if (node.widgets) {\n // Locate dynamic prompt text widgets\n // Include any widgets with dynamicPrompts set to true, and customtext\n const widgets = node.widgets.filter((n) => n.dynamicPrompts)\n for (const widget of widgets) {\n // Override the serialization of the value to resolve dynamic prompts for all widgets supporting it in this node\n widget.serializeValue = (workflowNode, widgetIndex) => {\n let prompt = stripComments(widget.value)\n while (\n prompt.replace('\\\\{', '').includes('{') &&\n prompt.replace('\\\\}', '').includes('}')\n ) {\n const startIndex = prompt.replace('\\\\{', '00').indexOf('{')\n const endIndex = prompt.replace('\\\\}', '00').indexOf('}')\n\n const optionsString = prompt.substring(startIndex + 1, endIndex)\n const options = optionsString.split('|')\n\n const randomIndex = Math.floor(Math.random() * options.length)\n const randomOption = options[randomIndex]\n\n prompt =\n prompt.substring(0, startIndex) +\n randomOption +\n prompt.substring(endIndex + 1)\n }\n\n // Overwrite the value in the serialized workflow pnginfo\n if (workflowNode?.widgets_values)\n workflowNode.widgets_values[widgetIndex] = prompt\n\n return prompt\n }\n }\n }\n }\n})\n","import { app } from '../../scripts/app'\n\n// Allows you to edit the attention weight by holding ctrl (or cmd) and using the up/down arrow keys\n\napp.registerExtension({\n name: 'Comfy.EditAttention',\n init() {\n const editAttentionDelta = app.ui.settings.addSetting({\n id: 'Comfy.EditAttention.Delta',\n name: 'Ctrl+up/down precision',\n type: 'slider',\n attrs: {\n min: 0.01,\n max: 0.5,\n step: 0.01\n },\n defaultValue: 0.05\n })\n\n function incrementWeight(weight, delta) {\n const floatWeight = parseFloat(weight)\n if (isNaN(floatWeight)) return weight\n const newWeight = floatWeight + delta\n return String(Number(newWeight.toFixed(10)))\n }\n\n function findNearestEnclosure(text, cursorPos) {\n let start = cursorPos,\n end = cursorPos\n let openCount = 0,\n closeCount = 0\n\n // Find opening parenthesis before cursor\n while (start >= 0) {\n start--\n if (text[start] === '(' && openCount === closeCount) break\n if (text[start] === '(') openCount++\n if (text[start] === ')') closeCount++\n }\n if (start < 0) return false\n\n openCount = 0\n closeCount = 0\n\n // Find closing parenthesis after cursor\n while (end < text.length) {\n if (text[end] === ')' && openCount === closeCount) break\n if (text[end] === '(') openCount++\n if (text[end] === ')') closeCount++\n end++\n }\n if (end === text.length) return false\n\n return { start: start + 1, end: end }\n }\n\n function addWeightToParentheses(text) {\n const parenRegex = /^\\((.*)\\)$/\n const parenMatch = text.match(parenRegex)\n\n const floatRegex = /:([+-]?(\\d*\\.)?\\d+([eE][+-]?\\d+)?)/\n const floatMatch = text.match(floatRegex)\n\n if (parenMatch && !floatMatch) {\n return `(${parenMatch[1]}:1.0)`\n } else {\n return text\n }\n }\n\n function editAttention(event: KeyboardEvent) {\n // @ts-expect-error Runtime narrowing not impl.\n const inputField: HTMLTextAreaElement = event.composedPath()[0]\n const delta = parseFloat(editAttentionDelta.value)\n\n if (inputField.tagName !== 'TEXTAREA') return\n if (!(event.key === 'ArrowUp' || event.key === 'ArrowDown')) return\n if (!event.ctrlKey && !event.metaKey) return\n\n event.preventDefault()\n\n let start = inputField.selectionStart\n let end = inputField.selectionEnd\n let selectedText = inputField.value.substring(start, end)\n\n // If there is no selection, attempt to find the nearest enclosure, or select the current word\n if (!selectedText) {\n const nearestEnclosure = findNearestEnclosure(inputField.value, start)\n if (nearestEnclosure) {\n start = nearestEnclosure.start\n end = nearestEnclosure.end\n selectedText = inputField.value.substring(start, end)\n } else {\n // Select the current word, find the start and end of the word\n const delimiters = ' .,\\\\/!?%^*;:{}=-_`~()\\r\\n\\t'\n\n while (\n !delimiters.includes(inputField.value[start - 1]) &&\n start > 0\n ) {\n start--\n }\n\n while (\n !delimiters.includes(inputField.value[end]) &&\n end < inputField.value.length\n ) {\n end++\n }\n\n selectedText = inputField.value.substring(start, end)\n if (!selectedText) return\n }\n }\n\n // If the selection ends with a space, remove it\n if (selectedText[selectedText.length - 1] === ' ') {\n selectedText = selectedText.substring(0, selectedText.length - 1)\n end -= 1\n }\n\n // If there are parentheses left and right of the selection, select them\n if (\n inputField.value[start - 1] === '(' &&\n inputField.value[end] === ')'\n ) {\n start -= 1\n end += 1\n selectedText = inputField.value.substring(start, end)\n }\n\n // If the selection is not enclosed in parentheses, add them\n if (\n selectedText[0] !== '(' ||\n selectedText[selectedText.length - 1] !== ')'\n ) {\n selectedText = `(${selectedText})`\n }\n\n // If the selection does not have a weight, add a weight of 1.0\n selectedText = addWeightToParentheses(selectedText)\n\n // Increment the weight\n const weightDelta = event.key === 'ArrowUp' ? delta : -delta\n const updatedText = selectedText.replace(\n /\\((.*):([+-]?\\d+(?:\\.\\d+)?)\\)/,\n (match, text, weight) => {\n weight = incrementWeight(weight, weightDelta)\n if (weight == 1) {\n return text\n } else {\n return `(${text}:${weight})`\n }\n }\n )\n\n inputField.setSelectionRange(start, end)\n // Intentional use of deprecated: https://developer.mozilla.org/docs/Web/API/Document/execCommand#using_inserttext\n document.execCommand('insertText', false, updatedText)\n inputField.setSelectionRange(start, start + updatedText.length)\n }\n window.addEventListener('keydown', editAttention)\n }\n})\n","import { ComfyWidgets, addValueControlWidgets } from '../../scripts/widgets'\nimport { app } from '../../scripts/app'\nimport { applyTextReplacements } from '../../scripts/utils'\nimport { LiteGraph, LGraphNode } from '@comfyorg/litegraph'\nimport type { INodeInputSlot, IWidget } from '@comfyorg/litegraph'\n\nconst CONVERTED_TYPE = 'converted-widget'\nconst VALID_TYPES = ['STRING', 'combo', 'number', 'toggle', 'BOOLEAN']\nconst CONFIG = Symbol()\nconst GET_CONFIG = Symbol()\nconst TARGET = Symbol() // Used for reroutes to specify the real target widget\n\ninterface PrimitiveNode extends LGraphNode {}\n\nconst replacePropertyName = 'Run widget replace on values'\nclass PrimitiveNode extends LGraphNode {\n controlValues: any[]\n lastType: string\n static category: string\n constructor(title?: string) {\n super(title)\n this.addOutput('connect to widget input', '*')\n this.serialize_widgets = true\n this.isVirtualNode = true\n\n if (!this.properties || !(replacePropertyName in this.properties)) {\n this.addProperty(replacePropertyName, false, 'boolean')\n }\n }\n\n applyToGraph(extraLinks = []) {\n if (!this.outputs[0].links?.length) return\n\n function get_links(node) {\n let links = []\n for (const l of node.outputs[0].links) {\n const linkInfo = app.graph.links[l]\n const n = node.graph.getNodeById(linkInfo.target_id)\n if (n.type == 'Reroute') {\n links = links.concat(get_links(n))\n } else {\n links.push(l)\n }\n }\n return links\n }\n\n let links = [\n ...get_links(this).map((l) => app.graph.links[l]),\n ...extraLinks\n ]\n let v = this.widgets?.[0].value\n if (v && this.properties[replacePropertyName]) {\n v = applyTextReplacements(app, v)\n }\n\n // For each output link copy our value over the original widget value\n for (const linkInfo of links) {\n const node = this.graph.getNodeById(linkInfo.target_id)\n const input = node.inputs[linkInfo.target_slot]\n let widget\n if (input.widget[TARGET]) {\n widget = input.widget[TARGET]\n } else {\n const widgetName = (input.widget as { name: string }).name\n if (widgetName) {\n widget = node.widgets.find((w) => w.name === widgetName)\n }\n }\n\n if (widget) {\n widget.value = v\n if (widget.callback) {\n widget.callback(\n widget.value,\n app.canvas,\n node,\n app.canvas.graph_mouse,\n {}\n )\n }\n }\n }\n }\n\n refreshComboInNode() {\n const widget = this.widgets?.[0]\n if (widget?.type === 'combo') {\n widget.options.values = this.outputs[0].widget[GET_CONFIG]()[0]\n\n if (!widget.options.values.includes(widget.value)) {\n widget.value = widget.options.values[0]\n ;(widget.callback as Function)(widget.value)\n }\n }\n }\n\n onAfterGraphConfigured() {\n if (this.outputs[0].links?.length && !this.widgets?.length) {\n // TODO: Review this check\n // @ts-expect-error\n if (!this.#onFirstConnection()) return\n\n // Populate widget values from config data\n if (this.widgets) {\n for (let i = 0; i < this.widgets_values.length; i++) {\n const w = this.widgets[i]\n if (w) {\n w.value = this.widgets_values[i]\n }\n }\n }\n\n // Merge values if required\n this.#mergeWidgetConfig()\n }\n }\n\n onConnectionsChange(_, index, connected) {\n if (app.configuringGraph) {\n // Dont run while the graph is still setting up\n return\n }\n\n const links = this.outputs[0].links\n if (connected) {\n if (links?.length && !this.widgets?.length) {\n this.#onFirstConnection()\n }\n } else {\n // We may have removed a link that caused the constraints to change\n this.#mergeWidgetConfig()\n\n if (!links?.length) {\n this.onLastDisconnect()\n }\n }\n }\n\n onConnectOutput(slot, type, input, target_node, target_slot) {\n // Fires before the link is made allowing us to reject it if it isn't valid\n // No widget, we cant connect\n if (!input.widget) {\n if (!(input.type in ComfyWidgets)) return false\n }\n\n if (this.outputs[slot].links?.length) {\n const valid = this.#isValidConnection(input)\n if (valid) {\n // On connect of additional outputs, copy our value to their widget\n this.applyToGraph([{ target_id: target_node.id, target_slot }])\n }\n return valid\n }\n }\n\n #onFirstConnection(recreating?: boolean) {\n // First connection can fire before the graph is ready on initial load so random things can be missing\n if (!this.outputs[0].links) {\n this.onLastDisconnect()\n return\n }\n const linkId = this.outputs[0].links[0]\n const link = this.graph.links[linkId]\n if (!link) return\n\n const theirNode = this.graph.getNodeById(link.target_id)\n if (!theirNode || !theirNode.inputs) return\n\n const input = theirNode.inputs[link.target_slot]\n if (!input) return\n\n let widget\n if (!input.widget) {\n if (!(input.type in ComfyWidgets)) return\n widget = { name: input.name, [GET_CONFIG]: () => [input.type, {}] } //fake widget\n } else {\n widget = input.widget\n }\n\n const config = widget[GET_CONFIG]?.()\n if (!config) return\n\n const { type } = getWidgetType(config)\n // Update our output to restrict to the widget type\n this.outputs[0].type = type\n this.outputs[0].name = type\n this.outputs[0].widget = widget\n\n this.#createWidget(\n widget[CONFIG] ?? config,\n theirNode,\n widget.name,\n recreating,\n widget[TARGET]\n )\n }\n\n #createWidget(inputData, node, widgetName, recreating, targetWidget) {\n let type = inputData[0]\n\n if (type instanceof Array) {\n type = 'COMBO'\n }\n\n // Store current size as addWidget resizes the node\n const size = this.size\n let widget\n if (type in ComfyWidgets) {\n widget = (ComfyWidgets[type](this, 'value', inputData, app) || {}).widget\n } else {\n widget = this.addWidget(type, 'value', null, () => {}, {})\n }\n\n if (targetWidget) {\n widget.value = targetWidget.value\n } else if (node?.widgets && widget) {\n const theirWidget = node.widgets.find((w) => w.name === widgetName)\n if (theirWidget) {\n widget.value = theirWidget.value\n }\n }\n\n if (\n !inputData?.[1]?.control_after_generate &&\n (widget.type === 'number' || widget.type === 'combo')\n ) {\n let control_value = this.widgets_values?.[1]\n if (!control_value) {\n control_value = 'fixed'\n }\n addValueControlWidgets(\n this,\n widget,\n control_value as string,\n undefined,\n inputData\n )\n let filter = this.widgets_values?.[2]\n if (filter && this.widgets.length === 3) {\n this.widgets[2].value = filter\n }\n }\n\n // Restore any saved control values\n const controlValues = this.controlValues\n if (\n this.lastType === this.widgets[0].type &&\n controlValues?.length === this.widgets.length - 1\n ) {\n for (let i = 0; i < controlValues.length; i++) {\n this.widgets[i + 1].value = controlValues[i]\n }\n }\n\n // When our value changes, update other widgets to reflect our changes\n // e.g. so LoadImage shows correct image\n const callback = widget.callback\n const self = this\n widget.callback = function () {\n const r = callback ? callback.apply(this, arguments) : undefined\n self.applyToGraph()\n return r\n }\n\n // Use the biggest dimensions in case the widgets caused the node to grow\n this.size = [\n Math.max(this.size[0], size[0]),\n Math.max(this.size[1], size[1])\n ]\n\n if (!recreating) {\n // Grow our node more if required\n const sz = this.computeSize()\n if (this.size[0] < sz[0]) {\n this.size[0] = sz[0]\n }\n if (this.size[1] < sz[1]) {\n this.size[1] = sz[1]\n }\n\n requestAnimationFrame(() => {\n if (this.onResize) {\n this.onResize(this.size)\n }\n })\n }\n }\n\n recreateWidget() {\n const values = this.widgets?.map((w) => w.value)\n this.#removeWidgets()\n this.#onFirstConnection(true)\n if (values?.length) {\n for (let i = 0; i < this.widgets?.length; i++)\n this.widgets[i].value = values[i]\n }\n return this.widgets?.[0]\n }\n\n #mergeWidgetConfig() {\n // Merge widget configs if the node has multiple outputs\n const output = this.outputs[0]\n const links = output.links\n\n const hasConfig = !!output.widget[CONFIG]\n if (hasConfig) {\n delete output.widget[CONFIG]\n }\n\n if (links?.length < 2 && hasConfig) {\n // Copy the widget options from the source\n if (links.length) {\n this.recreateWidget()\n }\n\n return\n }\n\n const config1 = output.widget[GET_CONFIG]()\n const isNumber = config1[0] === 'INT' || config1[0] === 'FLOAT'\n if (!isNumber) return\n\n for (const linkId of links) {\n const link = app.graph.links[linkId]\n if (!link) continue // Can be null when removing a node\n\n const theirNode = app.graph.getNodeById(link.target_id)\n const theirInput = theirNode.inputs[link.target_slot]\n\n // Call is valid connection so it can merge the configs when validating\n this.#isValidConnection(theirInput, hasConfig)\n }\n }\n\n #isValidConnection(input: INodeInputSlot, forceUpdate?: boolean) {\n // Only allow connections where the configs match\n const output = this.outputs[0]\n const config2 = input.widget[GET_CONFIG]()\n return !!mergeIfValid.call(\n this,\n output,\n config2,\n forceUpdate,\n this.recreateWidget\n )\n }\n\n #removeWidgets() {\n if (this.widgets) {\n // Allow widgets to cleanup\n for (const w of this.widgets) {\n if (w.onRemove) {\n w.onRemove()\n }\n }\n\n // Temporarily store the current values in case the node is being recreated\n // e.g. by group node conversion\n this.controlValues = []\n this.lastType = this.widgets[0]?.type\n for (let i = 1; i < this.widgets.length; i++) {\n this.controlValues.push(this.widgets[i].value)\n }\n setTimeout(() => {\n delete this.lastType\n delete this.controlValues\n }, 15)\n this.widgets.length = 0\n }\n }\n\n onLastDisconnect() {\n // We cant remove + re-add the output here as if you drag a link over the same link\n // it removes, then re-adds, causing it to break\n this.outputs[0].type = '*'\n this.outputs[0].name = 'connect to widget input'\n delete this.outputs[0].widget\n\n this.#removeWidgets()\n }\n}\n\nexport function getWidgetConfig(slot) {\n return slot.widget[CONFIG] ?? slot.widget[GET_CONFIG]()\n}\n\nfunction getConfig(widgetName) {\n const { nodeData } = this.constructor\n return (\n nodeData?.input?.required?.[widgetName] ??\n nodeData?.input?.optional?.[widgetName]\n )\n}\n\nfunction isConvertibleWidget(widget, config) {\n return (\n (VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0])) &&\n !widget.options?.forceInput\n )\n}\n\nfunction hideWidget(node, widget, suffix = '') {\n if (widget.type?.startsWith(CONVERTED_TYPE)) return\n widget.origType = widget.type\n widget.origComputeSize = widget.computeSize\n widget.origSerializeValue = widget.serializeValue\n widget.computeSize = () => [0, -4] // -4 is due to the gap litegraph adds between widgets automatically\n widget.type = CONVERTED_TYPE + suffix\n widget.serializeValue = () => {\n // Prevent serializing the widget if we have no input linked\n if (!node.inputs) {\n return undefined\n }\n let node_input = node.inputs.find((i) => i.widget?.name === widget.name)\n\n if (!node_input || !node_input.link) {\n return undefined\n }\n return widget.origSerializeValue\n ? widget.origSerializeValue()\n : widget.value\n }\n\n // Hide any linked widgets, e.g. seed+seedControl\n if (widget.linkedWidgets) {\n for (const w of widget.linkedWidgets) {\n hideWidget(node, w, ':' + widget.name)\n }\n }\n}\n\nfunction showWidget(widget) {\n widget.type = widget.origType\n widget.computeSize = widget.origComputeSize\n widget.serializeValue = widget.origSerializeValue\n\n delete widget.origType\n delete widget.origComputeSize\n delete widget.origSerializeValue\n\n // Hide any linked widgets, e.g. seed+seedControl\n if (widget.linkedWidgets) {\n for (const w of widget.linkedWidgets) {\n showWidget(w)\n }\n }\n}\n\nfunction convertToInput(node, widget, config) {\n hideWidget(node, widget)\n\n const { type } = getWidgetType(config)\n\n // Add input and store widget config for creating on primitive node\n const sz = node.size\n node.addInput(widget.name, type, {\n widget: { name: widget.name, [GET_CONFIG]: () => config }\n })\n\n for (const widget of node.widgets) {\n widget.last_y += LiteGraph.NODE_SLOT_HEIGHT\n }\n\n // Restore original size but grow if needed\n node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])])\n}\n\nfunction convertToWidget(node, widget) {\n showWidget(widget)\n const sz = node.size\n node.removeInput(node.inputs.findIndex((i) => i.widget?.name === widget.name))\n\n for (const widget of node.widgets) {\n widget.last_y -= LiteGraph.NODE_SLOT_HEIGHT\n }\n\n // Restore original size but grow if needed\n node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])])\n}\n\nfunction getWidgetType(config) {\n // Special handling for COMBO so we restrict links based on the entries\n let type = config[0]\n if (type instanceof Array) {\n type = 'COMBO'\n }\n return { type }\n}\n\nfunction isValidCombo(combo, obj) {\n // New input isnt a combo\n if (!(obj instanceof Array)) {\n console.log(`connection rejected: tried to connect combo to ${obj}`)\n return false\n }\n // New input combo has a different size\n if (combo.length !== obj.length) {\n console.log(`connection rejected: combo lists dont match`)\n return false\n }\n // New input combo has different elements\n if (combo.find((v, i) => obj[i] !== v)) {\n console.log(`connection rejected: combo lists dont match`)\n return false\n }\n\n return true\n}\n\nfunction isPrimitiveNode(node: LGraphNode): node is PrimitiveNode {\n return node.type === 'PrimitiveNode'\n}\n\nexport function setWidgetConfig(slot, config, target?: IWidget) {\n if (!slot.widget) return\n if (config) {\n slot.widget[GET_CONFIG] = () => config\n slot.widget[TARGET] = target\n } else {\n delete slot.widget\n }\n\n if (slot.link) {\n const link = app.graph.links[slot.link]\n if (link) {\n const originNode = app.graph.getNodeById(link.origin_id)\n if (isPrimitiveNode(originNode)) {\n if (config) {\n originNode.recreateWidget()\n } else if (!app.configuringGraph) {\n originNode.disconnectOutput(0)\n originNode.onLastDisconnect()\n }\n }\n }\n }\n}\n\nexport function mergeIfValid(\n output,\n config2,\n forceUpdate?: boolean,\n recreateWidget?: () => void,\n config1?: unknown\n) {\n if (!config1) {\n config1 = output.widget[CONFIG] ?? output.widget[GET_CONFIG]()\n }\n\n if (config1[0] instanceof Array) {\n if (!isValidCombo(config1[0], config2[0])) return\n } else if (config1[0] !== config2[0]) {\n // Types dont match\n console.log(`connection rejected: types dont match`, config1[0], config2[0])\n return\n }\n\n const keys = new Set([\n ...Object.keys(config1[1] ?? {}),\n ...Object.keys(config2[1] ?? {})\n ])\n\n let customConfig\n const getCustomConfig = () => {\n if (!customConfig) {\n if (typeof structuredClone === 'undefined') {\n customConfig = JSON.parse(JSON.stringify(config1[1] ?? {}))\n } else {\n customConfig = structuredClone(config1[1] ?? {})\n }\n }\n return customConfig\n }\n\n const isNumber = config1[0] === 'INT' || config1[0] === 'FLOAT'\n for (const k of keys.values()) {\n if (\n k !== 'default' &&\n k !== 'forceInput' &&\n k !== 'defaultInput' &&\n k !== 'control_after_generate' &&\n k !== 'multiline' &&\n k !== 'tooltip'\n ) {\n let v1 = config1[1][k]\n let v2 = config2[1]?.[k]\n\n if (v1 === v2 || (!v1 && !v2)) continue\n\n if (isNumber) {\n if (k === 'min') {\n const theirMax = config2[1]?.['max']\n if (theirMax != null && v1 > theirMax) {\n console.log('connection rejected: min > max', v1, theirMax)\n return\n }\n getCustomConfig()[k] =\n v1 == null ? v2 : v2 == null ? v1 : Math.max(v1, v2)\n continue\n } else if (k === 'max') {\n const theirMin = config2[1]?.['min']\n if (theirMin != null && v1 < theirMin) {\n console.log('connection rejected: max < min', v1, theirMin)\n return\n }\n getCustomConfig()[k] =\n v1 == null ? v2 : v2 == null ? v1 : Math.min(v1, v2)\n continue\n } else if (k === 'step') {\n let step\n if (v1 == null) {\n // No current step\n step = v2\n } else if (v2 == null) {\n // No new step\n step = v1\n } else {\n if (v1 < v2) {\n // Ensure v1 is larger for the mod\n const a = v2\n v2 = v1\n v1 = a\n }\n if (v1 % v2) {\n console.log(\n 'connection rejected: steps not divisible',\n 'current:',\n v1,\n 'new:',\n v2\n )\n return\n }\n\n step = v1\n }\n\n getCustomConfig()[k] = step\n continue\n }\n }\n\n console.log(`connection rejected: config ${k} values dont match`, v1, v2)\n return\n }\n }\n\n if (customConfig || forceUpdate) {\n if (customConfig) {\n output.widget[CONFIG] = [config1[0], customConfig]\n }\n\n const widget = recreateWidget?.call(this)\n // When deleting a node this can be null\n if (widget) {\n const min = widget.options.min\n const max = widget.options.max\n if (min != null && widget.value < min) widget.value = min\n if (max != null && widget.value > max) widget.value = max\n widget.callback(widget.value)\n }\n }\n\n return { customConfig }\n}\n\nlet useConversionSubmenusSetting\napp.registerExtension({\n name: 'Comfy.WidgetInputs',\n init() {\n useConversionSubmenusSetting = app.ui.settings.addSetting({\n id: 'Comfy.NodeInputConversionSubmenus',\n name: 'In the node context menu, place the entries that convert between input/widget in sub-menus.',\n type: 'boolean',\n defaultValue: true\n })\n },\n async beforeRegisterNodeDef(nodeType, nodeData, app) {\n // Add menu options to convert to/from widgets\n const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions\n nodeType.prototype.convertWidgetToInput = function (widget) {\n const config = getConfig.call(this, widget.name) ?? [\n widget.type,\n widget.options || {}\n ]\n if (!isConvertibleWidget(widget, config)) return false\n convertToInput(this, widget, config)\n return true\n }\n nodeType.prototype.getExtraMenuOptions = function (_, options) {\n const r = origGetExtraMenuOptions\n ? origGetExtraMenuOptions.apply(this, arguments)\n : undefined\n\n if (this.widgets) {\n let toInput = []\n let toWidget = []\n for (const w of this.widgets) {\n if (w.options?.forceInput) {\n continue\n }\n if (w.type === CONVERTED_TYPE) {\n toWidget.push({\n content: `Convert ${w.name} to widget`,\n callback: () => convertToWidget(this, w)\n })\n } else {\n const config = getConfig.call(this, w.name) ?? [\n w.type,\n w.options || {}\n ]\n if (isConvertibleWidget(w, config)) {\n toInput.push({\n content: `Convert ${w.name} to input`,\n callback: () => convertToInput(this, w, config)\n })\n }\n }\n }\n\n //Convert.. main menu\n if (toInput.length) {\n if (useConversionSubmenusSetting.value) {\n options.push({\n content: 'Convert Widget to Input',\n submenu: {\n options: toInput\n }\n })\n } else {\n options.push(...toInput, null)\n }\n }\n if (toWidget.length) {\n if (useConversionSubmenusSetting.value) {\n options.push({\n content: 'Convert Input to Widget',\n submenu: {\n options: toWidget\n }\n })\n } else {\n options.push(...toWidget, null)\n }\n }\n }\n\n return r\n }\n\n nodeType.prototype.onGraphConfigured = function () {\n if (!this.inputs) return\n\n for (const input of this.inputs) {\n if (input.widget) {\n if (!input.widget[GET_CONFIG]) {\n input.widget[GET_CONFIG] = () =>\n getConfig.call(this, input.widget.name)\n }\n\n // Cleanup old widget config\n if (input.widget.config) {\n if (input.widget.config[0] instanceof Array) {\n // If we are an old converted combo then replace the input type and the stored link data\n input.type = 'COMBO'\n\n const link = app.graph.links[input.link]\n if (link) {\n link.type = input.type\n }\n }\n delete input.widget.config\n }\n\n const w = this.widgets.find((w) => w.name === input.widget.name)\n if (w) {\n hideWidget(this, w)\n } else {\n convertToWidget(this, input)\n }\n }\n }\n }\n\n const origOnNodeCreated = nodeType.prototype.onNodeCreated\n nodeType.prototype.onNodeCreated = function () {\n const r = origOnNodeCreated ? origOnNodeCreated.apply(this) : undefined\n\n // When node is created, convert any force/default inputs\n if (!app.configuringGraph && this.widgets) {\n for (const w of this.widgets) {\n if (w?.options?.forceInput || w?.options?.defaultInput) {\n const config = getConfig.call(this, w.name) ?? [\n w.type,\n w.options || {}\n ]\n convertToInput(this, w, config)\n }\n }\n }\n\n return r\n }\n\n const origOnConfigure = nodeType.prototype.onConfigure\n nodeType.prototype.onConfigure = function () {\n const r = origOnConfigure\n ? origOnConfigure.apply(this, arguments)\n : undefined\n if (!app.configuringGraph && this.inputs) {\n // On copy + paste of nodes, ensure that widget configs are set up\n for (const input of this.inputs) {\n if (input.widget && !input.widget[GET_CONFIG]) {\n input.widget[GET_CONFIG] = () =>\n getConfig.call(this, input.widget.name)\n const w = this.widgets.find((w) => w.name === input.widget.name)\n if (w) {\n hideWidget(this, w)\n }\n }\n }\n }\n\n return r\n }\n\n function isNodeAtPos(pos) {\n for (const n of app.graph._nodes) {\n if (n.pos[0] === pos[0] && n.pos[1] === pos[1]) {\n return true\n }\n }\n return false\n }\n\n // Double click a widget input to automatically attach a primitive\n const origOnInputDblClick = nodeType.prototype.onInputDblClick\n const ignoreDblClick = Symbol()\n nodeType.prototype.onInputDblClick = function (slot) {\n const r = origOnInputDblClick\n ? origOnInputDblClick.apply(this, arguments)\n : undefined\n\n const input = this.inputs[slot]\n if (!input.widget || !input[ignoreDblClick]) {\n // Not a widget input or already handled input\n if (\n !(input.type in ComfyWidgets) &&\n !(input.widget[GET_CONFIG]?.()?.[0] instanceof Array)\n ) {\n return r //also Not a ComfyWidgets input or combo (do nothing)\n }\n }\n\n // Create a primitive node\n const node = LiteGraph.createNode('PrimitiveNode')\n app.graph.add(node)\n\n // Calculate a position that wont directly overlap another node\n const pos: [number, number] = [\n this.pos[0] - node.size[0] - 30,\n this.pos[1]\n ]\n while (isNodeAtPos(pos)) {\n pos[1] += LiteGraph.NODE_TITLE_HEIGHT\n }\n\n node.pos = pos\n node.connect(0, this, slot)\n node.title = input.name\n\n // Prevent adding duplicates due to triple clicking\n input[ignoreDblClick] = true\n setTimeout(() => {\n delete input[ignoreDblClick]\n }, 300)\n\n return r\n }\n\n // Prevent connecting COMBO lists to converted inputs that dont match types\n const onConnectInput = nodeType.prototype.onConnectInput\n nodeType.prototype.onConnectInput = function (\n targetSlot,\n type,\n output,\n originNode,\n originSlot\n ) {\n const v = onConnectInput?.(this, arguments)\n // Not a combo, ignore\n if (type !== 'COMBO') return v\n // Primitive output, allow that to handle\n if (originNode.outputs[originSlot].widget) return v\n\n // Ensure target is also a combo\n const targetCombo = this.inputs[targetSlot].widget?.[GET_CONFIG]?.()?.[0]\n if (!targetCombo || !(targetCombo instanceof Array)) return v\n\n // Check they match\n const originConfig =\n originNode.constructor?.nodeData?.output?.[originSlot]\n if (!originConfig || !isValidCombo(targetCombo, originConfig)) {\n return false\n }\n\n return v\n }\n },\n registerCustomNodes() {\n LiteGraph.registerNodeType(\n 'PrimitiveNode',\n Object.assign(PrimitiveNode, {\n title: 'Primitive'\n })\n )\n PrimitiveNode.category = 'utils'\n }\n})\n","import { $el, ComfyDialog } from '../../scripts/ui'\nimport { DraggableList } from '../../scripts/ui/draggableList'\nimport { GroupNodeConfig, GroupNodeHandler } from './groupNode'\nimport './groupNodeManage.css'\nimport { app, type ComfyApp } from '../../scripts/app'\nimport {\n LiteGraph,\n type LGraphNode,\n type LGraphNodeConstructor\n} from '@comfyorg/litegraph'\n\nconst ORDER: symbol = Symbol()\n\nfunction merge(target, source) {\n if (typeof target === 'object' && typeof source === 'object') {\n for (const key in source) {\n const sv = source[key]\n if (typeof sv === 'object') {\n let tv = target[key]\n if (!tv) tv = target[key] = {}\n merge(tv, source[key])\n } else {\n target[key] = sv\n }\n }\n }\n\n return target\n}\n\nexport class ManageGroupDialog extends ComfyDialog<HTMLDialogElement> {\n tabs: Record<\n 'Inputs' | 'Outputs' | 'Widgets',\n { tab: HTMLAnchorElement; page: HTMLElement }\n >\n selectedNodeIndex: number | null | undefined\n selectedTab: keyof ManageGroupDialog['tabs'] = 'Inputs'\n selectedGroup: string | undefined\n modifications: Record<\n string,\n Record<\n string,\n Record<\n string,\n { name?: string | undefined; visible?: boolean | undefined }\n >\n >\n > = {}\n nodeItems: any[]\n app: ComfyApp\n groupNodeType: LGraphNodeConstructor<LGraphNode>\n groupNodeDef: any\n groupData: any\n\n innerNodesList: HTMLUListElement\n widgetsPage: HTMLElement\n inputsPage: HTMLElement\n outputsPage: HTMLElement\n draggable: any\n\n get selectedNodeInnerIndex() {\n return +this.nodeItems[this.selectedNodeIndex].dataset.nodeindex\n }\n\n constructor(app) {\n super()\n this.app = app\n this.element = $el('dialog.comfy-group-manage', {\n parent: document.body\n }) as HTMLDialogElement\n }\n\n changeTab(tab) {\n this.tabs[this.selectedTab].tab.classList.remove('active')\n this.tabs[this.selectedTab].page.classList.remove('active')\n this.tabs[tab].tab.classList.add('active')\n this.tabs[tab].page.classList.add('active')\n this.selectedTab = tab\n }\n\n changeNode(index, force?) {\n if (!force && this.selectedNodeIndex === index) return\n\n if (this.selectedNodeIndex != null) {\n this.nodeItems[this.selectedNodeIndex].classList.remove('selected')\n }\n this.nodeItems[index].classList.add('selected')\n this.selectedNodeIndex = index\n\n if (!this.buildInputsPage() && this.selectedTab === 'Inputs') {\n this.changeTab('Widgets')\n }\n if (!this.buildWidgetsPage() && this.selectedTab === 'Widgets') {\n this.changeTab('Outputs')\n }\n if (!this.buildOutputsPage() && this.selectedTab === 'Outputs') {\n this.changeTab('Inputs')\n }\n\n this.changeTab(this.selectedTab)\n }\n\n getGroupData() {\n this.groupNodeType =\n LiteGraph.registered_node_types['workflow/' + this.selectedGroup]\n this.groupNodeDef = this.groupNodeType.nodeData\n this.groupData = GroupNodeHandler.getGroupData(this.groupNodeType)\n }\n\n changeGroup(group, reset = true) {\n this.selectedGroup = group\n this.getGroupData()\n\n const nodes = this.groupData.nodeData.nodes\n this.nodeItems = nodes.map((n, i) =>\n $el(\n 'li.draggable-item',\n {\n dataset: {\n nodeindex: n.index + ''\n },\n onclick: () => {\n this.changeNode(i)\n }\n },\n [\n $el('span.drag-handle'),\n $el(\n 'div',\n {\n textContent: n.title ?? n.type\n },\n n.title\n ? $el('span', {\n textContent: n.type\n })\n : []\n )\n ]\n )\n )\n\n this.innerNodesList.replaceChildren(...this.nodeItems)\n\n if (reset) {\n this.selectedNodeIndex = null\n this.changeNode(0)\n } else {\n const items = this.draggable.getAllItems()\n let index = items.findIndex((item) => item.classList.contains('selected'))\n if (index === -1) index = this.selectedNodeIndex\n this.changeNode(index, true)\n }\n\n const ordered = [...nodes]\n this.draggable?.dispose()\n this.draggable = new DraggableList(this.innerNodesList, 'li')\n this.draggable.addEventListener(\n 'dragend',\n ({ detail: { oldPosition, newPosition } }) => {\n if (oldPosition === newPosition) return\n ordered.splice(newPosition, 0, ordered.splice(oldPosition, 1)[0])\n for (let i = 0; i < ordered.length; i++) {\n this.storeModification({\n nodeIndex: ordered[i].index,\n section: ORDER,\n prop: 'order',\n value: i\n })\n }\n }\n )\n }\n\n storeModification(props: {\n nodeIndex?: number\n section: symbol\n prop: string\n value: any\n }) {\n const { nodeIndex, section, prop, value } = props\n const groupMod = (this.modifications[this.selectedGroup] ??= {})\n const nodesMod = (groupMod.nodes ??= {})\n const nodeMod = (nodesMod[nodeIndex ?? this.selectedNodeInnerIndex] ??= {})\n const typeMod = (nodeMod[section] ??= {})\n if (typeof value === 'object') {\n const objMod = (typeMod[prop] ??= {})\n Object.assign(objMod, value)\n } else {\n typeMod[prop] = value\n }\n }\n\n getEditElement(section, prop, value, placeholder, checked, checkable = true) {\n if (value === placeholder) value = ''\n\n const mods =\n this.modifications[this.selectedGroup]?.nodes?.[\n this.selectedNodeInnerIndex\n ]?.[section]?.[prop]\n if (mods) {\n if (mods.name != null) {\n value = mods.name\n }\n if (mods.visible != null) {\n checked = mods.visible\n }\n }\n\n return $el('div', [\n $el('input', {\n value,\n placeholder,\n type: 'text',\n onchange: (e) => {\n this.storeModification({\n section,\n prop,\n value: { name: e.target.value }\n })\n }\n }),\n $el('label', { textContent: 'Visible' }, [\n $el('input', {\n type: 'checkbox',\n checked,\n disabled: !checkable,\n onchange: (e) => {\n this.storeModification({\n section,\n prop,\n value: { visible: !!e.target.checked }\n })\n }\n })\n ])\n ])\n }\n\n buildWidgetsPage() {\n const widgets =\n this.groupData.oldToNewWidgetMap[this.selectedNodeInnerIndex]\n const items = Object.keys(widgets ?? {})\n const type = app.graph.extra.groupNodes[this.selectedGroup]\n const config = type.config?.[this.selectedNodeInnerIndex]?.input\n this.widgetsPage.replaceChildren(\n ...items.map((oldName) => {\n return this.getEditElement(\n 'input',\n oldName,\n widgets[oldName],\n oldName,\n config?.[oldName]?.visible !== false\n )\n })\n )\n return !!items.length\n }\n\n buildInputsPage() {\n const inputs = this.groupData.nodeInputs[this.selectedNodeInnerIndex]\n const items = Object.keys(inputs ?? {})\n const type = app.graph.extra.groupNodes[this.selectedGroup]\n const config = type.config?.[this.selectedNodeInnerIndex]?.input\n this.inputsPage.replaceChildren(\n ...items\n .map((oldName) => {\n let value = inputs[oldName]\n if (!value) {\n return\n }\n\n return this.getEditElement(\n 'input',\n oldName,\n value,\n oldName,\n config?.[oldName]?.visible !== false\n )\n })\n .filter(Boolean)\n )\n return !!items.length\n }\n\n buildOutputsPage() {\n const nodes = this.groupData.nodeData.nodes\n const innerNodeDef = this.groupData.getNodeDef(\n nodes[this.selectedNodeInnerIndex]\n )\n const outputs = innerNodeDef?.output ?? []\n const groupOutputs =\n this.groupData.oldToNewOutputMap[this.selectedNodeInnerIndex]\n\n const type = app.graph.extra.groupNodes[this.selectedGroup]\n const config = type.config?.[this.selectedNodeInnerIndex]?.output\n const node = this.groupData.nodeData.nodes[this.selectedNodeInnerIndex]\n const checkable = node.type !== 'PrimitiveNode'\n this.outputsPage.replaceChildren(\n ...outputs\n .map((type, slot) => {\n const groupOutputIndex = groupOutputs?.[slot]\n const oldName = innerNodeDef.output_name?.[slot] ?? type\n let value = config?.[slot]?.name\n const visible = config?.[slot]?.visible || groupOutputIndex != null\n if (!value || value === oldName) {\n value = ''\n }\n return this.getEditElement(\n 'output',\n slot,\n value,\n oldName,\n visible,\n checkable\n )\n })\n .filter(Boolean)\n )\n return !!outputs.length\n }\n\n show(type?) {\n const groupNodes = Object.keys(app.graph.extra?.groupNodes ?? {}).sort(\n (a, b) => a.localeCompare(b)\n )\n\n this.innerNodesList = $el(\n 'ul.comfy-group-manage-list-items'\n ) as HTMLUListElement\n this.widgetsPage = $el('section.comfy-group-manage-node-page')\n this.inputsPage = $el('section.comfy-group-manage-node-page')\n this.outputsPage = $el('section.comfy-group-manage-node-page')\n const pages = $el('div', [\n this.widgetsPage,\n this.inputsPage,\n this.outputsPage\n ])\n\n this.tabs = [\n ['Inputs', this.inputsPage],\n ['Widgets', this.widgetsPage],\n ['Outputs', this.outputsPage]\n ].reduce((p, [name, page]: [string, HTMLElement]) => {\n p[name] = {\n tab: $el('a', {\n onclick: () => {\n this.changeTab(name)\n },\n textContent: name\n }),\n page\n }\n return p\n }, {}) as any\n\n const outer = $el('div.comfy-group-manage-outer', [\n $el('header', [\n $el('h2', 'Group Nodes'),\n $el(\n 'select',\n {\n onchange: (e) => {\n this.changeGroup(e.target.value)\n }\n },\n groupNodes.map((g) =>\n $el('option', {\n textContent: g,\n selected: 'workflow/' + g === type,\n value: g\n })\n )\n )\n ]),\n $el('main', [\n $el('section.comfy-group-manage-list', this.innerNodesList),\n $el('section.comfy-group-manage-node', [\n $el(\n 'header',\n Object.values(this.tabs).map((t) => t.tab)\n ),\n pages\n ])\n ]),\n $el('footer', [\n $el(\n 'button.comfy-btn',\n {\n onclick: (e) => {\n // @ts-expect-error\n const node = app.graph._nodes.find(\n (n) => n.type === 'workflow/' + this.selectedGroup\n )\n if (node) {\n alert(\n 'This group node is in use in the current workflow, please first remove these.'\n )\n return\n }\n if (\n confirm(\n `Are you sure you want to remove the node: \"${this.selectedGroup}\"`\n )\n ) {\n delete app.graph.extra.groupNodes[this.selectedGroup]\n LiteGraph.unregisterNodeType('workflow/' + this.selectedGroup)\n }\n this.show()\n }\n },\n 'Delete Group Node'\n ),\n $el(\n 'button.comfy-btn',\n {\n onclick: async () => {\n let nodesByType\n let recreateNodes = []\n const types = {}\n for (const g in this.modifications) {\n const type = app.graph.extra.groupNodes[g]\n let config = (type.config ??= {})\n\n let nodeMods = this.modifications[g]?.nodes\n if (nodeMods) {\n const keys = Object.keys(nodeMods)\n if (nodeMods[keys[0]][ORDER]) {\n // If any node is reordered, they will all need sequencing\n const orderedNodes = []\n const orderedMods = {}\n const orderedConfig = {}\n\n for (const n of keys) {\n const order = nodeMods[n][ORDER].order\n orderedNodes[order] = type.nodes[+n]\n orderedMods[order] = nodeMods[n]\n orderedNodes[order].index = order\n }\n\n // Rewrite links\n for (const l of type.links) {\n if (l[0] != null) l[0] = type.nodes[l[0]].index\n if (l[2] != null) l[2] = type.nodes[l[2]].index\n }\n\n // Rewrite externals\n if (type.external) {\n for (const ext of type.external) {\n ext[0] = type.nodes[ext[0]]\n }\n }\n\n // Rewrite modifications\n for (const id of keys) {\n if (config[id]) {\n orderedConfig[type.nodes[id].index] = config[id]\n }\n delete config[id]\n }\n\n type.nodes = orderedNodes\n nodeMods = orderedMods\n type.config = config = orderedConfig\n }\n\n merge(config, nodeMods)\n }\n\n types[g] = type\n\n if (!nodesByType) {\n // @ts-expect-error\n nodesByType = app.graph._nodes.reduce((p, n) => {\n p[n.type] ??= []\n p[n.type].push(n)\n return p\n }, {})\n }\n\n const nodes = nodesByType['workflow/' + g]\n if (nodes) recreateNodes.push(...nodes)\n }\n\n await GroupNodeConfig.registerFromWorkflow(types, {})\n\n for (const node of recreateNodes) {\n node.recreate()\n }\n\n this.modifications = {}\n this.app.graph.setDirtyCanvas(true, true)\n this.changeGroup(this.selectedGroup, false)\n }\n },\n 'Save'\n ),\n $el(\n 'button.comfy-btn',\n { onclick: () => this.element.close() },\n 'Close'\n )\n ])\n ])\n\n this.element.replaceChildren(outer)\n this.changeGroup(\n type ? groupNodes.find((g) => 'workflow/' + g === type) : groupNodes[0]\n )\n this.element.showModal()\n\n this.element.addEventListener('close', () => {\n this.draggable?.dispose()\n })\n }\n}\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport { mergeIfValid } from './widgetInputs'\nimport { ManageGroupDialog } from './groupNodeManage'\nimport type { LGraphNode } from '@comfyorg/litegraph'\nimport { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'\n\nconst GROUP = Symbol()\n\nconst Workflow = {\n InUse: {\n Free: 0,\n Registered: 1,\n InWorkflow: 2\n },\n isInUseGroupNode(name) {\n const id = `workflow/${name}`\n // Check if lready registered/in use in this workflow\n if (app.graph.extra?.groupNodes?.[name]) {\n // @ts-expect-error\n if (app.graph._nodes.find((n) => n.type === id)) {\n return Workflow.InUse.InWorkflow\n } else {\n return Workflow.InUse.Registered\n }\n }\n return Workflow.InUse.Free\n },\n storeGroupNode(name, data) {\n let extra = app.graph.extra\n if (!extra) app.graph.extra = extra = {}\n let groupNodes = extra.groupNodes\n if (!groupNodes) extra.groupNodes = groupNodes = {}\n groupNodes[name] = data\n }\n}\n\nclass GroupNodeBuilder {\n nodes: LGraphNode[]\n nodeData: any\n\n constructor(nodes) {\n this.nodes = nodes\n }\n\n build() {\n const name = this.getName()\n if (!name) return\n\n // Sort the nodes so they are in execution order\n // this allows for widgets to be in the correct order when reconstructing\n this.sortNodes()\n\n this.nodeData = this.getNodeData()\n Workflow.storeGroupNode(name, this.nodeData)\n\n return { name, nodeData: this.nodeData }\n }\n\n getName() {\n const name = prompt('Enter group name')\n if (!name) return\n const used = Workflow.isInUseGroupNode(name)\n switch (used) {\n case Workflow.InUse.InWorkflow:\n alert(\n 'An in use group node with this name already exists embedded in this workflow, please remove any instances or use a new name.'\n )\n return\n case Workflow.InUse.Registered:\n if (\n !confirm(\n 'A group node with this name already exists embedded in this workflow, are you sure you want to overwrite it?'\n )\n ) {\n return\n }\n break\n }\n return name\n }\n\n sortNodes() {\n // Gets the builders nodes in graph execution order\n const nodesInOrder = app.graph.computeExecutionOrder(false)\n this.nodes = this.nodes\n .map((node) => ({ index: nodesInOrder.indexOf(node), node }))\n .sort((a, b) => a.index - b.index || a.node.id - b.node.id)\n .map(({ node }) => node)\n }\n\n getNodeData() {\n const storeLinkTypes = (config) => {\n // Store link types for dynamically typed nodes e.g. reroutes\n for (const link of config.links) {\n const origin = app.graph.getNodeById(link[4])\n const type = origin.outputs[link[1]].type\n link.push(type)\n }\n }\n\n const storeExternalLinks = (config) => {\n // Store any external links to the group in the config so when rebuilding we add extra slots\n config.external = []\n for (let i = 0; i < this.nodes.length; i++) {\n const node = this.nodes[i]\n if (!node.outputs?.length) continue\n for (let slot = 0; slot < node.outputs.length; slot++) {\n let hasExternal = false\n const output = node.outputs[slot]\n let type = output.type\n if (!output.links?.length) continue\n for (const l of output.links) {\n const link = app.graph.links[l]\n if (!link) continue\n if (type === '*') type = link.type\n\n if (!app.canvas.selected_nodes[link.target_id]) {\n hasExternal = true\n break\n }\n }\n if (hasExternal) {\n config.external.push([i, slot, type])\n }\n }\n }\n }\n\n // Use the built in copyToClipboard function to generate the node data we need\n const backup = localStorage.getItem('litegrapheditor_clipboard')\n try {\n // @ts-expect-error\n // TODO Figure out if copyToClipboard is really taking this param\n app.canvas.copyToClipboard(this.nodes)\n const config = JSON.parse(\n localStorage.getItem('litegrapheditor_clipboard')\n )\n\n storeLinkTypes(config)\n storeExternalLinks(config)\n\n return config\n } finally {\n localStorage.setItem('litegrapheditor_clipboard', backup)\n }\n }\n}\n\nexport class GroupNodeConfig {\n name: string\n nodeData: any\n inputCount: number\n oldToNewOutputMap: {}\n newToOldOutputMap: {}\n oldToNewInputMap: {}\n oldToNewWidgetMap: {}\n newToOldWidgetMap: {}\n primitiveDefs: {}\n widgetToPrimitive: {}\n primitiveToWidget: {}\n nodeInputs: {}\n outputVisibility: any[]\n nodeDef: any\n inputs: any[]\n linksFrom: {}\n linksTo: {}\n externalFrom: {}\n\n constructor(name, nodeData) {\n this.name = name\n this.nodeData = nodeData\n this.getLinks()\n\n this.inputCount = 0\n this.oldToNewOutputMap = {}\n this.newToOldOutputMap = {}\n this.oldToNewInputMap = {}\n this.oldToNewWidgetMap = {}\n this.newToOldWidgetMap = {}\n this.primitiveDefs = {}\n this.widgetToPrimitive = {}\n this.primitiveToWidget = {}\n this.nodeInputs = {}\n this.outputVisibility = []\n }\n\n async registerType(source = 'workflow') {\n this.nodeDef = {\n output: [],\n output_name: [],\n output_is_list: [],\n output_is_hidden: [],\n name: source + '/' + this.name,\n display_name: this.name,\n category: 'group nodes' + ('/' + source),\n input: { required: {} },\n\n [GROUP]: this\n }\n\n this.inputs = []\n const seenInputs = {}\n const seenOutputs = {}\n for (let i = 0; i < this.nodeData.nodes.length; i++) {\n const node = this.nodeData.nodes[i]\n node.index = i\n this.processNode(node, seenInputs, seenOutputs)\n }\n\n for (const p of this.#convertedToProcess) {\n p()\n }\n this.#convertedToProcess = null\n await app.registerNodeDef('workflow/' + this.name, this.nodeDef)\n }\n\n getLinks() {\n this.linksFrom = {}\n this.linksTo = {}\n this.externalFrom = {}\n\n // Extract links for easy lookup\n for (const l of this.nodeData.links) {\n const [sourceNodeId, sourceNodeSlot, targetNodeId, targetNodeSlot] = l\n\n // Skip links outside the copy config\n if (sourceNodeId == null) continue\n\n if (!this.linksFrom[sourceNodeId]) {\n this.linksFrom[sourceNodeId] = {}\n }\n if (!this.linksFrom[sourceNodeId][sourceNodeSlot]) {\n this.linksFrom[sourceNodeId][sourceNodeSlot] = []\n }\n this.linksFrom[sourceNodeId][sourceNodeSlot].push(l)\n\n if (!this.linksTo[targetNodeId]) {\n this.linksTo[targetNodeId] = {}\n }\n this.linksTo[targetNodeId][targetNodeSlot] = l\n }\n\n if (this.nodeData.external) {\n for (const ext of this.nodeData.external) {\n if (!this.externalFrom[ext[0]]) {\n this.externalFrom[ext[0]] = { [ext[1]]: ext[2] }\n } else {\n this.externalFrom[ext[0]][ext[1]] = ext[2]\n }\n }\n }\n }\n\n processNode(node, seenInputs, seenOutputs) {\n const def = this.getNodeDef(node)\n if (!def) return\n\n const inputs = { ...def.input?.required, ...def.input?.optional }\n\n this.inputs.push(this.processNodeInputs(node, seenInputs, inputs))\n if (def.output?.length) this.processNodeOutputs(node, seenOutputs, def)\n }\n\n getNodeDef(node) {\n const def = globalDefs[node.type]\n if (def) return def\n\n const linksFrom = this.linksFrom[node.index]\n if (node.type === 'PrimitiveNode') {\n // Skip as its not linked\n if (!linksFrom) return\n\n let type = linksFrom['0'][0][5]\n if (type === 'COMBO') {\n // Use the array items\n const source = node.outputs[0].widget.name\n const fromTypeName = this.nodeData.nodes[linksFrom['0'][0][2]].type\n const fromType = globalDefs[fromTypeName]\n const input =\n fromType.input.required[source] ?? fromType.input.optional[source]\n type = input[0]\n }\n\n const def = (this.primitiveDefs[node.index] = {\n input: {\n required: {\n value: [type, {}]\n }\n },\n output: [type],\n output_name: [],\n output_is_list: []\n })\n return def\n } else if (node.type === 'Reroute') {\n const linksTo = this.linksTo[node.index]\n if (linksTo && linksFrom && !this.externalFrom[node.index]?.[0]) {\n // Being used internally\n return null\n }\n\n let config = {}\n let rerouteType = '*'\n if (linksFrom) {\n for (const [, , id, slot] of linksFrom['0']) {\n const node = this.nodeData.nodes[id]\n const input = node.inputs[slot]\n if (rerouteType === '*') {\n rerouteType = input.type\n }\n if (input.widget) {\n const targetDef = globalDefs[node.type]\n const targetWidget =\n targetDef.input.required[input.widget.name] ??\n targetDef.input.optional[input.widget.name]\n\n const widget = [targetWidget[0], config]\n const res = mergeIfValid(\n {\n widget\n },\n targetWidget,\n false,\n null,\n widget\n )\n config = res?.customConfig ?? config\n }\n }\n } else if (linksTo) {\n const [id, slot] = linksTo['0']\n rerouteType = this.nodeData.nodes[id].outputs[slot].type\n } else {\n // Reroute used as a pipe\n for (const l of this.nodeData.links) {\n if (l[2] === node.index) {\n rerouteType = l[5]\n break\n }\n }\n if (rerouteType === '*') {\n // Check for an external link\n const t = this.externalFrom[node.index]?.[0]\n if (t) {\n rerouteType = t\n }\n }\n }\n\n // @ts-expect-error\n config.forceInput = true\n return {\n input: {\n required: {\n [rerouteType]: [rerouteType, config]\n }\n },\n output: [rerouteType],\n output_name: [],\n output_is_list: []\n }\n }\n\n console.warn(\n 'Skipping virtual node ' +\n node.type +\n ' when building group node ' +\n this.name\n )\n }\n\n getInputConfig(node, inputName, seenInputs, config, extra?) {\n const customConfig = this.nodeData.config?.[node.index]?.input?.[inputName]\n let name =\n customConfig?.name ??\n node.inputs?.find((inp) => inp.name === inputName)?.label ??\n inputName\n let key = name\n let prefix = ''\n // Special handling for primitive to include the title if it is set rather than just \"value\"\n if ((node.type === 'PrimitiveNode' && node.title) || name in seenInputs) {\n prefix = `${node.title ?? node.type} `\n key = name = `${prefix}${inputName}`\n if (name in seenInputs) {\n name = `${prefix}${seenInputs[name]} ${inputName}`\n }\n }\n seenInputs[key] = (seenInputs[key] ?? 1) + 1\n\n if (inputName === 'seed' || inputName === 'noise_seed') {\n if (!extra) extra = {}\n extra.control_after_generate = `${prefix}control_after_generate`\n }\n if (config[0] === 'IMAGEUPLOAD') {\n if (!extra) extra = {}\n extra.widget =\n this.oldToNewWidgetMap[node.index]?.[config[1]?.widget ?? 'image'] ??\n 'image'\n }\n\n if (extra) {\n config = [config[0], { ...config[1], ...extra }]\n }\n\n return { name, config, customConfig }\n }\n\n processWidgetInputs(inputs, node, inputNames, seenInputs) {\n const slots = []\n const converted = new Map()\n const widgetMap = (this.oldToNewWidgetMap[node.index] = {})\n for (const inputName of inputNames) {\n let widgetType = app.getWidgetType(inputs[inputName], inputName)\n if (widgetType) {\n const convertedIndex = node.inputs?.findIndex(\n (inp) => inp.name === inputName && inp.widget?.name === inputName\n )\n if (convertedIndex > -1) {\n // This widget has been converted to a widget\n // We need to store this in the correct position so link ids line up\n converted.set(convertedIndex, inputName)\n widgetMap[inputName] = null\n } else {\n // Normal widget\n const { name, config } = this.getInputConfig(\n node,\n inputName,\n seenInputs,\n inputs[inputName]\n )\n this.nodeDef.input.required[name] = config\n widgetMap[inputName] = name\n this.newToOldWidgetMap[name] = { node, inputName }\n }\n } else {\n // Normal input\n slots.push(inputName)\n }\n }\n return { converted, slots }\n }\n\n checkPrimitiveConnection(link, inputName, inputs) {\n const sourceNode = this.nodeData.nodes[link[0]]\n if (sourceNode.type === 'PrimitiveNode') {\n // Merge link configurations\n const [sourceNodeId, _, targetNodeId, __] = link\n const primitiveDef = this.primitiveDefs[sourceNodeId]\n const targetWidget = inputs[inputName]\n const primitiveConfig = primitiveDef.input.required.value\n const output = { widget: primitiveConfig }\n const config = mergeIfValid(\n output,\n targetWidget,\n false,\n null,\n primitiveConfig\n )\n primitiveConfig[1] =\n config?.customConfig ?? inputs[inputName][1]\n ? { ...inputs[inputName][1] }\n : {}\n\n let name = this.oldToNewWidgetMap[sourceNodeId]['value']\n name = name.substr(0, name.length - 6)\n primitiveConfig[1].control_after_generate = true\n primitiveConfig[1].control_prefix = name\n\n let toPrimitive = this.widgetToPrimitive[targetNodeId]\n if (!toPrimitive) {\n toPrimitive = this.widgetToPrimitive[targetNodeId] = {}\n }\n if (toPrimitive[inputName]) {\n toPrimitive[inputName].push(sourceNodeId)\n }\n toPrimitive[inputName] = sourceNodeId\n\n let toWidget = this.primitiveToWidget[sourceNodeId]\n if (!toWidget) {\n toWidget = this.primitiveToWidget[sourceNodeId] = []\n }\n toWidget.push({ nodeId: targetNodeId, inputName })\n }\n }\n\n processInputSlots(inputs, node, slots, linksTo, inputMap, seenInputs) {\n this.nodeInputs[node.index] = {}\n for (let i = 0; i < slots.length; i++) {\n const inputName = slots[i]\n if (linksTo[i]) {\n this.checkPrimitiveConnection(linksTo[i], inputName, inputs)\n // This input is linked so we can skip it\n continue\n }\n\n const { name, config, customConfig } = this.getInputConfig(\n node,\n inputName,\n seenInputs,\n inputs[inputName]\n )\n\n this.nodeInputs[node.index][inputName] = name\n if (customConfig?.visible === false) continue\n\n this.nodeDef.input.required[name] = config\n inputMap[i] = this.inputCount++\n }\n }\n\n processConvertedWidgets(\n inputs,\n node,\n slots,\n converted,\n linksTo,\n inputMap,\n seenInputs\n ) {\n // Add converted widgets sorted into their index order (ordered as they were converted) so link ids match up\n const convertedSlots = [...converted.keys()]\n .sort()\n .map((k) => converted.get(k))\n for (let i = 0; i < convertedSlots.length; i++) {\n const inputName = convertedSlots[i]\n if (linksTo[slots.length + i]) {\n this.checkPrimitiveConnection(\n linksTo[slots.length + i],\n inputName,\n inputs\n )\n // This input is linked so we can skip it\n continue\n }\n\n const { name, config } = this.getInputConfig(\n node,\n inputName,\n seenInputs,\n inputs[inputName],\n {\n defaultInput: true\n }\n )\n\n this.nodeDef.input.required[name] = config\n this.newToOldWidgetMap[name] = { node, inputName }\n\n if (!this.oldToNewWidgetMap[node.index]) {\n this.oldToNewWidgetMap[node.index] = {}\n }\n this.oldToNewWidgetMap[node.index][inputName] = name\n\n inputMap[slots.length + i] = this.inputCount++\n }\n }\n\n #convertedToProcess = []\n processNodeInputs(node, seenInputs, inputs) {\n const inputMapping = []\n\n const inputNames = Object.keys(inputs)\n if (!inputNames.length) return\n\n const { converted, slots } = this.processWidgetInputs(\n inputs,\n node,\n inputNames,\n seenInputs\n )\n const linksTo = this.linksTo[node.index] ?? {}\n const inputMap = (this.oldToNewInputMap[node.index] = {})\n this.processInputSlots(inputs, node, slots, linksTo, inputMap, seenInputs)\n\n // Converted inputs have to be processed after all other nodes as they'll be at the end of the list\n this.#convertedToProcess.push(() =>\n this.processConvertedWidgets(\n inputs,\n node,\n slots,\n converted,\n linksTo,\n inputMap,\n seenInputs\n )\n )\n\n return inputMapping\n }\n\n processNodeOutputs(node, seenOutputs, def) {\n const oldToNew = (this.oldToNewOutputMap[node.index] = {})\n\n // Add outputs\n for (let outputId = 0; outputId < def.output.length; outputId++) {\n const linksFrom = this.linksFrom[node.index]\n // If this output is linked internally we flag it to hide\n const hasLink =\n linksFrom?.[outputId] && !this.externalFrom[node.index]?.[outputId]\n const customConfig =\n this.nodeData.config?.[node.index]?.output?.[outputId]\n const visible = customConfig?.visible ?? !hasLink\n this.outputVisibility.push(visible)\n if (!visible) {\n continue\n }\n\n oldToNew[outputId] = this.nodeDef.output.length\n this.newToOldOutputMap[this.nodeDef.output.length] = {\n node,\n slot: outputId\n }\n this.nodeDef.output.push(def.output[outputId])\n this.nodeDef.output_is_list.push(def.output_is_list[outputId])\n\n let label = customConfig?.name\n if (!label) {\n label = def.output_name?.[outputId] ?? def.output[outputId]\n const output = node.outputs.find((o) => o.name === label)\n if (output?.label) {\n label = output.label\n }\n }\n\n let name = label\n if (name in seenOutputs) {\n const prefix = `${node.title ?? node.type} `\n name = `${prefix}${label}`\n if (name in seenOutputs) {\n name = `${prefix}${node.index} ${label}`\n }\n }\n seenOutputs[name] = 1\n\n this.nodeDef.output_name.push(name)\n }\n }\n\n static async registerFromWorkflow(groupNodes, missingNodeTypes) {\n const clean = app.clean\n app.clean = function () {\n for (const g in groupNodes) {\n try {\n LiteGraph.unregisterNodeType('workflow/' + g)\n } catch (error) {}\n }\n app.clean = clean\n }\n\n for (const g in groupNodes) {\n const groupData = groupNodes[g]\n\n let hasMissing = false\n for (const n of groupData.nodes) {\n // Find missing node types\n if (!(n.type in LiteGraph.registered_node_types)) {\n missingNodeTypes.push({\n type: n.type,\n hint: ` (In group node 'workflow/${g}')`\n })\n\n missingNodeTypes.push({\n type: 'workflow/' + g,\n action: {\n text: 'Remove from workflow',\n callback: (e) => {\n delete groupNodes[g]\n e.target.textContent = 'Removed'\n e.target.style.pointerEvents = 'none'\n e.target.style.opacity = 0.7\n }\n }\n })\n\n hasMissing = true\n }\n }\n\n if (hasMissing) continue\n\n const config = new GroupNodeConfig(g, groupData)\n await config.registerType()\n }\n }\n}\n\nexport class GroupNodeHandler {\n node\n groupData\n innerNodes: any\n\n constructor(node) {\n this.node = node\n this.groupData = node.constructor?.nodeData?.[GROUP]\n\n this.node.setInnerNodes = (innerNodes) => {\n this.innerNodes = innerNodes\n\n for (\n let innerNodeIndex = 0;\n innerNodeIndex < this.innerNodes.length;\n innerNodeIndex++\n ) {\n const innerNode = this.innerNodes[innerNodeIndex]\n\n for (const w of innerNode.widgets ?? []) {\n if (w.type === 'converted-widget') {\n w.serializeValue = w.origSerializeValue\n }\n }\n\n innerNode.index = innerNodeIndex\n innerNode.getInputNode = (slot) => {\n // Check if this input is internal or external\n const externalSlot =\n this.groupData.oldToNewInputMap[innerNode.index]?.[slot]\n if (externalSlot != null) {\n return this.node.getInputNode(externalSlot)\n }\n\n // Internal link\n const innerLink = this.groupData.linksTo[innerNode.index]?.[slot]\n if (!innerLink) return null\n\n const inputNode = innerNodes[innerLink[0]]\n // Primitives will already apply their values\n if (inputNode.type === 'PrimitiveNode') return null\n\n return inputNode\n }\n\n innerNode.getInputLink = (slot) => {\n const externalSlot =\n this.groupData.oldToNewInputMap[innerNode.index]?.[slot]\n if (externalSlot != null) {\n // The inner node is connected via the group node inputs\n const linkId = this.node.inputs[externalSlot].link\n let link = app.graph.links[linkId]\n\n // Use the outer link, but update the target to the inner node\n // @ts-expect-error\n // TODO: Fix this\n link = {\n ...link,\n target_id: innerNode.id,\n target_slot: +slot\n }\n return link\n }\n\n let link = this.groupData.linksTo[innerNode.index]?.[slot]\n if (!link) return null\n // Use the inner link, but update the origin node to be inner node id\n link = {\n origin_id: innerNodes[link[0]].id,\n origin_slot: link[1],\n target_id: innerNode.id,\n target_slot: +slot\n }\n return link\n }\n }\n }\n\n this.node.updateLink = (link) => {\n // Replace the group node reference with the internal node\n link = { ...link }\n const output = this.groupData.newToOldOutputMap[link.origin_slot]\n let innerNode = this.innerNodes[output.node.index]\n let l\n while (innerNode?.type === 'Reroute') {\n l = innerNode.getInputLink(0)\n innerNode = innerNode.getInputNode(0)\n }\n\n if (!innerNode) {\n return null\n }\n\n if (l && GroupNodeHandler.isGroupNode(innerNode)) {\n return innerNode.updateLink(l)\n }\n\n link.origin_id = innerNode.id\n link.origin_slot = l?.origin_slot ?? output.slot\n return link\n }\n\n this.node.getInnerNodes = () => {\n if (!this.innerNodes) {\n this.node.setInnerNodes(\n this.groupData.nodeData.nodes.map((n, i) => {\n const innerNode = LiteGraph.createNode(n.type)\n innerNode.configure(n)\n // @ts-expect-error\n innerNode.id = `${this.node.id}:${i}`\n return innerNode\n })\n )\n }\n\n this.updateInnerWidgets()\n\n return this.innerNodes\n }\n\n this.node.recreate = async () => {\n const id = this.node.id\n const sz = this.node.size\n const nodes = this.node.convertToNodes()\n\n const groupNode = LiteGraph.createNode(this.node.type)\n groupNode.id = id\n\n // Reuse the existing nodes for this instance\n groupNode.setInnerNodes(nodes)\n groupNode[GROUP].populateWidgets()\n app.graph.add(groupNode)\n groupNode.size = [\n Math.max(groupNode.size[0], sz[0]),\n Math.max(groupNode.size[1], sz[1])\n ]\n\n // Remove all converted nodes and relink them\n groupNode[GROUP].replaceNodes(nodes)\n return groupNode\n }\n\n this.node.convertToNodes = () => {\n const addInnerNodes = () => {\n const backup = localStorage.getItem('litegrapheditor_clipboard')\n // Clone the node data so we dont mutate it for other nodes\n const c = { ...this.groupData.nodeData }\n c.nodes = [...c.nodes]\n const innerNodes = this.node.getInnerNodes()\n let ids = []\n for (let i = 0; i < c.nodes.length; i++) {\n let id = innerNodes?.[i]?.id\n // Use existing IDs if they are set on the inner nodes\n if (id == null || isNaN(id)) {\n id = undefined\n } else {\n ids.push(id)\n }\n c.nodes[i] = { ...c.nodes[i], id }\n }\n localStorage.setItem('litegrapheditor_clipboard', JSON.stringify(c))\n app.canvas.pasteFromClipboard()\n localStorage.setItem('litegrapheditor_clipboard', backup)\n\n const [x, y] = this.node.pos\n let top\n let left\n // Configure nodes with current widget data\n const selectedIds = ids.length\n ? ids\n : Object.keys(app.canvas.selected_nodes)\n const newNodes = []\n for (let i = 0; i < selectedIds.length; i++) {\n const id = selectedIds[i]\n const newNode = app.graph.getNodeById(id)\n const innerNode = innerNodes[i]\n newNodes.push(newNode)\n\n if (left == null || newNode.pos[0] < left) {\n left = newNode.pos[0]\n }\n if (top == null || newNode.pos[1] < top) {\n top = newNode.pos[1]\n }\n\n if (!newNode.widgets) continue\n\n const map = this.groupData.oldToNewWidgetMap[innerNode.index]\n if (map) {\n const widgets = Object.keys(map)\n\n for (const oldName of widgets) {\n const newName = map[oldName]\n if (!newName) continue\n\n const widgetIndex = this.node.widgets.findIndex(\n (w) => w.name === newName\n )\n if (widgetIndex === -1) continue\n\n // Populate the main and any linked widgets\n if (innerNode.type === 'PrimitiveNode') {\n for (let i = 0; i < newNode.widgets.length; i++) {\n newNode.widgets[i].value =\n this.node.widgets[widgetIndex + i].value\n }\n } else {\n const outerWidget = this.node.widgets[widgetIndex]\n const newWidget = newNode.widgets.find(\n (w) => w.name === oldName\n )\n if (!newWidget) continue\n\n newWidget.value = outerWidget.value\n for (let w = 0; w < outerWidget.linkedWidgets?.length; w++) {\n newWidget.linkedWidgets[w].value =\n outerWidget.linkedWidgets[w].value\n }\n }\n }\n }\n }\n\n // Shift each node\n for (const newNode of newNodes) {\n newNode.pos = [\n newNode.pos[0] - (left - x),\n newNode.pos[1] - (top - y)\n ]\n }\n\n return { newNodes, selectedIds }\n }\n\n const reconnectInputs = (selectedIds) => {\n for (const innerNodeIndex in this.groupData.oldToNewInputMap) {\n const id = selectedIds[innerNodeIndex]\n const newNode = app.graph.getNodeById(id)\n const map = this.groupData.oldToNewInputMap[innerNodeIndex]\n for (const innerInputId in map) {\n const groupSlotId = map[innerInputId]\n if (groupSlotId == null) continue\n const slot = node.inputs[groupSlotId]\n if (slot.link == null) continue\n const link = app.graph.links[slot.link]\n if (!link) continue\n // connect this node output to the input of another node\n const originNode = app.graph.getNodeById(link.origin_id)\n originNode.connect(link.origin_slot, newNode, +innerInputId)\n }\n }\n }\n\n const reconnectOutputs = (selectedIds) => {\n for (\n let groupOutputId = 0;\n groupOutputId < node.outputs?.length;\n groupOutputId++\n ) {\n const output = node.outputs[groupOutputId]\n if (!output.links) continue\n const links = [...output.links]\n for (const l of links) {\n const slot = this.groupData.newToOldOutputMap[groupOutputId]\n const link = app.graph.links[l]\n const targetNode = app.graph.getNodeById(link.target_id)\n const newNode = app.graph.getNodeById(selectedIds[slot.node.index])\n newNode.connect(slot.slot, targetNode, link.target_slot)\n }\n }\n }\n\n const { newNodes, selectedIds } = addInnerNodes()\n reconnectInputs(selectedIds)\n reconnectOutputs(selectedIds)\n app.graph.remove(this.node)\n\n return newNodes\n }\n\n const getExtraMenuOptions = this.node.getExtraMenuOptions\n this.node.getExtraMenuOptions = function (_, options) {\n getExtraMenuOptions?.apply(this, arguments)\n\n let optionIndex = options.findIndex((o) => o.content === 'Outputs')\n if (optionIndex === -1) optionIndex = options.length\n else optionIndex++\n options.splice(\n optionIndex,\n 0,\n null,\n {\n content: 'Convert to nodes',\n callback: () => {\n return this.convertToNodes()\n }\n },\n {\n content: 'Manage Group Node',\n callback: () => {\n new ManageGroupDialog(app).show(this.type)\n }\n }\n )\n }\n\n // Draw custom collapse icon to identity this as a group\n const onDrawTitleBox = this.node.onDrawTitleBox\n this.node.onDrawTitleBox = function (ctx, height, size, scale) {\n onDrawTitleBox?.apply(this, arguments)\n\n const fill = ctx.fillStyle\n ctx.beginPath()\n ctx.rect(11, -height + 11, 2, 2)\n ctx.rect(14, -height + 11, 2, 2)\n ctx.rect(17, -height + 11, 2, 2)\n ctx.rect(11, -height + 14, 2, 2)\n ctx.rect(14, -height + 14, 2, 2)\n ctx.rect(17, -height + 14, 2, 2)\n ctx.rect(11, -height + 17, 2, 2)\n ctx.rect(14, -height + 17, 2, 2)\n ctx.rect(17, -height + 17, 2, 2)\n\n ctx.fillStyle = this.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR\n ctx.fill()\n ctx.fillStyle = fill\n }\n\n // Draw progress label\n const onDrawForeground = node.onDrawForeground\n const groupData = this.groupData.nodeData\n node.onDrawForeground = function (ctx) {\n const r = onDrawForeground?.apply?.(this, arguments)\n if (\n +app.runningNodeId === this.id &&\n this.runningInternalNodeId !== null\n ) {\n const n = groupData.nodes[this.runningInternalNodeId]\n if (!n) return\n const message = `Running ${n.title || n.type} (${this.runningInternalNodeId}/${groupData.nodes.length})`\n ctx.save()\n ctx.font = '12px sans-serif'\n const sz = ctx.measureText(message)\n ctx.fillStyle = node.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR\n ctx.beginPath()\n ctx.roundRect(\n 0,\n -LiteGraph.NODE_TITLE_HEIGHT - 20,\n sz.width + 12,\n 20,\n 5\n )\n ctx.fill()\n\n ctx.fillStyle = '#fff'\n ctx.fillText(message, 6, -LiteGraph.NODE_TITLE_HEIGHT - 6)\n ctx.restore()\n }\n }\n\n // Flag this node as needing to be reset\n const onExecutionStart = this.node.onExecutionStart\n this.node.onExecutionStart = function () {\n this.resetExecution = true\n return onExecutionStart?.apply(this, arguments)\n }\n\n const self = this\n const onNodeCreated = this.node.onNodeCreated\n this.node.onNodeCreated = function () {\n if (!this.widgets) {\n return\n }\n const config = self.groupData.nodeData.config\n if (config) {\n for (const n in config) {\n const inputs = config[n]?.input\n for (const w in inputs) {\n if (inputs[w].visible !== false) continue\n const widgetName = self.groupData.oldToNewWidgetMap[n][w]\n const widget = this.widgets.find((w) => w.name === widgetName)\n if (widget) {\n widget.type = 'hidden'\n widget.computeSize = () => [0, -4]\n }\n }\n }\n }\n\n return onNodeCreated?.apply(this, arguments)\n }\n\n function handleEvent(type, getId, getEvent) {\n const handler = ({ detail }) => {\n const id = getId(detail)\n if (!id) return\n const node = app.graph.getNodeById(id)\n if (node) return\n\n const innerNodeIndex = this.innerNodes?.findIndex((n) => n.id == id)\n if (innerNodeIndex > -1) {\n this.node.runningInternalNodeId = innerNodeIndex\n api.dispatchEvent(\n new CustomEvent(type, {\n detail: getEvent(detail, this.node.id + '', this.node)\n })\n )\n }\n }\n api.addEventListener(type, handler)\n return handler\n }\n\n const executing = handleEvent.call(\n this,\n 'executing',\n (d) => d,\n (d, id, node) => id\n )\n\n const executed = handleEvent.call(\n this,\n 'executed',\n (d) => d?.display_node || d?.node,\n (d, id, node) => ({\n ...d,\n node: id,\n display_node: id,\n merge: !node.resetExecution\n })\n )\n\n const onRemoved = node.onRemoved\n this.node.onRemoved = function () {\n onRemoved?.apply(this, arguments)\n api.removeEventListener('executing', executing)\n api.removeEventListener('executed', executed)\n }\n\n this.node.refreshComboInNode = (defs) => {\n // Update combo widget options\n for (const widgetName in this.groupData.newToOldWidgetMap) {\n const widget = this.node.widgets.find((w) => w.name === widgetName)\n if (widget?.type === 'combo') {\n const old = this.groupData.newToOldWidgetMap[widgetName]\n const def = defs[old.node.type]\n const input =\n def?.input?.required?.[old.inputName] ??\n def?.input?.optional?.[old.inputName]\n if (!input) continue\n\n widget.options.values = input[0]\n\n if (\n old.inputName !== 'image' &&\n !widget.options.values.includes(widget.value)\n ) {\n widget.value = widget.options.values[0]\n widget.callback(widget.value)\n }\n }\n }\n }\n }\n\n updateInnerWidgets() {\n for (const newWidgetName in this.groupData.newToOldWidgetMap) {\n const newWidget = this.node.widgets.find((w) => w.name === newWidgetName)\n if (!newWidget) continue\n\n const newValue = newWidget.value\n const old = this.groupData.newToOldWidgetMap[newWidgetName]\n let innerNode = this.innerNodes[old.node.index]\n\n if (innerNode.type === 'PrimitiveNode') {\n innerNode.primitiveValue = newValue\n const primitiveLinked = this.groupData.primitiveToWidget[old.node.index]\n for (const linked of primitiveLinked ?? []) {\n const node = this.innerNodes[linked.nodeId]\n const widget = node.widgets.find((w) => w.name === linked.inputName)\n\n if (widget) {\n widget.value = newValue\n }\n }\n continue\n } else if (innerNode.type === 'Reroute') {\n const rerouteLinks = this.groupData.linksFrom[old.node.index]\n if (rerouteLinks) {\n for (const [_, , targetNodeId, targetSlot] of rerouteLinks['0']) {\n const node = this.innerNodes[targetNodeId]\n const input = node.inputs[targetSlot]\n if (input.widget) {\n const widget = node.widgets?.find(\n (w) => w.name === input.widget.name\n )\n if (widget) {\n widget.value = newValue\n }\n }\n }\n }\n }\n\n const widget = innerNode.widgets?.find((w) => w.name === old.inputName)\n if (widget) {\n widget.value = newValue\n }\n }\n }\n\n populatePrimitive(node, nodeId, oldName, i, linkedShift) {\n // Converted widget, populate primitive if linked\n const primitiveId = this.groupData.widgetToPrimitive[nodeId]?.[oldName]\n if (primitiveId == null) return\n const targetWidgetName =\n this.groupData.oldToNewWidgetMap[primitiveId]['value']\n const targetWidgetIndex = this.node.widgets.findIndex(\n (w) => w.name === targetWidgetName\n )\n if (targetWidgetIndex > -1) {\n const primitiveNode = this.innerNodes[primitiveId]\n let len = primitiveNode.widgets.length\n if (\n len - 1 !==\n this.node.widgets[targetWidgetIndex].linkedWidgets?.length\n ) {\n // Fallback handling for if some reason the primitive has a different number of widgets\n // we dont want to overwrite random widgets, better to leave blank\n len = 1\n }\n for (let i = 0; i < len; i++) {\n this.node.widgets[targetWidgetIndex + i].value =\n primitiveNode.widgets[i].value\n }\n }\n return true\n }\n\n populateReroute(node, nodeId, map) {\n if (node.type !== 'Reroute') return\n\n const link = this.groupData.linksFrom[nodeId]?.[0]?.[0]\n if (!link) return\n const [, , targetNodeId, targetNodeSlot] = link\n const targetNode = this.groupData.nodeData.nodes[targetNodeId]\n const inputs = targetNode.inputs\n const targetWidget = inputs?.[targetNodeSlot]?.widget\n if (!targetWidget) return\n\n const offset = inputs.length - (targetNode.widgets_values?.length ?? 0)\n const v = targetNode.widgets_values?.[targetNodeSlot - offset]\n if (v == null) return\n\n const widgetName = Object.values(map)[0]\n const widget = this.node.widgets.find((w) => w.name === widgetName)\n if (widget) {\n widget.value = v\n }\n }\n\n populateWidgets() {\n if (!this.node.widgets) return\n\n for (\n let nodeId = 0;\n nodeId < this.groupData.nodeData.nodes.length;\n nodeId++\n ) {\n const node = this.groupData.nodeData.nodes[nodeId]\n const map = this.groupData.oldToNewWidgetMap[nodeId] ?? {}\n const widgets = Object.keys(map)\n\n if (!node.widgets_values?.length) {\n // special handling for populating values into reroutes\n // this allows primitives connect to them to pick up the correct value\n this.populateReroute(node, nodeId, map)\n continue\n }\n\n let linkedShift = 0\n for (let i = 0; i < widgets.length; i++) {\n const oldName = widgets[i]\n const newName = map[oldName]\n const widgetIndex = this.node.widgets.findIndex(\n (w) => w.name === newName\n )\n const mainWidget = this.node.widgets[widgetIndex]\n if (\n this.populatePrimitive(node, nodeId, oldName, i, linkedShift) ||\n widgetIndex === -1\n ) {\n // Find the inner widget and shift by the number of linked widgets as they will have been removed too\n const innerWidget = this.innerNodes[nodeId].widgets?.find(\n (w) => w.name === oldName\n )\n linkedShift += innerWidget?.linkedWidgets?.length ?? 0\n }\n if (widgetIndex === -1) {\n continue\n }\n\n // Populate the main and any linked widget\n mainWidget.value = node.widgets_values[i + linkedShift]\n for (let w = 0; w < mainWidget.linkedWidgets?.length; w++) {\n this.node.widgets[widgetIndex + w + 1].value =\n node.widgets_values[i + ++linkedShift]\n }\n }\n }\n }\n\n replaceNodes(nodes) {\n let top\n let left\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]\n if (left == null || node.pos[0] < left) {\n left = node.pos[0]\n }\n if (top == null || node.pos[1] < top) {\n top = node.pos[1]\n }\n\n this.linkOutputs(node, i)\n app.graph.remove(node)\n }\n\n this.linkInputs()\n this.node.pos = [left, top]\n }\n\n linkOutputs(originalNode, nodeId) {\n if (!originalNode.outputs) return\n\n for (const output of originalNode.outputs) {\n if (!output.links) continue\n // Clone the links as they'll be changed if we reconnect\n const links = [...output.links]\n for (const l of links) {\n const link = app.graph.links[l]\n if (!link) continue\n\n const targetNode = app.graph.getNodeById(link.target_id)\n const newSlot =\n this.groupData.oldToNewOutputMap[nodeId]?.[link.origin_slot]\n if (newSlot != null) {\n this.node.connect(newSlot, targetNode, link.target_slot)\n }\n }\n }\n }\n\n linkInputs() {\n for (const link of this.groupData.nodeData.links ?? []) {\n const [, originSlot, targetId, targetSlot, actualOriginId] = link\n const originNode = app.graph.getNodeById(actualOriginId)\n if (!originNode) continue // this node is in the group\n originNode.connect(\n originSlot,\n this.node.id,\n this.groupData.oldToNewInputMap[targetId][targetSlot]\n )\n }\n }\n\n static getGroupData(node) {\n return (node.nodeData ?? node.constructor?.nodeData)?.[GROUP]\n }\n\n static isGroupNode(node) {\n return !!node.constructor?.nodeData?.[GROUP]\n }\n\n static async fromNodes(nodes) {\n // Process the nodes into the stored workflow group node data\n const builder = new GroupNodeBuilder(nodes)\n const res = builder.build()\n if (!res) return\n\n const { name, nodeData } = res\n\n // Convert this data into a LG node definition and register it\n const config = new GroupNodeConfig(name, nodeData)\n await config.registerType()\n\n const groupNode = LiteGraph.createNode(`workflow/${name}`)\n // Reuse the existing nodes for this instance\n groupNode.setInnerNodes(builder.nodes)\n groupNode[GROUP].populateWidgets()\n app.graph.add(groupNode)\n\n // Remove all converted nodes and relink them\n groupNode[GROUP].replaceNodes(builder.nodes)\n return groupNode\n }\n}\n\nfunction addConvertToGroupOptions() {\n function addConvertOption(options, index) {\n const selected = Object.values(app.canvas.selected_nodes ?? {})\n const disabled =\n selected.length < 2 ||\n selected.find((n) => GroupNodeHandler.isGroupNode(n))\n options.splice(index + 1, null, {\n content: `Convert to Group Node`,\n disabled,\n callback: async () => {\n return await GroupNodeHandler.fromNodes(selected)\n }\n })\n }\n\n function addManageOption(options, index) {\n const groups = app.graph.extra?.groupNodes\n const disabled = !groups || !Object.keys(groups).length\n options.splice(index + 1, null, {\n content: `Manage Group Nodes`,\n disabled,\n callback: () => {\n new ManageGroupDialog(app).show()\n }\n })\n }\n\n // Add to canvas\n const getCanvasMenuOptions = LGraphCanvas.prototype.getCanvasMenuOptions\n LGraphCanvas.prototype.getCanvasMenuOptions = function () {\n const options = getCanvasMenuOptions.apply(this, arguments)\n const index =\n options.findIndex((o) => o?.content === 'Add Group') + 1 || options.length\n addConvertOption(options, index)\n addManageOption(options, index + 1)\n return options\n }\n\n // Add to nodes\n const getNodeMenuOptions = LGraphCanvas.prototype.getNodeMenuOptions\n LGraphCanvas.prototype.getNodeMenuOptions = function (node) {\n const options = getNodeMenuOptions.apply(this, arguments)\n if (!GroupNodeHandler.isGroupNode(node)) {\n const index =\n options.findIndex((o) => o?.content === 'Outputs') + 1 ||\n options.length - 1\n addConvertOption(options, index)\n }\n return options\n }\n}\n\nconst id = 'Comfy.GroupNode'\nlet globalDefs\nconst ext = {\n name: id,\n setup() {\n addConvertToGroupOptions()\n },\n async beforeConfigureGraph(graphData, missingNodeTypes) {\n const nodes = graphData?.extra?.groupNodes\n if (nodes) {\n await GroupNodeConfig.registerFromWorkflow(nodes, missingNodeTypes)\n }\n },\n addCustomNodeDefs(defs) {\n // Store this so we can mutate it later with group nodes\n globalDefs = defs\n },\n nodeCreated(node) {\n if (GroupNodeHandler.isGroupNode(node)) {\n node[GROUP] = new GroupNodeHandler(node)\n }\n },\n async refreshComboInNodes(defs) {\n // Re-register group nodes so new ones are created with the correct options\n Object.assign(globalDefs, defs)\n const nodes = app.graph.extra?.groupNodes\n if (nodes) {\n await GroupNodeConfig.registerFromWorkflow(nodes, {})\n }\n }\n}\n\napp.registerExtension(ext)\n","import { app } from '../../scripts/app'\nimport { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'\n\nfunction setNodeMode(node, mode) {\n node.mode = mode\n node.graph.change()\n}\n\nfunction addNodesToGroup(group, nodes = []) {\n var x1, y1, x2, y2\n var nx1, ny1, nx2, ny2\n var node\n\n x1 = y1 = x2 = y2 = -1\n nx1 = ny1 = nx2 = ny2 = -1\n\n for (var n of [group._nodes, nodes]) {\n for (var i in n) {\n node = n[i]\n\n nx1 = node.pos[0]\n ny1 = node.pos[1]\n nx2 = node.pos[0] + node.size[0]\n ny2 = node.pos[1] + node.size[1]\n\n if (node.type != 'Reroute') {\n ny1 -= LiteGraph.NODE_TITLE_HEIGHT\n }\n\n if (node.flags?.collapsed) {\n ny2 = ny1 + LiteGraph.NODE_TITLE_HEIGHT\n\n if (node?._collapsed_width) {\n nx2 = nx1 + Math.round(node._collapsed_width)\n }\n }\n\n if (x1 == -1 || nx1 < x1) {\n x1 = nx1\n }\n\n if (y1 == -1 || ny1 < y1) {\n y1 = ny1\n }\n\n if (x2 == -1 || nx2 > x2) {\n x2 = nx2\n }\n\n if (y2 == -1 || ny2 > y2) {\n y2 = ny2\n }\n }\n }\n\n var padding = 10\n\n y1 = y1 - Math.round(group.font_size * 1.4)\n\n group.pos = [x1 - padding, y1 - padding]\n group.size = [x2 - x1 + padding * 2, y2 - y1 + padding * 2]\n}\n\napp.registerExtension({\n name: 'Comfy.GroupOptions',\n setup() {\n const orig = LGraphCanvas.prototype.getCanvasMenuOptions\n // graph_mouse\n LGraphCanvas.prototype.getCanvasMenuOptions = function () {\n const options = orig.apply(this, arguments)\n const group = this.graph.getGroupOnPos(\n this.graph_mouse[0],\n this.graph_mouse[1]\n )\n if (!group) {\n options.push({\n content: 'Add Group For Selected Nodes',\n disabled: !Object.keys(app.canvas.selected_nodes || {}).length,\n callback: () => {\n // @ts-expect-error\n var group = new LiteGraph.LGraphGroup()\n addNodesToGroup(group, this.selected_nodes)\n app.canvas.graph.add(group)\n this.graph.change()\n }\n })\n\n return options\n }\n\n // Group nodes aren't recomputed until the group is moved, this ensures the nodes are up-to-date\n group.recomputeInsideNodes()\n const nodesInGroup = group._nodes\n\n options.push({\n content: 'Add Selected Nodes To Group',\n disabled: !Object.keys(app.canvas.selected_nodes || {}).length,\n callback: () => {\n addNodesToGroup(group, this.selected_nodes)\n this.graph.change()\n }\n })\n\n // No nodes in group, return default options\n if (nodesInGroup.length === 0) {\n return options\n } else {\n // Add a separator between the default options and the group options\n options.push(null)\n }\n\n // Check if all nodes are the same mode\n let allNodesAreSameMode = true\n for (let i = 1; i < nodesInGroup.length; i++) {\n if (nodesInGroup[i].mode !== nodesInGroup[0].mode) {\n allNodesAreSameMode = false\n break\n }\n }\n\n options.push({\n content: 'Fit Group To Nodes',\n callback: () => {\n addNodesToGroup(group)\n this.graph.change()\n }\n })\n\n options.push({\n content: 'Select Nodes',\n callback: () => {\n this.selectNodes(nodesInGroup)\n this.graph.change()\n this.canvas.focus()\n }\n })\n\n // Modes\n // 0: Always\n // 1: On Event\n // 2: Never\n // 3: On Trigger\n // 4: Bypass\n // If all nodes are the same mode, add a menu option to change the mode\n if (allNodesAreSameMode) {\n const mode = nodesInGroup[0].mode\n switch (mode) {\n case 0:\n // All nodes are always, option to disable, and bypass\n options.push({\n content: 'Set Group Nodes to Never',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 2)\n }\n }\n })\n options.push({\n content: 'Bypass Group Nodes',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 4)\n }\n }\n })\n break\n case 2:\n // All nodes are never, option to enable, and bypass\n options.push({\n content: 'Set Group Nodes to Always',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 0)\n }\n }\n })\n options.push({\n content: 'Bypass Group Nodes',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 4)\n }\n }\n })\n break\n case 4:\n // All nodes are bypass, option to enable, and disable\n options.push({\n content: 'Set Group Nodes to Always',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 0)\n }\n }\n })\n options.push({\n content: 'Set Group Nodes to Never',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 2)\n }\n }\n })\n break\n default:\n // All nodes are On Trigger or On Event(Or other?), option to disable, set to always, or bypass\n options.push({\n content: 'Set Group Nodes to Always',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 0)\n }\n }\n })\n options.push({\n content: 'Set Group Nodes to Never',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 2)\n }\n }\n })\n options.push({\n content: 'Bypass Group Nodes',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 4)\n }\n }\n })\n break\n }\n } else {\n // Nodes are not all the same mode, add a menu option to change the mode to always, never, or bypass\n options.push({\n content: 'Set Group Nodes to Always',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 0)\n }\n }\n })\n options.push({\n content: 'Set Group Nodes to Never',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 2)\n }\n }\n })\n options.push({\n content: 'Bypass Group Nodes',\n callback: () => {\n for (const node of nodesInGroup) {\n setNodeMode(node, 4)\n }\n }\n })\n }\n\n return options\n }\n }\n})\n","import { LiteGraph } from '@comfyorg/litegraph'\nimport { app } from '../../scripts/app'\n\n// Inverts the scrolling of context menus\n\nconst id = 'Comfy.InvertMenuScrolling'\napp.registerExtension({\n name: id,\n init() {\n const ctxMenu = LiteGraph.ContextMenu\n const replace = () => {\n // @ts-expect-error\n LiteGraph.ContextMenu = function (values, options) {\n options = options || {}\n if (options.scroll_speed) {\n options.scroll_speed *= -1\n } else {\n options.scroll_speed = -0.1\n }\n return ctxMenu.call(this, values, options)\n }\n LiteGraph.ContextMenu.prototype = ctxMenu.prototype\n }\n app.ui.settings.addSetting({\n id,\n category: ['Comfy', 'Graph', 'InvertMenuScrolling'],\n name: 'Invert Context Menu Scrolling',\n type: 'boolean',\n defaultValue: false,\n onChange(value) {\n if (value) {\n replace()\n } else {\n LiteGraph.ContextMenu = ctxMenu\n }\n }\n })\n }\n})\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport { useToastStore } from '@/stores/toastStore'\n\napp.registerExtension({\n name: 'Comfy.Keybinds',\n init() {\n const keybindListener = async function (event) {\n const modifierPressed = event.ctrlKey || event.metaKey\n\n // Queue prompt using (ctrl or command) + enter\n if (modifierPressed && event.key === 'Enter') {\n // Cancel current prompt using (ctrl or command) + alt + enter\n if (event.altKey) {\n await api.interrupt()\n useToastStore().add({\n severity: 'info',\n summary: 'Interrupted',\n detail: 'Execution has been interrupted',\n life: 1000\n })\n return\n }\n // Queue prompt as first for generation using (ctrl or command) + shift + enter\n app.queuePrompt(event.shiftKey ? -1 : 0).then()\n return\n }\n\n const target = event.composedPath()[0]\n if (\n target.tagName === 'TEXTAREA' ||\n target.tagName === 'INPUT' ||\n (target.tagName === 'SPAN' &&\n target.classList.contains('property_value'))\n ) {\n return\n }\n\n const modifierKeyIdMap = {\n s: '#comfy-save-button',\n o: '#comfy-file-input',\n Backspace: '#comfy-clear-button',\n d: '#comfy-load-default-button',\n g: '#comfy-group-selected-nodes-button'\n }\n\n const modifierKeybindId = modifierKeyIdMap[event.key]\n if (modifierPressed && modifierKeybindId) {\n event.preventDefault()\n\n const elem = document.querySelector(modifierKeybindId)\n elem.click()\n return\n }\n\n // Finished Handling all modifier keybinds, now handle the rest\n if (event.ctrlKey || event.altKey || event.metaKey) {\n return\n }\n\n // Close out of modals using escape\n if (event.key === 'Escape') {\n const modals = document.querySelectorAll<HTMLElement>('.comfy-modal')\n const modal = Array.from(modals).find(\n (modal) =>\n window.getComputedStyle(modal).getPropertyValue('display') !==\n 'none'\n )\n if (modal) {\n modal.style.display = 'none'\n }\n\n ;[...document.querySelectorAll('dialog')].forEach((d) => {\n d.close()\n })\n }\n\n const keyIdMap = {\n q: '.queue-tab-button.side-bar-button',\n h: '.queue-tab-button.side-bar-button',\n r: '#comfy-refresh-button'\n }\n\n const buttonId = keyIdMap[event.key]\n if (buttonId) {\n const button = document.querySelector(buttonId)\n button.click()\n }\n }\n\n window.addEventListener('keydown', keybindListener, true)\n }\n})\n","import { app } from '../../scripts/app'\nimport { LiteGraph } from '@comfyorg/litegraph'\nconst id = 'Comfy.LinkRenderMode'\nconst ext = {\n name: id,\n async setup(app) {\n app.ui.settings.addSetting({\n id,\n category: ['Comfy', 'Graph', 'LinkRenderMode'],\n name: 'Link Render Mode',\n defaultValue: 2,\n type: 'combo',\n // @ts-expect-error\n options: [...LiteGraph.LINK_RENDER_MODES, 'Hidden'].map((m, i) => ({\n value: i,\n text: m,\n selected: i == app.canvas.links_render_mode\n })),\n onChange(value) {\n app.canvas.links_render_mode = +value\n app.graph.setDirtyCanvas(true)\n }\n })\n }\n}\n\napp.registerExtension(ext)\n","import { app } from '../../scripts/app'\nimport { ComfyDialog, $el } from '../../scripts/ui'\nimport { ComfyApp } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport { ClipspaceDialog } from './clipspace'\n\n// Helper function to convert a data URL to a Blob object\nfunction dataURLToBlob(dataURL) {\n const parts = dataURL.split(';base64,')\n const contentType = parts[0].split(':')[1]\n const byteString = atob(parts[1])\n const arrayBuffer = new ArrayBuffer(byteString.length)\n const uint8Array = new Uint8Array(arrayBuffer)\n for (let i = 0; i < byteString.length; i++) {\n uint8Array[i] = byteString.charCodeAt(i)\n }\n return new Blob([arrayBuffer], { type: contentType })\n}\n\nfunction loadedImageToBlob(image) {\n const canvas = document.createElement('canvas')\n\n canvas.width = image.width\n canvas.height = image.height\n\n const ctx = canvas.getContext('2d')\n\n ctx.drawImage(image, 0, 0)\n\n const dataURL = canvas.toDataURL('image/png', 1)\n const blob = dataURLToBlob(dataURL)\n\n return blob\n}\n\nfunction loadImage(imagePath) {\n return new Promise((resolve, reject) => {\n const image = new Image()\n\n image.onload = function () {\n resolve(image)\n }\n\n image.src = imagePath\n })\n}\n\nasync function uploadMask(filepath, formData) {\n await api\n .fetchApi('/upload/mask', {\n method: 'POST',\n body: formData\n })\n .then((response) => {})\n .catch((error) => {\n console.error('Error:', error)\n })\n\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']] = new Image()\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src = api.apiURL(\n '/view?' +\n new URLSearchParams(filepath).toString() +\n app.getPreviewFormatParam() +\n app.getRandParam()\n )\n\n if (ComfyApp.clipspace.images)\n ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']] = filepath\n\n ClipspaceDialog.invalidatePreview()\n}\n\nfunction prepare_mask(image, maskCanvas, maskCtx, maskColor) {\n // paste mask data into alpha channel\n maskCtx.drawImage(image, 0, 0, maskCanvas.width, maskCanvas.height)\n const maskData = maskCtx.getImageData(\n 0,\n 0,\n maskCanvas.width,\n maskCanvas.height\n )\n\n // invert mask\n for (let i = 0; i < maskData.data.length; i += 4) {\n if (maskData.data[i + 3] == 255) maskData.data[i + 3] = 0\n else maskData.data[i + 3] = 255\n\n maskData.data[i] = maskColor.r\n maskData.data[i + 1] = maskColor.g\n maskData.data[i + 2] = maskColor.b\n }\n\n maskCtx.globalCompositeOperation = 'source-over'\n maskCtx.putImageData(maskData, 0, 0)\n}\n\nclass MaskEditorDialog extends ComfyDialog {\n static instance = null\n static mousedown_x: number | null = null\n static mousedown_y: number | null = null\n\n brush: HTMLDivElement\n maskCtx: any\n maskCanvas: HTMLCanvasElement\n brush_size_slider: HTMLDivElement\n brush_opacity_slider: HTMLDivElement\n colorButton: HTMLButtonElement\n saveButton: HTMLButtonElement\n zoom_ratio: number\n pan_x: number\n pan_y: number\n imgCanvas: HTMLCanvasElement\n last_display_style: string\n is_visible: boolean\n image: HTMLImageElement\n handler_registered: boolean\n brush_slider_input: HTMLInputElement\n cursorX: number\n cursorY: number\n mousedown_pan_x: number\n mousedown_pan_y: number\n last_pressure: number\n\n static getInstance() {\n if (!MaskEditorDialog.instance) {\n MaskEditorDialog.instance = new MaskEditorDialog()\n }\n\n return MaskEditorDialog.instance\n }\n\n is_layout_created = false\n\n constructor() {\n super()\n this.element = $el('div.comfy-modal', { parent: document.body }, [\n $el('div.comfy-modal-content', [...this.createButtons()])\n ])\n }\n\n createButtons() {\n return []\n }\n\n createButton(name, callback): HTMLButtonElement {\n var button = document.createElement('button')\n button.style.pointerEvents = 'auto'\n button.innerText = name\n button.addEventListener('click', callback)\n return button\n }\n\n createLeftButton(name, callback) {\n var button = this.createButton(name, callback)\n button.style.cssFloat = 'left'\n button.style.marginRight = '4px'\n return button\n }\n\n createRightButton(name, callback) {\n var button = this.createButton(name, callback)\n button.style.cssFloat = 'right'\n button.style.marginLeft = '4px'\n return button\n }\n\n createLeftSlider(self, name, callback): HTMLDivElement {\n const divElement = document.createElement('div')\n divElement.id = 'maskeditor-slider'\n divElement.style.cssFloat = 'left'\n divElement.style.fontFamily = 'sans-serif'\n divElement.style.marginRight = '4px'\n divElement.style.color = 'var(--input-text)'\n divElement.style.backgroundColor = 'var(--comfy-input-bg)'\n divElement.style.borderRadius = '8px'\n divElement.style.borderColor = 'var(--border-color)'\n divElement.style.borderStyle = 'solid'\n divElement.style.fontSize = '15px'\n divElement.style.height = '21px'\n divElement.style.padding = '1px 6px'\n divElement.style.display = 'flex'\n divElement.style.position = 'relative'\n divElement.style.top = '2px'\n divElement.style.pointerEvents = 'auto'\n self.brush_slider_input = document.createElement('input')\n self.brush_slider_input.setAttribute('type', 'range')\n self.brush_slider_input.setAttribute('min', '1')\n self.brush_slider_input.setAttribute('max', '100')\n self.brush_slider_input.setAttribute('value', '10')\n const labelElement = document.createElement('label')\n labelElement.textContent = name\n\n divElement.appendChild(labelElement)\n divElement.appendChild(self.brush_slider_input)\n\n self.brush_slider_input.addEventListener('change', callback)\n\n return divElement\n }\n\n createOpacitySlider(self, name, callback): HTMLDivElement {\n const divElement = document.createElement('div')\n divElement.id = 'maskeditor-opacity-slider'\n divElement.style.cssFloat = 'left'\n divElement.style.fontFamily = 'sans-serif'\n divElement.style.marginRight = '4px'\n divElement.style.color = 'var(--input-text)'\n divElement.style.backgroundColor = 'var(--comfy-input-bg)'\n divElement.style.borderRadius = '8px'\n divElement.style.borderColor = 'var(--border-color)'\n divElement.style.borderStyle = 'solid'\n divElement.style.fontSize = '15px'\n divElement.style.height = '21px'\n divElement.style.padding = '1px 6px'\n divElement.style.display = 'flex'\n divElement.style.position = 'relative'\n divElement.style.top = '2px'\n divElement.style.pointerEvents = 'auto'\n self.opacity_slider_input = document.createElement('input')\n self.opacity_slider_input.setAttribute('type', 'range')\n self.opacity_slider_input.setAttribute('min', '0.1')\n self.opacity_slider_input.setAttribute('max', '1.0')\n self.opacity_slider_input.setAttribute('step', '0.01')\n self.opacity_slider_input.setAttribute('value', '0.7')\n const labelElement = document.createElement('label')\n labelElement.textContent = name\n\n divElement.appendChild(labelElement)\n divElement.appendChild(self.opacity_slider_input)\n\n self.opacity_slider_input.addEventListener('input', callback)\n\n return divElement\n }\n\n setlayout(imgCanvas: HTMLCanvasElement, maskCanvas: HTMLCanvasElement) {\n const self = this\n\n // If it is specified as relative, using it only as a hidden placeholder for padding is recommended\n // to prevent anomalies where it exceeds a certain size and goes outside of the window.\n var bottom_panel = document.createElement('div')\n bottom_panel.style.position = 'absolute'\n bottom_panel.style.bottom = '0px'\n bottom_panel.style.left = '20px'\n bottom_panel.style.right = '20px'\n bottom_panel.style.height = '50px'\n bottom_panel.style.pointerEvents = 'none'\n\n var brush = document.createElement('div')\n brush.id = 'brush'\n brush.style.backgroundColor = 'transparent'\n brush.style.outline = '1px dashed black'\n brush.style.boxShadow = '0 0 0 1px white'\n brush.style.borderRadius = '50%'\n // @ts-expect-error\n brush.style.MozBorderRadius = '50%'\n // @ts-expect-error\n brush.style.WebkitBorderRadius = '50%'\n brush.style.position = 'absolute'\n brush.style.zIndex = '8889'\n brush.style.pointerEvents = 'none'\n this.brush = brush\n this.element.appendChild(imgCanvas)\n this.element.appendChild(maskCanvas)\n this.element.appendChild(bottom_panel)\n document.body.appendChild(brush)\n\n var clearButton = this.createLeftButton('Clear', () => {\n self.maskCtx.clearRect(\n 0,\n 0,\n self.maskCanvas.width,\n self.maskCanvas.height\n )\n })\n\n this.brush_size_slider = this.createLeftSlider(\n self,\n 'Thickness',\n (event) => {\n self.brush_size = event.target.value\n self.updateBrushPreview(self)\n }\n )\n\n this.brush_opacity_slider = this.createOpacitySlider(\n self,\n 'Opacity',\n (event) => {\n self.brush_opacity = event.target.value\n if (self.brush_color_mode !== 'negative') {\n self.maskCanvas.style.opacity = self.brush_opacity.toString()\n }\n }\n )\n\n this.colorButton = this.createLeftButton(this.getColorButtonText(), () => {\n if (self.brush_color_mode === 'black') {\n self.brush_color_mode = 'white'\n } else if (self.brush_color_mode === 'white') {\n self.brush_color_mode = 'negative'\n } else {\n self.brush_color_mode = 'black'\n }\n\n self.updateWhenBrushColorModeChanged()\n })\n\n var cancelButton = this.createRightButton('Cancel', () => {\n document.removeEventListener('keydown', MaskEditorDialog.handleKeyDown)\n self.close()\n })\n\n this.saveButton = this.createRightButton('Save', () => {\n document.removeEventListener('keydown', MaskEditorDialog.handleKeyDown)\n self.save()\n })\n\n this.element.appendChild(imgCanvas)\n this.element.appendChild(maskCanvas)\n this.element.appendChild(bottom_panel)\n\n bottom_panel.appendChild(clearButton)\n bottom_panel.appendChild(this.saveButton)\n bottom_panel.appendChild(cancelButton)\n bottom_panel.appendChild(this.brush_size_slider)\n bottom_panel.appendChild(this.brush_opacity_slider)\n bottom_panel.appendChild(this.colorButton)\n\n imgCanvas.style.position = 'absolute'\n maskCanvas.style.position = 'absolute'\n\n imgCanvas.style.top = '200'\n imgCanvas.style.left = '0'\n\n maskCanvas.style.top = imgCanvas.style.top\n maskCanvas.style.left = imgCanvas.style.left\n\n const maskCanvasStyle = this.getMaskCanvasStyle()\n maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode\n maskCanvas.style.opacity = maskCanvasStyle.opacity.toString()\n }\n\n async show() {\n this.zoom_ratio = 1.0\n this.pan_x = 0\n this.pan_y = 0\n\n if (!this.is_layout_created) {\n // layout\n const imgCanvas = document.createElement('canvas')\n const maskCanvas = document.createElement('canvas')\n\n imgCanvas.id = 'imageCanvas'\n maskCanvas.id = 'maskCanvas'\n\n this.setlayout(imgCanvas, maskCanvas)\n\n // prepare content\n this.imgCanvas = imgCanvas\n this.maskCanvas = maskCanvas\n this.maskCtx = maskCanvas.getContext('2d', { willReadFrequently: true })\n\n this.setEventHandler(maskCanvas)\n\n this.is_layout_created = true\n\n // replacement of onClose hook since close is not real close\n const self = this\n const observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'style'\n ) {\n if (\n self.last_display_style &&\n self.last_display_style != 'none' &&\n self.element.style.display == 'none'\n ) {\n self.brush.style.display = 'none'\n ComfyApp.onClipspaceEditorClosed()\n }\n\n self.last_display_style = self.element.style.display\n }\n })\n })\n\n const config = { attributes: true }\n observer.observe(this.element, config)\n }\n\n // The keydown event needs to be reconfigured when closing the dialog as it gets removed.\n document.addEventListener('keydown', MaskEditorDialog.handleKeyDown)\n\n if (ComfyApp.clipspace_return_node) {\n this.saveButton.innerText = 'Save to node'\n } else {\n this.saveButton.innerText = 'Save'\n }\n this.saveButton.disabled = false\n\n this.element.style.display = 'block'\n this.element.style.width = '85%'\n this.element.style.margin = '0 7.5%'\n this.element.style.height = '100vh'\n this.element.style.top = '50%'\n this.element.style.left = '42%'\n this.element.style.zIndex = '8888' // NOTE: alert dialog must be high priority.\n\n await this.setImages(this.imgCanvas)\n\n this.is_visible = true\n }\n\n isOpened() {\n return this.element.style.display == 'block'\n }\n\n invalidateCanvas(orig_image, mask_image) {\n this.imgCanvas.width = orig_image.width\n this.imgCanvas.height = orig_image.height\n\n this.maskCanvas.width = orig_image.width\n this.maskCanvas.height = orig_image.height\n\n let imgCtx = this.imgCanvas.getContext('2d', { willReadFrequently: true })\n let maskCtx = this.maskCanvas.getContext('2d', {\n willReadFrequently: true\n })\n\n imgCtx.drawImage(orig_image, 0, 0, orig_image.width, orig_image.height)\n prepare_mask(mask_image, this.maskCanvas, maskCtx, this.getMaskColor())\n }\n\n async setImages(imgCanvas) {\n let self = this\n\n const imgCtx = imgCanvas.getContext('2d', { willReadFrequently: true })\n const maskCtx = this.maskCtx\n const maskCanvas = this.maskCanvas\n\n imgCtx.clearRect(0, 0, this.imgCanvas.width, this.imgCanvas.height)\n maskCtx.clearRect(0, 0, this.maskCanvas.width, this.maskCanvas.height)\n\n // image load\n const filepath = ComfyApp.clipspace.images\n\n const alpha_url = new URL(\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src\n )\n alpha_url.searchParams.delete('channel')\n alpha_url.searchParams.delete('preview')\n alpha_url.searchParams.set('channel', 'a')\n let mask_image = await loadImage(alpha_url)\n\n // original image load\n const rgb_url = new URL(\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src\n )\n rgb_url.searchParams.delete('channel')\n rgb_url.searchParams.set('channel', 'rgb')\n this.image = new Image()\n this.image.onload = function () {\n maskCanvas.width = self.image.width\n maskCanvas.height = self.image.height\n\n self.invalidateCanvas(self.image, mask_image)\n self.initializeCanvasPanZoom()\n }\n this.image.src = rgb_url.toString()\n }\n\n initializeCanvasPanZoom() {\n // set initialize\n let drawWidth = this.image.width\n let drawHeight = this.image.height\n\n let width = this.element.clientWidth\n let height = this.element.clientHeight\n\n if (this.image.width > width) {\n drawWidth = width\n drawHeight = (drawWidth / this.image.width) * this.image.height\n }\n\n if (drawHeight > height) {\n drawHeight = height\n drawWidth = (drawHeight / this.image.height) * this.image.width\n }\n\n this.zoom_ratio = drawWidth / this.image.width\n\n const canvasX = (width - drawWidth) / 2\n const canvasY = (height - drawHeight) / 2\n this.pan_x = canvasX\n this.pan_y = canvasY\n\n this.invalidatePanZoom()\n }\n\n invalidatePanZoom() {\n let raw_width = this.image.width * this.zoom_ratio\n let raw_height = this.image.height * this.zoom_ratio\n\n if (this.pan_x + raw_width < 10) {\n this.pan_x = 10 - raw_width\n }\n\n if (this.pan_y + raw_height < 10) {\n this.pan_y = 10 - raw_height\n }\n\n let width = `${raw_width}px`\n let height = `${raw_height}px`\n\n let left = `${this.pan_x}px`\n let top = `${this.pan_y}px`\n\n this.maskCanvas.style.width = width\n this.maskCanvas.style.height = height\n this.maskCanvas.style.left = left\n this.maskCanvas.style.top = top\n\n this.imgCanvas.style.width = width\n this.imgCanvas.style.height = height\n this.imgCanvas.style.left = left\n this.imgCanvas.style.top = top\n }\n\n setEventHandler(maskCanvas) {\n const self = this\n\n if (!this.handler_registered) {\n maskCanvas.addEventListener('contextmenu', (event) => {\n event.preventDefault()\n })\n\n this.element.addEventListener('wheel', (event) =>\n this.handleWheelEvent(self, event)\n )\n this.element.addEventListener('pointermove', (event) =>\n this.pointMoveEvent(self, event)\n )\n this.element.addEventListener('touchmove', (event) =>\n this.pointMoveEvent(self, event)\n )\n\n this.element.addEventListener('dragstart', (event) => {\n if (event.ctrlKey) {\n event.preventDefault()\n }\n })\n\n maskCanvas.addEventListener('pointerdown', (event) =>\n this.handlePointerDown(self, event)\n )\n maskCanvas.addEventListener('pointermove', (event) =>\n this.draw_move(self, event)\n )\n maskCanvas.addEventListener('touchmove', (event) =>\n this.draw_move(self, event)\n )\n maskCanvas.addEventListener('pointerover', (event) => {\n this.brush.style.display = 'block'\n })\n maskCanvas.addEventListener('pointerleave', (event) => {\n this.brush.style.display = 'none'\n })\n\n document.addEventListener('pointerup', MaskEditorDialog.handlePointerUp)\n\n this.handler_registered = true\n }\n }\n\n getMaskCanvasStyle() {\n if (this.brush_color_mode === 'negative') {\n return {\n mixBlendMode: 'difference',\n opacity: '1'\n }\n } else {\n return {\n mixBlendMode: 'initial',\n opacity: this.brush_opacity\n }\n }\n }\n\n getMaskColor() {\n if (this.brush_color_mode === 'black') {\n return { r: 0, g: 0, b: 0 }\n }\n if (this.brush_color_mode === 'white') {\n return { r: 255, g: 255, b: 255 }\n }\n if (this.brush_color_mode === 'negative') {\n // negative effect only works with white color\n return { r: 255, g: 255, b: 255 }\n }\n\n return { r: 0, g: 0, b: 0 }\n }\n\n getMaskFillStyle() {\n const maskColor = this.getMaskColor()\n\n return 'rgb(' + maskColor.r + ',' + maskColor.g + ',' + maskColor.b + ')'\n }\n\n getColorButtonText() {\n let colorCaption = 'unknown'\n\n if (this.brush_color_mode === 'black') {\n colorCaption = 'black'\n } else if (this.brush_color_mode === 'white') {\n colorCaption = 'white'\n } else if (this.brush_color_mode === 'negative') {\n colorCaption = 'negative'\n }\n\n return 'Color: ' + colorCaption\n }\n\n updateWhenBrushColorModeChanged() {\n this.colorButton.innerText = this.getColorButtonText()\n\n // update mask canvas css styles\n\n const maskCanvasStyle = this.getMaskCanvasStyle()\n this.maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode\n this.maskCanvas.style.opacity = maskCanvasStyle.opacity.toString()\n\n // update mask canvas rgb colors\n\n const maskColor = this.getMaskColor()\n\n const maskData = this.maskCtx.getImageData(\n 0,\n 0,\n this.maskCanvas.width,\n this.maskCanvas.height\n )\n\n for (let i = 0; i < maskData.data.length; i += 4) {\n maskData.data[i] = maskColor.r\n maskData.data[i + 1] = maskColor.g\n maskData.data[i + 2] = maskColor.b\n }\n\n this.maskCtx.putImageData(maskData, 0, 0)\n }\n\n brush_opacity = 0.7\n brush_size = 10\n brush_color_mode = 'black'\n drawing_mode = false\n lastx = -1\n lasty = -1\n lasttime = 0\n\n static handleKeyDown(event) {\n const self = MaskEditorDialog.instance\n if (event.key === ']') {\n self.brush_size = Math.min(self.brush_size + 2, 100)\n self.brush_slider_input.value = self.brush_size\n } else if (event.key === '[') {\n self.brush_size = Math.max(self.brush_size - 2, 1)\n self.brush_slider_input.value = self.brush_size\n } else if (event.key === 'Enter') {\n self.save()\n }\n\n self.updateBrushPreview(self)\n }\n\n static handlePointerUp(event) {\n event.preventDefault()\n\n this.mousedown_x = null\n this.mousedown_y = null\n\n MaskEditorDialog.instance.drawing_mode = false\n }\n\n updateBrushPreview(self) {\n const brush = self.brush\n\n var centerX = self.cursorX\n var centerY = self.cursorY\n\n brush.style.width = self.brush_size * 2 * this.zoom_ratio + 'px'\n brush.style.height = self.brush_size * 2 * this.zoom_ratio + 'px'\n brush.style.left = centerX - self.brush_size * this.zoom_ratio + 'px'\n brush.style.top = centerY - self.brush_size * this.zoom_ratio + 'px'\n }\n\n handleWheelEvent(self, event) {\n event.preventDefault()\n\n if (event.ctrlKey) {\n // zoom canvas\n if (event.deltaY < 0) {\n this.zoom_ratio = Math.min(10.0, this.zoom_ratio + 0.2)\n } else {\n this.zoom_ratio = Math.max(0.2, this.zoom_ratio - 0.2)\n }\n\n this.invalidatePanZoom()\n } else {\n // adjust brush size\n if (event.deltaY < 0) this.brush_size = Math.min(this.brush_size + 2, 100)\n else this.brush_size = Math.max(this.brush_size - 2, 1)\n\n this.brush_slider_input.value = this.brush_size.toString()\n\n this.updateBrushPreview(this)\n }\n }\n\n pointMoveEvent(self, event) {\n this.cursorX = event.pageX\n this.cursorY = event.pageY\n\n self.updateBrushPreview(self)\n\n if (event.ctrlKey) {\n event.preventDefault()\n self.pan_move(self, event)\n }\n\n let left_button_down =\n (window.TouchEvent && event instanceof TouchEvent) || event.buttons == 1\n\n if (event.shiftKey && left_button_down) {\n self.drawing_mode = false\n\n const y = event.clientY\n let delta = (self.zoom_lasty - y) * 0.005\n self.zoom_ratio = Math.max(\n Math.min(10.0, self.last_zoom_ratio - delta),\n 0.2\n )\n\n this.invalidatePanZoom()\n return\n }\n }\n\n pan_move(self, event) {\n if (event.buttons == 1) {\n if (MaskEditorDialog.mousedown_x) {\n let deltaX = MaskEditorDialog.mousedown_x - event.clientX\n let deltaY = MaskEditorDialog.mousedown_y - event.clientY\n\n self.pan_x = this.mousedown_pan_x - deltaX\n self.pan_y = this.mousedown_pan_y - deltaY\n\n self.invalidatePanZoom()\n }\n }\n }\n\n draw_move(self, event) {\n if (event.ctrlKey || event.shiftKey) {\n return\n }\n\n event.preventDefault()\n\n this.cursorX = event.pageX\n this.cursorY = event.pageY\n\n self.updateBrushPreview(self)\n\n let left_button_down =\n (window.TouchEvent && event instanceof TouchEvent) || event.buttons == 1\n let right_button_down = [2, 5, 32].includes(event.buttons)\n\n if (!event.altKey && left_button_down) {\n var diff = performance.now() - self.lasttime\n\n const maskRect = self.maskCanvas.getBoundingClientRect()\n\n var x = event.offsetX\n var y = event.offsetY\n\n if (event.offsetX == null) {\n x = event.targetTouches[0].clientX - maskRect.left\n }\n\n if (event.offsetY == null) {\n y = event.targetTouches[0].clientY - maskRect.top\n }\n\n x /= self.zoom_ratio\n y /= self.zoom_ratio\n\n var brush_size = this.brush_size\n if (event instanceof PointerEvent && event.pointerType == 'pen') {\n brush_size *= event.pressure\n this.last_pressure = event.pressure\n } else if (\n window.TouchEvent &&\n event instanceof TouchEvent &&\n diff < 20\n ) {\n // The firing interval of PointerEvents in Pen is unreliable, so it is supplemented by TouchEvents.\n brush_size *= this.last_pressure\n } else {\n brush_size = this.brush_size\n }\n\n if (diff > 20 && !this.drawing_mode)\n requestAnimationFrame(() => {\n self.maskCtx.beginPath()\n self.maskCtx.fillStyle = this.getMaskFillStyle()\n self.maskCtx.globalCompositeOperation = 'source-over'\n self.maskCtx.arc(x, y, brush_size, 0, Math.PI * 2, false)\n self.maskCtx.fill()\n self.lastx = x\n self.lasty = y\n })\n else\n requestAnimationFrame(() => {\n self.maskCtx.beginPath()\n self.maskCtx.fillStyle = this.getMaskFillStyle()\n self.maskCtx.globalCompositeOperation = 'source-over'\n\n var dx = x - self.lastx\n var dy = y - self.lasty\n\n var distance = Math.sqrt(dx * dx + dy * dy)\n var directionX = dx / distance\n var directionY = dy / distance\n\n for (var i = 0; i < distance; i += 5) {\n var px = self.lastx + directionX * i\n var py = self.lasty + directionY * i\n self.maskCtx.arc(px, py, brush_size, 0, Math.PI * 2, false)\n self.maskCtx.fill()\n }\n self.lastx = x\n self.lasty = y\n })\n\n self.lasttime = performance.now()\n } else if ((event.altKey && left_button_down) || right_button_down) {\n const maskRect = self.maskCanvas.getBoundingClientRect()\n const x =\n (event.offsetX || event.targetTouches[0].clientX - maskRect.left) /\n self.zoom_ratio\n const y =\n (event.offsetY || event.targetTouches[0].clientY - maskRect.top) /\n self.zoom_ratio\n\n var brush_size = this.brush_size\n if (event instanceof PointerEvent && event.pointerType == 'pen') {\n brush_size *= event.pressure\n this.last_pressure = event.pressure\n } else if (\n window.TouchEvent &&\n event instanceof TouchEvent &&\n diff < 20\n ) {\n brush_size *= this.last_pressure\n } else {\n brush_size = this.brush_size\n }\n\n if (diff > 20 && !this.drawing_mode)\n // cannot tracking drawing_mode for touch event\n requestAnimationFrame(() => {\n self.maskCtx.beginPath()\n self.maskCtx.globalCompositeOperation = 'destination-out'\n self.maskCtx.arc(x, y, brush_size, 0, Math.PI * 2, false)\n self.maskCtx.fill()\n self.lastx = x\n self.lasty = y\n })\n else\n requestAnimationFrame(() => {\n self.maskCtx.beginPath()\n self.maskCtx.globalCompositeOperation = 'destination-out'\n\n var dx = x - self.lastx\n var dy = y - self.lasty\n\n var distance = Math.sqrt(dx * dx + dy * dy)\n var directionX = dx / distance\n var directionY = dy / distance\n\n for (var i = 0; i < distance; i += 5) {\n var px = self.lastx + directionX * i\n var py = self.lasty + directionY * i\n self.maskCtx.arc(px, py, brush_size, 0, Math.PI * 2, false)\n self.maskCtx.fill()\n }\n self.lastx = x\n self.lasty = y\n })\n\n self.lasttime = performance.now()\n }\n }\n\n handlePointerDown(self, event) {\n if (event.ctrlKey) {\n if (event.buttons == 1) {\n MaskEditorDialog.mousedown_x = event.clientX\n MaskEditorDialog.mousedown_y = event.clientY\n\n this.mousedown_pan_x = this.pan_x\n this.mousedown_pan_y = this.pan_y\n }\n return\n }\n\n var brush_size = this.brush_size\n if (event instanceof PointerEvent && event.pointerType == 'pen') {\n brush_size *= event.pressure\n this.last_pressure = event.pressure\n }\n\n if ([0, 2, 5].includes(event.button)) {\n self.drawing_mode = true\n\n event.preventDefault()\n\n if (event.shiftKey) {\n self.zoom_lasty = event.clientY\n self.last_zoom_ratio = self.zoom_ratio\n return\n }\n\n const maskRect = self.maskCanvas.getBoundingClientRect()\n const x =\n (event.offsetX || event.targetTouches[0].clientX - maskRect.left) /\n self.zoom_ratio\n const y =\n (event.offsetY || event.targetTouches[0].clientY - maskRect.top) /\n self.zoom_ratio\n\n self.maskCtx.beginPath()\n if (!event.altKey && event.button == 0) {\n self.maskCtx.fillStyle = this.getMaskFillStyle()\n self.maskCtx.globalCompositeOperation = 'source-over'\n } else {\n self.maskCtx.globalCompositeOperation = 'destination-out'\n }\n self.maskCtx.arc(x, y, brush_size, 0, Math.PI * 2, false)\n self.maskCtx.fill()\n self.lastx = x\n self.lasty = y\n self.lasttime = performance.now()\n }\n }\n\n async save() {\n const backupCanvas = document.createElement('canvas')\n const backupCtx = backupCanvas.getContext('2d', {\n willReadFrequently: true\n })\n backupCanvas.width = this.image.width\n backupCanvas.height = this.image.height\n\n backupCtx.clearRect(0, 0, backupCanvas.width, backupCanvas.height)\n backupCtx.drawImage(\n this.maskCanvas,\n 0,\n 0,\n this.maskCanvas.width,\n this.maskCanvas.height,\n 0,\n 0,\n backupCanvas.width,\n backupCanvas.height\n )\n\n // paste mask data into alpha channel\n const backupData = backupCtx.getImageData(\n 0,\n 0,\n backupCanvas.width,\n backupCanvas.height\n )\n\n // refine mask image\n for (let i = 0; i < backupData.data.length; i += 4) {\n if (backupData.data[i + 3] == 255) backupData.data[i + 3] = 0\n else backupData.data[i + 3] = 255\n\n backupData.data[i] = 0\n backupData.data[i + 1] = 0\n backupData.data[i + 2] = 0\n }\n\n backupCtx.globalCompositeOperation = 'source-over'\n backupCtx.putImageData(backupData, 0, 0)\n\n const formData = new FormData()\n const filename = 'clipspace-mask-' + performance.now() + '.png'\n\n const item = {\n filename: filename,\n subfolder: 'clipspace',\n type: 'input'\n }\n\n if (ComfyApp.clipspace.images) ComfyApp.clipspace.images[0] = item\n\n if (ComfyApp.clipspace.widgets) {\n const index = ComfyApp.clipspace.widgets.findIndex(\n (obj) => obj.name === 'image'\n )\n\n if (index >= 0) ComfyApp.clipspace.widgets[index].value = item\n }\n\n const dataURL = backupCanvas.toDataURL()\n const blob = dataURLToBlob(dataURL)\n\n let original_url = new URL(this.image.src)\n\n type Ref = { filename: string; subfolder?: string; type?: string }\n\n const original_ref: Ref = {\n filename: original_url.searchParams.get('filename')\n }\n\n let original_subfolder = original_url.searchParams.get('subfolder')\n if (original_subfolder) original_ref.subfolder = original_subfolder\n\n let original_type = original_url.searchParams.get('type')\n if (original_type) original_ref.type = original_type\n\n formData.append('image', blob, filename)\n formData.append('original_ref', JSON.stringify(original_ref))\n formData.append('type', 'input')\n formData.append('subfolder', 'clipspace')\n\n this.saveButton.innerText = 'Saving...'\n this.saveButton.disabled = true\n await uploadMask(item, formData)\n ComfyApp.onClipspaceEditorSave()\n this.close()\n }\n}\n\napp.registerExtension({\n name: 'Comfy.MaskEditor',\n init(app) {\n ComfyApp.open_maskeditor = function () {\n const dlg = MaskEditorDialog.getInstance()\n if (!dlg.isOpened()) {\n dlg.show()\n }\n }\n\n const context_predicate = () =>\n ComfyApp.clipspace &&\n ComfyApp.clipspace.imgs &&\n ComfyApp.clipspace.imgs.length > 0\n ClipspaceDialog.registerButton(\n 'MaskEditor',\n context_predicate,\n ComfyApp.open_maskeditor\n )\n }\n})\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport { ComfyDialog, $el } from '../../scripts/ui'\nimport { GroupNodeConfig, GroupNodeHandler } from './groupNode'\nimport { LGraphCanvas } from '@comfyorg/litegraph'\n\n// Adds the ability to save and add multiple nodes as a template\n// To save:\n// Select multiple nodes (ctrl + drag to select a region or ctrl+click individual nodes)\n// Right click the canvas\n// Save Node Template -> give it a name\n//\n// To add:\n// Right click the canvas\n// Node templates -> click the one to add\n//\n// To delete/rename:\n// Right click the canvas\n// Node templates -> Manage\n//\n// To rearrange:\n// Open the manage dialog and Drag and drop elements using the \"Name:\" label as handle\n\nconst id = 'Comfy.NodeTemplates'\nconst file = 'comfy.templates.json'\n\nclass ManageTemplates extends ComfyDialog {\n templates: any[]\n draggedEl: HTMLElement | null\n saveVisualCue: number | null\n emptyImg: HTMLImageElement\n importInput: HTMLInputElement\n\n constructor() {\n super()\n this.load().then((v) => {\n this.templates = v\n })\n\n this.element.classList.add('comfy-manage-templates')\n this.draggedEl = null\n this.saveVisualCue = null\n this.emptyImg = new Image()\n this.emptyImg.src =\n 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='\n\n this.importInput = $el('input', {\n type: 'file',\n accept: '.json',\n multiple: true,\n style: { display: 'none' },\n parent: document.body,\n onchange: () => this.importAll()\n }) as HTMLInputElement\n }\n\n createButtons() {\n const btns = super.createButtons()\n btns[0].textContent = 'Close'\n btns[0].onclick = (e) => {\n clearTimeout(this.saveVisualCue)\n this.close()\n }\n btns.unshift(\n $el('button', {\n type: 'button',\n textContent: 'Export',\n onclick: () => this.exportAll()\n })\n )\n btns.unshift(\n $el('button', {\n type: 'button',\n textContent: 'Import',\n onclick: () => {\n this.importInput.click()\n }\n })\n )\n return btns\n }\n\n async load() {\n let templates = []\n if (app.storageLocation === 'server') {\n if (app.isNewUserSession) {\n // New user so migrate existing templates\n const json = localStorage.getItem(id)\n if (json) {\n templates = JSON.parse(json)\n }\n await api.storeUserData(file, json, { stringify: false })\n } else {\n const res = await api.getUserData(file)\n if (res.status === 200) {\n try {\n templates = await res.json()\n } catch (error) {}\n } else if (res.status !== 404) {\n console.error(res.status + ' ' + res.statusText)\n }\n }\n } else {\n const json = localStorage.getItem(id)\n if (json) {\n templates = JSON.parse(json)\n }\n }\n\n return templates ?? []\n }\n\n async store() {\n if (app.storageLocation === 'server') {\n const templates = JSON.stringify(this.templates, undefined, 4)\n localStorage.setItem(id, templates) // Backwards compatibility\n try {\n await api.storeUserData(file, templates, { stringify: false })\n } catch (error) {\n console.error(error)\n alert(error.message)\n }\n } else {\n localStorage.setItem(id, JSON.stringify(this.templates))\n }\n }\n\n async importAll() {\n for (const file of this.importInput.files) {\n if (file.type === 'application/json' || file.name.endsWith('.json')) {\n const reader = new FileReader()\n reader.onload = async () => {\n const importFile = JSON.parse(reader.result as string)\n if (importFile?.templates) {\n for (const template of importFile.templates) {\n if (template?.name && template?.data) {\n this.templates.push(template)\n }\n }\n await this.store()\n }\n }\n await reader.readAsText(file)\n }\n }\n\n this.importInput.value = null\n\n this.close()\n }\n\n exportAll() {\n if (this.templates.length == 0) {\n alert('No templates to export.')\n return\n }\n\n const json = JSON.stringify({ templates: this.templates }, null, 2) // convert the data to a JSON string\n const blob = new Blob([json], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const a = $el('a', {\n href: url,\n download: 'node_templates.json',\n style: { display: 'none' },\n parent: document.body\n })\n a.click()\n setTimeout(function () {\n a.remove()\n window.URL.revokeObjectURL(url)\n }, 0)\n }\n\n show() {\n // Show list of template names + delete button\n super.show(\n $el(\n 'div',\n {},\n this.templates.flatMap((t, i) => {\n let nameInput\n return [\n $el(\n 'div',\n {\n dataset: { id: i.toString() },\n className: 'templateManagerRow',\n style: {\n display: 'grid',\n gridTemplateColumns: '1fr auto',\n border: '1px dashed transparent',\n gap: '5px',\n backgroundColor: 'var(--comfy-menu-bg)'\n },\n ondragstart: (e) => {\n this.draggedEl = e.currentTarget\n e.currentTarget.style.opacity = '0.6'\n e.currentTarget.style.border = '1px dashed yellow'\n e.dataTransfer.effectAllowed = 'move'\n e.dataTransfer.setDragImage(this.emptyImg, 0, 0)\n },\n ondragend: (e) => {\n e.target.style.opacity = '1'\n e.currentTarget.style.border = '1px dashed transparent'\n e.currentTarget.removeAttribute('draggable')\n\n // rearrange the elements\n this.element\n .querySelectorAll('.templateManagerRow')\n .forEach((el: HTMLElement, i) => {\n var prev_i = Number.parseInt(el.dataset.id)\n\n if (el == this.draggedEl && prev_i != i) {\n this.templates.splice(\n i,\n 0,\n this.templates.splice(prev_i, 1)[0]\n )\n }\n el.dataset.id = i.toString()\n })\n this.store()\n },\n ondragover: (e) => {\n e.preventDefault()\n if (e.currentTarget == this.draggedEl) return\n\n let rect = e.currentTarget.getBoundingClientRect()\n if (e.clientY > rect.top + rect.height / 2) {\n e.currentTarget.parentNode.insertBefore(\n this.draggedEl,\n e.currentTarget.nextSibling\n )\n } else {\n e.currentTarget.parentNode.insertBefore(\n this.draggedEl,\n e.currentTarget\n )\n }\n }\n },\n [\n $el(\n 'label',\n {\n textContent: 'Name: ',\n style: {\n cursor: 'grab'\n },\n onmousedown: (e) => {\n // enable dragging only from the label\n if (e.target.localName == 'label')\n e.currentTarget.parentNode.draggable = 'true'\n }\n },\n [\n $el('input', {\n value: t.name,\n dataset: { name: t.name },\n style: {\n transitionProperty: 'background-color',\n transitionDuration: '0s'\n },\n onchange: (e) => {\n clearTimeout(this.saveVisualCue)\n var el = e.target\n var row = el.parentNode.parentNode\n this.templates[row.dataset.id].name =\n el.value.trim() || 'untitled'\n this.store()\n el.style.backgroundColor = 'rgb(40, 95, 40)'\n el.style.transitionDuration = '0s'\n // @ts-expect-error\n // In browser env the return value is number.\n this.saveVisualCue = setTimeout(function () {\n el.style.transitionDuration = '.7s'\n el.style.backgroundColor = 'var(--comfy-input-bg)'\n }, 15)\n },\n onkeypress: (e) => {\n var el = e.target\n clearTimeout(this.saveVisualCue)\n el.style.transitionDuration = '0s'\n el.style.backgroundColor = 'var(--comfy-input-bg)'\n },\n $: (el) => (nameInput = el)\n })\n ]\n ),\n $el('div', {}, [\n $el('button', {\n textContent: 'Export',\n style: {\n fontSize: '12px',\n fontWeight: 'normal'\n },\n onclick: (e) => {\n const json = JSON.stringify({ templates: [t] }, null, 2) // convert the data to a JSON string\n const blob = new Blob([json], {\n type: 'application/json'\n })\n const url = URL.createObjectURL(blob)\n const a = $el('a', {\n href: url,\n download: (nameInput.value || t.name) + '.json',\n style: { display: 'none' },\n parent: document.body\n })\n a.click()\n setTimeout(function () {\n a.remove()\n window.URL.revokeObjectURL(url)\n }, 0)\n }\n }),\n $el('button', {\n textContent: 'Delete',\n style: {\n fontSize: '12px',\n color: 'red',\n fontWeight: 'normal'\n },\n onclick: (e) => {\n const item = e.target.parentNode.parentNode\n item.parentNode.removeChild(item)\n this.templates.splice(item.dataset.id * 1, 1)\n this.store()\n // update the rows index, setTimeout ensures that the list is updated\n var that = this\n setTimeout(function () {\n that.element\n .querySelectorAll('.templateManagerRow')\n .forEach((el: HTMLElement, i) => {\n el.dataset.id = i.toString()\n })\n }, 0)\n }\n })\n ])\n ]\n )\n ]\n })\n )\n )\n }\n}\n\napp.registerExtension({\n name: id,\n setup() {\n const manage = new ManageTemplates()\n\n const clipboardAction = async (cb) => {\n // We use the clipboard functions but dont want to overwrite the current user clipboard\n // Restore it after we've run our callback\n const old = localStorage.getItem('litegrapheditor_clipboard')\n await cb()\n localStorage.setItem('litegrapheditor_clipboard', old)\n }\n\n const orig = LGraphCanvas.prototype.getCanvasMenuOptions\n LGraphCanvas.prototype.getCanvasMenuOptions = function () {\n const options = orig.apply(this, arguments)\n\n options.push(null)\n options.push({\n content: `Save Selected as Template`,\n disabled: !Object.keys(app.canvas.selected_nodes || {}).length,\n callback: () => {\n const name = prompt('Enter name')\n if (!name?.trim()) return\n\n clipboardAction(() => {\n app.canvas.copyToClipboard()\n let data = localStorage.getItem('litegrapheditor_clipboard')\n data = JSON.parse(data)\n const nodeIds = Object.keys(app.canvas.selected_nodes)\n for (let i = 0; i < nodeIds.length; i++) {\n const node = app.graph.getNodeById(Number.parseInt(nodeIds[i]))\n // @ts-expect-error\n const nodeData = node?.constructor.nodeData\n\n let groupData = GroupNodeHandler.getGroupData(node)\n if (groupData) {\n groupData = groupData.nodeData\n // @ts-expect-error\n if (!data.groupNodes) {\n // @ts-expect-error\n data.groupNodes = {}\n }\n // @ts-expect-error\n data.groupNodes[nodeData.name] = groupData\n // @ts-expect-error\n data.nodes[i].type = nodeData.name\n }\n }\n\n manage.templates.push({\n name,\n data: JSON.stringify(data)\n })\n manage.store()\n })\n }\n })\n\n // Map each template to a menu item\n const subItems = manage.templates.map((t) => {\n return {\n content: t.name,\n callback: () => {\n clipboardAction(async () => {\n const data = JSON.parse(t.data)\n await GroupNodeConfig.registerFromWorkflow(data.groupNodes, {})\n localStorage.setItem('litegrapheditor_clipboard', t.data)\n app.canvas.pasteFromClipboard()\n })\n }\n }\n })\n\n subItems.push(null, {\n content: 'Manage',\n callback: () => manage.show()\n })\n\n options.push({\n content: 'Node Templates',\n submenu: {\n options: subItems\n }\n })\n\n return options\n }\n }\n})\n","import { LiteGraph, LGraphCanvas } from '@comfyorg/litegraph'\nimport { app } from '../../scripts/app'\nimport { ComfyWidgets } from '../../scripts/widgets'\nimport { LGraphNode } from '@comfyorg/litegraph'\n// Node that add notes to your project\n\napp.registerExtension({\n name: 'Comfy.NoteNode',\n registerCustomNodes() {\n class NoteNode extends LGraphNode {\n static category: string\n\n color = LGraphCanvas.node_colors.yellow.color\n bgcolor = LGraphCanvas.node_colors.yellow.bgcolor\n groupcolor = LGraphCanvas.node_colors.yellow.groupcolor\n isVirtualNode: boolean\n collapsable: boolean\n title_mode: number\n\n constructor(title?: string) {\n super(title)\n if (!this.properties) {\n this.properties = { text: '' }\n }\n ComfyWidgets.STRING(\n // Should we extends LGraphNode? Yesss\n this,\n '',\n // @ts-expect-error\n ['', { default: this.properties.text, multiline: true }],\n app\n )\n\n this.serialize_widgets = true\n this.isVirtualNode = true\n }\n }\n\n // Load default visibility\n\n LiteGraph.registerNodeType(\n 'Note',\n Object.assign(NoteNode, {\n title_mode: LiteGraph.NORMAL_TITLE,\n title: 'Note',\n collapsable: true\n })\n )\n\n NoteNode.category = 'utils'\n }\n})\n","import { app } from '../../scripts/app'\nimport { mergeIfValid, getWidgetConfig, setWidgetConfig } from './widgetInputs'\nimport { LiteGraph, LGraphCanvas, LGraphNode } from '@comfyorg/litegraph'\n\n// Node that allows you to redirect connections for cleaner graphs\n\napp.registerExtension({\n name: 'Comfy.RerouteNode',\n registerCustomNodes(app) {\n interface RerouteNode extends LGraphNode {\n __outputType?: string\n }\n\n class RerouteNode extends LGraphNode {\n static category: string | undefined\n static defaultVisibility = false\n\n constructor(title?: string) {\n super(title)\n if (!this.properties) {\n this.properties = {}\n }\n this.properties.showOutputText = RerouteNode.defaultVisibility\n this.properties.horizontal = false\n\n this.addInput('', '*')\n this.addOutput(this.properties.showOutputText ? '*' : '', '*')\n\n this.onAfterGraphConfigured = function () {\n requestAnimationFrame(() => {\n this.onConnectionsChange(LiteGraph.INPUT, null, true, null)\n })\n }\n\n this.onConnectionsChange = function (\n type,\n index,\n connected,\n link_info\n ) {\n this.applyOrientation()\n\n // Prevent multiple connections to different types when we have no input\n if (connected && type === LiteGraph.OUTPUT) {\n // Ignore wildcard nodes as these will be updated to real types\n const types = new Set(\n this.outputs[0].links\n .map((l) => app.graph.links[l].type)\n .filter((t) => t !== '*')\n )\n if (types.size > 1) {\n const linksToDisconnect = []\n for (let i = 0; i < this.outputs[0].links.length - 1; i++) {\n const linkId = this.outputs[0].links[i]\n const link = app.graph.links[linkId]\n linksToDisconnect.push(link)\n }\n for (const link of linksToDisconnect) {\n const node = app.graph.getNodeById(link.target_id)\n node.disconnectInput(link.target_slot)\n }\n }\n }\n\n // Find root input\n let currentNode = this\n let updateNodes = []\n let inputType = null\n let inputNode = null\n while (currentNode) {\n updateNodes.unshift(currentNode)\n const linkId = currentNode.inputs[0].link\n if (linkId !== null) {\n const link = app.graph.links[linkId]\n if (!link) return\n const node = app.graph.getNodeById(link.origin_id)\n const type = node.constructor.type\n if (type === 'Reroute') {\n if (node === this) {\n // We've found a circle\n currentNode.disconnectInput(link.target_slot)\n currentNode = null\n } else {\n // Move the previous node\n currentNode = node\n }\n } else {\n // We've found the end\n inputNode = currentNode\n inputType = node.outputs[link.origin_slot]?.type ?? null\n break\n }\n } else {\n // This path has no input node\n currentNode = null\n break\n }\n }\n\n // Find all outputs\n const nodes = [this]\n let outputType = null\n while (nodes.length) {\n currentNode = nodes.pop()\n const outputs =\n (currentNode.outputs ? currentNode.outputs[0].links : []) || []\n if (outputs.length) {\n for (const linkId of outputs) {\n const link = app.graph.links[linkId]\n\n // When disconnecting sometimes the link is still registered\n if (!link) continue\n\n const node = app.graph.getNodeById(link.target_id)\n const type = node.constructor.type\n\n if (type === 'Reroute') {\n // Follow reroute nodes\n nodes.push(node)\n updateNodes.push(node)\n } else {\n // We've found an output\n const nodeOutType =\n node.inputs &&\n node.inputs[link?.target_slot] &&\n node.inputs[link.target_slot].type\n ? node.inputs[link.target_slot].type\n : null\n if (\n inputType &&\n inputType !== '*' &&\n nodeOutType !== inputType\n ) {\n // The output doesnt match our input so disconnect it\n node.disconnectInput(link.target_slot)\n } else {\n outputType = nodeOutType\n }\n }\n }\n } else {\n // No more outputs for this path\n }\n }\n\n const displayType = inputType || outputType || '*'\n const color = LGraphCanvas.link_type_colors[displayType]\n\n let widgetConfig\n let targetWidget\n let widgetType\n // Update the types of each node\n for (const node of updateNodes) {\n // If we dont have an input type we are always wildcard but we'll show the output type\n // This lets you change the output link to a different type and all nodes will update\n node.outputs[0].type = inputType || '*'\n node.__outputType = displayType\n node.outputs[0].name = node.properties.showOutputText\n ? displayType\n : ''\n node.size = node.computeSize()\n node.applyOrientation()\n\n for (const l of node.outputs[0].links || []) {\n const link = app.graph.links[l]\n if (link) {\n link.color = color\n\n if (app.configuringGraph) continue\n const targetNode = app.graph.getNodeById(link.target_id)\n const targetInput = targetNode.inputs?.[link.target_slot]\n if (targetInput?.widget) {\n const config = getWidgetConfig(targetInput)\n if (!widgetConfig) {\n widgetConfig = config[1] ?? {}\n widgetType = config[0]\n }\n if (!targetWidget) {\n targetWidget = targetNode.widgets?.find(\n (w) => w.name === targetInput.widget.name\n )\n }\n\n const merged = mergeIfValid(targetInput, [\n config[0],\n widgetConfig\n ])\n if (merged.customConfig) {\n widgetConfig = merged.customConfig\n }\n }\n }\n }\n }\n\n for (const node of updateNodes) {\n if (widgetConfig && outputType) {\n node.inputs[0].widget = { name: 'value' }\n setWidgetConfig(\n node.inputs[0],\n [widgetType ?? displayType, widgetConfig],\n targetWidget\n )\n } else {\n setWidgetConfig(node.inputs[0], null)\n }\n }\n\n if (inputNode) {\n const link = app.graph.links[inputNode.inputs[0].link]\n if (link) {\n link.color = color\n }\n }\n }\n\n this.clone = function () {\n const cloned = RerouteNode.prototype.clone.apply(this)\n cloned.removeOutput(0)\n cloned.addOutput(this.properties.showOutputText ? '*' : '', '*')\n cloned.size = cloned.computeSize()\n return cloned\n }\n\n // This node is purely frontend and does not impact the resulting prompt so should not be serialized\n this.isVirtualNode = true\n }\n\n getExtraMenuOptions(_, options) {\n options.unshift(\n {\n content:\n (this.properties.showOutputText ? 'Hide' : 'Show') + ' Type',\n callback: () => {\n this.properties.showOutputText = !this.properties.showOutputText\n if (this.properties.showOutputText) {\n this.outputs[0].name =\n this.__outputType || (this.outputs[0].type as string)\n } else {\n this.outputs[0].name = ''\n }\n this.size = this.computeSize()\n this.applyOrientation()\n app.graph.setDirtyCanvas(true, true)\n }\n },\n {\n content:\n (RerouteNode.defaultVisibility ? 'Hide' : 'Show') +\n ' Type By Default',\n callback: () => {\n RerouteNode.setDefaultTextVisibility(\n !RerouteNode.defaultVisibility\n )\n }\n },\n {\n // naming is inverted with respect to LiteGraphNode.horizontal\n // LiteGraphNode.horizontal == true means that\n // each slot in the inputs and outputs are laid out horizontally,\n // which is the opposite of the visual orientation of the inputs and outputs as a node\n content:\n 'Set ' + (this.properties.horizontal ? 'Horizontal' : 'Vertical'),\n callback: () => {\n this.properties.horizontal = !this.properties.horizontal\n this.applyOrientation()\n }\n }\n )\n }\n applyOrientation() {\n this.horizontal = this.properties.horizontal\n if (this.horizontal) {\n // we correct the input position, because LiteGraphNode.horizontal\n // doesn't account for title presence\n // which reroute nodes don't have\n this.inputs[0].pos = [this.size[0] / 2, 0]\n } else {\n delete this.inputs[0].pos\n }\n app.graph.setDirtyCanvas(true, true)\n }\n\n computeSize(): [number, number] {\n return [\n this.properties.showOutputText && this.outputs && this.outputs.length\n ? Math.max(\n 75,\n LiteGraph.NODE_TEXT_SIZE * this.outputs[0].name.length * 0.6 +\n 40\n )\n : 75,\n 26\n ]\n }\n\n static setDefaultTextVisibility(visible) {\n RerouteNode.defaultVisibility = visible\n if (visible) {\n localStorage['Comfy.RerouteNode.DefaultVisibility'] = 'true'\n } else {\n delete localStorage['Comfy.RerouteNode.DefaultVisibility']\n }\n }\n }\n\n // Load default visibility\n RerouteNode.setDefaultTextVisibility(\n !!localStorage['Comfy.RerouteNode.DefaultVisibility']\n )\n\n LiteGraph.registerNodeType(\n 'Reroute',\n Object.assign(RerouteNode, {\n title_mode: LiteGraph.NO_TITLE,\n title: 'Reroute',\n collapsable: false\n })\n )\n\n RerouteNode.category = 'utils'\n }\n})\n","import { app } from '../../scripts/app'\nimport { applyTextReplacements } from '../../scripts/utils'\n// Use widget values and dates in output filenames\n\napp.registerExtension({\n name: 'Comfy.SaveImageExtraOutput',\n async beforeRegisterNodeDef(nodeType, nodeData, app) {\n if (nodeData.name === 'SaveImage' || nodeData.name === 'SaveAnimatedWEBP') {\n const onNodeCreated = nodeType.prototype.onNodeCreated\n // When the SaveImage node is created we want to override the serialization of the output name widget to run our S&R\n nodeType.prototype.onNodeCreated = function () {\n const r = onNodeCreated\n ? onNodeCreated.apply(this, arguments)\n : undefined\n\n const widget = this.widgets.find((w) => w.name === 'filename_prefix')\n widget.serializeValue = () => {\n return applyTextReplacements(app, widget.value)\n }\n\n return r\n }\n } else {\n // When any other node is created add a property to alias the node\n const onNodeCreated = nodeType.prototype.onNodeCreated\n nodeType.prototype.onNodeCreated = function () {\n const r = onNodeCreated\n ? onNodeCreated.apply(this, arguments)\n : undefined\n\n if (!this.properties || !('Node name for S&R' in this.properties)) {\n this.addProperty('Node name for S&R', this.constructor.type, 'string')\n }\n\n return r\n }\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'\n\nlet touchZooming\nlet touchCount = 0\n\napp.registerExtension({\n name: 'Comfy.SimpleTouchSupport',\n setup() {\n let zoomPos\n let touchTime\n let lastTouch\n\n function getMultiTouchPos(e) {\n return Math.hypot(\n e.touches[0].clientX - e.touches[1].clientX,\n e.touches[0].clientY - e.touches[1].clientY\n )\n }\n\n app.canvasEl.addEventListener(\n 'touchstart',\n (e) => {\n touchCount++\n lastTouch = null\n if (e.touches?.length === 1) {\n // Store start time for press+hold for context menu\n touchTime = new Date()\n lastTouch = e.touches[0]\n } else {\n touchTime = null\n if (e.touches?.length === 2) {\n // Store center pos for zoom\n zoomPos = getMultiTouchPos(e)\n app.canvas.pointer_is_down = false\n }\n }\n },\n true\n )\n\n app.canvasEl.addEventListener('touchend', (e: TouchEvent) => {\n touchZooming = false\n touchCount = e.touches?.length ?? touchCount - 1\n if (touchTime && !e.touches?.length) {\n if (new Date().getTime() - touchTime > 600) {\n try {\n // hack to get litegraph to use this event\n e.constructor = CustomEvent\n } catch (error) {}\n // @ts-expect-error\n e.clientX = lastTouch.clientX\n // @ts-expect-error\n e.clientY = lastTouch.clientY\n\n app.canvas.pointer_is_down = true\n // @ts-expect-error\n app.canvas._mousedown_callback(e)\n }\n touchTime = null\n }\n })\n\n app.canvasEl.addEventListener(\n 'touchmove',\n (e) => {\n touchTime = null\n if (e.touches?.length === 2) {\n app.canvas.pointer_is_down = false\n touchZooming = true\n // @ts-expect-error\n LiteGraph.closeAllContextMenus()\n // @ts-expect-error\n app.canvas.search_box?.close()\n const newZoomPos = getMultiTouchPos(e)\n\n const midX = (e.touches[0].clientX + e.touches[1].clientX) / 2\n const midY = (e.touches[0].clientY + e.touches[1].clientY) / 2\n\n let scale = app.canvas.ds.scale\n const diff = zoomPos - newZoomPos\n if (diff > 0.5) {\n scale *= 1 / 1.07\n } else if (diff < -0.5) {\n scale *= 1.07\n }\n app.canvas.ds.changeScale(scale, [midX, midY])\n app.canvas.setDirty(true, true)\n zoomPos = newZoomPos\n }\n },\n true\n )\n }\n})\n\nconst processMouseDown = LGraphCanvas.prototype.processMouseDown\nLGraphCanvas.prototype.processMouseDown = function (e) {\n if (touchZooming || touchCount) {\n return\n }\n return processMouseDown.apply(this, arguments)\n}\n\nconst processMouseMove = LGraphCanvas.prototype.processMouseMove\nLGraphCanvas.prototype.processMouseMove = function (e) {\n if (touchZooming || touchCount > 1) {\n return\n }\n return processMouseMove.apply(this, arguments)\n}\n","import { app } from '../../scripts/app'\nimport { ComfyWidgets } from '../../scripts/widgets'\nimport { LiteGraph } from '@comfyorg/litegraph'\n// Adds defaults for quickly adding nodes with middle click on the input/output\n\napp.registerExtension({\n name: 'Comfy.SlotDefaults',\n suggestionsNumber: null,\n init() {\n LiteGraph.search_filter_enabled = true\n LiteGraph.middle_click_slot_add_default_node = true\n this.suggestionsNumber = app.ui.settings.addSetting({\n id: 'Comfy.NodeSuggestions.number',\n category: ['Comfy', 'Node Search Box', 'NodeSuggestions'],\n name: 'Number of nodes suggestions',\n tooltip: 'Only for litegraph searchbox/context menu',\n type: 'slider',\n attrs: {\n min: 1,\n max: 100,\n step: 1\n },\n defaultValue: 5,\n onChange: (newVal, oldVal) => {\n this.setDefaults(newVal)\n }\n })\n },\n slot_types_default_out: {},\n slot_types_default_in: {},\n async beforeRegisterNodeDef(nodeType, nodeData, app) {\n var nodeId = nodeData.name\n var inputs = []\n inputs = nodeData['input']['required'] //only show required inputs to reduce the mess also not logical to create node with optional inputs\n for (const inputKey in inputs) {\n var input = inputs[inputKey]\n if (typeof input[0] !== 'string') continue\n\n var type = input[0]\n if (type in ComfyWidgets) {\n var customProperties = input[1]\n if (!customProperties?.forceInput) continue //ignore widgets that don't force input\n }\n\n if (!(type in this.slot_types_default_out)) {\n this.slot_types_default_out[type] = ['Reroute']\n }\n if (this.slot_types_default_out[type].includes(nodeId)) continue\n this.slot_types_default_out[type].push(nodeId)\n\n // Input types have to be stored as lower case\n // Store each node that can handle this input type\n const lowerType = type.toLocaleLowerCase()\n if (!(lowerType in LiteGraph.registered_slot_in_types)) {\n LiteGraph.registered_slot_in_types[lowerType] = { nodes: [] }\n }\n LiteGraph.registered_slot_in_types[lowerType].nodes.push(\n nodeType.comfyClass\n )\n }\n\n var outputs = nodeData['output']\n for (const key in outputs) {\n var type = outputs[key] as string\n if (!(type in this.slot_types_default_in)) {\n this.slot_types_default_in[type] = ['Reroute'] // [\"Reroute\", \"Primitive\"]; primitive doesn't always work :'()\n }\n\n this.slot_types_default_in[type].push(nodeId)\n\n // Store each node that can handle this output type\n if (!(type in LiteGraph.registered_slot_out_types)) {\n LiteGraph.registered_slot_out_types[type] = { nodes: [] }\n }\n LiteGraph.registered_slot_out_types[type].nodes.push(nodeType.comfyClass)\n\n if (!LiteGraph.slot_types_out.includes(type)) {\n LiteGraph.slot_types_out.push(type)\n }\n }\n var maxNum = this.suggestionsNumber.value\n this.setDefaults(maxNum)\n },\n setDefaults(maxNum) {\n LiteGraph.slot_types_default_out = {}\n LiteGraph.slot_types_default_in = {}\n\n for (const type in this.slot_types_default_out) {\n LiteGraph.slot_types_default_out[type] = this.slot_types_default_out[\n type\n ].slice(0, maxNum)\n }\n for (const type in this.slot_types_default_in) {\n LiteGraph.slot_types_default_in[type] = this.slot_types_default_in[\n type\n ].slice(0, maxNum)\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport {\n LGraphCanvas,\n LGraphNode,\n LGraphGroup,\n LiteGraph\n} from '@comfyorg/litegraph'\n\n// Shift + drag/resize to snap to grid\n\n/** Rounds a Vector2 in-place to the current CANVAS_GRID_SIZE. */\nfunction roundVectorToGrid(vec) {\n vec[0] =\n LiteGraph.CANVAS_GRID_SIZE * Math.round(vec[0] / LiteGraph.CANVAS_GRID_SIZE)\n vec[1] =\n LiteGraph.CANVAS_GRID_SIZE * Math.round(vec[1] / LiteGraph.CANVAS_GRID_SIZE)\n return vec\n}\n\napp.registerExtension({\n name: 'Comfy.SnapToGrid',\n init() {\n // Add setting to control grid size\n app.ui.settings.addSetting({\n id: 'Comfy.SnapToGrid.GridSize',\n category: ['Comfy', 'Graph', 'GridSize'],\n name: 'Snap to grid size',\n type: 'slider',\n attrs: {\n min: 1,\n max: 500\n },\n tooltip:\n 'When dragging and resizing nodes while holding shift they will be aligned to the grid, this controls the size of that grid.',\n defaultValue: LiteGraph.CANVAS_GRID_SIZE,\n onChange(value) {\n LiteGraph.CANVAS_GRID_SIZE = +value\n }\n })\n\n // After moving a node, if the shift key is down align it to grid\n const onNodeMoved = app.canvas.onNodeMoved\n app.canvas.onNodeMoved = function (node) {\n const r = onNodeMoved?.apply(this, arguments)\n\n if (app.shiftDown) {\n // Ensure all selected nodes are realigned\n for (const id in this.selected_nodes) {\n this.selected_nodes[id].alignToGrid()\n }\n }\n\n return r\n }\n\n // When a node is added, add a resize handler to it so we can fix align the size with the grid\n const onNodeAdded = app.graph.onNodeAdded\n app.graph.onNodeAdded = function (node) {\n const onResize = node.onResize\n node.onResize = function () {\n if (app.shiftDown) {\n roundVectorToGrid(node.size)\n }\n return onResize?.apply(this, arguments)\n }\n return onNodeAdded?.apply(this, arguments)\n }\n\n // Draw a preview of where the node will go if holding shift and the node is selected\n const origDrawNode = LGraphCanvas.prototype.drawNode\n LGraphCanvas.prototype.drawNode = function (node, ctx) {\n if (\n app.shiftDown &&\n this.node_dragged &&\n node.id in this.selected_nodes\n ) {\n const [x, y] = roundVectorToGrid([...node.pos])\n const shiftX = x - node.pos[0]\n let shiftY = y - node.pos[1]\n\n let w, h\n if (node.flags.collapsed) {\n // @ts-expect-error\n w = node._collapsed_width\n h = LiteGraph.NODE_TITLE_HEIGHT\n shiftY -= LiteGraph.NODE_TITLE_HEIGHT\n } else {\n w = node.size[0]\n h = node.size[1]\n // @ts-expect-error\n let titleMode = node.constructor.title_mode\n if (\n titleMode !== LiteGraph.TRANSPARENT_TITLE &&\n titleMode !== LiteGraph.NO_TITLE\n ) {\n h += LiteGraph.NODE_TITLE_HEIGHT\n shiftY -= LiteGraph.NODE_TITLE_HEIGHT\n }\n }\n const f = ctx.fillStyle\n ctx.fillStyle = 'rgba(100, 100, 100, 0.5)'\n ctx.fillRect(shiftX, shiftY, w, h)\n ctx.fillStyle = f\n }\n\n return origDrawNode.apply(this, arguments)\n }\n\n /**\n * The currently moving, selected group only. Set after the `selected_group` has actually started\n * moving.\n */\n let selectedAndMovingGroup: LGraphGroup | null = null\n\n /**\n * Handles moving a group; tracking when a group has been moved (to show the ghost in `drawGroups`\n * below) as well as handle the last move call from LiteGraph's `processMouseUp`.\n */\n const groupMove = LGraphGroup.prototype.move\n LGraphGroup.prototype.move = function (deltax, deltay, ignore_nodes) {\n const v = groupMove.apply(this, arguments)\n // When we've started moving, set `selectedAndMovingGroup` as LiteGraph sets `selected_group`\n // too eagerly and we don't want to behave like we're moving until we get a delta.\n if (\n !selectedAndMovingGroup &&\n app.canvas.selected_group === this &&\n (deltax || deltay)\n ) {\n selectedAndMovingGroup = this\n }\n\n // LiteGraph will call group.move both on mouse-move as well as mouse-up though we only want\n // to snap on a mouse-up which we can determine by checking if `app.canvas.last_mouse_dragging`\n // has been set to `false`. Essentially, this check here is the equivalent to calling an\n // `LGraphGroup.prototype.onNodeMoved` if it had existed.\n if (app.canvas.last_mouse_dragging === false && app.shiftDown) {\n // After moving a group (while app.shiftDown), snap all the child nodes and, finally,\n // align the group itself.\n this.recomputeInsideNodes()\n for (const node of this._nodes) {\n node.alignToGrid()\n }\n LGraphNode.prototype.alignToGrid.apply(this)\n }\n return v\n }\n\n /**\n * Handles drawing a group when, snapping the size when one is actively being resized tracking and/or\n * drawing a ghost box when one is actively being moved. This mimics the node snapping behavior for\n * both.\n */\n const drawGroups = LGraphCanvas.prototype.drawGroups\n LGraphCanvas.prototype.drawGroups = function (canvas, ctx) {\n if (this.selected_group && app.shiftDown) {\n if (this.selected_group_resizing) {\n roundVectorToGrid(this.selected_group.size)\n } else if (selectedAndMovingGroup) {\n // @ts-expect-error\n const [x, y] = roundVectorToGrid([...selectedAndMovingGroup.pos])\n const f = ctx.fillStyle\n const s = ctx.strokeStyle\n ctx.fillStyle = 'rgba(100, 100, 100, 0.33)'\n ctx.strokeStyle = 'rgba(100, 100, 100, 0.66)'\n // @ts-expect-error\n ctx.rect(x, y, ...selectedAndMovingGroup.size)\n ctx.fill()\n ctx.stroke()\n ctx.fillStyle = f\n ctx.strokeStyle = s\n }\n } else if (!this.selected_group) {\n selectedAndMovingGroup = null\n }\n return drawGroups.apply(this, arguments)\n }\n\n /** Handles adding a group in a snapping-enabled state. */\n const onGroupAdd = LGraphCanvas.onGroupAdd\n LGraphCanvas.onGroupAdd = function () {\n const v = onGroupAdd.apply(app.canvas, arguments)\n if (app.shiftDown) {\n // @ts-expect-error\n const lastGroup = app.graph._groups[app.graph._groups.length - 1]\n if (lastGroup) {\n // @ts-expect-error\n roundVectorToGrid(lastGroup.pos)\n // @ts-expect-error\n roundVectorToGrid(lastGroup.size)\n }\n }\n return v\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport { ComfyNodeDef } from '@/types/apiTypes'\n\n// Adds an upload button to the nodes\n\napp.registerExtension({\n name: 'Comfy.UploadImage',\n async beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef, app) {\n if (nodeData?.input?.required?.image?.[1]?.image_upload === true) {\n nodeData.input.required.upload = ['IMAGEUPLOAD']\n }\n }\n})\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\n\nconst WEBCAM_READY = Symbol()\n\napp.registerExtension({\n name: 'Comfy.WebcamCapture',\n getCustomWidgets(app) {\n return {\n WEBCAM(node, inputName) {\n let res\n node[WEBCAM_READY] = new Promise((resolve) => (res = resolve))\n\n const container = document.createElement('div')\n container.style.background = 'rgba(0,0,0,0.25)'\n container.style.textAlign = 'center'\n\n const video = document.createElement('video')\n video.style.height = video.style.width = '100%'\n\n const loadVideo = async () => {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({\n video: true,\n audio: false\n })\n container.replaceChildren(video)\n\n setTimeout(() => res(video), 500) // Fallback as loadedmetadata doesnt fire sometimes?\n video.addEventListener('loadedmetadata', () => res(video), false)\n video.srcObject = stream\n video.play()\n } catch (error) {\n const label = document.createElement('div')\n label.style.color = 'red'\n label.style.overflow = 'auto'\n label.style.maxHeight = '100%'\n label.style.whiteSpace = 'pre-wrap'\n\n if (window.isSecureContext) {\n label.textContent =\n 'Unable to load webcam, please ensure access is granted:\\n' +\n error.message\n } else {\n label.textContent =\n 'Unable to load webcam. A secure context is required, if you are not accessing ComfyUI on localhost (127.0.0.1) you will have to enable TLS (https)\\n\\n' +\n error.message\n }\n\n container.replaceChildren(label)\n }\n }\n\n loadVideo()\n\n return { widget: node.addDOMWidget(inputName, 'WEBCAM', container) }\n }\n }\n },\n nodeCreated(node) {\n if ((node.type, node.constructor.comfyClass !== 'WebcamCapture')) return\n\n let video\n const camera = node.widgets.find((w) => w.name === 'image')\n const w = node.widgets.find((w) => w.name === 'width')\n const h = node.widgets.find((w) => w.name === 'height')\n const captureOnQueue = node.widgets.find(\n (w) => w.name === 'capture_on_queue'\n )\n\n const canvas = document.createElement('canvas')\n\n const capture = () => {\n canvas.width = w.value\n canvas.height = h.value\n const ctx = canvas.getContext('2d')\n ctx.drawImage(video, 0, 0, w.value, h.value)\n const data = canvas.toDataURL('image/png')\n\n const img = new Image()\n img.onload = () => {\n node.imgs = [img]\n app.graph.setDirtyCanvas(true)\n requestAnimationFrame(() => {\n node.setSizeForImage?.()\n })\n }\n img.src = data\n }\n\n const btn = node.addWidget(\n 'button',\n 'waiting for camera...',\n 'capture',\n capture\n )\n btn.disabled = true\n btn.serializeValue = () => undefined\n\n camera.serializeValue = async () => {\n if (captureOnQueue.value) {\n capture()\n } else if (!node.imgs?.length) {\n const err = `No webcam image captured`\n alert(err)\n throw new Error(err)\n }\n\n // Upload image to temp storage\n const blob = await new Promise<Blob>((r) => canvas.toBlob(r))\n const name = `${+new Date()}.png`\n const file = new File([blob], name)\n const body = new FormData()\n body.append('image', file)\n body.append('subfolder', 'webcam')\n body.append('type', 'temp')\n const resp = await api.fetchApi('/upload/image', {\n method: 'POST',\n body\n })\n if (resp.status !== 200) {\n const err = `Error uploading camera image: ${resp.status} - ${resp.statusText}`\n alert(err)\n throw new Error(err)\n }\n return `webcam/${name} [temp]`\n }\n\n node[WEBCAM_READY].then((v) => {\n video = v\n // If width isnt specified then use video output resolution\n if (!w.value) {\n w.value = video.videoWidth || 640\n h.value = video.videoHeight || 480\n }\n btn.disabled = false\n btn.label = 'capture'\n })\n }\n})\n","import { app } from '../../scripts/app'\nimport { api } from '../../scripts/api'\nimport type { IWidget } from '@comfyorg/litegraph'\nimport type { DOMWidget } from '@/scripts/domWidget'\nimport { ComfyNodeDef } from '@/types/apiTypes'\n\ntype FolderType = 'input' | 'output' | 'temp'\n\nfunction splitFilePath(path: string): [string, string] {\n const folder_separator = path.lastIndexOf('/')\n if (folder_separator === -1) {\n return ['', path]\n }\n return [\n path.substring(0, folder_separator),\n path.substring(folder_separator + 1)\n ]\n}\n\nfunction getResourceURL(\n subfolder: string,\n filename: string,\n type: FolderType = 'input'\n): string {\n const params = [\n 'filename=' + encodeURIComponent(filename),\n 'type=' + type,\n 'subfolder=' + subfolder,\n app.getRandParam().substring(1)\n ].join('&')\n\n return `/view?${params}`\n}\n\nasync function uploadFile(\n audioWidget: IWidget,\n audioUIWidget: DOMWidget<HTMLAudioElement>,\n file: File,\n updateNode: boolean,\n pasted: boolean = false\n) {\n try {\n // Wrap file in formdata so it includes filename\n const body = new FormData()\n body.append('image', file)\n if (pasted) body.append('subfolder', 'pasted')\n const resp = await api.fetchApi('/upload/image', {\n method: 'POST',\n body\n })\n\n if (resp.status === 200) {\n const data = await resp.json()\n // Add the file to the dropdown list and update the widget value\n let path = data.name\n if (data.subfolder) path = data.subfolder + '/' + path\n\n if (!audioWidget.options.values.includes(path)) {\n audioWidget.options.values.push(path)\n }\n\n if (updateNode) {\n audioUIWidget.element.src = api.apiURL(\n getResourceURL(...splitFilePath(path))\n )\n audioWidget.value = path\n }\n } else {\n alert(resp.status + ' - ' + resp.statusText)\n }\n } catch (error) {\n alert(error)\n }\n}\n\n// AudioWidget MUST be registered first, as AUDIOUPLOAD depends on AUDIO_UI to be\n// present.\napp.registerExtension({\n name: 'Comfy.AudioWidget',\n async beforeRegisterNodeDef(nodeType, nodeData) {\n if (\n ['LoadAudio', 'SaveAudio', 'PreviewAudio'].includes(nodeType.comfyClass)\n ) {\n nodeData.input.required.audioUI = ['AUDIO_UI']\n }\n },\n getCustomWidgets() {\n return {\n AUDIO_UI(node, inputName: string) {\n const audio = document.createElement('audio')\n audio.controls = true\n audio.classList.add('comfy-audio')\n audio.setAttribute('name', 'media')\n\n const audioUIWidget: DOMWidget<HTMLAudioElement> = node.addDOMWidget(\n inputName,\n /* name=*/ 'audioUI',\n audio\n )\n // @ts-expect-error\n // TODO: Sort out the DOMWidget type.\n audioUIWidget.serialize = false\n\n const isOutputNode = node.constructor.nodeData.output_node\n if (isOutputNode) {\n // Hide the audio widget when there is no audio initially.\n audioUIWidget.element.classList.add('empty-audio-widget')\n // Populate the audio widget UI on node execution.\n const onExecuted = node.onExecuted\n node.onExecuted = function (message) {\n onExecuted?.apply(this, arguments)\n const audios = message.audio\n if (!audios) return\n const audio = audios[0]\n audioUIWidget.element.src = api.apiURL(\n getResourceURL(audio.subfolder, audio.filename, audio.type)\n )\n audioUIWidget.element.classList.remove('empty-audio-widget')\n }\n }\n return { widget: audioUIWidget }\n }\n }\n },\n onNodeOutputsUpdated(nodeOutputs: Record<number, any>) {\n for (const [nodeId, output] of Object.entries(nodeOutputs)) {\n const node = app.graph.getNodeById(Number.parseInt(nodeId))\n if ('audio' in output) {\n const audioUIWidget = node.widgets.find(\n (w) => w.name === 'audioUI'\n ) as unknown as DOMWidget<HTMLAudioElement>\n const audio = output.audio[0]\n audioUIWidget.element.src = api.apiURL(\n getResourceURL(audio.subfolder, audio.filename, audio.type)\n )\n audioUIWidget.element.classList.remove('empty-audio-widget')\n }\n }\n }\n})\n\napp.registerExtension({\n name: 'Comfy.UploadAudio',\n async beforeRegisterNodeDef(nodeType, nodeData: ComfyNodeDef) {\n if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) {\n nodeData.input.required.upload = ['AUDIOUPLOAD']\n }\n },\n getCustomWidgets() {\n return {\n AUDIOUPLOAD(node, inputName: string) {\n // The widget that allows user to select file.\n const audioWidget: IWidget = node.widgets.find(\n (w: IWidget) => w.name === 'audio'\n )\n const audioUIWidget: DOMWidget<HTMLAudioElement> = node.widgets.find(\n (w: IWidget) => w.name === 'audioUI'\n )\n\n const onAudioWidgetUpdate = () => {\n audioUIWidget.element.src = api.apiURL(\n getResourceURL(...splitFilePath(audioWidget.value))\n )\n }\n // Initially load default audio file to audioUIWidget.\n if (audioWidget.value) {\n onAudioWidgetUpdate()\n }\n audioWidget.callback = onAudioWidgetUpdate\n\n // Load saved audio file widget values if restoring from workflow\n const onGraphConfigured = node.onGraphConfigured\n node.onGraphConfigured = function () {\n onGraphConfigured?.apply(this, arguments)\n if (audioWidget.value) {\n onAudioWidgetUpdate()\n }\n }\n\n const fileInput = document.createElement('input')\n fileInput.type = 'file'\n fileInput.accept = 'audio/*'\n fileInput.style.display = 'none'\n fileInput.onchange = () => {\n if (fileInput.files.length) {\n uploadFile(audioWidget, audioUIWidget, fileInput.files[0], true)\n }\n }\n // The widget to pop up the upload dialog.\n const uploadWidget = node.addWidget(\n 'button',\n inputName,\n /* value=*/ '',\n () => {\n fileInput.click()\n }\n )\n uploadWidget.label = 'choose file to upload'\n uploadWidget.serialize = false\n\n return { widget: uploadWidget }\n }\n }\n }\n})\n"],"names":["app","id","file","ext","prompt","links","widget","w","type","def","node","link","selectedIds","newNodes","i","group","modal","x","y","audio"],"mappings":";;;AAIO,MAAM,wBAAwB,YAAY;AAAA,SAAA;AAAA;AAAA;AAAA,EAC/C,OAAO,QAAQ,CAAA;AAAA,EACf,OAAO,WAAW;AAAA,EAElB,OAAO,eAAe,MAAM,kBAAkB,UAAU;AAChD,UAAA,OAAO,IAAI,UAAU;AAAA,MACzB,MAAM;AAAA,MACN,aAAa;AAAA,MACb;AAAA,MACA,SAAS;AAAA,IAAA,CACV;AAEe,oBAAA,MAAM,KAAK,IAAI;AAAA,EACjC;AAAA,EAEA,OAAO,oBAAoB;AAEvB,QAAA,SAAS,aACT,SAAS,UAAU,QACnB,SAAS,UAAU,KAAK,SAAS,GACjC;AACA,YAAM,cAAc,SAAS;AAAA,QAC3B;AAAA,MAAA;AAEF,UAAI,aAAa;AACH,oBAAA,MACV,SAAS,UAAU,KAAK,SAAS,UAAU,eAAe,CAAC,EAAE;AAC/D,oBAAY,MAAM,YAAY;AAC9B,oBAAY,MAAM,WAAW;AAAA,MAC/B;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