{"version":3,"file":"ajf-material-barcode.mjs","sources":["../../../projects/material/barcode/src/barcode.ts","../../../projects/material/barcode/src/barcode.html","../../../projects/material/barcode/src/barcode-module.ts","../../../projects/material/barcode/src/public_api.ts","../../../projects/material/barcode/src/ajf-material-barcode.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfBarcode} from '@ajf/core/barcode';\nimport {\n  AfterViewInit,\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  forwardRef,\n  OnDestroy,\n  Renderer2,\n  ViewEncapsulation,\n} from '@angular/core';\nimport {NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {Subscription} from 'rxjs';\nimport {switchMap} from 'rxjs/operators';\n\nexport const BARCODE_CONTROL_VALUE_ACCESSOR: any = {\n  provide: NG_VALUE_ACCESSOR,\n  useExisting: forwardRef(() => AjfBarcodeComponent),\n  multi: true,\n};\n\n/**\n * Ajf barcode component.\n */\n@Component({\n  selector: 'ajf-barcode',\n  templateUrl: 'barcode.html',\n  styleUrls: ['barcode.scss'],\n  encapsulation: ViewEncapsulation.None,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  providers: [BARCODE_CONTROL_VALUE_ACCESSOR],\n})\nexport class AjfBarcodeComponent extends AjfBarcode implements OnDestroy, AfterViewInit {\n  sourceSelectSub: Subscription = Subscription.EMPTY;\n  resetSub: Subscription = Subscription.EMPTY;\n  constructor(cdr: ChangeDetectorRef, renderer: Renderer2) {\n    super(cdr, renderer);\n    this.resetSub = this.resetEvt.subscribe(() => this.setupVideoSourceSub());\n  }\n\n  setupVideoSourceSub() {\n    if (this.videoSourceSelect == undefined) return;\n    this.sourceSelectSub.unsubscribe();\n    this.sourceSelectSub = this.videoSourceSelect.valueChange\n      .pipe(switchMap(() => this.getStream()))\n      .subscribe(c => console.log(c));\n  }\n\n  ngAfterViewInit(): void {\n    this.initVideoStreams();\n    this.setupVideoSourceSub();\n  }\n\n  ngOnDestroy(): void {\n    console.log('a');\n    this.stopCurrentStream();\n    this.sourceSelectSub.unsubscribe();\n    this.resetSub.unsubscribe();\n  }\n}\n","<ng-container *ngIf=\"value; else barcode\">\n  <div class=\"ajf-code-container\">\n    <span>{{ value }}</span>\n    <button mat-raised-button (click)=\"reset()\">\n      <mat-icon style=\"transform: rotate(90deg)\">format_align_justify</mat-icon>\n    </button>\n  </div>\n</ng-container>\n<ng-template #barcode>\n  <mat-tab-group (selectedIndexChange)=\"onTabChange($event)\">\n    <mat-tab [label]=\"'Image'| transloco\">\n      <div class=\"ajf-drop-container\">\n        <div class=\"ajf-dropzone\" ajfDnd (file)=\"onSelectDrop($event)\">\n          <div class=\"ajf-text-wrapper\">\n            <div class=\"ajf-centered\">\n              <a mat-button (click)=\"fileInput.click()\"\n                >{{'Drop your image here or click to select'|transloco}}</a\n              >\n            </div>\n          </div>\n        </div>\n        <div #barcodeImagePreview class=\"ajf-barcode-image-preview\"></div>\n      </div>\n      <input\n        #fileInput\n        type=\"file\"\n        (change)=\"onSelectFile($event)\"\n        multiple\n        style=\"display: none\"\n      />\n    </mat-tab>\n    <mat-tab [label]=\"'Camera'|transloco\">\n      <mat-form-field\n        appearance=\"fill\"\n        class=\"ajf-video-device-select\"\n      >\n        <mat-label>Choose Video source</mat-label>\n        <mat-select #videoSourceSelect\n          ><mat-option *ngFor=\"let device of videoDevices|async\" [value]=\"device.deviceId\">\n            {{device.label}}\n          </mat-option></mat-select\n        ></mat-form-field\n      >\n      <div class=\"ajf-barcode-video\">\n        <ng-container *ngIf=\"supportsVideoStream; else noVideo\">\n          <div #barcodeVideoPreview class=\"ajf-video-preview ajf-video-preview-hidden\">\n            <div *ngIf=\"value && value.length > 0\">{{ value }}</div>\n          </div>\n          <video #barcodeVideo autoplay playsinline muted></video>\n        </ng-container>\n        <ng-template #noVideo>\n          <div>NO VIDEO</div>\n        </ng-template>\n      </div>\n    </mat-tab>\n  </mat-tab-group>\n</ng-template>\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfCommonModule} from '@ajf/core/common';\nimport {AjfTranslocoModule} from '@ajf/core/transloco';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatTabsModule} from '@angular/material/tabs';\n\nimport {AjfBarcodeComponent} from './barcode';\nimport {MatSelectModule} from '@angular/material/select';\nimport {FormsModule} from '@angular/forms';\n\n@NgModule({\n  imports: [\n    AjfCommonModule,\n    AjfTranslocoModule,\n    CommonModule,\n    FormsModule,\n    MatButtonModule,\n    MatIconModule,\n    MatSelectModule,\n    MatTabsModule,\n  ],\n  declarations: [AjfBarcodeComponent],\n  exports: [AjfBarcodeComponent],\n})\nexport class AjfBarcodeModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './barcode';\nexport * from './barcode-module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;AAiBU,MAAA,8BAA8B,GAAQ;AACjD,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,mBAAmB,CAAC;AAClD,IAAA,KAAK,EAAE,IAAI;;AAGb;;AAEG;AASG,MAAO,mBAAoB,SAAQ,UAAU,CAAA;IAGjD,WAAY,CAAA,GAAsB,EAAE,QAAmB,EAAA;AACrD,QAAA,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC;AAHtB,QAAA,IAAA,CAAA,eAAe,GAAiB,YAAY,CAAC,KAAK;AAClD,QAAA,IAAA,CAAA,QAAQ,GAAiB,YAAY,CAAC,KAAK;AAGzC,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;;IAG3E,mBAAmB,GAAA;AACjB,QAAA,IAAI,IAAI,CAAC,iBAAiB,IAAI,SAAS;YAAE;AACzC,QAAA,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;AAClC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