@homepages/concrete 1.0.3 → 2.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/codemods/manifest.json +8 -0
  3. package/codemods/unlayer-author-css.mjs +194 -0
  4. package/dist/artifact/playground/client/assets/index-CW7co-u9.js +1101 -0
  5. package/dist/artifact/playground/client/index.html +1 -1
  6. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  7. package/dist/artifact/playground/host.mjs +21 -21
  8. package/dist/base.css +15 -2
  9. package/dist/cli/build/static.js +1 -1
  10. package/dist/cli/dev/server.js +6 -2
  11. package/dist/cli/dev/vite.js +42 -22
  12. package/dist/css/compile.js +26 -4
  13. package/dist/css/rules.js +72 -1
  14. package/dist/eslint/authoring.js +2 -0
  15. package/dist/eslint/rules/island-ids.js +39 -0
  16. package/dist/fixtures/media-plugin.js +32 -17
  17. package/dist/fixtures/media.js +4 -2
  18. package/dist/fixtures/property.js +12 -2
  19. package/dist/fixtures/resolve.js +58 -5
  20. package/dist/fixtures/rows.js +6 -1
  21. package/dist/fixtures.d.ts +57 -12
  22. package/dist/fixtures.js +7 -3
  23. package/dist/index.d.ts +2 -1
  24. package/dist/index.js +2 -1
  25. package/dist/islands/island-id.js +8 -0
  26. package/dist/islands/marker.d.ts +14 -4
  27. package/dist/islands/marker.js +18 -6
  28. package/dist/packages/external/concrete/package.js +1 -1
  29. package/dist/packages/internal/island-runtime/dist/index.js +4 -2
  30. package/dist/packages/internal/island-runtime/dist/island-id-context.js +15 -0
  31. package/dist/packages/internal/island-runtime/dist/use-island-id.d.ts +24 -0
  32. package/dist/packages/internal/island-runtime/dist/use-island-id.js +44 -0
  33. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +1 -1
  34. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +44 -2
  35. package/dist/rules/registry.js +19 -0
  36. package/dist/template/logic-shim.d.ts +2 -1
  37. package/dist/template/logic-shim.js +2 -1
  38. package/guide/reference/cli/INDEX.md +2 -2
  39. package/guide/reference/cli/build.md +1 -1
  40. package/guide/reference/cli/check.md +1 -1
  41. package/guide/reference/cli/dev.md +1 -1
  42. package/guide/reference/cli/property-add.md +1 -1
  43. package/guide/reference/cli/property-list.md +1 -1
  44. package/guide/reference/cli/publish.md +1 -1
  45. package/guide/reference/cli/upgrade.md +1 -1
  46. package/guide/reference/rules/INDEX.md +4 -1
  47. package/package.json +1 -1
  48. package/dist/artifact/playground/client/assets/index-Da8V3M7E.js +0 -1101
@@ -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-Da8V3M7E.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-CW7co-u9.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="./assets/index-CckS2ONm.css">
9
9
  </head>
10
10
  <body>
