File size: 22,407 Bytes
48d81fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
"""

@author: Dr.Lt.Data

@title: Impact Pack

@nickname: Impact Pack

@description: This extension offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler.

"""

import folder_paths
import os
import sys
import logging

comfy_path = os.path.dirname(folder_paths.__file__)
impact_path = os.path.join(os.path.dirname(__file__))
modules_path = os.path.join(os.path.dirname(__file__), "modules")

sys.path.append(modules_path)

import impact.config
logging.info(f"### Loading: ComfyUI-Impact-Pack ({impact.config.version})")

# Core
# recheck dependencies for colab
try:
    import folder_paths
    import torch                  # noqa: F401
    import cv2                    # noqa: F401
    from cv2 import setNumThreads # noqa: F401
    import numpy as np            # noqa: F401
    import comfy.samplers
    import comfy.sd               # noqa: F401
    from PIL import Image, ImageFilter             # noqa: F401
    from skimage.measure import label, regionprops # noqa: F401
    from collections import namedtuple             # noqa: F401
    import piexif                                  # noqa: F401
    import nodes
except Exception as e:
    import logging
    logging.error("[Impact Pack] Failed to import due to several dependencies are missing!!!!")
    raise e


import impact.impact_server  # to load server api

from .modules.impact.impact_pack import *       # noqa: F403
from .modules.impact.detectors import *         # noqa: F403
from .modules.impact.pipe import *              # noqa: F403
from .modules.impact.logics import *            # noqa: F403
from .modules.impact.util_nodes import *        # noqa: F403
from .modules.impact.segs_nodes import *        # noqa: F403
from .modules.impact.special_samplers import *  # noqa: F403
from .modules.impact.hf_nodes import *          # noqa: F403
from .modules.impact.bridge_nodes import *      # noqa: F403
from .modules.impact.hook_nodes import *        # noqa: F403
from .modules.impact.animatediff_nodes import * # noqa: F403
from .modules.impact.segs_upscaler import *     # noqa: F403

import threading


threading.Thread(target=impact.wildcards.wildcard_load).start()


