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AAG,CACF,CACF","names":["useDialog","useI18n","openConfirm","text","confirmButtonText","options","Swal","__vitePreload","n","isConfirmed","openPrompt","input","value","openErrorDialog","errorMessage"],"ignoreList":[],"sources":["../../../packs/frontend/utils/dialog.ts"],"sourcesContent":["export const useDialog = () => {\n const { t } = useI18n();\n\n const openConfirm = async (\n text: string,\n confirmButtonText: string,\n options?: object\n ) => {\n const { default: Swal } = await import(\"sweetalert2/dist/sweetalert2\");\n const { isConfirmed } = await Swal.fire({\n text: text,\n icon: \"question\",\n showCancelButton: true,\n cancelButtonText: t(\"buttons.cancel\"),\n confirmButtonText: confirmButtonText || t(\"buttons.yes\"),\n reverseButtons: true,\n heightAuto: false,\n ...options,\n });\n return isConfirmed;\n };\n\n const openPrompt = async (\n text: string,\n input: \"text\" | \"url\",\n confirmButtonText: string,\n options?: object\n ) => {\n const { default: Swal } = await import(\"sweetalert2/dist/sweetalert2\");\n const { value } = await Swal.fire({\n text: text,\n icon: \"question\",\n input: input,\n showCancelButton: true,\n cancelButtonText: t(\"buttons.cancel\"),\n confirmButtonText: confirmButtonText || t(\"buttons.yes\"),\n reverseButtons: true,\n heightAuto: false,\n ...options,\n });\n\n return value;\n };\n\n async function openErrorDialog(\n errorMessage: string | Error = \"\"\n ): Promise {\n console.error(errorMessage);\n\n const { default: Swal } = await import(\"sweetalert2/dist/sweetalert2\");\n const result = await Swal.fire({\n title: t(\"errors.error\"),\n text: t(\"errors.unknownErrorRefresh\"),\n icon: \"error\",\n showCancelButton: true,\n cancelButtonText: t(\"buttons.cancel\"),\n confirmButtonText: t(\"buttons.reload\"),\n });\n\n if (result.value) {\n window.location.reload();\n }\n }\n\n return {\n openConfirm,\n openPrompt,\n openErrorDialog,\n };\n};\n"],"file":"assets/dialog-D2a862Fw.js"}