{"version":3,"file":"fullscreenMessageChannel.cjs","names":["_createMessageChannel","require","_messageGuards","isFullscreenIdPayload","payload","isRecord","fullscreenId","isEmptyPayload","fullscreenMessageChannel","exports","createMessageChannel","channelName","messageDomain","payloadGuards","enterRequested","exitAllRequested","exitRequested","stateChanged","Array","isArray","fullscreenStack","every","stateRequested","protocolVersion"],"sources":["../../../../src/message-bus/fullscreen/fullscreenMessageChannel.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\nimport {\n  createMessageChannel,\n  type MessageOf,\n} from \"../createMessageChannel.js\";\nimport { isRecord } from \"../messageGuards.js\";\n\nconst isFullscreenIdPayload = (\n  payload: unknown,\n): payload is { fullscreenId: string } =>\n  isRecord(payload) && typeof payload.fullscreenId === \"string\";\n\nconst isEmptyPayload = (payload: unknown): payload is Record<string, never> =>\n  isRecord(payload);\n\n/**\n * The messages every Odyssey app on the page and the fullscreen mode host send each other.\n *\n * Apps only ask. The host, which Unified UI Shell runs, owns the stack and is the only sender of `stateChanged`. Every change, and every reply to `stateRequested`, is the same full snapshot, so an app that starts late never replays an enter that already happened.\n *\n * **This is a cross-version contract.** Apps and UI Shell can each be on a different Odyssey version, so a message type or payload field can be added but never renamed, removed, or given a new meaning without raising `protocolVersion`.\n */\nexport const fullscreenMessageChannel = createMessageChannel({\n  channelName: \"odyssey-fullscreen\",\n  messageDomain: \"fullscreen\",\n  payloadGuards: {\n    /**\n     * An app asks for an id to go on top of the stack. An id already in the stack moves to the top.\n     */\n    enterRequested: isFullscreenIdPayload,\n    /**\n     * An app asks for every id to leave the stack, returning the page to how it was before anything entered fullscreen.\n     */\n    exitAllRequested: isEmptyPayload,\n    /**\n     * An app, or the host on Escape, asks for an id to leave the stack, wherever it is. The id under it is shown again.\n     */\n    exitRequested: isFullscreenIdPayload,\n    /**\n     * The host's stack, bottom first. Sent after every change and in reply to `stateRequested`.\n     */\n    stateChanged: (\n      payload: unknown,\n    ): payload is { fullscreenStack: string[] } =>\n      isRecord(payload) &&\n      Array.isArray(payload.fullscreenStack) &&\n      payload.fullscreenStack.every(\n        (fullscreenId) => typeof fullscreenId === \"string\",\n      ),\n    /**\n     * An app that just started asks the host for the current stack.\n     */\n    stateRequested: isEmptyPayload,\n  },\n  protocolVersion: 1,\n});\n\nexport type FullscreenMessage = MessageOf<typeof fullscreenMessageChannel>;\n"],"mappings":";;;;;;AAYA,IAAAA,qBAAA,GAAAC,OAAA;AAIA,IAAAC,cAAA,GAAAD,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,MAAME,qBAAqB,GACzBC,OAAgB,IAEhB,IAAAC,uBAAQ,EAACD,OAAO,CAAC,IAAI,OAAOA,OAAO,CAACE,YAAY,KAAK,QAAQ;AAE/D,MAAMC,cAAc,GAAIH,OAAgB,IACtC,IAAAC,uBAAQ,EAACD,OAAO,CAAC;AASZ,MAAMI,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,IAAAE,0CAAoB,EAAC;EAC3DC,WAAW,EAAE,oBAAoB;EACjCC,aAAa,EAAE,YAAY;EAC3BC,aAAa,EAAE;IAIbC,cAAc,EAAEX,qBAAqB;IAIrCY,gBAAgB,EAAER,cAAc;IAIhCS,aAAa,EAAEb,qBAAqB;IAIpCc,YAAY,EACVb,OAAgB,IAEhB,IAAAC,uBAAQ,EAACD,OAAO,CAAC,IACjBc,KAAK,CAACC,OAAO,CAACf,OAAO,CAACgB,eAAe,CAAC,IACtChB,OAAO,CAACgB,eAAe,CAACC,KAAK,CAC1Bf,YAAY,IAAK,OAAOA,YAAY,KAAK,QAC5C,CAAC;IAIHgB,cAAc,EAAEf;EAClB,CAAC;EACDgB,eAAe,EAAE;AACnB,CAAC,CAAC","ignoreList":[]}