{"version":3,"sources":["jsdelivr-header.js","/npm/projects/ngx-imageengine/src/lib/ngx-imageengine.component.ts","/npm/projects/ngx-imageengine/src/lib/ngx-imageengine.component.html","/npm/projects/ngx-imageengine/src/lib/ngx-imageengine.module.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,w8BCWgB,EACZ,EAMA,GAKA,OAAS,EAAK,IAAM,GAAK,EAAK,OAAS,IAAM,EAAK,IAAM,EAAS,SAClE,EAAK,KAAO,GAAK,EAAK,MAAQ,IAAM,EAAK,KAAO,EAAS,KAC5D,CAEA,SAAS,EAAY,EAAuB,GACxC,OAAI,GAAK,EACL,GAAK,EAAI,EAAI,EACN,GAGP,CAER,C,iBAyEI,SAAA,EAAoB,GAAA,KAAA,kBA3DX,KAAA,WAA2B,GAE3B,KAAA,KAAsB,KACtB,KAAA,KAAsB,GAEtB,KAAA,IAAqB,GACrB,KAAA,gBAAqE,GACrE,KAAA,eAAkD,KAClD,KAAA,cAAoE,GACpE,KAAA,aAAgD,KAEhD,KAAA,YAAsB,EACtB,KAAA,aAAuB,EACvB,KAAA,MAAgB,EAEhB,KAAA,0BAAoC,EACpC,KAAA,oBAA8B,EAE9B,KAAA,eAAyB,GAEzB,KAAA,OAAiB,EAK1B,KAAA,WAAqB,GACrB,KAAA,UAA2B,KAE3B,KAAA,iBAAkC,EAClC,KAAA,qBAAsC,EACtC,KAAA,kBAAmC,EACnC,KAAA,sBAAuC,EAEvC,KAAA,UAAoB,UAEpB,KAAA,SAA4C,CAAC,MAAO,EAAG,OAAQ,GAE/D,KAAA,gBAA0B,EAC1B,KAAA,OAAiB,EAEjB,KAAA,aAA8B,KAC9B,KAAA,aAA8B,I,QAEa,EAAA,UAAA,SAAA,SAAS,GAAT,IAAA,EAAA,KAC1C,KAAK,aAED,KAAK,cAAgB,OAAO,aAAa,KAAK,cAClD,KAAK,aAAe,OAAO,YAAW,WAAM,OAAA,EAAK,cAAc,GAAE,K,EAIvB,EAAA,UAAA,S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,E,KAA1B,UAEQ,eAAc,E,KAAtB,UAEQ,MAAK,E,KAAb,UAEqB,QAAO,E,KAA5B,Y,MAAU,aAqBgC,SAAQ,E,KAAlD,e,MAAa,gBAAiB,CAAC,aAQW,SAAQ,E,KAAlD,e,MAAa,gBAAiB,CAAC,gB,ME1FpC,W,oFAAa,EAAoB,KAAA,GAAA,OAAA,EAAA,gBAAA,W,mFAApB,EAAoB,aAAA,CAT7B,GAAuB,QAAA,CAG1B,iBAAa,QAAA,CAGV,K,mFAGS,EAAoB,QAAA,CAPpB,CACZ,oB,iFAMY,EAAoB,WAAA,E,KAXhC,W,MAAS,CACR,aAAc,CACZ,GAEA,QAAS,CACZ,iBAEC,QAAS,CACP,S","file":"/npm/@imageengine/imageengine-angular@0.0.31/bundles/imageengine-imageengine-angular.umd.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@imageengine/imageengine-angular@0.0.31/bundles/imageengine-imageengine-angular.umd.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import {\n    \n    Component,\n    OnInit,\n    Input,\n    ViewChild,\n    AfterViewInit,\n    ElementRef,\n    ChangeDetectorRef,\n    OnChanges,\n    SimpleChanges,\n    HostListener\n    \n} from \"@angular/core\";\n\nimport { IEDirectives, build_IE_url } from \"@imageengine/imageengine-helpers\";\n\nexport function check_if_in_viewport(\n    rect: {\n\tbottom: number,\n\tright: number,\n\tleft: number,\n\ttop: number\n    },\n    viewport: {\n\twidth: number,\n\theight: number\n    }\n) {\n    return ((rect.top > 0 || rect.bottom > 0) && rect.top < viewport.height) &&\n\t((rect.left > 0 || rect.right > 0) && rect.left < viewport.width)\n};\n\nfunction get_highest(a: number | undefined, b: number | undefined) {\n    if (a && b) {\n\treturn a >= b ? a : b;\n    } else if (a) {\n\treturn a;\n    } else {\n\treturn b;\n    }\n};\n\n\n\n@Component({\n  selector: \"ngx-imageengine\",\n  templateUrl: \"./ngx-imageengine.component.html\",\n    styles: [\n\t\".ngx-ie-image-wrapper { display: flex; flex-flow: column nowrap; justify-content: center; align-items: center; overflow: hidden; } \\\n         .ngx-ie-image { object-position: center center; }\"\n    ]\n})\n\nexport class NgxImageengineComponent implements OnInit, AfterViewInit, OnChanges {\n    @Input() directives: IEDirectives = {};\n    \n    @Input() path: string | null = null;\n    @Input() host: string | null = \"\";\n    \n    @Input() alt: string | null = \"\";\n    @Input() wrapper_classes: string[] | Set<string> | { [klass: string]: any } = {};\n    @Input() wrapper_styles: { [klass: string]: any } | null = null;\n    @Input() image_classes: string[] | Set<string> | { [klass: string]: any }  = {};\n    @Input() image_styles: { [klass: string]: any } | null = null;\n\n    @Input() responsive: boolean = false;\n    @Input() derive_size: boolean = false;\n    @Input() lazy: boolean = true;\n\n    @Input() force_size_recalculation: boolean = false;\n    @Input() device_pixel_ratio: boolean = true;\n\n    @Input() strip_from_src: string = \"\";\n\n    @Input() debug: boolean = false;\n\n    @ViewChild(\"wrapper\") wrapper!: ElementRef;\n\n\n    final_host: string = \"\";\n    final_src: string | null = null;\n    \n    image_width: number | undefined = undefined;\n    directive_width: number | undefined = undefined;\n    image_height: number | undefined = undefined;\n    directive_height: number | undefined = undefined;\n\n    image_fit: string = \"contain\";\n    \n    viewport: {width: number, height: number} = {width: 0, height: 0};\n\n    is_in_viewport: boolean = false;\n    ready: boolean = false;\n\n    resize_timer: number | null = null;\n    scroll_timer: number | null = null;\n\n    @HostListener(\"window:resize\", [\"$event\"]) onResize($event: Event): void {\n\tif (this.responsive) {\n\t    \n\t    if (this.resize_timer) { window.clearTimeout(this.resize_timer); }\n\t    this.resize_timer = window.setTimeout(() => this.maybe_resize(), 250);\n\t}\n    }\n\n    @HostListener(\"window:scroll\", [\"$event\"]) onScroll($event: Event): void {\n\tif (this.lazy) {\n\t    \n\t    if (this.scroll_timer) { window.clearTimeout(this.scroll_timer); }\n\t    this.scroll_timer = window.setTimeout(() => this.maybe_scrolled(), 100);\n\t}\n    }\n    \n    constructor(private change_detector: ChangeDetectorRef) { }\n\n    ngOnInit(): void {\n\t\n\tif (typeof this.path !== \"string\") {\n\t    throw new Error(\"Valid path attribute is required\");\n\t}\n\n\tif (this.debug && (typeof this.host !== \"string\" || this.host.trim() === \"\")) {\n\t    console.warn(\"ImageEngine host wasn't set\");\n\t}\n\n\tthis.set_final_host();\n    }\n\n    ngAfterViewInit(): void {\n\tthis.set_viewport();\n\tthis.set_sizes();\n\tthis.set_image_fit();\n\tthis.maybe_is_in_viewport();\n\tthis.build_source();\n\tthis.maybe_ready();\n    }\n\n    ngOnChanges(changes: SimpleChanges): void {\n\n\tlet is_changes =\n\t    changes.directives ||\n\t    changes.path ||\n\t    changes.host ||\n\t    changes.wrapper_classes ||\n\t    changes.wrapper_styles ||\n\t    changes.image_classes ||\n\t    changes.image_styles ||\n\t    changes.derive_size;\n\n\tif (is_changes && !is_changes.firstChange) {\n\t    this.change_detector.detectChanges();\n\t    this.set_sizes();\n\t    this.set_final_host();\n\t    this.set_image_fit();\n\t    this.maybe_is_in_viewport();\n\t    this.build_source();\n\t    this.maybe_ready();\n\t}\n    }\n\n    set_final_host(): void {\n\tthis.final_host = typeof this.host === \"string\" ? this.host : \"\";\n    }\n\n    set_image_fit(): void {\n\tswitch(this.directives.fit) {\n\t    case \"stretch\":\n\t\tthis.image_fit = \"fill\";\n\t\tbreak;\n\t    case \"cropbox\":\n\t\tthis.image_fit = \"cover\";\n\t\tbreak;\n\t    default:\n\t\tthis.image_fit = \"contain\";\n\t\tbreak;\n\t}\n    }\n\n    set_viewport(): void {\n\tthis.viewport.width = window.innerWidth || document.documentElement.clientWidth;\n\tthis.viewport.height = window.innerHeight || document.documentElement.clientHeight;\n    }\n    \n    maybe_resize(): void {\n\tthis.set_sizes();\n\tthis.set_viewport();\n\tthis.maybe_is_in_viewport();\n\tthis.maybe_ready();\n    }\n\n    maybe_scrolled(): void {\n\tthis.maybe_is_in_viewport();\n\tthis.maybe_ready();\n    }\n\n    maybe_is_in_viewport(): void {\n\tthis.is_in_viewport = check_if_in_viewport(this.wrapper.nativeElement.getBoundingClientRect(), this.viewport);\n    }\n\n    maybe_ready(): void {\n\tif (!this.ready && (!this.lazy || this.is_in_viewport)) {\n\t    this.ready = true;\n\t    \n\t    // this is needed because it might not display the image even though it\n\t    // changed and loaded\n\t    this.wrapper.nativeElement.style.backgroundSize = \"100%\";\n\t}\n\tthis.change_detector.detectChanges();\n    }\n\n    set_sizes(): void {\n\tif (this.derive_size) {\n\t    let rect = this.wrapper.nativeElement.getBoundingClientRect();\n\t    \n\t    if (this.debug) {\n\t\tconsole.log(\"derive_size is true: the wrapper element BoundingClientRect is: \", rect);\n\t    }\n\t    \n\t    this.set_sizes_by_fit(rect.width, rect.height);\n\n\t} else {\n\t    if (this.directives.no_optimization) {\n\t\tthis.directive_width = undefined;\n\t\tthis.directive_height = undefined;\n\t\tthis.image_width = undefined;\n\t\tthis.image_height = undefined;\n\t\t\n\t    } else {\n\t\tthis.set_sizes_by_fit(this.directives.width, this.directives.height);\n\t    }\n\t}\n    }\n\n    set_sizes_by_fit(width: number | undefined, height: number | undefined): void {\n\twidth = width ? Math.round(width) : width;\n\theight = height ? Math.round(height) : height;\n\tthis.directive_width = this.force_size_recalculation ? width : get_highest(this.directive_width, width)\n\tthis.directive_height = this.force_size_recalculation ? height : get_highest(this.directive_height, height);\n\n\tswitch(this.directives.fit) {\n\t    case \"box\":\n\t    case \"letterbox\":\n\t\tif (width && height && width >= (height || 0)) {\n\t\t    this.image_height = height;\n\t\t    this.image_width = undefined;\n\t\t} else if (width) {\n\t\t    this.image_width = width;\n\t\t    this.image_height = undefined;\n\t\t}\n\t\tbreak;\n\t    case \"stretch\":\n\t\tthis.image_width = width;\n\t\tthis.image_height = height;\n\t\tbreak;\n\t    default:\n\t\tif (width && height && width >= (height || 0)) {\n\t\t    this.image_width = width;\n\t\t    this.image_height = undefined;\n\t\t} else if (height) {\n\t\t    this.image_height = height;\n\t\t    this.image_width = undefined;\n\t\t}\n\t\tbreak;\n\t}\n    }\n\n    build_source(): void {\n\tlet final_directives = {...this.directives};\n\tlet final_path = this.path ? this.path.replace(this.strip_from_src, \"\") : \"\";\n\t\n\tif (this.derive_size) {\n\t    if (this.debug) {\n\t\tconsole.log(\"derive_size enabled, overriding directives width and height\");\n\t    }\n\t    final_directives.width = this.directive_width;\n\t    final_directives.height = this.directive_height;\n\t    if (this.device_pixel_ratio) {\n\t\tfinal_directives.width = final_directives.width ? final_directives.width * window.devicePixelRatio : final_directives.width;\n\t\tfinal_directives.height = final_directives.height ? final_directives.height * window.devicePixelRatio : final_directives.height;\n\t    }\n\t}\n\n\tif (this.debug) {\n\t    console.log(`final_directives object: ${JSON.stringify(final_directives)}`);\n\t}\n\tthis.final_src = build_IE_url(`${this.final_host}${final_path}`, final_directives, this.debug);\n    }\n};\n","<div #wrapper class=\"ngx-ie-image-wrapper\" [ngClass]=\"wrapper_classes\" [ngStyle]=\"wrapper_styles\">  \n  <img *ngIf=\"ready\" [src]=\"final_src\" class=\"ngx-ie-image\" [ngClass]=\"image_classes\" [ngStyle]=\"image_styles\" [alt]=\"alt\" [attr.width]=\"image_width\" [attr.height]=\"image_height\" [style.object-fit]=\"image_fit\"/>\n</div>\n","import { NgModule } from '@angular/core';\nimport { NgxImageengineComponent } from './ngx-imageengine.component';\nimport { BrowserModule } from \"@angular/platform-browser\";\n\n\n@NgModule({\n  declarations: [\n    NgxImageengineComponent\n  ],\n    imports: [\n\tBrowserModule\n  ],\n  exports: [\n    NgxImageengineComponent\n  ]\n})\nexport class NgxImageengineModule { }\n"]}