"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
var client = require("@sanity/client"), stega = require("@sanity/client/stega"), jsxRuntime = require("react/jsx-runtime"), VisualEditingComponent = require("next-sanity/visual-editing/client-component"), react = require("@portabletext/react"), nextLoader = require("@sanity/next-loader"), groq = require("groq"), createDataAttribute = require("@sanity/visual-editing/create-data-attribute");
function _interopDefaultCompat(e) {
return e && typeof e == "object" && "default" in e ? e : { default: e };
}
var VisualEditingComponent__default = /* @__PURE__ */ _interopDefaultCompat(VisualEditingComponent), groq__default = /* @__PURE__ */ _interopDefaultCompat(groq);
function VisualEditing(props) {
let autoBasePath;
if (typeof props.basePath != "string")
try {
autoBasePath = process.env.__NEXT_ROUTER_BASEPATH, autoBasePath && console.log(
`Detected next basePath as ${JSON.stringify(autoBasePath)} by reading "process.env.__NEXT_ROUTER_BASEPATH". If this is incorrect then you can set it manually with the basePath prop on the component.`
);
} catch (err) {
console.error("Failed detecting basePath", err);
}
let autoTrailingSlash;
if (typeof props.trailingSlash != "boolean")
try {
autoTrailingSlash = !!process.env.__NEXT_TRAILING_SLASH, autoTrailingSlash && console.log(
`Detected next trailingSlash as ${JSON.stringify(autoTrailingSlash)} by reading "process.env.__NEXT_TRAILING_SLASH". If this is incorrect then you can set it manually with the trailingSlash prop on the component.`
);
} catch (err) {
console.error("Failed detecting trailingSlash", err);
}
return /* @__PURE__ */ jsxRuntime.jsx(
VisualEditingComponent__default.default,
{
...props,
basePath: props.basePath ?? autoBasePath,
trailingSlash: props.trailingSlash ?? autoTrailingSlash
}
);
}
Object.defineProperty(exports, "createClient", {
enumerable: !0,
get: function() {
return client.createClient;
}
});
Object.defineProperty(exports, "unstable__adapter", {
enumerable: !0,
get: function() {
return client.unstable__adapter;
}
});
Object.defineProperty(exports, "unstable__environment", {
enumerable: !0,
get: function() {
return client.unstable__environment;
}
});
Object.defineProperty(exports, "stegaClean", {
enumerable: !0,
get: function() {
return stega.stegaClean;
}
});
Object.defineProperty(exports, "defineQuery", {
enumerable: !0,
get: function() {
return groq.defineQuery;
}
});
Object.defineProperty(exports, "groq", {
enumerable: !0,
get: function() {
return groq__default.default;
}
});
Object.defineProperty(exports, "createDataAttribute", {
enumerable: !0,
get: function() {
return createDataAttribute.createDataAttribute;
}
});
exports.VisualEditing = VisualEditing;
Object.keys(react).forEach(function(k) {
k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k) && Object.defineProperty(exports, k, {
enumerable: !0,
get: function() {
return react[k];
}
});
});
Object.keys(nextLoader).forEach(function(k) {
k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k) && Object.defineProperty(exports, k, {
enumerable: !0,
get: function() {
return nextLoader[k];
}
});
});
//# sourceMappingURL=index.cjs.map