{"version":3,"file":"taiga-ui-cdk-directives-visual-viewport.mjs","sources":["../../../projects/cdk/directives/visual-viewport/visual-viewport.directive.ts","../../../projects/cdk/directives/visual-viewport/taiga-ui-cdk-directives-visual-viewport.ts"],"sourcesContent":["import {Directive, inject} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {WA_WINDOW} from '@ng-web-apis/common';\nimport {WaViewportService} from '@ng-web-apis/screen-orientation';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiPx} from '@taiga-ui/cdk/utils/miscellaneous';\n\n@Directive({selector: '[tuiVisualViewport]'})\nexport class TuiVisualViewport {\n    private readonly w = inject(WA_WINDOW);\n    private readonly style = tuiInjectElement().style;\n    private minInnerHeight = Infinity;\n\n    protected readonly $ = inject(WaViewportService)\n        .pipe(takeUntilDestroyed())\n        .subscribe(({offsetLeft, offsetTop, height, width, scale}) => {\n            this.minInnerHeight = Math.min(this.minInnerHeight, this.w.innerHeight);\n\n            this.style.setProperty('--tui-viewport-x', tuiPx(offsetLeft));\n            this.style.setProperty('--tui-viewport-y', tuiPx(offsetTop));\n            this.style.setProperty('--tui-viewport-height', tuiPx(height));\n            this.style.setProperty('--tui-viewport-width', tuiPx(width));\n            this.style.setProperty('--tui-viewport-scale', String(scale));\n            this.style.setProperty('--tui-viewport-vh', tuiPx(this.w.innerHeight / 100));\n            this.style.setProperty('--tui-viewport-vw', tuiPx(this.w.innerWidth / 100));\n            this.style.setProperty(\n                '--tui-viewport-svh',\n                tuiPx(this.minInnerHeight / 100),\n            );\n        });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAQa,iBAAiB,CAAA;AAD9B,IAAA,WAAA,GAAA;AAEqB,QAAA,IAAA,CAAA,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;AACrB,QAAA,IAAA,CAAA,KAAK,GAAG,gBAAgB,EAAE,CAAC,KAAK;QACzC,IAAA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