"use strict";
(globalThis["__googlesitekit_webpackJsonp"] = globalThis["__googlesitekit_webpackJsonp"] || []).push([["googlesitekit-datastore-pdf"],{

/***/ "./js/googlesitekit-datastore-pdf.ts"
/*!*******************************************!*\
  !*** ./js/googlesitekit-datastore-pdf.ts ***!
  \*******************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony import */ var googlesitekit_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! googlesitekit-data */ "googlesitekit-data");
/* harmony import */ var googlesitekit_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(googlesitekit_data__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _googlesitekit_datastore_pdf__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./googlesitekit/datastore/pdf */ "./js/googlesitekit/datastore/pdf/index.ts");
/**
 * Site Kit by Google, Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Internal dependencies
 */


(0,_googlesitekit_datastore_pdf__WEBPACK_IMPORTED_MODULE_1__.registerStore)((googlesitekit_data__WEBPACK_IMPORTED_MODULE_0___default()));

/***/ },

/***/ "./js/googlesitekit/datastore/pdf/constants.ts"
/*!*****************************************************!*\
  !*** ./js/googlesitekit/datastore/pdf/constants.ts ***!
  \*****************************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CORE_PDF: () => (/* binding */ CORE_PDF)
/* harmony export */ });
/**
 * Site Kit by Google, Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

const CORE_PDF = 'core/pdf';

/***/ },

/***/ "./js/googlesitekit/datastore/pdf/index.ts"
/*!*************************************************!*\
  !*** ./js/googlesitekit/datastore/pdf/index.ts ***!
  \*************************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   actions: () => (/* binding */ actions),
/* harmony export */   controls: () => (/* binding */ controls),
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */   initialState: () => (/* binding */ initialState),
/* harmony export */   reducer: () => (/* binding */ reducer),
/* harmony export */   registerStore: () => (/* binding */ registerStore),
/* harmony export */   resolvers: () => (/* binding */ resolvers),
/* harmony export */   selectors: () => (/* binding */ selectors)
/* harmony export */ });
/* harmony import */ var googlesitekit_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! googlesitekit-data */ "googlesitekit-data");
/* harmony import */ var googlesitekit_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(googlesitekit_data__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ "./js/googlesitekit/datastore/pdf/constants.ts");
/* harmony import */ var _pdf__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pdf */ "./js/googlesitekit/datastore/pdf/pdf.ts");
/**
 * Site Kit by Google, Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */



const store = (0,googlesitekit_data__WEBPACK_IMPORTED_MODULE_0__.combineStores)(googlesitekit_data__WEBPACK_IMPORTED_MODULE_0__.commonStore, _pdf__WEBPACK_IMPORTED_MODULE_2__["default"]);
const initialState = store.initialState;
const actions = store.actions;
const controls = store.controls;
const reducer = store.reducer;
const resolvers = store.resolvers;
const selectors = store.selectors;
function registerStore(registry) {
  registry.registerStore(_constants__WEBPACK_IMPORTED_MODULE_1__.CORE_PDF, store);
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (store);

/***/ },

/***/ "./js/googlesitekit/datastore/pdf/pdf.ts"
/*!***********************************************!*\
  !*** ./js/googlesitekit/datastore/pdf/pdf.ts ***!
  \***********************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   actions: () => (/* binding */ actions),
/* harmony export */   controls: () => (/* binding */ controls),
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */   initialState: () => (/* binding */ initialState),
/* harmony export */   reducer: () => (/* binding */ reducer),
/* harmony export */   resolvers: () => (/* binding */ resolvers),
/* harmony export */   selectors: () => (/* binding */ selectors)
/* harmony export */ });
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! invariant */ "../node_modules/invariant/browser.js");
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "../node_modules/lodash/lodash.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var googlesitekit_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! googlesitekit-data */ "googlesitekit-data");
/* harmony import */ var googlesitekit_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(googlesitekit_data__WEBPACK_IMPORTED_MODULE_2__);
/**
 * `core/pdf` data store: pdf data.
 *
 * Site Kit by Google, Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * External dependencies
 */



/**
 * Internal dependencies
 */

const SET_SELECTION = 'SET_SELECTION';
const SET_STATUS = 'SET_STATUS';
const SET_PROGRESS = 'SET_PROGRESS';
const SET_BLOB = 'SET_BLOB';
const CLEAR_EXPORT = 'CLEAR_EXPORT';
const REQUEST_CANCEL = 'REQUEST_CANCEL';
const CLEAR_CANCEL_REQUEST = 'CLEAR_CANCEL_REQUEST';
const START_EXPORTING = 'START_EXPORTING';
const FINISH_EXPORTING = 'FINISH_EXPORTING';
/**
 * Determines whether the given value is an array of strings.
 *
 * @since 1.180.0
 *
 * @param {*} value Value to test.
 * @return {boolean} `true` if `value` is an array whose every element is a string.
 */
