@homepages/concrete 2.0.0 → 4.0.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/CHANGELOG.md +63 -0
- package/codemods/framework-namespace.mjs +107 -0
- package/codemods/manifest.json +15 -0
- package/codemods/platform-namespace.mjs +83 -0
- package/codemods/theme-collapse.mjs +396 -0
- package/dist/artifact/playground/client/assets/{index-CW7co-u9.js → index-D1fwOGVK.js} +37 -37
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
- package/dist/artifact/playground/host.mjs +19 -19
- package/dist/base.css +57 -34
- package/dist/browser/site-config.d.ts +1 -1
- package/dist/browser/site-config.js +3 -2
- package/dist/cli/check/render/class-conflicts.js +1 -1
- package/dist/cli/dev/islands.js +2 -2
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
- package/dist/packages/internal/format-geometry/dist/capture.js +4 -4
- package/dist/packages/internal/island-runtime/dist/contract.d.ts +1 -1
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +2 -2
- package/dist/primitives/FrameShell.d.ts +1 -1
- package/dist/primitives/FrameShell.js +1 -1
- package/dist/primitives/Image.d.ts +1 -1
- package/dist/primitives/Image.js +3 -3
- package/dist/primitives/Section.d.ts +3 -3
- package/dist/primitives/Section.js +4 -4
- package/dist/primitives/Tour.d.ts +1 -1
- package/dist/primitives/Tour.js +3 -3
- package/dist/primitives/Video.d.ts +1 -1
- package/dist/primitives/Video.js +3 -3
- package/dist/styles.css +4 -3
- package/guide/reference/cli/INDEX.md +2 -2
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +1 -1
- package/package.json +1 -3
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Playground</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-D1fwOGVK.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="./assets/index-CckS2ONm.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f="data-tr-island",j="data-tr-island-id",T="data-tr-island-props",z="data-tr-island-frameless";var O=class extends Error{name="IslandPropsError"};function B(t){let o;try{o=JSON.parse(t)}catch(e){throw new O(`island props payload is not valid JSON: ${String(e)}`)}if(o===null||typeof o!="object"||Array.isArray(o))throw new O("island props payload must be a JSON object");return o}var J=Symbol.for("homepages.tr-island-editor-instance");function q(t){let o=globalThis,e=o[J];return e||(e=t.createContext(null),o[J]=e),e}var U=Symbol.for("homepages.tr-island-id");function V(t){let o=globalThis,e=o[U];return e||(e=t.createContext(null),o[U]=e),e}var tt="100%";function N(t){let o=t.getBoundingClientRect();return o.width>0||o.height>0}function et(t){if(N(t))return t;let o=t.firstElementChild;if(o&&N(o))return o;for(let e=t.previousElementSibling;e;e=e.previousElementSibling)if(N(e))return e;for(let e=t.parentElement;e;e=e.parentElement)if(N(e))return e;return o??t}function nt(t){let o=t.getBoundingClientRect();return o.bottom>0&&o.right>0&&o.top<window.innerHeight&&o.left<window.innerWidth}function ot(){return navigator.connection?.saveData===!0}function rt(t){typeof requestIdleCallback=="function"?requestIdleCallback(t):setTimeout(t,1)}async function Y(t){let{markers:o,hydrate:e,warm:i,moduleUrl:a}=t,c=n=>n.getAttribute(f)??"",d=new Set,u=n=>d.has(n)?Promise.resolve(null):(d.add(n),e(n)),p=new Map;for(let n of o)p.set(n,et(n));let I=n=>p.get(n)??n,b=[],w=[];for(let n of o)(nt(I(n))?b:w).push(n);if(a&&!ot()){let n=new Set;for(let r of w){let s=a(c(r));if(s==null||s===""||n.has(s))continue;n.add(s);let l=document.createElement("link");l.rel="modulepreload",l.href=s,l.setAttribute("fetchpriority","low"),document.head.appendChild(l)}}for(let n of b)i(c(n));let E=[];for(let n of b){let r=await u(n);r&&E.push(r)}let m=null,h=new Map,R=n=>{let r=u(n),s=I(n),l=h.get(s);return(!l||l.every(L=>d.has(L)))&&m?.unobserve(s),r};if(typeof IntersectionObserver<"u"){m=new IntersectionObserver(n=>{for(let r of n)if(r.isIntersecting)for(let s of h.get(r.target)??[])R(s)},{rootMargin:tt});for(let n of w){let r=I(n),s=h.get(r);s?s.push(n):(h.set(r,[n]),m.observe(r))}}let _=w.slice(),g=()=>{rt(()=>{let n=_.shift();for(;n&&d.has(n);)n=_.shift();if(!n){m?.disconnect();return}R(n).then(g,g)})};return g(),E}var G="data-section-instance-id",C=new WeakMap;async function P(t){let o=t.root??document,e=Array.from(o.querySelectorAll(`[${f}]`)).filter(n=>!C.has(n)&&n.parentElement?.closest(`[${f}]`)==null);if(e.length===0)return[];let i=new Map,a=new Set;for(let n of o.querySelectorAll(`script[${T}]`)){let r=n.getAttribute(T);r!==null&&(i.has(r)&&a.add(r),i.set(r,n.textContent??""))}let[c,{createRoot:d,hydrateRoot:u}]=await Promise.all([import("react"),import("react-dom/client")]),{createElement:p}=c,I=q(c),b=V(c),w=({onMounted:n,children:r})=>{let[s,l]=c.useState(0);return c.useEffect(()=>{s===0?l(1):n()},[s,n]),r},E=new Map,m=n=>{let r=E.get(n);return r||(r=t.load(n),E.set(n,r)),r},h=t.schedule!=="eager",R=h?m:t.load,_=async n=>{let r=n.getAttribute(f)??"",s=n.getAttribute(j)??"",l=()=>{},L=new Promise(S=>{l=S}),y={id:s,key:r,element:n,mounted:L};try{if(a.has(s))throw new Error(`island "${s}" (${r}) shares its id with another ${T} payload \u2014 refusing to hydrate either instance rather than guess whose props belong to which marker`);let S=i.get(s);if(S===void 0)throw new Error(`island "${s}" (${r}) has no ${T} payload`);let Q=B(S),M=await R(r);if(y.editor=M.editor,t.shouldHydrate&&!t.shouldHydrate(y)||C.has(n)||!n.isConnected)return l(),null;let Z=n.closest(`[${G}]`)?.getAttribute(G)??null,k=p(I,{value:Z},p(b,{value:s},p(w,{onMounted:l,children:p(M.default,Q)}))),H={onUncaughtError:D=>{t.onError?.(D,y),l()},onCaughtError:D=>{t.onError?.(D,y),l()}},x;return n.hasAttribute(z)?(x=d(n,H),x.render(k)):x=u(n,k,H),C.set(n,x),t.onHydrated?.(y),y}catch(S){return t.onError?.(S,y),l(),null}};if(h)return Y({markers:e,hydrate:_,warm:n=>{m(n).catch(()=>{})},moduleUrl:t.moduleUrl});let g=[];for(let n of e){let r=await _(n);r&&g.push(r)}return g}function $(t=document){let o=t instanceof Element&&t.matches(`[${f}]`)?[t]:[];for(let e of[...o,...t.querySelectorAll(`[${f}]`)]){let i=C.get(e);i&&(C.delete(e),i.unmount())}}import{createElement as it,useLayoutEffect as at}from"react";var A="we-enh-shield",W="we-enh-shield--item",lt="data-we-live",ct="data-slot-item",dt=window.__TR_ISLAND_MAP||{};function ut(t){let o=dt[t];return o?import(new URL(o,document.baseURI).href):Promise.reject(new Error("playground: no island module for "+t))}var v=new WeakMap;function ft(t,o){return function(i){return at(o,[]),it(t,i)}}function pt(t){return t.__trIslandReal||t.default}async function mt(t){let o=await ut(t),e,i=new Promise(c=>{e=c}),a=o.editor?{...o.editor}:void 0;return a&&v.set(a,{committed:i,signalCommit:e}),{...o,editor:a,default:ft(pt(o),e)}}function ht(t,o){let e=t.createElement("div");return e.className=o?A+" "+W:A,e.setAttribute("aria-hidden","true"),e}function K(t,o){let e=t.ownerDocument,i=e.defaultView,a=i?i.getComputedStyle(t).position:"";(!a||a==="static")&&(t.style.position="relative"),!Array.from(t.children).some(c=>c.classList.contains(A))&&t.appendChild(ht(e,o))}function yt(t){let o=t.editor;if(!o||o.live!==!0)return;let e=t.element;for(let u of Array.from(e.querySelectorAll("["+ct+"]")))K(u,!0);let a=e.ownerDocument.defaultView,d=(a?a.getComputedStyle(e).display:"")==="contents"?Array.from(e.children):[e];for(let u of d)K(u,!1)}var F=!1;function wt(){if(F||document.getElementById("
|
|
1
|
+
var f="data-tr-island",j="data-tr-island-id",T="data-tr-island-props",z="data-tr-island-frameless";var O=class extends Error{name="IslandPropsError"};function B(t){let o;try{o=JSON.parse(t)}catch(e){throw new O(`island props payload is not valid JSON: ${String(e)}`)}if(o===null||typeof o!="object"||Array.isArray(o))throw new O("island props payload must be a JSON object");return o}var J=Symbol.for("homepages.tr-island-editor-instance");function q(t){let o=globalThis,e=o[J];return e||(e=t.createContext(null),o[J]=e),e}var U=Symbol.for("homepages.tr-island-id");function V(t){let o=globalThis,e=o[U];return e||(e=t.createContext(null),o[U]=e),e}var tt="100%";function N(t){let o=t.getBoundingClientRect();return o.width>0||o.height>0}function et(t){if(N(t))return t;let o=t.firstElementChild;if(o&&N(o))return o;for(let e=t.previousElementSibling;e;e=e.previousElementSibling)if(N(e))return e;for(let e=t.parentElement;e;e=e.parentElement)if(N(e))return e;return o??t}function nt(t){let o=t.getBoundingClientRect();return o.bottom>0&&o.right>0&&o.top<window.innerHeight&&o.left<window.innerWidth}function ot(){return navigator.connection?.saveData===!0}function rt(t){typeof requestIdleCallback=="function"?requestIdleCallback(t):setTimeout(t,1)}async function Y(t){let{markers:o,hydrate:e,warm:i,moduleUrl:a}=t,c=n=>n.getAttribute(f)??"",d=new Set,u=n=>d.has(n)?Promise.resolve(null):(d.add(n),e(n)),p=new Map;for(let n of o)p.set(n,et(n));let I=n=>p.get(n)??n,b=[],w=[];for(let n of o)(nt(I(n))?b:w).push(n);if(a&&!ot()){let n=new Set;for(let r of w){let s=a(c(r));if(s==null||s===""||n.has(s))continue;n.add(s);let l=document.createElement("link");l.rel="modulepreload",l.href=s,l.setAttribute("fetchpriority","low"),document.head.appendChild(l)}}for(let n of b)i(c(n));let E=[];for(let n of b){let r=await u(n);r&&E.push(r)}let m=null,h=new Map,R=n=>{let r=u(n),s=I(n),l=h.get(s);return(!l||l.every(L=>d.has(L)))&&m?.unobserve(s),r};if(typeof IntersectionObserver<"u"){m=new IntersectionObserver(n=>{for(let r of n)if(r.isIntersecting)for(let s of h.get(r.target)??[])R(s)},{rootMargin:tt});for(let n of w){let r=I(n),s=h.get(r);s?s.push(n):(h.set(r,[n]),m.observe(r))}}let _=w.slice(),g=()=>{rt(()=>{let n=_.shift();for(;n&&d.has(n);)n=_.shift();if(!n){m?.disconnect();return}R(n).then(g,g)})};return g(),E}var G="data-section-instance-id",C=new WeakMap;async function P(t){let o=t.root??document,e=Array.from(o.querySelectorAll(`[${f}]`)).filter(n=>!C.has(n)&&n.parentElement?.closest(`[${f}]`)==null);if(e.length===0)return[];let i=new Map,a=new Set;for(let n of o.querySelectorAll(`script[${T}]`)){let r=n.getAttribute(T);r!==null&&(i.has(r)&&a.add(r),i.set(r,n.textContent??""))}let[c,{createRoot:d,hydrateRoot:u}]=await Promise.all([import("react"),import("react-dom/client")]),{createElement:p}=c,I=q(c),b=V(c),w=({onMounted:n,children:r})=>{let[s,l]=c.useState(0);return c.useEffect(()=>{s===0?l(1):n()},[s,n]),r},E=new Map,m=n=>{let r=E.get(n);return r||(r=t.load(n),E.set(n,r)),r},h=t.schedule!=="eager",R=h?m:t.load,_=async n=>{let r=n.getAttribute(f)??"",s=n.getAttribute(j)??"",l=()=>{},L=new Promise(S=>{l=S}),y={id:s,key:r,element:n,mounted:L};try{if(a.has(s))throw new Error(`island "${s}" (${r}) shares its id with another ${T} payload \u2014 refusing to hydrate either instance rather than guess whose props belong to which marker`);let S=i.get(s);if(S===void 0)throw new Error(`island "${s}" (${r}) has no ${T} payload`);let Q=B(S),M=await R(r);if(y.editor=M.editor,t.shouldHydrate&&!t.shouldHydrate(y)||C.has(n)||!n.isConnected)return l(),null;let Z=n.closest(`[${G}]`)?.getAttribute(G)??null,k=p(I,{value:Z},p(b,{value:s},p(w,{onMounted:l,children:p(M.default,Q)}))),H={onUncaughtError:D=>{t.onError?.(D,y),l()},onCaughtError:D=>{t.onError?.(D,y),l()}},x;return n.hasAttribute(z)?(x=d(n,H),x.render(k)):x=u(n,k,H),C.set(n,x),t.onHydrated?.(y),y}catch(S){return t.onError?.(S,y),l(),null}};if(h)return Y({markers:e,hydrate:_,warm:n=>{m(n).catch(()=>{})},moduleUrl:t.moduleUrl});let g=[];for(let n of e){let r=await _(n);r&&g.push(r)}return g}function $(t=document){let o=t instanceof Element&&t.matches(`[${f}]`)?[t]:[];for(let e of[...o,...t.querySelectorAll(`[${f}]`)]){let i=C.get(e);i&&(C.delete(e),i.unmount())}}import{createElement as it,useLayoutEffect as at}from"react";var A="we-enh-shield",W="we-enh-shield--item",lt="data-we-live",ct="data-slot-item",dt=window.__TR_ISLAND_MAP||{};function ut(t){let o=dt[t];return o?import(new URL(o,document.baseURI).href):Promise.reject(new Error("playground: no island module for "+t))}var v=new WeakMap;function ft(t,o){return function(i){return at(o,[]),it(t,i)}}function pt(t){return t.__trIslandReal||t.default}async function mt(t){let o=await ut(t),e,i=new Promise(c=>{e=c}),a=o.editor?{...o.editor}:void 0;return a&&v.set(a,{committed:i,signalCommit:e}),{...o,editor:a,default:ft(pt(o),e)}}function ht(t,o){let e=t.createElement("div");return e.className=o?A+" "+W:A,e.setAttribute("aria-hidden","true"),e}function K(t,o){let e=t.ownerDocument,i=e.defaultView,a=i?i.getComputedStyle(t).position:"";(!a||a==="static")&&(t.style.position="relative"),!Array.from(t.children).some(c=>c.classList.contains(A))&&t.appendChild(ht(e,o))}function yt(t){let o=t.editor;if(!o||o.live!==!0)return;let e=t.element;for(let u of Array.from(e.querySelectorAll("["+ct+"]")))K(u,!0);let a=e.ownerDocument.defaultView,d=(a?a.getComputedStyle(e).display:"")==="contents"?Array.from(e.children):[e];for(let u of d)K(u,!1)}var F=!1;function wt(){if(F||document.getElementById("concrete-canvas-shield-style"))return;F=!0;let t=document.createElement("style");t.id="concrete-canvas-shield-style",t.textContent="."+A+"{position:absolute;inset:0;z-index:1;cursor:pointer;background:transparent;}."+W+"{z-index:2;}["+lt+"] ."+A+"{display:none;}",document.head.appendChild(t)}async function X(t){wt();let o=await P({root:t,load:mt,schedule:"eager",shouldHydrate:e=>e.editor?e.editor.live===!0:!1,onError:(e,i)=>{if(console.error("playground: canvas island failed to hydrate:",i.key,e),i.editor){let a=v.get(i.editor);a&&a.signalCommit()}}});await Promise.all(o.map(e=>e.editor?v.get(e.editor):void 0).filter(e=>e!==void 0).map(e=>e.committed));for(let e of o)yt(e);return o}function gt(t){$(t),t.querySelectorAll("."+A).forEach(o=>o.remove())}window.__trCanvasIslands={hydrateRoot:X,unmountRoot:gt};X(document.body);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ke=/^(\d+(?:\.\d+)?)(in|mm)$/;function X(e){let t=Ke.exec(e),[,n,r]=t??[];if(n===void 0||r===void 0)throw new Error(`malformed physical length: "${e}"`);let o=Number.parseFloat(n);return r==="mm"?o/25.4:o}function O(e){if(typeof e.width=="number"&&typeof e.height=="number")return{frameWidth:e.width,frameHeight:e.height,bleed:0,viewportWidth:e.width,viewportHeight:e.height,deviceScaleFactor:1,pixelWidth:e.width,pixelHeight:e.height,pointWidth:e.width/96*72,pointHeight:e.height/96*72,bleedPoints:0};let t=e,n=X(t.width),r=X(t.height),o=t.bleed===void 0?0:X(t.bleed),s=n*96,u=r*96,d=o*96,a=s+2*d,h=u+2*d,v=t.dpi/96;return{frameWidth:s,frameHeight:u,bleed:d,viewportWidth:a,viewportHeight:h,deviceScaleFactor:v,pixelWidth:Math.round(a*v),pixelHeight:Math.round(h*v),pointWidth:(n+2*o)*72,pointHeight:(r+2*o)*72,bleedPoints:o*72}}var C="concrete-frame";function N(e){let t=O(e);return{"--frame-w":`${t.frameWidth}px`,"--frame-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}var K=`(function () {
|
|
2
2
|
function CaptureIntersectionObserver(callback, options) {
|
|
3
3
|
var opts = options || {};
|
|
4
4
|
this.root = opts.root || null;
|
|
@@ -46,23 +46,23 @@ var Xe=/^(\d+(?:\.\d+)?)(in|mm)$/;function Y(e){let t=Xe.exec(e),[,n,r]=t??[];if
|
|
|
46
46
|
return entries;
|
|
47
47
|
};
|
|
48
48
|
window.IntersectionObserver = CaptureIntersectionObserver;
|
|
49
|
-
})();`;var
|
|
50
|
-
const ready = window.${
|
|
49
|
+
})();`;var J="__trIslandsReady",Ze=`(async () => {
|
|
50
|
+
const ready = window.${J};
|
|
51
51
|
if (ready === undefined) {
|
|
52
52
|
throw new Error(
|
|
53
53
|
"capture blocked: the page ships island markers but its host published no " +
|
|
54
|
-
"window.${
|
|
54
|
+
"window.${J} \u2014 the island runtime never ran",
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
await ready;
|
|
58
|
-
})()`;var le=400;var
|
|
58
|
+
})()`;var le=400;var et=`(async () => {
|
|
59
59
|
await new Promise((resolve) => {
|
|
60
60
|
setTimeout(resolve, ${le});
|
|
61
61
|
});
|
|
62
62
|
await new Promise((resolve) => {
|
|
63
63
|
requestAnimationFrame(() => resolve(undefined));
|
|
64
64
|
});
|
|
65
|
-
})()`,ce=5,
|
|
65
|
+
})()`,ce=5,tt=`(async () => {
|
|
66
66
|
const frame = () => new Promise((resolve) => {
|
|
67
67
|
requestAnimationFrame(() => resolve(undefined));
|
|
68
68
|
});
|
|
@@ -83,14 +83,14 @@ var Xe=/^(\d+(?:\.\d+)?)(in|mm)$/;function Y(e){let t=Xe.exec(e),[,n,r]=t??[];if
|
|
|
83
83
|
await frame();
|
|
84
84
|
}
|
|
85
85
|
await frame();
|
|
86
|
-
})()`;function M(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function y(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
87
|
-
<script type="application/json" id="
|
|
88
|
-
${e.root.bodyHtml}${
|
|
86
|
+
})()`;function M(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function y(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var de="tr-frame",ue="tr-root",pe="tr-site-config";function me(e){return fe(e.id,{...N(e)})}function fe(e,t){let n=Object.entries(t).map(([r,o])=>`${r}:${o}`).join(";");return{class:`${C} ${de}`,dataFormat:e,style:n}}function L(e,t){let n=me(e);return`<div class="${y(n.class)}" data-format="${y(n.dataFormat)}" style="${y(n.style)}">${t.join("")}</div>`}var nt="concrete-root",rt="concrete-site-config";function $(e){switch(e.destination){case"published":return ot(e);case"artifact":return it(e);case"preview":return at(e);case"diff":return st(e)}}function ge(e){return e.kind==="none"||Object.keys(e.islandMap).length===0?[]:[`<script>${K}</script>`]}var ye="html, body { margin: 0; padding: 0; }";function he(e){let t=[`rel="${e.rel}"`,`href="${y(e.href)}"`];return e.sizes!==void 0&&t.push(`sizes="${y(e.sizes)}"`),e.type!==void 0&&t.push(`type="${y(e.type)}"`),`<link ${t.join(" ")} />`}function ot(e){let{meta:t}=e,n=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${y(t.title)}</title>`,`<meta name="description" content="${y(t.description)}" />`];t.canonical&&n.push(`<link rel="canonical" href="${y(t.canonical)}" />`);for(let s of t.icons??[])n.push(he(s));n.push('<meta property="og:type" content="website" />'),t.siteName&&n.push(`<meta property="og:site_name" content="${y(t.siteName)}" />`),n.push(`<meta property="og:title" content="${y(t.title)}" />`),n.push(`<meta property="og:description" content="${y(t.description)}" />`),t.ogUrl&&n.push(`<meta property="og:url" content="${y(t.ogUrl)}" />`),t.ogImage&&(n.push(`<meta property="og:image" content="${y(t.ogImage)}" />`),t.ogImageWidth&&n.push(`<meta property="og:image:width" content="${t.ogImageWidth}" />`),t.ogImageHeight&&n.push(`<meta property="og:image:height" content="${t.ogImageHeight}" />`),t.ogImageType&&n.push(`<meta property="og:image:type" content="${y(t.ogImageType)}" />`),t.ogImageAlt&&n.push(`<meta property="og:image:alt" content="${y(t.ogImageAlt)}" />`),n.push('<meta name="twitter:card" content="summary_large_image" />'),n.push(`<meta name="twitter:title" content="${y(t.title)}" />`),n.push(`<meta name="twitter:description" content="${y(t.description)}" />`),n.push(`<meta name="twitter:image" content="${y(t.ogImage)}" />`)),n.push(...q(e.stylesheets)),n.push(...Z(e.islands)),e.prefetchUrls&&e.prefetchUrls.length>0&&n.push(`<script type="speculationrules">${M({prefetch:[{source:"list",urls:[...e.prefetchUrls]}]})}</script>`);let r=e.siteConfig?M(e.siteConfig):null,o=r===null?"":[rt,pe].map(s=>`
|
|
87
|
+
<script type="application/json" id="${s}">${r}</script>`).join("");return j({lang:t.lang??"en",head:n,body:` <body class="${nt} ${ue}">
|
|
88
|
+
${e.root.bodyHtml}${o}${ee(e.islands,"viewport")}
|
|
89
89
|
<script type="module" src="${y(e.analyticsJs.url)}"></script>
|
|
90
|
-
</body>`})}function
|
|
90
|
+
</body>`})}function it(e){let t=['<meta charset="utf-8" />'];e.title!==void 0&&t.push(`<title>${y(e.title)}</title>`),t.push(...q(e.stylesheets));let n=[ye,...ct(e.root)];return t.push(Q(n)),t.push(...ge(e.islands)),t.push(...Z(e.islands)),j({lang:"en",head:t,body:` <body>${lt(e.root)}${ee(e.islands,"eager")}</body>`})}function at(e){let t=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${y(e.title)}</title>`,...e.icon===void 0?[]:[he({rel:"icon",href:e.icon})],...q(e.stylesheets),Q([ye,...e.extraCss??[]]),...e.capture===!0?ge(e.islands):[],...Z(e.islands)],n=(e.devScripts??[]).map(r=>`
|
|
91
91
|
${r}`).join("");return j({lang:"en",head:t,body:` <body>
|
|
92
92
|
${e.root.bodyHtml}${ee(e.islands,e.capture===!0?"eager":"viewport")}${n}
|
|
93
|
-
</body>`})}function
|
|
93
|
+
</body>`})}function st(e){let t=['<meta charset="utf-8" />',`<meta name="viewport" content="width=${e.viewportWidth}, initial-scale=1" />`,`<title>${y(e.title)}</title>`,...q(e.stylesheets),Q([`html, body { margin: 0; padding: 0; width: ${e.viewportWidth}px; }`])];return j({lang:"en",head:t,body:` <body>${e.root.bodyHtml}</body>`})}function j(e){let t=e.head.map(n=>` ${n}`).join(`
|
|
94
94
|
`);return`<!doctype html>
|
|
95
95
|
<html lang="${y(e.lang)}">
|
|
96
96
|
<head>
|
|
@@ -98,22 +98,22 @@ ${t}
|
|
|
98
98
|
</head>
|
|
99
99
|
${e.body}
|
|
100
100
|
</html>
|
|
101
|
-
`}function
|
|
102
|
-
`)}function
|
|
101
|
+
`}function lt(e){return e.kind==="frame"?L(e.format,e.sectionHtml):e.pages.map(t=>L(e.format,t)).join(`
|
|
102
|
+
`)}function ct(e){return e.kind!=="frameStack"?[]:[`body > .${C} { break-after: page; }`,`body > .${C}:last-child { break-after: auto; }`]}function q(e){return e.kind==="links"?e.hrefs.map(t=>`<link rel="stylesheet" href="${y(t)}" />`):e.css.map(t=>`<style>${t}</style>`)}function Q(e){let[t,...n]=e;return t===void 0?"<style></style>":n.length===0?`<style>${t}</style>`:`<style>${t}
|
|
103
103
|
${n.join(`
|
|
104
104
|
`)}
|
|
105
105
|
</style>`}function Z(e){if(e.kind!=="bundles")return[];let t=[],n=e.reactVendorMap;if(n&&Object.keys(n).length>0&&t.push(`<script type="importmap">${M({imports:n})}</script>`),Object.keys(e.islandMap).length===0)return t;for(let r of[e.runtime.url,...Object.values(n??{}),...e.reactVendorCore?[e.reactVendorCore.url]:[]])t.push(`<link rel="modulepreload" href="${y(r)}" />`);return t}function ee(e,t){if(e.kind==="none"||Object.keys(e.islandMap).length===0)return"";let n=M(e.islandMap),r=t==="eager"?' window.__TR_ISLAND_SCHEDULE = "eager";':"";return e.kind==="bundles"?`
|
|
106
106
|
<script>window.__TR_ISLAND_MAP=${n};${r}</script>
|
|
107
107
|
<script type="module" src="${y(e.runtime.url)}"></script>`:`
|
|
108
|
-
${
|
|
108
|
+
${dt}
|
|
109
109
|
<script>window.__TR_ISLAND_MAP = ${n};${r}</script>
|
|
110
|
-
<script type="module" src="${y(e.bootstrapUrl)}"></script>`}var
|
|
110
|
+
<script type="module" src="${y(e.bootstrapUrl)}"></script>`}var dt=`<script type="module">
|
|
111
111
|
import RefreshRuntime from "/@react-refresh";
|
|
112
112
|
RefreshRuntime.injectIntoGlobalHook(window);
|
|
113
113
|
window.$RefreshReg$ = () => {};
|
|
114
114
|
window.$RefreshSig$ = () => (type) => type;
|
|
115
115
|
window.__vite_plugin_react_preamble_installed__ = true;
|
|
116
|
-
</script>`;function ge(){let e={};return new Proxy(e,{get:(t,n)=>typeof n!="string"||n in e||n==="then"||n==="toJSON"?e[n]:`#${n}`})}function ye(e){let t=new URLSearchParams;for(let[r,o]of Object.entries(e))o!=null&&o!==""&&t.set(r,o);let n=t.toString();return n===""?"":`?${n}`}var T={catalog:"api/catalog",render:"api/render",media:e=>`api/media${ye({fixture:e})}`,capture:(e,t)=>`api/capture/${e}${ye({fixture:t.fixture,format:t.format,page:t.page,canvas:t.canvas})}`,live:(e,t)=>`fixtures/${encodeURIComponent(e)}/live${t==="/"?"/":`${t}/`}`,hmr:"__hmr"};var g=class extends Error{constructor(n,r){super(r);this.status=n}status};function at(e){return e.split("-").map(t=>t&&t[0].toUpperCase()+t.slice(1)).join(" ")}function he(e){let{variant:t}=e;return{required:e.required,variant:t===null?null:{cases:t.cases.map(n=>({value:n,label:at(n)})),locked:t.locked}}}function _e(e){return Object.fromEntries(e.map(t=>[t.instance_id,{enabled:t.enabled,...t.variant===void 0?{}:{variant:t.variant}}]))}function be(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new g(400,"A render request's display is an object keyed by instance id.");let t={};for(let[n,r]of Object.entries(e)){if(typeof r!="object"||r===null||Array.isArray(r))throw new g(400,`The display state of "${n}" is not an object.`);let{enabled:o,variant:l}=r;if(o!==void 0&&typeof o!="boolean")throw new g(400,`The display state of "${n}" has a non-boolean enabled.`);if(l!==void 0&&typeof l!="string")throw new g(400,`The display state of "${n}" has a non-string variant.`);t[n]={...o===void 0?{}:{enabled:o},...l===void 0?{}:{variant:l}}}return t}function ve(e,t){for(let[n,r]of Object.entries(t)){let o=e.instances.find(u=>u.instanceId===n);if(o===void 0)throw new g(400,`The composition places no instance "${n}".`);if(r.enabled===!1&&o.display.required)throw new g(400,`Section instance "${n}" is required and cannot be hidden.`);if(r.variant===void 0)continue;let l=o.display.variant;if(l===null)throw new g(400,`Section instance "${n}" declares no display variant.`);if(l.locked)throw new g(400,`Section instance "${n}" declares a locked variant, which the user cannot switch.`);if(!l.cases.includes(r.variant))throw new g(400,`"${r.variant}" is not a declared case of section instance "${n}" (declared: ${l.cases.join(", ")}).`)}}function we(e,t){return new Map(e.instances.map(n=>[n.instance_id,t[n.instance_id]?.enabled??n.enabled]))}function xe(e,t,n){let r=n[e.instance_id]?.variant;if(r===void 0||r===e.variant)return e;let o={...e.slots};for(let[l,u]of Object.entries(t))l in o||(u.variant===void 0||u.variant.cases.includes(r))&&(o[l]=u.type==="list"?[]:null);return{...e,variant:r,slots:o}}function Re(e){return Array.isArray(e)?e.length:0}function Se(e){return typeof e=="string"&&e!==""?e:null}function st(e){return{propertyType:Se(e.property_type),listingIntent:Se(e.listing_intent),units:Re(e.units),photos:Re(e.photos)}}function lt(e){let t=JSON.stringify(e),n=3735928559,r=1103547991;for(let o=0;o<t.length;o++){let l=t.charCodeAt(o);n=Math.imul(n^l,2654435761),r=Math.imul(r^l,1597334677)}return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(16).padStart(14,"0")}function ke(e){return{id:e.id,label:e.label,summary:st(e.facts),doc:lt(e.instances),display:_e(e.instances)}}function Ie(e,t){let n=e.replace(/\/+$/,"");return t==="/"?`${n}/`:`${n}${t}/`}function Pe(e){let{pages:t,currentPageId:n,basePath:r}=e,o=t.find(d=>d.id===n);if(!o)throw new Error(`nav: page "${n}" is not one of the declared pages (${t.map(d=>d.id).join(", ")}).`);let l=[o,...t.filter(d=>d.id!==o.id&&d.enabled!==!1)],u={};for(let d of l)for(let a of d.sections)a.enabled===!1||a.key in u||(u[a.key]=d.id===o.id?`#${a.anchor}`:`${Ie(r,d.path)}#${a.anchor}`);return{anchors:u,pages:t.filter(d=>d.enabled!==!1).map(d=>({id:d.id,label:d.label,href:Ie(r,d.path),current:d.id===o.id}))}}function W(e,t){return e.pages?.[t]?.enabled!==!1}function te(e,t){return t.filter(n=>W(e,n.id))}var D={base:"stylesheets/base.css",template:"stylesheets/template.css"},k={frame:"__capture/frame",print:"__capture/print"};function Ee(e){return new URLSearchParams(e).toString()}function ne(e,t,n){return`${k.frame}?${Ee({fixture:e,page:t,format:n})}`}function Te(e,t){return`${k.print}?${Ee({fixture:e,format:t})}`}var ct=["text","number","select","image","list","poi","url","video","tour","document"],dt=[],wn=[...ct,...dt];var ut=["address","type","intent","describe","uploads","units","comparables","contacts"];var pt={address:"always",type:"always",intent:"always",describe:"always",uploads:"always",units:"derived",comparables:"derived",contacts:"derived"},xn=ut.filter(e=>pt[e]==="always");var mt={matterport:{kind:"tour",label:"Matterport",pattern:/(^|\.)matterport\.com$/i,strategy:"api"},biganto:{kind:"tour",label:"Biganto",pattern:/(^|\.)biganto\.com$/i,strategy:"opengraph"},youtube:{kind:"video",label:"YouTube",pattern:/(^|\.)(youtube\.com|youtu\.be)$/i,strategy:"oembed"},vimeo:{kind:"video",label:"Vimeo",pattern:/(^|\.)vimeo\.com$/i,strategy:"oembed"},zillow:{kind:"listing",label:"Zillow",pattern:/(^|\.)zillow\.com$/i,strategy:"none"},redfin:{kind:"listing",label:"Redfin",pattern:/(^|\.)redfin\.com$/i,strategy:"none"},dropbox:{kind:"file",label:"Dropbox",pattern:/(^|\.)dropbox\.com$/i,strategy:"none"},drive:{kind:"file",label:"Google Drive",pattern:/^drive\.google\.com$/i,strategy:"none"},maps:{kind:"map",label:"Google Maps",pattern:/(^|\.)google\.com$/i,path:/^\/maps(\/|$)/i,strategy:"none"}};function $e(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="http:"&&t.protocol!=="https:")return null;for(let[n,r]of Object.entries(mt))if(r.pattern.test(t.hostname)&&!(r.path&&!r.path.test(t.pathname)))return n;return null}var ft="badge=0&autopause=0&player_id=0&title=0&byline=0&portrait=0&sidedock=0&vimeo_logo=0&pip=0&chromecast=0&quality_selector=0&progress_bar=1";function Ce(e){let t=e.trim();if(!t)return null;let n=$e(t);if(n==="vimeo"){let r=t.match(/vimeo\.com\/(?:.*\/)?(\d+)/);return r?`https://player.vimeo.com/video/${r[1]}?${ft}`:null}if(n==="youtube"){let r=t.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)??t.match(/[?&]v=([A-Za-z0-9_-]{11})/)??t.match(/youtube\.com\/(?:embed|shorts)\/([A-Za-z0-9_-]{11})/);return r?`https://www.youtube.com/embed/${r[1]}?rel=0`:null}return null}function Ae(e){let t=e.trim();if(!t)return null;let n=$e(t);if(n==="matterport"){let r=new URL(t).searchParams.get("m");return r!==null&&/^[A-Za-z0-9]+$/.test(r)?`https://my.matterport.com/show/?m=${r}&nt=1`:null}return n==="biganto"?t:null}var V=e=>e<0?0:e>1?1:e;function F(e){if(typeof e!="object"||e===null)return null;let{nx:t=0,ny:n=0,nw:r=1,nh:o=1}=e;if(![t,n,r,o].every(a=>typeof a=="number"&&Number.isFinite(a)))return null;let l=V(t),u=V(n),d={nx:l,ny:u,nw:Math.min(V(r),1-l),nh:Math.min(V(o),1-u)};return d.nw<=0||d.nh<=0||d.nx===0&&d.ny===0&&d.nw===1&&d.nh===1?null:d}var z={file(e){return typeof e=="string"?{url:e,responsive:null}:{url:e.url,responsive:e.responsive}}};function gt(e){if(typeof e!="object"||e===null)return null;let t=e.asset_id;return typeof t=="string"&&t!==""?t:null}function yt(e,t,n){if(e.file===null)return null;let r=n.crop===void 0?null:F(t.rect),o=n.crop===void 0?null:F(t.mobile_rect),l=n.file(e.file),u=r===null?{photo_id:e.id,url:l.url,alt:e.alt,responsive:l.responsive}:{photo_id:e.id,url:n.crop(e.file,r),alt:e.alt,responsive:null,rect:r};return o!==null&&(u.mobile={url:n.crop(e.file,o),responsive:null}),u}function He(e,t){if(e.posterFile!==void 0){let n=t.file(e.posterFile);return n.responsive===null?{poster:n.url}:{poster:n.url,poster_responsive:n.responsive}}return{poster:e.posterUrl??""}}function ht(e,t){let n=He(e,t);return e.file===null?{video_id:e.id,url:Ce(e.url??"")??"",...n,alt:e.alt,source:"link",...e.provider===null?{}:{provider:e.provider}}:{video_id:e.id,url:t.file(e.file).url,...n,alt:e.alt,source:"upload"}}function _t(e,t){return{tour_id:e.id,url:Ae(e.url??"")??"",...He(e,t),alt:e.alt,...e.provider===null?{}:{provider:e.provider}}}function bt(e,t){return e.file===null?null:{asset_id:e.id,url:t.file(e.file).url,filename:e.filename,content_type:e.mime,size_bytes:0}}function vt(e,t,n,r){let o=gt(t),l=o===null?void 0:n.get(o);if(l===void 0||l.kind!==e)return null;switch(e){case"image":return yt(l,t,r);case"video":return ht(l,r);case"tour":return _t(l,r);case"document":return bt(l,r);default:return null}}var wt=new Set(["image","video","tour","document"]),xt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Rt(e,t,n){let r=typeof e.id=="string"?e.id:"",o=typeof e.floor_label=="string"?e.floor_label:null,l=r===""?void 0:t.get(r),u=l?.kind==="image"&&l.file!==null?n.file(l.file):null;return{id:r,...typeof e.upload_id=="string"?{upload_id:e.upload_id}:{},url:u?.url??"",alt:o??"Floor plan",floor_label:o,position:typeof e.position=="number"?e.position:0,...u?.responsive?{responsive:u.responsive}:{}}}function St(e,t,n,r){return e.type==="image"&&Array.isArray(t)?t.filter(xt).map(o=>Rt(o,n,r)):re(e,t,n,r)}function re(e,t,n,r){if(t==null)return t;if(wt.has(e.type))return vt(e.type,t,n,r);if(e.type!=="list"||!Array.isArray(t))return t;let o=t;if(e.fields!==void 0){let l=e.fields;return o.map(u=>{if(typeof u!="object"||u===null)return u;let d={...u};for(let[a,h]of Object.entries(l))d[a]=St(h,d[a],n,r);return d})}if(e.element!==void 0){let l=e.element;return o.map(u=>re(l,u,n,r))}return o}function Ne(e,t,n,r=z){let o={};for(let[l,u]of Object.entries(e.slots)){let d=t.schema.slots[l];o[l]=d===void 0?u:re(d,u,n,r)}return o}function Oe(e){return typeof e=="string"?e:e.url}function kt(e,t){return e.split(",").map(n=>{let[r="",...o]=n.trim().split(/\s+/);return[t(r),...o].join(" ")}).join(", ")}function It(e){return{file(t){let n=z.file(t),r=n.responsive===null?null:{...n.responsive,sources:n.responsive.sources.map(o=>({...o,srcset:kt(o.srcset,e)}))};return{url:e(n.url),responsive:r}},crop(t,n){return e(z.file(t).url,{crop:n})}}}function A(e){return Array.isArray(e)?e:[]}function Me(e,t){let{facts:n}=e,r=a=>e.media[a],o=a=>a?.file===null||a?.file===void 0?"":t(Oe(a.file)),l=a=>a?.posterFile!==void 0?t(Oe(a.posterFile)):a?.posterUrl??"",u=[];for(let a of A(n.photos)){let h=r(a.id);u.push({id:a.id,kind:"photo",name:h?.filename||a.id,size:"",src:o(h),caption:a.caption??null})}for(let a of A(n.floor_plans)){let h=r(a.id);u.push({id:a.id,kind:"plan",name:h?.filename||a.id,size:"",src:o(h)})}for(let a of A(n.videos)){let h=a.provider??void 0;u.push({id:a.id,kind:"video",name:a.caption??r(a.id)?.filename??a.id,size:"",src:l(r(a.id)),caption:a.caption??null,ready:!0,durationMs:a.duration_ms??null,...h===void 0?{}:{provider:h}})}for(let a of A(n.tours))u.push({id:a.id,kind:"tour",name:`${a.provider??"Tour"} ${a.id}`,size:"",src:l(r(a.id)),ready:!0,provider:a.provider??""});for(let a of A(n.documents)){let h=r(a.id)?.sizeBytes;u.push({id:a.id,kind:"document",name:a.filename??a.id,size:"",src:"",mime:a.mime??"",...h===void 0?{}:{sizeBytes:h}})}let d=[["avatar_upload_id","headshot"],["logo_dark_upload_id","logo (dark)"],["logo_light_upload_id","logo (light)"]];for(let a of A(n.contacts)){let h=typeof a.name=="string"?a.name:"Contact";for(let[v,E]of d){let S=a[v];typeof S=="string"&&u.push({id:S,kind:"library",name:`${h} \u2014 ${E}`,size:"",src:o(r(S)),caption:h})}}return u}var Pt={image:["photo_id","asset_id"],video:["video_id","asset_id"],tour:["tour_id","asset_id"],document:["asset_id"]};function Et(e){return e.filter(t=>typeof t=="object"&&t!==null&&!Array.isArray(t)).map(({id:t,upload_id:n,floor_label:r,position:o})=>({id:typeof t=="string"?t:"",...typeof n=="string"?{upload_id:n}:{},floor_label:typeof r=="string"?r:null,position:typeof o=="number"?o:0}))}function oe(e,t){if(t==null)return t;let n=Pt[e.type];if(n!==void 0){if(typeof t!="object")return null;let o=t,l=n.map(a=>o[a]).find(a=>typeof a=="string"&&a!=="");if(typeof l!="string")return null;if(e.type!=="image")return{asset_id:l};let u=F(o.rect),d=typeof o.mobile=="object"&&o.mobile!==null?F(o.mobile.rect):null;return{asset_id:l,...u===null?{}:{rect:u},...d===null?{}:{mobile_rect:d}}}if(e.type!=="list"||!Array.isArray(t))return t;let r=t;if(e.fields!==void 0){let o=e.fields;return r.map(l=>{if(typeof l!="object"||l===null)return l;let u={...l};for(let[d,a]of Object.entries(o))d in u&&(u[d]=a.type==="image"&&Array.isArray(u[d])?Et(u[d]):oe(a,u[d]));return u})}if(e.element!==void 0){let o=e.element;return r.map(l=>oe(o,l))}return r}function De(e){let{instance:t,slots:n,fixture:r,session:o,assetUrl:l}=e,u={...t.slots},d={},a=r.provenance[t.instance_id]??{};for(let v of Object.keys(n))d[v]=a[v]??{kind:"empty"};for(let[v,E]of Object.entries(o??{})){let S=n[v];S!==void 0&&(u[v]=oe(S,E),d[v]={kind:"session"})}let h=new Map(Object.entries(r.media));return{slots:Ne({...t,slots:u},{schema:{slots:n}},h,It(l)),provenance:d}}var Fe=1024*1024;function $t(e){let t=N(e),n=typeof e.width=="string"?`${e.width} \xD7 ${String(e.height)}`:void 0;return{id:e.id,label:e.label,cssWidth:t.viewportWidth,cssHeight:t.viewportHeight,bleed:t.bleed,pixelWidth:t.pixelWidth,pixelHeight:t.pixelHeight,...n===void 0?{}:{physical:n},tokens:{...O(e)}}}function Ct(e,t){return new Response(t,{status:e,headers:{"content-type":"text/plain; charset=utf-8"}})}function ie(e){return new Response(JSON.stringify(e),{headers:{"content-type":"application/json; charset=utf-8"}})}function ae(e){return new Response(e,{headers:{"content-type":"text/html; charset=utf-8"}})}function At(e){if(typeof e!="object"||e===null)return null;let t=e.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<600?t:null}function U(e,t,n){let r=e.searchParams.get(t);if(r===null||r==="")throw new g(400,`${n} needs a ${t} parameter.`);return r}function Ht(e){return`<script>
|
|
116
|
+
</script>`;function _e(){let e={};return new Proxy(e,{get:(t,n)=>typeof n!="string"||n in e||n==="then"||n==="toJSON"?e[n]:`#${n}`})}function be(e){let t=new URLSearchParams;for(let[r,o]of Object.entries(e))o!=null&&o!==""&&t.set(r,o);let n=t.toString();return n===""?"":`?${n}`}var T={catalog:"api/catalog",render:"api/render",media:e=>`api/media${be({fixture:e})}`,capture:(e,t)=>`api/capture/${e}${be({fixture:t.fixture,format:t.format,page:t.page,canvas:t.canvas})}`,live:(e,t)=>`fixtures/${encodeURIComponent(e)}/live${t==="/"?"/":`${t}/`}`,hmr:"__hmr"};var g=class extends Error{constructor(n,r){super(r);this.status=n}status};function ut(e){return e.split("-").map(t=>t&&t[0].toUpperCase()+t.slice(1)).join(" ")}function ve(e){let{variant:t}=e;return{required:e.required,variant:t===null?null:{cases:t.cases.map(n=>({value:n,label:ut(n)})),locked:t.locked}}}function we(e){return Object.fromEntries(e.map(t=>[t.instance_id,{enabled:t.enabled,...t.variant===void 0?{}:{variant:t.variant}}]))}function xe(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new g(400,"A render request's display is an object keyed by instance id.");let t={};for(let[n,r]of Object.entries(e)){if(typeof r!="object"||r===null||Array.isArray(r))throw new g(400,`The display state of "${n}" is not an object.`);let{enabled:o,variant:s}=r;if(o!==void 0&&typeof o!="boolean")throw new g(400,`The display state of "${n}" has a non-boolean enabled.`);if(s!==void 0&&typeof s!="string")throw new g(400,`The display state of "${n}" has a non-string variant.`);t[n]={...o===void 0?{}:{enabled:o},...s===void 0?{}:{variant:s}}}return t}function Re(e,t){for(let[n,r]of Object.entries(t)){let o=e.instances.find(u=>u.instanceId===n);if(o===void 0)throw new g(400,`The composition places no instance "${n}".`);if(r.enabled===!1&&o.display.required)throw new g(400,`Section instance "${n}" is required and cannot be hidden.`);if(r.variant===void 0)continue;let s=o.display.variant;if(s===null)throw new g(400,`Section instance "${n}" declares no display variant.`);if(s.locked)throw new g(400,`Section instance "${n}" declares a locked variant, which the user cannot switch.`);if(!s.cases.includes(r.variant))throw new g(400,`"${r.variant}" is not a declared case of section instance "${n}" (declared: ${s.cases.join(", ")}).`)}}function Se(e,t){return new Map(e.instances.map(n=>[n.instance_id,t[n.instance_id]?.enabled??n.enabled]))}function ke(e,t,n){let r=n[e.instance_id]?.variant;if(r===void 0||r===e.variant)return e;let o={...e.slots};for(let[s,u]of Object.entries(t))s in o||(u.variant===void 0||u.variant.cases.includes(r))&&(o[s]=u.type==="list"?[]:null);return{...e,variant:r,slots:o}}function Ie(e){return Array.isArray(e)?e.length:0}function Ee(e){return typeof e=="string"&&e!==""?e:null}function pt(e){return{propertyType:Ee(e.property_type),listingIntent:Ee(e.listing_intent),units:Ie(e.units),photos:Ie(e.photos)}}function mt(e){let t=JSON.stringify(e),n=3735928559,r=1103547991;for(let o=0;o<t.length;o++){let s=t.charCodeAt(o);n=Math.imul(n^s,2654435761),r=Math.imul(r^s,1597334677)}return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(16).padStart(14,"0")}function Pe(e){return{id:e.id,label:e.label,summary:pt(e.facts),doc:mt(e.instances),display:we(e.instances)}}function Te(e,t){let n=e.replace(/\/+$/,"");return t==="/"?`${n}/`:`${n}${t}/`}function Ce(e){let{pages:t,currentPageId:n,basePath:r}=e,o=t.find(d=>d.id===n);if(!o)throw new Error(`nav: page "${n}" is not one of the declared pages (${t.map(d=>d.id).join(", ")}).`);let s=[o,...t.filter(d=>d.id!==o.id&&d.enabled!==!1)],u={};for(let d of s)for(let a of d.sections)a.enabled===!1||a.key in u||(u[a.key]=d.id===o.id?`#${a.anchor}`:`${Te(r,d.path)}#${a.anchor}`);return{anchors:u,pages:t.filter(d=>d.enabled!==!1).map(d=>({id:d.id,label:d.label,href:Te(r,d.path),current:d.id===o.id}))}}function W(e,t){return e.pages?.[t]?.enabled!==!1}function te(e,t){return t.filter(n=>W(e,n.id))}var D={base:"stylesheets/base.css",template:"stylesheets/template.css"},k={frame:"__capture/frame",print:"__capture/print"};function $e(e){return new URLSearchParams(e).toString()}function ne(e,t,n){return`${k.frame}?${$e({fixture:e,page:t,format:n})}`}function Ae(e,t){return`${k.print}?${$e({fixture:e,format:t})}`}var ft=["text","number","select","image","list","poi","url","video","tour","document"],gt=[],Tn=[...ft,...gt];var yt=["address","type","intent","describe","uploads","units","comparables","contacts"];var ht={address:"always",type:"always",intent:"always",describe:"always",uploads:"always",units:"derived",comparables:"derived",contacts:"derived"},Cn=yt.filter(e=>ht[e]==="always");var _t={matterport:{kind:"tour",label:"Matterport",pattern:/(^|\.)matterport\.com$/i,strategy:"api"},biganto:{kind:"tour",label:"Biganto",pattern:/(^|\.)biganto\.com$/i,strategy:"opengraph"},youtube:{kind:"video",label:"YouTube",pattern:/(^|\.)(youtube\.com|youtu\.be)$/i,strategy:"oembed"},vimeo:{kind:"video",label:"Vimeo",pattern:/(^|\.)vimeo\.com$/i,strategy:"oembed"},zillow:{kind:"listing",label:"Zillow",pattern:/(^|\.)zillow\.com$/i,strategy:"none"},redfin:{kind:"listing",label:"Redfin",pattern:/(^|\.)redfin\.com$/i,strategy:"none"},dropbox:{kind:"file",label:"Dropbox",pattern:/(^|\.)dropbox\.com$/i,strategy:"none"},drive:{kind:"file",label:"Google Drive",pattern:/^drive\.google\.com$/i,strategy:"none"},maps:{kind:"map",label:"Google Maps",pattern:/(^|\.)google\.com$/i,path:/^\/maps(\/|$)/i,strategy:"none"}};function He(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="http:"&&t.protocol!=="https:")return null;for(let[n,r]of Object.entries(_t))if(r.pattern.test(t.hostname)&&!(r.path&&!r.path.test(t.pathname)))return n;return null}var bt="badge=0&autopause=0&player_id=0&title=0&byline=0&portrait=0&sidedock=0&vimeo_logo=0&pip=0&chromecast=0&quality_selector=0&progress_bar=1";function Oe(e){let t=e.trim();if(!t)return null;let n=He(t);if(n==="vimeo"){let r=t.match(/vimeo\.com\/(?:.*\/)?(\d+)/);return r?`https://player.vimeo.com/video/${r[1]}?${bt}`:null}if(n==="youtube"){let r=t.match(/youtu\.be\/([A-Za-z0-9_-]{11})/)??t.match(/[?&]v=([A-Za-z0-9_-]{11})/)??t.match(/youtube\.com\/(?:embed|shorts)\/([A-Za-z0-9_-]{11})/);return r?`https://www.youtube.com/embed/${r[1]}?rel=0`:null}return null}function Ne(e){let t=e.trim();if(!t)return null;let n=He(t);if(n==="matterport"){let r=new URL(t).searchParams.get("m");return r!==null&&/^[A-Za-z0-9]+$/.test(r)?`https://my.matterport.com/show/?m=${r}&nt=1`:null}return n==="biganto"?t:null}var V=e=>e<0?0:e>1?1:e;function F(e){if(typeof e!="object"||e===null)return null;let{nx:t=0,ny:n=0,nw:r=1,nh:o=1}=e;if(![t,n,r,o].every(a=>typeof a=="number"&&Number.isFinite(a)))return null;let s=V(t),u=V(n),d={nx:s,ny:u,nw:Math.min(V(r),1-s),nh:Math.min(V(o),1-u)};return d.nw<=0||d.nh<=0||d.nx===0&&d.ny===0&&d.nw===1&&d.nh===1?null:d}var G={file(e){return typeof e=="string"?{url:e,responsive:null}:{url:e.url,responsive:e.responsive}}};function vt(e){if(typeof e!="object"||e===null)return null;let t=e.asset_id;return typeof t=="string"&&t!==""?t:null}function wt(e,t,n){if(e.file===null)return null;let r=n.crop===void 0?null:F(t.rect),o=n.crop===void 0?null:F(t.mobile_rect),s=n.file(e.file),u=r===null?{photo_id:e.id,url:s.url,alt:e.alt,responsive:s.responsive}:{photo_id:e.id,url:n.crop(e.file,r),alt:e.alt,responsive:null,rect:r};return o!==null&&(u.mobile={url:n.crop(e.file,o),responsive:null}),u}function Me(e,t){if(e.posterFile!==void 0){let n=t.file(e.posterFile);return n.responsive===null?{poster:n.url}:{poster:n.url,poster_responsive:n.responsive}}return{poster:e.posterUrl??""}}function xt(e,t){let n=Me(e,t);return e.file===null?{video_id:e.id,url:Oe(e.url??"")??"",...n,alt:e.alt,source:"link",...e.provider===null?{}:{provider:e.provider}}:{video_id:e.id,url:t.file(e.file).url,...n,alt:e.alt,source:"upload"}}function Rt(e,t){return{tour_id:e.id,url:Ne(e.url??"")??"",...Me(e,t),alt:e.alt,...e.provider===null?{}:{provider:e.provider}}}function St(e,t){return e.file===null?null:{asset_id:e.id,url:t.file(e.file).url,filename:e.filename,content_type:e.mime,size_bytes:0}}function kt(e,t,n,r){let o=vt(t),s=o===null?void 0:n.get(o);if(s===void 0||s.kind!==e)return null;switch(e){case"image":return wt(s,t,r);case"video":return xt(s,r);case"tour":return Rt(s,r);case"document":return St(s,r);default:return null}}var It=new Set(["image","video","tour","document"]),Et=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Pt(e,t,n){let r=typeof e.id=="string"?e.id:"",o=typeof e.floor_label=="string"?e.floor_label:null,s=r===""?void 0:t.get(r),u=s?.kind==="image"&&s.file!==null?n.file(s.file):null;return{id:r,...typeof e.upload_id=="string"?{upload_id:e.upload_id}:{},url:u?.url??"",alt:o??"Floor plan",floor_label:o,position:typeof e.position=="number"?e.position:0,...u?.responsive?{responsive:u.responsive}:{}}}function Tt(e,t,n,r){return e.type==="image"&&Array.isArray(t)?t.filter(Et).map(o=>Pt(o,n,r)):re(e,t,n,r)}function re(e,t,n,r){if(t==null)return t;if(It.has(e.type))return kt(e.type,t,n,r);if(e.type!=="list"||!Array.isArray(t))return t;let o=t;if(e.fields!==void 0){let s=e.fields;return o.map(u=>{if(typeof u!="object"||u===null)return u;let d={...u};for(let[a,h]of Object.entries(s))d[a]=Tt(h,d[a],n,r);return d})}if(e.element!==void 0){let s=e.element;return o.map(u=>re(s,u,n,r))}return o}function De(e,t,n,r=G){let o={};for(let[s,u]of Object.entries(e.slots)){let d=t.schema.slots[s];o[s]=d===void 0?u:re(d,u,n,r)}return o}function Fe(e){return typeof e=="string"?e:e.url}function Ct(e,t){return e.split(",").map(n=>{let[r="",...o]=n.trim().split(/\s+/);return[t(r),...o].join(" ")}).join(", ")}function $t(e){return{file(t){let n=G.file(t),r=n.responsive===null?null:{...n.responsive,sources:n.responsive.sources.map(o=>({...o,srcset:Ct(o.srcset,e)}))};return{url:e(n.url),responsive:r}},crop(t,n){return e(G.file(t).url,{crop:n})}}}function A(e){return Array.isArray(e)?e:[]}function Ue(e,t){let{facts:n}=e,r=a=>e.media[a],o=a=>a?.file===null||a?.file===void 0?"":t(Fe(a.file)),s=a=>a?.posterFile!==void 0?t(Fe(a.posterFile)):a?.posterUrl??"",u=[];for(let a of A(n.photos)){let h=r(a.id);u.push({id:a.id,kind:"photo",name:h?.filename||a.id,size:"",src:o(h),caption:a.caption??null})}for(let a of A(n.floor_plans)){let h=r(a.id);u.push({id:a.id,kind:"plan",name:h?.filename||a.id,size:"",src:o(h)})}for(let a of A(n.videos)){let h=a.provider??void 0;u.push({id:a.id,kind:"video",name:a.caption??r(a.id)?.filename??a.id,size:"",src:s(r(a.id)),caption:a.caption??null,ready:!0,durationMs:a.duration_ms??null,...h===void 0?{}:{provider:h}})}for(let a of A(n.tours))u.push({id:a.id,kind:"tour",name:`${a.provider??"Tour"} ${a.id}`,size:"",src:s(r(a.id)),ready:!0,provider:a.provider??""});for(let a of A(n.documents)){let h=r(a.id)?.sizeBytes;u.push({id:a.id,kind:"document",name:a.filename??a.id,size:"",src:"",mime:a.mime??"",...h===void 0?{}:{sizeBytes:h}})}let d=[["avatar_upload_id","headshot"],["logo_dark_upload_id","logo (dark)"],["logo_light_upload_id","logo (light)"]];for(let a of A(n.contacts)){let h=typeof a.name=="string"?a.name:"Contact";for(let[v,P]of d){let S=a[v];typeof S=="string"&&u.push({id:S,kind:"library",name:`${h} \u2014 ${P}`,size:"",src:o(r(S)),caption:h})}}return u}var At={image:["photo_id","asset_id"],video:["video_id","asset_id"],tour:["tour_id","asset_id"],document:["asset_id"]};function Ht(e){return e.filter(t=>typeof t=="object"&&t!==null&&!Array.isArray(t)).map(({id:t,upload_id:n,floor_label:r,position:o})=>({id:typeof t=="string"?t:"",...typeof n=="string"?{upload_id:n}:{},floor_label:typeof r=="string"?r:null,position:typeof o=="number"?o:0}))}function oe(e,t){if(t==null)return t;let n=At[e.type];if(n!==void 0){if(typeof t!="object")return null;let o=t,s=n.map(a=>o[a]).find(a=>typeof a=="string"&&a!=="");if(typeof s!="string")return null;if(e.type!=="image")return{asset_id:s};let u=F(o.rect),d=typeof o.mobile=="object"&&o.mobile!==null?F(o.mobile.rect):null;return{asset_id:s,...u===null?{}:{rect:u},...d===null?{}:{mobile_rect:d}}}if(e.type!=="list"||!Array.isArray(t))return t;let r=t;if(e.fields!==void 0){let o=e.fields;return r.map(s=>{if(typeof s!="object"||s===null)return s;let u={...s};for(let[d,a]of Object.entries(o))d in u&&(u[d]=a.type==="image"&&Array.isArray(u[d])?Ht(u[d]):oe(a,u[d]));return u})}if(e.element!==void 0){let o=e.element;return r.map(s=>oe(o,s))}return r}function Le(e){let{instance:t,slots:n,fixture:r,session:o,assetUrl:s}=e,u={...t.slots},d={},a=r.provenance[t.instance_id]??{};for(let v of Object.keys(n))d[v]=a[v]??{kind:"empty"};for(let[v,P]of Object.entries(o??{})){let S=n[v];S!==void 0&&(u[v]=oe(S,P),d[v]={kind:"session"})}let h=new Map(Object.entries(r.media));return{slots:De({...t,slots:u},{schema:{slots:n}},h,$t(s)),provenance:d}}var je=1024*1024;function Nt(e){let t=O(e),n=typeof e.width=="string"?`${e.width} \xD7 ${String(e.height)}`:void 0;return{id:e.id,label:e.label,cssWidth:t.viewportWidth,cssHeight:t.viewportHeight,bleed:t.bleed,pixelWidth:t.pixelWidth,pixelHeight:t.pixelHeight,...n===void 0?{}:{physical:n},tokens:{...N(e)}}}function Mt(e,t){return new Response(t,{status:e,headers:{"content-type":"text/plain; charset=utf-8"}})}function ie(e){return new Response(JSON.stringify(e),{headers:{"content-type":"application/json; charset=utf-8"}})}function ae(e){return new Response(e,{headers:{"content-type":"text/html; charset=utf-8"}})}function Dt(e){if(typeof e!="object"||e===null)return null;let t=e.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<600?t:null}function U(e,t,n){let r=e.searchParams.get(t);if(r===null||r==="")throw new g(400,`${n} needs a ${t} parameter.`);return r}function Ft(e){return`<script>
|
|
117
117
|
(function () {
|
|
118
118
|
try {
|
|
119
119
|
var src = new EventSource(${JSON.stringify(e)});
|
|
@@ -122,6 +122,6 @@ ${e.body}
|
|
|
122
122
|
});
|
|
123
123
|
} catch (e) { /* no change channel; the page stays as it is */ }
|
|
124
124
|
})();
|
|
125
|
-
</script>`}function
|
|
126
|
-
${c.problems}`:void 0;return{...
|
|
127
|
-
`)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${i.name} - ${c.label}`,extraCss:["html, body { background: #fff; }"],...t.live?{devScripts:[
|
|
125
|
+
</script>`}function Ut(e){if(e===T.catalog||e==="api/media"||e.startsWith("api/capture/")||e===k.frame||e===k.print)return!0;let[t,n,r]=e.split("/").filter(Boolean);return t==="fixtures"&&n!==void 0&&r==="live"}function Bn(e){let{reader:t,assetUrl:n,renderer:r}=e,o=(e.base??"/").endsWith("/")?e.base??"/":`${e.base??"/"}/`,s=p=>/^([a-z][a-z0-9+.-]*:|\/)/i.test(p)?p:`${o}${p}`,u=()=>[D.base,D.template].map(p=>s(n(p)));async function d(p){let{fixtures:l}=await t.fixtures(),i=l.find(c=>c.id===p);if(i===void 0){let c=l.map(f=>f.id).join(", ")||"none";throw new g(404,`There is no fixture "${p}" (have: ${c}).`)}return i}function a(p,l){let i=p.instances.find(c=>c.instance_id===l);if(i===void 0)throw new g(400,`The composition places no instance "${l}".`);return i}function h(p,l,i,c,f){if(p.output!=="website")return{selfAnchor:c,anchors:_e(),pages:[]};let m=Se(l,f),_=p.pages.map(R=>({id:R.id,label:R.label,path:R.path??`/${R.id}`,sections:R.sections.map(I=>({key:I.section,anchor:I.section,enabled:m.get(I.instanceId)!==!1}))})),b=`${o}${T.live(l.id,"/").replace(/\/$/,"")}`,w=Ce({pages:_,currentPageId:i,basePath:b});return{selfAnchor:c,anchors:w.anchors,pages:w.pages}}async function v(p,l,i,c,f,m){let _=p.instances.find(Y=>Y.instanceId===c.instance_id);if(_===void 0)throw new Error(`The composition places no section "${c.section_key}".`);let b=ke(c,_.sectionSchema.slots,m),{slots:w,provenance:R}=Le({instance:b,slots:_.sectionSchema.slots,fixture:l,session:f,assetUrl:n}),I=h(p,l,i,b.section_key,m),x=b.variant,H=await r.section(b.section_key);return{html:r.renderToString(r.createElement(H,{slots:w,nav:I,variant:x??""}),{identifierPrefix:b.instance_id}),resolvedProps:{slots:w,nav:I,variant:x},provenance:R}}async function P(p,l,i){let c=[];for(let f of i.sections){let m=a(l,f.instanceId);m.enabled&&c.push((await v(p,l,i.id,m,void 0,{})).html)}return c}function S(p,l,i){let c=p.pages.find(f=>f.id===l);if(c===void 0)throw new g(i,`The template declares no page "${l}".`);return c}function z(p,l){if(p.output==="website")throw new g(404,`"${p.key}" is a website \u2014 captures are for rendered templates; open its pages live instead.`);let i=l===null?p.formats[0]:p.formats.find(c=>c.id===l);if(i===void 0)throw new g(404,`The template declares no format "${l??""}" (have: ${p.formats.map(c=>c.id).join(", ")}).`);return i}async function qe(){let p=await t.islands(),l={wire:1,islands:{map:{...p.map},hostScript:p.canvasHost,importMap:{...p.importMap}},stylesheets:[D.base,D.template].map(m=>n(m))},i,c;try{i=await t.template(),c=await t.fixtures()}catch(m){return{...l,template:{key:"",name:"",output:"website",formats:[],pages:[],canvases:[],instances:[]},fixtures:[],capabilities:{hmr:t.live,capture:!1},error:m instanceof Error?m.message:String(m)}}let f=c.problems!==void 0&&c.fixtures.length===0?`No fixture could be rendered:
|
|
126
|
+
${c.problems}`:void 0;return{...l,template:{key:i.key,name:i.name,output:i.output,formats:i.output==="website"?[]:i.formats.map(Nt),pages:i.pages.map(m=>({id:m.id,label:m.label,...m.path===void 0?{}:{path:m.path},instanceIds:m.sections.map(_=>_.instanceId)})),canvases:i.canvases.map(m=>({id:m.id,label:m.label,pages:[...m.pages]})),instances:i.instances.map(m=>({...m,display:ve(m.display)}))},fixtures:c.fixtures.map(Pe),capabilities:{hmr:t.live,capture:i.output!=="website"&&t.capture!==void 0},...f===void 0?{}:{error:f}}}async function We(p){if(p.method!=="POST")throw new g(405,`POST a render request to ${T.render}.`);let l=await p.text();if(new TextEncoder().encode(l).byteLength>je)throw new g(413,`request body exceeds ${je} bytes`);let i;try{i=l===""?void 0:JSON.parse(l)}catch(w){throw new g(400,`request body is not JSON: ${w instanceof Error?w.message:String(w)}`)}if(i===void 0||typeof i.page!="string"||typeof i.instance!="string"||typeof i.fixture!="string")throw new g(400,"A render request names a page, an instance and a fixture.");let c=typeof i.session=="object"&&i.session!==null?i.session:{},f=xe(i.display),m=await t.template(),_=await d(i.fixture),b=S(m,i.page,400);return Re(m,f),v(m,_,b.id,a(_,i.instance),c.slots,f)}async function Ve(p){let l=await d(U(p,"fixture","api/media"));return{items:Ue(l,n)}}async function Ge(p,l){let i=await t.template();if(i.output!=="website")throw new g(404,`"${i.key}" is a rendered ${i.output} template and has no live pages \u2014 preview it on the canvas.`);let c=i.pages.find(_=>_.path===l);if(c===void 0){let _=i.pages.map(b=>b.path??b.id).join(", ");throw new g(404,`The template declares no page at "${l}" (have: ${_}).`)}let f=await d(p),m=await P(i,f,c);return $({destination:"preview",root:{kind:"plain",bodyHtml:m.join(`
|
|
127
|
+
`)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${i.name} - ${c.label}`,extraCss:["html, body { background: #fff; }"],...t.live?{devScripts:[Ft(`${o}${T.hmr}`)]}:{}})}function se(p,l,i){let c=S(p,i,404);if(!W(l,c.id))throw new g(404,`The fixture "${l.id}" switches the page "${c.id}" off, so it has no capture.`);return c}async function ze(p){let l=k.frame,i=await t.template(),c=z(i,p.searchParams.get("format")),f=await d(U(p,"fixture",l)),m=se(i,f,U(p,"page",l));return $({destination:"artifact",root:{kind:"frame",format:c,sectionHtml:await P(i,f,m)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${i.name} \u2014 ${m.id}`})}async function Be(p){let l=await t.template(),i=z(l,p.searchParams.get("format"));if(l.output!=="document")throw new g(404,`"${l.key}" is an ${l.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);let c=await d(U(p,"fixture",k.print)),f=[];for(let m of te(c,l.pages))f.push(await P(l,c,m));if(f.length===0)throw new g(404,`The fixture "${c.id}" switches every page off, so it has no PDF.`);return $({destination:"artifact",root:{kind:"frameStack",format:i,pages:f},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${l.name} \u2014 print`})}async function Ye(p,l){let i=p;if(i!=="screenshot"&&i!=="bundle"&&i!=="print")throw new g(404,`There is no capture at ${l.pathname}.`);let c=U(l,"fixture",`api/capture/${i}`),f=await t.template(),m=z(f,l.searchParams.get("format")),_=await d(c),b,w,R;if(i==="screenshot"){let x=l.searchParams.get("page")??te(_,f.pages)[0]?.id;if(x===void 0)throw new g(404,`The fixture "${c}" leaves no page on.`);se(f,_,x),b={kind:i,fixture:c,format:m,documents:[{path:ne(c,x,m.id),page:x,name:`${x}.png`}]},w="image/png",R=`${f.key}-${x}-${m.id}.png`}else if(i==="bundle"){if(f.output!=="image")throw new g(404,`"${f.key}" is a ${f.output} template \u2014 the zip is for the image class; a document downloads its PDF.`);let x=l.searchParams.get("canvas"),H=x===null?f.canvases[0]:f.canvases.find(E=>E.id===x);if(H===void 0)throw new g(404,`The template declares no canvas "${x??""}".`);let B=H.pages.filter(E=>W(_,E));if(B.length===0)throw new g(404,`The fixture "${c}" switches every page of the canvas "${H.id}" off, so it has no zip.`);let Y=B.map(E=>({path:ne(c,E,m.id),page:E,name:`${f.pages.find(Je=>Je.id===E)?.label||E}.png`}));b={kind:i,fixture:c,format:m,documents:Y},w="application/zip",R=`${f.key}-${m.id}.zip`}else{if(f.output!=="document")throw new g(404,`"${f.key}" is an ${f.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);b={kind:i,fixture:c,format:m,documents:[{path:Ae(c,m.id),page:null,name:`${f.key}.pdf`}]},w="application/pdf",R=`${f.key}.pdf`}if(t.capture===void 0)throw new g(501,"This playground has no captures to give.");let I=await t.capture(b);return new Response(new Uint8Array(I),{headers:{"content-type":w,"content-disposition":`attachment; filename="${encodeURIComponent(R)}"`}})}async function Xe(p,l,i){if(i===T.render)return ie(await We(p));if(p.method!=="GET"&&p.method!=="HEAD"&&Ut(i))throw new g(405,`${i} only reads; the playground accepts no uploads and writes nothing.`);if(i===T.catalog)return ie(await qe());if(i==="api/media")return ie(await Ve(l));if(i.startsWith("api/capture/"))return Ye(i.slice(12),l);if(i===k.frame)return ae(await ze(l));if(i===k.print)return ae(await Be(l));let[c,f,m,_,...b]=i.split("/").filter(Boolean);if(c==="fixtures"&&f!==void 0&&m==="live"){if(b.length>0)throw new g(404,`There is no route at ${l.pathname}.`);return ae(await Ge(decodeURIComponent(f),_===void 0?"/":`/${decodeURIComponent(_)}`))}return null}return{async handle(p){let l=new URL(p.url);if(!l.pathname.startsWith(o)&&`${l.pathname}/`!==o)return null;let i=l.pathname.slice(o.length);try{return await Xe(p,l,i)}catch(c){let f=Dt(c);if(f===null)throw c;return Mt(f,c instanceof Error?c.message:String(c))}}}}export{Bn as createHost};
|
package/dist/base.css
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/* @homepages/concrete — the base stylesheet every template's page loads.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Not an `exports` subpath: the build copies these bytes into the artifact as a
|
|
6
|
+
* page-level asset (`src/cli/build/static.ts`). It is NOT part of the Tailwind
|
|
6
7
|
* entry (that is styles.css); it ships as its own stylesheet on the page.
|
|
7
8
|
*
|
|
8
9
|
* Contains:
|
|
@@ -21,14 +22,22 @@
|
|
|
21
22
|
* shipped defects to live customers twice before anyone went looking. The
|
|
22
23
|
* layers are gone; `check` refuses author CSS that declares them.
|
|
23
24
|
* - The three reset gaps Tailwind's preflight leaves (below)
|
|
24
|
-
* - The section box model (.
|
|
25
|
-
* - The frame shell's static half (.
|
|
25
|
+
* - The section box model (.concrete-section, emitted by the <Section> primitive)
|
|
26
|
+
* - The frame shell's static half (.concrete-frame, emitted by the <FrameShell> primitive)
|
|
26
27
|
* and the window witness that holds every host to the geometry it owes that shell
|
|
27
|
-
* - The <Image>/<Video>/<Tour> box's geometry default (.
|
|
28
|
+
* - The <Image>/<Video>/<Tour> box's geometry default (.concrete-image-block), layered so
|
|
28
29
|
* an author's own width utility beats it
|
|
29
|
-
* - The <Image>/<Video> frame's placeholder fill (.
|
|
30
|
+
* - The <Image>/<Video> frame's placeholder fill (.concrete-image-frame)
|
|
30
31
|
* - Universal tokens: motion
|
|
31
32
|
*
|
|
33
|
+
* EVERY NAME THIS FILE OWNS SPELLS `concrete-`, token and class alike, so a template
|
|
34
|
+
* author reading `.concrete-section` or `var(--concrete-window-h)` knows whose it is
|
|
35
|
+
* without a comment. `--concrete-image-frame-bg` is the one token here a template sets;
|
|
36
|
+
* every other `--concrete-*` is declared here and only read. `.concrete-frame` spells
|
|
37
|
+
* the namespace too but is the FRAME CONTRACT's class rather than this file's: it is
|
|
38
|
+
* derived once, in `@homepages/format-geometry`, and stamped by every capture surface,
|
|
39
|
+
* so this file styles it and never names it.
|
|
40
|
+
*
|
|
32
41
|
* REQUIRES A TAILWIND ENTRY ON THE PAGE. Your entry's `@import "tailwindcss"` brings
|
|
33
42
|
* Tailwind's preflight, and preflight does the reset: box-sizing, margin/padding,
|
|
34
43
|
* list-style, the button and anchor resets, display:block on replaced elements. This
|
|
@@ -80,15 +89,28 @@
|
|
|
80
89
|
* the contract that lets adjacent sections butt edge-to-edge, so a page composes as
|
|
81
90
|
* a vertical stack with no framework-injected whitespace; padding is the author's —
|
|
82
91
|
* on this root or a child, the background still paints edge-to-edge under it. */
|
|
83
|
-
.
|
|
92
|
+
.concrete-section {
|
|
84
93
|
display: block;
|
|
85
94
|
width: 100%;
|
|
86
95
|
padding: 0;
|
|
87
96
|
margin: 0;
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
/* The frame shell's static half, emitted by the <FrameShell> primitive.
|
|
91
|
-
*
|
|
99
|
+
/* The frame shell's static half, emitted by the <FrameShell> primitive.
|
|
100
|
+
*
|
|
101
|
+
* `.concrete-frame` spells this file's namespace but is not this file's to name: it
|
|
102
|
+
* is FRAME_ROOT_CLASS, derived once in `@homepages/format-geometry` and stamped by
|
|
103
|
+
* every capture surface — the published page shell, the render worker, the editing
|
|
104
|
+
* canvas and <FrameShell>. This file only styles it, so a change to the spelling
|
|
105
|
+
* belongs at that derivation point and nowhere else. The private custom properties
|
|
106
|
+
* and counters below ARE concrete's.
|
|
107
|
+
*
|
|
108
|
+
* `.tr-frame` is its pre-4.0.0 spelling, styled alongside for a transition window
|
|
109
|
+
* only: a template built on this version can be captured by a platform that still
|
|
110
|
+
* stamps the old class. `:is()` keeps the specificity of a single class. It goes
|
|
111
|
+
* when every capture surface stamps the new class alone.
|
|
112
|
+
*
|
|
113
|
+
* The frame is a viewport: every host owes a frame document a window that is exactly the
|
|
92
114
|
* format's BLEED box, and the root fills it — viewport units and geometry @media in
|
|
93
115
|
* sections read the window and get frame geometry by construction. No size
|
|
94
116
|
* container here: containers inside sections are ordinary component styling. The
|
|
@@ -99,7 +121,7 @@
|
|
|
99
121
|
* against a box identical to the one it would otherwise use (the root fills the
|
|
100
122
|
* window exactly), so it moves no author content; what it buys is a stacked print
|
|
101
123
|
* document, where each shell then anchors its own witness on its own sheet. */
|
|
102
|
-
.tr-frame {
|
|
124
|
+
:is(.concrete-frame, .tr-frame) {
|
|
103
125
|
position: relative;
|
|
104
126
|
width: 100vw;
|
|
105
127
|
height: 100vh;
|
|
@@ -109,22 +131,22 @@
|
|
|
109
131
|
|
|
110
132
|
/* The window the host owes this document: the bleed box, i.e. the trim box
|
|
111
133
|
* extended symmetrically by the bleed. */
|
|
112
|
-
--
|
|
113
|
-
--
|
|
134
|
+
--concrete-frame-window-w: calc(var(--frame-w) + 2 * var(--frame-bleed));
|
|
135
|
+
--concrete-frame-window-h: calc(var(--frame-h) + 2 * var(--frame-bleed));
|
|
114
136
|
|
|
115
137
|
/* 1 when the real window misses the owed one on either axis, 0 when it does not.
|
|
116
138
|
* max(d, -d) is an absolute difference and `/ 1px` makes it a plain number. The
|
|
117
139
|
* -1 is the tolerance: a browser window is whole CSS px while a physical format's
|
|
118
140
|
* box is fractional, so a capturer rounds and is right to. Multiplying past the
|
|
119
141
|
* tolerance saturates the clamp, so the witness is on or off, never faded. */
|
|
120
|
-
--
|
|
142
|
+
--concrete-frame-window-mismatch: clamp(
|
|
121
143
|
0,
|
|
122
144
|
(
|
|
123
145
|
max(
|
|
124
|
-
(100vw - var(--
|
|
125
|
-
(var(--
|
|
126
|
-
(100vh - var(--
|
|
127
|
-
(var(--
|
|
146
|
+
(100vw - var(--concrete-frame-window-w)) / 1px,
|
|
147
|
+
(var(--concrete-frame-window-w) - 100vw) / 1px,
|
|
148
|
+
(100vh - var(--concrete-frame-window-h)) / 1px,
|
|
149
|
+
(var(--concrete-frame-window-h) - 100vh) / 1px
|
|
128
150
|
) - 1
|
|
129
151
|
) * 10000,
|
|
130
152
|
1
|
|
@@ -142,15 +164,15 @@
|
|
|
142
164
|
* pixels and identical layout to one with no witness at all. On a mismatch it covers
|
|
143
165
|
* the artifact and names both geometries, because a frame measured against the wrong
|
|
144
166
|
* box is not a preview of anything and must not read as one. */
|
|
145
|
-
.tr-frame::after {
|
|
167
|
+
:is(.concrete-frame, .tr-frame)::after {
|
|
146
168
|
counter-reset:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
169
|
+
concrete-frame-owed-w calc(var(--concrete-frame-window-w) / 1px)
|
|
170
|
+
concrete-frame-owed-h calc(var(--concrete-frame-window-h) / 1px)
|
|
171
|
+
concrete-frame-got-w calc(100vw / 1px)
|
|
172
|
+
concrete-frame-got-h calc(100vh / 1px);
|
|
151
173
|
content: "FRAME WINDOW MISMATCH — this format declares a "
|
|
152
|
-
counter(
|
|
153
|
-
" window; the host gave " counter(
|
|
174
|
+
counter(concrete-frame-owed-w) "×" counter(concrete-frame-owed-h)
|
|
175
|
+
" window; the host gave " counter(concrete-frame-got-w) "×" counter(concrete-frame-got-h)
|
|
154
176
|
". Every viewport unit and geometry query in this frame is resolving against the wrong box.";
|
|
155
177
|
position: absolute;
|
|
156
178
|
inset: 0;
|
|
@@ -163,14 +185,14 @@
|
|
|
163
185
|
background: #b3261e;
|
|
164
186
|
color: #ffffff;
|
|
165
187
|
font: 700 clamp(11px, 2.2vw, 26px)/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
166
|
-
opacity: var(--
|
|
188
|
+
opacity: var(--concrete-frame-window-mismatch);
|
|
167
189
|
pointer-events: none;
|
|
168
190
|
}
|
|
169
191
|
|
|
170
192
|
/* Imposed from OUTSIDE <Section>, which stays byte-identical across output classes:
|
|
171
193
|
* without it flexbox would compress an overflowing stack to fit, hiding the overflow
|
|
172
194
|
* the author must be able to see. */
|
|
173
|
-
.tr-frame > * {
|
|
195
|
+
:is(.concrete-frame, .tr-frame) > * {
|
|
174
196
|
flex-shrink: 0;
|
|
175
197
|
}
|
|
176
198
|
|
|
@@ -184,14 +206,14 @@
|
|
|
184
206
|
* were each fixed by hand with an `!`. Layered, an authored width wins outright and
|
|
185
207
|
* needs none.
|
|
186
208
|
*
|
|
187
|
-
* Deliberately separate from .
|
|
209
|
+
* Deliberately separate from .concrete-image-frame below, which templates apply by hand to
|
|
188
210
|
* boxes of their own — flex items, a rail card, a button. Those want the fill and not
|
|
189
211
|
* this geometry, so the two must not be one class.
|
|
190
212
|
*
|
|
191
213
|
* Nothing else belongs here: the box is the caller's. `relative` and `overflow-hidden`
|
|
192
214
|
* stay utilities on the framed wrapper, where the <img> absolutely fills it — those are
|
|
193
215
|
* the frame's contract, not a default an author may replace. */
|
|
194
|
-
.
|
|
216
|
+
.concrete-image-block {
|
|
195
217
|
display: block;
|
|
196
218
|
width: 100%;
|
|
197
219
|
}
|
|
@@ -202,9 +224,10 @@
|
|
|
202
224
|
* exists. Both frames share this one class (and one token) deliberately: the fill is the
|
|
203
225
|
* same neutral rect, so a template retints it once. Templates also apply it by hand to
|
|
204
226
|
* their own gallery boxes for that fill alone, so it carries no geometry.
|
|
205
|
-
* Retint it by setting --
|
|
206
|
-
|
|
207
|
-
|
|
227
|
+
* Retint it by setting --concrete-image-frame-bg in your theme's layout tokens — the
|
|
228
|
+
* one framework token a template declares rather than only reads. */
|
|
229
|
+
.concrete-image-frame {
|
|
230
|
+
background-color: var(--concrete-image-frame-bg, oklch(0.97 0 0));
|
|
208
231
|
}
|
|
209
232
|
}
|
|
210
233
|
|
|
@@ -212,9 +235,9 @@
|
|
|
212
235
|
|
|
213
236
|
:root {
|
|
214
237
|
/* Motion */
|
|
215
|
-
--
|
|
216
|
-
--
|
|
217
|
-
--
|
|
238
|
+
--concrete-duration-fast: 150ms;
|
|
239
|
+
--concrete-duration-base: 250ms;
|
|
240
|
+
--concrete-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
218
241
|
|
|
219
242
|
/* The height of the window this page is being viewed in — what `100svh` means
|
|
220
243
|
* on a published page, which is what this resolves to there and in a frame
|
|
@@ -229,5 +252,5 @@
|
|
|
229
252
|
* — and a box sized from the window therefore writes ONE thing and is honest on
|
|
230
253
|
* both surfaces. Spell it as a floor (`min-height`), never a fixed height, so
|
|
231
254
|
* content taller than a screen still grows the box instead of overflowing it. */
|
|
232
|
-
--
|
|
255
|
+
--concrete-window-h: 100svh;
|
|
233
256
|
}
|
|
@@ -5,7 +5,7 @@ interface SiteConfig {
|
|
|
5
5
|
siteSecret: string;
|
|
6
6
|
ingestBase: string;
|
|
7
7
|
}
|
|
8
|
-
/** Read the per-site config a published page embeds as `#
|
|
8
|
+
/** Read the per-site config a published page embeds as `#concrete-site-config`. Null when absent or incomplete. */
|
|
9
9
|
declare function readSiteConfig(): SiteConfig | null;
|
|
10
10
|
/** HMAC-SHA256 a message with a hex-encoded secret, returning the signature as lowercase hex. */
|
|
11
11
|
declare function hmacHex(secretHex: string, message: string): Promise<string>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
//#region src/browser/site-config.ts
|
|
2
|
-
|
|
2
|
+
const LEGACY_SITE_CONFIG_ID = "tr-site-config";
|
|
3
|
+
/** Read the per-site config a published page embeds as `#concrete-site-config`. Null when absent or incomplete. */
|
|
3
4
|
function readSiteConfig() {
|
|
4
|
-
const el = document.getElementById("
|
|
5
|
+
const el = document.getElementById("concrete-site-config") ?? document.getElementById(LEGACY_SITE_CONFIG_ID);
|
|
5
6
|
if (!el?.textContent) return null;
|
|
6
7
|
try {
|
|
7
8
|
const config = JSON.parse(el.textContent);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/cli/check/render/class-conflicts.ts
|
|
2
|
-
const SECTION_ROOT_CLASS = "
|
|
2
|
+
const SECTION_ROOT_CLASS = "concrete-section";
|
|
3
3
|
const MARGIN_UTILITY = /^-?m(?:[trblxyse])?-/;
|
|
4
4
|
const MARGIN_ARBITRARY = /^\[margin(?:-[a-z-]+)?:/;
|
|
5
5
|
function utilityOf(token) {
|
package/dist/cli/dev/islands.js
CHANGED
|
@@ -300,10 +300,10 @@ function shieldHandle(handle) {
|
|
|
300
300
|
|
|
301
301
|
let styleInstalled = false;
|
|
302
302
|
function ensureShieldStyle() {
|
|
303
|
-
if (styleInstalled || document.getElementById("
|
|
303
|
+
if (styleInstalled || document.getElementById("concrete-canvas-shield-style")) return;
|
|
304
304
|
styleInstalled = true;
|
|
305
305
|
const style = document.createElement("style");
|
|
306
|
-
style.id = "
|
|
306
|
+
style.id = "concrete-canvas-shield-style";
|
|
307
307
|
style.textContent =
|
|
308
308
|
"." + SHIELD_CLASS + "{position:absolute;inset:0;z-index:1;cursor:pointer;background:transparent;}" +
|
|
309
309
|
"." + SHIELD_ITEM_CLASS + "{z-index:2;}" +
|
|
@@ -56,7 +56,7 @@ function bakePropertyRefSlots(schema, facts, ctx) {
|
|
|
56
56
|
* null, a display entry falls back to its first declared case.
|
|
57
57
|
*/
|
|
58
58
|
function resolveDerivedHandle(derivedHandle, deriveFacts, ctx, target) {
|
|
59
|
-
const authored = ctx?.computed
|
|
59
|
+
const authored = ctx?.computed[derivedHandle];
|
|
60
60
|
try {
|
|
61
61
|
if (authored === void 0) throw new Error(`derived handle "${derivedHandle}" is not in the section's computed map`);
|
|
62
62
|
return { value: authored(deriveFacts()) };
|
|
@@ -3,11 +3,11 @@ import { resolveFormatGeometry } from "./geometry.js";
|
|
|
3
3
|
//#region ../../internal/format-geometry/dist/capture.js
|
|
4
4
|
/**
|
|
5
5
|
* The frame shell's root class — the static half of the frame contract, laid
|
|
6
|
-
* out and clipped by
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* out and clipped by Concrete's base stylesheet. Shared so a canvas host or a
|
|
7
|
+
* capturing worker can stamp the identical class on its own page root and
|
|
8
|
+
* resolve the frame from the same stylesheet the captured page uses.
|
|
9
9
|
*/
|
|
10
|
-
const FRAME_ROOT_CLASS = "
|
|
10
|
+
const FRAME_ROOT_CLASS = "concrete-frame";
|
|
11
11
|
/** The frame shell's per-format tokens: trim box + bleed, exact CSS px. */
|
|
12
12
|
function frameTokens(format) {
|
|
13
13
|
const geometry = resolveFormatGeometry(format);
|
|
@@ -105,7 +105,7 @@ interface IslandEditor {
|
|
|
105
105
|
* together with that island's own `editor` declaration.
|
|
106
106
|
*
|
|
107
107
|
* ```tsx
|
|
108
|
-
* import type { IslandEditor, IslandServerFrame } from "@homepages/
|
|
108
|
+
* import type { IslandEditor, IslandServerFrame } from "@homepages/concrete";
|
|
109
109
|
*
|
|
110
110
|
* export const editor = { live: true } satisfies IslandEditor;
|
|
111
111
|
* export const serverFrame = false satisfies IslandServerFrame<typeof editor>;
|
|
@@ -11,9 +11,9 @@ function assertRecordCollectionContract(schema, sectionKey) {
|
|
|
11
11
|
const collection = collectionForSlot(slot);
|
|
12
12
|
if (collection === null) {
|
|
13
13
|
const legal = Object.keys(COLLECTIONS).map((field) => `fact.property.${field}`).join(" / ");
|
|
14
|
-
throw new Error(`Section "${sectionKey}": ${label} source.field "${source.field ?? "?"}" is not a known collection. COLLECTIONS is a closed registry owned by @homepages/
|
|
14
|
+
throw new Error(`Section "${sectionKey}": ${label} source.field "${source.field ?? "?"}" is not a known collection. COLLECTIONS is a closed registry owned by @homepages/concrete — a workspace cannot add to it. A direct-sourced collection may only bind a registry array (${legal}); for any other repeating data, drop \`source\` and give the slot a fill decision instead.`);
|
|
15
15
|
}
|
|
16
|
-
if (!COLLECTIONS[collection].ownership) throw new Error(`Section "${sectionKey}": ${label} collection "${collection}" declares no ownership in COLLECTIONS. COLLECTIONS is a closed registry owned by @homepages/
|
|
16
|
+
if (!COLLECTIONS[collection].ownership) throw new Error(`Section "${sectionKey}": ${label} collection "${collection}" declares no ownership in COLLECTIONS. COLLECTIONS is a closed registry owned by @homepages/concrete — this is a framework defect, not something a workspace can fix.`);
|
|
17
17
|
const inherited = collectionBounds(collection);
|
|
18
18
|
if (inherited.max !== void 0 && slot.max !== void 0 && slot.max >= inherited.max) throw new Error(`Section "${sectionKey}": ${label} declares max ${slot.max}, but collection "${collection}" already caps membership at ${inherited.max}. An explicit max is legal only if it is strictly lower; drop it to inherit ${inherited.max}.`);
|
|
19
19
|
if (inherited.min !== void 0 && slot.min !== void 0 && slot.min <= inherited.min) throw new Error(`Section "${sectionKey}": ${label} declares min ${slot.min}, but collection "${collection}" already requires at least ${inherited.min}. An explicit min is legal only if it is strictly higher; drop it to inherit ${inherited.min}.`);
|
|
@@ -10,7 +10,7 @@ type Props = {
|
|
|
10
10
|
* The frame shell — the rendered-class page root, the frame analog of the
|
|
11
11
|
* website page shell. The frame is a viewport: every host owes a frame
|
|
12
12
|
* document a window that is exactly the format's bleed box, and the static
|
|
13
|
-
* half of the contract (`.
|
|
13
|
+
* half of the contract (`.concrete-frame`, from the base stylesheet) fills
|
|
14
14
|
* that window, clips at the shell's own edge, and lays sections out as a
|
|
15
15
|
* rigid flex column (`flex-shrink: 0` on every direct child, so an
|
|
16
16
|
* overflowing stack overflows measurably instead of being silently
|