urbi-exhibitions
Version:
83 lines (82 loc) • 1.9 kB
JavaScript
import { jsx as i } from "react/jsx-runtime";
import { createContext as u, useContext as c, useState as r, useMemo as I, useCallback as M } from "react";
const d = 1e3, v = 60 * d, D = 60 * d, b = 3 * d, C = u({
enabled: !1,
setEnabled: () => {
},
inactivityDuration: v,
setInactivityDuration: () => {
}
});
function w() {
const o = c(C);
if (o === void 0)
throw new Error("useClockContext must be used within an ClockProvider");
return o;
}
const N = ({ children: o }) => {
const [n, e] = r(!1), [a, s] = r(v), t = I(
() => ({
enabled: n,
setEnabled: e,
inactivityDuration: a,
setInactivityDuration: s
}),
[n, a]
);
return /* @__PURE__ */ i(C.Provider, { value: t, children: o });
};
N.displayName = "ClockProvider";
const p = u(
void 0
);
function _() {
const o = c(p);
if (o === void 0)
throw new Error(
"useGeolocationContext must be used within an GeolocationProvider"
);
return o;
}
const P = ({
children: o
}) => {
const [n, e] = r(void 0);
return /* @__PURE__ */ i(p.Provider, { value: { coordinates: n, setCoordinates: e }, children: o });
};
P.displayName = "GeolocationProvider";
const m = u(void 0);
function k() {
const o = c(m);
if (o === void 0)
throw new Error("useMap must be used within an MapProvider");
return o;
}
const f = ({ children: o }) => {
const [n, e] = r(
void 0
), a = M(
(s) => e((t) => {
var l;
if (t != null && t.map)
return {
...t,
map: { ...t.map, state: { ...(l = t == null ? void 0 : t.map) == null ? void 0 : l.state, ...s } }
};
}),
[e]
);
return /* @__PURE__ */ i(m.Provider, { value: { ...n, setMapContext: e, updateMapState: a }, children: o });
};
f.displayName = "MapProvider";
export {
N as C,
P as G,
f as M,
v as T,
_ as a,
k as b,
D as c,
b as d,
w as u
};