{"version":3,"file":"fullscreenState.cjs","names":["emptyFullscreenState","exports","fullscreenStack","getActiveFullscreenId","at","getIsFullscreen","fullscreenId","getIsInFullscreenStack","includes","getHasActiveFullscreen","length","getFullscreenStackIndex","indexOf","getStackWithEnteredId","filter","stackedId","concat","getStackWithExitedId","getIsSameFullscreenStack","currentFullscreenStack","nextFullscreenStack","every","index"],"sources":["../../../../src/message-bus/fullscreen/fullscreenState.ts"],"sourcesContent":["/*!\n * Copyright (c) 2026-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/**\n * The fullscreen state of the whole page, shared by every app and Unified UI Shell.\n */\nexport type FullscreenState = {\n  /**\n   * Every fullscreen id on the page, bottom first. Only the last one is shown; the ones under it are shown again, in order, as the ones above them exit. Empty when nothing on the page is in fullscreen.\n   */\n  fullscreenStack: string[];\n};\n\nexport type FullscreenIdArgs = {\n  fullscreenId: string;\n};\n\nexport const emptyFullscreenState: FullscreenState = { fullscreenStack: [] };\n\n/**\n * The id shown in fullscreen right now: the top of the stack. `undefined` when nothing is in fullscreen.\n */\nexport const getActiveFullscreenId = ({\n  fullscreenStack,\n}: FullscreenState): string | undefined => fullscreenStack.at(-1);\n\n/**\n * `true` when **this** id is the one shown in fullscreen, on top of the stack.\n *\n * Use it for what only the visible region does: taking focus, making the page around it `inert`, and announcing the change. A region lower in the stack is covered by the one above it, so it reads `false` until that one exits.\n */\nexport const getIsFullscreen = ({\n  fullscreenId,\n  fullscreenStack,\n}: FullscreenIdArgs & FullscreenState): boolean =>\n  getActiveFullscreenId({ fullscreenStack }) === fullscreenId;\n\n/**\n * `true` when this id is anywhere in the stack, even covered by another.\n *\n * Use it for what stays true until the id exits: a region staying fixed over the page, and its button reading as pressed.\n */\nexport const getIsInFullscreenStack = ({\n  fullscreenId,\n  fullscreenStack,\n}: FullscreenIdArgs & FullscreenState): boolean =>\n  fullscreenStack.includes(fullscreenId);\n\n/**\n * `true` when **anything** on the page is in fullscreen, in any app.\n *\n * Use it for what the page around fullscreen does, such as UI Shell hiding its navigation and banners. It doesn't say which id; read `getIsFullscreen` for that.\n */\nexport const getHasActiveFullscreen = ({\n  fullscreenStack,\n}: FullscreenState): boolean => fullscreenStack.length > 0;\n\n/**\n * Where this id sits in the stack, from `0` at the bottom, or `-1` when it isn't in it. A region uses it to stack above the regions under it.\n */\nexport const getFullscreenStackIndex = ({\n  fullscreenId,\n  fullscreenStack,\n}: FullscreenIdArgs & FullscreenState): number =>\n  fullscreenStack.indexOf(fullscreenId);\n\n/**\n * The stack with an id on top. An id already in the stack moves to the top rather than appearing twice.\n */\nexport const getStackWithEnteredId = ({\n  fullscreenId,\n  fullscreenStack,\n}: FullscreenIdArgs & FullscreenState): string[] =>\n  fullscreenStack\n    .filter((stackedId) => stackedId !== fullscreenId)\n    .concat(fullscreenId);\n\n/**\n * The stack without an id, wherever it was. The ids above and below it keep their order.\n */\nexport const getStackWithExitedId = ({\n  fullscreenId,\n  fullscreenStack,\n}: FullscreenIdArgs & FullscreenState): string[] =>\n  fullscreenStack.filter((stackedId) => stackedId !== fullscreenId);\n\n/**\n * `true` when two stacks hold the same ids in the same order, so subscribers aren't told about a message that changed nothing.\n */\nexport const getIsSameFullscreenStack = ({\n  currentFullscreenStack,\n  nextFullscreenStack,\n}: {\n  currentFullscreenStack: string[];\n  nextFullscreenStack: string[];\n}): boolean =>\n  currentFullscreenStack.length === nextFullscreenStack.length &&\n  currentFullscreenStack.every(\n    (fullscreenId, index) => fullscreenId === nextFullscreenStack[index],\n  );\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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