@@ -1 +1 @@
1
- var m="data-tr-island",H="data-tr-island-id",T="data-tr-island-props",j="data-tr-island-frameless";var x=class extends Error{name="IslandPropsError"};function z(t){let o;try{o=JSON.parse(t)}catch(e){throw new x(`island props payload is not valid JSON: ${String(e)}`)}if(o===null||typeof o!="object"||Array.isArray(o))throw new x("island props payload must be a JSON object");return o}var B=Symbol.for("homepages.tr-island-editor-instance");function J(t){let o=globalThis,e=o[B];return e||(e=t.createContext(null),o[B]=e),e}var X="100%";function N(t){let o=t.getBoundingClientRect();return o.width>0||o.height>0}function Q(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 Z(t){let o=t.getBoundingClientRect();return o.bottom>0&&o.right>0&&o.top<window.innerHeight&&o.left<window.innerWidth}function tt(){return navigator.connection?.saveData===!0}function et(t){typeof requestIdleCallback=="function"?requestIdleCallback(t):setTimeout(t,1)}async function q(t){let{markers:o,hydrate:e,warm:a,moduleUrl:l}=t,c=n=>n.getAttribute(m)??"",f=new Set,p=n=>f.has(n)?Promise.resolve(null):(f.add(n),e(n)),w=new Map;for(let n of o)w.set(n,Q(n));let b=n=>w.get(n)??n,E=[],h=[];for(let n of o)(Z(b(n))?E:h).push(n);if(l&&!tt()){let n=new Set;for(let i of h){let s=l(c(i));if(s==null||s===""||n.has(s))continue;n.add(s);let d=document.createElement("link");d.rel="modulepreload",d.href=s,d.setAttribute("fetchpriority","low"),document.head.appendChild(d)}}for(let n of E)a(c(n));let I=[];for(let n of E){let i=await p(n);i&&I.push(i)}let y=null,g=new Map,_=n=>{let i=p(n),s=b(n),d=g.get(s);return(!d||d.every(u=>f.has(u)))&&y?.unobserve(s),i};if(typeof IntersectionObserver<"u"){y=new IntersectionObserver(n=>{for(let i of n)if(i.isIntersecting)for(let s of g.get(i.target)??[])_(s)},{rootMargin:X});for(let n of h){let i=b(n),s=g.get(i);s?s.push(n):(g.set(i,[n]),y.observe(i))}}let R=h.slice(),r=()=>{et(()=>{let n=R.shift();for(;n&&f.has(n);)n=R.shift();if(!n){y?.disconnect();return}_(n).then(r,r)})};return r(),I}var U="data-section-instance-id",C=new WeakMap;async function D(t){let o=t.root??document,e=Array.from(o.querySelectorAll(`[${m}]`)).filter(r=>!C.has(r)&&r.parentElement?.closest(`[${m}]`)==null);if(e.length===0)return[];let a=new Map,l=new Set;for(let r of o.querySelectorAll(`script[${T}]`)){let n=r.getAttribute(T);n!==null&&(a.has(n)&&l.add(n),a.set(n,r.textContent??""))}let[c,{createRoot:f,hydrateRoot:p}]=await Promise.all([import("react"),import("react-dom/client")]),{createElement:w}=c,b=J(c),E=({onMounted:r,children:n})=>{let[i,s]=c.useState(0);return c.useEffect(()=>{i===0?s(1):r()},[i,r]),n},h=new Map,I=r=>{let n=h.get(r);return n||(n=t.load(r),h.set(r,n)),n},y=t.schedule!=="eager",g=y?I:t.load,_=async r=>{let n=r.getAttribute(m)??"",i=r.getAttribute(H)??"",s=()=>{},d=new Promise(S=>{s=S}),u={id:i,key:n,element:r,mounted:d};try{if(l.has(i))throw new Error(`island "${i}" (${n}) shares its id with another ${T} payload \u2014 refusing to hydrate either instance rather than guess whose props belong to which marker`);let S=a.get(i);if(S===void 0)throw new Error(`island "${i}" (${n}) has no ${T} payload`);let F=z(S),v=await g(n);if(u.editor=v.editor,t.shouldHydrate&&!t.shouldHydrate(u)||C.has(r)||!r.isConnected)return s(),null;let W=r.closest(`[${U}]`)?.getAttribute(U)??null,M=w(b,{value:W},w(E,{onMounted:s,children:w(v.default,F)})),k={onUncaughtError:L=>{t.onError?.(L,u),s()},onCaughtError:L=>{t.onError?.(L,u),s()}},O;return r.hasAttribute(j)?(O=f(r,k),O.render(M)):O=p(r,M,k),C.set(r,O),t.onHydrated?.(u),u}catch(S){return t.onError?.(S,u),s(),null}};if(y)return q({markers:e,hydrate:_,warm:r=>{I(r).catch(()=>{})},moduleUrl:t.moduleUrl});let R=[];for(let r of e){let n=await _(r);n&&R.push(n)}return R}function P(t=document){let o=t instanceof Element&&t.matches(`[${m}]`)?[t]:[];for(let e of[...o,...t.querySelectorAll(`[${m}]`)]){let a=C.get(e);a&&(C.delete(e),a.unmount())}}import{createElement as ot,useLayoutEffect as rt}from"react";var A="we-enh-shield",Y="we-enh-shield--item",st="data-we-live",it="data-slot-item",at=window.__TR_ISLAND_MAP||{};function lt(t){let o=at[t];return o?import(new URL(o,document.baseURI).href):Promise.reject(new Error("playground: no island module for "+t))}var $=new WeakMap;function ct(t,o){return function(a){return rt(o,[]),ot(t,a)}}function dt(t){return t.__trIslandReal||t.default}async function ut(t){let o=await lt(t),e,a=new Promise(c=>{e=c}),l=o.editor?{...o.editor}:void 0;return l&&$.set(l,{committed:a,signalCommit:e}),{...o,editor:l,default:ct(dt(o),e)}}function ft(t,o){let e=t.createElement("div");return e.className=o?A+" "+Y:A,e.setAttribute("aria-hidden","true"),e}function V(t,o){let e=t.ownerDocument,a=e.defaultView,l=a?a.getComputedStyle(t).position:"";(!l||l==="static")&&(t.style.position="relative"),!Array.from(t.children).some(c=>c.classList.contains(A))&&t.appendChild(ft(e,o))}function pt(t){let o=t.editor;if(!o||o.live!==!0)return;let e=t.element;for(let p of Array.from(e.querySelectorAll("["+it+"]")))V(p,!0);let l=e.ownerDocument.defaultView,f=(l?l.getComputedStyle(e).display:"")==="contents"?Array.from(e.children):[e];for(let p of f)V(p,!1)}var G=!1;function mt(){if(G||document.getElementById("tr-canvas-shield-style"))return;G=!0;let t=document.createElement("style");t.id="tr-canvas-shield-style",t.textContent="."+A+"{position:absolute;inset:0;z-index:1;cursor:pointer;background:transparent;}."+Y+"{z-index:2;}["+st+"] ."+A+"{display:none;}",document.head.appendChild(t)}async function K(t){mt();let o=await D({root:t,load:ut,schedule:"eager",shouldHydrate:e=>e.editor?e.editor.live===!0:!1,onError:(e,a)=>{if(console.error("playground: canvas island failed to hydrate:",a.key,e),a.editor){let l=$.get(a.editor);l&&l.signalCommit()}}});await Promise.all(o.map(e=>e.editor?$.get(e.editor):void 0).filter(e=>e!==void 0).map(e=>e.committed));for(let e of o)pt(e);return o}function ht(t){P(t),t.querySelectorAll("."+A).forEach(o=>o.remove())}window.__trCanvasIslands={hydrateRoot:K,unmountRoot:ht};K(document.body);
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("tr-canvas-shield-style"))return;F=!0;let t=document.createElement("style");t.id="tr-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 ze=/^(\d+(?:\.\d+)?)(in|mm)$/;function J(e){let t=ze.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 M(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=J(t.width),r=J(t.height),o=t.bleed===void 0?0:J(t.bleed),l=n*96,u=r*96,c=o*96,s=l+2*c,h=u+2*c,b=t.dpi/96;return{frameWidth:l,frameHeight:u,bleed:c,viewportWidth:s,viewportHeight:h,deviceScaleFactor:b,pixelWidth:Math.round(s*b),pixelHeight:Math.round(h*b),pointWidth:(n+2*o)*72,pointHeight:(r+2*o)*72,bleedPoints:o*72}}var T="tr-frame";function N(e){let t=M(e);return{"--frame-w":`${t.frameWidth}px`,"--frame-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}var K=`(function () {
1
+ var Xe=/^(\d+(?:\.\d+)?)(in|mm)$/;function Y(e){let t=Xe.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 N(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=Y(t.width),r=Y(t.height),o=t.bleed===void 0?0:Y(t.bleed),l=n*96,u=r*96,d=o*96,a=l+2*d,h=u+2*d,v=t.dpi/96;return{frameWidth:l,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 $="tr-frame";function O(e){let t=N(e);return{"--frame-w":`${t.frameWidth}px`,"--frame-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}var J=`(function () {
2
2
  function CaptureIntersectionObserver(callback, options) {
3
3
  var opts = options || {};
4
4
  this.root = opts.root || null;
@@ -46,27 +46,27 @@ var ze=/^(\d+(?:\.\d+)?)(in|mm)$/;function J(e){let t=ze.exec(e),[,n,r]=t??[];if
46
46
  return entries;
47
47
  };
48
48
  window.IntersectionObserver = CaptureIntersectionObserver;
49
- })();`;var Y="__trIslandsReady",Xe=`(async () => {
50
- const ready = window.${Y};
49
+ })();`;var K="__trIslandsReady",Ke=`(async () => {
50
+ const ready = window.${K};
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.${Y} \u2014 the island runtime never ran",
54
+ "window.${K} \u2014 the island runtime never ran",
55
55
  );
56
56
  }
57
57
  await ready;
58
- })()`;var le=400;var Ge=`(async () => {
58
+ })()`;var le=400;var Je=`(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
- })()`,de=5,Je=`(async () => {
65
+ })()`,ce=5,Qe=`(async () => {
66
66
  const frame = () => new Promise((resolve) => {
67
67
  requestAnimationFrame(() => resolve(undefined));
68
68
  });
69
- for (let pass = 0; pass < ${de}; pass += 1) {
69
+ for (let pass = 0; pass < ${ce}; pass += 1) {
70
70
  const running = document.getAnimations().filter((animation) => {
71
71
  if (animation.playState === "finished" || animation.playState === "idle") return false;
72
72
  const timing = animation.effect && animation.effect.getComputedTiming();
@@ -83,14 +83,14 @@ var ze=/^(\d+(?:\.\d+)?)(in|mm)$/;function J(e){let t=ze.exec(e),[,n,r]=t??[];if
83
83
  await frame();
84
84
  }
85
85
  await frame();
86
- })()`;function D(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function y(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ce(e){return ue(e.id,{...N(e)})}function ue(e,t){let n=Object.entries(t).map(([r,o])=>`${r}:${o}`).join(";");return{class:T,dataFormat:e,style:n}}function j(e,t){let n=ce(e);return`<div class="${y(n.class)}" data-format="${y(n.dataFormat)}" style="${y(n.style)}">${t.join("")}</div>`}function C(e){switch(e.destination){case"published":return Ye(e);case"artifact":return Ke(e);case"preview":return Qe(e);case"diff":return Ze(e)}}function pe(e){return e.kind==="none"||Object.keys(e.islandMap).length===0?[]:[`<script>${K}</script>`]}var fe="html, body { margin: 0; padding: 0; }";function me(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 Ye(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 o of t.icons??[])n.push(me(o));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(...W(e.stylesheets)),n.push(...Z(e.islands)),e.prefetchUrls&&e.prefetchUrls.length>0&&n.push(`<script type="speculationrules">${D({prefetch:[{source:"list",urls:[...e.prefetchUrls]}]})}</script>`);let r=e.siteConfig?`
87
- <script type="application/json" id="tr-site-config">${D(e.siteConfig)}</script>`:"";return L({lang:t.lang??"en",head:n,body:` <body class="tr-root">
86
+ })()`;function M(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function y(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function de(e){return ue(e.id,{...O(e)})}function ue(e,t){let n=Object.entries(t).map(([r,o])=>`${r}:${o}`).join(";");return{class:$,dataFormat:e,style:n}}function L(e,t){let n=de(e);return`<div class="${y(n.class)}" data-format="${y(n.dataFormat)}" style="${y(n.style)}">${t.join("")}</div>`}function C(e){switch(e.destination){case"published":return Ze(e);case"artifact":return et(e);case"preview":return tt(e);case"diff":return nt(e)}}function pe(e){return e.kind==="none"||Object.keys(e.islandMap).length===0?[]:[`<script>${J}</script>`]}var me="html, body { margin: 0; padding: 0; }";function fe(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 Ze(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 o of t.icons??[])n.push(fe(o));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?`
87
+ <script type="application/json" id="tr-site-config">${M(e.siteConfig)}</script>`:"";return j({lang:t.lang??"en",head:n,body:` <body class="tr-root">
88
88
  ${e.root.bodyHtml}${r}${ee(e.islands,"viewport")}
89
89
  <script type="module" src="${y(e.analyticsJs.url)}"></script>
90
- </body>`})}function Ke(e){let t=['<meta charset="utf-8" />'];e.title!==void 0&&t.push(`<title>${y(e.title)}</title>`),t.push(...W(e.stylesheets));let n=[fe,...tt(e.root)];return t.push(Q(n)),t.push(...pe(e.islands)),t.push(...Z(e.islands)),L({lang:"en",head:t,body:` <body>${et(e.root)}${ee(e.islands,"eager")}</body>`})}function Qe(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?[]:[me({rel:"icon",href:e.icon})],...W(e.stylesheets),Q([fe,...e.extraCss??[]]),...e.capture===!0?pe(e.islands):[],...Z(e.islands)],n=(e.devScripts??[]).map(r=>`
91
- ${r}`).join("");return L({lang:"en",head:t,body:` <body>
90
+ </body>`})}function et(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=[me,...ot(e.root)];return t.push(Q(n)),t.push(...pe(e.islands)),t.push(...Z(e.islands)),j({lang:"en",head:t,body:` <body>${rt(e.root)}${ee(e.islands,"eager")}</body>`})}function tt(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?[]:[fe({rel:"icon",href:e.icon})],...q(e.stylesheets),Q([me,...e.extraCss??[]]),...e.capture===!0?pe(e.islands):[],...Z(e.islands)],n=(e.devScripts??[]).map(r=>`
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 Ze(e){let t=['<meta charset="utf-8" />',`<meta name="viewport" content="width=${e.viewportWidth}, initial-scale=1" />`,`<title>${y(e.title)}</title>`,...W(e.stylesheets),Q([`html, body { margin: 0; padding: 0; width: ${e.viewportWidth}px; }`])];return L({lang:"en",head:t,body:` <body>${e.root.bodyHtml}</body>`})}function L(e){let t=e.head.map(n=>` ${n}`).join(`
93
+ </body>`})}function nt(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 et(e){return e.kind==="frame"?j(e.format,e.sectionHtml):e.pages.map(t=>j(e.format,t)).join(`
102
- `)}function tt(e){return e.kind!=="frameStack"?[]:[`body > .${T} { break-after: page; }`,`body > .${T}:last-child { break-after: auto; }`]}function W(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}
101
+ `}function rt(e){return e.kind==="frame"?L(e.format,e.sectionHtml):e.pages.map(t=>L(e.format,t)).join(`
102
+ `)}function ot(e){return e.kind!=="frameStack"?[]:[`body > .${$} { break-after: page; }`,`body > .${$}: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
- </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">${D({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=D(e.islandMap),r=t==="eager"?' window.__TR_ISLAND_SCHEDULE = "eager";':"";return e.kind==="bundles"?`
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
- ${nt}
108
+ ${it}
109
109
  <script>window.__TR_ISLAND_MAP = ${n};${r}</script>
110
- <script type="module" src="${y(e.bootstrapUrl)}"></script>`}var nt=`<script type="module">
110
+ <script type="module" src="${y(e.bootstrapUrl)}"></script>`}var it=`<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 k={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 rt(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:rt(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 Re(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 be(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 _e(e,t){return new Map(e.instances.map(n=>[n.instance_id,t[n.instance_id]?.enabled??n.enabled]))}function Se(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 ve(e){return Array.isArray(e)?e.length:0}function xe(e){return typeof e=="string"&&e!==""?e:null}function ot(e){return{propertyType:xe(e.property_type),listingIntent:xe(e.listing_intent),units:ve(e.units),photos:ve(e.photos)}}function it(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 Ie(e){return{id:e.id,label:e.label,summary:ot(e.facts),doc:it(e.instances),display:we(e.instances)}}function Pe(e,t){let n=e.replace(/\/+$/,"");return t==="/"?`${n}/`:`${n}${t}/`}function Ee(e){let{pages:t,currentPageId:n,basePath:r}=e,o=t.find(c=>c.id===n);if(!o)throw new Error(`nav: page "${n}" is not one of the declared pages (${t.map(c=>c.id).join(", ")}).`);let l=[o,...t.filter(c=>c.id!==o.id&&c.enabled!==!1)],u={};for(let c of l)for(let s of c.sections)s.enabled===!1||s.key in u||(u[s.key]=c.id===o.id?`#${s.anchor}`:`${Pe(r,c.path)}#${s.anchor}`);return{anchors:u,pages:t.filter(c=>c.enabled!==!1).map(c=>({id:c.id,label:c.label,href:Pe(r,c.path),current:c.id===o.id}))}}function V(e,t){return e.pages?.[t]?.enabled!==!1}function te(e,t){return t.filter(n=>V(e,n.id))}var O={base:"stylesheets/base.css",template:"stylesheets/template.css"},I={frame:"__capture/frame",print:"__capture/print"};function $e(e){return new URLSearchParams(e).toString()}function ne(e,t,n){return`${I.frame}?${$e({fixture:e,page:t,format:n})}`}function ke(e,t){return`${I.print}?${$e({fixture:e,format:t})}`}var q=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(s=>typeof s=="number"&&Number.isFinite(s)))return null;let l=q(t),u=q(n),c={nx:l,ny:u,nw:Math.min(q(r),1-l),nh:Math.min(q(o),1-u)};return c.nw<=0||c.nh<=0||c.nx===0&&c.ny===0&&c.nw===1&&c.nh===1?null:c}var z={file(e){return typeof e=="string"?{url:e,responsive:null}:{url:e.url,responsive:e.responsive}}};function st(e){if(typeof e!="object"||e===null)return null;let t=e.asset_id;return typeof t=="string"&&t!==""?t:null}function at(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 Te(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 lt(e,t){let n=Te(e,t);return e.file===null?{video_id:e.id,url: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 dt(e,t){return{tour_id:e.id,url:e.url??"",...Te(e,t),alt:e.alt,...e.provider===null?{}:{provider:e.provider}}}function ct(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 ut(e,t,n,r){let o=st(t),l=o===null?void 0:n.get(o);if(l===void 0||l.kind!==e)return null;switch(e){case"image":return at(l,t,r);case"video":return lt(l,r);case"tour":return dt(l,r);case"document":return ct(l,r);default:return null}}var pt=new Set(["image","video","tour","document"]),ft=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function mt(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 gt(e,t,n,r){return e.type==="image"&&Array.isArray(t)?t.filter(ft).map(o=>mt(o,n,r)):re(e,t,n,r)}function re(e,t,n,r){if(t==null)return t;if(pt.has(e.type))return ut(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 c={...u};for(let[s,h]of Object.entries(l))c[s]=gt(h,c[s],n,r);return c})}if(e.element!==void 0){let l=e.element;return o.map(u=>re(l,u,n,r))}return o}function Ce(e,t,n,r=z){let o={};for(let[l,u]of Object.entries(e.slots)){let c=t.schema.slots[l];o[l]=c===void 0?u:re(c,u,n,r)}return o}function Ae(e){return typeof e=="string"?e:e.url}function yt(e,t){return e.split(",").map(n=>{let[r="",...o]=n.trim().split(/\s+/);return[t(r),...o].join(" ")}).join(", ")}function ht(e){return{file(t){let n=z.file(t),r=n.responsive===null?null:{...n.responsive,sources:n.responsive.sources.map(o=>({...o,srcset:yt(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 He(e,t){let{facts:n}=e,r=s=>e.media[s],o=s=>s?.file===null||s?.file===void 0?"":t(Ae(s.file)),l=s=>s?.posterFile!==void 0?t(Ae(s.posterFile)):s?.posterUrl??"",u=[];for(let s of A(n.photos)){let h=r(s.id);u.push({id:s.id,kind:"photo",name:h?.filename||s.id,size:"",src:o(h),caption:s.caption??null})}for(let s of A(n.floor_plans)){let h=r(s.id);u.push({id:s.id,kind:"plan",name:h?.filename||s.id,size:"",src:o(h)})}for(let s of A(n.videos)){let h=s.provider??void 0;u.push({id:s.id,kind:"video",name:s.caption??r(s.id)?.filename??s.id,size:"",src:l(r(s.id)),caption:s.caption??null,ready:!0,durationMs:s.duration_ms??null,...h===void 0?{}:{provider:h}})}for(let s of A(n.tours))u.push({id:s.id,kind:"tour",name:`${s.provider??"Tour"} ${s.id}`,size:"",src:l(r(s.id)),ready:!0,provider:s.provider??""});for(let s of A(n.documents)){let h=r(s.id)?.sizeBytes;u.push({id:s.id,kind:"document",name:s.filename??s.id,size:"",src:"",mime:s.mime??"",...h===void 0?{}:{sizeBytes:h}})}let c=[["avatar_upload_id","headshot"],["logo_dark_upload_id","logo (dark)"],["logo_light_upload_id","logo (light)"]];for(let s of A(n.contacts)){let h=typeof s.name=="string"?s.name:"Contact";for(let[b,$]of c){let x=s[b];typeof x=="string"&&u.push({id:x,kind:"library",name:`${h} \u2014 ${$}`,size:"",src:o(r(x)),caption:h})}}return u}var wt={image:["photo_id","asset_id"],video:["video_id","asset_id"],tour:["tour_id","asset_id"],document:["asset_id"]};function Rt(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=wt[e.type];if(n!==void 0){if(typeof t!="object")return null;let o=t,l=n.map(s=>o[s]).find(s=>typeof s=="string"&&s!=="");if(typeof l!="string")return null;if(e.type!=="image")return{asset_id:l};let u=F(o.rect),c=typeof o.mobile=="object"&&o.mobile!==null?F(o.mobile.rect):null;return{asset_id:l,...u===null?{}:{rect:u},...c===null?{}:{mobile_rect:c}}}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[c,s]of Object.entries(o))c in u&&(u[c]=s.type==="image"&&Array.isArray(u[c])?Rt(u[c]):oe(s,u[c]));return u})}if(e.element!==void 0){let o=e.element;return r.map(l=>oe(o,l))}return r}function Me(e){let{instance:t,slots:n,fixture:r,session:o,assetUrl:l}=e,u={...t.slots},c={},s=r.provenance[t.instance_id]??{};for(let b of Object.keys(n))c[b]=s[b]??{kind:"empty"};for(let[b,$]of Object.entries(o??{})){let x=n[b];x!==void 0&&(u[b]=oe(x,$),c[b]={kind:"session"})}let h=new Map(Object.entries(r.media));return{slots:Ce({...t,slots:u},{schema:{slots:n}},h,ht(l)),provenance:c}}var Ne=1024*1024;function _t(e){let t=M(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 St(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 se(e){return new Response(e,{headers:{"content-type":"text/html; charset=utf-8"}})}function vt(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 xt(e){return`<script>
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>
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 It(e){if(e===k.catalog||e==="api/media"||e.startsWith("api/capture/")||e===I.frame||e===I.print)return!0;let[t,n,r]=e.split("/").filter(Boolean);return t==="fixtures"&&n!==void 0&&r==="live"}function Pn(e){let{reader:t,assetUrl:n,renderer:r}=e,o=(e.base??"/").endsWith("/")?e.base??"/":`${e.base??"/"}/`,l=p=>/^([a-z][a-z0-9+.-]*:|\/)/i.test(p)?p:`${o}${p}`,u=()=>[O.base,O.template].map(p=>l(n(p)));async function c(p){let{fixtures:a}=await t.fixtures(),i=a.find(d=>d.id===p);if(i===void 0){let d=a.map(m=>m.id).join(", ")||"none";throw new g(404,`There is no fixture "${p}" (have: ${d}).`)}return i}function s(p,a){let i=p.instances.find(d=>d.instance_id===a);if(i===void 0)throw new g(400,`The composition places no instance "${a}".`);return i}function h(p,a,i,d,m){if(p.output!=="website")return{selfAnchor:d,anchors:ge(),pages:[]};let f=_e(a,m),w=p.pages.map(v=>({id:v.id,label:v.label,path:v.path??`/${v.id}`,sections:v.sections.map(P=>({key:P.section,anchor:P.section,enabled:f.get(P.instanceId)!==!1}))})),R=`${o}${k.live(a.id,"/").replace(/\/$/,"")}`,_=Ee({pages:w,currentPageId:i,basePath:R});return{selfAnchor:d,anchors:_.anchors,pages:_.pages}}async function b(p,a,i,d,m,f){let w=p.instances.find(G=>G.instanceId===d.instance_id);if(w===void 0)throw new Error(`The composition places no section "${d.section_key}".`);let R=Se(d,w.sectionSchema.slots,f),{slots:_,provenance:v}=Me({instance:R,slots:w.sectionSchema.slots,fixture:a,session:m,assetUrl:n}),P=h(p,a,i,R.section_key,f),S=R.variant,H=await r.section(R.section_key);return{html:r.renderToString(r.createElement(H,{slots:_,nav:P,variant:S??""}),{identifierPrefix:R.instance_id}),resolvedProps:{slots:_,nav:P,variant:S},provenance:v}}async function $(p,a,i){let d=[];for(let m of i.sections){let f=s(a,m.instanceId);f.enabled&&d.push((await b(p,a,i.id,f,void 0,{})).html)}return d}function x(p,a,i){let d=p.pages.find(m=>m.id===a);if(d===void 0)throw new g(i,`The template declares no page "${a}".`);return d}function B(p,a){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=a===null?p.formats[0]:p.formats.find(d=>d.id===a);if(i===void 0)throw new g(404,`The template declares no format "${a??""}" (have: ${p.formats.map(d=>d.id).join(", ")}).`);return i}async function De(){let p=await t.islands(),a={wire:1,islands:{map:{...p.map},hostScript:p.canvasHost,importMap:{...p.importMap}},stylesheets:[O.base,O.template].map(f=>n(f))},i,d;try{i=await t.template(),d=await t.fixtures()}catch(f){return{...a,template:{key:"",name:"",output:"website",formats:[],pages:[],canvases:[],instances:[]},fixtures:[],capabilities:{hmr:t.live,capture:!1},error:f instanceof Error?f.message:String(f)}}let m=d.problems!==void 0&&d.fixtures.length===0?`No fixture could be rendered:
126
- ${d.problems}`:void 0;return{...a,template:{key:i.key,name:i.name,output:i.output,formats:i.output==="website"?[]:i.formats.map(_t),pages:i.pages.map(f=>({id:f.id,label:f.label,...f.path===void 0?{}:{path:f.path},instanceIds:f.sections.map(w=>w.instanceId)})),canvases:i.canvases.map(f=>({id:f.id,label:f.label,pages:[...f.pages]})),instances:i.instances.map(f=>({...f,display:he(f.display)}))},fixtures:d.fixtures.map(Ie),capabilities:{hmr:t.live,capture:i.output!=="website"&&t.capture!==void 0},...m===void 0?{}:{error:m}}}async function Oe(p){if(p.method!=="POST")throw new g(405,`POST a render request to ${k.render}.`);let a=await p.text();if(new TextEncoder().encode(a).byteLength>Ne)throw new g(413,`request body exceeds ${Ne} bytes`);let i;try{i=a===""?void 0:JSON.parse(a)}catch(_){throw new g(400,`request body is not JSON: ${_ instanceof Error?_.message:String(_)}`)}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 d=typeof i.session=="object"&&i.session!==null?i.session:{},m=Re(i.display),f=await t.template(),w=await c(i.fixture),R=x(f,i.page,400);return be(f,m),b(f,w,R.id,s(w,i.instance),d.slots,m)}async function Fe(p){let a=await c(U(p,"fixture","api/media"));return{items:He(a,n)}}async function Ue(p,a){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 d=i.pages.find(w=>w.path===a);if(d===void 0){let w=i.pages.map(R=>R.path??R.id).join(", ");throw new g(404,`The template declares no page at "${a}" (have: ${w}).`)}let m=await c(p),f=await $(i,m,d);return C({destination:"preview",root:{kind:"plain",bodyHtml:f.join(`
127
- `)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${i.name} - ${d.label}`,extraCss:["html, body { background: #fff; }"],...t.live?{devScripts:[xt(`${o}${k.hmr}`)]}:{}})}function ae(p,a,i){let d=x(p,i,404);if(!V(a,d.id))throw new g(404,`The fixture "${a.id}" switches the page "${d.id}" off, so it has no capture.`);return d}async function je(p){let a=I.frame,i=await t.template(),d=B(i,p.searchParams.get("format")),m=await c(U(p,"fixture",a)),f=ae(i,m,U(p,"page",a));return C({destination:"artifact",root:{kind:"frame",format:d,sectionHtml:await $(i,m,f)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${i.name} \u2014 ${f.id}`})}async function Le(p){let a=await t.template(),i=B(a,p.searchParams.get("format"));if(a.output!=="document")throw new g(404,`"${a.key}" is an ${a.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);let d=await c(U(p,"fixture",I.print)),m=[];for(let f of te(d,a.pages))m.push(await $(a,d,f));if(m.length===0)throw new g(404,`The fixture "${d.id}" switches every page off, so it has no PDF.`);return C({destination:"artifact",root:{kind:"frameStack",format:i,pages:m},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${a.name} \u2014 print`})}async function We(p,a){let i=p;if(i!=="screenshot"&&i!=="bundle"&&i!=="print")throw new g(404,`There is no capture at ${a.pathname}.`);let d=U(a,"fixture",`api/capture/${i}`),m=await t.template(),f=B(m,a.searchParams.get("format")),w=await c(d),R,_,v;if(i==="screenshot"){let S=a.searchParams.get("page")??te(w,m.pages)[0]?.id;if(S===void 0)throw new g(404,`The fixture "${d}" leaves no page on.`);ae(m,w,S),R={kind:i,fixture:d,format:f,documents:[{path:ne(d,S,f.id),page:S,name:`${S}.png`}]},_="image/png",v=`${m.key}-${S}-${f.id}.png`}else if(i==="bundle"){if(m.output!=="image")throw new g(404,`"${m.key}" is a ${m.output} template \u2014 the zip is for the image class; a document downloads its PDF.`);let S=a.searchParams.get("canvas"),H=S===null?m.canvases[0]:m.canvases.find(E=>E.id===S);if(H===void 0)throw new g(404,`The template declares no canvas "${S??""}".`);let X=H.pages.filter(E=>V(w,E));if(X.length===0)throw new g(404,`The fixture "${d}" switches every page of the canvas "${H.id}" off, so it has no zip.`);let G=X.map(E=>({path:ne(d,E,f.id),page:E,name:`${m.pages.find(qe=>qe.id===E)?.label||E}.png`}));R={kind:i,fixture:d,format:f,documents:G},_="application/zip",v=`${m.key}-${f.id}.zip`}else{if(m.output!=="document")throw new g(404,`"${m.key}" is an ${m.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);R={kind:i,fixture:d,format:f,documents:[{path:ke(d,f.id),page:null,name:`${m.key}.pdf`}]},_="application/pdf",v=`${m.key}.pdf`}if(t.capture===void 0)throw new g(501,"This playground has no captures to give.");let P=await t.capture(R);return new Response(new Uint8Array(P),{headers:{"content-type":_,"content-disposition":`attachment; filename="${encodeURIComponent(v)}"`}})}async function Ve(p,a,i){if(i===k.render)return ie(await Oe(p));if(p.method!=="GET"&&p.method!=="HEAD"&&It(i))throw new g(405,`${i} only reads; the playground accepts no uploads and writes nothing.`);if(i===k.catalog)return ie(await De());if(i==="api/media")return ie(await Fe(a));if(i.startsWith("api/capture/"))return We(i.slice(12),a);if(i===I.frame)return se(await je(a));if(i===I.print)return se(await Le(a));let[d,m,f,w,...R]=i.split("/").filter(Boolean);if(d==="fixtures"&&m!==void 0&&f==="live"){if(R.length>0)throw new g(404,`There is no route at ${a.pathname}.`);return se(await Ue(decodeURIComponent(m),w===void 0?"/":`/${decodeURIComponent(w)}`))}return null}return{async handle(p){let a=new URL(p.url);if(!a.pathname.startsWith(o)&&`${a.pathname}/`!==o)return null;let i=a.pathname.slice(o.length);try{return await Ve(p,a,i)}catch(d){let m=vt(d);if(m===null)throw d;return St(m,d instanceof Error?d.message:String(d))}}}}export{Pn as createHost};
125
+ </script>`}function Nt(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 Un(e){let{reader:t,assetUrl:n,renderer:r}=e,o=(e.base??"/").endsWith("/")?e.base??"/":`${e.base??"/"}/`,l=p=>/^([a-z][a-z0-9+.-]*:|\/)/i.test(p)?p:`${o}${p}`,u=()=>[D.base,D.template].map(p=>l(n(p)));async function d(p){let{fixtures:s}=await t.fixtures(),i=s.find(c=>c.id===p);if(i===void 0){let c=s.map(f=>f.id).join(", ")||"none";throw new g(404,`There is no fixture "${p}" (have: ${c}).`)}return i}function a(p,s){let i=p.instances.find(c=>c.instance_id===s);if(i===void 0)throw new g(400,`The composition places no instance "${s}".`);return i}function h(p,s,i,c,f){if(p.output!=="website")return{selfAnchor:c,anchors:ge(),pages:[]};let m=we(s,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(s.id,"/").replace(/\/$/,"")}`,w=Pe({pages:_,currentPageId:i,basePath:b});return{selfAnchor:c,anchors:w.anchors,pages:w.pages}}async function v(p,s,i,c,f,m){let _=p.instances.find(X=>X.instanceId===c.instance_id);if(_===void 0)throw new Error(`The composition places no section "${c.section_key}".`);let b=xe(c,_.sectionSchema.slots,m),{slots:w,provenance:R}=De({instance:b,slots:_.sectionSchema.slots,fixture:s,session:f,assetUrl:n}),I=h(p,s,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 E(p,s,i){let c=[];for(let f of i.sections){let m=a(s,f.instanceId);m.enabled&&c.push((await v(p,s,i.id,m,void 0,{})).html)}return c}function S(p,s,i){let c=p.pages.find(f=>f.id===s);if(c===void 0)throw new g(i,`The template declares no page "${s}".`);return c}function G(p,s){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=s===null?p.formats[0]:p.formats.find(c=>c.id===s);if(i===void 0)throw new g(404,`The template declares no format "${s??""}" (have: ${p.formats.map(c=>c.id).join(", ")}).`);return i}async function Ue(){let p=await t.islands(),s={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{...s,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{...s,template:{key:i.key,name:i.name,output:i.output,formats:i.output==="website"?[]:i.formats.map($t),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:he(m.display)}))},fixtures:c.fixtures.map(ke),capabilities:{hmr:t.live,capture:i.output!=="website"&&t.capture!==void 0},...f===void 0?{}:{error:f}}}async function Le(p){if(p.method!=="POST")throw new g(405,`POST a render request to ${T.render}.`);let s=await p.text();if(new TextEncoder().encode(s).byteLength>Fe)throw new g(413,`request body exceeds ${Fe} bytes`);let i;try{i=s===""?void 0:JSON.parse(s)}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=be(i.display),m=await t.template(),_=await d(i.fixture),b=S(m,i.page,400);return ve(m,f),v(m,_,b.id,a(_,i.instance),c.slots,f)}async function je(p){let s=await d(U(p,"fixture","api/media"));return{items:Me(s,n)}}async function qe(p,s){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===s);if(c===void 0){let _=i.pages.map(b=>b.path??b.id).join(", ");throw new g(404,`The template declares no page at "${s}" (have: ${_}).`)}let f=await d(p),m=await E(i,f,c);return C({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:[Ht(`${o}${T.hmr}`)]}:{}})}function se(p,s,i){let c=S(p,i,404);if(!W(s,c.id))throw new g(404,`The fixture "${s.id}" switches the page "${c.id}" off, so it has no capture.`);return c}async function We(p){let s=k.frame,i=await t.template(),c=G(i,p.searchParams.get("format")),f=await d(U(p,"fixture",s)),m=se(i,f,U(p,"page",s));return C({destination:"artifact",root:{kind:"frame",format:c,sectionHtml:await E(i,f,m)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${i.name} \u2014 ${m.id}`})}async function Ve(p){let s=await t.template(),i=G(s,p.searchParams.get("format"));if(s.output!=="document")throw new g(404,`"${s.key}" is an ${s.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,s.pages))f.push(await E(s,c,m));if(f.length===0)throw new g(404,`The fixture "${c.id}" switches every page off, so it has no PDF.`);return C({destination:"artifact",root:{kind:"frameStack",format:i,pages:f},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:u()},title:`${s.name} \u2014 print`})}async function ze(p,s){let i=p;if(i!=="screenshot"&&i!=="bundle"&&i!=="print")throw new g(404,`There is no capture at ${s.pathname}.`);let c=U(s,"fixture",`api/capture/${i}`),f=await t.template(),m=G(f,s.searchParams.get("format")),_=await d(c),b,w,R;if(i==="screenshot"){let x=s.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=s.searchParams.get("canvas"),H=x===null?f.canvases[0]:f.canvases.find(P=>P.id===x);if(H===void 0)throw new g(404,`The template declares no canvas "${x??""}".`);let B=H.pages.filter(P=>W(_,P));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 X=B.map(P=>({path:ne(c,P,m.id),page:P,name:`${f.pages.find(Be=>Be.id===P)?.label||P}.png`}));b={kind:i,fixture:c,format:m,documents:X},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:Te(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 Ge(p,s,i){if(i===T.render)return ie(await Le(p));if(p.method!=="GET"&&p.method!=="HEAD"&&Nt(i))throw new g(405,`${i} only reads; the playground accepts no uploads and writes nothing.`);if(i===T.catalog)return ie(await Ue());if(i==="api/media")return ie(await je(s));if(i.startsWith("api/capture/"))return ze(i.slice(12),s);if(i===k.frame)return ae(await We(s));if(i===k.print)return ae(await Ve(s));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 ${s.pathname}.`);return ae(await qe(decodeURIComponent(f),_===void 0?"/":`/${decodeURIComponent(_)}`))}return null}return{async handle(p){let s=new URL(p.url);if(!s.pathname.startsWith(o)&&`${s.pathname}/`!==o)return null;let i=s.pathname.slice(o.length);try{return await Ge(p,s,i)}catch(c){let f=At(c);if(f===null)throw c;return Ct(f,c instanceof Error?c.message:String(c))}}}}export{Un as createHost};
package/dist/base.css CHANGED
@@ -1,4 +1,4 @@
1
- @layer theme, base, components, sections, template, utilities;
1
+ @layer theme, base, components, utilities;
2
2
 
3
3
  /* @homepages/concrete — the base stylesheet every template's page loads.
4
4
  *
@@ -6,7 +6,20 @@
6
6
  * entry (that is styles.css); it ships as its own stylesheet on the page.
7
7
  *
8
8
  * Contains:
9
- * - The cascade-layer order declaration above — the one place it is stated
9
+ * - The cascade-layer order declaration above — the one place it is stated.
10
+ * It names Tailwind's four layers and nothing else. YOUR CSS IS NOT LAYERED:
11
+ * write a plain rule and it outranks every utility, because unlayered beats
12
+ * layered outright. That is stock Tailwind v4 and it is the whole model —
13
+ * what you write is what applies. If you want a utility to win over a rule of
14
+ * yours, put that rule in Tailwind's own `@layer components`.
15
+ *
16
+ * `sections` and `template` used to sit here, between `components` and
17
+ * `utilities`, and the old kit's build folded every section's hand-CSS into
18
+ * them. A declaration there lost to any utility setting the same property on
19
+ * the same element, however specific its selector — silently, and only on the
20
+ * published page, because the dev server served the same CSS unlayered. That
21
+ * shipped defects to live customers twice before anyone went looking. The
22
+ * layers are gone; `check` refuses author CSS that declares them.
10
23
  * - The three reset gaps Tailwind's preflight leaves (below)
11
24
  * - The section box model (.tr-section, emitted by the <Section> primitive)
12
25
  * - The frame shell's static half (.tr-frame, emitted by the <FrameShell> primitive)
@@ -7,8 +7,8 @@ import { dirname, extname, join } from "node:path";
7
7
  import { fileURLToPath, pathToFileURL } from "node:url";
8
8
  import { readFile } from "node:fs/promises";
9
9
  import { createHash } from "node:crypto";
10
- import { build } from "esbuild";
11
10
  import { createRequire } from "node:module";
11
+ import { build } from "esbuild";
12
12
 
13
13
  //#region src/cli/build/static.ts
14
14
  function sha256(bytes) {
@@ -67,12 +67,14 @@ async function startDevServer(options) {
67
67
  const browserMarker = FROM_SOURCE ? `/@fs/${sourceMarker.replace(/^\/+/, "")}` : "@homepages/concrete";
68
68
  const serverMarker = FROM_SOURCE ? sourceMarker : "@homepages/concrete";
69
69
  const islandEntries = findWorkspaceIslands(root).map((file) => relative(root, file));
70
+ const browserAssets = /* @__PURE__ */ new Map();
70
71
  const vite = await createDevVite({
71
72
  root,
72
73
  packageRoot,
73
74
  markerSpecifier: browserMarker,
74
75
  hmrPort: port + 100,
75
- islandEntries
76
+ islandEntries,
77
+ assets: browserAssets
76
78
  });
77
79
  let islands = {
78
80
  map: {},
@@ -137,6 +139,7 @@ async function startDevServer(options) {
137
139
  clientDir,
138
140
  baseCss: join(packageRoot, FROM_SOURCE ? join("src", "css", "base.css") : join("dist", "base.css")),
139
141
  log,
142
+ browserAssets,
140
143
  crops: /* @__PURE__ */ new Map()
141
144
  };
142
145
  const fixturesDir = join(root, "fixtures") + sep;
@@ -270,7 +273,8 @@ async function sendFixtureMedia(ctx, req, url, res) {
270
273
  sendText(res, 405, "fixture media only reads; the playground accepts no uploads.");
271
274
  return;
272
275
  }
273
- const asset = await ctx.workspace.fixtureAsset(decodeURIComponent(url.pathname));
276
+ const path = decodeURIComponent(url.pathname);
277
+ const asset = await ctx.workspace.fixtureAsset(path) ?? ctx.browserAssets.get(path);
274
278
  if (asset === void 0) {
275
279
  sendText(res, 404, "not found");
276
280
  return;
@@ -1,6 +1,7 @@
1
1
  import { createTsconfigPathsPlugin } from "./tsconfig-paths.js";
2
2
  import { islandTransformPlugin, toPosixPath } from "./islands.js";
3
3
  import { imageDimensions } from "../../fixtures/image-dimensions.js";
4
+ import { MEDIA_EXTENSIONS, fixtureMediaModule } from "../../fixtures/media-plugin.js";
4
5
  import { extname, isAbsolute, relative } from "node:path";
5
6
  import { readFile } from "node:fs/promises";
6
7
  import react from "@vitejs/plugin-react";
@@ -19,33 +20,52 @@ const RASTER_EXTENSIONS = /* @__PURE__ */ new Set([
19
20
  ".avif"
20
21
  ]);
21
22
  /**
22
- * A raster imported from a module is an OBJECT in the authoring contract (`AuthorImage`:
23
- * url, width, height, responsive) where Vite would hand back a URL string. `dev` serves
24
- * the master and derives no ladder — the ladder is the build's (`responsive: null`, the
25
- * same answer fixture media gets in `dev`). A query suffix (`?url`, `?raw`) is the
26
- * author asking Vite for the string form on purpose, and is left to Vite.
23
+ * Every asset import in the BROWSER graph, resolved exactly as the server graph resolves
24
+ * it (../../fixtures/media-plugin.ts): a raster yields the `AuthorImage` object the
25
+ * authoring contract promises, everything else its served `/fixture-media/` URL string.
26
+ *
27
+ * Left to itself Vite answers differently on both counts — it inlines a file under
28
+ * `assetsInlineLimit` as a `data:` URI and names the rest by their workspace path — and an
29
+ * island is in BOTH graphs, so a divergence is an attribute mismatch React reports on the
30
+ * island's own element at hydration. `build` has no such split (both its graphs are
31
+ * esbuild's), so this is the dev server's alone to close.
32
+ *
33
+ * What it mints is recorded in `assets`, which the server's `/fixture-media/` route reads
34
+ * alongside the server graph's index: an island declaring `serverFrame = false` is stubbed
35
+ * out of that graph, so its assets are minted only here.
36
+ *
37
+ * A query suffix (`?url`, `?raw`) is the author asking Vite for a form of their own on
38
+ * purpose, and is left to Vite.
27
39
  */
28
- function authorImagePlugin(root) {
40
+ function fixtureMediaVitePlugin(root, assets) {
29
41
  return {
30
- name: "concrete-dev:author-image",
42
+ name: "concrete-dev:fixture-media",
31
43
  enforce: "pre",
32
44
  async load(id) {
33
- if (id.includes("?") || !RASTER_EXTENSIONS.has(extname(id).toLowerCase())) return null;
34
- const bytes = await readFile(id);
35
- const url = isInside(root, id) ? `/${toPosixPath(relative(root, id))}` : `/@fs/${toPosixPath(id).replace(/^\/+/, "")}`;
36
- const size = imageDimensions(bytes) ?? {
37
- width: 0,
38
- height: 0
39
- };
40
- return `export default ${JSON.stringify({
41
- url,
42
- responsive: null,
43
- width: size.width,
44
- height: size.height
45
- })};`;
45
+ if (id.includes("?")) return null;
46
+ const ext = extname(id).toLowerCase();
47
+ if (!isInside(root, id)) return rasterFromPackage(id, ext);
48
+ if (!MEDIA_EXTENSIONS.has(ext)) return null;
49
+ const { asset, value } = fixtureMediaModule(id, await readFile(id));
50
+ assets.set(asset.url, asset);
51
+ return `export default ${JSON.stringify(value)};`;
46
52
  }
47
53
  };
48
54
  }
55
+ async function rasterFromPackage(id, ext) {
56
+ if (!RASTER_EXTENSIONS.has(ext)) return null;
57
+ const size = imageDimensions(await readFile(id)) ?? {
58
+ width: 0,
59
+ height: 0
60
+ };
61
+ const url = `/@fs/${toPosixPath(id).replace(/^\/+/, "")}`;
62
+ return `export default ${JSON.stringify({
63
+ url,
64
+ responsive: null,
65
+ width: size.width,
66
+ height: size.height
67
+ })};`;
68
+ }
49
69
  async function createDevVite(options) {
50
70
  const { root, packageRoot } = options;
51
71
  const pathsPlugin = await createTsconfigPathsPlugin(root);
@@ -60,7 +80,7 @@ async function createDevVite(options) {
60
80
  markerSpecifier: options.markerSpecifier
61
81
  }),
62
82
  react(),
63
- authorImagePlugin(root),
83
+ fixtureMediaVitePlugin(root, options.assets),
64
84
  ...pathsPlugin === null ? [] : [pathsPlugin]
65
85
  ],
66
86
  server: {
@@ -118,4 +138,4 @@ async function settleBrowserDependencies(vite, entryUrls) {
118
138
  }
119
139
 
120
140
  //#endregion
121
- export { authorImagePlugin, createDevVite, settleBrowserDependencies };
141
+ export { createDevVite, fixtureMediaVitePlugin, settleBrowserDependencies };
@@ -1,8 +1,11 @@
1
1
  import { compileFormatVariantsToCss } from "../design-system/format-variants.js";
2
2
  import { collectCssGraph } from "./graph.js";
3
3
  import { inlineCssGraph } from "./inline.js";
4
- import { externalUrlViolations, tailwindImportViolations } from "./rules.js";
4
+ import { externalUrlViolations, retiredLayerViolations, tailwindImportViolations } from "./rules.js";
5
+ import { readFileSync } from "node:fs";
6
+ import { dirname, join } from "node:path";
5
7
  import { createHash } from "node:crypto";
8
+ import { createRequire } from "node:module";
6
9
  import { compile, optimize } from "@tailwindcss/node";
7
10
  import { Scanner } from "@tailwindcss/oxide";
8
11
 
@@ -17,10 +20,26 @@ function buildTailwindEntry(inlinedCss, template) {
17
20
  if (template.output === "website") return inlinedCss;
18
21
  return `${inlinedCss.trimEnd()}\n\n${compileFormatVariantsToCss(template.formats)}`;
19
22
  }
23
+ const TAILWIND_PACKAGE = "tailwindcss";
24
+ /**
25
+ * The framework's own file for a `tailwindcss` stylesheet import — `tailwindcss` or a
26
+ * subpath such as `tailwindcss/theme.css` — read from the package's `style` export.
27
+ * Undefined for any other specifier, and for a subpath the package does not export as
28
+ * a stylesheet, which Tailwind's own resolver then reports.
29
+ */
30
+ function resolveFrameworkTailwindCss(id) {
31
+ if (id !== TAILWIND_PACKAGE && !id.startsWith(`${TAILWIND_PACKAGE}/`)) return void 0;
32
+ const manifest = createRequire(import.meta.url).resolve(`${TAILWIND_PACKAGE}/package.json`);
33
+ const { exports } = JSON.parse(readFileSync(manifest, "utf8"));
34
+ const entry = exports[id === TAILWIND_PACKAGE ? "." : `.${id.slice(11)}`];
35
+ const file = typeof entry === "string" ? entry : entry?.style;
36
+ return file === void 0 ? void 0 : join(dirname(manifest), file);
37
+ }
20
38
  async function compileTailwind(root, entry) {
21
39
  const compiler = await compile(entry, {
22
40
  base: root,
23
- onDependency: () => {}
41
+ onDependency: () => {},
42
+ customCssResolver: (id) => Promise.resolve(resolveFrameworkTailwindCss(id))
24
43
  });
25
44
  const scanner = new Scanner({ sources: [...compiler.root === "none" ? [] : compiler.root === null ? [{
26
45
  base: root,
@@ -53,12 +72,15 @@ async function compileTemplateCss(input) {
53
72
  violations: importViolations
54
73
  };
55
74
  const css = await compileTailwind(input.root, buildTailwindEntry(inlined.css, input.template));
56
- const violations = input.template.output === "website" ? [] : await externalUrlViolations({
75
+ const violations = [...await retiredLayerViolations({
76
+ root: input.root,
77
+ sources: graph
78
+ }), ...input.template.output === "website" ? [] : await externalUrlViolations({
57
79
  root: input.root,
58
80
  templateFile: input.templateFile,
59
81
  css,
60
82
  sources: graph
61
- });
83
+ })];
62
84
  const bytes = new TextEncoder().encode(css);
63
85
  const contentHash = createHash("sha256").update(bytes).digest("hex");
64
86
  return {