{"version":3,"file":"biit-solutions-wizardry-theme-icon.mjs","names":["i1.BiitIconService"],"sources":["../../../projects/wizardry-theme/icon/src/biit-icon/biit-icon.service.ts","../../../projects/wizardry-theme/icon/src/biit-icon/biit-icon.component.ts","../../../projects/wizardry-theme/icon/src/biit-icon/biit-icon.module.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {biitIcon, BiitIcons} from '@biit-solutions/biit-icons-collection';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class BiitIconService {\n\n  private registry: Map<biitIcon, string> = new Map<biitIcon, string>();\n  constructor() { }\n\n  public registerIcons(icons: BiitIcons[]): void {\n    icons.forEach(icon => this.registry.set(icon.name, icon.data))\n  }\n\n  public getIcon(iconName: biitIcon): string | undefined {\n    if (!this.registry.has(iconName)) {\n      console.warn(`Icon '${iconName} was not found'`);\n    }\n    return this.registry.get(iconName);\n  }\n\n}\n","import {ChangeDetectionStrategy, Component, ElementRef, Inject, Input, OnInit, Optional} from '@angular/core';\nimport {BiitIconService} from \"./biit-icon.service\";\nimport {DOCUMENT} from \"@angular/common\";\nimport {biitIcon} from '@biit-solutions/biit-icons-collection';\n\n@Component({\n    selector: 'biit-icon',\n    template: `\n    <ng-content></ng-content>\n  `,\n    styles: [':host::ng-deep svg{width: 50px; height: 50px; display: block}'],\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    standalone: false\n})\nexport class BiitIconComponent implements OnInit {\n  private svgIcon: SVGElement | undefined = undefined;\n\n  @Input('name') set nameUpdater(name: biitIcon | undefined) {\n    this.name = name;\n    this.draw();\n  }\n  @Input('svgStyle') set styleUpdater(style: any) {\n    this.style = style;\n    this.draw();\n  }\n  @Input('pathStyle') set stylePathUpdater(style: any) {\n    this.pathStyle = style;\n    this.draw();\n  }\n\n  private name: biitIcon | undefined;\n  private style: any;\n  private pathStyle: any;\n  private initialized: boolean = true; //avoids draw for each input while initializing.\n  public constructor(private element: ElementRef, private biitIconService: BiitIconService, @Optional() @Inject(DOCUMENT) private document: any) {\n  }\n\n  ngOnInit(): void {\n    this.initialized = false;\n    this.draw();\n  }\n\n  private draw(): void {\n    if(this.initialized) {\n      return;\n    }\n    if (this.svgIcon) {\n      this.element.nativeElement.removeChild(this.svgIcon);\n    }\n    if (!this.name) {\n      return;\n    }\n    const svgData: string | undefined = this.biitIconService.getIcon(this.name);\n    if (svgData) {\n      this.svgIcon = this.svgElementFromString(svgData);\n      if (!this.svgIcon) {\n        return;\n      }\n      this.svgIcon.style.width = '100%';\n      this.svgIcon.style.height = '100%';\n      if (this.style) {\n        Object.keys(this.style).forEach(styleKey => {\n          if (this.svgIcon) {\n            (this.svgIcon.style as any)[styleKey] = (this.style as any)[styleKey]\n          }\n        });\n      }\n      if (this.pathStyle) {\n        Array.from(this.svgIcon.getElementsByTagName('path')).forEach(path => {\n          Object.keys(this.pathStyle).forEach(styleKey => (path.style as any)[styleKey] = (this.pathStyle as any)[styleKey] );\n        })\n      }\n      this.element.nativeElement.appendChild(this.svgIcon);\n    }\n  }\n\n  private svgElementFromString(svgContent: string): SVGElement {\n    const div: HTMLDivElement = this.document.createElement('DIV');\n    div.innerHTML = svgContent;\n    return div.querySelector('svg') || this.document.createElementNS('http://www.w3.org/2000/svg', 'pattern');\n  }\n}\n","import { NgModule } from '@angular/core';\nimport { BiitIconComponent } from './biit-icon.component';\nimport {CommonModule} from \"@angular/common\";\n\n\n\n@NgModule({\n  declarations: [\n    BiitIconComponent\n  ],\n  imports: [\n    CommonModule\n  ],\n  exports: [\n    BiitIconComponent\n  ]\n})\nexport class BiitIconModule { }\n"],"mappings":";;;AAMA,IAAa,kBAAb,MAAa,gBAAe;CAG1B,cAAA;EADQ,KAAA,2BAAkC,IAAI,IAAG;CACjC;CAET,cAAc,OAAkB;EACrC,MAAM,SAAQ,SAAQ,KAAK,SAAS,IAAI,KAAK,MAAM,KAAK,IAAI,CAAC;CAC/D;CAEO,QAAQ,UAAkB;EAC/B,IAAI,CAAC,KAAK,SAAS,IAAI,QAAQ,GAC7B,Q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