@weatherboard/cms 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/next.cjs +4 -4
- package/dist/next.cjs.map +3 -3
- package/dist/next.mjs +4 -4
- package/dist/next.mjs.map +3 -3
- package/dist/runtime/site-readers.d.cts +7 -1
- package/dist/runtime/site-readers.d.mts +7 -1
- package/dist/runtime/site-readers.d.ts +7 -1
- package/dist/runtime/test-fixtures/saved-documents.d.cts +4 -0
- package/dist/runtime/test-fixtures/saved-documents.d.mts +4 -0
- package/dist/runtime/test-fixtures/saved-documents.d.ts +4 -0
- package/dist/server.cjs +3 -3
- package/dist/server.cjs.map +3 -3
- package/dist/server.mjs +2 -2
- package/dist/server.mjs.map +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CmsQuery, type CmsResolution } from "../contracts/query.cjs";
|
|
2
2
|
import type { CmsReader, CmsReadResult } from "./reader.cjs";
|
|
3
3
|
declare const days: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
4
|
-
/** Saved shapes copied from schema-base 0.
|
|
4
|
+
/** Saved shapes copied from schema-base 0.4.0; no schema package is loaded by CMS. */
|
|
5
5
|
type SavedDocument = {
|
|
6
6
|
readonly _id: string;
|
|
7
7
|
readonly _createdAt: string;
|
|
@@ -11,6 +11,11 @@ type SavedDocument = {
|
|
|
11
11
|
export type SavedVacancyDocument = SavedDocument & {
|
|
12
12
|
readonly _type: "vacancy";
|
|
13
13
|
readonly title?: string;
|
|
14
|
+
readonly workLocation?: {
|
|
15
|
+
readonly _type: "reference";
|
|
16
|
+
readonly _ref: string;
|
|
17
|
+
readonly _weak?: boolean;
|
|
18
|
+
};
|
|
14
19
|
readonly location?: string;
|
|
15
20
|
readonly locationNote?: string;
|
|
16
21
|
readonly summary?: string;
|
|
@@ -85,6 +90,7 @@ export type Vacancy = {
|
|
|
85
90
|
readonly id: string;
|
|
86
91
|
readonly title: string;
|
|
87
92
|
readonly location: string;
|
|
93
|
+
readonly locationId: string | null;
|
|
88
94
|
readonly summary: string | null;
|
|
89
95
|
readonly pdfUrl: string | null;
|
|
90
96
|
readonly applyUrl: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CmsQuery, type CmsResolution } from "../contracts/query.mjs";
|
|
2
2
|
import type { CmsReader, CmsReadResult } from "./reader.mjs";
|
|
3
3
|
declare const days: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
4
|
-
/** Saved shapes copied from schema-base 0.
|
|
4
|
+
/** Saved shapes copied from schema-base 0.4.0; no schema package is loaded by CMS. */
|
|
5
5
|
type SavedDocument = {
|
|
6
6
|
readonly _id: string;
|
|
7
7
|
readonly _createdAt: string;
|
|
@@ -11,6 +11,11 @@ type SavedDocument = {
|
|
|
11
11
|
export type SavedVacancyDocument = SavedDocument & {
|
|
12
12
|
readonly _type: "vacancy";
|
|
13
13
|
readonly title?: string;
|
|
14
|
+
readonly workLocation?: {
|
|
15
|
+
readonly _type: "reference";
|
|
16
|
+
readonly _ref: string;
|
|
17
|
+
readonly _weak?: boolean;
|
|
18
|
+
};
|
|
14
19
|
readonly location?: string;
|
|
15
20
|
readonly locationNote?: string;
|
|
16
21
|
readonly summary?: string;
|
|
@@ -85,6 +90,7 @@ export type Vacancy = {
|
|
|
85
90
|
readonly id: string;
|
|
86
91
|
readonly title: string;
|
|
87
92
|
readonly location: string;
|
|
93
|
+
readonly locationId: string | null;
|
|
88
94
|
readonly summary: string | null;
|
|
89
95
|
readonly pdfUrl: string | null;
|
|
90
96
|
readonly applyUrl: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CmsQuery, type CmsResolution } from "../contracts/query.js";
|
|
2
2
|
import type { CmsReader, CmsReadResult } from "./reader.js";
|
|
3
3
|
declare const days: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
4
|
-
/** Saved shapes copied from schema-base 0.
|
|
4
|
+
/** Saved shapes copied from schema-base 0.4.0; no schema package is loaded by CMS. */
|
|
5
5
|
type SavedDocument = {
|
|
6
6
|
readonly _id: string;
|
|
7
7
|
readonly _createdAt: string;
|
|
@@ -11,6 +11,11 @@ type SavedDocument = {
|
|
|
11
11
|
export type SavedVacancyDocument = SavedDocument & {
|
|
12
12
|
readonly _type: "vacancy";
|
|
13
13
|
readonly title?: string;
|
|
14
|
+
readonly workLocation?: {
|
|
15
|
+
readonly _type: "reference";
|
|
16
|
+
readonly _ref: string;
|
|
17
|
+
readonly _weak?: boolean;
|
|
18
|
+
};
|
|
14
19
|
readonly location?: string;
|
|
15
20
|
readonly locationNote?: string;
|
|
16
21
|
readonly summary?: string;
|
|
@@ -85,6 +90,7 @@ export type Vacancy = {
|
|
|
85
90
|
readonly id: string;
|
|
86
91
|
readonly title: string;
|
|
87
92
|
readonly location: string;
|
|
93
|
+
readonly locationId: string | null;
|
|
88
94
|
readonly summary: string | null;
|
|
89
95
|
readonly pdfUrl: string | null;
|
|
90
96
|
readonly applyUrl: string | null;
|
|
@@ -2,6 +2,10 @@ export declare const savedVacancy: {
|
|
|
2
2
|
readonly _id: "vacancy_7e57";
|
|
3
3
|
readonly _type: "vacancy";
|
|
4
4
|
readonly title: "Assistant";
|
|
5
|
+
readonly workLocation: {
|
|
6
|
+
readonly _type: "reference";
|
|
7
|
+
readonly _ref: "location_7e57";
|
|
8
|
+
};
|
|
5
9
|
readonly location: "Other";
|
|
6
10
|
readonly locationNote: "Depot";
|
|
7
11
|
readonly summary: "Day shift";
|
|
@@ -2,6 +2,10 @@ export declare const savedVacancy: {
|
|
|
2
2
|
readonly _id: "vacancy_7e57";
|
|
3
3
|
readonly _type: "vacancy";
|
|
4
4
|
readonly title: "Assistant";
|
|
5
|
+
readonly workLocation: {
|
|
6
|
+
readonly _type: "reference";
|
|
7
|
+
readonly _ref: "location_7e57";
|
|
8
|
+
};
|
|
5
9
|
readonly location: "Other";
|
|
6
10
|
readonly locationNote: "Depot";
|
|
7
11
|
readonly summary: "Day shift";
|
|
@@ -2,6 +2,10 @@ export declare const savedVacancy: {
|
|
|
2
2
|
readonly _id: "vacancy_7e57";
|
|
3
3
|
readonly _type: "vacancy";
|
|
4
4
|
readonly title: "Assistant";
|
|
5
|
+
readonly workLocation: {
|
|
6
|
+
readonly _type: "reference";
|
|
7
|
+
readonly _ref: "location_7e57";
|
|
8
|
+
};
|
|
5
9
|
readonly location: "Other";
|
|
6
10
|
readonly locationNote: "Depot";
|
|
7
11
|
readonly summary: "Day shift";
|
package/dist/server.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var D=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var ce=(e,n)=>{for(var t in n)D(e,t,{get:n[t],enumerable:!0})},de=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of ae(n))!ue.call(e,r)&&r!==t&&D(e,r,{get:()=>n[r],enumerable:!(o=le(n,r))||o.enumerable});return e};var ye=e=>de(D({},"__esModule",{value:!0}),e);var Oe={};ce(Oe,{MENU_DECORATIONS:()=>I,MENU_LAYOUTS:()=>x,MENU_LAYOUT_DEFAULTS:()=>E,businessLocationsQuery:()=>re,createCmsReader:()=>W,locationTags:()=>ne,locationsQuery:()=>oe,menuQuery:()=>J,menuTags:()=>q,openVacanciesQuery:()=>X,parseBusinessLocation:()=>N,parseLocationDocument:()=>P,parseMenuDocument:()=>R,parseScheduleDocument:()=>v,parseVacancies:()=>
|
|
1
|
+
"use strict";var D=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var ce=(e,n)=>{for(var t in n)D(e,t,{get:n[t],enumerable:!0})},de=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of ae(n))!ue.call(e,r)&&r!==t&&D(e,r,{get:()=>n[r],enumerable:!(o=le(n,r))||o.enumerable});return e};var ye=e=>de(D({},"__esModule",{value:!0}),e);var Oe={};ce(Oe,{MENU_DECORATIONS:()=>I,MENU_LAYOUTS:()=>x,MENU_LAYOUT_DEFAULTS:()=>E,businessLocationsQuery:()=>re,createCmsReader:()=>W,locationTags:()=>ne,locationsQuery:()=>oe,menuQuery:()=>J,menuTags:()=>q,openVacanciesQuery:()=>X,parseBusinessLocation:()=>N,parseLocationDocument:()=>P,parseMenuDocument:()=>R,parseScheduleDocument:()=>v,parseVacancies:()=>L,parseVacancyDocument:()=>M,resolveWithFallback:()=>G,scheduleQuery:()=>ie,scheduleTags:()=>se,vacancyTags:()=>K});module.exports=ye(Oe);var Ke=require("server-only");function F(e){if(!Array.isArray(e))return!1;for(let n=0;n<e.length;n+=1)if(!Object.hasOwn(e,n))return!1;return!0}var x=["stacked","columns"],I=["none","playful"],E={layout:"stacked",decoration:"none"},O=`_type, _id, _rev, _updatedAt, title, locationKeys, note, signOff,
|
|
2
2
|
variants[]{_key, label, note, sections[]{_key, title, service, items[]{
|
|
3
3
|
_key, name, description, priceNote, dietary, allergenNote, availability,
|
|
4
4
|
prices[]{_key, label, amount{minor, currency}}, extras[]{_key, name, amount{minor, currency}}
|
|
5
|
-
}}}`;function q(e,n){return b(e,{types:["menu"],...n===void 0?{}:{ids:[n]}})}function d(e,n){throw new w("menu",[`${e} ${n}`])}function U(e,n,t=new Set,o){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="object"||e===null)return d(n,"is not plain JSON data");try{if(t.has(e))return d(n,"is not acyclic JSON data");let r=Array.isArray(e),s=Object.getPrototypeOf(e);if(r?s!==Array.prototype:s!==Object.prototype&&s!==null)return d(n,"is not an ordinary saved object");t.add(e);let a=Reflect.ownKeys(e),k=r?[]:{},y=0,p=0;for(let i of a){if(typeof i!="string")return d(n,"has a symbol key");let u=r&&i!=="length"?`${n}[${i}]`:`${n}.${i}`,c;try{c=i==="_id"&&o!==void 0?o:Object.getOwnPropertyDescriptor(e,i)}catch{return d(u,"could not be snapshotted as plain JSON data")}if(!c||!Object.hasOwn(c,"value"))return d(u,"is not a saved data property");if(r&&i==="length"){let $=c.value;if(typeof $!="number"||!Number.isSafeInteger($)||$<0)return d(u,"is not a saved list length");y=$;continue}if(!c.enumerable||r&&!/^(0|[1-9]\d*)$/.test(i))return d(u,"is not a JSON data property");let l=c.value,g=U(l,u,t);Object.defineProperty(k,i,{value:g,enumerable:!0,writable:!0,configurable:!0}),p++}return r&&(p!==y||k.length!==y)?d(n,"is not a complete saved list"):k}catch(r){if(r instanceof w)throw r;return d(n,"could not be snapshotted as plain JSON data")}finally{t.delete(e)}}function C(e,n){return e===null||typeof e!="object"||Array.isArray(e)||Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null?d(n,"is not an ordinary saved object"):e}function f(e,n,t=!0){return typeof e!="string"||t&&e.trim()===""?d(n,"is not saved text"):e}function S(e,n,t){return e[n]===void 0||e[n]===null?{}:{[n]:f(e[n],`${t}.${n}`,!1)}}function _(e,n,t){return e==null?[]:F(e)?e.map((o,r)=>t(o,`${n}[${String(r)}]`)):d(n,"is not a complete saved list")}function B(e,n){let t=C(e,n);if(typeof t.minor!="number"||!Number.isSafeInteger(t.minor)||t.minor<0)return d(`${n}.minor`,"is not a whole non-negative safe amount");let o=f(t.currency,`${n}.currency`);return/^[A-Z]{3}$/.test(o)?{minor:t.minor,currency:o}:d(`${n}.currency`,"is not a three-letter currency code")}function pe(e,n){let t=C(e,n);return{_key:f(t._key,`${n}._key`),amount:B(t.amount,`${n}.amount`),...S(t,"label",n)}}function fe(e,n){let t=C(e,n);return{_key:f(t._key,`${n}._key`),name:f(t.name,`${n}.name`),amount:B(t.amount,`${n}.amount`)}}function me(e,n){let t=C(e,n),o=t.availability??"available";return o!=="available"&&o!=="sold-out"&&o!=="hidden"?d(`${n}.availability`,"is not an availability choice"):{_key:f(t._key,`${n}._key`),name:f(t.name,`${n}.name`),...S(t,"description",n),...S(t,"priceNote",n),...S(t,"allergenNote",n),prices:_(t.prices,`${n}.prices`,pe),extras:_(t.extras,`${n}.extras`,fe),dietary:_(t.dietary,`${n}.dietary`,f),availability:o}}function ge(e,n){let t=C(e,n);return{_key:f(t._key,`${n}._key`),title:f(t.title,`${n}.title`),...S(t,"service",n),items:_(t.items,`${n}.items`,me)}}function he(e,n){let t=C(e,n);return{_key:f(t._key,`${n}._key`),label:f(t.label,`${n}.label`),...S(t,"note",n),sections:_(t.sections,`${n}.sections`,ge)}}function ke(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;let n=e._id;return typeof n=="string"&&n.trim()!==""&&!/^(drafts|versions)\./.test(n)}function R(e,n="menu"){return be(U(e,n),n)}function be(e,n){let t=C(e,n);if(t._type!=="menu")return d(`${n}._type`,"is not menu");if(!ke(t))return d(`${n}._id`,"is not a published menu identity");let o=f(t._updatedAt,`${n}._updatedAt`);if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(o)||!Number.isFinite(Date.parse(o)))return d(`${n}._updatedAt`,"is not an update date");let r=_(t.variants,`${n}.variants`,he);return r.length===0?d(`${n}.variants`,"has no menu choices"):{_type:"menu",_id:f(t._id,`${n}._id`),_rev:f(t._rev,`${n}._rev`),_updatedAt:o,title:f(t.title,`${n}.title`),locationKeys:_(t.locationKeys,`${n}.locationKeys`,f),variants:r,...S(t,"note",n),...Object.hasOwn(t,"signOff")?{signOff:t.signOff}:{}}}function H(e){if(e===null)return!0;try{return R(e),!0}catch{return!1}}var Q="malformed-content",w=class extends Error{code=Q;documentId;problems;constructor(n,t){super(`${Q}: ${n}: ${t.join("; ")}`),this.name="MalformedContentError",this.documentId=n,this.problems=t}};var z=`{..., "sections": coalesce(sections[]{..., _type == "menuBlock" => {menu->{${O}}}, _type == "linkListBlock" => {links[]{..., "page": page->{title, "slug": slug.current}}}}, sections)}`,Ue=`*[_type == "page" && defined(slug.current)]|order(slug.current asc)${z}`,Be=`*[_type == "page" && slug.current == $slug][0]${z}`;var $e=/^[A-Za-z][A-Za-z0-9_]{0,63}$/,Se=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,_e=/^[a-z0-9]{6,12}\.[a-z][a-z0-9_-]{0,63}$/;function V(e){if(!e||!Array.isArray(e.types)||e.types.length===0)throw new TypeError("CMS dependencies require document types");let n=[...e.types];for(let o of n)if(typeof o!="string"||!$e.test(o))throw new TypeError("Invalid CMS document type");if(e.ids!==void 0&&!Array.isArray(e.ids))throw new TypeError("Invalid CMS document IDs");let t=e.ids===void 0?void 0:[...e.ids];for(let o of t??[])if(typeof o!="string"||!Se.test(o)||/^(drafts|versions)\./.test(o))throw new TypeError("Invalid CMS document ID");if(new Set(n).size+new Set(t).size>128)throw new TypeError("Too many CMS tags");return Object.freeze({types:Object.freeze(n),...t===void 0?{}:{ids:Object.freeze(t)}})}function A(e){if(!e||typeof e.name!="string"||!/^[A-Za-z][A-Za-z0-9_.-]{0,127}$/.test(e.name)||typeof e.query!="string"||e.query.trim()===""||typeof e.resolve!="function")throw new TypeError("Invalid CMS query configuration");let n=e.params;if(!n||typeof n!="object"||Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw new TypeError("CMS params must be plain JSON scalars");let t={};for(let o of Reflect.ownKeys(n)){let r=Object.getOwnPropertyDescriptor(n,o);if(typeof o!="string"||!r||!Object.hasOwn(r,"value")||!r.enumerable)throw new TypeError("CMS params must be plain JSON scalars");let s=r.value;if(!(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s)))throw new TypeError("CMS params must be plain JSON scalars");Object.defineProperty(t,o,{value:s,enumerable:!0})}return Object.freeze({name:e.name,query:e.query,params:Object.freeze(t),dependencies:V(e.dependencies),resolve:e.resolve})}function b(e,n){if(typeof e!="string"||e.length>77||!_e.test(e))throw new TypeError("Invalid CMS scope");let t=V(n),o=[...[...new Set(t.types)].sort().map(r=>`cms:${e}:type:${r}`),...[...new Set(t.ids??[])].sort().map(r=>`cms:${e}:id:${r}`)];return Object.freeze(o)}function J(e){return A({name:"menu.v1",query:`*[_type == "menu" && _id == $id && !(_id in path("drafts.**")) && !(_id in path("versions.**"))][0]{${O}}`,params:{id:e},dependencies:{types:["menu"],ids:[e]},resolve:(n,t)=>{if(!H(t)||t!==null&&t._id!==e)throw new TypeError("Invalid CMS menu fallback");if(n==null)return{data:t,fallbackFields:["$"]};let o=R(n);if(o._id!==e)throw new w("menu",["menu._id does not match the requested document"]);return{data:o,fallbackFields:[]}}})}function Z(e){if(!e||!Object.hasOwn(e,"data")||!Array.isArray(e.fallbackFields)||![...e.fallbackFields].every(n=>typeof n=="string"&&(n==="$"||/^[A-Za-z][A-Za-z0-9_.[\]-]{0,127}$/.test(n))))throw new TypeError("Invalid CMS resolution");if(e.warnings!==void 0&&(!Array.isArray(e.warnings)||![...e.warnings].every(n=>n==="siteHero.layout.defaulted"||n==="siteHero.tagline.dropped"||n==="siteHero.taglines.defaulted")))throw new TypeError("Invalid CMS resolution warnings");return{data:e.data,fallbackFields:Object.freeze([...new Set(e.fallbackFields)]),...e.warnings?.length?{warnings:Object.freeze([...new Set(e.warnings)])}:{}}}function W(e){let n=e?.revalidateSeconds??3600;if(!Number.isSafeInteger(n)||n<3600||!e?.adapter||typeof e.adapter.read!="function"||e.onDiagnostic!==void 0&&typeof e.onDiagnostic!="function")throw new TypeError("Invalid CMS reader configuration");let t=e.adapter;b(t.scope,{types:["ScopeValidation"]});let o=r=>{try{e.onDiagnostic?e.onDiagnostic(r):console.warn(JSON.stringify(r))}catch{}};return{async read(r,s){let a,k,y;try{if(a=A(r),y=b(t.scope,a.dependencies),!s||!Object.hasOwn(s,"fallback"))throw new TypeError;k=Z(a.resolve(null,s.fallback))}catch{throw new TypeError("Invalid CMS query or fallback configuration")}let p=(c,l,g)=>(o({event:"cms.fallback",query:a.name,reason:c,fields:["$"],...l===void 0?{}:{status:l},...g?{warnings:g}:{}}),{data:k.data,source:"fallback",fallbackFields:["$"],reason:c,...g?{warnings:g}:{}}),i;try{i=await t.read({name:a.name,query:a.query,params:a.params},{tags:y,revalidateSeconds:n})}catch{return p("network")}if(!i.ok){let l=["configuration","network","timeout","rate-limit","upstream","plan-limit","permission","malformed"].includes(i.reason)?i.reason:"malformed",g=Number.isInteger(i.status)&&(i.status??0)>=100&&(i.status??0)<=599?i.status:void 0;return p(l,g)}if(i.value===null||i.value===void 0)return p("missing");let u;try{u=Z(a.resolve(i.value,s.fallback))}catch{return p("malformed")}return u.fallbackFields.includes("$")?{...p("invalid-field",void 0,u.warnings),data:u.data}:u.fallbackFields.length>0?(o({event:"cms.partial-fallback",query:a.name,reason:"invalid-field",fields:u.fallbackFields,...u.warnings?{warnings:u.warnings}:{}}),{...u,source:"mixed",reason:"invalid-field"}):{...u,source:"cms"}}}}var h=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),m=e=>typeof e=="string"&&e.trim()?e.trim():null,Ce=(e,n)=>e._type===n&&typeof e._id=="string"&&e._id.length>0&&!/^(drafts|versions)\./.test(e._id),we=/^\d{4}-\d{2}-\d{2}$/,Y=/^([01]\d|2[0-3]):[0-5]\d$/,Ae=["mon","tue","wed","thu","fri","sat","sun"];async function G(e,n,t){try{let o=await e.read(n,{fallback:t});return{...o,source:o.source==="cms"?"sanity":o.source}}catch{return{data:t,source:"fallback",fallbackFields:["$"],reason:"configuration"}}}var Te=/^[A-Za-z0-9._+-]{1,64}@[A-Za-z0-9-]{1,63}(?:\.[A-Za-z0-9-]{1,63})*\.[A-Za-z]{2,63}$/;function Re(e){let n=m(e);if(!n)return null;try{let t=new URL(n);return t.protocol==="http:"||t.protocol==="https:"?t.href:null}catch{return null}}function T(e){if(typeof e!="function")throw new TypeError("A client validator is required")}function M(e,n,t){if(T(t),!h(e)||e.status!=="open")return null;let o=m(e.closingDate);if(o!==null&&o<n||t(e)!==null)return null;let r=m(e.title),s=e.location==="Other"?m(e.locationNote):m(e.location);if(!r||!s)return null;let a=m(e.pdfUrl);return{id:String(m(e._id)),title:r,location:s,summary:m(e.summary),pdfUrl:a?.startsWith("https://cdn.sanity.io/files/")?a:null,applyUrl:Re(e.applyUrl),applyEmail:typeof e.applyEmail=="string"&&e.applyEmail.length<=254&&Te.test(e.applyEmail)?e.applyEmail:null}}function j(e,n,t){if(T(t),!Array.isArray(e))throw new TypeError("Sanity returned vacancies that are not a list");return e.map(o=>({value:M(o,n,t),order:h(o)&&typeof o.order=="number"&&Number.isFinite(o.order)?o.order:1e6})).filter(o=>o.value!==null).sort((o,r)=>o.order-r.order||o.value.title.toLowerCase().localeCompare(r.value.title.toLowerCase())).map(o=>o.value)}function K(e){return b(e,{types:["vacancy"]})}function X(e,n){if(!we.test(e))throw new TypeError("Invalid calendar date");return T(n),A({name:"vacancy.open.v1",query:'*[_type == "vacancy" && status == "open" && !(_id in path("drafts.**")) && !(_id in path("versions.**")) && (!defined(closingDate) || closingDate >= $today)]|order(coalesce(order, 1000000) asc, lower(title) asc){_id, _type, title, location, locationNote, summary, "pdfUrl": jobDescriptionPdf.asset->url, applyUrl, applyEmail, status, closingDate, order}',params:{today:e},dependencies:{types:["vacancy"]},resolve:(t,o)=>({data:t==null?o:j(t,e,n),fallbackFields:t==null?["$"]:[]})})}var xe=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],Ie=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function L(e){return!h(e)||typeof e._id!="string"||!h(e.slug)||typeof e.slug.current!="string"||!Ie.test(e.slug.current)||m(e.name)===null||e.addressLines!==void 0&&e.addressLines!==null&&(!Array.isArray(e.addressLines)||Array.from(e.addressLines).some(n=>m(n)===null))||e.postcode!==void 0&&e.postcode!==null&&m(e.postcode)===null||e.coordinates!==void 0&&e.coordinates!==null&&(!h(e.coordinates)||typeof e.coordinates.lat!="number"||!Number.isFinite(e.coordinates.lat)||typeof e.coordinates.lng!="number"||!Number.isFinite(e.coordinates.lng))||e.phone!==void 0&&e.phone!==null&&typeof e.phone!="string"||e.email!==void 0&&e.email!==null&&typeof e.email!="string"?null:{name:m(e.name),slug:e.slug.current,addressLines:e.addressLines==null?e.addressLines:e.addressLines.map(n=>n.trim()),postcode:e.postcode==null?e.postcode:String(e.postcode).trim(),coordinates:e.coordinates==null?e.coordinates:{lat:e.coordinates.lat,lng:e.coordinates.lng},phone:e.phone,email:e.email,hours:e.hours}}function ee(e){if(!h(e))return null;let n={};for(let t of xe){let o=e[t];if(!Array.isArray(o)||!Array.from(o).every(r=>h(r)&&typeof r.opens=="string"&&typeof r.closes=="string"))return null;n[t]=o.map(r=>({opens:r.opens,closes:r.closes}))}return n}function P(e,n,t){T(t);let o=L(e);if(o===null||o.slug!==n.id)return{data:n,fallbackFields:["$"]};let r=ee(o.hours),s={id:n.id,label:o.name,addressLines:o.addressLines??n.addressLines,postcode:o.postcode??n.postcode,geo:o.coordinates==null?n.geo:{latitude:o.coordinates.lat,longitude:o.coordinates.lng},telephone:o.phone===void 0?n.telephone:o.phone,email:o.email===void 0?n.email:o.email,hours:r??n.hours};try{return{data:t(s),fallbackFields:r===null?["hours"]:[]}}catch{if(r!==null)try{return{data:t({...s,hours:n.hours}),fallbackFields:["hours"]}}catch{}return{data:n,fallbackFields:["$"]}}}function N(e,n,t){T(t);let o=L(e);if(o===null||o.slug!==n.id)return{data:n,fallbackFields:["$"]};let r=ee(o.hours),s={...n,label:o.name,address:n.address===null?null:{...n.address,streetAddress:o.addressLines??n.address.streetAddress,postalCode:o.postcode??n.address.postalCode},telephone:o.phone===void 0?n.telephone:o.phone,email:o.email===void 0?n.email:o.email,geo:o.coordinates==null?n.geo:{latitude:o.coordinates.lat,longitude:o.coordinates.lng},hours:r??n.hours};try{return{data:t(s),fallbackFields:r===null?["hours"]:[]}}catch{if(r!==null)try{return{data:t({...s,hours:n.hours}),fallbackFields:["hours"]}}catch{}return{data:n,fallbackFields:["$"]}}}function ne(e){return b(e,{types:["location"]})}function te(e,n){return A({name:e,query:'*[_type == "location" && defined(slug.current) && !(_id in path("drafts.**")) && !(_id in path("versions.**"))]{_id, _type, name, slug, addressLines, postcode, coordinates, phone, email, hours}',params:{},dependencies:{types:["location"]},resolve:(t,o)=>{if(!Array.isArray(t))return{data:o,fallbackFields:["$"]};let r=new Map,s=new Set;for(let y of t){let p=L(y);p!==null&&(r.has(p.slug)?s.add(p.slug):r.set(p.slug,y))}let a=[];return{data:o.map((y,p)=>{let i=r.get(y.id),u=i===void 0||s.has(y.id)?{data:y,fallbackFields:["$"]}:n(i,y);return a.push(...u.fallbackFields.map(c=>c==="$"?`locations[${p}]`:`locations[${p}].${c}`)),u.data}),fallbackFields:o.length>0&&a.length===o.length&&a.every(y=>/^locations\[\d+\]$/.test(y))?["$"]:a}}})}function oe(e){return T(e),te("locations.v1",(n,t)=>P(n,t,e))}function re(e){return T(e),te("locations.business.v1",(n,t)=>N(n,t,e))}function Ee(e,n,t){let o=`${e}-${n.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"stop"}`,r=o;for(let s=2;t.has(r);s++)r=`${o}-${s}`;return t.add(r),r}function v(e,n){if(!h(e)||!Ce(e,"schedule")||e._id!=="schedule"||e.timeZone!==n.timeZone||!Array.isArray(e.days)||e.days.length!==7)throw new TypeError("Invalid schedule document");let t=e.days.map((o,r)=>{if(!h(o)||o.day!==Ae[r]||typeof o.rest!="boolean"||!Array.isArray(o.stops))throw new TypeError("Invalid schedule day");let s=o.day,a=o.rest,k=o.stops,y=n.days.find(c=>c.day===s),p=new Set(y?.stops.map(c=>c.id)??[]),i=new Set,u=k.map(c=>{if(!h(c))throw new TypeError("Invalid schedule stop");let l=c;if(!m(l.name)||!Y.test(String(l.from??""))||!Y.test(String(l.to??""))||!m(l.address))throw new TypeError("Invalid schedule stop");let g=y?.stops.find($=>$.name===l.name&&!i.has($.id));return g?(i.add(g.id),{...g,name:String(l.name),from:String(l.from),to:String(l.to),address:String(l.address)}):{id:Ee(s,String(l.name),p),name:String(l.name),from:String(l.from),to:String(l.to),address:String(l.address),place:null,postcode:null,notes:null,lat:null,lng:null,coordinateSource:null,approximate:!1,needsConfirmation:null,captured:`${l.name}
|
|
5
|
+
}}}`;function q(e,n){return b(e,{types:["menu"],...n===void 0?{}:{ids:[n]}})}function y(e,n){throw new w("menu",[`${e} ${n}`])}function U(e,n,t=new Set,o){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="object"||e===null)return y(n,"is not plain JSON data");try{if(t.has(e))return y(n,"is not acyclic JSON data");let r=Array.isArray(e),s=Object.getPrototypeOf(e);if(r?s!==Array.prototype:s!==Object.prototype&&s!==null)return y(n,"is not an ordinary saved object");t.add(e);let a=Reflect.ownKeys(e),g=r?[]:{},u=0,p=0;for(let i of a){if(typeof i!="string")return y(n,"has a symbol key");let c=r&&i!=="length"?`${n}[${i}]`:`${n}.${i}`,d;try{d=i==="_id"&&o!==void 0?o:Object.getOwnPropertyDescriptor(e,i)}catch{return y(c,"could not be snapshotted as plain JSON data")}if(!d||!Object.hasOwn(d,"value"))return y(c,"is not a saved data property");if(r&&i==="length"){let $=d.value;if(typeof $!="number"||!Number.isSafeInteger($)||$<0)return y(c,"is not a saved list length");u=$;continue}if(!d.enumerable||r&&!/^(0|[1-9]\d*)$/.test(i))return y(c,"is not a JSON data property");let l=d.value,h=U(l,c,t);Object.defineProperty(g,i,{value:h,enumerable:!0,writable:!0,configurable:!0}),p++}return r&&(p!==u||g.length!==u)?y(n,"is not a complete saved list"):g}catch(r){if(r instanceof w)throw r;return y(n,"could not be snapshotted as plain JSON data")}finally{t.delete(e)}}function C(e,n){return e===null||typeof e!="object"||Array.isArray(e)||Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null?y(n,"is not an ordinary saved object"):e}function f(e,n,t=!0){return typeof e!="string"||t&&e.trim()===""?y(n,"is not saved text"):e}function S(e,n,t){return e[n]===void 0||e[n]===null?{}:{[n]:f(e[n],`${t}.${n}`,!1)}}function _(e,n,t){return e==null?[]:F(e)?e.map((o,r)=>t(o,`${n}[${String(r)}]`)):y(n,"is not a complete saved list")}function B(e,n){let t=C(e,n);if(typeof t.minor!="number"||!Number.isSafeInteger(t.minor)||t.minor<0)return y(`${n}.minor`,"is not a whole non-negative safe amount");let o=f(t.currency,`${n}.currency`);return/^[A-Z]{3}$/.test(o)?{minor:t.minor,currency:o}:y(`${n}.currency`,"is not a three-letter currency code")}function pe(e,n){let t=C(e,n);return{_key:f(t._key,`${n}._key`),amount:B(t.amount,`${n}.amount`),...S(t,"label",n)}}function fe(e,n){let t=C(e,n);return{_key:f(t._key,`${n}._key`),name:f(t.name,`${n}.name`),amount:B(t.amount,`${n}.amount`)}}function me(e,n){let t=C(e,n),o=t.availability??"available";return o!=="available"&&o!=="sold-out"&&o!=="hidden"?y(`${n}.availability`,"is not an availability choice"):{_key:f(t._key,`${n}._key`),name:f(t.name,`${n}.name`),...S(t,"description",n),...S(t,"priceNote",n),...S(t,"allergenNote",n),prices:_(t.prices,`${n}.prices`,pe),extras:_(t.extras,`${n}.extras`,fe),dietary:_(t.dietary,`${n}.dietary`,f),availability:o}}function ge(e,n){let t=C(e,n);return{_key:f(t._key,`${n}._key`),title:f(t.title,`${n}.title`),...S(t,"service",n),items:_(t.items,`${n}.items`,me)}}function he(e,n){let t=C(e,n);return{_key:f(t._key,`${n}._key`),label:f(t.label,`${n}.label`),...S(t,"note",n),sections:_(t.sections,`${n}.sections`,ge)}}function ke(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;let n=e._id;return typeof n=="string"&&n.trim()!==""&&!/^(drafts|versions)\./.test(n)}function R(e,n="menu"){return be(U(e,n),n)}function be(e,n){let t=C(e,n);if(t._type!=="menu")return y(`${n}._type`,"is not menu");if(!ke(t))return y(`${n}._id`,"is not a published menu identity");let o=f(t._updatedAt,`${n}._updatedAt`);if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(o)||!Number.isFinite(Date.parse(o)))return y(`${n}._updatedAt`,"is not an update date");let r=_(t.variants,`${n}.variants`,he);return r.length===0?y(`${n}.variants`,"has no menu choices"):{_type:"menu",_id:f(t._id,`${n}._id`),_rev:f(t._rev,`${n}._rev`),_updatedAt:o,title:f(t.title,`${n}.title`),locationKeys:_(t.locationKeys,`${n}.locationKeys`,f),variants:r,...S(t,"note",n),...Object.hasOwn(t,"signOff")?{signOff:t.signOff}:{}}}function H(e){if(e===null)return!0;try{return R(e),!0}catch{return!1}}var Q="malformed-content",w=class extends Error{code=Q;documentId;problems;constructor(n,t){super(`${Q}: ${n}: ${t.join("; ")}`),this.name="MalformedContentError",this.documentId=n,this.problems=t}};var z=`{..., "sections": coalesce(sections[]{..., _type == "menuBlock" => {menu->{${O}}}, _type == "linkListBlock" => {links[]{..., "page": page->{title, "slug": slug.current}}}}, sections)}`,Ue=`*[_type == "page" && defined(slug.current)]|order(slug.current asc)${z}`,Be=`*[_type == "page" && slug.current == $slug][0]${z}`;var $e=/^[A-Za-z][A-Za-z0-9_]{0,63}$/,Se=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,_e=/^[a-z0-9]{6,12}\.[a-z][a-z0-9_-]{0,63}$/;function V(e){if(!e||!Array.isArray(e.types)||e.types.length===0)throw new TypeError("CMS dependencies require document types");let n=[...e.types];for(let o of n)if(typeof o!="string"||!$e.test(o))throw new TypeError("Invalid CMS document type");if(e.ids!==void 0&&!Array.isArray(e.ids))throw new TypeError("Invalid CMS document IDs");let t=e.ids===void 0?void 0:[...e.ids];for(let o of t??[])if(typeof o!="string"||!Se.test(o)||/^(drafts|versions)\./.test(o))throw new TypeError("Invalid CMS document ID");if(new Set(n).size+new Set(t).size>128)throw new TypeError("Too many CMS tags");return Object.freeze({types:Object.freeze(n),...t===void 0?{}:{ids:Object.freeze(t)}})}function A(e){if(!e||typeof e.name!="string"||!/^[A-Za-z][A-Za-z0-9_.-]{0,127}$/.test(e.name)||typeof e.query!="string"||e.query.trim()===""||typeof e.resolve!="function")throw new TypeError("Invalid CMS query configuration");let n=e.params;if(!n||typeof n!="object"||Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw new TypeError("CMS params must be plain JSON scalars");let t={};for(let o of Reflect.ownKeys(n)){let r=Object.getOwnPropertyDescriptor(n,o);if(typeof o!="string"||!r||!Object.hasOwn(r,"value")||!r.enumerable)throw new TypeError("CMS params must be plain JSON scalars");let s=r.value;if(!(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s)))throw new TypeError("CMS params must be plain JSON scalars");Object.defineProperty(t,o,{value:s,enumerable:!0})}return Object.freeze({name:e.name,query:e.query,params:Object.freeze(t),dependencies:V(e.dependencies),resolve:e.resolve})}function b(e,n){if(typeof e!="string"||e.length>77||!_e.test(e))throw new TypeError("Invalid CMS scope");let t=V(n),o=[...[...new Set(t.types)].sort().map(r=>`cms:${e}:type:${r}`),...[...new Set(t.ids??[])].sort().map(r=>`cms:${e}:id:${r}`)];return Object.freeze(o)}function J(e){return A({name:"menu.v1",query:`*[_type == "menu" && _id == $id && !(_id in path("drafts.**")) && !(_id in path("versions.**"))][0]{${O}}`,params:{id:e},dependencies:{types:["menu"],ids:[e]},resolve:(n,t)=>{if(!H(t)||t!==null&&t._id!==e)throw new TypeError("Invalid CMS menu fallback");if(n==null)return{data:t,fallbackFields:["$"]};let o=R(n);if(o._id!==e)throw new w("menu",["menu._id does not match the requested document"]);return{data:o,fallbackFields:[]}}})}function Z(e){if(!e||!Object.hasOwn(e,"data")||!Array.isArray(e.fallbackFields)||![...e.fallbackFields].every(n=>typeof n=="string"&&(n==="$"||/^[A-Za-z][A-Za-z0-9_.[\]-]{0,127}$/.test(n))))throw new TypeError("Invalid CMS resolution");if(e.warnings!==void 0&&(!Array.isArray(e.warnings)||![...e.warnings].every(n=>n==="siteHero.layout.defaulted"||n==="siteHero.tagline.dropped"||n==="siteHero.taglines.defaulted")))throw new TypeError("Invalid CMS resolution warnings");return{data:e.data,fallbackFields:Object.freeze([...new Set(e.fallbackFields)]),...e.warnings?.length?{warnings:Object.freeze([...new Set(e.warnings)])}:{}}}function W(e){let n=e?.revalidateSeconds??3600;if(!Number.isSafeInteger(n)||n<3600||!e?.adapter||typeof e.adapter.read!="function"||e.onDiagnostic!==void 0&&typeof e.onDiagnostic!="function")throw new TypeError("Invalid CMS reader configuration");let t=e.adapter;b(t.scope,{types:["ScopeValidation"]});let o=r=>{try{e.onDiagnostic?e.onDiagnostic(r):console.warn(JSON.stringify(r))}catch{}};return{async read(r,s){let a,g,u;try{if(a=A(r),u=b(t.scope,a.dependencies),!s||!Object.hasOwn(s,"fallback"))throw new TypeError;g=Z(a.resolve(null,s.fallback))}catch{throw new TypeError("Invalid CMS query or fallback configuration")}let p=(d,l,h)=>(o({event:"cms.fallback",query:a.name,reason:d,fields:["$"],...l===void 0?{}:{status:l},...h?{warnings:h}:{}}),{data:g.data,source:"fallback",fallbackFields:["$"],reason:d,...h?{warnings:h}:{}}),i;try{i=await t.read({name:a.name,query:a.query,params:a.params},{tags:u,revalidateSeconds:n})}catch{return p("network")}if(!i.ok){let l=["configuration","network","timeout","rate-limit","upstream","plan-limit","permission","malformed"].includes(i.reason)?i.reason:"malformed",h=Number.isInteger(i.status)&&(i.status??0)>=100&&(i.status??0)<=599?i.status:void 0;return p(l,h)}if(i.value===null||i.value===void 0)return p("missing");let c;try{c=Z(a.resolve(i.value,s.fallback))}catch{return p("malformed")}return c.fallbackFields.includes("$")?{...p("invalid-field",void 0,c.warnings),data:c.data}:c.fallbackFields.length>0?(o({event:"cms.partial-fallback",query:a.name,reason:"invalid-field",fields:c.fallbackFields,...c.warnings?{warnings:c.warnings}:{}}),{...c,source:"mixed",reason:"invalid-field"}):{...c,source:"cms"}}}}var k=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),m=e=>typeof e=="string"&&e.trim()?e.trim():null,Ce=(e,n)=>e._type===n&&typeof e._id=="string"&&e._id.length>0&&!/^(drafts|versions)\./.test(e._id),we=/^\d{4}-\d{2}-\d{2}$/,Y=/^([01]\d|2[0-3]):[0-5]\d$/,Ae=["mon","tue","wed","thu","fri","sat","sun"];async function G(e,n,t){try{let o=await e.read(n,{fallback:t});return{...o,source:o.source==="cms"?"sanity":o.source}}catch{return{data:t,source:"fallback",fallbackFields:["$"],reason:"configuration"}}}var Te=/^[A-Za-z0-9._+-]{1,64}@[A-Za-z0-9-]{1,63}(?:\.[A-Za-z0-9-]{1,63})*\.[A-Za-z]{2,63}$/;function Re(e){let n=m(e);if(!n)return null;try{let t=new URL(n);return t.protocol==="http:"||t.protocol==="https:"?t.href:null}catch{return null}}function T(e){if(typeof e!="function")throw new TypeError("A client validator is required")}function M(e,n,t){if(T(t),!k(e)||e.status!=="open")return null;let o=m(e.closingDate);if(o!==null&&o<n||t(e)!==null)return null;let r=m(e.title),s=k(e.workLocation)?e.workLocation:null,a=m(e.location),g=m(s?.name)??(a==="Other"?null:a)??m(e.locationNote);if(!r||!g)return null;let u=m(e.pdfUrl);return{id:String(m(e._id)),title:r,location:g,locationId:s===null?null:m(s._id),summary:m(e.summary),pdfUrl:u?.startsWith("https://cdn.sanity.io/files/")?u:null,applyUrl:Re(e.applyUrl),applyEmail:typeof e.applyEmail=="string"&&e.applyEmail.length<=254&&Te.test(e.applyEmail)?e.applyEmail:null}}function L(e,n,t){if(T(t),!Array.isArray(e))throw new TypeError("Sanity returned vacancies that are not a list");return e.map(o=>({value:M(o,n,t),order:k(o)&&typeof o.order=="number"&&Number.isFinite(o.order)?o.order:1e6})).filter(o=>o.value!==null).sort((o,r)=>o.order-r.order||o.value.title.toLowerCase().localeCompare(r.value.title.toLowerCase())).map(o=>o.value)}function K(e){return b(e,{types:["vacancy","location"]})}function X(e,n){if(!we.test(e))throw new TypeError("Invalid calendar date");return T(n),A({name:"vacancy.open.v2",query:'*[_type == "vacancy" && status == "open" && !(_id in path("drafts.**")) && !(_id in path("versions.**")) && (!defined(closingDate) || closingDate >= $today)]|order(coalesce(order, 1000000) asc, lower(title) asc){_id, _type, title, "workLocation": workLocation->{_id, name}, location, locationNote, summary, "pdfUrl": jobDescriptionPdf.asset->url, applyUrl, applyEmail, status, closingDate, order}',params:{today:e},dependencies:{types:["vacancy","location"]},resolve:(t,o)=>({data:t==null?o:L(t,e,n),fallbackFields:t==null?["$"]:[]})})}var xe=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],Ie=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function j(e){return!k(e)||typeof e._id!="string"||!k(e.slug)||typeof e.slug.current!="string"||!Ie.test(e.slug.current)||m(e.name)===null||e.addressLines!==void 0&&e.addressLines!==null&&(!Array.isArray(e.addressLines)||Array.from(e.addressLines).some(n=>m(n)===null))||e.postcode!==void 0&&e.postcode!==null&&m(e.postcode)===null||e.coordinates!==void 0&&e.coordinates!==null&&(!k(e.coordinates)||typeof e.coordinates.lat!="number"||!Number.isFinite(e.coordinates.lat)||typeof e.coordinates.lng!="number"||!Number.isFinite(e.coordinates.lng))||e.phone!==void 0&&e.phone!==null&&typeof e.phone!="string"||e.email!==void 0&&e.email!==null&&typeof e.email!="string"?null:{name:m(e.name),slug:e.slug.current,addressLines:e.addressLines==null?e.addressLines:e.addressLines.map(n=>n.trim()),postcode:e.postcode==null?e.postcode:String(e.postcode).trim(),coordinates:e.coordinates==null?e.coordinates:{lat:e.coordinates.lat,lng:e.coordinates.lng},phone:e.phone,email:e.email,hours:e.hours}}function ee(e){if(!k(e))return null;let n={};for(let t of xe){let o=e[t];if(!Array.isArray(o)||!Array.from(o).every(r=>k(r)&&typeof r.opens=="string"&&typeof r.closes=="string"))return null;n[t]=o.map(r=>({opens:r.opens,closes:r.closes}))}return n}function P(e,n,t){T(t);let o=j(e);if(o===null||o.slug!==n.id)return{data:n,fallbackFields:["$"]};let r=ee(o.hours),s={id:n.id,label:o.name,addressLines:o.addressLines??n.addressLines,postcode:o.postcode??n.postcode,geo:o.coordinates==null?n.geo:{latitude:o.coordinates.lat,longitude:o.coordinates.lng},telephone:o.phone===void 0?n.telephone:o.phone,email:o.email===void 0?n.email:o.email,hours:r??n.hours};try{return{data:t(s),fallbackFields:r===null?["hours"]:[]}}catch{if(r!==null)try{return{data:t({...s,hours:n.hours}),fallbackFields:["hours"]}}catch{}return{data:n,fallbackFields:["$"]}}}function N(e,n,t){T(t);let o=j(e);if(o===null||o.slug!==n.id)return{data:n,fallbackFields:["$"]};let r=ee(o.hours),s={...n,label:o.name,address:n.address===null?null:{...n.address,streetAddress:o.addressLines??n.address.streetAddress,postalCode:o.postcode??n.address.postalCode},telephone:o.phone===void 0?n.telephone:o.phone,email:o.email===void 0?n.email:o.email,geo:o.coordinates==null?n.geo:{latitude:o.coordinates.lat,longitude:o.coordinates.lng},hours:r??n.hours};try{return{data:t(s),fallbackFields:r===null?["hours"]:[]}}catch{if(r!==null)try{return{data:t({...s,hours:n.hours}),fallbackFields:["hours"]}}catch{}return{data:n,fallbackFields:["$"]}}}function ne(e){return b(e,{types:["location"]})}function te(e,n){return A({name:e,query:'*[_type == "location" && defined(slug.current) && !(_id in path("drafts.**")) && !(_id in path("versions.**"))]{_id, _type, name, slug, addressLines, postcode, coordinates, phone, email, hours}',params:{},dependencies:{types:["location"]},resolve:(t,o)=>{if(!Array.isArray(t))return{data:o,fallbackFields:["$"]};let r=new Map,s=new Set;for(let u of t){let p=j(u);p!==null&&(r.has(p.slug)?s.add(p.slug):r.set(p.slug,u))}let a=[];return{data:o.map((u,p)=>{let i=r.get(u.id),c=i===void 0||s.has(u.id)?{data:u,fallbackFields:["$"]}:n(i,u);return a.push(...c.fallbackFields.map(d=>d==="$"?`locations[${p}]`:`locations[${p}].${d}`)),c.data}),fallbackFields:o.length>0&&a.length===o.length&&a.every(u=>/^locations\[\d+\]$/.test(u))?["$"]:a}}})}function oe(e){return T(e),te("locations.v1",(n,t)=>P(n,t,e))}function re(e){return T(e),te("locations.business.v1",(n,t)=>N(n,t,e))}function Ee(e,n,t){let o=`${e}-${n.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"stop"}`,r=o;for(let s=2;t.has(r);s++)r=`${o}-${s}`;return t.add(r),r}function v(e,n){if(!k(e)||!Ce(e,"schedule")||e._id!=="schedule"||e.timeZone!==n.timeZone||!Array.isArray(e.days)||e.days.length!==7)throw new TypeError("Invalid schedule document");let t=e.days.map((o,r)=>{if(!k(o)||o.day!==Ae[r]||typeof o.rest!="boolean"||!Array.isArray(o.stops))throw new TypeError("Invalid schedule day");let s=o.day,a=o.rest,g=o.stops,u=n.days.find(d=>d.day===s),p=new Set(u?.stops.map(d=>d.id)??[]),i=new Set,c=g.map(d=>{if(!k(d))throw new TypeError("Invalid schedule stop");let l=d;if(!m(l.name)||!Y.test(String(l.from??""))||!Y.test(String(l.to??""))||!m(l.address))throw new TypeError("Invalid schedule stop");let h=u?.stops.find($=>$.name===l.name&&!i.has($.id));return h?(i.add(h.id),{...h,name:String(l.name),from:String(l.from),to:String(l.to),address:String(l.address)}):{id:Ee(s,String(l.name),p),name:String(l.name),from:String(l.from),to:String(l.to),address:String(l.address),place:null,postcode:null,notes:null,lat:null,lng:null,coordinateSource:null,approximate:!1,needsConfirmation:null,captured:`${l.name}
|
|
6
6
|
${l.from}-${l.to}
|
|
7
|
-
${l.address}`}});return{day:s,rest:a,stops:a?[]:
|
|
7
|
+
${l.address}`}});return{day:s,rest:a,stops:a?[]:c}});return{timeZone:n.timeZone,days:t}}function se(e){return b(e,{types:["schedule"],ids:["schedule"]})}function ie(){return A({name:"schedule.v1",query:'*[_type == "schedule" && _id == "schedule" && !(_id in path("drafts.**")) && !(_id in path("versions.**"))][0]{_id, _type, timeZone, days}',params:{},dependencies:{types:["schedule"],ids:["schedule"]},resolve:(e,n)=>({data:e==null?n:v(e,n),fallbackFields:e==null?["$"]:[]})})}0&&(module.exports={MENU_DECORATIONS,MENU_LAYOUTS,MENU_LAYOUT_DEFAULTS,businessLocationsQuery,createCmsReader,locationTags,locationsQuery,menuQuery,menuTags,openVacanciesQuery,parseBusinessLocation,parseLocationDocument,parseMenuDocument,parseScheduleDocument,parseVacancies,parseVacancyDocument,resolveWithFallback,scheduleQuery,scheduleTags,vacancyTags});
|
|
8
8
|
//# sourceMappingURL=server.cjs.map
|