Current Path : /home/ncdcgo/admin.ncdc.go.ug/static/js/ |
Current File : /home/ncdcgo/admin.ncdc.go.ug/static/js/28.7d8198d4.chunk.js.map |
{"version":3,"file":"static/js/28.7d8198d4.chunk.js","mappings":"0IA+CA,IA3CoB,SAAC,GAAgB,IAAdA,EAAa,EAAbA,OACrB,OACE,gBACEC,UAAU,kEACV,aAAW,aAFb,UAIE,gBAAIA,UAAU,kDAAd,WACE,eAAIA,UAAU,yCAAd,UACE,UAAC,KAAD,CACEC,GAAG,OACHD,UAAU,kHAFZ,WAIE,gBACEA,UAAU,eACVE,KAAK,eACLC,QAAQ,YACRC,MAAM,6BAJR,UAME,iBAAMC,EAAE,uMAVZ,YAFJ,OAiBGN,QAjBH,IAiBGA,OAjBH,EAiBGA,EAAQO,KAAI,SAACC,EAAOC,GACnB,OACE,gBAAIR,UAAU,2BAAd,WACE,SAAC,IAAD,CAAcS,KAAM,GAAIT,UAAU,UAClC,SAAC,KAAD,CACEC,GAAIM,EAAMG,KACVV,UAAU,gIAFZ,SAIGO,EAAMI,SANmCH,EAUjD,QAIR,C,4KCpCYI,EAAQ,SAAC,GAAsB,IAApBC,EAAmB,EAAnBA,KAAMC,EAAa,EAAbA,OAC5B,OAAOC,EAAAA,EAAAA,WAAS,kBACXD,GADU,IAEbE,SAAU,CAAC,KAAMH,GACjBI,QAAS,kBARQ,SAAC,GAAc,IAAZJ,EAAW,EAAXA,KACtB,OAAOK,EAAAA,EAAAA,IAAA,mBAAsBL,GAC9B,CAMkBM,CAAM,CAAEN,KAAAA,GAAd,IAEZ,E,qHCPYO,EAAW,SAAC,GAAoB,IAAlBC,EAAiB,EAAjBA,KAAMR,EAAW,EAAXA,KAC/B,OAAOK,EAAAA,EAAAA,MAAA,mBAAwBL,GAAQQ,EACxC,EAEDD,EAASE,UAAY,CACnBD,KAAME,IAAAA,MAAgB,CACpBC,MAAOD,IAAAA,OACPE,KAAMF,IAAAA,OACNG,MAAOH,IAAAA,SACNI,WACHd,KAAMU,IA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MsI,EAAaC,EAAAA,YAhBnB,SAAkBC,EAAOC,GACvB,OAAoBF,EAAAA,cAAoB,MAAOG,OAAOC,OAAO,CAC3DxI,MAAO,6BACPF,KAAM,OACNC,QAAS,YACT0I,YAAa,EACbC,OAAQ,eACR,cAAe,OACfC,IAAKL,GACJD,GAAqBD,EAAAA,cAAoB,OAAQ,CAClDQ,cAAe,QACfC,eAAgB,QAChB5I,EAAG,mBAEN,IAGD,K,qCCLA,IAAMkI,EAAaC,EAAAA,YAZnB,SAAoBC,EAAOC,GACzB,OAAoBF,EAAAA,cAAoB,MAAOG,OAAOC,OAAO,CAC3DxI,MAAO,6BACPD,QAAS,YACTD,KAAM,eACN,cAAe,OACf6I,IAAKL,GACJD,GAAqBD,EAAAA,cAAoB,OAAQ,CAClDnI,EAAG,4HAEN,IAGD,K","sources":["components/Layout/Breadcrumbs.jsx","features/ads/api/getAd.js","features/ads/api/updateAd.js","features/ads/components/UpdateAd.jsx","features/ads/routes/Ad.jsx","features/ads/api/getAds.js","features/ads/api/deleteAd.js","features/ads/components/DeleteAd.jsx","features/ads/components/AdsList.jsx","features/ads/api/createAd.js","features/ads/components/CreateAd.jsx","features/ads/routes/Ads.jsx","features/ads/routes/index.jsx","../node_modules/@heroicons/react/outline/esm/PlusIcon.js","../node_modules/@heroicons/react/solid/esm/PencilIcon.js"],"sourcesContent":["import React from \"react\";\nimport { Link } from \"react-router-dom\";\nimport { ChevronRight } from \"react-feather\";\n\nconst Breadcrumbs = ({ routes }) => {\n return (\n <nav\n className=\"flex bg-white border border-gray-200 p-2 rounded-full px-4 mt-4\"\n aria-label=\"Breadcrumb\"\n >\n <ol className=\"inline-flex items-center space-x-1 md:space-x-3\">\n <li className=\"inline-flex items-center text-gray-800\">\n <Link\n to=\"/app\"\n className=\"inline-flex items-center text-sm text-gray-800 hover:text-gray-900 dark:text-gray-800 dark:hover:text-gray-200\"\n >\n <svg\n className=\"w-4 h-4 mr-2\"\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z\"></path>\n </svg>\n Home\n </Link>\n </li>\n {routes?.map((route, index) => {\n return (\n <li className=\"inline-flex items-center\" key={index}>\n <ChevronRight size={10} className=\"mr-4\" />\n <Link\n to={route.path}\n className=\"inline-flex items-center text-sm font-extrabold text-gray-700 hover:text-gray-900 dark:text-gray-800 dark:hover:text-gray-200\"\n >\n {route.name}\n </Link>\n </li>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nBreadcrumbs.propTypes = {};\n\nexport default Breadcrumbs;\n","import { axios } from 'lib/axios';\nimport { useQuery } from 'react-query';\n\nexport const getAd = ({ adId }) => {\n return axios.get(`/adverts/${adId}`);\n};\n\nexport const useAd = ({ adId, config }) => {\n return useQuery({\n ...config,\n queryKey: ['ad', adId],\n queryFn: () => getAd({ adId }),\n });\n};\n","import { axios } from 'lib/axios';\nimport { queryClient } from 'lib/react-query';\nimport { useNotificationStore } from 'stores/notifications';\nimport PropTypes from 'prop-types';\nimport { useMutation } from 'react-query';\n\nexport const updateAd = ({ data, adId }) => {\n return axios.patch(`/adverts/${adId}`, data);\n};\n\nupdateAd.propTypes = {\n data: PropTypes.shape({\n title: PropTypes.string,\n desc: PropTypes.string,\n image: PropTypes.string,\n }).isRequired,\n adId: PropTypes.string.isRequired,\n};\n\nexport const useUpdateAd = ({ config } = {}) => {\n const { addNotification } = useNotificationStore();\n\n return useMutation({\n onMutate: async (updatingAd) => {\n await queryClient.cancelQueries(['ad', updatingAd?.adId]);\n\n const previousAd = queryClient.getQueryData[('ad', updatingAd?.adId)];\n\n queryClient.setQueryData(['ad', updatingAd?.adId], {\n ...previousAd,\n ...updatingAd.data,\n id: updatingAd.adId,\n });\n\n return { previousAd };\n },\n onError: (_, __, context) => {\n if (context?.previousAd) {\n queryClient.setQueryData(['ad', context.previousAd.id], context.previousAd);\n }\n },\n onSuccess: (data) => {\n queryClient.refetchQueries(['ad', data.id]);\n addNotification({\n type: 'success',\n title: 'Ad Updated',\n });\n },\n ...config,\n mutationFn: updateAd,\n });\n};\n","import { Button, Spinner } from \"components/Elements\";\nimport {\n Form,\n FormDrawer,\n InputField,\n TextAreaField,\n UploadField,\n} from \"components/Form\";\nimport { Authorization, ROLES } from \"lib/authorization\";\nimport { PencilIcon } from \"@heroicons/react/solid\";\nimport PropTypes from \"prop-types\";\nimport { useState } from \"react\";\nimport * as z from \"zod\";\n\nimport { useAd } from \"../api/getAd\";\nimport { useUpdateAd } from \"../api/updateAd\";\n\nconst schema = z.object({\n title: z.string(),\n desc: z.string(),\n});\n\nexport const UpdateAd = ({ adId }) => {\n const [image, setImage] = useState(null);\n const [preview, setPreview] = useState(null);\n const adQuery = useAd({ adId });\n const updateAdMutation = useUpdateAd();\n\n if (updateAdMutation.isLoading) {\n return (\n <div\n id=\"loading-screen\"\n className=\"w-full h-full fixed block top-0 left-0 bg-black opacity-75 z-50\"\n >\n <span className=\"opacity-75 top-1/2 my-0 mx-auto block relative w-0 h-0\">\n <Spinner size=\"sm\" />\n </span>\n </div>\n );\n }\n\n return (\n <Authorization allowedRoles={[ROLES.ADMIN]}>\n <FormDrawer\n size=\"sm\"\n isDone={updateAdMutation.isSuccess}\n triggerButton={\n <Button\n variant=\"create\"\n startIcon={<PencilIcon className=\"h-4 w-4\" />}\n size=\"sm\"\n >\n Update\n </Button>\n }\n title=\"Update Advert\"\n submitButton={\n <Button\n form=\"update-ad\"\n type=\"submit\"\n size=\"sm\"\n isLoading={updateAdMutation.isLoading}\n >\n Submit\n </Button>\n }\n >\n <Form\n id=\"update-ad\"\n encType=\"multipart/form-data\"\n onSubmit={async (values) => {\n const { title, desc } = values;\n const bodyFormData = new FormData();\n bodyFormData.append(\"title\", title);\n bodyFormData.append(\"desc\", desc);\n bodyFormData.append(\"image\", image);\n await updateAdMutation.mutateAsync({ data: bodyFormData, adId });\n }}\n options={{\n defaultValues: {\n title: adQuery.data?.title,\n desc: adQuery.data?.desc,\n image: adQuery.data?.image,\n },\n }}\n schema={schema}\n >\n {({ register, formState, watch, setValue }) => (\n <>\n <InputField\n label=\"Title\"\n error={formState.errors[\"title\"]}\n registration={register(\"title\")}\n />\n <TextAreaField\n label=\"Description\"\n error={formState.errors[\"desc\"]}\n editorContent={watch(\"desc\")}\n setValue={setValue}\n value=\"desc\"\n />\n <UploadField\n title=\"Update Banner Image\"\n subTitle=\"Upload clear image for better visibility\"\n error={formState.errors[\"image\"]}\n x={1280}\n y={340}\n onChange={(e) => {\n setImage(e.target.files[0]);\n setPreview(URL.createObjectURL(e.target.files[0]));\n }}\n preview={preview}\n />\n </>\n )}\n </Form>\n </FormDrawer>\n </Authorization>\n );\n};\n\nUpdateAd.propTypes = {\n adId: PropTypes.string.isRequired,\n};\n","import { MDPreview, Spinner } from \"components/Elements\";\nimport { Head } from \"components/Head\";\nimport { ContentLayout } from \"components/Layout\";\nimport { UPLOADS_API_URL } from \"config\";\nimport { formatDate } from \"utils/format\";\nimport { useParams } from \"react-router-dom\";\nimport { LazyLoadImage } from \"react-lazy-load-image-component\";\nimport { useAd } from \"../api/getAd\";\nimport { UpdateAd } from \"../components/UpdateAd\";\nimport Breadcrumbs from \"components/Layout/Breadcrumbs\"; \n\nexport const Ad = () => {\n const { adId } = useParams();\n const adQuery = useAd({ adId });\n\n if (adQuery.isLoading) {\n return (\n <div className=\"w-full h-48 flex justify-center items-center\">\n <Spinner size=\"lg\" />\n </div>\n );\n }\n\n const routes = [\n {\n name: \"Banner Adverts\",\n path: \"/app/ads\",\n },\n {\n name: adQuery.data?.title,\n path: \"\",\n },\n ];\n\n if (!adQuery.data) return null;\n\n return (\n <>\n <Head title={adQuery.data._id} />\n <ContentLayout\n title={adQuery.data.title}\n button={<UpdateAd adId={adId} />}\n >\n <span className=\"text-xs font-bold text-gray-500\">\n Advert created on {formatDate(adQuery.data.createdAt)}\n </span>\n <Breadcrumbs routes={routes} />\n <div className=\"mt-6 flex flex-col dark:bg-gray-700 space-y-16\">\n <LazyLoadImage\n src={`${UPLOADS_API_URL}/${adQuery.data.image}`}\n alt={adQuery.data.title}\n className=\"w-full h-full\"\n />\n </div>\n <div className=\"mt-4\">\n <div className=\"text-sm text-gray-400 font-bold mb-4\">\n Description\n </div>\n <div className=\"text-gray-500 bg-white p-4\">\n <MDPreview value={adQuery.data.desc} />\n </div>\n </div>\n </ContentLayout>\n </>\n );\n};\n","import { axios } from 'lib/axios';\nimport { useQuery } from 'react-query';\n\nexport const getAds = () => {\n return axios.get('/adverts');\n};\n\nexport const useAds = ({ config } = {}) => {\n return useQuery({\n ...config,\n queryKey: ['ads'],\n queryFn: () => getAds(),\n });\n};\n","import { axios } from 'lib/axios';\nimport { queryClient } from 'lib/react-query';\nimport { useNotificationStore } from 'stores/notifications';\nimport PropTypes from 'prop-types';\nimport { useMutation } from 'react-query';\n\nexport const deleteAd = ({ adId }) => {\n return axios.delete(`/adverts/${adId}`);\n};\n\ndeleteAd.propTypes = {\n adId: PropTypes.string.isRequired,\n};\n\nexport const useDeleteAd = ({ config } = {}) => {\n const { addNotification } = useNotificationStore();\n\n return useMutation({\n onMutate: async (deletedAd) => {\n await queryClient.cancelQueries('ads');\n\n const previousAds = queryClient.getQueryData('ads');\n\n queryClient.setQueryData(\n 'ads',\n previousAds?.filter((ad) => ad.id !== deletedAd.managerId)\n );\n\n return { previousAds };\n },\n onError: (_, __, context) => {\n if (context?.previousAds) {\n queryClient.setQueryData('ads', context.previousAds);\n }\n },\n onSuccess: () => {\n queryClient.invalidateQueries('ads');\n addNotification({\n type: 'success',\n title: 'Ad Deleted',\n });\n },\n ...config,\n mutationFn: deleteAd,\n });\n};\n","import { Button, ConfirmationDialog, Spinner } from \"components/Elements\";\nimport { Authorization, ROLES } from \"lib/authorization\";\nimport PropTypes from \"prop-types\";\n\nimport { useDeleteAd } from \"../api/deleteAd\";\n\nexport const DeleteAd = ({ id }) => {\n const deleteAdMutation = useDeleteAd();\n\n if (deleteAdMutation.isLoading) {\n return (\n <div\n id=\"loading-screen\"\n className=\"w-full h-full fixed block top-0 left-0 bg-black opacity-75 z-50\"\n >\n <span className=\"opacity-75 top-1/2 my-0 mx-auto block relative w-0 h-0\">\n <Spinner size=\"sm\" />\n </span>\n </div>\n );\n }\n\n return (\n <Authorization allowedRoles={[ROLES.ADMIN]}>\n <ConfirmationDialog\n icon=\"danger\"\n title=\"Delete Advert\"\n body=\"Are you sure you want to delete this Advert?\"\n triggerButton={<button>Remove</button>}\n confirmButton={\n <Button\n isLoading={deleteAdMutation.isLoading}\n type=\"button\"\n className=\"bg-red-600\"\n onClick={async () =>\n await deleteAdMutation.mutateAsync({ adId: id })\n }\n >\n Delete Advert\n </Button>\n }\n />\n </Authorization>\n );\n};\n\nDeleteAd.propTypes = {\n id: PropTypes.string.isRequired,\n};\n","import { Table, Spinner } from \"components/Elements\";\nimport { Link } from \"react-router-dom\";\nimport { formatDate } from \"utils/format\";\n\nimport { useAds } from \"../api/getAds\";\n\nimport { DeleteAd } from \"./DeleteAd\";\n\nexport const AdsList = () => {\n const adsQuery = useAds();\n\n if (adsQuery.isLoading) {\n return (\n <div className=\"w-full h-48 flex justify-center items-center\">\n <Spinner size=\"lg\" />\n </div>\n );\n }\n\n if (!adsQuery.data) return null;\n\n return (\n <Table\n data={adsQuery.data}\n columns={[\n {\n title: \"Lists\",\n field: \"_id\",\n Cell({ entry: { _id, title, createdAt } }) {\n return (\n <Link to={`./${_id}`}>\n <span className=\"text-gray-400 text-md\">{title}</span>\n <span className=\"mx-4 text-gray-200 text-xs\">\n {formatDate(createdAt)}\n </span>\n </Link>\n );\n },\n },\n {\n title: \"...\",\n field: \"_id\",\n Cell({ entry: { _id } }) {\n return <DeleteAd id={_id} />;\n },\n },\n ]}\n />\n );\n};\n","import { axios } from 'lib/axios';\nimport { queryClient } from 'lib/react-query';\nimport { useNotificationStore } from 'stores/notifications';\nimport PropTypes from 'prop-types';\nimport { useMutation } from 'react-query';\n\nexport const createAd = ({ data }) => {\n return axios.post(`/adverts`, data);\n};\n\ncreateAd.propTypes = {\n data: PropTypes.shape({\n title: PropTypes.string.isRequired,\n desc: PropTypes.string.isRequired,\n image: PropTypes.string.isRequired,\n }).isRequired,\n};\n\nexport const useCreateAd = ({ config } = {}) => {\n const { addNotification } = useNotificationStore();\n return useMutation({\n onMutate: async (newAd) => {\n await queryClient.cancelQueries('ads');\n\n const previousAds = queryClient.getQueryData('ads');\n\n queryClient.setQueryData('ads', [...(previousAds || []), newAd.data]);\n\n return { previousAds };\n },\n onError: (_, __, context) => {\n if (context?.previousAds) {\n queryClient.setQueryData('ads', context.previousAds);\n }\n },\n onSuccess: () => {\n queryClient.invalidateQueries('ads');\n addNotification({\n type: 'success',\n title: 'New ad successfully created',\n });\n },\n ...config,\n mutationFn: createAd,\n });\n};\n","import { Button, Spinner } from \"components/Elements\";\nimport {\n Form,\n FormDrawer,\n InputField,\n TextAreaField,\n UploadField,\n} from \"components/Form\";\nimport { Authorization, ROLES } from \"lib/authorization\";\nimport { PlusIcon } from \"@heroicons/react/outline\";\nimport { useState } from \"react\";\nimport * as z from \"zod\";\n\nimport { useCreateAd } from \"../api/createAd\";\n\nconst schema = z.object({\n title: z.string(),\n desc: z.string(),\n});\n\nexport const CreateAd = () => {\n const [image, setImage] = useState(null);\n const [preview, setPreview] = useState(null);\n const createAdMutation = useCreateAd();\n\n if (createAdMutation.isLoading) {\n return (\n <div\n id=\"loading-screen\"\n className=\"w-full h-full fixed block top-0 left-0 bg-black opacity-75 z-50\"\n >\n <span className=\"opacity-75 top-1/2 my-0 mx-auto block relative w-0 h-0\">\n <Spinner size=\"sm\" />\n </span>\n </div>\n );\n }\n\n return (\n <Authorization allowedRoles={[ROLES.ADMIN]}>\n <FormDrawer\n size=\"sm\"\n isDone={createAdMutation.isSuccess}\n triggerButton={\n <Button\n variant=\"create\"\n size=\"sm\"\n startIcon={<PlusIcon className=\"h-4 w-4\" />}\n >\n Create Advert\n </Button>\n }\n title=\"Create New Advert\"\n submitButton={\n <Button\n form=\"create-ad\"\n type=\"submit\"\n size=\"sm\"\n isLoading={createAdMutation.isLoading}\n >\n Submit\n </Button>\n }\n >\n <Form\n id=\"create-ad\"\n encType=\"multipart/form-data\"\n onSubmit={async (values) => {\n const { title, desc } = values;\n const bodyFormData = new FormData();\n bodyFormData.append(\"title\", title);\n bodyFormData.append(\"desc\", desc);\n bodyFormData.append(\"image\", image);\n await createAdMutation.mutateAsync({ data: bodyFormData });\n }}\n schema={schema}\n >\n {({ register, formState, watch, setValue }) => (\n <>\n <InputField\n label=\"Title\"\n error={formState.errors[\"title\"]}\n registration={register(\"title\")}\n />\n <TextAreaField\n label=\"Content\"\n error={formState.errors[\"desc\"]}\n editorContent={watch(\"desc\")}\n setValue={setValue}\n value=\"desc\"\n />\n <UploadField\n title=\"Upload Ad Banner Image\"\n subTitle=\"Upload clear image for better visibility\"\n error={formState.errors[\"image\"]}\n x={1280}\n y={340}\n onChange={(e) => {\n setImage(e.target.files[0]);\n setPreview(URL.createObjectURL(e.target.files[0]));\n }}\n preview={preview}\n />\n </>\n )}\n </Form>\n </FormDrawer>\n </Authorization>\n );\n};\n","import { ContentLayout } from \"components/Layout\";\nimport Breadcrumbs from \"components/Layout/Breadcrumbs\";\n\nimport { AdsList } from \"../components/AdsList\";\nimport { CreateAd } from \"../components/CreateAd\";\n\nexport const Ads = () => {\n const routes = [\n {\n name: \"Banner Adverts\",\n path: \".\",\n },\n ];\n return (\n <ContentLayout title=\"Banner Adverts\" button={<CreateAd />}>\n <Breadcrumbs routes={routes} />\n <div className=\"mt-4\">\n <AdsList />\n </div>\n </ContentLayout>\n );\n};\n","import { Navigate, Route, Routes } from 'react-router-dom';\n\nimport { Ad } from './Ad';\nimport { Ads } from './Ads';\n\nexport const AdsRoutes = () => {\n return (\n <Routes>\n <Route path=\"\" element={<Ads />} />\n <Route path=\":adId\" element={<Ad />} />\n <Route path=\"*\" element={<Navigate to=\".\" />} />\n </Routes>\n );\n};\n","import * as React from \"react\";\n\nfunction PlusIcon(props, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 2,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n ref: svgRef\n }, props), /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M12 4v16m8-8H4\"\n }));\n}\n\nconst ForwardRef = React.forwardRef(PlusIcon);\nexport default ForwardRef;","import * as React from \"react\";\n\nfunction PencilIcon(props, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 20 20\",\n fill: \"currentColor\",\n \"aria-hidden\": \"true\",\n ref: svgRef\n }, props), /*#__PURE__*/React.createElement(\"path\", {\n d: \"M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z\"\n }));\n}\n\nconst ForwardRef = React.forwardRef(PencilIcon);\nexport default ForwardRef;"],"names":["routes","className","to","fill","viewBox","xmlns","d","map","route","index","size","path","name","useAd","adId","config","useQuery","queryKey","queryFn","axios","getAd","updateAd","data","propTypes","PropTypes","title","desc","image","isRequired","schema","z","UpdateAd","useState","setImage","preview","setPreview","adQuery","updateAdMutation","addNotification","useNotificationStore","useMutation","onMutate","updatingAd","queryClient","previousAd","id","onError","_","__","context","onSuccess","type","mutationFn","useUpdateAd","isLoading","allowedRoles","ROLES","Form","isDone","isSuccess","triggerButton","variant","startIcon","PencilIcon","submitButton","form","encType","onSubmit","values","bodyFormData","FormData","append","mutateAsync","options","defaultValues","register","formState","watch","setValue","label","error","errors","registration","editorContent","value","subTitle","x","y","onChange","e","target","files","URL","createObjectURL","Ad","useParams","Head","_id","button","formatDate","createdAt","Breadcrumbs","LazyLoadImage","src","UPLOADS_API_URL","alt","getAds","deleteAd","DeleteAd","deleteAdMutation","deletedAd","previousAds","filter","ad","managerId","useDeleteAd","icon","body","confirmButton","onClick","AdsList","adsQuery","useAds","columns","field","Cell","entry","createAd","CreateAd","createAdMutation","newAd","useCreateAd","PlusIcon","Ads","AdsRoutes","element","ForwardRef","React","props","svgRef","Object","assign","strokeWidth","stroke","ref","strokeLinecap","strokeLinejoin"],"sourceRoot":""}