NODE_CLASS_MAPPINGS = {
    "SAMLoader": SAMLoader, # noqa: F405
    "CLIPSegDetectorProvider": CLIPSegDetectorProvider, # noqa: F405
    "ONNXDetectorProvider": ONNXDetectorProvider, # noqa: F405

    "BitwiseAndMaskForEach": BitwiseAndMaskForEach, # noqa: F405
    "SubtractMaskForEach": SubtractMaskForEach, # noqa: F405

    "DetailerForEach": DetailerForEach, # noqa: F405
    "DetailerForEachAutoRetry": DetailerForEachAutoRetry, # noqa: F405
    "DetailerForEachDebug": DetailerForEachTest, # noqa: F405
    "DetailerForEachPipe": DetailerForEachPipe, # noqa: F405
    "DetailerForEachDebugPipe": DetailerForEachTestPipe, # noqa: F405
    "DetailerForEachPipeForAnimateDiff": DetailerForEachPipeForAnimateDiff, # noqa: F405

    "SAMDetectorCombined": SAMDetectorCombined, # noqa: F405
    "SAMDetectorSegmented": SAMDetectorSegmented, # noqa: F405

    "FaceDetailer": FaceDetailer, # noqa: F405
    "FaceDetailerPipe": FaceDetailerPipe, # noqa: F405
    "MaskDetailerPipe": MaskDetailerPipe, # noqa: F405

    "ToDetailerPipe": ToDetailerPipe, # noqa: F405
    "ToDetailerPipeSDXL": ToDetailerPipeSDXL, # noqa: F405
    "FromDetailerPipe": FromDetailerPipe, # noqa: F405
    "FromDetailerPipe_v2": FromDetailerPipe_v2, # noqa: F405
    "FromDetailerPipeSDXL": FromDetailerPipe_SDXL, # noqa: F405
    "AnyPipeToBasic": AnyPipeToBasic, # noqa: F405
    "ToBasicPipe": ToBasicPipe, # noqa: F405
    "FromBasicPipe": FromBasicPipe, # noqa: F405
    "FromBasicPipe_v2": FromBasicPipe_v2, # noqa: F405
    "BasicPipeToDetailerPipe": BasicPipeToDetailerPipe, # noqa: F405
    "BasicPipeToDetailerPipeSDXL": BasicPipeToDetailerPipeSDXL, # noqa: F405
    "DetailerPipeToBasicPipe": DetailerPipeToBasicPipe, # noqa: F405
    "EditBasicPipe": EditBasicPipe, # noqa: F405
    "EditDetailerPipe": EditDetailerPipe, # noqa: F405
    "EditDetailerPipeSDXL": EditDetailerPipeSDXL, # noqa: F405

    "LatentPixelScale": LatentPixelScale, # noqa: F405
    "PixelKSampleUpscalerProvider": PixelKSampleUpscalerProvider, # noqa: F405
    "PixelKSampleUpscalerProviderPipe": PixelKSampleUpscalerProviderPipe, # noqa: F405
    "IterativeLatentUpscale": IterativeLatentUpscale, # noqa: F405
    "IterativeImageUpscale": IterativeImageUpscale, # noqa: F405
    "PixelTiledKSampleUpscalerProvider": PixelTiledKSampleUpscalerProvider, # noqa: F405
    "PixelTiledKSampleUpscalerProviderPipe": PixelTiledKSampleUpscalerProviderPipe, # noqa: F405
    "TwoSamplersForMaskUpscalerProvider": TwoSamplersForMaskUpscalerProvider, # noqa: F405
    "TwoSamplersForMaskUpscalerProviderPipe": TwoSamplersForMaskUpscalerProviderPipe, # noqa: F405

    "PixelKSampleHookCombine": PixelKSampleHookCombine, # noqa: F405
    "DenoiseScheduleHookProvider": DenoiseScheduleHookProvider, # noqa: F405
    "StepsScheduleHookProvider": StepsScheduleHookProvider, # noqa: F405
    "CfgScheduleHookProvider": CfgScheduleHookProvider, # noqa: F405
    "NoiseInjectionHookProvider": NoiseInjectionHookProvider, # noqa: F405
    "UnsamplerHookProvider": UnsamplerHookProvider, # noqa: F405
    "CoreMLDetailerHookProvider": CoreMLDetailerHookProvider, # noqa: F405
    "PreviewDetailerHookProvider": PreviewDetailerHookProvider, # noqa: F405
    "BlackPatchRetryHookProvider": BlackPatchRetryHookProvider, # noqa: F405
    "CustomSamplerDetailerHookProvider": CustomSamplerDetailerHookProvider, # noqa: F405
    "LamaRemoverDetailerHookProvider": LamaRemoverDetailerHookProvider, # noqa: F405

    "DetailerHookCombine": DetailerHookCombine, # noqa: F405
    "NoiseInjectionDetailerHookProvider": NoiseInjectionDetailerHookProvider, # noqa: F405
    "UnsamplerDetailerHookProvider": UnsamplerDetailerHookProvider, # noqa: F405
    "DenoiseSchedulerDetailerHookProvider": DenoiseSchedulerDetailerHookProvider, # noqa: F405
    "SEGSOrderedFilterDetailerHookProvider": SEGSOrderedFilterDetailerHookProvider, # noqa: F405
    "SEGSRangeFilterDetailerHookProvider": SEGSRangeFilterDetailerHookProvider, # noqa: F405
    "SEGSLabelFilterDetailerHookProvider": SEGSLabelFilterDetailerHookProvider, # noqa: F405
    "VariationNoiseDetailerHookProvider": VariationNoiseDetailerHookProvider, # noqa: F405
    # "CustomNoiseDetailerHookProvider": CustomNoiseDetailerHookProvider,

    "BitwiseAndMask": BitwiseAndMask, # noqa: F405
    "SubtractMask": SubtractMask, # noqa: F405
    "AddMask": AddMask, # noqa: F405
    "MaskRectArea": MaskRectArea, # noqa: F405
    "MaskRectAreaAdvanced": MaskRectAreaAdvanced, # noqa: F405
    "ImpactSegsAndMask": SegsBitwiseAndMask, # noqa: F405
    "ImpactSegsAndMaskForEach": SegsBitwiseAndMaskForEach, # noqa: F405
    "EmptySegs": EmptySEGS, # noqa: F405
    "ImpactFlattenMask": FlattenMask, # noqa: F405

    "MediaPipeFaceMeshToSEGS": MediaPipeFaceMeshToSEGS, # noqa: F405
    "MaskToSEGS": MaskToSEGS, # noqa: F405
    "MaskToSEGS_for_AnimateDiff": MaskToSEGS_for_AnimateDiff, # noqa: F405
    "ToBinaryMask": ToBinaryMask, # noqa: F405
    "MasksToMaskList": MasksToMaskList, # noqa: F405
    "MaskListToMaskBatch": MaskListToMaskBatch, # noqa: F405
    "ImageListToImageBatch": ImageListToImageBatch, # noqa: F405
    "SetDefaultImageForSEGS": DefaultImageForSEGS, # noqa: F405
    "RemoveImageFromSEGS": RemoveImageFromSEGS, # noqa: F405

    "BboxDetectorSEGS": BboxDetectorForEach, # noqa: F405
    "SegmDetectorSEGS": SegmDetectorForEach, # noqa: F405
    "ONNXDetectorSEGS": BboxDetectorForEach, # noqa: F405
    "ImpactSimpleDetectorSEGS_for_AD": SimpleDetectorForAnimateDiff, # noqa: F405
    "ImpactSAM2VideoDetectorSEGS": SAM2VideoDetectorSEGS, # noqa: F405
    "ImpactSimpleDetectorSEGS": SimpleDetectorForEach, # noqa: F405
    "ImpactSimpleDetectorSEGSPipe": SimpleDetectorForEachPipe, # noqa: F405
    "ImpactControlNetApplySEGS": ControlNetApplySEGS, # noqa: F405
    "ImpactControlNetApplyAdvancedSEGS": ControlNetApplyAdvancedSEGS, # noqa: F405
    "ImpactControlNetClearSEGS": ControlNetClearSEGS, # noqa: F405
    "ImpactIPAdapterApplySEGS": IPAdapterApplySEGS, # noqa: F405

    "ImpactDecomposeSEGS": DecomposeSEGS, # noqa: F405
    "ImpactAssembleSEGS": AssembleSEGS, # noqa: F405
    "ImpactFrom_SEG_ELT": From_SEG_ELT, # noqa: F405
    "ImpactEdit_SEG_ELT": Edit_SEG_ELT, # noqa: F405
    "ImpactDilate_Mask_SEG_ELT": Dilate_SEG_ELT, # noqa: F405
    "ImpactDilateMask": DilateMask, # noqa: F405
    "ImpactGaussianBlurMask": GaussianBlurMask, # noqa: F405
    "ImpactDilateMaskInSEGS": DilateMaskInSEGS, # noqa: F405
    "ImpactGaussianBlurMaskInSEGS": GaussianBlurMaskInSEGS, # noqa: F405
    "ImpactScaleBy_BBOX_SEG_ELT": SEG_ELT_BBOX_ScaleBy, # noqa: F405
    "ImpactFrom_SEG_ELT_bbox": From_SEG_ELT_bbox, # noqa: F405
    "ImpactFrom_SEG_ELT_crop_region": From_SEG_ELT_crop_region, # noqa: F405
    "ImpactCount_Elts_in_SEGS": Count_Elts_in_SEGS, # noqa: F405

    "BboxDetectorCombined_v2": BboxDetectorCombined, # noqa: F405
    "SegmDetectorCombined_v2": SegmDetectorCombined, # noqa: F405
    "SegsToCombinedMask": SegsToCombinedMask, # noqa: F405

    "KSamplerProvider": KSamplerProvider, # noqa: F405
    "TwoSamplersForMask": TwoSamplersForMask, # noqa: F405
    "TiledKSamplerProvider": TiledKSamplerProvider, # noqa: F405

    "KSamplerAdvancedProvider": KSamplerAdvancedProvider, # noqa: F405
    "TwoAdvancedSamplersForMask": TwoAdvancedSamplersForMask, # noqa: F405

    "ImpactNegativeConditioningPlaceholder": NegativeConditioningPlaceholder, # noqa: F405

    "PreviewBridge": PreviewBridge, # noqa: F405
    "PreviewBridgeLatent": PreviewBridgeLatent, # noqa: F405
    "ImageSender": ImageSender, # noqa: F405
    "ImageReceiver": ImageReceiver, # noqa: F405
    "LatentSender": LatentSender, # noqa: F405
    "LatentReceiver": LatentReceiver, # noqa: F405
    "ImageMaskSwitch": ImageMaskSwitch, # noqa: F405
    "LatentSwitch": GeneralSwitch, # noqa: F405
    "SEGSSwitch": GeneralSwitch, # noqa: F405
    "ImpactSwitch": GeneralSwitch, # noqa: F405
    "ImpactInversedSwitch": GeneralInversedSwitch, # noqa: F405

    "ImpactWildcardProcessor": ImpactWildcardProcessor, # noqa: F405
    "ImpactWildcardEncode": ImpactWildcardEncode, # noqa: F405

    "SEGSUpscaler": SEGSUpscaler, # noqa: F405
    "SEGSUpscalerPipe": SEGSUpscalerPipe, # noqa: F405
    "SEGSDetailer": SEGSDetailer, # noqa: F405
    "SEGSPaste": SEGSPaste, # noqa: F405
    "SEGSPreview": SEGSPreview, # noqa: F405
    "SEGSPreviewCNet": SEGSPreviewCNet, # noqa: F405
    "SEGSToImageList": SEGSToImageList, # noqa: F405
    "ImpactSEGSToMaskList": SEGSToMaskList, # noqa: F405
    "ImpactSEGSToMaskBatch": SEGSToMaskBatch, # noqa: F405
    "ImpactSEGSConcat": SEGSConcat, # noqa: F405
    "ImpactSEGSPicker": SEGSPicker, # noqa: F405
    "ImpactMakeTileSEGS": MakeTileSEGS, # noqa: F405
    "ImpactSEGSMerge": SEGSMerge, # noqa: F405

    "SEGSDetailerForAnimateDiff": SEGSDetailerForAnimateDiff, # noqa: F405

    "ImpactKSamplerBasicPipe": KSamplerBasicPipe, # noqa: F405
    "ImpactKSamplerAdvancedBasicPipe": KSamplerAdvancedBasicPipe, # noqa: F405

    "ReencodeLatent": ReencodeLatent, # noqa: F405
    "ReencodeLatentPipe": ReencodeLatentPipe, # noqa: F405

    "ImpactImageBatchToImageList": ImageBatchToImageList, # noqa: F405
    "ImpactMakeImageList": MakeImageList, # noqa: F405
    "ImpactMakeImageBatch": MakeImageBatch, # noqa: F405
    "ImpactMakeAnyList": MakeAnyList, # noqa: F405
    "ImpactMakeMaskList": MakeMaskList, # noqa: F405
    "ImpactMakeMaskBatch": MakeMaskBatch, # noqa: F405
    "ImpactSelectNthItemOfAnyList": NthItemOfAnyList, # noqa: F405

    "RegionalSampler": RegionalSampler, # noqa: F405
    "RegionalSamplerAdvanced": RegionalSamplerAdvanced, # noqa: F405
    "CombineRegionalPrompts": CombineRegionalPrompts, # noqa: F405
    "RegionalPrompt": RegionalPrompt, # noqa: F405

    "ImpactCombineConditionings": CombineConditionings, # noqa: F405
    "ImpactConcatConditionings": ConcatConditionings, # noqa: F405

    "ImpactSEGSLabelAssign": SEGSLabelAssign, # noqa: F405
    "ImpactSEGSLabelFilter": SEGSLabelFilter, # noqa: F405
    "ImpactSEGSRangeFilter": SEGSRangeFilter, # noqa: F405
    "ImpactSEGSOrderedFilter": SEGSOrderedFilter, # noqa: F405
    "ImpactSEGSIntersectionFilter": SEGSIntersectionFilter, # noqa: F405
    "ImpactSEGSNMSFilter": SEGSNMSFilter, # noqa: F405

    "ImpactCompare": ImpactCompare, # noqa: F405
    "ImpactConditionalBranch": ImpactConditionalBranch, # noqa: F405
    "ImpactConditionalBranchSelMode": ImpactConditionalBranchSelMode, # noqa: F405
    "ImpactIfNone": ImpactIfNone, # noqa: F405
    "ImpactConvertDataType": ImpactConvertDataType, # noqa: F405
    "ImpactLogicalOperators": ImpactLogicalOperators, # noqa: F405
    "ImpactInt": ImpactInt, # noqa: F405
    "ImpactFloat": ImpactFloat, # noqa: F405
    "ImpactBoolean": ImpactBoolean, # noqa: F405
    "ImpactValueSender": ImpactValueSender, # noqa: F405
    "ImpactValueReceiver": ImpactValueReceiver, # noqa: F405
    "ImpactImageInfo": ImpactImageInfo, # noqa: F405
    "ImpactLatentInfo": ImpactLatentInfo, # noqa: F405
    "ImpactMinMax": ImpactMinMax, # noqa: F405
    "ImpactNeg": ImpactNeg, # noqa: F405
    "ImpactConditionalStopIteration": ImpactConditionalStopIteration, # noqa: F405
    "ImpactStringSelector": StringSelector, # noqa: F405
    "StringListToString": StringListToString, # noqa: F405
    "WildcardPromptFromString": WildcardPromptFromString, # noqa: F405
    "ImpactExecutionOrderController": ImpactExecutionOrderController, # noqa: F405
    "ImpactListBridge": ImpactListBridge, # noqa: F405

    "RemoveNoiseMask": RemoveNoiseMask, # noqa: F405

    "ImpactLogger": ImpactLogger, # noqa: F405
    "ImpactDummyInput": ImpactDummyInput, # noqa: F405

    "ImpactQueueTrigger": ImpactQueueTrigger, # noqa: F405
    "ImpactQueueTriggerCountdown": ImpactQueueTriggerCountdown, # noqa: F405
    "ImpactSetWidgetValue": ImpactSetWidgetValue, # noqa: F405
    "ImpactNodeSetMuteState": ImpactNodeSetMuteState, # noqa: F405
    "ImpactControlBridge": ImpactControlBridge, # noqa: F405
    "ImpactIsNotEmptySEGS": ImpactNotEmptySEGS, # noqa: F405
    "ImpactSleep": ImpactSleep, # noqa: F405
    "ImpactRemoteBoolean": ImpactRemoteBoolean, # noqa: F405
    "ImpactRemoteInt": ImpactRemoteInt, # noqa: F405

    "ImpactHFTransformersClassifierProvider": HF_TransformersClassifierProvider, # noqa: F405
    "ImpactSEGSClassify": SEGS_Classify, # noqa: F405

    "ImpactSchedulerAdapter": ImpactSchedulerAdapter, # noqa: F405
    "GITSSchedulerFuncProvider": GITSSchedulerFuncProvider # noqa: F405
}


