/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ "./src/scss/admin/notification/index.scss":
/*!************************************************!*\
  !*** ./src/scss/admin/notification/index.scss ***!
  \************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin


/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
/*!*********************************************!*\
  !*** ./src/js/admin/notifications/index.js ***!
  \*********************************************/
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _scss_admin_notification_index_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../../scss/admin/notification/index.scss */ "./src/scss/admin/notification/index.scss");
/**
 * WeCodeArt Framework.
 *
 * WARNING: This file is part of the core WeCodeArt Framework. DO NOT edit this file under any circumstances.
 * Please do all modifications in the form of a child theme.
 *
 * @package 	WeCodeArt FrameWork
 * @subpackage 	Admin/Notifications
 * @copyright   Copyright (c) 2025, WeCodeArt Framework
 * @since 		3.8.1
 * @version		6.1.2
 */


const Notification = {
  init() {
    document.addEventListener('click', e => {
      var _target$closest$datas;
      const {
        target
      } = e;
      const noticeId = (_target$closest$datas = target.closest('.wca-notice')?.dataset?.id) !== null && _target$closest$datas !== void 0 ? _target$closest$datas : '';
      if (target.matches('[data-dismiss]')) {
        this.dismissNew(e, noticeId);
      } else if (target.classList.contains('notice-dismiss')) {
        this.dismiss(e, noticeId);
      }
    });
  },
  dismiss(e, noticeId) {
    e.preventDefault();
    this.ajax(noticeId);
  },
  dismissNew(e, noticeId) {
    var _target$getAttribute, _target$getAttribute2;
    e.preventDefault();
    const {
      target
    } = e;
    const el = target.closest('.wca-notice');
    this.ajax(noticeId);
    el.parentNode.removeChild(el);
    const link = (_target$getAttribute = target.getAttribute('href')) !== null && _target$getAttribute !== void 0 ? _target$getAttribute : '';
    const _target = (_target$getAttribute2 = target.getAttribute('target')) !== null && _target$getAttribute2 !== void 0 ? _target$getAttribute2 : '';
    link && _target === '_blank' && window.open(link, '_blank');
  },
  ajax(noticeId) {
    if (noticeId === '') {
      return;
    }
    const notices = [...document.querySelectorAll('.wca-notice')];
    const container = notices.filter(({
      dataset: {
        id = ''
      } = {}
    }) => id == noticeId).pop();
    const {
      nonce = ''
    } = container?.dataset || {};
    fetch(ajaxurl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
      },
      body: `action=wca_dismiss_notification&notification=${encodeURIComponent(noticeId)}&nonce=${encodeURIComponent(nonce)}`
    });
  }
};
document.addEventListener('DOMContentLoaded', () => {
  Notification.init();
});
})();

/******/ })()
;
//# sourceMappingURL=notifications.js.map