function isStringArray(value) {
  return Array.isArray(value) && value.every(item => typeof item === 'string');
}
const initialState = {
  selection: {
    contextSlugs: [],
    widgetSlugs: []
  },
  status: 'idle',
  progress: 0,
  blobURL: null,
  blobFilename: null,
  cancelRequested: false,
  isExporting: false
};
const actions = {
  /**
   * Sets the current PDF export selection.
   *
   * @since 1.180.0
   *
   * @param {Object}   selection              The selection object.
   * @param {string[]} selection.contextSlugs Selected dashboard context slugs.
   * @param {string[]} selection.widgetSlugs  Selected widget slugs.
   * @return {Object} Redux-style action.
   */
  setSelection(selection) {
    invariant__WEBPACK_IMPORTED_MODULE_0___default()((0,lodash__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(selection), 'selection must be a plain object.');
    invariant__WEBPACK_IMPORTED_MODULE_0___default()(isStringArray(selection.contextSlugs), 'selection.contextSlugs must be an array of strings.');
    invariant__WEBPACK_IMPORTED_MODULE_0___default()(isStringArray(selection.widgetSlugs), 'selection.widgetSlugs must be an array of strings.');
    return {
      payload: {
        selection
      },
      type: SET_SELECTION
    };
  },
  /**
   * Sets the current PDF export status.
   *
   * @since 1.180.0
   *
   * @param {string} status One of 'idle', 'progress', 'success', 'error'.
   * @return {Object} Redux-style action.
   */
  setStatus(status) {
    const validStatuses = ['idle', 'progress', 'success', 'error'];
    invariant__WEBPACK_IMPORTED_MODULE_0___default()(validStatuses.includes(status), `status must be one of: ${validStatuses.join(', ')}.`);
    return {
      payload: {
        status
      },
      type: SET_STATUS
    };
  },
  /**
   * Sets the current PDF export progress.
   *
   * @since 1.180.0
   *
   * @param {number} progress Progress value between 0 and 100, inclusive.
   * @return {Object} Redux-style action.
   */
  setProgress(progress) {
    invariant__WEBPACK_IMPORTED_MODULE_0___default()(typeof progress === 'number' && Number.isFinite(progress) && progress >= 0 && progress <= 100, 'progress must be a number between 0 and 100.');
    return {
      payload: {
        progress
      },
      type: SET_PROGRESS
    };
  },
  /**
   * Sets the generated PDF blob URL and filename.
   *
   * @since 1.180.0
   *
   * @param {Object} blob          The blob descriptor.
   * @param {string} blob.url      The blob URL.
   * @param {string} blob.filename The blob filename.
   * @return {Object} Redux-style action.
   */
  setBlob(blob) {
    invariant__WEBPACK_IMPORTED_MODULE_0___default()((0,lodash__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(blob), 'blob must be a plain object.');
    invariant__WEBPACK_IMPORTED_MODULE_0___default()(typeof blob.url === 'string' && blob.url.length > 0, 'blob.url must be a non-empty string.');
    invariant__WEBPACK_IMPORTED_MODULE_0___default()(typeof blob.filename === 'string' && blob.filename.length > 0, 'blob.filename must be a non-empty string.');
    return {
      payload: {
        blob
      },
      type: SET_BLOB
    };
  },
  /**
   * Resets the export-lifecycle fields (status, progress, blobURL, blobFilename).
   *
   * Leaves `selection` untouched so the side sheet retains the user's choices
   * between exports.
   *
   * @since 1.180.0
   *
   * @return {Object} Redux-style action.
   */
  clearExport() {
    return {
      payload: {},
      type: CLEAR_EXPORT
    };
  },
  /**
   * Requests cancellation of the in-flight PDF export.
   *
   * @since 1.180.0
   *
   * @return {Object} Redux-style action.
   */
  requestCancel() {
    return {
      payload: {},
      type: REQUEST_CANCEL
    };
  },
  /**
   * Clears a previously-set cancel request.
   *
   * @since 1.180.0
   *
   * @return {Object} Redux-style action.
   */
  clearCancelRequest() {
    return {
      payload: {},
      type: CLEAR_CANCEL_REQUEST
    };
  },
  /**
   * Marks the PDF export as in progress.
   *
   * @since 1.181.0
   *
   * @return Redux-style action.
   */
  startExporting() {
    return {
      payload: {},
      type: START_EXPORTING
    };
  },
  /**
   * Marks the PDF export as finished.
   *
   * @since 1.181.0
   *
   * @return Redux-style action.
   */
  finishExporting() {
    return {
      payload: {},
      type: FINISH_EXPORTING
    };
  }
};
const controls = {};
const reducer = (0,googlesitekit_data__WEBPACK_IMPORTED_MODULE_2__.createReducer)((state, action) => {
  switch (action.type) {
    case SET_SELECTION:
      state.selection = action.payload.selection;
      break;
    case SET_STATUS:
      state.status = action.payload.status;
      break;
    case SET_PROGRESS:
      state.progress = action.payload.progress;
      break;
    case SET_BLOB:
      state.blobURL = action.payload.blob.url;
      state.blobFilename = action.payload.blob.filename;
      break;
    case CLEAR_EXPORT:
      state.status = initialState.status;
      state.progress = initialState.progress;
      state.blobURL = initialState.blobURL;
      state.blobFilename = initialState.blobFilename;
      break;
    case REQUEST_CANCEL:
      state.cancelRequested = true;
      break;
    case CLEAR_CANCEL_REQUEST:
      state.cancelRequested = false;
      break;
    case START_EXPORTING:
      // Ignore a second start while an export is already in flight so a
      // double-click cannot mount two orchestrators.
      if (!state.isExporting) {
        state.isExporting = true;
      }
      break;
    case FINISH_EXPORTING:
      state.isExporting = false;
      break;
    default:
      break;
  }
});
const resolvers = {};
const selectors = {
  /**
   * Gets the `slugs` used to generate content for the PDF export.
   *
   * @since 1.180.0
   *
   * @param {PDFState} state Data store's state.
   * @return {PDFSelection} Current selection: `{ contextSlugs, widgetSlugs }`.
   */
  getSelection(state) {
    return state.selection;
  },
  /**
   * Gets the currently selected dashboard context slugs.
   *
   * @since 1.180.0
   *
   * @param {PDFState} state Data store's state.
   * @return {string[]} Selected context slugs.
   */
  getSelectedContextSlugs(state) {
    return state.selection.contextSlugs;
  },
  /**
   * Gets the currently selected widget slugs.
   *
   * @since 1.180.0
   *
   * @param {PDFState} state Data store's state.
   * @return {string[]} Selected widget slugs.
   */
  getSelectedWidgetSlugs(state) {
    return state.selection.widgetSlugs;
  },
  /**
   * Gets the current PDF export status.
   *
   * @since 1.180.0
   *
   * @param {PDFState} state Data store's state.
   * @return {PDFStatus} One of 'idle', 'progress', 'success', 'error'.
   */
  getStatus(state) {
    return state.status;
  },
  /**
   * Gets the current PDF export progress.
   *
   * @since 1.180.0
   *
   * @param {PDFState} state Data store's state.
   * @return {number} Progress value between 0 and 100, inclusive.
   */
  getProgress(state) {
    return state.progress;
  },
  /**
   * Gets the generated PDF blob descriptor.
   *
   * @since 1.180.0
   *
   * @param {PDFState} state Data store's state.
   * @return {PDFBlob} Blob descriptor: `{ url, filename }`.
   */
  getBlob(state) {
    return {
      url: state.blobURL,
      filename: state.blobFilename
    };
  },
  /**
   * Determines whether cancellation has been requested for the in-flight export.
   *
   * @since 1.180.0
   *
   * @param {PDFState} state Data store's state.
   * @return {boolean} `true` if cancellation has been requested.
   */
  isCancelRequested(state) {
    return state.cancelRequested;
  },
  /**
   * Determines whether a PDF export is currently in progress.
   *
   * @since 1.181.0
   *
   * @param state Data store's state.
   * @return `true` when exporting.
   */
  isExporting(state) {
    return state.isExporting;
  }
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  initialState,
  actions,
  controls,
  reducer,
  resolvers,
  selectors
});

/***/ },

/***/ "googlesitekit-data"
/*!*****************************************!*\
  !*** external ["googlesitekit","data"] ***!
  \*****************************************/
(module) {

module.exports = googlesitekit.data;

/***/ }

},
/******/ __webpack_require__ => { // webpackRuntimeModules
/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
/******/ __webpack_require__.O(0, ["googlesitekit-vendor"], () => (__webpack_exec__("./js/googlesitekit-datastore-pdf.ts")));
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ }
]);
//# sourceMappingURL=googlesitekit-datastore-pdf.js.map