"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var shared_api_exports = {};
__export(shared_api_exports, {
  SharedActionTypes: () => SharedActionTypes,
  makeswiftConnectionInit: () => makeswiftConnectionInit,
  registerDocument: () => registerDocument,
  registerDocumentsEffect: () => registerDocumentsEffect,
  setBreakpoints: () => setBreakpoints,
  setLocale: () => setLocale,
  unregisterDocument: () => unregisterDocument
});
module.exports = __toCommonJS(shared_api_exports);
var import_locale = require("../locale");
const SharedActionTypes = {
  MAKESWIFT_CONNECTION_INIT: "MAKESWIFT_CONNECTION_INIT",
  REGISTER_DOCUMENT: "REGISTER_DOCUMENT",
  UNREGISTER_DOCUMENT: "UNREGISTER_DOCUMENT",
  SET_BREAKPOINTS: "SET_BREAKPOINTS",
  SET_LOCALE: "SET_LOCALE"
};
function makeswiftConnectionInit() {
  return {
    type: SharedActionTypes.MAKESWIFT_CONNECTION_INIT
  };
}
function registerDocument(document) {
  return {
    type: SharedActionTypes.REGISTER_DOCUMENT,
    payload: { documentKey: document.key, document }
  };
}
function unregisterDocument(documentKey) {
  return { type: SharedActionTypes.UNREGISTER_DOCUMENT, payload: { documentKey } };
}
function registerDocumentsEffect(documents) {
  return (dispatch) => {
    documents.forEach((document) => dispatch(registerDocument(document)));
    return () => {
      documents.forEach((document) => dispatch(unregisterDocument(document.key)));
    };
  };
}
function setBreakpoints(breakpoints) {
  return { type: SharedActionTypes.SET_BREAKPOINTS, payload: { breakpoints } };
}
function setLocale(locale, pathname) {
  return {
    type: SharedActionTypes.SET_LOCALE,
    payload: { locale: import_locale.localeStringSchema.parse(locale.toString()), pathname }
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  SharedActionTypes,
  makeswiftConnectionInit,
  registerDocument,
  registerDocumentsEffect,
  setBreakpoints,
  setLocale,
  unregisterDocument
});
//# sourceMappingURL=shared-api.js.map