{"version":3,"file":"codeBox.obs.js","sources":["../../src/Security/codeBoxCharacter.partial.obs","../../../Rock.JavaScript.Obsidian/node_modules/style-inject/dist/style-inject.es.js","../../src/Security/codeBox.obs"],"sourcesContent":["<!-- Copyright by the Spark Development Network; Licensed under the Rock Community License -->\r\n<template>\r\n    <input :value=\"modelValue\"\r\n           autocomplete=\"one-time-code\"\r\n           :autofocus=\"boxIndex === 0\"\r\n           :class=\"`rock-code-box-${boxIndex + 1} form-control flex-grow-1 flex-sm-grow-0 flex-shrink-1 ${boxIndex > 0 ? 'ml-1' : ''}`\"\r\n           :disabled=\"disabled\"\r\n           :id=\"`${uniqueId}-${boxIndex + 1}`\"\r\n           :maxlength=\"maxLength\"\r\n           ref=\"inputElement\"\r\n           type=\"text\"\r\n           @paste=\"onPaste\"\r\n           @keydown=\"onKeydown\" />\r\n</template>\r\n\r\n<style scoped>\r\n.rock-code-box input {\r\n    width: 47px;\r\n    height: 64px;\r\n    text-align: center;\r\n    font-size: 24px;\r\n}\r\n</style>\r\n\r\n<script setup lang=\"ts\">\r\n    import { ref, PropType, onMounted } from \"vue\";\r\n    import { CodeBoxCharacterController } from \"./types.partial\";\r\n\r\n    const props = defineProps({\r\n        modelValue: {\r\n            type: String as PropType<string>,\r\n            required: false,\r\n            default: null\r\n        },\r\n\r\n        boxIndex: {\r\n            type: Number as PropType<number>,\r\n            required: true\r\n        },\r\n\r\n        uniqueId: {\r\n            type: String as PropType<string>,\r\n            required: true\r\n        },\r\n\r\n        allowedChars: {\r\n            type: Object as PropType<RegExp>,\r\n            required: false,\r\n            default: /^[a-zA-Z0-9]$/\r\n        },\r\n\r\n        disabled: {\r\n            type: Boolean as PropType<boolean>,\r\n            required: false,\r\n            default: false\r\n        },\r\n\r\n        maxLength: {\r\n            type: Number as PropType<number>,\r\n            required: true\r\n        }\r\n    });\r\n\r\n    const emit = defineEmits<{\r\n        (e: \"update:modelValue\", value: string): void,\r\n        (e: \"pasteValues\", value: string): void,\r\n        (e: \"clear\", boxIndex: number): void,\r\n        (e: \"move\", boxIndex: number): void,\r\n        (e: \"complete\"): void,\r\n        (e: \"ready\", value: CodeBoxCharacterController): void\r\n    }>();\r\n\r\n    //#region Values\r\n\r\n    const inputElement = ref();\r\n\r\n    //#endregion\r\n\r\n    //#region Event Handlers\r\n\r\n    /** Event handler for the \"paste\" event. */\r\n    function onPaste(_event: Event): void {\r\n        // The \"paste\" event is handled before the input is updated with the pasted value.\r\n        // Temporarily store the original input value\r\n        // and clear it so the pasted content overwrites the previous content.\r\n        const originalValue = inputElement.value.value;\r\n        inputElement.value.value = \"\";\r\n\r\n        // Wait for the \"paste\" event to result in an input change,\r\n        // then process the pasted value.\r\n        onNextInput((event: InputEvent): void => {\r\n            // Revert the pasted value to the original value (stored above),\r\n            // and let the parent codeBox handle the pasted value\r\n            // so it can update the individual codeBoxCharacter components.\r\n            const pastedValue: string = inputElement.value.value;\r\n            inputElement.value.value = originalValue;\r\n\r\n            // If the full code was pasted into any code box,\r\n            // and if the characters are all valid,\r\n            // then paste the values across all code boxes.\r\n            if (pastedValue.length === props.maxLength && pastedValue.split(\"\").every(pastedCharacter => props.allowedChars.test(pastedCharacter))) {\r\n                // This will leave the pasted value in the current text box.\r\n                emit(\"pasteValues\", pastedValue);\r\n                emit(\"complete\");\r\n            }\r\n\r\n            // If an invalid or incomplete code is pasted into the field,\r\n            // then prevent the event from bubbling up.\r\n            event.preventDefault();\r\n            return;\r\n        });\r\n    }\r\n\r\n    /** Event handler for the \"keydown\" event. */\r\n    function onKeydown(event: KeyboardEvent): void {\r\n        const value = inputElement.value.value;\r\n        // KeyboardEvent.key values can be found at - https://www.w3.org/TR/uievents-key/#named-key-attribute-values.\r\n        const key = {\r\n            backspace: \"Backspace\",\r\n            delete: \"Delete\",\r\n            enter: \"Enter\"\r\n        } as const;\r\n        // Legacy KeyboardEvent.keyCode documentation can be found at - https://www.w3.org/TR/uievents/#dom-keyboardevent-keycode.\r\n        // Some KeyboardEvent.keyCode values can be found at - https://www.w3.org/TR/uievents/#fixed-virtual-key-codes.\r\n        const keyCode = {\r\n            backspace: 8,\r\n            delete: 46,\r\n            enter: 13\r\n        } as const;\r\n\r\n        // First check the `key` property.\r\n        // If this is an older supported browser,\r\n        // then fallback to checking the `keyCode` then `charCode` properties.\r\n        const isBackspace = event.key === key.backspace || event.keyCode === keyCode.backspace || event.charCode === keyCode.backspace;\r\n        const isDelete = event.key === key.delete || event.keyCode === keyCode.delete || event.charCode === keyCode.delete;\r\n        const isEnter = event.key === key.enter || event.keyCode === keyCode.enter || event.charCode === keyCode.enter;\r\n\r\n        // Allow Backspace and Delete if the input has a value.\r\n        if ((isBackspace || isDelete) && value.length >= 1) {\r\n            // Update the model value on the next \"input\" event.\r\n            onNextInput(() => {\r\n                emit(\"update:modelValue\", inputElement.value.value);\r\n            });\r\n\r\n            return;\r\n        }\r\n\r\n        // If Backspace was pressed and this input is empty,\r\n        // then clear the previous code box and set focus to it.\r\n        if (isBackspace) {\r\n            if (props.boxIndex > 0) {\r\n                emit(\"clear\", props.boxIndex - 1);\r\n                emit(\"move\", props.boxIndex - 1);\r\n            }\r\n\r\n            event.preventDefault();\r\n            return;\r\n        }\r\n\r\n        // Allow the Enter key to submit a form if this is a child element of a form with a submit button.\r\n        if (isEnter) {\r\n            return;\r\n        }\r\n\r\n        // Prevent more than one character from being entered manually into the box.\r\n        if (value.length >= 1 && !event.ctrlKey) {\r\n            event.preventDefault();\r\n            return;\r\n        }\r\n\r\n        // If the input is empty and a valid key was pressed,\r\n        // then update the input and either move to the next input\r\n        // or emit a \"complete\" event.\r\n        if (!event.ctrlKey) {\r\n            // Process the value after the keypress results in an input change.\r\n            onNextInput(() => {\r\n                // Emit the \"update:modelValue\" update event before the \"complete\" event below.\r\n                emit(\"update:modelValue\", inputElement.value.value);\r\n\r\n                // Move to the next box if this isn't the last one.\r\n                if (props.boxIndex < props.maxLength - 1) {\r\n                    emit(\"move\", props.boxIndex + 1);\r\n                }\r\n                // Complete if this is the last one.\r\n                else if (props.boxIndex === props.maxLength - 1) {\r\n                    emit(\"complete\");\r\n                }\r\n            });\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Event handler when for when the input value changes.\r\n     * @param event\r\n     */\r\n    function onInputChanged(event): void {\r\n        const pastedValue: string = event.target.value;\r\n\r\n        // If the full code was pasted into any code box,\r\n        // and if the characters are all valid,\r\n        // then paste the values across all code boxes.\r\n        if (pastedValue.length === props.maxLength && pastedValue.split(\"\").every(pastedCharacter => props.allowedChars.test(pastedCharacter))) {\r\n            // This will leave the pasted value in the current text box.\r\n            emit(\"pasteValues\", pastedValue);\r\n            emit(\"complete\");\r\n        }\r\n    }\r\n\r\n    //#endregion\r\n\r\n    //#region Functions\r\n\r\n    /** Adds a one-time \"input\" event handler that will be executed before the `onInputChanged` event handler. */\r\n    function onNextInput(inputEventListener: (event: InputEvent) => void): void {\r\n        function deregisteringInputEventHandler(event: InputEvent): void {\r\n            inputElement.value.removeEventListener(\"input\", deregisteringInputEventHandler);\r\n            inputEventListener(event);\r\n        }\r\n\r\n        // Configure the callback to preprocess the \"input\" event.\r\n        inputElement.value.removeEventListener(\"input\", onInputChanged);\r\n        inputElement.value.addEventListener(\"input\", deregisteringInputEventHandler);\r\n        inputElement.value.addEventListener(\"input\", onInputChanged);\r\n    }\r\n\r\n    //#endregion\r\n\r\n    onMounted(() => {\r\n        // Add the \"input\" event handler here instead of in the template\r\n        // so that it is clear that we manually manage the \"input\" event handlers.\r\n        inputElement.value.addEventListener(\"input\", onInputChanged);\r\n\r\n        // Emit the codeBoxCharacter controller object once this component is ready.\r\n        emit(\"ready\", {\r\n            focus(): void {\r\n                inputElement.value.focus();\r\n            },\r\n            clear(): void {\r\n                emit(\"update:modelValue\", \"\");\r\n            },\r\n            boxIndex: props.boxIndex\r\n        });\r\n    });\r\n</script>\r\n","function styleInject(css, ref) {\n  if ( ref === void 0 ) ref = {};\n  var insertAt = ref.insertAt;\n\n  if (!css || typeof document === 'undefined') { return; }\n\n  var head = document.head || document.getElementsByTagName('head')[0];\n  var style = document.createElement('style');\n  style.type = 'text/css';\n\n  if (insertAt === 'top') {\n    if (head.firstChild) {\n      head.insertBefore(style, head.firstChild);\n    } else {\n      head.appendChild(style);\n    }\n  } else {\n    head.appendChild(style);\n  }\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = css;\n  } else {\n    style.appendChild(document.createTextNode(css));\n  }\n}\n\nexport default styleInject;\n","<!-- Copyright by the Spark Development Network; Licensed under the Rock Community License -->\r\n<template>\r\n    <RockFormField v-model=\"internalModelValue\"\r\n                   name=\"codebox\"\r\n                   :rules=\"rules\">\r\n        <template #default=\"{uniqueId, field}\">\r\n            <div :class=\"['form-group rock-code-box', isRequired ? 'required' : '']\">\r\n                <div class=\"control-wrapper\">\r\n                    <div class=\"d-flex\">\r\n                        <CodeBoxCharacter v-for=\"(character, index) of characters\"\r\n                                          :modelValue=\"character\"\r\n                                          :allowedChars=\"allowedChars\"\r\n                                          :boxIndex=\"index\"\r\n                                          :disabled=\"disabled\"\r\n                                          :key=\"index\"\r\n                                          :maxLength=\"maxLength\"\r\n                                          :modelModifiers=\"modelModifiers\"\r\n                                          :uniqueId=\"uniqueId\"\r\n                                          @clear=\"onClear\"\r\n                                          @complete=\"onComplete\"\r\n                                          @move=\"onMove\"\r\n                                          @pasteValues=\"onPasteValues\"\r\n                                          @ready=\"onReady\"\r\n                                          @update:modelValue=\"value => onCodeBoxCharacterUpdated(value, index)\" />\r\n                    </div>\r\n                </div>\r\n            </div>\r\n        </template>\r\n    </RockFormField>\r\n</template>\r\n\r\n<style scoped>\r\n.rock-code-box input {\r\n    width: 47px;\r\n    height: 64px;\r\n    text-align: center;\r\n    font-size: 24px;\r\n}\r\n</style>\r\n\r\n<script setup lang=\"ts\">\r\n    import { computed, onMounted, PropType, ref } from \"vue\";\r\n    import CodeBoxCharacter from \"./codeBoxCharacter.partial.obs\";\r\n    import { CodeBoxCharacterController } from \"./types.partial\";\r\n    import RockFormField from \"@Obsidian/Controls/rockFormField.obs\";\r\n    import { useVModelPassthrough } from \"@Obsidian/Utility/component\";\r\n    import { normalizeRules, rulesPropType } from \"@Obsidian/ValidationRules\";\r\n\r\n    type CodeBoxModelModifiers = {\r\n        capitalize?: unknown\r\n    };\r\n\r\n    const props = defineProps({\r\n        modelValue: {\r\n            type: String as PropType<string>,\r\n            required: false,\r\n            default: null\r\n        },\r\n\r\n        allowedChars: {\r\n            type: Object as PropType<RegExp>,\r\n            required: false,\r\n            default: /^[a-zA-Z0-9]$/\r\n        },\r\n\r\n        disabled: {\r\n            type: Boolean as PropType<boolean>,\r\n            required: false,\r\n            default: false\r\n        },\r\n\r\n        maxLength: {\r\n            type: Number as PropType<number>,\r\n            required: true\r\n        },\r\n\r\n        modelModifiers: {\r\n            type: Object as PropType<CodeBoxModelModifiers>,\r\n            required: false,\r\n            default: null\r\n        },\r\n\r\n        rules: rulesPropType\r\n    });\r\n\r\n    const emit = defineEmits<{\r\n        (e: \"update:modelValue\", value: string): void,\r\n        (e: \"complete\", value: string): void\r\n    }>();\r\n\r\n    /** Controllers for each codeBoxCharacter component. */\r\n    const codeBoxCharacterControllers: Record<number, CodeBoxCharacterController> = {};\r\n\r\n    //#region Values\r\n\r\n    const internalModelValue = useVModelPassthrough(props, \"modelValue\", emit);\r\n    const characters = ref<string[]>(getMaxLengthCharacters(props.modelValue.split(\"\")));\r\n\r\n    //#endregion\r\n\r\n    //#region Computed Values\r\n\r\n    /** The internal rules we will be used for calculations. */\r\n    const internalRules = computed(() => normalizeRules(props.rules));\r\n\r\n    /** Determines if this field is marked as required. */\r\n    const isRequired = computed(() => internalRules.value.includes(\"required\"));\r\n\r\n    //#endregion\r\n\r\n    //#region Event Handlers\r\n\r\n    /** Event handler for a codeBoxCharacter component being updated. */\r\n    function onCodeBoxCharacterUpdated(value: string, boxIndex: number): void {\r\n        // Modify the value if there are any modifiers present.\r\n        if (props.modelModifiers?.capitalize) {\r\n            value = value?.toLocaleUpperCase();\r\n        }\r\n\r\n        // Update the character associated with the codeBoxCharacter component.\r\n        characters.value[boxIndex] = value;\r\n\r\n        // Update the model value (which is the code combined from all the characters).\r\n        internalModelValue.value = characters.value.join(\"\");\r\n    }\r\n\r\n    /** Event handler for a codeBoxCharacter component being cleared. */\r\n    function onClear(boxIndex: number): void {\r\n        codeBoxCharacterControllers[boxIndex].clear();\r\n    }\r\n\r\n    /** Event handler for moving focus to a codeBoxCharacter component. */\r\n    function onMove(boxIndex: number): void {\r\n        codeBoxCharacterControllers[boxIndex].focus();\r\n    }\r\n\r\n    /** Event handler for a value being pasted into a codeBoxCharacter component. */\r\n    function onPasteValues(value: string): void {\r\n        // Modify the value if there are any modifiers present.\r\n        if (props.modelModifiers?.capitalize) {\r\n            value = value?.toLocaleUpperCase();\r\n        }\r\n\r\n        // Set all the characters to the pasted value after splitting it.\r\n        characters.value = getMaxLengthCharacters(value.split(\"\"));\r\n    }\r\n\r\n    /**\r\n     * Event handler for a codeBoxCharacter component completing.\r\n     *\r\n     * This can be sent from any of the codeBoxCharacter components if\r\n     * it recognizes that the entire code has been entered.\r\n     */\r\n    function onComplete(): void {\r\n        const code = characters.value.join(\"\");\r\n        internalModelValue.value = code;\r\n        emit(\"complete\", code);\r\n    }\r\n\r\n    /**\r\n     * Event handler for a codeBoxCharacter component being ready.\r\n     *\r\n     * The codeBoxCharacter component will provide an object that can be used to control it.\r\n     */\r\n    function onReady(event: CodeBoxCharacterController): void {\r\n        codeBoxCharacterControllers[event.boxIndex] = event;\r\n    }\r\n\r\n    //#endregion\r\n\r\n    //#region Functions\r\n\r\n    /**\r\n     * Copies a source array and ensures the resulting array has `length === props.maxLength`.\r\n     *\r\n     * If the `source.length < props.maxLength`, then `\"\"` elements will be added.\r\n     *\r\n     * If the `source.length > props.maxLength`, then excess elements will be removed.\r\n     */\r\n    function getMaxLengthCharacters(source: string[]): string[] {\r\n        if (source.length > props.maxLength) {\r\n            // Truncate to match the max length of the code box.\r\n            return source.slice(0, props.maxLength);\r\n        }\r\n        else if (source.length < props.maxLength) {\r\n            const result = [...source];\r\n\r\n            // Pad the array to match the maxLength of the code box.\r\n            const charactersToInsert = props.maxLength - result.length;\r\n            for (let i = 0; i < charactersToInsert; i++) {\r\n                result.push(\"\");\r\n            }\r\n\r\n            return result;\r\n        }\r\n        else {\r\n            return [...source];\r\n        }\r\n    }\r\n\r\n    //#endregion\r\n\r\n    //#region Watchers\r\n\r\n    //#endregion\r\n\r\n    onMounted(() => {\r\n        // Try to focus on the first codeBoxCharacter component when this component is mounted.\r\n        codeBoxCharacterControllers[0]?.focus();\r\n    });\r\n</script>\r\n"],"names":["inputElement","ref","onPaste","_event","originalValue","value","onNextInput","event","pastedValue","length","props","maxLength","split","every","pastedCharacter","allowedChars","test","emit","preventDefault","onKeydown","key","backspace","delete","enter","keyCode","isBackspace","charCode","isDelete","isEnter","boxIndex","ctrlKey","onInputChanged","target","inputEventListener","deregisteringInputEventHandler","removeEventListener","addEventListener","onMounted","focus","clear","styleInject","css","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","codeBoxCharacterControllers","internalModelValue","useVModelPassthrough","characters","getMaxLengthCharacters","modelValue","internalRules","computed","normalizeRules","rules","isRequired","includes","onCodeBoxCharacterUpdated","_props$modelModifiers","modelModifiers","capitalize","_value","toLocaleUpperCase","join","onClear","onMove","onPasteValues","_props$modelModifiers2","_value2","onComplete","code","onReady","source","slice","result","charactersToInsert","i","push","_codeBoxCharacterCont"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA0EI,IAAMA,YAAY,GAAGC,GAAG,EAAE,CAAA;UAO1B,SAASC,OAAOA,CAACC,MAAa,EAAQ;MAIlC,MAAA,IAAMC,aAAa,GAAGJ,YAAY,CAACK,KAAK,CAACA,KAAK,CAAA;MAC9CL,MAAAA,YAAY,CAACK,KAAK,CAACA,KAAK,GAAG,EAAE,CAAA;YAI7BC,WAAW,CA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