{"version":3,"file":"VDialog-C2gHhOkV.js","sources":["../../node_modules/vuetify/lib/components/VDialog/VDialog.mjs"],"sourcesContent":["import { mergeProps as _mergeProps, createVNode as _createVNode } from \"vue\";\n// Styles\nimport \"./VDialog.css\";\n\n// Components\nimport { VDialogTransition } from \"../transitions/index.mjs\";\nimport { VDefaultsProvider } from \"../VDefaultsProvider/index.mjs\";\nimport { VOverlay } from \"../VOverlay/index.mjs\";\nimport { makeVOverlayProps } from \"../VOverlay/VOverlay.mjs\"; // Composables\nimport { forwardRefs } from \"../../composables/forwardRefs.mjs\";\nimport { useProxiedModel } from \"../../composables/proxiedModel.mjs\";\nimport { useScopeId } from \"../../composables/scopeId.mjs\"; // Utilities\nimport { mergeProps, nextTick, ref, watch } from 'vue';\nimport { focusableChildren, genericComponent, IN_BROWSER, propsFactory, useRender } from \"../../util/index.mjs\"; // Types\nexport const makeVDialogProps = propsFactory({\n fullscreen: Boolean,\n retainFocus: {\n type: Boolean,\n default: true\n },\n scrollable: Boolean,\n ...makeVOverlayProps({\n origin: 'center center',\n scrollStrategy: 'block',\n transition: {\n component: VDialogTransition\n },\n zIndex: 2400\n })\n}, 'VDialog');\nexport const VDialog = genericComponent()({\n name: 'VDialog',\n props: makeVDialogProps(),\n emits: {\n 'update:modelValue': value => true,\n afterLeave: () => true\n },\n setup(props, _ref) {\n let {\n emit,\n slots\n } = _ref;\n const isActive = useProxiedModel(props, 'modelValue');\n const {\n scopeId\n } = useScopeId();\n const overlay = ref();\n function onFocusin(e) {\n const before = e.relatedTarget;\n const after = e.target;\n if (before !== after && overlay.value?.contentEl &&\n // We're the topmost dialog\n overlay.value?.globalTop &&\n // It isn't the document or the dialog body\n ![document, overlay.value.contentEl].includes(after) &&\n // It isn't inside the dialog body\n !overlay.value.contentEl.contains(after)) {\n const focusable = focusableChildren(overlay.value.contentEl);\n if (!focusable.length) return;\n const firstElement = focusable[0];\n const lastElement = focusable[focusable.length - 1];\n if (before === firstElement) {\n lastElement.focus();\n } else {\n firstElement.focus();\n }\n }\n }\n if (IN_BROWSER) {\n watch(() => isActive.value && props.retainFocus, val => {\n val ? document.addEventListener('focusin', onFocusin) : document.removeEventListener('focusin', onFocusin);\n }, {\n immediate: true\n });\n }\n function onAfterEnter() {\n if (overlay.value?.contentEl && !overlay.value.contentEl.contains(document.activeElement)) {\n overlay.value.contentEl.focus({\n preventScroll: true\n });\n }\n }\n function onAfterLeave() {\n emit('afterLeave');\n }\n watch(isActive, async val => {\n if (!val) {\n await nextTick();\n overlay.value.activatorEl?.focus({\n preventScroll: true\n });\n }\n });\n useRender(() => {\n const overlayProps = VOverlay.filterProps(props);\n const activatorProps = mergeProps({\n 'aria-haspopup': 'dialog',\n 'aria-expanded': String(isActive.value)\n }, props.activatorProps);\n const contentProps = mergeProps({\n tabindex: -1\n }, props.contentProps);\n return _createVNode(VOverlay, _mergeProps({\n \"ref\": overlay,\n \"class\": ['v-dialog', {\n 'v-dialog--fullscreen': props.fullscreen,\n 'v-dialog--scrollable': props.scrollable\n }, props.class],\n \"style\": props.style\n }, overlayProps, {\n \"modelValue\": isActive.value,\n \"onUpdate:modelValue\": $event => isActive.value = $event,\n \"aria-modal\": \"true\",\n \"activatorProps\": activatorProps,\n \"contentProps\": contentProps,\n \"role\": \"dialog\",\n \"onAfterEnter\": onAfterEnter,\n \"onAfterLeave\": onAfterLeave\n }, scopeId), {\n activator: slots.activator,\n default: function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _createVNode(VDefaultsProvider, {\n \"root\": \"VDialog\"\n }, {\n default: () => [slots.default?.(...args)]\n });\n }\n });\n });\n return forwardRefs({}, overlay);\n }\n});\n//# sourceMappingURL=VDialog.mjs.map"],"names":["makeVDialogProps","propsFactory","makeVOverlayProps","VDialogTransition","VDialog","genericComponent","value","props","_ref","emit","slots","isActive","useProxiedModel","scopeId","useScopeId","overlay","ref","onFocusin","e","before","after","_a","_b","focusable","focusableChildren","firstElement","lastElement","IN_BROWSER","watch","val","onAfterEnter","onAfterLeave","nextTick","useRender","overlayProps","VOverlay","activatorProps","mergeProps","contentProps","_createVNode","_mergeProps","$event","_len","args","_key","VDefaultsProvider","forwardRefs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAcO,MAAMA,EAAmBC,EAAa,CAC3C,WAAY,QACZ,YAAa,CACX,KAAM,QACN,QAAS,EACV,EACD,WAAY,QACZ,GAAGC,EAAkB,CACnB,OAAQ,gBACR,eAAgB,QAChB,WAAY,CACV,UAAWC,CACZ,EACD,OAAQ,IACZ,CAAG,CACH,EAAG,SAAS,EACCC,EAAUC,EAAgB,EAAG,CACxC,KAAM,UACN,MAAOL,EAAkB,EACzB,MAAO,CACL,oBAAqBM,GAAS,GAC9B,WAAY,IAAM,EACnB,EACD,MAAMC,EAAOC,EAAM,CACjB,GAAI,CACF,KAAAC,EACA,MAAAC,CACD,EAAGF,EACJ,MAAMG,EAAWC,EAAgBL,EAAO,YAAY,EAC9C,CACJ,QAAAM,CACD,EAAGC,EAAU,EACRC,EAAUC,IAChB,SAASC,EAAUC,EAAG,SACpB,MAAMC,EAASD,EAAE,cACXE,EAAQF,EAAE,OAChB,GAAIC,IAAWC,KAASC,EAAAN,EAAQ,QAAR,MAAAM,EAAe,cAEvCC,EAAAP,EAAQ,QAAR,MAAAO,EAAe,YAEf,CAAC,CAAC,SAAUP,EAAQ,MAAM,SAAS,EAAE,SAASK,CAAK,GAEnD,CAACL,EAAQ,MAAM,UAAU,SAASK,CAAK,EAAG,CACxC,MAAMG,EAAYC,EAAkBT,EAAQ,MAAM,SAAS,EAC3D,GAAI,CAACQ,EAAU,OAAQ,OACvB,MAAME,EAAeF,EAAU,CAAC,EAC1BG,EAAcH,EAAUA,EAAU,OAAS,CAAC,EAC9CJ,IAAWM,EACbC,EAAY,MAAK,EAEjBD,EAAa,MAAK,CAErB,CACF,CACGE,GACFC,EAAM,IAAMjB,EAA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