{"version":3,"file":"seatsio-seatsio-angular.mjs","names":["i1.SeatsioService","i1.SeatsioService","i1.SeatsioService","i1.SeatsioService"],"sources":["../../../projects/seatsio-angular/src/lib/seatsio.service.ts","../../../projects/seatsio-angular/src/lib/seatsio.component.ts","../../../projects/seatsio-angular/src/lib/seatsio-designer/seatsio-designer.component.ts","../../../projects/seatsio-angular/src/lib/seatsio.component.html","../../../projects/seatsio-angular/src/lib/seatsio-seating-chart/seatsio-seating-chart.component.ts","../../../projects/seatsio-angular/src/lib/seatsio.component.html","../../../projects/seatsio-angular/src/lib/seatsio-event-manager/seatsio-event-manager.component.ts","../../../projects/seatsio-angular/src/lib/seatsio.component.html","../../../projects/seatsio-angular/src/lib/seatsio-angular.module.ts"],"sourcesContent":["import {Injectable} from '@angular/core';\nimport {\n  ChartDesignerConfigOptions,\n  ChartRendererConfigOptions,\n  EventManagerConfigOptions,\n  Region,\n  SeatingChart,\n  Seatsio\n} from '@seatsio/seatsio-types';\n\ndeclare const seatsio: Seatsio;\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class SeatsioService {\n  chart: SeatingChart;\n\n  async showDesigner(config: EmbeddableProps<ChartDesignerConfigOptions>) {\n    const seatsioInstance = await this.getSeatsio(config.region, config.chartJsUrl);\n\n    delete config['chartJsUrl'];\n    delete config['region'];\n    return new seatsioInstance.SeatingChartDesigner(config).render();\n  }\n\n  async showSeatingChart(config: EmbeddableProps<ChartRendererConfigOptions>) {\n    const seatsioInstance = await this.getSeatsio(config.region, config.chartJsUrl);\n\n    delete config['chartJsUrl'];\n    delete config['region'];\n    return new seatsioInstance.SeatingChart(config).render();\n  }\n\n  async showEventManager(config: EmbeddableProps<EventManagerConfigOptions>) {\n    const seatsioInstance = await this.getSeatsio(config.region, config.chartJsUrl);\n\n    delete config['chartJsUrl'];\n    delete config['region'];\n    return new seatsioInstance.EventManager(config).render();\n  }\n\n  getSeatsio(region, chartJsUrl) {\n    if (typeof seatsio !== 'undefined') {\n      return Promise.resolve(seatsio);\n    }\n    return this.loadSeatsio(region, chartJsUrl);\n  }\n\n  loadSeatsio(region, chartJsUrl = 'https://cdn-{region}.seatsio.net/chart.js') {\n    return new Promise<Seatsio>((resolve, reject) => {\n      const script: HTMLScriptElement = document.createElement('script');\n      script.onload = () => resolve(seatsio);\n      script.onerror = () => reject(`Could not load ${script.src}`);\n      script.src = chartJsUrl.replace('{region}', region);\n      document.head.appendChild(script);\n    });\n  }\n}\n\nexport type EmbeddableProps<T> = {\n  onRenderStarted?: (chart: SeatingChart) => void\n  chartJsUrl?: string\n  region: Region\n} & T;\n","import {Component, ElementRef, Input, OnDestroy, OnInit, ChangeDetectionStrategy} from '@angular/core';\nimport {EmbeddableProps, SeatsioService} from './seatsio.service';\nimport {CommonConfigOptions, SeatingChart} from '@seatsio/seatsio-types';\n\n@Component({\n    template: '',\n    changeDetection: ChangeDetectionStrategy.Eager,\n    standalone: false\n})\nexport class SeatsioComponent<T extends CommonConfigOptions> implements OnInit, OnDestroy {\n\n  @Input() config: EmbeddableProps<T>;\n\n  seatsioService: SeatsioService;\n  chart: SeatingChart;\n\n  constructor(seatsioService: SeatsioService, private elRef: ElementRef) {\n    this.seatsioService = seatsioService;\n  }\n\n  protected render(_config: EmbeddableProps<T>): Promise<SeatingChart> {\n    throw new Error('Not implemented');\n  }\n\n  async ngOnInit() {\n    this.config['divId'] = undefined;\n    this.config['container'] = this.elRef.nativeElement.firstElementChild;\n\n    this.chart = await this.render(this.config);\n\n    if ('onRenderStarted' in this.config) {\n      this.config['onRenderStarted'](this.chart);\n    }\n  }\n\n  ngOnDestroy() {\n    if (this.chart) {\n      this.chart.destroy();\n    }\n  }\n}\n\n","import {Component, ElementRef, ChangeDetectionStrategy} from '@angular/core';\nimport {EmbeddableProps, SeatsioService} from '../seatsio.service';\nimport {SeatsioComponent} from '../seatsio.component';\nimport {ChartDesignerConfigOptions} from '@seatsio/seatsio-types';\n\n@Component({\n    selector: 'si-seatsio-designer',\n    templateUrl: '../seatsio.component.html',\n    providers: [SeatsioService],\n    changeDetection: ChangeDetectionStrategy.Eager,\n    standalone: false\n})\nexport class SeatsioDesignerComponent extends SeatsioComponent<ChartDesignerConfigOptions> {\n\n  constructor(seatsioService: SeatsioService, elRef: ElementRef) {\n    super(seatsioService, elRef);\n  }\n\n  protected render(config: EmbeddableProps<ChartDesignerConfigOptions>) {\n    return this.seatsioService.showDesigner(config);\n  }\n}\n","<div style=\"height: 100%; width: 100%;\"></div>\n","import {Component, ElementRef, ChangeDetectionStrategy} from '@angular/core';\nimport {EmbeddableProps, SeatsioService} from '../seatsio.service';\nimport {SeatsioComponent} from '../seatsio.component';\nimport {ChartRendererConfigOptions} from '@seatsio/seatsio-types';\n\n@Component({\n    selector: 'si-seatsio-seating-chart',\n    templateUrl: '../seatsio.component.html',\n    providers: [SeatsioService],\n    changeDetection: ChangeDetectionStrategy.Eager,\n    standalone: false\n})\nexport class SeatsioSeatingChartComponent extends SeatsioComponent<ChartRendererConfigOptions> {\n\n  constructor(seatsioService: SeatsioService, elRef: ElementRef) {\n    super(seatsioService, elRef);\n  }\n\n  protected render(config: EmbeddableProps<ChartRendererConfigOptions>) {\n    return this.seatsioService.showSeatingChart(config);\n  }\n}\n","<div style=\"height: 100%; width: 100%;\"></div>\n","import {Component, ElementRef, ChangeDetectionStrategy} from '@angular/core';\nimport {EmbeddableProps, SeatsioService} from '../seatsio.service';\nimport {SeatsioComponent} from '../seatsio.component';\nimport {EventManagerConfigOptions} from '@seatsio/seatsio-types';\n\n@Component({\n    selector: 'si-seatsio-event-manager',\n    templateUrl: '../seatsio.component.html',\n    providers: [SeatsioService],\n    changeDetection: ChangeDetectionStrategy.Eager,\n    standalone: false\n})\nexport class SeatsioEventManagerComponent extends SeatsioComponent<EventManagerConfigOptions> {\n\n  constructor(seatsioService: SeatsioService, elRef: ElementRef) {\n    super(seatsioService, elRef);\n  }\n\n  protected render(config: EmbeddableProps<EventManagerConfigOptions>) {\n    return this.seatsioService.showEventManager(config);\n  }\n}\n","<div style=\"height: 100%; width: 100%;\"></div>\n","import {NgModule} from '@angular/core';\nimport {SeatsioDesignerComponent} from './seatsio-designer/seatsio-designer.component';\nimport {SeatsioSeatingChartComponent} from './seatsio-seating-chart/seatsio-seating-chart.component';\nimport {SeatsioEventManagerComponent} from './seatsio-event-manager/seatsio-event-manager.component';\nimport {SeatsioComponent} from './seatsio.component';\n\n@NgModule({\n  declarations: [\n    SeatsioComponent,\n    SeatsioDesignerComponent,\n    SeatsioSeatingChartComponent,\n    SeatsioEventManagerComponent\n  ],\n  imports: [],\n  exports: [\n    SeatsioDesignerComponent,\n    SeatsioSeatingChartComponent,\n    SeatsioEventManagerComponent\n  ]\n})\nexport class SeatsioAngularModule {\n}\n"],"mappings":";;AAeA,IAAa,iBAAb,MAAa,eAAc;CACzB;CAEA,MAAM,aAAa,QAAmD;EACpE,MAAM,kBAAkB,MAAM,KAAK,WAAW,OAAO,QAAQ,OAAO,UAAU;EAE9E,OAAO,OAAO;EACd,OAAO,OAAO;EACd,OAAO,IAAI,gBAAgB,qBAAqB,MAAM,CAAC,CAAC,OAAM;CAChE;CAEA,MAAM,iBAAiB,QAAmD;EACxE,MAAM,kBAAkB,MAAM,KAAK,WAAW,OAAO,QAAQ,OAAO,UAAU;EAE9E,OAAO,OAAO;EACd,OAAO,OAAO;EACd,OAAO,IAAI,gBAAgB,aAAa,MAAM,CAAC,CAAC,OAAM;CACxD;CAEA,MAAM,iBAAiB,QAAkD;EACvE,MAAM,kBAAkB,MAAM,KAAK,WAAW,OAAO,QAAQ,OAAO,UAAU;EAE9E,OAAO,OAAO;EACd,OAAO,OAAO;EACd,OAAO,IAAI,gBAAgB,aAAa,MAAM,CAAC,CAAC,OAAM;CACxD;CAEA,WAAW,QAAQ,YAAU;EAC3B,IAAI,OAAO,YAAY,aACrB,OAAO,QAAQ,QAAQ,OAAO;EAEhC,OAAO,KAAK,YAAY,QAAQ,UAAU;CAC5C;CAEA,YAAY,QAAQ,aAAa,6CAA2C;EAC1E,OAAO,I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