NODE_DISPLAY_NAME_MAPPINGS = {
    "SAMLoader": "SAMLoader (Impact)",

    "BboxDetectorSEGS": "BBOX Detector (SEGS)",
    "SegmDetectorSEGS": "SEGM Detector (SEGS)",
    "ONNXDetectorSEGS": "ONNX Detector (SEGS/legacy) - use BBOXDetector",
    "ImpactSimpleDetectorSEGS_for_AD": "Simple Detector for Video (SEGS)",
    "ImpactSAM2VideoDetectorSEGS": "SAM2 Video Detector (SEGS)",
    "ImpactSimpleDetectorSEGS": "Simple Detector (SEGS)",
    "ImpactSimpleDetectorSEGSPipe": "Simple Detector (SEGS/pipe)",
    "ImpactControlNetApplySEGS": "ControlNetApply (SEGS) - DEPRECATED",
    "ImpactControlNetApplyAdvancedSEGS": "ControlNetApply (SEGS)",
    "ImpactIPAdapterApplySEGS": "IPAdapterApply (SEGS)",

    "BboxDetectorCombined_v2": "BBOX Detector (combined)",
    "SegmDetectorCombined_v2": "SEGM Detector (combined)",
    "SegsToCombinedMask": "SEGS to MASK (combined)",
    "MediaPipeFaceMeshToSEGS": "MediaPipe FaceMesh to SEGS",
    "MaskToSEGS": "MASK to SEGS",
    "MaskToSEGS_for_AnimateDiff": "MASK to SEGS for Video",
    "BitwiseAndMaskForEach": "Pixelwise(SEGS & SEGS)",
    "SubtractMaskForEach": "Pixelwise(SEGS - SEGS)",
    "ImpactSegsAndMask": "Pixelwise(SEGS & MASK)",
    "ImpactSegsAndMaskForEach": "Pixelwise(SEGS & MASKS ForEach)",
    "BitwiseAndMask": "Pixelwise(MASK & MASK)",
    "SubtractMask": "Pixelwise(MASK - MASK)",
    "AddMask": "Pixelwise(MASK + MASK)",
    "MaskRectArea": "Mask Rect Area",
    "MaskRectAreaAdvanced": "Mask Rect Area (Advanced)",
    "ImpactFlattenMask": "Flatten Mask Batch",
    "DetailerForEach": "Detailer (SEGS)",
    "DetailerForEachAutoRetry": "Detailer (SEGS) with auto retry",
    "DetailerForEachPipe": "Detailer (SEGS/pipe)",
    "DetailerForEachDebug": "DetailerDebug (SEGS)",
    "DetailerForEachDebugPipe": "DetailerDebug (SEGS/pipe)",
    "SEGSDetailerForAnimateDiff": "SEGSDetailer For Video (SEGS/pipe)",
    "DetailerForEachPipeForAnimateDiff": "Detailer For Video (SEGS/pipe)",
    "SEGSUpscaler": "Upscaler (SEGS)",
    "SEGSUpscalerPipe": "Upscaler (SEGS/pipe)",

    "SAMDetectorCombined": "SAMDetector (combined)",
    "SAMDetectorSegmented": "SAMDetector (segmented)",
    "FaceDetailerPipe": "FaceDetailer (pipe)",
    "MaskDetailerPipe": "MaskDetailer (pipe)",

    "FromDetailerPipeSDXL": "FromDetailer (SDXL/pipe)",
    "BasicPipeToDetailerPipeSDXL": "BasicPipe -> DetailerPipe (SDXL)",
    "EditDetailerPipeSDXL": "Edit DetailerPipe (SDXL)",

    "BasicPipeToDetailerPipe": "BasicPipe -> DetailerPipe",
    "DetailerPipeToBasicPipe": "DetailerPipe -> BasicPipe",
    "EditBasicPipe": "Edit BasicPipe",
    "EditDetailerPipe": "Edit DetailerPipe",
    "AnyPipeToBasic": "Any PIPE -> BasicPipe",

    "LatentPixelScale": "Latent Scale (on Pixel Space)",
    "IterativeLatentUpscale": "Iterative Upscale (Latent/on Pixel Space)",
    "IterativeImageUpscale": "Iterative Upscale (Image)",

    "TwoSamplersForMaskUpscalerProvider": "TwoSamplersForMask Upscaler Provider",
    "TwoSamplersForMaskUpscalerProviderPipe": "TwoSamplersForMask Upscaler Provider (pipe)",

    "ReencodeLatent": "Reencode Latent",
    "ReencodeLatentPipe": "Reencode Latent (pipe)",

    "ImpactKSamplerBasicPipe": "KSampler (pipe)",
    "ImpactKSamplerAdvancedBasicPipe": "KSampler (Advanced/pipe)",
    "ImpactSEGSLabelAssign": "SEGS Assign (label)",
    "ImpactSEGSLabelFilter": "SEGS Filter (label)",
    "ImpactSEGSRangeFilter": "SEGS Filter (range)",
    "ImpactSEGSOrderedFilter": "SEGS Filter (ordered)",
    "ImpactSEGSIntersectionFilter": "SEGS Filter (intersection)",
    "ImpactSEGSNMSFilter": "SEGS Filter (non max suppression)",
    "ImpactSEGSConcat": "SEGS Concat",
    "ImpactSEGSToMaskList": "SEGS to Mask List",
    "ImpactSEGSToMaskBatch": "SEGS to Mask Batch",
    "ImpactSEGSPicker": "Picker (SEGS)",
    "ImpactMakeTileSEGS": "Make Tile SEGS",
    "ImpactSEGSMerge": "SEGS Merge",

    "ImpactDecomposeSEGS": "Decompose (SEGS)",
    "ImpactAssembleSEGS": "Assemble (SEGS)",
    "ImpactFrom_SEG_ELT": "From SEG_ELT",
    "ImpactEdit_SEG_ELT": "Edit SEG_ELT",
    "ImpactFrom_SEG_ELT_bbox": "From SEG_ELT bbox",
    "ImpactFrom_SEG_ELT_crop_region": "From SEG_ELT crop_region",
    "ImpactDilate_Mask_SEG_ELT": "Dilate Mask (SEG_ELT)",
    "ImpactScaleBy_BBOX_SEG_ELT": "ScaleBy BBOX (SEG_ELT)",
    "ImpactCount_Elts_in_SEGS": "Count Elts in SEGS",
    "ImpactDilateMask": "Dilate Mask",
    "ImpactGaussianBlurMask": "Gaussian Blur Mask",
    "ImpactDilateMaskInSEGS": "Dilate Mask (SEGS)",
    "ImpactGaussianBlurMaskInSEGS": "Gaussian Blur Mask (SEGS)",

    "PreviewBridge": "Preview Bridge (Image)",
    "PreviewBridgeLatent": "Preview Bridge (Latent)",
    "ImageSender": "Image Sender",
    "ImageReceiver": "Image Receiver",
    "ImageMaskSwitch": "Switch (images, mask)",
    "ImpactSwitch": "Switch (Any)",
    "ImpactInversedSwitch": "Inversed Switch (Any)",
    "ImpactExecutionOrderController": "Execution Order Controller",
    "ImpactListBridge": "List Bridge",

    "MasksToMaskList": "Mask Batch to Mask List",
    "MaskListToMaskBatch": "Mask List to Mask Batch",
    "ImpactImageBatchToImageList": "Image Batch to Image List",
    "ImageListToImageBatch": "Image List to Image Batch",

    "ImpactMakeImageList": "Make Image List",
    "ImpactMakeImageBatch": "Make Image Batch",
    "ImpactMakeMaskList": "Make Mask List",
    "ImpactMakeMaskBatch": "Make Mask Batch",
    "ImpactMakeAnyList": "Make List (Any)",
    "ImpactSelectNthItemOfAnyList": "Select Nth Item (Any list)",

    "ImpactStringSelector": "String Selector",
    "StringListToString": "String List to String",
    "WildcardPromptFromString": "Wildcard Prompt from String",
    "ImpactIsNotEmptySEGS": "SEGS isn't Empty",
    "SetDefaultImageForSEGS": "Set Default Image for SEGS",
    "RemoveImageFromSEGS": "Remove Image from SEGS",

    "RemoveNoiseMask": "Remove Noise Mask",

    "ImpactCombineConditionings": "Combine Conditionings",
    "ImpactConcatConditionings": "Concat Conditionings",

    "ImpactQueueTrigger": "Queue Trigger",
    "ImpactQueueTriggerCountdown": "Queue Trigger (Countdown)",
    "ImpactSetWidgetValue": "Set Widget Value",
    "ImpactNodeSetMuteState": "Set Mute State",
    "ImpactControlBridge": "Control Bridge",
    "ImpactSleep": "Sleep",
    "ImpactRemoteBoolean": "Remote Boolean (on prompt)",
    "ImpactRemoteInt": "Remote Int (on prompt)",

    "ImpactHFTransformersClassifierProvider": "HF Transformers Classifier Provider",
    "ImpactSEGSClassify": "SEGS Classify",

    "LatentSwitch": "Switch (latent/legacy)",
    "SEGSSwitch": "Switch (SEGS/legacy)",

    "SEGSPreviewCNet": "SEGSPreview (CNET Image)",

    "ImpactSchedulerAdapter": "Impact Scheduler Adapter",
    "GITSSchedulerFuncProvider": "GITSScheduler Func Provider",
    "ImpactNegativeConditioningPlaceholder": "Negative Cond Placeholder"
}


# NOTE:  Inject directly into EXTENSION_WEB_DIRS instead of WEB_DIRECTORY
#        Provide the js path fixed as ComfyUI-Impact-Pack instead of the path name, making it available for external use

# WEB_DIRECTORY = "js"  -- deprecated method
nodes.EXTENSION_WEB_DIRS["ComfyUI-Impact-Pack"] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'js')


__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']