"use client";

// src/components/shell/builder-dev-sync.tsx
import * as React2 from "react";

// src/components/shell/product-authoring-context.tsx
import * as React from "react";
import {
  isPlatformCreatorWorkspace,
  setRuntimeProductAuthoring
} from "@exxatdesignux/product-framework/product-authoring-gate";
import {
  isProductAuthoringEnabled,
  isProductAuthoringRuntimeAllowed
} from "@exxatdesignux/product-framework/product-authoring";
import { jsx, jsxs } from "react/jsx-runtime";
var ProductAuthoringContext = React.createContext(
  void 0
);
function useProductAuthoringEnabled() {
  const ctx = React.useContext(ProductAuthoringContext);
  if (ctx !== void 0) return ctx;
  if (!isProductAuthoringRuntimeAllowed()) return false;
  return isProductAuthoringEnabled();
}

// src/components/shell/builder-dev-sync.tsx
import { ensureShippedCatalogLoaded } from "@exxatdesignux/product-framework/tenant-products/shipped-catalog";
import {
  isBuilderDevSyncEnvironment,
  startBuilderDevSync
} from "@exxatdesignux/product-framework/tenant-products/builder-dev-sync";
function BuilderDevSync() {
  const authoring = useProductAuthoringEnabled();
  React2.useEffect(() => {
    if (!authoring || !isBuilderDevSyncEnvironment()) return;
    let stop = () => {
    };
    void ensureShippedCatalogLoaded().finally(() => {
      stop = startBuilderDevSync();
    });
    return () => stop();
  }, [authoring]);
  return null;
}
export {
  BuilderDevSync
};
//# sourceMappingURL=builder-dev-sync.js.map