{"version":3,"file":"kadung-product-image-editor.mjs","sources":["../../../projects/product-image-editor/_directives/save-generated-images.directive.ts","../../../projects/product-image-editor/_services/product-image-editor.service.ts","../../../projects/product-image-editor/component/product-image-editor.component.ts","../../../projects/product-image-editor/component/product-image-editor.component.html","../../../projects/product-image-editor/component/product-image-editor.module.ts","../../../projects/product-image-editor/public-api.ts","../../../projects/product-image-editor/kadung-product-image-editor.ts"],"sourcesContent":["import { Directive, Host, HostListener, Input } from '@angular/core';\nimport { ProductImageEditorComponent } from '../component';\n\n@Directive({\n  selector: '[saveGeneratedImages]',\n})\nexport class SaveGeneratedImagesDirective {\n  @Input('saveGeneratedImages')\n  productImageEditorComponent: ProductImageEditorComponent;\n  constructor() {}\n\n  @HostListener('click')\n  onSave(): void {\n    this.productImageEditorComponent.save();\n  }\n}\n","import { Injectable } from '@angular/core';\r\nimport { ProductType } from '../_models/product-type';\r\nimport { arrayIntersection } from '@kadung/kadung/_core';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\nimport { ProductRequest } from '../_models/product-request';\r\n\r\n@Injectable()\r\nexport class ProductImageEditorService {\r\n  canvasChanged$ = new BehaviorSubject<{ [key: number]: boolean }>({});\r\n  loadedParts: Set<number> = new Set();\r\n  colorsChanged$ = new BehaviorSubject<boolean>(false);\r\n  objectsLoaded$ = new BehaviorSubject<boolean>(false);\r\n  printTypeChanged$ = new BehaviorSubject<boolean>(false);\r\n  product: Partial<ProductRequest>;\r\n\r\n  printServiceInfo: {\r\n    parts: {\r\n      visibleBoxPaintOccupation: any;\r\n      id: number;\r\n      refferentProductTypeItemProductTypePartPrintAreaInMM: number;\r\n    }[];\r\n    printTypeId: number;\r\n    colors: any[];\r\n  };\r\n  priceInfo$Source = new BehaviorSubject<{ [key: number]: any }>(null);\r\n  priceInfo$ = this.priceInfo$Source.pipe(\r\n    map((priceInfo) => {\r\n      if (priceInfo) {\r\n        Object.entries(priceInfo).forEach(\r\n          ([productTypeBasePrice, value]: any) => {\r\n            priceInfo[productTypeBasePrice] = {\r\n              ...value,\r\n              basePrice:\r\n                value.productTypeParts\r\n                  .filter(\r\n                    (productTypePart) => !productTypePart.includedInBasePrice\r\n                  )\r\n                  .reduce((acc, curr) => acc + curr.price, 0) +\r\n                +productTypeBasePrice,\r\n            };\r\n          }\r\n        );\r\n      }\r\n\r\n      return priceInfo;\r\n    })\r\n  );\r\n\r\n  constructor() {}\r\n\r\n  finishEditing(\r\n    productObjects: any[],\r\n    productType: ProductType,\r\n    canvasProperties: { height: number; width: number }\r\n  ): void {\r\n    this.product = {\r\n      ...this.product,\r\n      canvas: canvasProperties,\r\n      sizeIds: productType.sizes.map((s) => s.id),\r\n      productTypeId: productType.id,\r\n      productTypeParts: productObjects,\r\n      imageProductObjects: [],\r\n      textProductObjects: [],\r\n      imageSuffixUrls: [],\r\n      productImages: [],\r\n      productImageVariants: [],\r\n      code: '',\r\n      printTasksChanged:\r\n        Object.values(this.canvasChanged$.value).filter(\r\n          (canvasChanged) => canvasChanged\r\n        ).length > 0 ||\r\n        this.colorsChanged$.value ||\r\n        this.printTypeChanged$.value,\r\n    };\r\n  }\r\n\r\n  determinePrintService(productType: ProductType): void {\r\n    const priceInfo = {};\r\n\r\n    Object.keys(productType.colorsWithPrices).forEach((basePrice) => {\r\n      const selectedColors = arrayIntersection(\r\n        this.printServiceInfo.colors,\r\n        productType.colorsWithPrices[basePrice]\r\n      );\r\n      if (selectedColors.length > 0) {\r\n        priceInfo[+basePrice] = {\r\n          colors: selectedColors,\r\n          sizes: productType.sizes.sort((a, b) => a.id - b.id),\r\n          productTypeParts: [],\r\n        };\r\n      }\r\n    });\r\n\r\n    this.printServiceInfo.parts.forEach((part) => {\r\n      const productTypePart = productType.productTypeParts.filter(\r\n        (ptp) => +ptp.id === part.id\r\n      )[0];\r\n\r\n      const selectedProductTypePartPrintTypePrintSize =\r\n        productTypePart.productTypePartPrintTypeList\r\n          .filter(\r\n            (ptppt) => ptppt.printTypeId === this.printServiceInfo.printTypeId\r\n          )[0]\r\n          .productTypePartPrintTypePrintSizeList.filter(\r\n            (ptpptps) =>\r\n              ptpptps.minArea <=\r\n                part.refferentProductTypeItemProductTypePartPrintAreaInMM *\r\n                  part.visibleBoxPaintOccupation.paintAreaOccupation &&\r\n              part.refferentProductTypeItemProductTypePartPrintAreaInMM *\r\n                part.visibleBoxPaintOccupation.paintAreaOccupation <\r\n                ptpptps.maxArea\r\n          )[0];\r\n\r\n      Object.keys(priceInfo).forEach((basePrice) => {\r\n        const printServices =\r\n          selectedProductTypePartPrintTypePrintSize.printServiceList.filter(\r\n            (ps) =>\r\n              priceInfo[basePrice].colors.map((c) => +c.id).includes(ps.colorId)\r\n          );\r\n\r\n        priceInfo[basePrice].productTypeParts.push({\r\n          id: productTypePart.id,\r\n          name: productTypePart.name,\r\n          printSize: selectedProductTypePartPrintTypePrintSize.name,\r\n          orderNumber: productTypePart.orderNumber,\r\n          printServiceIdList: printServices.map((ps) => ps.id),\r\n          price: printServices[0].price,\r\n        });\r\n      });\r\n    });\r\n\r\n    Object.keys(priceInfo).forEach((basePrice) => {\r\n      const minSelectedPrintServicePriceProductType = priceInfo[\r\n        +basePrice\r\n      ].productTypeParts.sort((a, b) =>\r\n        a.price > b.price\r\n          ? -1\r\n          : a.price < b.price\r\n          ? 1\r\n          : a.orderNumber < b.orderNumber\r\n          ? -1\r\n          : 1\r\n      )[0];\r\n\r\n      priceInfo[+basePrice].productTypeParts.forEach(\r\n        (ptp) => (ptp.includedInBasePrice = false)\r\n      );\r\n\r\n      if (minSelectedPrintServicePriceProductType) {\r\n        minSelectedPrintServicePriceProductType.includedInBasePrice = true;\r\n      }\r\n\r\n      priceInfo[basePrice].productTypeParts.sort(\r\n        (a, b) => a.orderNumber - b.orderNumber\r\n      );\r\n    });\r\n\r\n    this.priceInfo$Source.next(priceInfo);\r\n  }\r\n}\r\n","import {\r\n  AfterViewInit,\r\n  ChangeDetectionStrategy,\r\n  Component,\r\n  EventEmitter,\r\n  Inject,\r\n  Input,\r\n  OnDestroy,\r\n  OnInit,\r\n  Optional,\r\n  Output,\r\n  TemplateRef,\r\n  ViewChild,\r\n} from '@angular/core';\r\nimport {\r\n  createBackgroundColor,\r\n  IMAGE_EDITOR_SERVICE,\r\n  ImageEditorComponent,\r\n  ImageEditorService,\r\n} from '@kadung/image-editor';\r\nimport { Color } from '@kadung/image-editor/_models/color';\r\nimport { EditingBox } from '@kadung/image-editor/_models/editing-box';\r\nimport {\r\n  BehaviorSubject,\r\n  combineLatest,\r\n  forkJoin,\r\n  of,\r\n  Subscription,\r\n} from 'rxjs';\r\nimport { map, take, tap } from 'rxjs/operators';\r\nimport { SubSink } from 'subsink';\r\nimport { ProductTypePart } from '../_models/product-type-part';\r\nimport { ProductImageEditorService } from '../_services';\r\n\r\n@Component({\r\n  selector: 'product-image-editor',\r\n  templateUrl: './product-image-editor.component.html',\r\n  styleUrls: ['./product-image-editor.component.scss'],\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class ProductImageEditorComponent\r\n  implements OnInit, AfterViewInit, OnDestroy\r\n{\r\n  @ViewChild(ImageEditorComponent, { static: false })\r\n  editor: ImageEditorComponent;\r\n  @Input() btnClass: string = 'btn btn-submit btn-small';\r\n  @Input() product: any;\r\n  @Input() productType: any;\r\n  @Input() actionMode: 'EDIT' | 'ADD';\r\n  @Input() chosenColors: Color[];\r\n  @Input() formTemplate: TemplateRef<any>;\r\n  @Input() showCustomUploadButton = true;\r\n  @Output() generatedProductResultHandler = new EventEmitter<{}>();\r\n  @Output() generatedProductImageDataHandler = new EventEmitter();\r\n  activeColor$ = new BehaviorSubject<Color>(null);\r\n  subs = new SubSink();\r\n  currentImagePrintSize$ = new BehaviorSubject<string>('');\r\n  chosenGalleryImage$;\r\n  selectedProductTypePart$ = new BehaviorSubject<any>(null);\r\n\r\n  createColor = createBackgroundColor;\r\n\r\n  setImageEditorObjectMeta = (object: any) => {\r\n    return {\r\n      fileAssetId: object.id,\r\n    };\r\n  };\r\n\r\n  initialPart: ProductTypePart;\r\n  editingBox: EditingBox;\r\n  colors$ = new BehaviorSubject<Color[]>([]);\r\n  colorPrices: {\r\n    color: any;\r\n    price: any;\r\n    _meta: {\r\n      backgroundColor: string;\r\n    };\r\n  }[] = [];\r\n  printTypes: { id: number; name: string; guideUrl: string | null }[] = [];\r\n\r\n  objects$ = new BehaviorSubject<any[]>([]);\r\n  backgroundColor$ = new BehaviorSubject<string>('transparent');\r\n\r\n  constructor(\r\n    private productImageEditorService: ProductImageEditorService,\r\n    @Optional()\r\n    @Inject(IMAGE_EDITOR_SERVICE)\r\n    private imageEditorService: ImageEditorService\r\n  ) {}\r\n\r\n  ngOnInit(): void {\r\n    this.initialPart =\r\n      this.productType.productTypeParts.find(\r\n        (ptp) => +ptp.id === +this.product?.primaryPartId\r\n      ) || this.productType.productTypeParts[0];\r\n\r\n    this.selectProductTypePart(this.initialPart);\r\n\r\n    this.subs.add(\r\n      this.selectedProductTypePart$.subscribe((selectedProductTypePart) => {\r\n        if (selectedProductTypePart) {\r\n          this.objects$.next(\r\n            this.actionMode === 'EDIT'\r\n              ? this.product.objects\r\n                  .map((object) => ({\r\n                    ...object,\r\n                    objectItem: {\r\n                      ...object.productObjectTypeItem,\r\n                      objectImageUrl:\r\n                        object.productObjectTypeItem.productObjectImageUrl,\r\n                      _meta: {\r\n                        fileAssetId: object.productObjectTypeItem.fileAssetId,\r\n                      },\r\n                    },\r\n                  }))\r\n                  .filter(\r\n                    (o) => o.productTypePartId === selectedProductTypePart.id\r\n                  )\r\n              : []\r\n          );\r\n\r\n          this.backgroundColor$.next(\r\n            this.actionMode === 'EDIT'\r\n              ? this.product.productPrintTaskList.length > 0\r\n                ? this.product.productPrintTaskList.find(\r\n                    (ppt) =>\r\n                      ppt.productTypePartId === +selectedProductTypePart.id\r\n                  )?.printBackgroundColor\r\n                : 'transparent'\r\n              : 'transparent'\r\n          );\r\n        }\r\n      })\r\n    );\r\n\r\n    this.colors$.next(\r\n      []\r\n        .concat(...Object.values(this.productType.colorsWithPrices))\r\n        .map((c) => {\r\n          return {\r\n            ...c,\r\n            selected: +this.productType.defaultColorId === +c.id,\r\n            canvasImage: this.initialPart.partColorImages.find(\r\n              (partColorImage) => +partColorImage.color.id === +c.id\r\n            ).imageUrl,\r\n          };\r\n        })\r\n    );\r\n\r\n    this.activeColor$.next(\r\n      this.colors$.value.find((color) =>\r\n        this.actionMode === 'EDIT'\r\n          ? +this.product?.primaryColorId === +color.id\r\n          : +color.id === +this.productType.defaultColorId\r\n      )\r\n    );\r\n\r\n    this.editingBox = {\r\n      scaleX: this.initialPart.scaleX,\r\n      scaleY: this.initialPart.scaleY,\r\n      left: this.initialPart.left,\r\n      top: this.initialPart.top,\r\n      width: this.initialPart.width,\r\n      height: this.initialPart.height,\r\n      angle: this.initialPart.angle,\r\n      backgroundColor: this.initialPart.backgroundColor,\r\n    };\r\n\r\n    this.subs.add(\r\n      this.imageEditorService?.visibleBoxPaintOccupation$.subscribe((info) => {\r\n        this.onVisibleBoxPaintOccupationChange(info);\r\n      })\r\n    );\r\n\r\n    this.colorPrices = Object.keys(this.productType.colorsWithPrices).flatMap(\r\n      (basePrice) =>\r\n        this.productType.colorsWithPrices[basePrice].map((color) => ({\r\n          sizes: this.productType.sizes,\r\n          color: color,\r\n          price: {\r\n            productTypeBasePrice: +basePrice,\r\n            basePrice: +basePrice,\r\n            price: +basePrice + this.productType.recommendedProfit,\r\n            profit: this.productType.recommendedProfit,\r\n          },\r\n          _meta: {\r\n            backgroundColor: createBackgroundColor(color),\r\n          },\r\n        }))\r\n    );\r\n\r\n    this.printTypes = this.productType.productTypeParts\r\n      .flatMap((ptp) =>\r\n        ptp.productTypePartPrintTypeList.map((ptppt) => ({\r\n          id: ptppt.printTypeId,\r\n          name: ptppt.printTypeName,\r\n          guideUrl: ptppt.guideUrl,\r\n        }))\r\n      )\r\n      // filters distinct values\r\n      .filter(\r\n        (element, index, self) =>\r\n          index === self.findIndex((t) => t.id === element.id)\r\n      );\r\n\r\n    this.determineInitialPrintService();\r\n  }\r\n\r\n  ngAfterViewInit(): void {\r\n    this.setColors(this.initialPart);\r\n\r\n    this.subs.add(\r\n      combineLatest([\r\n        this.productImageEditorService.priceInfo$,\r\n        this.selectedProductTypePart$,\r\n      ]).subscribe(\r\n        ([priceInfo, selectedProductTypePart]: [any, ProductTypePart]) => {\r\n          this.currentImagePrintSize$.next(\r\n            Object.values(priceInfo)[0]['productTypeParts'].find(\r\n              (ptp) => ptp.id === selectedProductTypePart.id\r\n            )?.printSize\r\n          );\r\n\r\n          this.chosenGalleryImage$ = this.editor?.chosenGalleryImage$;\r\n        }\r\n      )\r\n    );\r\n  }\r\n\r\n  determineInitialPrintService(): void {\r\n    const colorIds =\r\n      this.actionMode === 'EDIT'\r\n        ? this.product.productItems\r\n            .map((pi) => pi.colorId || pi.color?.id)\r\n            .filter(\r\n              (element, index, self) =>\r\n                index === self.findIndex((t) => t === element)\r\n            )\r\n        : this.colorPrices.map((c) => c.color.id);\r\n\r\n    this.productImageEditorService.printServiceInfo = {\r\n      parts:\r\n        this.actionMode === 'EDIT'\r\n          ? this.product.productPrintTaskList\r\n              ?.filter(\r\n                (element, index, self) =>\r\n                  index ===\r\n                  self.findIndex(\r\n                    (t) => t.productTypePartId === element.productTypePartId\r\n                  )\r\n              )\r\n              .map((ppt) => {\r\n                const partColorImage = this.productType.productTypeParts.filter(\r\n                  (ptp) => +ptp.id === ppt.productTypePartId\r\n                )[0].partColorImages[0];\r\n\r\n                return {\r\n                  id: ppt.productTypePartId,\r\n                  visibleBoxPaintOccupation: ppt.printAreaInfo\r\n                    ? JSON.parse(ppt.printAreaInfo)\r\n                    : { paintAreaOccupation: 0 },\r\n                  refferentProductTypeItemProductTypePartPrintAreaInMM:\r\n                    partColorImage.referentSizePrintAreaHeight *\r\n                    partColorImage.referentSizePrintAreaWidth,\r\n                };\r\n              })\r\n          : [],\r\n      printTypeId:\r\n        this.actionMode === 'EDIT'\r\n          ? this.product.productPrintTaskList.length > 0\r\n            ? this.product.productPrintTaskList[0].printTypeId\r\n            : this.printTypes[0].id\r\n          : this.printTypes[0].id,\r\n      colors: this.colorPrices\r\n        .filter((cp) => colorIds.includes(cp.color.id))\r\n        .map((cp) => cp.color),\r\n    };\r\n\r\n    this.productImageEditorService.determinePrintService(this.productType);\r\n  }\r\n\r\n  selectProductTypePart(productTypePart: ProductTypePart): void {\r\n    if (this.editor && this.selectedProductTypePart$.value) {\r\n      this.selectedProductTypePart$.value.objects = this.editor.getObjects();\r\n    }\r\n\r\n    this.selectedProductTypePart$.next(productTypePart);\r\n    this.productImageEditorService.loadedParts.add(+productTypePart.id);\r\n\r\n    this.editingBox = {\r\n      scaleX: productTypePart.scaleX,\r\n      scaleY: productTypePart.scaleY,\r\n      left: productTypePart.left,\r\n      top: productTypePart.top,\r\n      width: productTypePart.width,\r\n      height: productTypePart.height,\r\n      angle: productTypePart.angle,\r\n      backgroundColor: productTypePart.backgroundColor,\r\n    };\r\n\r\n    this.setColors(productTypePart);\r\n  }\r\n\r\n  setColors(productTypePart: ProductTypePart): void {\r\n    const updatedColors = this.colors$.value.map((color) => ({\r\n      ...color,\r\n      canvasImage: productTypePart.partColorImages.find(\r\n        (partColorImage) => +partColorImage.color.id === +color.id\r\n      ).imageUrl,\r\n    }));\r\n\r\n    this.colors$.next(updatedColors);\r\n\r\n    const newActiveColor =\r\n      updatedColors.find(\r\n        (color) => +color.id === +this.editor?.activeColor$.value.id\r\n      ) ??\r\n      updatedColors.find(\r\n        (color) => +color.id === +this.productType.defaultColorId\r\n      );\r\n\r\n    this.activeColor$.next(newActiveColor);\r\n  }\r\n\r\n  onObjectsLoaded(event: any): void {\r\n    if (!this.productImageEditorService.objectsLoaded$.value) {\r\n      this.productImageEditorService.objectsLoaded$.next(event);\r\n    }\r\n  }\r\n\r\n  onCanvasChanged(): void {\r\n    this.productImageEditorService.canvasChanged$.next({\r\n      ...this.productImageEditorService.canvasChanged$,\r\n      [this.selectedProductTypePart$.value.id]: true,\r\n    });\r\n  }\r\n\r\n  onVisibleBoxPaintOccupationChange(event): void {\r\n    if (this.editor.getObjects().length > 0) {\r\n      const selectedProductTypePartIndex =\r\n        this.productImageEditorService.printServiceInfo.parts\r\n          .map((p) => p.id)\r\n          .indexOf(+this.selectedProductTypePart$.value.id);\r\n      if (selectedProductTypePartIndex !== -1) {\r\n        this.productImageEditorService.printServiceInfo.parts[\r\n          selectedProductTypePartIndex\r\n        ].visibleBoxPaintOccupation = event;\r\n      } else {\r\n        this.productImageEditorService.printServiceInfo.parts.push({\r\n          visibleBoxPaintOccupation: event,\r\n          id: +this.selectedProductTypePart$.value.id,\r\n          refferentProductTypeItemProductTypePartPrintAreaInMM:\r\n            this.selectedProductTypePart$.value.partColorImages[0]\r\n              .referentSizePrintAreaHeight *\r\n            this.selectedProductTypePart$.value.partColorImages[0]\r\n              .referentSizePrintAreaWidth,\r\n        });\r\n      }\r\n    } else {\r\n      this.productImageEditorService.printServiceInfo.parts =\r\n        this.productImageEditorService.printServiceInfo.parts.filter(\r\n          (p) => p.id !== +this.selectedProductTypePart$.value.id\r\n        );\r\n    }\r\n\r\n    this.productImageEditorService.determinePrintService(this.productType);\r\n  }\r\n\r\n  save(providedColors: Color[] = null): void {\r\n    this.selectedProductTypePart$.value.objects = this.editor.getObjects();\r\n    const productObjects = this.productType.productTypeParts.map((ptp) => {\r\n      return {\r\n        productTypePartId: ptp.id,\r\n        id: ptp.id,\r\n        objects:\r\n          ptp.objects ||\r\n          (this.actionMode === 'EDIT'\r\n            ? this.product.objects\r\n                .map((o) => ({\r\n                  ...o,\r\n                  objectItem: {\r\n                    ...o.productObjectTypeItem,\r\n                    objectImageUrl:\r\n                      o.productObjectTypeItem.productObjectImageUrl,\r\n                    _meta: {\r\n                      fileAssetId: o.productObjectTypeItem.fileAssetId,\r\n                    },\r\n                  },\r\n                }))\r\n                .filter((o) => o.productTypePartId === ptp.id)\r\n            : []),\r\n        hasBeenLoaded: this.productImageEditorService.loadedParts.has(+ptp.id),\r\n        partColorImages: ptp.partColorImages,\r\n        orderNumber: ptp.orderNumber,\r\n        printType: ptp.printType,\r\n        backgroundColor: ptp.backgroundColor\r\n          ? ptp.backgroundColor\r\n          : 'transparent',\r\n        productTypePartPrintTypes: ptp.productTypePartPrintTypeList,\r\n        drawableRectangle: {\r\n          left: ptp.left,\r\n          top: ptp.top,\r\n          width: ptp.width,\r\n          height: ptp.height,\r\n          angle: ptp.angle,\r\n          scaleX: ptp.scaleX,\r\n          scaleY: ptp.scaleY,\r\n        },\r\n      };\r\n    });\r\n\r\n    this.product = {\r\n      ...this.product,\r\n      canvas: this.editor.canvasProperties$.value,\r\n      sizeIds: this.productType.sizes.map((s) => s.id),\r\n      id: this.productType.id,\r\n      productTypeId: this.productType.id,\r\n      productTypeParts: productObjects,\r\n      code: '',\r\n      printTasksChanged:\r\n        Object.values(\r\n          this.productImageEditorService.canvasChanged$.value\r\n        ).filter((canvasChanged) => canvasChanged).length > 0 ||\r\n        this.productImageEditorService.colorsChanged$.value ||\r\n        this.productImageEditorService.printTypeChanged$.value,\r\n    };\r\n\r\n    this.product.productTypeParts.forEach((ptp) => {\r\n      ptp.objects = ptp.objects.filter(\r\n        (o) => !(o.type === 'textbox' && o.value === '')\r\n      );\r\n    });\r\n\r\n    const generateImageRequests = this.product.productTypeParts.map((ptp) => {\r\n      if (!ptp.hasBeenLoaded) {\r\n        return this.editor.loadObjects(ptp).pipe(\r\n          map((objects) => {\r\n            ptp.objects = objects;\r\n\r\n            const { getResult, getImageData } =\r\n              this.editor.generateImageRequest({\r\n                ...ptp,\r\n                colors: (providedColors?.length > 0\r\n                  ? this.colors$.value.filter((color) =>\r\n                      providedColors.find(\r\n                        (providedColor) => +providedColor.id === +color.id\r\n                      )\r\n                    )\r\n                  : this.colors$.value\r\n                ).map((c) => ({\r\n                  ...c,\r\n                  canvasImage: ptp.partColorImages.find(\r\n                    (partColorImage) => +partColorImage.color.id === +c.id\r\n                  ).imageUrl,\r\n                })),\r\n              });\r\n\r\n            const result = getResult();\r\n\r\n            const processedResult = {\r\n              ...result,\r\n              imageVariants: result.imageVariants.map((imageVariant) => ({\r\n                ...imageVariant,\r\n                serialNumber: ptp.orderNumber,\r\n              })),\r\n              images: result['images'].map((image) => {\r\n                const printServiceInfoPart =\r\n                  this.productImageEditorService.printServiceInfo.parts.find(\r\n                    (part) => part.id === +ptp.productTypePartId\r\n                  );\r\n\r\n                return {\r\n                  ...image,\r\n                  printServiceIdList: this.generatePrintServiceIdList(\r\n                    this.productImageEditorService.priceInfo$Source.value\r\n                  )[ptp.productTypePartId],\r\n                  printAreaOccupation:\r\n                    printServiceInfoPart?.visibleBoxPaintOccupation\r\n                      .paintAreaOccupation,\r\n                  printAreaInfo: JSON.stringify(\r\n                    printServiceInfoPart?.visibleBoxPaintOccupation\r\n                  ),\r\n                };\r\n              }),\r\n            };\r\n\r\n            return { result: processedResult, imageData$: getImageData() };\r\n          })\r\n        );\r\n      } else {\r\n        const { getResult, getImageData } = this.editor.generateImageRequest({\r\n          ...ptp,\r\n          colors: (providedColors?.length > 0\r\n            ? this.colors$.value.filter((color) =>\r\n                providedColors.find(\r\n                  (providedColor) => +providedColor.id === +color.id\r\n                )\r\n              )\r\n            : this.colors$.value\r\n          ).map((c) => ({\r\n            ...c,\r\n            canvasImage: ptp.partColorImages.find(\r\n              (partColorImage) => +partColorImage.color.id === +c.id\r\n            ).imageUrl,\r\n          })),\r\n        });\r\n\r\n        const result = getResult();\r\n\r\n        const processedResult = {\r\n          ...result,\r\n          imageVariants: result.imageVariants.map((imageVariant) => ({\r\n            ...imageVariant,\r\n            serialNumber: ptp.orderNumber,\r\n          })),\r\n          images: result['images'].map((image) => {\r\n            const printServiceInfoPart =\r\n              this.productImageEditorService.printServiceInfo.parts.find(\r\n                (part) => part.id === +ptp.productTypePartId\r\n              );\r\n\r\n            return {\r\n              ...image,\r\n              printServiceIdList: this.generatePrintServiceIdList(\r\n                this.productImageEditorService.priceInfo$Source.value\r\n              )[ptp.productTypePartId],\r\n              printAreaOccupation:\r\n                printServiceInfoPart?.visibleBoxPaintOccupation\r\n                  .paintAreaOccupation,\r\n              printAreaInfo: JSON.stringify(\r\n                printServiceInfoPart?.visibleBoxPaintOccupation\r\n              ),\r\n            };\r\n          }),\r\n        };\r\n\r\n        return of({ result: processedResult, imageData$: getImageData() });\r\n      }\r\n    });\r\n\r\n    this.subs.add(\r\n      forkJoin(generateImageRequests).subscribe(\r\n        (generatedImageRequest: { result: any; imageData$: any }[]) => {\r\n          const results = generatedImageRequest.map((req) => req.result);\r\n          this.generatedProductResultHandler.emit({\r\n            results,\r\n            product: {\r\n              ...this.product,\r\n              productImageVariants: results.flatMap((result) =>\r\n                result.imageVariants.map((variant) => ({\r\n                  ...variant,\r\n                  productTypePartId: variant.id,\r\n                  productImageUrl: variant.imageUrl,\r\n                }))\r\n              ),\r\n              imageProductObjects: results.flatMap((result) =>\r\n                result.imageObjects.map((imageObject) => ({\r\n                  ...imageObject,\r\n                  productTypePartId: imageObject.id,\r\n                  productObjectTypeItem: {\r\n                    ...imageObject.objectItem,\r\n                    productObjectImageUrl:\r\n                      imageObject.objectItem.objectImageUrl,\r\n                  },\r\n                }))\r\n              ),\r\n              productImages: results.flatMap((result) =>\r\n                result.images.map((image) => ({\r\n                  ...image,\r\n                  productTypePartId: image.id,\r\n                }))\r\n              ),\r\n              imageSuffixUrls: results.flatMap(\r\n                (result) => result.imageSuffixUrls\r\n              ),\r\n              textProductObjects: results.flatMap(\r\n                (result) => result.textObjects\r\n              ),\r\n            },\r\n          });\r\n\r\n          let subscription: Subscription;\r\n          subscription = forkJoin(\r\n            generatedImageRequest.map((req) =>\r\n              req.imageData$.pipe(map((imageData) => imageData))\r\n            )\r\n          ).subscribe(\r\n            (imageData) => {\r\n              this.generatedProductImageDataHandler.emit(imageData);\r\n              subscription?.unsubscribe();\r\n            },\r\n            (error) => {\r\n              console.log(error);\r\n            }\r\n          );\r\n        }\r\n      )\r\n    );\r\n  }\r\n\r\n  generatePrintServiceIdList(priceInfo: any): any {\r\n    const printServiceIdList = {};\r\n\r\n    Object.values(priceInfo).forEach((priceValue: any) => {\r\n      priceValue.productTypeParts.forEach((productTypePart) => {\r\n        if (!printServiceIdList[productTypePart.id]) {\r\n          printServiceIdList[productTypePart.id] = [];\r\n        }\r\n\r\n        printServiceIdList[productTypePart.id] = [\r\n          ...printServiceIdList[productTypePart.id],\r\n          ...productTypePart.printServiceIdList,\r\n        ];\r\n      });\r\n    });\r\n\r\n    return printServiceIdList;\r\n  }\r\n\r\n  ngOnDestroy(): void {\r\n    this.subs.unsubscribe();\r\n    this.productImageEditorService.canvasChanged$.next({});\r\n    this.productImageEditorService.colorsChanged$.next(false);\r\n    this.productImageEditorService.printTypeChanged$.next(false);\r\n    this.productImageEditorService.priceInfo$Source.next(null);\r\n    this.productImageEditorService.loadedParts = new Set();\r\n  }\r\n}\r\n","<div\r\n  class=\"d-flex w-100 h-100\"\r\n  *ngIf=\"selectedProductTypePart$ | async as selectedProductTypePart\"\r\n>\r\n  <image-editor\r\n    [showCustomUploadButton]=\"showCustomUploadButton\"\r\n    [activeColor$]=\"activeColor$\"\r\n    class=\"w-100 h-100\"\r\n    [customTemplate]=\"customTemplate\"\r\n    [image]=\"selectedProductTypePart\"\r\n    [objects]=\"objects$ | async\"\r\n    [colors]=\"colors$ | async\"\r\n    [backgroundColor]=\"backgroundColor$ | async\"\r\n    [btnClass]=\"btnClass\"\r\n    [editingBox]=\"editingBox\"\r\n    (objectsLoaded)=\"onObjectsLoaded($event)\"\r\n    (canvasChanged)=\"onCanvasChanged()\"\r\n    [setObjectMeta]=\"setImageEditorObjectMeta\"\r\n    [formTemplate]=\"formTemplate\"\r\n  >\r\n    <ng-template #customTemplate>\r\n      <div\r\n        class=\"d-flex part-tabs align-items-center w-100 p-1\"\r\n        style=\"height: 40px\"\r\n      >\r\n        <div\r\n          id=\"partTabs\"\r\n          class=\"h-100 d-flex part-tabs align-items-center cursor-pointer p-2\"\r\n          *ngFor=\"let ptp of productType.productTypeParts\"\r\n          style=\"color: #6c757d\"\r\n          [class.text-primary]=\"ptp === selectedProductTypePart\"\r\n          [class.selected-product-type-part]=\"ptp === selectedProductTypePart\"\r\n          [class.fw-bold]=\"ptp === selectedProductTypePart\"\r\n          (click)=\"selectProductTypePart(ptp)\"\r\n        >\r\n          <a>{{ ptp.name }} </a>\r\n        </div>\r\n      </div>\r\n    </ng-template>\r\n\r\n    <div\r\n      class=\"d-flex align-items-center flex-column\"\r\n      currentImagePrintSize\r\n      *ngIf=\"currentImagePrintSize$ | async as currentImagePrintSize\"\r\n    >\r\n      <p class=\"fw-bold mt-2 p3 mb-0 text-wrap text-center\">\r\n        {{ \"dashboard.editor.printSize\" | translate }}:\r\n      </p>\r\n      <p class=\"fw-bold text-wrap text-center p3 mb-0\">\r\n        {{ currentImagePrintSize }}\r\n      </p>\r\n      <i\r\n        class=\"icon-information\"\r\n        [kaduTooltip]=\"'dashboard.editor.imagePrintSizeTooltip' | translate\"\r\n      ></i>\r\n    </div>\r\n  </image-editor>\r\n\r\n  <ng-content></ng-content>\r\n</div>\r\n","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule } from '@angular/core';\r\nimport {\r\n  FileUploadHandlerDirective,\r\n  IMAGE_EDITOR_ENVIRONMENT_CONFIG,\r\n  IMAGE_EDITOR_SERVICE,\r\n  ImageEditorModule,\r\n  TRANSLATE_CONFIG,\r\n} from '@kadung/image-editor';\r\nimport { KaduLetModule } from '@kadung/kadung/kadu-let';\r\nimport { KaduTooltipModule } from '@kadung/kadung/kadu-tooltip';\r\nimport { SaveGeneratedImagesDirective } from '../_directives';\r\nimport { ProductImageEditorComponent } from './product-image-editor.component';\r\nimport { ProductImageEditorService } from '../_services';\r\n\r\n@NgModule({\r\n  declarations: [ProductImageEditorComponent, SaveGeneratedImagesDirective],\r\n  imports: [CommonModule, ImageEditorModule, KaduTooltipModule, KaduLetModule],\r\n  providers: [ProductImageEditorService],\r\n  exports: [ProductImageEditorComponent, SaveGeneratedImagesDirective, ImageEditorModule],\r\n})\r\nexport class ProductImageEditorModule {\r\n  static forRoot(config: {\r\n    environmentConfig: any;\r\n    imageEditorService: any;\r\n    translateConfig: any;\r\n    loaderService: any;\r\n  }): ModuleWithProviders<ProductImageEditorModule> {\r\n    return {\r\n      ngModule: ProductImageEditorModule,\r\n      providers: [\r\n        {\r\n          provide: IMAGE_EDITOR_ENVIRONMENT_CONFIG,\r\n          useValue: config.environmentConfig,\r\n        },\r\n        {\r\n          provide: IMAGE_EDITOR_SERVICE,\r\n          useClass: config.imageEditorService,\r\n        },\r\n        {\r\n          provide: TRANSLATE_CONFIG,\r\n          useFactory: (service: any) => ({\r\n            service: service,\r\n            method: config.translateConfig.method,\r\n          }),\r\n          deps: [config.translateConfig.service],\r\n        },\r\n      ],\r\n    };\r\n  }\r\n}\r\n","/*\n * Public API Surface of product-image-editor\n */\n\nexport * from './component';\nexport * from './_services';\nexport * from './_directives';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAMa,4BAA4B,CAAA;AAGvC,IAAA,WAAA,GAAA,GAAgB;IAGhB,MAAM,GAAA;AACJ,QAAA,IAAI,CAAC,2BAA2B,CAAC,IAAI,EAAE,CAAC;KACzC;;yHARU,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;6GAA5B,4BAA4B,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,EAAA,2BAAA,EAAA,CAAA,qBAAA,EAAA,6BAAA,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,UAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBAHxC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oB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