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8CAiBAP,EAAAA,EAAAA,IAAAA,EADCQ,EAAAA,EAAAA,IAAWC,EAAAA,KACZ,uCAGAT,EAAAA,EAAAA,IAAAA,EADCQ,EAAAA,EAAAA,IAAWE,EAAAA,EAAAA,wBACZ,6CAnMiB3G,GAAkB,UADtC4G,EAAAA,EAAAA,IAAU,CAAEC,WAAY,CAAE5E,SAAF,IAAY6E,YAAZ,IAAyBC,SAAQA,EAAAA,MACrC/G,G","sources":["webpack://sbs.vison/./Scripts/ts/App/Areas/Embed/IndexPage.vue.ts"],"sourcesContent":["import { Guid } from 'Api/Dto/Drive';\r\nimport { ApiException } from 'Api/Dto/QueryResult';\r\nimport { ViewerStateType } from 'Api/Enums/ViewerStateType';\r\nimport { ExploreService, IComment, Project } from 'Api/ExploreService';\r\nimport { BasePage, Component, Prop, Watch } from 'App/Areas/BasePage';\r\nimport 'App/Areas/Explore/DetailsExplore.vue.ts.scss';\r\nimport { IPlayerContext } from 'App/Areas/Shares/IPlayerContext';\r\nimport VoPlayer from 'App/Areas/Shares/VoPlayer.vue';\r\nimport { injectTypes } from 'App/injectTypes';\r\nimport { lazyInject } from 'App/Inversify.config';\r\nimport { TokenValidator, TokenValidatorFactory } from 'App/Services/TokenValidator';\r\nimport VueMarkdown from 'vue-markdown';\r\nimport { Ref } from 'vue-property-decorator';\r\nimport { VOverlay } from 'vuetify/lib';\r\n\r\ninterface IExploreState {\r\n pId: number;\r\n token?: string;\r\n}\r\n\r\n@Component({ components: { VoPlayer, VueMarkdown, VOverlay } })\r\nexport default class ExploreDetailsPage extends BasePage {\r\n public created(): void {\r\n this.baseTranslationPath = 'Areas.Explore.Views.Home.Detail';\r\n this._resizeObserver = new ResizeObserver(this.$debounce(this._onPlayerSizeChanged, 500));\r\n }\r\n\r\n public async mounted(): Promise {\r\n this.isDrawerEnabled = false;\r\n this.isGoToHomeEnabled = false;\r\n\r\n await this.$nextTick();\r\n\r\n document.addEventListener('keydown', ev => { this._onKeyDown(ev); });\r\n document.addEventListener('fullscreenchange', ev => this._exitFullscreenHandler(ev), false);\r\n\r\n this.currentState = {\r\n pId: Number.parseInt(this.getUrlParameter('pId')),\r\n token: this.getUrlParameter('token')\r\n };\r\n\r\n let mode: ViewerStateType = this.defaultState;\r\n\r\n if (this.isMobileOrTabletDevice) {\r\n mode = ViewerStateType.FullScreen;\r\n }\r\n else {\r\n let urlDisplayMode = this.getUrlParameter('mode');\r\n\r\n if (urlDisplayMode) {\r\n let urlStateValue = ViewerStateType[urlDisplayMode];\r\n\r\n if (urlStateValue >= ViewerStateType.FullPage && urlStateValue <= ViewerStateType.FullScreen) {\r\n mode = urlStateValue;\r\n }\r\n }\r\n }\r\n\r\n let playerElement = this.$refs.player;\r\n\r\n if (playerElement instanceof VoPlayer) {\r\n this.playerComponent = playerElement;\r\n }\r\n\r\n this.displayMode = mode;\r\n }\r\n\r\n @Watch('currentState')\r\n @Watch('codeCulture')\r\n private async _loadProjectAsync(): Promise {\r\n try {\r\n this.loadProjectError = null;\r\n\r\n if (this.currentState) {\r\n this._tokenValidator = this._tokenValidatorFactory(this.currentState.token);\r\n\r\n let p = await this._tokenValidator.executeAsync(token =>\r\n this._exploreService.loadProjectAsync(this.currentState.pId, token, '')\r\n );\r\n\r\n let isStandaloneDatasource = p.datasources.find(ds => ds.name == 'isStandalone');\r\n if (isStandaloneDatasource) {\r\n isStandaloneDatasource.value = this.appContext.isStandalone;\r\n }\r\n\r\n document.title = p.name;\r\n\r\n if (window.history.state == null || window.history.state.pId != p.id) {\r\n let url = new URL(location.href);\r\n url.searchParams.set('pId', `${p.id}`);\r\n\r\n if (this.currentState.token) {\r\n url.searchParams.set('token', this.currentState.token);\r\n }\r\n\r\n window.history.pushState({ pId: p.id, token: this.currentState.token }, p.name, url.href);\r\n }\r\n\r\n this.project = p;\r\n await this.$nextTick();\r\n this._resizeObserver.disconnect();\r\n this._resizeObserver.observe(this.playerTheaterContainer);\r\n\r\n await this._updateProjectCountAsync(p.id);\r\n }\r\n }\r\n catch (e) {\r\n if (!(e instanceof ApiException)) {\r\n throw e;\r\n }\r\n\r\n this.loadProjectError = e.error\r\n }\r\n }\r\n\r\n private async _updateProjectCountAsync(idProject: number): Promise {\r\n try {\r\n await this._exploreService.addViewProjectAsync(idProject);\r\n }\r\n catch {\r\n //TODO Intercept error\r\n }\r\n }\r\n\r\n\r\n private _onKeyDown(evt: KeyboardEvent): void {\r\n let isEscape = false;\r\n\r\n if ('key' in evt) {\r\n isEscape = (evt.key == 'Escape' || evt.key == 'Esc');\r\n }\r\n\r\n if (isEscape && !this.isStateLocked) {\r\n this.displayMode = this.defaultState;\r\n }\r\n }\r\n\r\n private _exitFullscreenHandler(e: Event): void {\r\n let isInFullscreen = document.fullscreen;\r\n\r\n if (!isInFullscreen && !this.isStateLocked) {\r\n this.displayMode = this.defaultState;\r\n }\r\n }\r\n\r\n private _onPlayerSizeChanged(e: Array): void {\r\n const [resizeObserverEntry] = e;\r\n\r\n const { width, height } = resizeObserverEntry.contentRect;\r\n\r\n document.body.style.setProperty('--player-container-width', `${width}px`);\r\n document.body.style.setProperty('--player-container-height', `${height}px`);\r\n }\r\n\r\n @Watch('displayMode')\r\n private async _onDisplayModePropertyChanged(value: ViewerStateType, oldValue: ViewerStateType): Promise {\r\n await this.$nextTick();\r\n\r\n let viewerState = ViewerStateType[value] || ViewerStateType[this.defaultState];\r\n value = ViewerStateType[viewerState];\r\n\r\n this.isFullScreen = false;\r\n this.drawer = false;\r\n\r\n const player = this.playerComponent?.$el as HTMLElement;\r\n\r\n if (player && value == ViewerStateType.FullPage || value == ViewerStateType.FullScreen) {\r\n player.scrollIntoView({ block: 'start', inline: 'start' });\r\n\r\n if (value == ViewerStateType.FullScreen) {\r\n this.isFullScreen = true;\r\n\r\n try {\r\n if (document.body.requestFullscreen) {\r\n await document.body.requestFullscreen();\r\n }\r\n }\r\n catch (e) { }\r\n }\r\n }\r\n }\r\n\r\n public get playerContext(): IPlayerContext {\r\n if (this.playerComponent) {\r\n return this.playerComponent.dataContext;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n @Prop({ type: Number, required: false, default: ViewerStateType.FullPage })\r\n public defaultState: ViewerStateType;\r\n @Prop({ type: Boolean, required: false, default: false })\r\n public isStateLocked: boolean;\r\n\r\n @Ref('player-theater-container')\r\n public playerTheaterContainer: HTMLElement;\r\n\r\n public project: Project = null;\r\n public relatedProjects: Array = [];\r\n public projectComments: Array = [];\r\n public currentState: IExploreState = null;\r\n public playerComponent: VoPlayer = null;\r\n public displayMode: ViewerStateType = ViewerStateType.Normal;\r\n public loadProjectError: any = null;\r\n\r\n public Guid: any = Guid;\r\n public ViewerStateType: any = ViewerStateType;\r\n\r\n private _resizeObserver: ResizeObserver;\r\n private _tokenValidator: TokenValidator;\r\n\r\n @lazyInject(ExploreService)\r\n private readonly _exploreService: ExploreService;\r\n\r\n @lazyInject(injectTypes.TokenValidatorFactory)\r\n private readonly _tokenValidatorFactory: TokenValidatorFactory;\r\n}\r\n\r\n"],"names":["ExploreDetailsPage","BasePage","ViewerStateType","Guid","created","this","baseTranslationPath","_resizeObserver","ResizeObserver","$debounce","_onPlayerSizeChanged","isDrawerEnabled","isGoToHomeEnabled","$nextTick","document","addEventListener","ev","_onKeyDown","_exitFullscreenHandler","currentState","pId","Number","parseInt","getUrlParameter","token","mode","defaultState","isMobileOrTabletDevice","urlDisplayMode","urlStateValue","playerElement","$refs","player","VoPlayer","playerComponent","displayMode","loadProjectError","_tokenValidator","_tokenValidatorFactory","p","executeAsync","_exploreService","loadProjectAsync","isStandaloneDatasource","datasources","find","ds","name","value","appContext","isStandalone","title","window","history","state","id","url","URL","location","href","searchParams","set","pushState","project","disconnect","observe","playerTheaterContainer","_updateProjectCountAsync","e","ApiException","error","idProject","addViewProjectAsync","evt","isEscape","key","isStateLocked","isInFullscreen","fullscreen","resizeObserverEntry","width","height","contentRect","body","style","setProperty","oldValue","viewerState","isFullScreen","drawer","$el","scrollIntoView","block","inline","requestFullscreen","playerContext","dataContext","__decorate","Watch","Prop","type","required","default","Boolean","Ref","lazyInject","ExploreService","injectTypes","Component","components","VueMarkdown","VOverlay"],"sourceRoot":""}