@homepages/concrete 9.0.0 → 10.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 (143) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +3 -3
  3. package/codemods/manifest.json +14 -0
  4. package/codemods/registry-keys-only.mjs +113 -0
  5. package/codemods/steps/list-object-form.mjs +2 -3
  6. package/codemods/steps/registry-key-reads.mjs +276 -0
  7. package/dist/artifact/playground/client/assets/index-BFNHB7VM.css +1 -0
  8. package/dist/artifact/playground/client/assets/index-Div1yo6s.js +1259 -0
  9. package/dist/artifact/playground/client/index.html +2 -2
  10. package/dist/artifact/playground/host.mjs +42 -42
  11. package/dist/cli/build/artifact.js +2 -1
  12. package/dist/cli/build/fixtures.js +2 -1
  13. package/dist/cli/check/render/inputs.js +3 -3
  14. package/dist/cli/check/stages/sections.js +5 -6
  15. package/dist/cli/check/stages/workspace.js +2 -0
  16. package/dist/cli/check/template-key.js +16 -0
  17. package/dist/cli/dev/workspace-reader.js +9 -2
  18. package/dist/fixtures/media-store.js +3 -3
  19. package/dist/fixtures/resolve.js +28 -23
  20. package/dist/fixtures/synthesize-empties.js +3 -1
  21. package/dist/fixtures.d.ts +1 -1
  22. package/dist/index.d.ts +3 -4
  23. package/dist/packages/external/concrete/package.js +1 -1
  24. package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +1 -1
  25. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +15 -27
  26. package/dist/packages/internal/fill-bake/dist/compute-reads.js +12 -12
  27. package/dist/packages/internal/fill-bake/dist/derive-source.js +7 -14
  28. package/dist/packages/internal/fill-bake/dist/index.js +4 -3
  29. package/dist/packages/internal/fill-bake/dist/item-merge.js +36 -16
  30. package/dist/packages/internal/fill-bake/dist/item-overrides.js +1 -28
  31. package/dist/packages/internal/fill-bake/dist/linked-merge.js +5 -7
  32. package/dist/packages/internal/fill-bake/dist/list-grammar.js +11 -34
  33. package/dist/packages/internal/fill-bake/dist/stored-row-reader.js +1 -0
  34. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +12 -39
  35. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +2 -17
  36. package/dist/packages/internal/media-resolution/dist/document.js +16 -15
  37. package/dist/packages/internal/media-resolution/dist/image.js +38 -94
  38. package/dist/packages/internal/media-resolution/dist/index.js +1 -1
  39. package/dist/packages/internal/media-resolution/dist/list.js +12 -12
  40. package/dist/packages/internal/media-resolution/dist/media.js +17 -16
  41. package/dist/packages/internal/media-resolution/dist/records.js +4 -2
  42. package/dist/packages/internal/media-resolution/dist/slot.js +9 -6
  43. package/dist/packages/internal/media-resolution/dist/tour.js +12 -11
  44. package/dist/packages/internal/media-resolution/dist/video.js +16 -16
  45. package/dist/packages/internal/property-facts/dist/registry-facts.js +10 -2
  46. package/dist/packages/internal/section-contracts/dist/catalog.js +2 -10
  47. package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +5 -12
  48. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +1 -5
  49. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +7 -5
  50. package/dist/packages/internal/section-contracts/dist/grammar-scope.js +1 -1
  51. package/dist/packages/internal/section-contracts/dist/index.js +0 -2
  52. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +0 -29
  53. package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +2 -16
  54. package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +6 -6
  55. package/dist/packages/internal/section-contracts/dist/object-contract.js +4 -2
  56. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +6 -2
  57. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -15
  58. package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +6 -7
  59. package/dist/packages/internal/section-contracts/dist/row-source-contract.js +7 -8
  60. package/dist/packages/internal/section-contracts/dist/runners.js +5 -17
  61. package/dist/packages/internal/section-contracts/dist/select-contract.js +7 -1
  62. package/dist/packages/internal/section-contracts/dist/source-contract.js +20 -79
  63. package/dist/packages/internal/section-contracts/dist/sources-contract.js +1 -1
  64. package/dist/packages/internal/section-contracts/dist/table-member.js +5 -8
  65. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +5 -10
  66. package/dist/packages/internal/source-resolution/dist/index.js +21 -189
  67. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  68. package/dist/packages/internal/template-artifact/dist/layout.js +3 -1
  69. package/dist/packages/internal/template-artifact/dist/verify.js +32 -16
  70. package/dist/packages/internal/template-contracts/dist/content-pick.js +24 -1
  71. package/dist/packages/internal/template-contracts/dist/decision-fills.js +2 -6
  72. package/dist/packages/internal/template-contracts/dist/document-value.d.ts +2 -2
  73. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +3 -2
  74. package/dist/packages/internal/template-contracts/dist/fact-keys.js +19 -43
  75. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +24 -3
  76. package/dist/packages/internal/template-contracts/dist/fact-registry.js +14 -7
  77. package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +1 -1
  78. package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +3 -68
  79. package/dist/packages/internal/template-contracts/dist/fill-spec.js +7 -6
  80. package/dist/packages/internal/template-contracts/dist/list-editing.js +0 -1
  81. package/dist/packages/internal/template-contracts/dist/list.d.ts +1 -1
  82. package/dist/packages/internal/template-contracts/dist/list.js +7 -15
  83. package/dist/packages/internal/template-contracts/dist/media-candidates.js +1 -1
  84. package/dist/packages/internal/template-contracts/dist/mirror-kind.js +2 -2
  85. package/dist/packages/internal/template-contracts/dist/object.js +3 -2
  86. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +2 -2
  87. package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +2 -2
  88. package/dist/packages/internal/template-contracts/dist/read-graph.js +14 -51
  89. package/dist/packages/internal/template-contracts/dist/ref-locate.js +15 -27
  90. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +3 -1
  91. package/dist/packages/internal/template-contracts/dist/registry-facts.js +13 -24
  92. package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +20 -4
  93. package/dist/packages/internal/template-contracts/dist/registry-shape.js +69 -11
  94. package/dist/packages/internal/template-contracts/dist/row-planners.js +1 -1
  95. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +5 -14
  96. package/dist/packages/internal/template-contracts/dist/row-ref.js +7 -23
  97. package/dist/packages/internal/template-contracts/dist/row-sources.js +6 -16
  98. package/dist/packages/internal/template-contracts/dist/row.d.ts +1 -1
  99. package/dist/packages/internal/template-contracts/dist/row.js +6 -7
  100. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +5 -20
  101. package/dist/packages/internal/template-contracts/dist/section-schema-types.d.ts +1 -0
  102. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +29 -37
  103. package/dist/packages/internal/template-contracts/dist/slot-builders.js +4 -7
  104. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +2 -733
  105. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +2 -502
  106. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +4 -1
  107. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +4 -4
  108. package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -2
  109. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +9 -10
  110. package/dist/packages/internal/template-contracts/dist/table-members.d.ts +5 -12
  111. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -37
  112. package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +2 -2
  113. package/dist/primitives/Image.d.ts +3 -3
  114. package/dist/primitives/slot-bindings.js +2 -2
  115. package/dist/primitives/slot-download.d.ts +1 -1
  116. package/dist/primitives/slot-media.d.ts +1 -1
  117. package/dist/rules/registry.js +6 -0
  118. package/dist/schema/fact.d.ts +19 -52
  119. package/dist/schema/fact.js +6 -25
  120. package/dist/schema/facts-view.d.ts +1 -2
  121. package/dist/schema/property-facts.d.ts +1 -62
  122. package/dist/schema/section-schema.d.ts +2 -2
  123. package/dist/schema/section-schema.js +1 -1
  124. package/dist/section/section.d.ts +2 -2
  125. package/guide/reference/cli/INDEX.md +2 -2
  126. package/guide/reference/cli/build.md +1 -1
  127. package/guide/reference/cli/check.md +1 -1
  128. package/guide/reference/cli/dev.md +1 -1
  129. package/guide/reference/cli/property-add.md +1 -1
  130. package/guide/reference/cli/property-list.md +1 -1
  131. package/guide/reference/cli/publish.md +1 -1
  132. package/guide/reference/cli/upgrade.md +1 -1
  133. package/guide/reference/rules/INDEX.md +4 -5
  134. package/package.json +1 -1
  135. package/dist/artifact/playground/client/assets/index-BUmdDDX5.js +0 -1259
  136. package/dist/artifact/playground/client/assets/index-DDOcM0zA.css +0 -1
  137. package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +0 -15
  138. package/dist/packages/internal/section-contracts/dist/group-contract.js +0 -19
  139. package/dist/packages/internal/section-contracts/dist/option-source-contract.js +0 -22
  140. package/dist/packages/internal/template-contracts/dist/comparable-address.js +0 -19
  141. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +0 -62
  142. package/dist/packages/internal/template-contracts/dist/legacy-facts.js +0 -167
  143. package/dist/packages/internal/template-contracts/dist/registry-aliases.js +0 -77
@@ -1,4 +1,4 @@
1
- var Fo=/^(\d+(?:\.\d+)?)(in|mm)$/;function kt(e){let t=Fo.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 W(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,panels:1,sheetWidth:e.width,sheetHeight:e.height,sheetPointWidth:e.width/96*72,sheetPointHeight:e.height/96*72};let t=e,n=kt(t.width),r=kt(t.height),o=t.bleed===void 0?0:kt(t.bleed),i=n*96,s=r*96,a=o*96,l=i+2*a,d=s+2*a,m=t.dpi/96,g=t.panels??1;return{frameWidth:i,frameHeight:s,bleed:a,viewportWidth:l,viewportHeight:d,deviceScaleFactor:m,pixelWidth:Math.round(l*m),pixelHeight:Math.round(d*m),pointWidth:(n+2*o)*72,pointHeight:(r+2*o)*72,bleedPoints:o*72,panels:g,sheetWidth:g*i+2*a,sheetHeight:d,sheetPointWidth:(g*n+2*o)*72,sheetPointHeight:(r+2*o)*72}}var Pe="concrete-frame",Ce="concrete-sheet";function Fe(e){let t=W(e);return{"--frame-w":`${t.frameWidth}px`,"--frame-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}function xt(e){let t=W(e);return{"--sheet-w":`${t.panels*t.frameWidth}px`,"--sheet-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}var Xe="data-tr-island",In="__trCaptureHolds";var St=`(function () {
1
+ var ms=/^(\d+(?:\.\d+)?)(in|mm)$/;function gn(e){let t=ms.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 ne(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,panels:1,sheetWidth:e.width,sheetHeight:e.height,sheetPointWidth:e.width/96*72,sheetPointHeight:e.height/96*72};let t=e,n=gn(t.width),r=gn(t.height),o=t.bleed===void 0?0:gn(t.bleed),i=n*96,s=r*96,a=o*96,l=i+2*a,d=s+2*a,f=t.dpi/96,p=t.panels??1;return{frameWidth:i,frameHeight:s,bleed:a,viewportWidth:l,viewportHeight:d,deviceScaleFactor:f,pixelWidth:Math.round(l*f),pixelHeight:Math.round(d*f),pointWidth:(n+2*o)*72,pointHeight:(r+2*o)*72,bleedPoints:o*72,panels:p,sheetWidth:p*i+2*a,sheetHeight:d,sheetPointWidth:(p*n+2*o)*72,sheetPointHeight:(r+2*o)*72}}var Je="concrete-frame",Ze="concrete-sheet";function Qe(e){let t=ne(e);return{"--frame-w":`${t.frameWidth}px`,"--frame-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}function bn(e){let t=ne(e);return{"--sheet-w":`${t.panels*t.frameWidth}px`,"--sheet-h":`${t.frameHeight}px`,"--frame-bleed":`${t.bleed}px`}}var $t="data-tr-island",qr="__trCaptureHolds";var kn=`(function () {
2
2
  function CaptureIntersectionObserver(callback, options) {
3
3
  var opts = options || {};
4
4
  this.root = opts.root || null;
@@ -46,34 +46,34 @@ var Fo=/^(\d+(?:\.\d+)?)(in|mm)$/;function kt(e){let t=Fo.exec(e),[,n,r]=t??[];i
46
46
  return entries;
47
47
  };
48
48
  window.IntersectionObserver = CaptureIntersectionObserver;
49
- })();`,Lo=`!!document.querySelector("[${Xe}]")`,vt="__trIslandsReady",No=`(async () => {
50
- const ready = window.${vt};
49
+ })();`,ys=`!!document.querySelector("[${$t}]")`,wn="__trIslandsReady",gs=`(async () => {
50
+ const ready = window.${wn};
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.${vt} \u2014 the island runtime never ran",
54
+ "window.${wn} \u2014 the island runtime never ran",
55
55
  );
56
56
  }
57
57
  await ready;
58
- })()`,Wa=`(() => {
59
- const holds = window.${In};
58
+ })()`,Ud=`(() => {
59
+ const holds = window.${qr};
60
60
  const keys = [...new Set(Array.from(
61
- document.querySelectorAll("[${Xe}]"),
62
- (el) => el.getAttribute("${Xe}"),
61
+ document.querySelectorAll("[${$t}]"),
62
+ (el) => el.getAttribute("${$t}"),
63
63
  ))];
64
64
  return JSON.stringify({ openHolds: holds ? holds.size : 0, islands: keys });
65
- })()`;var Tn=400;var Do=`(async () => {
65
+ })()`;var Vr=400;var bs=`(async () => {
66
66
  await new Promise((resolve) => {
67
- setTimeout(resolve, ${Tn});
67
+ setTimeout(resolve, ${Vr});
68
68
  });
69
69
  await new Promise((resolve) => {
70
70
  requestAnimationFrame(() => resolve(undefined));
71
71
  });
72
- })()`,jn=5,Ho=`(async () => {
72
+ })()`,Wr=5,ws=`(async () => {
73
73
  const frame = () => new Promise((resolve) => {
74
74
  requestAnimationFrame(() => resolve(undefined));
75
75
  });
76
- for (let pass = 0; pass < ${jn}; pass += 1) {
76
+ for (let pass = 0; pass < ${Wr}; pass += 1) {
77
77
  const running = document.getAnimations().filter((animation) => {
78
78
  if (animation.playState === "finished" || animation.playState === "idle") return false;
79
79
  const timing = animation.effect && animation.effect.getComputedTiming();
@@ -90,64 +90,64 @@ var Fo=/^(\d+(?:\.\d+)?)(in|mm)$/;function kt(e){let t=Fo.exec(e),[,n,r]=t??[];i
90
90
  await frame();
91
91
  }
92
92
  await frame();
93
- })()`;function b(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ne(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function Pn(e){return Je(e.id,{...Fe(e)})}function Je(e,t){let n=Object.entries(t).map(([r,o])=>`${r}:${o}`).join(";");return{class:Pe,dataFormat:e,style:n}}function Ze(e,t){let n=Pn(e);return`<div class="${b(n.class)}" data-format="${b(n.dataFormat)}" style="${b(n.style)}">${t.join("")}</div>`}function Rt(e,t){let n=Object.entries(xt(e)).map(([r,o])=>`${r}:${o}`).join(";");return`<div class="${b(Ce)}" style="${b(n)}">${t.join("")}</div>`}function we(e){switch(e.destination){case"published":return Uo(e);case"artifact":return qo(e);case"preview":return Ko(e);case"canvas":return Bo(e)}}function Cn(e){return e.kind==="none"||Object.keys(e.islandMap).length===0?[]:[`<script>${St}</script>`]}var Fn="html, body { margin: 0; padding: 0; }";function Mn(e){let t=[`rel="${e.rel}"`,`href="${b(e.href)}"`];return e.sizes!==void 0&&t.push(`sizes="${b(e.sizes)}"`),e.type!==void 0&&t.push(`type="${b(e.type)}"`),`<link ${t.join(" ")} />`}function Uo(e){let{meta:t}=e,n=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${b(t.title)}</title>`,`<meta name="description" content="${b(t.description)}" />`];t.canonical&&n.push(`<link rel="canonical" href="${b(t.canonical)}" />`);for(let o of t.icons??[])n.push(Mn(o));n.push('<meta property="og:type" content="website" />'),t.siteName&&n.push(`<meta property="og:site_name" content="${b(t.siteName)}" />`),n.push(`<meta property="og:title" content="${b(t.title)}" />`),n.push(`<meta property="og:description" content="${b(t.description)}" />`),t.ogUrl&&n.push(`<meta property="og:url" content="${b(t.ogUrl)}" />`),t.ogImage&&(n.push(`<meta property="og:image" content="${b(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="${b(t.ogImageType)}" />`),t.ogImageAlt&&n.push(`<meta property="og:image:alt" content="${b(t.ogImageAlt)}" />`),n.push('<meta name="twitter:card" content="summary_large_image" />'),n.push(`<meta name="twitter:title" content="${b(t.title)}" />`),n.push(`<meta name="twitter:description" content="${b(t.description)}" />`),n.push(`<meta name="twitter:image" content="${b(t.ogImage)}" />`)),n.push(...$t(e.stylesheets)),n.push(...Ot(e.islands)),e.prefetchUrls&&e.prefetchUrls.length>0&&n.push(`<script type="speculationrules">${ne({prefetch:[{source:"list",urls:[...e.prefetchUrls]}]})}</script>`);let r=e.siteConfig?`
94
- <script type="application/json" id="concrete-site-config">${ne(e.siteConfig)}</script>`:"";return Et({lang:t.lang??"en",head:n,body:` <body class="concrete-root">
95
- ${e.root.bodyHtml}${r}${At(e.islands,"viewport")}
96
- <script type="module" src="${b(e.analyticsJs.url)}"></script>
97
- </body>`})}function qo(e){let t=['<meta charset="utf-8" />'];e.title!==void 0&&t.push(`<title>${b(e.title)}</title>`),t.push(...$t(e.stylesheets));let n=[Fn,...Go(e.root)];return t.push(Ln(n)),t.push(...Cn(e.islands)),t.push(...Ot(e.islands)),Et({lang:"en",head:t,body:` <body>${zo(e.root)}${At(e.islands,"eager")}</body>`})}function Ko(e){let t=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${b(e.title)}</title>`,...e.icon===void 0?[]:[Mn({rel:"icon",href:e.icon})],...$t(e.stylesheets),Ln([Fn,...e.extraCss??[]]),...e.capture===!0?Cn(e.islands):[],...Ot(e.islands)],n=(e.devScripts??[]).map(r=>`
98
- ${r}`).join("");return Et({lang:"en",head:t,body:` <body>
99
- ${e.root.bodyHtml}${At(e.islands,e.capture===!0?"eager":"viewport")}${n}
100
- </body>`})}function Bo(e){let t=e.stylesheets.hrefs.map(n=>`<link rel="stylesheet" href="${b(n)}">`).join("");return`<!doctype html>
93
+ })()`;function R(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function Br(e){return Et(e.id,{...Qe(e)})}function Et(e,t){let n=Object.entries(t).map(([r,o])=>`${r}:${o}`).join(";");return{class:Je,dataFormat:e,style:n}}function It(e,t){let n=Br(e);return`<div class="${R(n.class)}" data-format="${R(n.dataFormat)}" style="${R(n.style)}">${t.join("")}</div>`}function vn(e,t){let n=Object.entries(bn(e)).map(([r,o])=>`${r}:${o}`).join(";");return`<div class="${R(Ze)}" style="${R(n)}">${t.join("")}</div>`}function Fe(e){switch(e.destination){case"published":return ks(e);case"artifact":return vs(e);case"preview":return xs(e);case"canvas":return Ss(e)}}function zr(e){return e.kind==="none"||Object.keys(e.islandMap).length===0?[]:[`<script>${kn}</script>`]}var Gr="html, body { margin: 0; padding: 0; }";function Yr(e){let t=[`rel="${e.rel}"`,`href="${R(e.href)}"`];return e.sizes!==void 0&&t.push(`sizes="${R(e.sizes)}"`),e.type!==void 0&&t.push(`type="${R(e.type)}"`),`<link ${t.join(" ")} />`}function ks(e){let{meta:t}=e,n=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${R(t.title)}</title>`,`<meta name="description" content="${R(t.description)}" />`];t.canonical&&n.push(`<link rel="canonical" href="${R(t.canonical)}" />`);for(let o of t.icons??[])n.push(Yr(o));n.push('<meta property="og:type" content="website" />'),t.siteName&&n.push(`<meta property="og:site_name" content="${R(t.siteName)}" />`),n.push(`<meta property="og:title" content="${R(t.title)}" />`),n.push(`<meta property="og:description" content="${R(t.description)}" />`),t.ogUrl&&n.push(`<meta property="og:url" content="${R(t.ogUrl)}" />`),t.ogImage&&(n.push(`<meta property="og:image" content="${R(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="${R(t.ogImageType)}" />`),t.ogImageAlt&&n.push(`<meta property="og:image:alt" content="${R(t.ogImageAlt)}" />`),n.push('<meta name="twitter:card" content="summary_large_image" />'),n.push(`<meta name="twitter:title" content="${R(t.title)}" />`),n.push(`<meta name="twitter:description" content="${R(t.description)}" />`),n.push(`<meta name="twitter:image" content="${R(t.ogImage)}" />`)),n.push(...Sn(e.stylesheets)),n.push(...Rn(e.islands)),e.prefetchUrls&&e.prefetchUrls.length>0&&n.push(`<script type="speculationrules">${ue({prefetch:[{source:"list",urls:[...e.prefetchUrls]}]})}</script>`);let r=e.siteConfig?`
94
+ <script type="application/json" id="concrete-site-config">${ue(e.siteConfig)}</script>`:"";return xn({lang:t.lang??"en",head:n,body:` <body class="concrete-root">
95
+ ${e.root.bodyHtml}${r}${_n(e.islands,"viewport")}
96
+ <script type="module" src="${R(e.analyticsJs.url)}"></script>
97
+ </body>`})}function vs(e){let t=['<meta charset="utf-8" />'];e.title!==void 0&&t.push(`<title>${R(e.title)}</title>`),t.push(...Sn(e.stylesheets));let n=[Gr,...$s(e.root)];return t.push(Xr(n)),t.push(...zr(e.islands)),t.push(...Rn(e.islands)),xn({lang:"en",head:t,body:` <body>${Os(e.root)}${_n(e.islands,"eager")}</body>`})}function xs(e){let t=['<meta charset="utf-8" />','<meta name="viewport" content="width=device-width, initial-scale=1" />',`<title>${R(e.title)}</title>`,...e.icon===void 0?[]:[Yr({rel:"icon",href:e.icon})],...Sn(e.stylesheets),Xr([Gr,...e.extraCss??[]]),...e.capture===!0?zr(e.islands):[],...Rn(e.islands)],n=(e.devScripts??[]).map(r=>`
98
+ ${r}`).join("");return xn({lang:"en",head:t,body:` <body>
99
+ ${e.root.bodyHtml}${_n(e.islands,e.capture===!0?"eager":"viewport")}${n}
100
+ </body>`})}function Ss(e){let t=e.stylesheets.hrefs.map(n=>`<link rel="stylesheet" href="${R(n)}">`).join("");return`<!doctype html>
101
101
  <html>
102
102
  <head>
103
103
  <meta charset="utf-8">
104
- <base href="${b(e.base)}">
104
+ <base href="${R(e.base)}">
105
105
  <!-- Cascade-layer order is fixed by FIRST declaration, document-wide. The
106
106
  kernel's document defaults must lose to everything a template declares,
107
107
  so their layer is pre-declared here, before any template stylesheet,
108
108
  pinning it below every layer those go on to declare. -->
109
109
  <style>@layer ${e.defaultsLayer};</style>
110
- ${t}${Vo(e.islands)}
110
+ ${t}${_s(e.islands)}
111
111
  <style>${e.frameCss}</style>
112
112
  </head>
113
113
  <body>
114
- <div id="${b(e.root.id)}"${Wo(e.root)}></div>
114
+ <div id="${R(e.root.id)}"${Rs(e.root)}></div>
115
115
  </body>
116
- </html>`}function Wo(e){if(!e.pageBox)return"";let t=Je(e.pageBox.formatId,e.pageBox.tokens);return` class="${b(t.class)}" data-format="${b(t.dataFormat)}" style="${b(t.style)}"`}function Vo(e){if(e.kind==="none"||Object.keys(e.islandMap).length===0)return"";let t=e.hostScriptSrc?`
117
- <script id="tr-island-host" type="module" src="${b(e.hostScriptSrc)}"></script>`:"";return`${Object.keys(e.importMap).length===0?"":`
118
- <script type="importmap">${ne({imports:e.importMap})}</script>`}
119
- <script>window.__TR_ISLAND_MAP=${ne(e.islandMap)};</script>
116
+ </html>`}function Rs(e){if(!e.pageBox)return"";let t=Et(e.pageBox.formatId,e.pageBox.tokens);return` class="${R(t.class)}" data-format="${R(t.dataFormat)}" style="${R(t.style)}"`}function _s(e){if(e.kind==="none"||Object.keys(e.islandMap).length===0)return"";let t=e.hostScriptSrc?`
117
+ <script id="tr-island-host" type="module" src="${R(e.hostScriptSrc)}"></script>`:"";return`${Object.keys(e.importMap).length===0?"":`
118
+ <script type="importmap">${ue({imports:e.importMap})}</script>`}
119
+ <script>window.__TR_ISLAND_MAP=${ue(e.islandMap)};</script>
120
120
  <!-- id is the contract the host's readiness gate keys off \u2014 it waits on THIS
121
121
  element's load event, not a timeout, so a slow cold first load still
122
- activates without a refresh. -->${t}`}function Et(e){let t=e.head.map(n=>` ${n}`).join(`
122
+ activates without a refresh. -->${t}`}function xn(e){let t=e.head.map(n=>` ${n}`).join(`
123
123
  `);return`<!doctype html>
124
- <html lang="${b(e.lang)}">
124
+ <html lang="${R(e.lang)}">
125
125
  <head>
126
126
  ${t}
127
127
  </head>
128
128
  ${e.body}
129
129
  </html>
130
- `}function zo(e){if(e.kind==="frame")return Ze(e.format,e.sectionHtml);let t=e.pages.map(o=>Ze(e.format,o)),{panels:n}=W(e.format);if(n===1)return t.join(`
131
- `);if(t.length%n!==0)throw new Error(`page-shell: format "${e.format.id}" folds ${n} panels to a sheet, but the stack has ${t.length} pages, not a whole number of sheets`);let r=[];for(let o=0;o<t.length;o+=n)r.push(Rt(e.format,t.slice(o,o+n)));return r.join(`
132
- `)}function Go(e){if(e.kind!=="frameStack")return[];let t=W(e.format).panels===1?Pe:Ce;return[`body > .${t} { break-after: page; }`,`body > .${t}:last-child { break-after: auto; }`]}function $t(e){return e.kind==="links"?e.hrefs.map(t=>`<link rel="stylesheet" href="${b(t)}" />`):e.css.map(t=>`<style>${t}</style>`)}function Ln(e){let[t,...n]=e;return t===void 0?"<style></style>":n.length===0?`<style>${t}</style>`:`<style>${t}
130
+ `}function Os(e){if(e.kind==="frame")return It(e.format,e.sectionHtml);let t=e.pages.map(o=>It(e.format,o)),{panels:n}=ne(e.format);if(n===1)return t.join(`
131
+ `);if(t.length%n!==0)throw new Error(`page-shell: format "${e.format.id}" folds ${n} panels to a sheet, but the stack has ${t.length} pages, not a whole number of sheets`);let r=[];for(let o=0;o<t.length;o+=n)r.push(vn(e.format,t.slice(o,o+n)));return r.join(`
132
+ `)}function $s(e){if(e.kind!=="frameStack")return[];let t=ne(e.format).panels===1?Je:Ze;return[`body > .${t} { break-after: page; }`,`body > .${t}:last-child { break-after: auto; }`]}function Sn(e){return e.kind==="links"?e.hrefs.map(t=>`<link rel="stylesheet" href="${R(t)}" />`):e.css.map(t=>`<style>${t}</style>`)}function Xr(e){let[t,...n]=e;return t===void 0?"<style></style>":n.length===0?`<style>${t}</style>`:`<style>${t}
133
133
  ${n.join(`
134
134
  `)}
135
- </style>`}function Ot(e){if(e.kind!=="bundles")return[];let t=[],n=e.reactVendorMap;if(n&&Object.keys(n).length>0&&t.push(`<script type="importmap">${ne({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="${b(r)}" />`);return t}function At(e,t){if(e.kind==="none"||Object.keys(e.islandMap).length===0)return"";let n=ne(e.islandMap),r=t==="eager"?' window.__TR_ISLAND_SCHEDULE = "eager";':"";return e.kind==="bundles"?`
135
+ </style>`}function Rn(e){if(e.kind!=="bundles")return[];let t=[],n=e.reactVendorMap;if(n&&Object.keys(n).length>0&&t.push(`<script type="importmap">${ue({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="${R(r)}" />`);return t}function _n(e,t){if(e.kind==="none"||Object.keys(e.islandMap).length===0)return"";let n=ue(e.islandMap),r=t==="eager"?' window.__TR_ISLAND_SCHEDULE = "eager";':"";return e.kind==="bundles"?`
136
136
  <script>window.__TR_ISLAND_MAP=${n};${r}</script>
137
- <script type="module" src="${b(e.runtime.url)}"></script>`:`
138
- ${Yo}
137
+ <script type="module" src="${R(e.runtime.url)}"></script>`:`
138
+ ${Es}
139
139
  <script>window.__TR_ISLAND_MAP = ${n};${r}</script>
140
- <script type="module" src="${b(e.bootstrapUrl)}"></script>`}var Yo=`<script type="module">
140
+ <script type="module" src="${R(e.bootstrapUrl)}"></script>`}var Es=`<script type="module">
141
141
  import RefreshRuntime from "/@react-refresh";
142
142
  RefreshRuntime.injectIntoGlobalHook(window);
143
143
  window.$RefreshReg$ = () => {};
144
144
  window.$RefreshSig$ = () => (type) => type;
145
145
  window.__vite_plugin_react_preamble_installed__ = true;
146
- </script>`;function Nn(){let e={};return new Proxy(e,{get:(t,n)=>typeof n!="string"||n in e||n==="then"||n==="toJSON"?e[n]:`#${n}`})}function Dn(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 fe={catalog:"api/catalog",render:"api/render",media:e=>`api/media${Dn({fixture:e})}`,capture:(e,t)=>`api/capture/${e}${Dn({fixture:t.fixture,format:t.format,page:t.page,canvas:t.canvas})}`,live:(e,t)=>`fixtures/${encodeURIComponent(e)}/live${t==="/"?"/":`${t}/`}`,hmr:"__hmr"};var Xo=["text","number","select","image","list","poi","url","date","email","phone","address","video","tour","document","media"],Jo=[],yl=[...Xo,...Jo];var It=["id","slot","index","def","value","present","enclosing"],Qe=["image","video","tour","document"];function F(e){return Qe.includes(e)}var _e={cutout:{label:"Background removed",kinds:["image"],site:"holder",options:{enclosed:{required:!1,type:"string",values:["clear","keep"]}}},autocrop:{label:"Cropped to its subject",kinds:["image"],site:"holder",options:{brief:{required:!0,type:"string"}}},probe:{label:"Probed",kinds:["image","video","document"],site:"kind",options:{}},understand:{label:"Understood",kinds:["image","video","document","tour"],site:"kind",options:{}},preview:{label:"Preview",kinds:["image","video","document"],site:"kind",options:{}},ladder:{label:"Renditions",kinds:["image","video","document"],site:"kind",options:{}},transcode:{label:"Transcoded",kinds:["video"],site:"kind",options:{}},poster:{label:"Poster",kinds:["video","document"],site:"kind",options:{}},rasterize:{label:"Pages rasterized",kinds:["document"],site:"kind",options:{}},fetch:{label:"Link fetched",kinds:["video","tour"],site:"kind",options:{}},tour_details:{label:"Tour details",kinds:["tour"],site:"kind",options:{}},crop:{label:"Cut to its crop",kinds:["image"],site:"place",options:{}}},Kn=Object.keys(_e),Zo=Kn.filter(e=>_e[e].site==="holder"),gl=Kn.filter(e=>_e[e].site==="kind");function Hn(e){return typeof e=="string"&&Object.hasOwn(_e,e)}function Qo(e){if(typeof e=="string")return Hn(e)?{kind:"process",verb:e}:null;if(typeof e!="object"||e===null||Array.isArray(e))return null;let{kind:t,verb:n}=e;return t==="process"&&Hn(n)?e:null}function Tt(e){let t=_e[e.verb],n=Object.keys(t.options),r=n.length>0?`it takes ${n.map(o=>`\`${o}\``).join(", ")}`:"it takes none";for(let[o,i]of Object.entries(e)){if(o==="kind"||o==="verb"||i===void 0)continue;if(o==="reads")return`\`${e.verb}\` takes no \`reads\` \u2014 a process is about one asset, never the property`;let s=t.options[o];if(s===void 0){let a=o==="aspect"&&e.verb==="autocrop"?"; its aspect is the holder's `crop` \u2014 the aspect it locks, free form where it locks none":"";return`\`${e.verb}\` takes no option "${o}" \u2014 ${r}${a}`}if(s.values!==void 0){if(typeof i!="string"||!s.values.includes(i))return`\`${e.verb}\`'s \`${o}\` is one of ${s.values.map(a=>`"${a}"`).join(", ")}`;continue}if(typeof i!==s.type||typeof i=="string"&&i.trim()==="")return`\`${e.verb}\`'s \`${o}\` is a non-empty ${s.type}`}for(let[o,i]of Object.entries(t.options))if(i.required&&e[o]===void 0)return`\`${e.verb}\` requires \`${o}\``;return null}function V(e){let{type:t,kinds:n}=e;if(t==="media"){let r=Array.isArray(n)?n.filter(o=>typeof o=="string"&&F(o)):[];return r.length>0?r:Qe}return typeof t=="string"&&F(t)?[t]:[]}function jt(e){let{kinds:t,process:n}=e;if(t!==void 0){if(e.type!=="media")return"declares `kinds` \u2014 only `media()` leaves its kind open; a kind's own builder fixes it";if(!Array.isArray(t)||t.length===0||!t.every(i=>typeof i=="string"&&F(i)))return`declares \`kinds\` ${JSON.stringify(t)} \u2014 a non-empty list of ${Qe.join(", ")}`}if(n===void 0)return null;let r=Zo.map(i=>`process.${i}()`).join(", ");if(!Array.isArray(n)||n.length===0)return`declares \`process\` ${JSON.stringify(n)} \u2014 a non-empty list of processes (${r})`;let o=new Set;for(let i of n){let s=Qo(i);if(s===null)return`processes ${JSON.stringify(i)}, which is no process (${r})`;let{verb:a}=s,l=_e[a];if(l.site==="kind")return`processes "${a}", which every ${l.kinds.join(", ")} gets from birth on its kind's row \u2014 never a holder's to declare`;if(l.site==="place")return`processes "${a}", which every ${l.kinds.join(", ")} place gets wherever its value carries a crop \u2014 never a holder's to declare`;if(o.has(a))return`processes "${a}" twice \u2014 a holder declares each process once`;o.add(a);let d=Tt(s);if(d!==null)return`processes "${a}" with options that do not fit: ${d}`;let m=V(e).filter(g=>!l.kinds.includes(g));if(m.length>0)return`processes "${a}", which applies to ${l.kinds.join(", ")} and not to ${m.join(", ")}`}return null}var ei={property:{latitude:"lat",longitude:"lon"},contact:{address:"contact_address"}},ti={address:{role:"bindable",container:"property",value_type:"text",fields:{display:{value_type:"text"},street:{value_type:"text"},street_no_type:{value_type:"text"},city:{value_type:"text"},state:{value_type:"text"},postal:{value_type:"text"},unit:{value_type:"text"}}},address_street:{role:"bindable",container:"property",value_type:"text"},address_unit:{role:"bindable",container:"property",value_type:"text"},address_city:{role:"bindable",container:"property",value_type:"text"},address_state:{role:"bindable",container:"property",value_type:"text"},address_postal:{role:"bindable",container:"property",value_type:"text"},listing_intent:{role:"bindable",container:"property",value_type:"text",writeback:{kind:"property",column:"listing_intent"}},lat:{role:"bindable",container:"property",value_type:"number"},lon:{role:"bindable",container:"property",value_type:"number"}},Bn={units:{role:"bindable",container:"property",value_type:"unit_list",row:{unit_id:{path:"unit_id",value_type:"text"},position:{path:"position",value_type:"number"},floor_plans:{path:"floor_plans",value_type:"image_list",row:{id:{value_type:"text"},floor_label:{value_type:"text"},position:{value_type:"number"}}},unit_label:{path:"unit_label",value_type:"text",primary:!0,writeback:{column:"unit_label"}},beds:{path:"beds",value_type:"number",primary:!0,writeback:{column:"beds"}},baths:{path:"baths",value_type:"number",primary:!0,writeback:{column:"baths"}},sqft:{path:"sqft",value_type:"number",primary:!0,writeback:{column:"sqft"}},price:{path:"price",value_type:"text",primary:!0,writeback:{column:"price"}}}},comparables:{role:"bindable",container:"property",value_type:"comparable_list",row:{id:{path:"id",value_type:"text"},address_street:{path:"address_street",value_type:"text"},address_city:{path:"address_city",value_type:"text"},address_state:{path:"address_state",value_type:"text"},address_postal:{path:"address_postal",value_type:"text"},address:{path:"address",value_type:"text"},lat:{path:"lat",value_type:"number"},lng:{path:"lng",value_type:"number"},distance_m:{path:"distance_m",value_type:"number"},status:{path:"status",value_type:"text"},price:{path:"price",value_type:"number",writeback:{column:"price"}},price_period:{path:"price_period",value_type:"text"},sale_date:{path:"sale_date",value_type:"text",writeback:{column:"sale_date"}},beds:{path:"beds",value_type:"number",writeback:{column:"beds"}},baths:{path:"baths",value_type:"number",writeback:{column:"baths"}},sqft:{path:"sqft",value_type:"number",writeback:{column:"sqft"}},photo:{path:"photo_upload_id",value_type:"image"},year_built:{path:"year_built",value_type:"number"},lot_sqft:{path:"lot_sqft",value_type:"number"},stories:{path:"stories",value_type:"number"},units:{path:"units",value_type:"number"},hoa_monthly:{path:"hoa_monthly",value_type:"number"},list_price:{path:"list_price",value_type:"number"},listed_date:{path:"listed_date",value_type:"text"},mls_number:{path:"mls_number",value_type:"text"},description:{path:"description",value_type:"text"}}},contacts:{role:"bindable",container:"property",value_type:"contact_list",row:{id:{path:"id",value_type:"text"},primary:{path:"primary",value_type:"boolean"},name:{path:"name",value_type:"text",primary:!0,writeback:{column:"name"}},title:{path:"title",value_type:"text",primary:!0,writeback:{column:"title"}},org_name:{path:"org_name",value_type:"text",primary:!0,writeback:{column:"org_name"}},bio:{path:"bio",value_type:"text",primary:!0,writeback:{column:"bio"}},address:{path:"address",value_type:"text",primary:!0},email:{path:"email",value_type:"text",primary:!0,writeback:{column:"email"}},phone:{path:"phone",value_type:"text",primary:!0,writeback:{column:"phone"}},website:{path:"website_url",value_type:"text",primary:!0,writeback:{column:"website"}},instagram:{path:"instagram_url",value_type:"text",primary:!0,writeback:{column:"socials.instagram"}},linkedin:{path:"linkedin_url",value_type:"text",primary:!0,writeback:{column:"socials.linkedin"}},x:{path:"x_url",value_type:"text",primary:!0,writeback:{column:"socials.x"}},facebook:{path:"facebook_url",value_type:"text",primary:!0,writeback:{column:"socials.facebook"}},headshot:{path:"avatar_upload_id",value_type:"image",primary:!0},logo_dark:{path:"logo_dark_upload_id",value_type:"image",primary:!0},logo_light:{path:"logo_light_upload_id",value_type:"image",primary:!0}}}},Wn={description:{role:"readable",path:"narrative.description",value_type:"text"},unit:{role:"readable",path:"units",value_type:"row",primary_of:"units"},contact:{role:"readable",path:"contacts",value_type:"row",primary_of:"contacts"}};function Un(e){let t=Bn[Wn[e].primary_of],n=ei[e]??{},r={};for(let[o,i]of Object.entries(t.row)){if(i.primary!==!0)continue;let s={role:"bindable",container:e,value_type:i.value_type};i.value_type==="image"&&(s.image=!0),i.writeback!==void 0&&(s.writeback=e==="unit"?{kind:"unit",column:i.writeback.column}:{kind:"contact",field:i.writeback.column}),r[n[o]??o]=s}return r}function ni(){return{...ti,...Un("unit"),...Bn,...Un("contact"),...Wn}}var Me=ni();var ke={units:{idKey:"unit_id",ownership:"property"},contacts:{idKey:"id",cap:12,min:1,ownership:"library"},comparables:{idKey:"id",ownership:"property"}},ri={units:"property.units",contacts:"property.contacts",comparables:"property.comparables",commercial_spaces:"property.commercial_spaces"},Pt={contacts:"library.contacts"};function Ct(e){return Object.hasOwn(ke,e)}var qn=Object.fromEntries([...Object.entries(ri),...Object.entries(Pt)].map(([e,t])=>[t,e]));function S(e){if(typeof e!="string")return null;if(Object.hasOwn(ke,e))return{table:e,reading:"legacy"};let t=Object.hasOwn(qn,e)?qn[e]:void 0;return t===void 0?null:{table:t,reading:"registry"}}var oi={matterport:{kind:"tour",label:"Matterport",pattern:/(^|\.)matterport\.com$/i,strategy:"api"},biganto:{kind:"tour",label:"Biganto",pattern:/(^|\.)biganto\.com$/i,strategy:"opengraph"},iguide:{kind:"tour",label:"iGUIDE",pattern:/(^|\.)youriguide\.com$/i,strategy:"opengraph"},kuula:{kind:"tour",label:"Kuula",pattern:/(^|\.)kuula\.co$/i,strategy:"opengraph"},momento360:{kind:"tour",label:"Momento360",pattern:/(^|\.)momento360\.com$/i,strategy:"opengraph"},cloudpano:{kind:"tour",label:"CloudPano",pattern:/(^|\.)cloudpano\.com$/i,strategy:"none"},asteroom:{kind:"tour",label:"Asteroom",pattern:/(^|\.)asteroom\.com$/i,strategy:"none"},zillow3d:{kind:"tour",label:"Zillow 3D Home",pattern:/(^|\.)zillow\.com$/i,path:/^\/view-3d-home\//i,strategy:"none"},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 Vn(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(oi))if(r.pattern.test(t.hostname)&&!(r.path&&!r.path.test(t.pathname)))return n;return null}var ii="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 zn(e){let t=e.trim();if(!t)return null;let n=Vn(t);if(n==="vimeo"){let r=t.match(/vimeo\.com\/(?:.*\/)?(\d+)/);return r?`https://player.vimeo.com/video/${r[1]}?${ii}`: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 Gn(e){let t=e.trim();if(!t)return null;let n=Vn(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!==null&&si.has(n)?t:null}var si=new Set(["biganto","iguide","kuula","momento360","cloudpano","asteroom","zillow3d"]);var ai=["crop","cutout","mask_white","mask_black"];function Mt(e){return e!==null&&!(e.x<=0&&e.y<=0&&e.width>=1&&e.height>=1)}function li(e){return e.url!==null?e.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,""):e.key?.split("/").pop()??e.id}function Lt(e,t){let{id:n,renditions:r,...o}=e,i=e.kind==="image";return{...o,id:t.id,file:t.file,crop:i?t.crop:null,name:t.name!==null&&t.name!==""?t.name:li(e),renditions:{...r,crop:i?t.renditions.crop:null,cutout:i?t.renditions.cutout:null,mask_white:i?t.renditions.mask_white:null,mask_black:i?t.renditions.mask_black:null}}}function Yn(e){return e.url===null?"upload":"link"}function z(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xn(e){if(!z(e))return!1;let{id:t,kind:n,renditions:r}=e;return typeof t=="string"&&typeof n=="string"&&F(n)&&z(r)}function Jn(e){return z(e)&&typeof e.id=="string"&&typeof e.file=="string"&&z(e.renditions)&&!("kind"in e)}function ci(e){return z(e)&&typeof e.file=="string"&&"picked"in e&&z(e.renditions)&&!("id"in e)}function et(e){return z(e)&&typeof e.media=="string"&&e.media!==""}function di(e){let t=e.asset_id;return typeof t=="string"&&t!==""?t:void 0}function xe(e){if(z(e))return et(e)?e.media:Jn(e)||Xn(e)?e.id:ci(e)?e.picked??e.file:di(e)}function Ft(e,t){if(Array.isArray(e))for(let n of e)Ft(n,t);else if(Jn(e))t.has(e.id)||t.set(e.id,e);else if(z(e)&&!Xn(e))for(let n of Object.values(e))Ft(n,t)}function tt(e){let t=new Map;for(let[n,r]of Object.entries(e))n!=="files"&&Ft(r,t);return t}function ui(e,t){return Object.hasOwn(e.files,t)?e.files[t]:void 0}function fi(e,t){let n=ui(t,e.file);return n===void 0?null:Lt(n,e)}function Zn(e){let t={};for(let[n,r]of tt(e)){let o=fi(r,e);o!==null&&(t[n]=o)}return t}function pi(e){return Object.hasOwn(e,"crop")||e.renditions!==void 0}function mi(e,t){let n=Object.hasOwn(t,"crop"),r=t.renditions??{},o=n?null:e.renditions,i=Object.fromEntries(ai.map(s=>[s,Object.hasOwn(r,s)?r[s]??null:o?.[s]??null]));return{crop:n?t.crop??null:e.crop,renditions:i}}function Nt(e,t){return pi(t)?{...e,...mi({crop:e.crop,renditions:e.renditions},t)}:e}var Le="property.uploads";function Qn(e){if(typeof e=="string"&&e!=="")return[e];if(!(!Array.isArray(e)||e.length===0||!e.every(t=>typeof t=="string"&&t!=="")))return[...e]}function Dt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function hi(e){if(xe(e)!==void 0||!Dt(e))return e;for(let t of Object.values(e))if(xe(t)!==void 0)return t}function Ht(e,t){let[n,...r]=t.split(".");if(n!=="property"||r.length===0)return null;let o=e;for(let i of r)if(o=Array.isArray(o)?o.find(s=>Dt(s)&&s.id===i):Dt(o)&&Object.hasOwn(o,i)?o[i]:void 0,o===void 0)return null;return Array.isArray(o)?o.flatMap(i=>{let s=hi(i),a=xe(s);return a===void 0?[]:[{id:a,value:s}]}):null}function er(e,t){return Ht(e,t)?.map(({id:n})=>n)??null}function yi(e,t){let n=tt(e),r=new Set,o=[];for(let i of Qn(t.from)??[])for(let{id:s,value:a}of Ht(e,i)??[]){if(r.has(s))continue;let l=n.get(s),d=l===void 0||!Object.hasOwn(e.files,l.file)?void 0:e.files[l.file];if(l===void 0||d===void 0||!t.kinds.includes(d.kind))continue;r.add(s);let m=et(a)?Nt(l,a):l;o.push({id:s,value:m,file:d,list:i})}return o}function gi(e,t){return yi(e,t).map(({value:n,file:r,list:o})=>({asset:Lt(r,n),list:o}))}function re(e,t){return gi(e,t).map(({asset:n})=>n)}var w=class extends Error{constructor(n,r){super(r);this.status=n}status};function bi(e){return e.split("-").map(t=>t&&t[0].toUpperCase()+t.slice(1)).join(" ")}function tr(e){let{variant:t}=e;return{required:e.required,variant:t===null?null:{cases:t.cases.map(n=>({value:n,label:bi(n)})),locked:t.locked}}}function nr(e){return Object.fromEntries(e.map(t=>[t.instance_id,{enabled:t.enabled,...t.variant===void 0?{}:{variant:t.variant}}]))}function rr(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new w(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 w(400,`The display state of "${n}" is not an object.`);let{enabled:o,variant:i}=r;if(o!==void 0&&typeof o!="boolean")throw new w(400,`The display state of "${n}" has a non-boolean enabled.`);if(i!==void 0&&typeof i!="string")throw new w(400,`The display state of "${n}" has a non-string variant.`);t[n]={...o===void 0?{}:{enabled:o},...i===void 0?{}:{variant:i}}}return t}function or(e,t){for(let[n,r]of Object.entries(t)){let o=e.instances.find(s=>s.instanceId===n);if(o===void 0)throw new w(400,`The composition places no instance "${n}".`);if(r.enabled===!1&&o.display.required)throw new w(400,`Section instance "${n}" is required and cannot be hidden.`);if(r.variant===void 0)continue;let i=o.display.variant;if(i===null)throw new w(400,`Section instance "${n}" declares no display variant.`);if(i.locked)throw new w(400,`Section instance "${n}" declares a locked variant, which the user cannot switch.`);if(!i.cases.includes(r.variant))throw new w(400,`"${r.variant}" is not a declared case of section instance "${n}" (declared: ${i.cases.join(", ")}).`)}}function ir(e,t){return new Map(e.instances.map(n=>[n.instance_id,t[n.instance_id]?.enabled??n.enabled]))}function sr(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[i,s]of Object.entries(t))i in o||(s.variant===void 0||s.variant.cases.includes(r))&&(o[i]=s.type==="list"?[]:null);return{...e,variant:r,slots:o}}function wi(e){return typeof e=="string"&&e!==""?e:null}function _i(e){return{listingIntent:wi(e.listing_intent),units:e.units.length,photos:re(e,{kinds:["image"],from:["property.property_media"]}).length}}function ki(e){let t=JSON.stringify(e),n=3735928559,r=1103547991;for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);n=Math.imul(n^i,2654435761),r=Math.imul(r^i,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 ar(e){return{id:e.id,label:e.label,summary:_i(e.facts),doc:ki(e.instances),display:nr(e.instances)}}function lr(e,t){let n=e.replace(/\/+$/,"");return t==="/"?`${n}/`:`${n}${t}/`}function cr(e){let{pages:t,currentPageId:n,basePath:r}=e,o=t.find(a=>a.id===n);if(!o)throw new Error(`nav: page "${n}" is not one of the declared pages (${t.map(a=>a.id).join(", ")}).`);let i=[o,...t.filter(a=>a.id!==o.id&&a.enabled!==!1)],s={};for(let a of i)for(let l of a.sections)l.enabled===!1||l.key in s||(s[l.key]=a.id===o.id?`#${l.anchor}`:`${lr(r,a.path)}#${l.anchor}`);return{anchors:s,pages:t.filter(a=>a.enabled!==!1).map(a=>({id:a.id,label:a.label,href:lr(r,a.path),current:a.id===o.id}))}}function nt(e,t){return e.pages?.[t]?.enabled!==!1}function Ut(e,t){return t.filter(n=>nt(e,n.id))}var Ne={base:"stylesheets/base.css",template:"stylesheets/template.css"},G={frame:"__capture/frame",print:"__capture/print"};function dr(e){return new URLSearchParams(e).toString()}function qt(e,t,n){return`${G.frame}?${dr({fixture:e,page:t,format:n})}`}function ur(e,t){return`${G.print}?${dr({fixture:e,format:t})}`}var Kt=Symbol.for("@homepages/concrete:row:of"),Bt=Symbol.for("@homepages/concrete:element:of");function ve(e){return typeof e=="object"&&e!==null&&e.kind==="sibling"&&R(e.of)}function xi(e,t){return e===t||_(e)&&_(t)&&e.key===t.key}function rt(e,t){let n=[...e];for(let r of t??[])n.some(o=>xi(o,r))||n.push(r);return n}function M(e){return typeof e=="object"&&e!==null&&"section"in e&&typeof e.section=="string"&&"slot"in e&&typeof e.slot=="string"}function Wt(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="row"&&"field"in e&&typeof e.field=="string"}function Y(e){if(!Wt(e))return;let t=e[Kt];return typeof t=="object"&&t!==null?t:void 0}function L(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="element"}function fr(e){if(!L(e))return;let t=e[Bt];return typeof t=="object"&&t!==null?t:void 0}function _(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="home"&&"key"in e&&typeof e.key=="string"}function pr(e){return typeof e=="object"&&e!==null&&"head"in e&&typeof e.head=="object"&&"declaration"in e&&R(e.declaration)}function R(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}function ot(e,t){if(typeof e=="function")return{kind:"compute",fn:e,reads:[]};let n=t;if(e.requires===void 0)return{kind:"compute",fn:n,reads:[...e.reads]};if(!Array.isArray(e.requires)||e.requires.length===0)throw new Error("compute(): `requires` names at least one read \u2014 omit it when the value needs none.");return{kind:"compute",fn:n,reads:rt(e.reads,e.requires),requires:[...e.requires]}}function T(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="compute"&&"fn"in e&&typeof e.fn=="function"}function Vt(e){return typeof e=="object"&&e!==null&&e.kind==="compute"&&typeof e.fn=="function"}var vi="written-without-pick-none",Si={write:new Set(["brief","reads","requires","none"]),pick:new Set(["brief","reads","requires","unique"]),find:new Set(["brief","reads","requires","none"])};function zt(e,t){let n=`fill.${e}()`;if(typeof t.brief!="string"||t.brief.trim()==="")throw new Error(`${n}: \`brief\` is required \u2014 it is the whole instruction the model is given.`);let r=Si[e],o={kind:"fill",verb:e};for(let[s,a]of Object.entries(t)){if(!r.has(s)){let l=s==="none"&&e==="pick"?` A pick judges every candidate, so selecting none is already an outcome its brief steers \u2014 \`concrete upgrade\` drops \`none\` from every \`fill.pick\` (the \`${vi}\` codemod).`:s==="count"?" A fill takes no count: the list's own `min` and `max` bound how many items it fills.":s==="cap"?" A write's budget is its holder's `cap` \u2014 a text slot's own, or a list's `item: text.short({ cap })`.":s==="of"&&e==="find"?" A find names no candidates: the platform's lookup for its holder's kind supplies the value.":s==="of"&&e==="pick"?" A pick chooses from its holder's candidates \u2014 a select's values, a media slot's `from` list of its kinds, a row's table, a list's item's.":s==="of"?" The kind a write produces is its holder's \u2014 a text slot's own, a list's `item`, a label's text slot.":"";throw new Error(`${n}: "${s}" is not an option \u2014 it takes ${[...r].map(d=>`\`${d}\``).join(", ")}, and everything the model should know goes in the brief.${l}`)}if(s==="none"&&a!==void 0&&a!==!0)throw new Error(`${n}: \`none\` is \`true\` or absent \u2014 it admits the empty answer, and the brief's last sentence says when nothing is right.`);if(s==="unique"&&a!==void 0&&typeof a!="boolean")throw new Error(`${n}: \`unique\` is a boolean \u2014 \`false\` lets a pick repeat an element.`);if(s==="requires"&&a!==void 0&&(!Array.isArray(a)||a.length===0))throw new Error(`${n}: \`requires\` names at least one read \u2014 omit it when the fill needs none.`);a!==void 0&&(o[s]=s==="reads"||s==="requires"?[...a]:a)}let i=o.requires;return i!==void 0&&(o.reads=rt(o.reads??[],i)),o}function Ri(e){return zt("write",e)}function Ei(e){return zt("pick",e)}function $i(e){return zt("find",e)}var N={write:Ri,pick:Ei,find:$i};function D(e,t){if(K(e))return[e];if(!Array.isArray(e)||!e.every(o=>typeof o=="object"&&o!==null))return;if(e.length===0)throw new Error(`${t} declares \`source: []\` \u2014 a list of fills names at least one fill, and a holder nothing fills declares no \`source\`.`);let n=e.filter(o=>!K(o)).length;if(n===0)return e;let r=n<e.length?"a derivation beside a fill":n>1?"several derivations":"a derivation in a list";throw new Error(`${t}'s \`source\` lists ${r} \u2014 \`source\` takes one derivation (a fact, a slot, a row's member, the element, a \`compute()\`) or an ordered list of fills: a holder has one write path, and a derived value has no writer beside it.`)}function pe(e){return K(e)||Array.isArray(e)&&e.length>0&&e.every(K)}function K(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="fill"&&"verb"in e&&(e.verb==="write"||e.verb==="pick"||e.verb==="find")&&"brief"in e&&typeof e.brief=="string"}var it=Symbol.for("@homepages/concrete:fill:declaration");function mr(e){return pe(e)?{[it]:K(e)?[e]:[...e]}:{}}function H(e){if(!(typeof e!="object"||e===null))return e[it]}var hr=["Basement","Ground","1st floor","2nd floor","3rd floor","4th floor","Penthouse"];var Oi=["street","unit","city","state","postal"],yr=[...Oi,"latitude","longitude"];function Gt(e){return yr.includes(e)}var gr=new Map;function Yt(e){gr.set(e.home,e)}function Ai(e){let t=gr.get(e);if(t===void 0)throw new Error(`fact registry: the ${e} registry is not declared yet \u2014 import @homepages/template-contracts/fact-registry (or ./fact-keys, ./table-members) before reading it.`);return t}var br=new Set(["text","select","email","phone","url","date"]);function Se(e){switch(e.type){case"number":case"image":case"address":return e.type;case"list":return Ii(e.element);default:return br.has(e.type)?"text":null}}function Ii(e){return e.type==="object"?"row_list":e.type==="image"?"image_list":e.type==="number"?"number_list":br.has(e.type)?"text_list":null}function Ti(e){return Object.hasOwn(Pt,e)?"library":"property"}function ji(e,t){let n=e.pages[t],r=n?.declaration.type==="list"?n.declaration.element:void 0;if(r?.type!=="object")throw new Error(`fact registry: the ${e.home} registry declares no list of objects "${t}"`);return r.fields}function me(e){return ji(Ai(Ti(e)),e)}function Re(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function wr(e){if(typeof e!="string")return null;let t=e.lastIndexOf(".");if(t<=0)return null;let n=S(e.slice(0,t));if(n?.reading!=="registry")return null;let r=e.slice(t+1),o=Re(me(n.table),r);return o!==void 0&&Se(o)==="row_list"?{table:n,member:r}:null}var st=["type","label","from","source","locked","when"],Xt=new Set(st),at=Symbol.for("@homepages/concrete:table-of");function lt(e,t){return Object.defineProperty(e,at,{value:t,enumerable:!1})}function He(e){if(typeof e!="object"||e===null)return null;let t=e[at];return typeof t=="object"&&t!==null?t:null}function Pi(e){if(e.reading==="registry")return Object.keys(me(e.table));let t=Me[e.table].row;return Object.keys(t).filter(n=>n!==ke[e.table].idKey&&!Xt.has(n))}function De(e,t){return Object.freeze({kind:"row",field:t,[Kt]:e})}function Ci(e,t){return new Proxy(De(e,t),{get(n,r,o){return typeof r=="string"&&!(r in n)&&Gt(r)?De(e,`${t}.${r}`):Reflect.get(n,r,o)}})}var kr=Symbol.for("@homepages/concrete:row:definition");function j(e){let t=e[kr];return typeof t=="object"&&t!==null?t:e}function Fi(e,t){if(e.reading==="legacy")return!1;let n=Re(me(e.table),t);return n!==void 0&&Se(n)==="address"}function _r(e,t){if(e.reading==="legacy"){let r=Me[e.table].row;return Object.hasOwn(r,t)?String(r[t].value_type):void 0}let n=Re(me(e.table),t);return n===void 0?void 0:String(Se(n)??"")}var Mi=new Set(["then","toJSON","$$typeof","asymmetricMatch","nodeType","tagName","@@iterator"]);function xr(e,t,n=[]){let r=t===null?null:new Set(Pi(t)),o=new Proxy(e,{get(i,s,a){if(s===kr)return i;if(typeof s!="string")return Reflect.get(i,s,a);if(t!==null&&r!==null){let l=[t,...n],d=l.map(g=>g===t?r.has(s)?_r(t,s):void 0:_r(g,s));if(d.every(g=>g===void 0))return Reflect.get(i,s,a);let m=d.findIndex(g=>g===void 0||g!==d[0]);if(m===-1)return Fi(t,s)?Ci(o,s):De(o,s);if(s in i||Xt.has(s))return Reflect.get(i,s,a);throw new Error(`row: "${String(i.label)}" reads the member "${s}", which its \`from\` table ${l[m].table} ${d[m]===void 0?"lacks":"holds at another kind"} \u2014 every table a row names carries every member its readers read, at one kind.`)}return s in i||Xt.has(s)?Reflect.get(i,s,a):Mi.has(s)?void 0:De(o,s)}});return o}function vr(e){let t=new Proxy(e,{get(n,r,o){return typeof r=="string"&&!(r in n)&&Gt(r)?De(t,r):Reflect.get(n,r,o)}});return t}function Sr(e,t){let n=e.map(t);return n.some((r,o)=>r!==e[o])?n:void 0}function Rr(e,t){let n=e.reads===void 0?void 0:Sr(e.reads,t),r=e.requires===void 0?void 0:Sr(e.requires,t);return n===void 0&&r===void 0?e:{...e,...n===void 0?{}:{reads:n},...r===void 0?{}:{requires:r}}}function X(e,t){let n=j(e),r,o=n.source;if(o!==void 0)if(T(o)){let s=Rr(o,t);s!==o&&(r={...n,source:s})}else{let s=t(o);s!==o&&(r={...n,source:s})}let i=H(n);if(i!==void 0){let s=!1,a=i.map(l=>{let d=Rr(l,t);return d!==l&&(s=!0),d});s&&(r={...r??n,[it]:a})}return r??n}function Er(e){return t=>{let n=Y(t);if(n===void 0)return t;let r=e.get(n);return r===void 0?t:{kind:"row",slot:r,field:t.field}}}var $r=new Set(["row","address"]);function Or(e){let t=new Map;for(let[n,r]of Object.entries(e))typeof r=="object"&&r!==null&&$r.has(r.type)&&t.set(r,n);return t}function Ar(e,t,n){let r=[e.source];X(e,o=>(r.push(o),o));for(let[o,i]of t)if(!(o===e||i===n))for(let s of st){let a=o[s];if(a!==void 0&&r.includes(a))return`${i}.${s}`}}function Ir(e){let t=e.slice(e.indexOf(".")+1);return`reads \`${e}\`, which is the row's own \`${t}\`, not a member \u2014 a row's ${st.map(n=>`\`${n}\``).join(", ")} are its slot definition's, and its table has no member named \`${t}\`.`}function oe(e){return $r.has(e.type)?{...j(e)}:e}var Li={"property.listing_intent":"listing_intent","property.description":"description","property.address":"address","property.address.street":"address_street","property.address.unit":"address_unit","property.address.city":"address_city","property.address.state":"address_state","property.address.postal":"address_postal","property.address.latitude":"lat","property.address.longitude":"lon"};function Tr(e){let t=Li;if(Object.hasOwn(t,e))return t[e];let n=S(e)?.table;return n!==void 0&&Ct(n)?n:e}function Zt(e,t){for(let n of D(t,e)??[])if(!(n.verb!=="pick"||n.of===void 0))throw new Error(`${e}'s \`fill.pick\` states \`of\` \u2014 a pick chooses from its holder's \`from\`; remove \`of\` and name the candidates in \`from\`.`)}function Ni(e){return M(e)?{kind:"section",section:e.section,slot:e.slot}:R(e)?{kind:"sibling",of:e}:_(e)?{kind:"home",key:e.key}:e}function U(e){return Ue(e,Ni)}function Di(e,t,n){if(!(t!==!0||n===void 0)){if(T(n)){if(n.requires!==void 0&&n.requires.length>0)return;throw new Error(`${e} is \`required\` and sourced by a \`compute()\` naming no \`requires\` \u2014 nothing to require. Name the reads the value cannot do without: \`compute({ reads, requires: [fact.property.address] }, \u2026)\`.`)}if(M(n)||R(n)||ve(n))throw new Error(`${e} is \`required\` and mirrors another slot \u2014 a mirror requires its upstream; mark that slot \`required\` instead.`)}}function Ue(e,t){let n=e.source;Di(e.label??"a slot",e.required,n);let r=n!==void 0&&D(n,e.label??"a slot")===void 0;return{...e.locked===!0?{locked:!0}:{},...e.required===!0?{required:!0}:{},...r?{source:t(n)}:{},...mr(n),...e.label!==void 0?{label:e.label}:{},...e.placeholder!==void 0?{placeholder:e.placeholder}:{},...e.when!==void 0?{when:e.when}:{}}}function Jt(e){return t=>({type:"text",size:e,...U(t),...t.cap!==void 0?{cap:t.cap}:{}})}var $={short:Jt("short"),medium:Jt("medium"),long:Jt("long")};function E(e){return{type:"number",...U(e),...e.thousandsSep!==void 0?{thousandsSep:e.thousandsSep}:{},...e.decimals!==void 0?{decimals:e.decimals}:{},...e.maxDigits!==void 0?{maxDigits:e.maxDigits}:{}}}function Hi(e){let t=e.source;return{type:"select",...U(e),..._(t)?{options:{source:Tr(t.key)}}:{},...e.creatable!==void 0?{creatable:e.creatable}:{}}}function Ui(e){if(_(e.source))throw new Error(`select: "${e.label}" declares both \`from\` and a fact \`source\` \u2014 a select takes exactly one set of choices.`);return Zt(`select: "${e.label}"`,e.source),{type:"select",...U(e),values:[...e.from],...e.creatable!==void 0?{creatable:e.creatable}:{}}}function qi(e,t){if(K(t.source)&&t.source.verb!=="pick")throw new Error(`select: a display entry is filled by \`fill.pick\` \u2014 the model picks one of its cases \u2014 never \`fill.${t.source.verb}\`.`);return Zt("select: a display entry",t.source),{cases:[...e],...t.locked===!0?{locked:!0}:{},...t.source!==void 0?{source:t.source}:{}}}function Ki(e){if(Array.isArray(e))throw new Error("select: takes one options object \u2014 write the choices as `from`: `select({ from: [...], \u2026 })`.");if(e.options!==void 0)throw new Error("select: declares `options` \u2014 a select names its choices in `from`: `select({ from: [...], \u2026 })`.");return e.label===void 0&&Array.isArray(e.from)?qi(e.from,e):e.from!==void 0?Ui(e):Hi(e)}var qe=Ki;function he(e){return{type:"url",...U(e),...e.accepts!==void 0?{accepts:e.accepts}:{}}}function Qt(e){return{type:"date",...U(e)}}function jr(e){return{type:"email",...U(e)}}function Pr(e){return{type:"phone",...U(e)}}function ct(e={}){return vr({type:"address",...U(e)})}function Cr(e,t){let n=`${e}: "${t.label??e}"`;if(Zt(n,t.source),"category"in t)throw new Error(`${n} declares \`category\` \u2014 a media declaration names the list it picks from in \`from\` (\`from: fact.property.property_media\`, \`fact.property.floor_plans\`, \`fact.property.uploads\`), or owns its asset without one.`);if("sources"in t)throw new Error(`${n} declares \`sources\` \u2014 a media slot takes a pasted link wherever a link provider claims its kind (a video, a tour), and declares nothing for it. \`concrete upgrade\` removes it.`);let r=jt({type:e,kinds:t.kinds,process:t.process});if(r!==null)throw new Error(`${n} ${r}.`);let o=D(t.source,n),i=t.source!==void 0&&o===void 0&&!T(t.source);if(i&&t.from!==void 0)throw new Error(`${n} picks \`from\` a media list and declares a \`source\` \u2014 a slot bound to a fact holds what that fact holds.`);if((i||T(t.source))&&t.process!==void 0)throw new Error(`${n} declares \`process\` beside a \`source\` that derives its value \u2014 a derived slot holds what it derives from, processed where that is declared.`);if(o?.some(l=>l.verb==="pick")===!0&&t.from===void 0)throw new Error(`${n} is picked by a \`fill.pick\` and names no \`from\` \u2014 a pick chooses from its holder's \`from\` (\`from: fact.property.property_media\`); a media declaration without one owns its asset.`);let a=Bi(n,e,t.kinds,t.from)?.map(l=>_(l)?l.key:l);return{...a!==void 0?{from:a.length===1?a[0]:a}:{},...t.process!==void 0?{process:t.process.map(l=>({...l}))}:{}}}function Bi(e,t,n,r){if(r===void 0)return;let o=Array.isArray(r)?r:[r];if(o.length===0)throw new Error(`${e} declares \`from: []\` \u2014 name the media list it picks from, or omit \`from\` and the declaration owns its asset.`);let i=V({type:t,kinds:n}),s=new Set;for(let a of o){let l=typeof a=="object"&&a!==null&&!_(a),d=_(a)?a.key:l&&"declaration"in a?a.declaration:a;if(s.has(d))throw new Error(`${e} picks \`from\` one media list twice \u2014 each list is named once; an asset two lists hold is one candidate, attributed to the first.`);if(s.add(d),!l)continue;let m=V(d.element);if(m.length>0&&!i.some(g=>m.includes(g)))throw new Error(`${e} picks \`from\` a list of ${m.join(", ")}, whose items can never be ${i.join(" or ")} \u2014 each list it picks from holds items of its kinds.`)}return o}function J(e={}){return{type:"image",...U(e),...e.crop!==void 0?{crop:e.crop}:{},...Cr("image",e)}}function dt(e={}){return{type:"media",...U(e),...e.kinds!==void 0?{kinds:[...e.kinds]}:{},...Cr("media",e)}}var tn=Symbol.for("@homepages/concrete:object:declared-fields");function ie(e){return e[tn]}function nn(e,t){let n=ie(t);return n!==void 0&&Object.defineProperty(e,tn,{value:n,enumerable:!1}),e}var Fr="a label is a source, as a text slot takes one",en="`label: text.short({ cap: 60, source: fill.write({ reads, brief }) })`",Wi=new Set(["type","size","cap","locked"]);function Vi(e,t,n){if(typeof t=="string")throw new Error(`${e} declares the label ${JSON.stringify(t)} \u2014 ${Fr}: write \`label: compute(() => ${JSON.stringify(t)})\`.`);if(R(t)){let r=Object.entries(n).find(([,o])=>o===t);if(r===void 0)return zi(e,t);if(t.type!=="text"&&t.type!=="address")throw new Error(`${e} label names its field "${r[0]}", a "${t.type}" \u2014 a label names a text or an address field.`);return{field:r[0]}}if(pe(t)){let r=K(t)?`\`fill.${t.verb}\``:"list of fills";throw new Error(`${e} label is a bare ${r} \u2014 the label is the fill's holder, so it states the kind the fill writes: ${en}.`)}return $.short({locked:!0,source:t})}function zi(e,t){let n=H(t);if(n===void 0||n.some(s=>s.verb!=="write")||t.type!=="text")throw new Error(`${e} declares a slot as its label that is none of its fields \u2014 ${Fr}: write what that slot read as the label (\`label: comp.address.street\`, \`label: compute(() => "Listing agent")\`), a written label as ${en}; a title the user edits is a field, which the label names by its const.`);let r=Object.keys(t).filter(s=>!Wi.has(s));if(r.length>0)throw new Error(`${e} label is a written text slot declaring ${r.map(s=>`\`${s}\``).join(", ")} \u2014 a label states only its kind and cap: ${en}; a title the user edits is a field, which the label names by its const.`);let{size:o,cap:i}=t;return $[o]({locked:!0,source:n.length===1?n[0]:n,...i!==void 0?{cap:i}:{}})}function Gi(e){let{type:t,element:n}=e;if(t==="object")return"an object \u2014 an object never holds another; flatten its fields into this one";if(t==="list"&&n?.type==="object")return Yi(e);if(t==="list"&&n?.type==="row")return"a list of rows \u2014 declare the selection at the top level instead"}var Ke="declare the list at the top level instead";function Yi(e){let t=H(e);if(t!==void 0&&t.some(o=>o.verb!=="pick")||t===void 0&&pe(e.source))return`a list of objects declaring a fill other than a pick \u2014 no fill but a pick writes a list inside an object; ${Ke}`;let n=e.source;if(_(n))return`a list of objects sourced by the fact "${n.key}" \u2014 its items carry their own minted ids, so it lists a row's member, a \`compute()\` or authored items; ${Ke}`;if(M(n)||ve(n)||R(n))return`a list of objects sourced by another list slot \u2014 its items carry their own minted ids, so it lists a row's member, a \`compute()\` or authored items; ${Ke}`;let r=e.element.fields;for(let[o,i]of Object.entries(r)){let s=Xi(i,r);if(s!==void 0)return`a list of objects whose item field "${o}" is ${s}`}}function Xi(e,t){if(e.type==="list"&&e.element?.type==="object")return"a list of objects \u2014 a list of objects nests one level; flatten the inner list's fields into this item or declare it beside the outer list";if(H(e)!==void 0)return`filled \u2014 no fill writes into a list inside an object; ${Ke}`;let n=e.source;if(n===void 0)return;if(T(n))return`a \`compute()\` \u2014 an item of a list inside an object reads its element, or a row \`from\` its member; ${Ke}`;let{kind:r,slot:o}=n;if(r==="element"&&e.type==="row"&&S(e.from)!==null)return"a table's row holding the element \u2014 the element of a list inside an object is a member's item: hold it in a row `from` that member (`row({ label, from: unit.floor_plans, source: entry })`)";if(r!=="element"&&!(e.type!=="row"&&r==="row"&&typeof o=="string"&&t[o]?.type==="row"))return"bound to something outside its item \u2014 an item of a list inside an object reads its element, a row `from` its member, or a row beside it"}function Ee(e){let t="object";if(e.source!==void 0)throw new Error(`${t} declares \`source\`, but an object is a pure container with no value of its own \u2014 declare it on the field that holds the value.`);if(Object.hasOwn(e.fields,"label")&&e.fields.label!==e.label)throw new Error(`${t} declares a field keyed "label" \u2014 the key is reserved for the object's label: write its source as \`label\`, beside \`fields\`.`);let n=It.find(m=>Object.hasOwn(e.fields,m));if(n!==void 0)throw new Error(`${t} field "${n}" is named like its binding's own \`${n}\` \u2014 a field is read straight off its object's binding, which owns ${It.map(m=>`\`${m}\``).join(", ")}. Rename the field.`);let r=e.label===void 0?void 0:Vi(t,e.label,e.fields),o=r!==void 0&&!("type"in r)?r:void 0,i={...r===void 0||o!==void 0?{}:{label:r},...e.fields};if(Object.keys(i).length===0)throw new Error(`${t} declares no fields \u2014 an object groups at least one.`);for(let[m,g]of Object.entries(i)){let v=Gi(g);if(v!==void 0)throw new Error(`${t} field "${m}" is ${v}.`);if(m!=="label"&&g.label===void 0)throw new Error(`${t} field "${m}" declares no \`label\` \u2014 every field of an object states the name the editor shows it by.`)}let s=Or(i);for(let[m,g]of Object.entries(i)){let v=Ar(g,s);if(v!==void 0)throw new Error(`${t} field "${m}" ${Ir(v)}`)}let a=Er(s),l={};for(let[m,g]of Object.entries(i))l[m]=oe(X(g,a));let d={type:"object",...e.locked===!0?{locked:!0}:{},...o!==void 0?{label:o}:{},fields:l,...e.when!==void 0?{when:e.when}:{}};return Object.defineProperty(d,tn,{value:i,enumerable:!1}),d}var Lr=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function Ji(e){return S(e.from)}function Zi(e){if(!Array.isArray(e.from)){let t=Ji(e);return t===null?[]:[t]}return e.from.flatMap(t=>S(t)??[])}function Qi(e){if(e===void 0)return;if(Mr(e.source))return e;if(e.type!=="object"||!Lr(e.fields))return;let t=Object.values(e.fields).filter(n=>Mr(n.source));return t.length===1?t[0]:void 0}function Nr(e){let t=Qi(e);return t?.type==="row"?Zi(t):[]}function Mr(e){return Lr(e)&&e.kind==="element"}var Mc=[...new Set(Object.values(ke).map(e=>e.idKey))].filter(e=>e!=="id");function es(e,t){if(_(e)){if(S(e.key)===null)throw new Error(`list: "${t}" is sourced by the fact "${e.key}", which is no table \u2014 a list's source is a table, a list slot, a list-valued member, a \`compute()\` or a fill; a list of the property's media is picked (\`fill.pick\`) from its item's \`from\`, or computed over a media list (\`compute({ reads: [fact.property.property_media] }, \u2026)\`).`);return{kind:"home",key:e.key}}if(M(e))return{kind:"section",section:e.section,slot:e.slot};if(R(e))return{kind:"sibling",of:e};if(Y(e)!==void 0||T(e))return e;throw new Error(`list: "${t}" declares a source that is no list.`)}function Ur(e){return _(e)?S(e.key):R(e)&&e.type==="list"?He(e):null}var ts=new Set(["label","locked","placeholder","when","source"]);function ns(e){let t={};for(let[n,r]of Object.entries(e))ts.has(n)||(t[n]=r);return t}function rs(e,t){if(_(e)&&S(e.key)!==null)return{type:"row",from:e.key,source:{kind:"element"}};for(let r of D(e,`list: "${t}"`)??[]){if(r.verb==="write")throw new Error(qr(t,"declares no `item`"));if(r.verb==="pick")throw new Error(on(t,"declares no `item`"))}if(pe(e))return{type:"poi"};if(R(e)&&e.type==="list")return is(e,t);let n=Y(e);if(n!==void 0){let r=He(n);if(r!==null&&os(r,e.field)==="image_list")return{type:"image"}}throw new Error(`list: "${t}" declares no \`item\`, and its source does not say what its elements are \u2014 declare \`item\`: a plain slot (\`item: image()\`), or a function of the element (\`item: (el) => object({ \u2026 })\`).`)}function os(e,t){if(e.reading==="legacy"){let r=Me[e.table].row;return Object.hasOwn(r,t)?r[t].value_type:void 0}let n=Re(me(e.table),t);return n===void 0?void 0:Se(n)??void 0}function qr(e,t){return`list: "${e}" is written by a \`fill.write\` and ${t} \u2014 the item is the kind every written element is: a value slot (\`item: text.short({ cap: 80 })\`), an object exactly one field of which holds the element (\`question: text.medium({ label: "Question", cap: 48, source: el })\`), or an object declared plainly whose members the write answers (\`item: object({ label: text.short({ label: "Unit" }), fields: { \u2026 } })\`).`}function Kr(e){if(typeof e!="object"||e===null||e.type!=="object")return!1;let t=e.fields??{};return!Object.values(t).some(n=>L(n.source))}function Dr(e,t){if(e.type!=="object")return;let n=Object.entries(e.fields).filter(([,r])=>r.type!=="row"&&r.source?.kind==="element");if(n.length!==1)throw new Error(qr(t,n.length===0?"its object item holds the element in no field":`its object item holds the element in ${String(n.length)} fields (${n.map(([r])=>`"${r}"`).join(", ")}) \u2014 one field holds it`))}function is(e,t){let n=e.element;if(n===void 0||n.type==="object")throw new Error(`list: "${t}" lists the items of a list of objects \u2014 declare \`item\` to say what each item holds.`);return n.type==="row"?{type:"row",from:n.from,source:{kind:"element"}}:ns(n)}function on(e,t){return`list: "${e}" is picked by a \`fill.pick\` and ${t} \u2014 the item holds the pick in the field holding its candidates: a candidate holder itself (\`item: image({ from: fact.property.property_media })\`, \`item: row({ label: "Agent", from: fact.property.contacts })\`), or an object exactly one field of which holds candidates and no source, which its siblings read by its const (\`const photo = image({ label: "Photo", from: fact.property.property_media }); object({ fields: { photo, caption: text.short({ label: "Caption", source: fill.write({ reads: [photo], brief }) }) } })\`).`}function sn(e){let t=j(e);return t.type==="row"?typeof t.from=="string":t.type==="select"?Array.isArray(t.values):typeof t.type=="string"&&(F(t.type)||t.type==="media")&&t.from!==void 0}function an(e){return j(e).source===void 0&&H(e)===void 0}function Br(e,t){if(e.type!=="object")return sn(e)&&an(e)?null:void 0;let n=ie(e)??e.fields??{},r=Object.entries(n).filter(([,s])=>typeof s=="object"&&s!==null&&sn(s)&&an(s)),o=r.filter(([,s])=>j(s).type!=="select"),i=o.length>0?o:r;if(i.length>1)throw new Error(`list: "${t}"'s item declares ${String(i.length)} fields with \`from\` and no source (${i.map(([s])=>`"${s}"`).join(", ")}) \u2014 a picked list's item holds its pick in exactly one; give the others a source of their own.`);return i.length===1?i[0][0]:void 0}function Hr(e){return{...oe(e),source:{kind:"element"}}}function rn(e,t){if(t===void 0)return null;let n=t===null?e:(ie(e)??e.fields)[t],r=j(n);return r.type==="row"?S(r.from):null}function ss(e,t){if(t===null)return Hr(e);let n=e,r=(ie(e)??n.fields)[t],o=s=>s===r||typeof s=="object"&&s!==null&&j(s)===j(r)?{kind:"element"}:s,i={};for(let[s,a]of Object.entries(n.fields))i[s]=s===t?Hr(a):X(a,o);return nn({...n,fields:i},n)}function as(e,t,n){let r=i=>{if(!L(i))return i;if(fr(i)!==t)throw new Error(`list: "${n}"'s item reads the element of another list \u2014 an element is read only inside its own list's item.`);return{kind:"element"}};if(e.type==="object"){let i=e,s={},a=!1;for(let[l,d]of Object.entries(i.fields))s[l]=oe(X(d,r)),s[l]!==d&&(a=!0);return a?nn({...i,fields:s},i):i}return oe(X(e,r))}function Wr(e,t){let n=e.type==="object"?Object.entries(e.fields):[["",e]];for(let[r,o]of n){let i=o.source;if(i?.kind==="home")throw new Error(`list: "${t}"'s item${r===""?"":` field "${r}"`} is bound to the fact "${String(i.key)}", which is the same value in every item \u2014 read the element or a row's member instead; a property fact belongs in a fill's or a \`compute()\`'s \`reads\`.`)}}function ls(e,t){if(e.item===void 0)return rs(e.source,t);let n=new Set((D(e.source,`list: "${t}"`)??[]).map(l=>l.verb));if(n.has("pick")){let l=cs(e.item,t);return n.has("write")&&Dr(l,t),l}let r={},o=Object.freeze({kind:"element",[Bt]:r,[at]:Ur(e.source)}),i=typeof e.item=="function"?e.item(o):e.item;if(typeof i!="object"||i===null||typeof i.type!="string")throw new Error(`list: "${t}"'s item is no slot \u2014 return a value slot, a row or an object.`);if(i.type==="list")throw new Error(`list: "${t}"'s item is a list \u2014 a list's item is a value slot, a row or an object; a list never holds lists.`);if(i.type!=="object"&&H(i)!==void 0)throw new Error(`list: "${t}"'s item declares a fill \u2014 one decision produces the whole list, so the fill belongs on the list's \`source:\`; a field of an object item may carry its own.`);Wr(i,t);let s=as(i,r,t);if(n.has("write")&&!Kr(e.item)&&Dr(s,t),s.type==="object"||s.type==="row")return s;let a={...s};return delete a.locked,a}function cs(e,t){if(typeof e=="function")throw new Error(on(t,"declares its item as a function"));if(typeof e!="object"||e===null||typeof e.type!="string")throw new Error(`list: "${t}"'s item is no slot \u2014 return a value slot, a row or an object.`);let n=Br(e,t);if(n===void 0)throw new Error(on(t,"its item declares no field with `from` and no source"));Wr(e,t);let r=ss(e,n);if(r.type==="object"||r.type==="row")return r;let o={...r};return delete o.locked,o}function ds(e,t){let n=e.source;if(!(n===void 0||(D(n,"list")??[]).some(i=>i.verb==="pick"))||typeof e.item!="object"||e.item===null)return Ur(n);let o=e.item;if(n===void 0){if(o.type!=="object")return rn(o,sn(o)?null:void 0);let i=Object.entries(ie(o)??{}).filter(([,s])=>j(s).type==="row"&&an(s));return i.length===1?rn(o,i[0][0]):null}return rn(o,Br(o,t))}function P(e){let t=e.label??"list";for(let d of["fields","title","unique","count"]){if(e[d]===void 0)continue;let m={fields:"declare `item: (el) => object({ fields })` \u2014 an item function returning an object",title:"give the item's object a `label` \u2014 a string, or a text slot",unique:"a pick is unique by default (`fill.pick({ unique: false })` lifts it)",count:"`min` and `max` bound how many items any source yields"};throw new Error(`list: "${t}" declares \`${d}\`, which a list no longer takes \u2014 ${m[d]}.`)}let n=e.source,r=D(n,`list: "${t}"`),o=Kr(e.item),i=r?.every(d=>d.verb==="pick"||d.verb==="write"&&o)===!0;if(r!==void 0&&e.max===void 0&&!i)throw new Error(`list: "${t}" is filled but declares no \`max\` \u2014 a fill is an open supply, so the list bounds it.`);for(let d of r??[])if(d.verb==="pick"&&d.of!==void 0)throw new Error(`list: "${t}"'s \`fill.pick\` states \`of\` \u2014 a list's pick chooses from its item's \`from\`; remove \`of\`.`);let s={type:"list",...Ue(e,d=>es(d,t)),element:ls(e,t),...e.min!==void 0?{min:e.min}:{},...e.max!==void 0?{max:e.max}:{}},a=T(n)?Nr(s.element):void 0,l=a===void 0?ds(e,t):a.length===1?a[0]:null;return lt(s,l)}function ut(e,t){if(t!==void 0&&(typeof t!="object"||t===null||Array.isArray(t)))throw new Error(`process.${e}(): takes an options object, or nothing.`);let n={kind:"process",verb:e};for(let[o,i]of Object.entries(t??{}))i!==void 0&&(n[o]=i);let r=Tt(n);if(r!==null)throw new Error(`process.${e}(): ${r}.`);return n}function us(e){return ut("cutout",e)}function fs(e){return ut("autocrop",e)}function Z(e,t){return ut(e,t)}function ps(e){return Z("probe",e)}function ms(e){return Z("understand",e)}function hs(e){return Z("preview",e)}function ys(e){return Z("ladder",e)}function gs(e){return Z("transcode",e)}function bs(e){return Z("poster",e)}function ws(e){return Z("rasterize",e)}function _s(e){return Z("fetch",e)}function ks(e){return Z("tour_details",e)}function xs(e){return ut("crop",e)}var vs={cutout:us,autocrop:fs},ft={...vs,probe:ps,understand:ms,preview:hs,ladder:ys,transcode:gs,poster:bs,rasterize:ws,fetch:_s,tour_details:ks,crop:xs};function Ss(e,t="a list"){return`${e} is sourced by ${t} \u2014 a row's slot source names a row, which it mirrors. A list's first row is a \`compute()\` over the list: \`source: compute({ reads: [list] }, (rows) => rows[0] ?? null)\`.`}function Rs(e,t){if(_(e))throw new Error(`row: "${t}" is sourced by the fact "${e.key}" \u2014 a table is a row's \`from\`, never its source: \`row({ label, from: fact.${e.key} })\` holds its first row, which the user may re-pick.`);if(M(e))return{kind:"section",section:e.section,slot:e.slot};if(R(e))return{kind:"sibling",of:e};if(L(e)||T(e))return Object.freeze({...e});throw new Error(`row: "${t}" declares a source that is no element, slot, compute or pick.`)}function Es(e,t){if(Array.isArray(e))return $s(e,t);let n=_(e)?S(e.key):null;if(n!==null)return{key:e.key,tables:[n]};let r=Y(e);if(r!==void 0){let o=`${String(j(r).from)}.${e.field}`;if(wr(o)!==null)return{key:o,tables:[]}}throw new Error(e===void 0?`row: "${t}" declares no \`from\` \u2014 a row names its fact data: a table (\`row({ label, from: fact.property.contacts })\`) or a row's list-valued member (\`from: unit.floor_plans\`).`:`row: "${t}"'s \`from\` is ${_(e)?`the fact "${e.key}", which is not a table`:"no table or list-valued member"} \u2014 a row's \`from\` is a fact table (\`fact.property.contacts\`) or a table row's list-valued member (\`unit.floor_plans\`).`)}function $s(e,t){if(e.length===0)throw new Error(`row: "${t}" declares \`from: []\` \u2014 a row names the table it is a row of.`);let n=[],r=[];for(let o of e){let i=_(o)?S(o.key):null;if(i===null)throw new Error(`row: "${t}"'s \`from\` lists ${_(o)?`the fact "${o.key}", which is not a table`:"something that is no table"} \u2014 a row's list of \`from\` names tables (\`[fact.property.contacts, \u2026]\`); a list-valued member is a row's only \`from\`.`);if(r.some(s=>s.table===i.table))throw new Error(`row: "${t}" names the ${i.table} table twice in \`from\` \u2014 each table is named once.`);n.push(o.key),r.push(i)}return{key:n.length===1?n[0]:n,tables:r}}function Os(e,t,n){let r=He(R(e)||L(e)?e:void 0);if(!(r===null||t.some(o=>r.table===o.table)))throw new Error(`row: "${n}" is \`from\` the ${t.map(o=>o.table).join(", ")} table${t.length===1?"":"s"} but its source holds a row of ${r.table} \u2014 a row's source yields a row of its own \`from\`.`)}function Vr(e){let{key:t,tables:n}=Es(e.from,e.label),r=n[0]??null;if(r===null&&!L(e.source))throw new Error(`row: "${e.label}" is \`from\` the list-valued member "${t}" but its source is no element \u2014 a row from a member holds an item of it, the element of the list over that member: \`source: entry\`.`);if(R(e.source)&&e.source.type==="list")throw new Error(Ss(`row: "${e.label}"`));let o=D(e.source,`row: "${e.label}"`);for(let a of o??[]){if(a.verb!=="pick")throw new Error(`row: "${e.label}" is filled by \`fill.${a.verb}\` \u2014 a row holds a row that exists, which only a \`fill.pick({ brief })\` out of its \`from\` yields.`);if(a.of!==void 0)throw new Error(`row: "${e.label}"'s \`fill.pick\` states \`of\` \u2014 a row's pick chooses from its \`from\`; remove \`of\`.`)}o===void 0&&e.source!==void 0&&r!==null&&Os(e.source,n,e.label);let i=Ue(e,a=>Rs(a,e.label)),s=lt({type:"row",from:t,...i},r);return xr(s,r,n.slice(1))}var As=["property","library"];function Q(e,t){if("label"in e)throw new Error("fact registry: a page head holds no `label` \u2014 the declaration states the fact's name");for(let n of["title","description"]){let r=e[n];if(typeof r=="string"&&r.trim()==="")throw new Error(`fact registry: a page declares an empty ${n}`)}return{head:e,declaration:t}}var Is=new Set(["home","item"]);function dn(e,t,n){let r=typeof t=="object"&&t!==null?n.pages.get(t):void 0;if(r!==void 0)return{kind:"home",key:`${n.home}.${r}`};if(pr(t)){let i=n.pages.get(t);if(i===void 0)throw new Error(`${e} reads a page that is not one of this registry's \u2014 a registry reads its own facts by their page's const.`);return{kind:"home",key:`${n.home}.${i}`}}let o=ve(t)?t.of:t;if(R(o)){let i=n.fields?.get(o);if(i===void 0)throw new Error(`${e} reads the declaration "${o.label??o.type}", which is not a field of the same item \u2014 a field reads its siblings by their consts, and a top-level fact by its page's const.`);return{kind:"item",field:i}}if(_(t)&&[...n.pages.values()].some(i=>t.key===`${n.home}.${i}`))return{kind:"home",key:t.key};if(_(t))throw new Error(`${e} is bound to the fact "${t.key}" \u2014 a registry declares the facts; it reads a sibling page by its const and binds none.`);if(M(t))throw new Error(`${e} reads a section's slot \u2014 a registry reads no section.`);if(L(t)&&n.picked===!0)return{kind:"element"};if(L(t))throw new Error(`${e} reads the element \u2014 a registry's list nothing picks is built by the user, so its item's fields read one another by const.`);if(Y(t)!==void 0)throw new Error(`${e} reads the member "${t.field}" of a row that is not a field of the same item.`);if(Wt(t)&&typeof t.slot=="string")return{kind:"row",slot:t.slot,field:t.field};if(typeof t=="object"&&t!==null&&Is.has(String(t.kind)))return t;throw new Error(`${e} declares a read a registry cannot answer.`)}function Ts(e,t,n){return Array.isArray(t)?t.length===1?ln(e,t[0],n):t.map(r=>ln(e,r,n)):ln(e,t,n)}function ln(e,t,n){let r=typeof t=="object"&&t!==null?n.pages.get(t):void 0,o=typeof t=="string"?t:r===void 0?void 0:`${n.home}.${r}`;if(o===void 0||!n.mediaLists.has(o))throw new Error(`${e} picks \`from\` something other than one of this registry's media lists \u2014 a media field picks from a list of media (the \`uploads\` page, a sorted list), by its const, or owns its asset.`);return o}function un(e,t,n){let r=t.reads.map(o=>dn(e,o,n));return t.requires===void 0?{kind:"compute",fn:t.fn,reads:r}:{kind:"compute",fn:t.fn,reads:r,requires:t.requires.map(o=>dn(e,o,n))}}function js(e,t){if(t.when!==void 0)throw new Error(`${e} declares \`when\` \u2014 a registry has no display variant; a page is drawn when a template reads it.`);if(t.required!==void 0)throw new Error(`${e} declares \`required\` \u2014 a fact requires nothing on its own account; what a property must answer is what its templates require.`);if(t.type==="poi")throw new Error(`${e} is a poi \u2014 a place the platform builds is no fact.`)}function Ps(e,t){let{type:n,fields:r}=t;if(n!=="object"||r===void 0)return;let o=Object.entries(r).filter(([,i])=>i.type==="row");if(o.length>0)throw new Error(`${e} holds a picked row in ${o.map(([i])=>`"${i}"`).join(", ")} \u2014 a list picking rows declares the row as its item (\`item: row({ from })\`), whose members are the row's.`)}function Cs(e){let t=new Map,n=e.fields;for(let r of[n,ie(e)??{}])for(let[o,i]of Object.entries(r))typeof i=="object"&&i!==null&&t.set(i,o);return t}function fn(e,t,n){js(e,t);let r=oe(X(t,o=>dn(e,o,n)));switch(r.from!==void 0&&(F(String(r.type))||r.type==="media")&&(r={...r,from:Ts(e,t.from,n)}),r.type){case"object":{let o={},i={...n,fields:Cs(r)};for(let[s,a]of Object.entries(r.fields))o[s]=fn(`${e}.${s}`,a,i);r={...r,fields:o};break}case"list":{let o=r.max,i={home:n.home,pages:n.pages,mediaLists:n.mediaLists},s=H(t)?.some(l=>l.verb==="pick")===!0,a=fn(`${e}[]`,r.element,s?{...i,picked:!0}:i);Ps(`${e}[]`,a),r={...r,element:a,...Vt(o)?{max:un(`${e}.max`,o,i)}:{}};break}default:break}return r}function Fs(e,t,n,r){let o=`${e}.${t}`,i=fn(o,n.declaration,r);if(i.type==="object")throw new Error(`${o} is an object \u2014 a top-level fact is a value or a list; a group of fields is a list's item.`);if(i.label===void 0)throw new Error(`${o} declares no \`label\` \u2014 a top-level fact states the name its page and its Details section show it by.`);if(n.head===null)return{head:null,declaration:i};let{title:s,description:a}=n.head;return{head:{title:typeof s=="string"?s:un(`${o}.title`,s,r),description:typeof a=="string"?a:un(`${o}.description`,a,r)},declaration:i}}var Ms=["home","pages"];function Ls(e){return"head"in e&&"declaration"in e}function Ns(e){let t=e.element;return e.type==="list"&&typeof t?.type=="string"&&(F(t.type)||t.type==="media")}function Gr(e,t){if(!As.includes(e))throw new Error(`fact registry: "${e}" is not a home`);let n=new Map,r=new Set,o={};for(let[l,d]of Object.entries(t)){if(Ms.includes(l))throw new Error(`fact registry: ${e} declares a page keyed "${l}", a registry's own key`);n.set(d,l);let m=Ls(d)?d:{head:null,declaration:d};o[l]=m,Ns(m.declaration)&&r.add(`${e}.${l}`)}let i={home:e,pages:n,mediaLists:r},s={};for(let[l,d]of Object.entries(o))s[l]=Fs(e,l,d,i);let a={home:e,pages:s};for(let l of Object.keys(t))a[l]={kind:"home",key:`${e}.${l}`};return a}var Ds=[{value:"for_sale",label:"For sale",icon:"tag",description:"List price, finance details, and a sold-ready layout."},{value:"for_rent",label:"For rent",icon:"key",description:"Monthly rent, lease terms, pets, and utilities."}],Hs=["sold","active"],Us=["total","monthly"];function qs(e){return e==null?"active":"sold"}function Ks(e){return e==="for_rent"?"monthly":"total"}var Bs=6371e3;function Ws(e,t,n,r){let o=l=>l*Math.PI/180,i=o(n-e),s=o(r-t),a=Math.sin(i/2)**2+Math.cos(o(e))*Math.cos(o(n))*Math.sin(s/2)**2;return 2*Bs*Math.asin(Math.sqrt(a))}function Vs(e,t){return e?.latitude==null||e.longitude==null||t?.latitude==null||t.longitude==null?null:Math.round(Ws(t.latitude,t.longitude,e.latitude,e.longitude))}var Yr=Gr("library",{contacts:Q({title:"Your contacts",description:"The people your listings name, with the headshots and logos they carry."},P({label:"Contacts",item:()=>{let e=$.short({label:"Name",cap:256});return Ee({label:e,fields:{headshot:J({label:"Headshot"}),name:e,title:$.short({label:"Title",cap:128}),org_name:$.short({label:"Organization",cap:256}),email:jr({label:"Email"}),phone:Pr({label:"Phone"}),website:he({label:"Website"}),address:ct({label:"Address"}),bio:$.long({label:"Bio",cap:4e3}),logo_dark:J({label:"Logo for light backgrounds",process:[ft.cutout()]}),logo_light:J({label:"Logo for dark backgrounds",process:[ft.cutout()]}),instagram:he({label:"Instagram"}),linkedin:he({label:"LinkedIn"}),x:he({label:"X"}),facebook:he({label:"Facebook"})}})}}))});Yt(Yr);var pn=Q({title:"What\u2019s the address?",description:"We\u2019ll build your map and neighborhood details from this."},ct({label:"Address"})),Xr=Q({title:"For sale or for rent?",description:"This adjusts the pricing details we ask for."},qe({label:"Listing intent",from:[...Ds]})),se=Q({title:"Add photos, docs, and links",description:"Everything you add helps fill and enrich your website."},P({label:"Uploads",item:dt()})),mn=P({label:"Media",item:dt({kinds:["image","video","tour"],from:se}),source:N.pick({brief:"Does this upload show the property? It belongs when its name or account says it is a photograph, a rendering, a video or a virtual tour of the property: its building, rooms, grounds, amenities, surroundings or views. It does not belong when its name or account says it is a floor plan or another diagram; a logo, wordmark or brand graphic; a headshot, portrait or other photograph of a person or people; a flyer, ad, business card, slide or other image that is mostly text; a screenshot; a map; or a scanned document page. When neither its name nor its account says what it is, you cannot tell. Order what belongs as a walk through the property: aerial and street views first, then the approach and entry, then the interiors room by room (living spaces, kitchen and dining, bedrooms, bathrooms), then outdoor spaces, amenities, surroundings and views, with every shot of one space together. A video or tour sits with the space it shows, and one of the whole property comes first."})}),Jr=P({label:"Floor plans",item:J({label:"Floor plan",from:se,process:[ft.cutout({enclosed:"keep"})]}),source:N.pick({brief:"Is this upload exactly one floor plan? A floor plan is a top-down view of one floor of a dwelling's rooms and walls \u2014 drawn or rendered, flat or in 3D, at any size. It belongs when its name or account says it shows one floor plan, whatever title, figures or text are printed around it. It does not belong when its name or account says it holds two or more plans, or says it is something else: a building key or locator diagram (the building's outline with one unit shaded), a site, plot, parking or driveway diagram, a standalone legend, scale bar or north arrow, a logo, a photograph, or plain text. When neither its name nor its account says what it is, or how many plans it holds, you cannot tell. Order what belongs from the lowest floor to the highest; plans of several units go in the order the units are numbered, each unit's floors together."})}),zs=P({label:"Documents",item:dt({kinds:["document","image","video"],from:se}),source:N.pick({brief:"Does this upload set out the property's specifics? It belongs when its name or account says it records its figures, finances, terms, legal record, condition or plans: an offering memorandum, brochure, listing sheet, rent roll, financials, comparables, lease, survey, site plan, plan set, disclosure or report. It does not belong when its name or account says it is a photograph, rendering, video or tour showing the property; an image of floor plans or elevations; a logo; a photograph of people; an ad, sign or announcement; a map; or notes for whoever makes the marketing. When neither its name nor its account says what it is, you cannot tell. Order what belongs as a buyer reads it: the offering memorandum, brochure or listing sheet first, then the financials, rent roll and comparables, then the leases, legal record and disclosures, then the reports, surveys and plans."})}),Gs=J({label:"Hero",from:mn,source:N.pick({brief:"Choose the single cover photo for the property's page. The cover is a wide banner above the property's address, so it must stand for the whole property at a glance. Only an image whose name or account says it is a photograph of the property can be chosen. Never choose a logo, wordmark or other brand graphic; an agent, team or company headshot; a flyer, ad, business card, slide or any image that is mostly text; a screenshot; a map; a scanned document or brochure page; or a floor plan or other diagram \u2014 nor an image whose name and account do not say what it is. Among the photographs of the property prefer, in order: a front exterior of the building; another exterior or aerial view; the widest, brightest shot of the main living space. Rank close-up details, bathrooms, utility spaces, empty rooms and anything that reads as a fragment rather than a place last: they are weaker covers, never excluded, so when they are the only photographs of the property, choose the best of them. If not one candidate is a photograph of the property, choose none: no banner beats a banner that is not the property."})}),Ys=he({label:"Website"}),Xs=`Is this floor plan labelled for this unit? Its label is read from its name and the text printed on it, never from the rooms drawn or any figures. It belongs when its label names this unit: the unit's label or a plain variant of it ("Unit 3", "#3", "Apt 3" and "Residence 3" all label "Unit 3"); a descriptor the unit's label carries in brackets, like "(PH)", may be left off. A plan labelling several units, such as a shared floor printed "Unit 1/2/3", belongs to each of them. It is excluded when it labels other units and not this one. When it labels no unit, you cannot tell. Order what belongs from the lowest floor to the highest.`,Js=`Is this photo labelled for this unit? Its label is read from its name, the text printed on it and a caption its account records, never from the rooms it shows, any figures, how much it looks like the unit or where it falls among the uploads. It belongs when its label names this unit: the unit's label or a plain variant of it ("Unit 3", "#3", "Apt 3" and "Residence 3" all label "Unit 3"); a descriptor the unit's label carries in brackets, like "(PH)", may be left off. A photo labelled for several units belongs to each of them. It is excluded when it labels other units and not this one. When it labels no unit, you cannot tell.`,Zs=[`List every dwelling the uploads present with its own specs printed \u2014 its beds, baths, square feet, asking price or rent written out for that dwelling: the home a listing describes, or each unit a building's documents name or number. A dwelling the uploads only name, picture or mark with a status, with no specs of its own, is not listed. A plan or row printed for several units ("Unit 4/6") lists each of those units, each with what is printed for it. A dwelling named in several uploads, or on several pages, is one item carrying everything they print for it. A unit-mix row standing for several unnamed units is not a dwelling; neither is a whole building, a comparable property, a market average or a portfolio total.`,"Every member is what an upload prints as text for that dwelling, and nothing else. An upload's own text, as its account quotes it (a document's or a sheet's content, an image's printed words), is what it prints; the account's description of what a drawing, a photo or a map shows (the rooms, the doors, the spaces) is never a member's source. Never count rooms; never compute, round or convert a figure; never carry one across from another dwelling, a unit-mix average or the building's totals; never add what is usual for a dwelling of its kind. A figure printed for a neighbourhood, a development or the building is never a dwelling's, and a count or fee is 0 only where the uploads print none for that dwelling. A member no upload prints for that dwelling is null, and a null is always better than a guess.",`label: the unit's own name as printed \u2014 its unit number or name ("201", "Residence 201", "4B", "Penthouse 501"), without a word marking its status ("model", "available") \u2014 and never its street address. A dwelling presented alone, with no unit name, is always labelled "Home", whatever name the uploads print for the home itself.`,"beds, baths, sqft: exactly as printed for that dwelling; a studio has one bedroom.",'price: the asking price or monthly rent as written for that dwelling, or its status word ("Sold", "Leased", "Request for Info").','floor: the floor of its building the dwelling sits on, as printed ("3", "PH", "Ground", "3 to 4"); never read off its unit number.',"hoa_monthly: the HOA, condo or strata fee printed per month for that dwelling. A fee printed for another period, or for the building, is null.",'parking: the number of parking spaces printed for that dwelling ("1 deeded space" is 1, "two-car garage" is 2). Parking printed with no count, or for the building, is null.',"lot_sqft: the lot size printed in square feet for that dwelling: a home's own lot. A lot in another unit, or the lot of a building several dwellings share, is null.",'amenities: the real selling points of that dwelling, the qualitative features a client would notice that its beds, baths, size, floor, parking and price do not already say, such as "Private roof deck", "Harbor views", "Corner exposure". Name only what an upload says about that dwelling, in a few words. Never make one up and never add one just to fill the list: a feature the whole building shares, a routine fitting or finish, a note printed on a plan (which way a door opens, extra space) or a restated size is not a selling point. Most dwellings have none to three; leave the list empty when nothing stands out.',"When the uploads present no dwelling with its own specs printed, return no items."].join(`
146
+ </script>`;function Jr(){let e={};return new Proxy(e,{get:(t,n)=>typeof n!="string"||n in e||n==="then"||n==="toJSON"?e[n]:`#${n}`})}function Zr(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 Se={catalog:"api/catalog",render:"api/render",media:e=>`api/media${Zr({fixture:e})}`,capture:(e,t)=>`api/capture/${e}${Zr({fixture:t.fixture,format:t.format,page:t.page,canvas:t.canvas})}`,live:(e,t)=>`fixtures/${encodeURIComponent(e)}/live${t==="/"?"/":`${t}/`}`,hmr:"__hmr"};var Is=["text","number","select","image","list","poi","url","date","email","phone","address","video","tour","document","media"],As=[],fc=[...Is,...As];var On=["id","slot","index","def","value","present","enclosing"],At=["image","video","tour","document"];function F(e){return At.includes(e)}var De={cutout:{label:"Background removed",kinds:["image"],site:"holder",options:{enclosed:{required:!1,type:"string",values:["clear","keep"]}}},autocrop:{label:"Cropped to its subject",kinds:["image"],site:"holder",options:{brief:{required:!0,type:"string"}}},probe:{label:"Probed",kinds:["image","video","document"],site:"kind",options:{}},understand:{label:"Understood",kinds:["image","video","document","tour"],site:"kind",options:{}},preview:{label:"Preview",kinds:["image","video","document"],site:"kind",options:{}},ladder:{label:"Renditions",kinds:["image","video","document"],site:"kind",options:{}},transcode:{label:"Transcoded",kinds:["video"],site:"kind",options:{}},poster:{label:"Poster",kinds:["video","document"],site:"kind",options:{}},rasterize:{label:"Pages rasterized",kinds:["document"],site:"kind",options:{}},fetch:{label:"Link fetched",kinds:["video","tour"],site:"kind",options:{}},tour_details:{label:"Tour details",kinds:["tour"],site:"kind",options:{}},crop:{label:"Cut to its crop",kinds:["image"],site:"place",options:{}}},Qr=Object.keys(De),js=Qr.filter(e=>De[e].site==="holder"),pc=Qr.filter(e=>De[e].site==="kind");function Ps(e){return typeof e=="string"&&Object.hasOwn(De,e)}function Ts(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let{kind:t,verb:n}=e;return t==="process"&&Ps(n)?e:null}function $n(e){let t=De[e.verb],n=Object.keys(t.options),r=n.length>0?`it takes ${n.map(o=>`\`${o}\``).join(", ")}`:"it takes none";for(let[o,i]of Object.entries(e)){if(o==="kind"||o==="verb"||i===void 0)continue;if(o==="reads")return`\`${e.verb}\` takes no \`reads\` \u2014 a process is about one media value, never the property`;let s=t.options[o];if(s===void 0){let a=o==="aspect"&&e.verb==="autocrop"?"; its aspect is the holder's `crop` \u2014 the aspect it locks, free form where it locks none":"";return`\`${e.verb}\` takes no option "${o}" \u2014 ${r}${a}`}if(s.values!==void 0){if(typeof i!="string"||!s.values.includes(i))return`\`${e.verb}\`'s \`${o}\` is one of ${s.values.map(a=>`"${a}"`).join(", ")}`;continue}if(typeof i!==s.type||typeof i=="string"&&i.trim()==="")return`\`${e.verb}\`'s \`${o}\` is a non-empty ${s.type}`}for(let[o,i]of Object.entries(t.options))if(i.required&&e[o]===void 0)return`\`${e.verb}\` requires \`${o}\``;return null}function J(e){let{type:t,kinds:n}=e;if(t==="media"){let r=Array.isArray(n)?n.filter(o=>typeof o=="string"&&F(o)):[];return r.length>0?r:At}return typeof t=="string"&&F(t)?[t]:[]}function En(e){let{kinds:t,process:n}=e;if(t!==void 0){if(e.type!=="media")return"declares `kinds` \u2014 only `media()` leaves its kind open; a kind's own builder fixes it";if(!Array.isArray(t)||t.length===0||!t.every(i=>typeof i=="string"&&F(i)))return`declares \`kinds\` ${JSON.stringify(t)} \u2014 a non-empty list of ${At.join(", ")}`}if(n===void 0)return null;let r=js.map(i=>`process.${i}()`).join(", ");if(!Array.isArray(n)||n.length===0)return`declares \`process\` ${JSON.stringify(n)} \u2014 a non-empty list of processes (${r})`;let o=new Set;for(let i of n){let s=Ts(i);if(s===null)return`processes ${JSON.stringify(i)}, which is no process (${r})`;let{verb:a}=s,l=De[a];if(l.site==="kind")return`processes "${a}", which every ${l.kinds.join(", ")} gets from birth on its kind's row \u2014 never a holder's to declare`;if(l.site==="place")return`processes "${a}", which every ${l.kinds.join(", ")} place gets wherever its value carries a crop \u2014 never a holder's to declare`;if(o.has(a))return`processes "${a}" twice \u2014 a holder declares each process once`;o.add(a);let d=$n(s);if(d!==null)return`processes "${a}" with options that do not fit: ${d}`;let f=J(e).filter(p=>!l.kinds.includes(p));if(f.length>0)return`processes "${a}", which applies to ${l.kinds.join(", ")} and not to ${f.join(", ")}`}return null}var In=["visibility","variant"];var Ms={matterport:{kind:"tour",label:"Matterport",pattern:/(^|\.)matterport\.com$/i,strategy:"api"},biganto:{kind:"tour",label:"Biganto",pattern:/(^|\.)biganto\.com$/i,strategy:"opengraph"},iguide:{kind:"tour",label:"iGUIDE",pattern:/(^|\.)youriguide\.com$/i,strategy:"opengraph"},kuula:{kind:"tour",label:"Kuula",pattern:/(^|\.)kuula\.co$/i,strategy:"opengraph"},momento360:{kind:"tour",label:"Momento360",pattern:/(^|\.)momento360\.com$/i,strategy:"opengraph"},cloudpano:{kind:"tour",label:"CloudPano",pattern:/(^|\.)cloudpano\.com$/i,strategy:"none"},asteroom:{kind:"tour",label:"Asteroom",pattern:/(^|\.)asteroom\.com$/i,strategy:"none"},zillow3d:{kind:"tour",label:"Zillow 3D Home",pattern:/(^|\.)zillow\.com$/i,path:/^\/view-3d-home\//i,strategy:"none"},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 eo(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(Ms))if(r.pattern.test(t.hostname)&&!(r.path&&!r.path.test(t.pathname)))return n;return null}var Cs="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 to(e){let t=e.trim();if(!t)return null;let n=eo(t);if(n==="vimeo"){let r=t.match(/vimeo\.com\/(?:.*\/)?(\d+)/);return r?`https://player.vimeo.com/video/${r[1]}?${Cs}`: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 no(e){let t=e.trim();if(!t)return null;let n=eo(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!==null&&Fs.has(n)?t:null}var Fs=new Set(["biganto","iguide","kuula","momento360","cloudpano","asteroom","zillow3d"]);var Ds=["crop","cutout","mask_white","mask_black"];function jn(e){return e!==null&&!(e.x<=0&&e.y<=0&&e.width>=1&&e.height>=1)}function Ls(e){return e.url!==null?e.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i,""):e.key?.split("/").pop()??e.id}function Pn(e,t){let{id:n,renditions:r,...o}=e,i=e.kind==="image";return{...o,id:t.id,file:t.file,crop:i?t.crop:null,name:t.name!==null&&t.name!==""?t.name:Ls(e),renditions:{...r,crop:i?t.renditions.crop:null,cutout:i?t.renditions.cutout:null,mask_white:i?t.renditions.mask_white:null,mask_black:i?t.renditions.mask_black:null}}}function ro(e){return e.url===null?"upload":"link"}function Z(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function et(e){if(!Z(e))return!1;let{id:t,kind:n,renditions:r}=e;return typeof t=="string"&&typeof n=="string"&&F(n)&&Z(r)}function tt(e){return Z(e)&&typeof e.id=="string"&&typeof e.file=="string"&&Z(e.renditions)&&!("kind"in e)&&!("picked"in e)}function jt(e){return Z(e)&&typeof e.file=="string"&&e.file!==""&&!tt(e)&&!et(e)}function Re(e){return Z(e)&&typeof e.media=="string"&&e.media!==""}function pe(e){if(Z(e)){if(Re(e))return e.media;if(tt(e)||et(e))return e.id;if(jt(e))return e.picked??e.file}}function D(e){if(Re(e))return e.media;if(jt(e))return e.file}function An(e,t){if(Array.isArray(e))for(let n of e)An(n,t);else if(tt(e))t.has(e.id)||t.set(e.id,e);else if(Z(e)&&!et(e))for(let n of Object.values(e))An(n,t)}function Pt(e){let t=new Map;for(let[n,r]of Object.entries(e))n!=="files"&&An(r,t);return t}function Ns(e,t){return Object.hasOwn(e.files,t)?e.files[t]:void 0}function oo(e,t){let n=Ns(t,e.file);return n===void 0?null:Pn(n,e)}function Tn(e){let t={};for(let[n,r]of Pt(e)){let o=oo(r,e);o!==null&&(t[n]=o)}return t}function io(e){return Object.hasOwn(e,"crop")||e.renditions!==void 0}function so(e,t){let n=Object.hasOwn(t,"crop"),r=t.renditions??{},o=n?null:e.renditions,i=Object.fromEntries(Ds.map(s=>[s,Object.hasOwn(r,s)?r[s]??null:o?.[s]??null]));return{crop:n?t.crop??null:e.crop,renditions:i}}function Hs(e,t){if(e===null||e.kind!=="image"||!io(t))return e;let n=so({crop:e.crop,renditions:e.renditions},t);return{...e,crop:n.crop,renditions:{...e.renditions,...n.renditions}}}function Mn(e,t){return io(t)?{...e,...so({crop:e.crop,renditions:e.renditions},t)}:e}function ao(e,t){let n,r=i=>(n??=Tn(t),Object.hasOwn(n,i)?n[i]:null),o=i=>{if(Array.isArray(i))return i.flatMap(a=>{let l=o(a);return l===null&&a!==null?[]:[l]});if(!Z(i)||et(i))return i;if(tt(i))return oo(i,t);if(jt(i))return r(i.file);if(Re(i))return Hs(r(i.media),i);let s={};for(let[a,l]of Object.entries(i))s[a]=o(l);return s};return o(e)}function fe(e){if(Array.isArray(e))return e.map(fe);if(!Z(e))return e;if(et(e)||tt(e))return{media:e.id};if(Re(e)){let{crop:n,renditions:r,...o}=e;return o}let t={};for(let[n,r]of Object.entries(e))t[n]=fe(r);return t}var nt="property.uploads";function lo(e){if(typeof e=="string"&&e!=="")return[e];if(!(!Array.isArray(e)||e.length===0||!e.every(t=>typeof t=="string"&&t!=="")))return[...e]}function Cn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Us(e){if(pe(e)!==void 0||!Cn(e))return e;for(let t of Object.values(e))if(pe(t)!==void 0)return t}function Fn(e,t){let[n,...r]=t.split(".");if(n!=="property"||r.length===0)return null;let o=e;for(let i of r)if(o=Array.isArray(o)?o.find(s=>Cn(s)&&s.id===i):Cn(o)&&Object.hasOwn(o,i)?o[i]:void 0,o===void 0)return null;return Array.isArray(o)?o.flatMap(i=>{let s=Us(i),a=pe(s);return a===void 0?[]:[{id:a,value:s}]}):null}function co(e,t){return Fn(e,t)?.map(({id:n})=>n)??null}function Ks(e,t){let n=Pt(e),r=new Set,o=[];for(let i of lo(t.from)??[])for(let{id:s,value:a}of Fn(e,i)??[]){if(r.has(s))continue;let l=n.get(s),d=l===void 0||!Object.hasOwn(e.files,l.file)?void 0:e.files[l.file];if(l===void 0||d===void 0||!t.kinds.includes(d.kind))continue;r.add(s);let f=Re(a)?Mn(l,a):l;o.push({id:s,value:f,file:d,list:i})}return o}function qs(e,t){return Ks(e,t).map(({value:n,file:r,list:o})=>({record:Pn(r,n),list:o}))}function _e(e,t){return qs(e,t).map(({record:n})=>n)}var _=class extends Error{constructor(n,r){super(r);this.status=n}status};function Vs(e){return e.split("-").map(t=>t&&t[0].toUpperCase()+t.slice(1)).join(" ")}function uo(e){let{variant:t}=e;return{required:e.required,variant:t===null?null:{cases:t.cases.map(n=>({value:n,label:Vs(n)})),locked:t.locked}}}function fo(e){return Object.fromEntries(e.map(t=>[t.instance_id,{enabled:t.enabled,...t.variant===void 0?{}:{variant:t.variant}}]))}function po(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new _(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 _(400,`The display state of "${n}" is not an object.`);let{enabled:o,variant:i}=r;if(o!==void 0&&typeof o!="boolean")throw new _(400,`The display state of "${n}" has a non-boolean enabled.`);if(i!==void 0&&typeof i!="string")throw new _(400,`The display state of "${n}" has a non-string variant.`);t[n]={...o===void 0?{}:{enabled:o},...i===void 0?{}:{variant:i}}}return t}function mo(e,t){for(let[n,r]of Object.entries(t)){let o=e.instances.find(s=>s.instanceId===n);if(o===void 0)throw new _(400,`The composition places no instance "${n}".`);if(r.enabled===!1&&o.display.required)throw new _(400,`Section instance "${n}" is required and cannot be hidden.`);if(r.variant===void 0)continue;let i=o.display.variant;if(i===null)throw new _(400,`Section instance "${n}" declares no display variant.`);if(i.locked)throw new _(400,`Section instance "${n}" declares a locked variant, which the user cannot switch.`);if(!i.cases.includes(r.variant))throw new _(400,`"${r.variant}" is not a declared case of section instance "${n}" (declared: ${i.cases.join(", ")}).`)}}function ho(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[i,s]of Object.entries(t))i in o||(s.variant===void 0||s.variant.cases.includes(r))&&(o[i]=s.type==="list"?[]:null);return{...e,variant:r,slots:o}}function Ws(e){return typeof e=="string"&&e!==""?e:null}function Bs(e){return{listingIntent:Ws(e.listing_intent),units:e.units.length,photos:_e(e,{kinds:["image"],from:["property.property_media"]}).length}}function zs(e){let t=JSON.stringify(e),n=3735928559,r=1103547991;for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);n=Math.imul(n^i,2654435761),r=Math.imul(r^i,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 yo(e){return{id:e.id,label:e.label,summary:Bs(e.facts),doc:zs(e.instances),display:fo(e.instances)}}function go(e,t){let n=e.replace(/\/+$/,"");return t==="/"?`${n}/`:`${n}${t}/`}function bo(e){let{pages:t,currentPageId:n,basePath:r}=e,o=t.find(a=>a.id===n);if(!o)throw new Error(`nav: page "${n}" is not one of the declared pages (${t.map(a=>a.id).join(", ")}).`);let i=[o,...t.filter(a=>a.id!==o.id&&a.enabled!==!1)],s={};for(let a of i)for(let l of a.sections)l.enabled===!1||l.key in s||(s[l.key]=a.id===o.id?`#${l.anchor}`:`${go(r,a.path)}#${l.anchor}`);return{anchors:s,pages:t.filter(a=>a.enabled!==!1).map(a=>({id:a.id,label:a.label,href:go(r,a.path),current:a.id===o.id}))}}function Tt(e,t){return e.pages?.[t]?.enabled!==!1}function Dn(e,t){return t.filter(n=>Tt(e,n.id))}var rt={base:"stylesheets/base.css",template:"stylesheets/template.css"},re={frame:"__capture/frame",print:"__capture/print"};function wo(e){return new URLSearchParams(e).toString()}function Ln(e,t,n){return`${re.frame}?${wo({fixture:e,page:t,format:n})}`}function ko(e,t){return`${re.print}?${wo({fixture:e,format:t})}`}var Gs=["autocomplete","manual_pinned","resolved"],xo=["street","unit","city","state","postal"],it=[...xo,"latitude","longitude"];function Oe(e){return it.includes(e)}function ot(e){if(typeof e!="string")return null;let t=e.trim();return t===""?null:t}function vo(e,t){return typeof e=="number"&&Number.isFinite(e)&&Math.abs(e)<=t?e:null}function Q(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e,n=vo(t.latitude,90),r=vo(t.longitude,180),o=n!==null&&r!==null,i=t.source,s={street:ot(t.street),unit:ot(t.unit),city:ot(t.city),state:ot(t.state),postal:ot(t.postal),latitude:o?n:null,longitude:o?r:null,source:typeof i=="string"&&Gs.includes(i)?i:null};return o||xo.some(a=>s[a]!==null)?s:null}function So(e,t){let n=Q(e);return n===null?null:n[t]}var Nn=Symbol.for("@homepages/concrete:row:of"),Hn=Symbol.for("@homepages/concrete:element:of");function Le(e){return typeof e=="object"&&e!==null&&e.kind==="sibling"&&T(e.of)}function Ys(e,t){return e===t||A(e)&&A(t)&&e.key===t.key}function Mt(e,t){let n=[...e];for(let r of t??[])n.some(o=>Ys(o,r))||n.push(r);return n}function W(e){return typeof e=="object"&&e!==null&&"section"in e&&typeof e.section=="string"&&"slot"in e&&typeof e.slot=="string"}function Un(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="row"&&"field"in e&&typeof e.field=="string"}function oe(e){if(!Un(e))return;let t=e[Nn];return typeof t=="object"&&t!==null?t:void 0}function B(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="element"}function Ro(e){if(!B(e))return;let t=e[Hn];return typeof t=="object"&&t!==null?t:void 0}function A(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="home"&&"key"in e&&typeof e.key=="string"}function _o(e){return typeof e=="object"&&e!==null&&"head"in e&&typeof e.head=="object"&&"declaration"in e&&T(e.declaration)}function T(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}function Ct(e,t){if(typeof e=="function")return{kind:"compute",fn:e,reads:[]};let n=t;if(e.requires===void 0)return{kind:"compute",fn:n,reads:[...e.reads]};if(!Array.isArray(e.requires)||e.requires.length===0)throw new Error("compute(): `requires` names at least one read \u2014 omit it when the value needs none.");return{kind:"compute",fn:n,reads:Mt(e.reads,e.requires),requires:[...e.requires]}}function L(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="compute"&&"fn"in e&&typeof e.fn=="function"}function Ft(e){return typeof e=="object"&&e!==null&&e.kind==="compute"&&typeof e.fn=="function"}var Xs="written-without-pick-none",Js={write:new Set(["brief","reads","requires","none"]),pick:new Set(["brief","reads","requires","unique"]),find:new Set(["brief","reads","requires","none"])};function Kn(e,t){let n=`fill.${e}()`;if(typeof t.brief!="string"||t.brief.trim()==="")throw new Error(`${n}: \`brief\` is required \u2014 it is the whole instruction the model is given.`);let r=Js[e],o={kind:"fill",verb:e};for(let[s,a]of Object.entries(t)){if(!r.has(s)){let l=s==="none"&&e==="pick"?` A pick judges every candidate, so selecting none is already an outcome its brief steers \u2014 \`concrete upgrade\` drops \`none\` from every \`fill.pick\` (the \`${Xs}\` codemod).`:s==="count"?" A fill takes no count: the list's own `min` and `max` bound how many items it fills.":s==="cap"?" A write's budget is its holder's `cap` \u2014 a text slot's own, or a list's `item: text.short({ cap })`.":s==="of"&&e==="find"?" A find names no candidates: the platform's lookup for its holder's kind supplies the value.":s==="of"&&e==="pick"?" A pick chooses from its holder's candidates \u2014 a select's values, a media slot's `from` list of its kinds, a row's table, a list's item's.":s==="of"?" The kind a write produces is its holder's \u2014 a text slot's own, a list's `item`, a label's text slot.":"";throw new Error(`${n}: "${s}" is not an option \u2014 it takes ${[...r].map(d=>`\`${d}\``).join(", ")}, and everything the model should know goes in the brief.${l}`)}if(s==="none"&&a!==void 0&&a!==!0)throw new Error(`${n}: \`none\` is \`true\` or absent \u2014 it admits the empty answer, and the brief's last sentence says when nothing is right.`);if(s==="unique"&&a!==void 0&&typeof a!="boolean")throw new Error(`${n}: \`unique\` is a boolean \u2014 \`false\` lets a pick repeat an element.`);if(s==="requires"&&a!==void 0&&(!Array.isArray(a)||a.length===0))throw new Error(`${n}: \`requires\` names at least one read \u2014 omit it when the fill needs none.`);a!==void 0&&(o[s]=s==="reads"||s==="requires"?[...a]:a)}let i=o.requires;return i!==void 0&&(o.reads=Mt(o.reads??[],i)),o}function Zs(e){return Kn("write",e)}function Qs(e){return Kn("pick",e)}function ea(e){return Kn("find",e)}var z={write:Zs,pick:Qs,find:ea};function G(e,t){if(ee(e))return[e];if(!Array.isArray(e)||!e.every(o=>typeof o=="object"&&o!==null))return;if(e.length===0)throw new Error(`${t} declares \`source: []\` \u2014 a list of fills names at least one fill, and a holder nothing fills declares no \`source\`.`);let n=e.filter(o=>!ee(o)).length;if(n===0)return e;let r=n<e.length?"a derivation beside a fill":n>1?"several derivations":"a derivation in a list";throw new Error(`${t}'s \`source\` lists ${r} \u2014 \`source\` takes one derivation (a fact, a slot, a row's member, the element, a \`compute()\`) or an ordered list of fills: a holder has one write path, and a derived value has no writer beside it.`)}function $e(e){return ee(e)||Array.isArray(e)&&e.length>0&&e.every(ee)}function ee(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="fill"&&"verb"in e&&(e.verb==="write"||e.verb==="pick"||e.verb==="find")&&"brief"in e&&typeof e.brief=="string"}var Dt=Symbol.for("@homepages/concrete:fill:declaration");function Oo(e){return $e(e)?{[Dt]:ee(e)?[e]:[...e]}:{}}function q(e){if(!(typeof e!="object"||e===null))return e[Dt]}var $o=["Basement","Ground","1st floor","2nd floor","3rd floor","4th floor","Penthouse"];var Ne=new Map;function Vn(e){Ne.set(e.home,e)}function Io(e){let t=Ne.get(e);if(t===void 0)throw new Error(`fact registry: the ${e} registry is not declared yet \u2014 import @homepages/template-contracts/fact-registry (or ./fact-keys, ./table-members) before reading it.`);return t}var Ao=new Set(["text","select","email","phone","url","date"]);function Lt(e){switch(e.type){case"number":case"image":case"address":return e.type;case"list":return ta(e.element);default:return Ao.has(e.type)?"text":null}}function ta(e){return e.type==="object"?"row_list":e.type==="image"?"image_list":e.type==="number"?"number_list":Ao.has(e.type)?"text_list":null}function na(e){if(e.type!=="list")return!1;let t=e.element.type;return F(t)||t==="media"}function jo(e){return Object.entries(e.pages).flatMap(([t,n])=>na(n.declaration)?[`${e.home}.${t}`]:[])}function Po(e){return Ft(e.source)}var Eo=new WeakMap;function Wn(e){let t=Eo.get(e);return t===void 0&&(t=ra(e),Eo.set(e,t)),t}function ra(e){let t=new Map;for(let[n,r]of Object.entries(e.pages)){let o=r.declaration;if(o.type==="list")continue;let i=`${e.home}.${n}`;if(o.type==="address"){t.set(i,{declaration:o,value_type:"address"});for(let s of it)t.set(`${i}.${s}`,{declaration:o,value_type:Bn(s)});continue}t.set(i,{declaration:o,value_type:oa(i,o)})}return t}function oa(e,t){if(t.type==="image")return"image";if(F(t.type)||t.type==="media")throw new Error(`fact registry: ${e} is a single ${t.type} \u2014 a top-level media fact is an image, the one media value a slot binds.`);return t.type==="number"?"number":"text"}function Bn(e){return e==="latitude"||e==="longitude"?"number":"text"}function ia(e,t){if(t.type!=="list")return null;let n=t.element;return n.type==="object"?e:n.type==="row"?n.from.slice(n.from.indexOf(".")+1):null}var qn;function To(){if(qn!==void 0)return qn;Io("library");let e=new Map;for(let t of Ne.values())for(let[n,r]of Object.entries(t.pages)){let o=ia(n,r.declaration);o!==null&&e.set(`${t.home}.${n}`,o)}return Ne.has("property")&&Ne.has("library")&&(qn=e),e}function zn(){return[...new Set(To().values())]}function E(e){return typeof e=="string"?To().get(e)??null:null}function Gn(e){return e?.kind==="home"?E(e.key):null}function Nt(e){for(let t of Ne.values()){let n=Object.hasOwn(t.pages,e)?t.pages[e]:void 0;if(n?.declaration.type==="list"&&n.declaration.element.type==="object")return t.home}throw new Error(`fact registry: no linked registry declares a table "${e}"`)}function Yn(e,t){let n=e.pages[t],r=n?.declaration.type==="list"?n.declaration.element:void 0;if(r?.type!=="object")throw new Error(`fact registry: the ${e.home} registry declares no list of objects "${t}"`);return r.fields}function Xn(e){return Yn(Io(Nt(e)),e)}function Jn(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function ie(e,t){let n=Jn(Xn(e),t);return n===void 0?void 0:Lt(n)}function Zn(e){if(typeof e!="string")return null;let t=e.lastIndexOf(".");if(t<=0)return null;let n=E(e.slice(0,t));if(n===null)return null;let r=e.slice(t+1);return ie(n,r)==="row_list"?{table:n,member:r}:null}function Ht(e){if(typeof e!="string")return null;let t=e.lastIndexOf(".");if(t<=0)return null;let n=e.slice(0,t),r=E(n);if(r===null)return null;let o=e.slice(t+1);return ie(r,o)===void 0?null:{table:r,tableKey:n,member:o}}var Ut=["type","label","from","source","locked","when"],Mo=new Set(Ut),Kt=Symbol.for("@homepages/concrete:table-of");function qt(e,t){return Object.defineProperty(e,Kt,{value:t,enumerable:!1})}function at(e){if(typeof e!="object"||e===null)return null;let t=e[Kt];return typeof t=="string"?t:null}function sa(e){return Object.keys(Xn(e))}function st(e,t){return Object.freeze({kind:"row",field:t,[Nn]:e})}function aa(e,t){return new Proxy(st(e,t),{get(n,r,o){return typeof r=="string"&&!(r in n)&&Oe(r)?st(e,`${t}.${r}`):Reflect.get(n,r,o)}})}var Co=Symbol.for("@homepages/concrete:row:definition");function N(e){let t=e[Co];return typeof t=="object"&&t!==null?t:e}var la=new Set(["then","toJSON","$$typeof","asymmetricMatch","nodeType","tagName","@@iterator"]);function Fo(e,t,n=[]){let r=t===null?null:new Set(sa(t)),o=new Proxy(e,{get(i,s,a){if(s===Co)return i;if(typeof s!="string")return Reflect.get(i,s,a);if(t!==null&&r!==null){let l=[t,...n],d=l.map(p=>p===t&&!r.has(s)?void 0:ie(p,s));if(d.every(p=>p===void 0))return Reflect.get(i,s,a);let f=d.findIndex(p=>p===void 0||p!==d[0]);if(f===-1)return d[0]==="address"?aa(o,s):st(o,s);if(s in i||Mo.has(s))return Reflect.get(i,s,a);throw new Error(`row: "${String(i.label)}" reads the member "${s}", which its \`from\` table ${l[f]} ${d[f]===void 0?"lacks":"holds at another kind"} \u2014 every table a row names carries every member its readers read, at one kind.`)}return s in i||Mo.has(s)?Reflect.get(i,s,a):la.has(s)?void 0:st(o,s)}});return o}function Do(e){let t=new Proxy(e,{get(n,r,o){return typeof r=="string"&&!(r in n)&&Oe(r)?st(t,r):Reflect.get(n,r,o)}});return t}function Lo(e,t){let n=e.map(t);return n.some((r,o)=>r!==e[o])?n:void 0}function No(e,t){let n=e.reads===void 0?void 0:Lo(e.reads,t),r=e.requires===void 0?void 0:Lo(e.requires,t);return n===void 0&&r===void 0?e:{...e,...n===void 0?{}:{reads:n},...r===void 0?{}:{requires:r}}}function se(e,t){let n=N(e),r,o=n.source;if(o!==void 0)if(L(o)){let s=No(o,t);s!==o&&(r={...n,source:s})}else{let s=t(o);s!==o&&(r={...n,source:s})}let i=q(n);if(i!==void 0){let s=!1,a=i.map(l=>{let d=No(l,t);return d!==l&&(s=!0),d});s&&(r={...r??n,[Dt]:a})}return r??n}function Ho(e){return t=>{let n=oe(t);if(n===void 0)return t;let r=e.get(n);return r===void 0?t:{kind:"row",slot:r,field:t.field}}}var Uo=new Set(["row","address"]);function Ko(e){let t=new Map;for(let[n,r]of Object.entries(e))typeof r=="object"&&r!==null&&Uo.has(r.type)&&t.set(r,n);return t}function qo(e,t,n){let r=[e.source];se(e,o=>(r.push(o),o));for(let[o,i]of t)if(!(o===e||i===n))for(let s of Ut){let a=o[s];if(a!==void 0&&r.includes(a))return`${i}.${s}`}}function Vo(e){let t=e.slice(e.indexOf(".")+1);return`reads \`${e}\`, which is the row's own \`${t}\`, not a member \u2014 a row's ${Ut.map(n=>`\`${n}\``).join(", ")} are its slot definition's, and its table has no member named \`${t}\`.`}function me(e){return Uo.has(e.type)?{...N(e)}:e}function er(e,t){for(let n of G(t,e)??[])if(!(n.verb!=="pick"||n.of===void 0))throw new Error(`${e}'s \`fill.pick\` states \`of\` \u2014 a pick chooses from its holder's \`from\`; remove \`of\` and name the candidates in \`from\`.`)}function da(e){return W(e)?{kind:"section",section:e.section,slot:e.slot}:T(e)?{kind:"sibling",of:e}:A(e)?{kind:"home",key:e.key}:e}function Y(e){return lt(e,da)}function ca(e,t,n){if(!(t!==!0||n===void 0)){if(L(n)){if(n.requires!==void 0&&n.requires.length>0)return;throw new Error(`${e} is \`required\` and sourced by a \`compute()\` naming no \`requires\` \u2014 nothing to require. Name the reads the value cannot do without: \`compute({ reads, requires: [fact.property.address] }, \u2026)\`.`)}if(W(n)||T(n)||Le(n))throw new Error(`${e} is \`required\` and mirrors another slot \u2014 a mirror requires its upstream; mark that slot \`required\` instead.`)}}function lt(e,t){let n=e.source;ca(e.label??"a slot",e.required,n);let r=n!==void 0&&G(n,e.label??"a slot")===void 0;return{...e.locked===!0?{locked:!0}:{},...e.required===!0?{required:!0}:{},...r?{source:t(n)}:{},...Oo(n),...e.label!==void 0?{label:e.label}:{},...e.placeholder!==void 0?{placeholder:e.placeholder}:{},...e.when!==void 0?{when:e.when}:{}}}function Qn(e){return t=>({type:"text",size:e,...Y(t),...t.cap!==void 0?{cap:t.cap}:{}})}var C={short:Qn("short"),medium:Qn("medium"),long:Qn("long")};function M(e){return{type:"number",...Y(e),...e.thousandsSep!==void 0?{thousandsSep:e.thousandsSep}:{},...e.decimals!==void 0?{decimals:e.decimals}:{},...e.maxDigits!==void 0?{maxDigits:e.maxDigits}:{}}}function ua(e){return{type:"select",...Y(e),...e.creatable!==void 0?{creatable:e.creatable}:{}}}function fa(e){if(A(e.source))throw new Error(`select: "${e.label}" declares both \`from\` and a fact \`source\` \u2014 a select takes exactly one set of choices.`);return er(`select: "${e.label}"`,e.source),{type:"select",...Y(e),values:[...e.from],...e.creatable!==void 0?{creatable:e.creatable}:{}}}function pa(e,t){if(ee(t.source)&&t.source.verb!=="pick")throw new Error(`select: a display entry is filled by \`fill.pick\` \u2014 the model picks one of its cases \u2014 never \`fill.${t.source.verb}\`.`);return er("select: a display entry",t.source),{cases:[...e],...t.locked===!0?{locked:!0}:{},...t.source!==void 0?{source:t.source}:{}}}function ma(e){if(Array.isArray(e))throw new Error("select: takes one options object \u2014 write the choices as `from`: `select({ from: [...], \u2026 })`.");if(e.options!==void 0)throw new Error("select: declares `options` \u2014 a select names its choices in `from`: `select({ from: [...], \u2026 })`.");return e.label===void 0&&Array.isArray(e.from)?pa(e.from,e):e.from!==void 0?fa(e):ua(e)}var dt=ma;function Ee(e){return{type:"url",...Y(e),...e.accepts!==void 0?{accepts:e.accepts}:{}}}function tr(e){return{type:"date",...Y(e)}}function Wo(e){return{type:"email",...Y(e)}}function Bo(e){return{type:"phone",...Y(e)}}function Vt(e={}){return Do({type:"address",...Y(e)})}function zo(e,t){let n=`${e}: "${t.label??e}"`;if(er(n,t.source),"category"in t)throw new Error(`${n} declares \`category\` \u2014 a media declaration names the list it picks from in \`from\` (\`from: fact.property.property_media\`, \`fact.property.floor_plans\`, \`fact.property.uploads\`), or owns its media without one.`);if("sources"in t)throw new Error(`${n} declares \`sources\` \u2014 a media slot takes a pasted link wherever a link provider claims its kind (a video, a tour), and declares nothing for it. \`concrete upgrade\` removes it.`);let r=En({type:e,kinds:t.kinds,process:t.process});if(r!==null)throw new Error(`${n} ${r}.`);let o=G(t.source,n),i=t.source!==void 0&&o===void 0&&!L(t.source);if(i&&t.from!==void 0)throw new Error(`${n} picks \`from\` a media list and declares a \`source\` \u2014 a slot bound to a fact holds what that fact holds.`);if((i||L(t.source))&&t.process!==void 0)throw new Error(`${n} declares \`process\` beside a \`source\` that derives its value \u2014 a derived slot holds what it derives from, processed where that is declared.`);if(o?.some(l=>l.verb==="pick")===!0&&t.from===void 0)throw new Error(`${n} is picked by a \`fill.pick\` and names no \`from\` \u2014 a pick chooses from its holder's \`from\` (\`from: fact.property.property_media\`); a media declaration without one owns its media.`);let a=ha(n,e,t.kinds,t.from)?.map(l=>A(l)?l.key:l);return{...a!==void 0?{from:a.length===1?a[0]:a}:{},...t.process!==void 0?{process:t.process.map(l=>({...l}))}:{}}}function ha(e,t,n,r){if(r===void 0)return;let o=Array.isArray(r)?r:[r];if(o.length===0)throw new Error(`${e} declares \`from: []\` \u2014 name the media list it picks from, or omit \`from\` and the declaration owns its media.`);let i=J({type:t,kinds:n}),s=new Set;for(let a of o){let l=typeof a=="object"&&a!==null&&!A(a),d=A(a)?a.key:l&&"declaration"in a?a.declaration:a;if(s.has(d))throw new Error(`${e} picks \`from\` one media list twice \u2014 each list is named once; a media value two lists hold is one candidate, attributed to the first.`);if(s.add(d),!l)continue;let f=J(d.element);if(f.length>0&&!i.some(p=>f.includes(p)))throw new Error(`${e} picks \`from\` a list of ${f.join(", ")}, whose items can never be ${i.join(" or ")} \u2014 each list it picks from holds items of its kinds.`)}return o}function ae(e={}){return{type:"image",...Y(e),...e.crop!==void 0?{crop:e.crop}:{},...zo("image",e)}}function Wt(e={}){return{type:"media",...Y(e),...e.kinds!==void 0?{kinds:[...e.kinds]}:{},...zo("media",e)}}var rr=Symbol.for("@homepages/concrete:object:declared-fields");function he(e){return e[rr]}function or(e,t){let n=he(t);return n!==void 0&&Object.defineProperty(e,rr,{value:n,enumerable:!1}),e}var Go="a label is a source, as a text slot takes one",nr="`label: text.short({ cap: 60, source: fill.write({ reads, brief }) })`",ya=new Set(["type","size","cap","locked"]);function ga(e,t,n){if(typeof t=="string")throw new Error(`${e} declares the label ${JSON.stringify(t)} \u2014 ${Go}: write \`label: compute(() => ${JSON.stringify(t)})\`.`);if(T(t)){let r=Object.entries(n).find(([,o])=>o===t);if(r===void 0)return ba(e,t);if(t.type!=="text"&&t.type!=="address")throw new Error(`${e} label names its field "${r[0]}", a "${t.type}" \u2014 a label names a text or an address field.`);return{field:r[0]}}if($e(t)){let r=ee(t)?`\`fill.${t.verb}\``:"list of fills";throw new Error(`${e} label is a bare ${r} \u2014 the label is the fill's holder, so it states the kind the fill writes: ${nr}.`)}return C.short({locked:!0,source:t})}function ba(e,t){let n=q(t);if(n===void 0||n.some(s=>s.verb!=="write")||t.type!=="text")throw new Error(`${e} declares a slot as its label that is none of its fields \u2014 ${Go}: write what that slot read as the label (\`label: comp.address.street\`, \`label: compute(() => "Listing agent")\`), a written label as ${nr}; a title the user edits is a field, which the label names by its const.`);let r=Object.keys(t).filter(s=>!ya.has(s));if(r.length>0)throw new Error(`${e} label is a written text slot declaring ${r.map(s=>`\`${s}\``).join(", ")} \u2014 a label states only its kind and cap: ${nr}; a title the user edits is a field, which the label names by its const.`);let{size:o,cap:i}=t;return C[o]({locked:!0,source:n.length===1?n[0]:n,...i!==void 0?{cap:i}:{}})}function wa(e){let{type:t,element:n}=e;if(t==="object")return"an object \u2014 an object never holds another; flatten its fields into this one";if(t==="list"&&n?.type==="object")return ka(e);if(t==="list"&&n?.type==="row")return"a list of rows \u2014 declare the selection at the top level instead"}var ct="declare the list at the top level instead";function ka(e){let t=q(e);if(t!==void 0&&t.some(o=>o.verb!=="pick")||t===void 0&&$e(e.source))return`a list of objects declaring a fill other than a pick \u2014 no fill but a pick writes a list inside an object; ${ct}`;let n=e.source;if(A(n))return`a list of objects sourced by the fact "${n.key}" \u2014 its items carry their own minted ids, so it lists a row's member, a \`compute()\` or authored items; ${ct}`;if(W(n)||Le(n)||T(n))return`a list of objects sourced by another list slot \u2014 its items carry their own minted ids, so it lists a row's member, a \`compute()\` or authored items; ${ct}`;let r=e.element.fields;for(let[o,i]of Object.entries(r)){let s=va(i,r);if(s!==void 0)return`a list of objects whose item field "${o}" is ${s}`}}function va(e,t){if(e.type==="list"&&e.element?.type==="object")return"a list of objects \u2014 a list of objects nests one level; flatten the inner list's fields into this item or declare it beside the outer list";if(q(e)!==void 0)return`filled \u2014 no fill writes into a list inside an object; ${ct}`;let n=e.source;if(n===void 0)return;if(L(n))return`a \`compute()\` \u2014 an item of a list inside an object reads its element, or a row \`from\` its member; ${ct}`;let{kind:r,slot:o}=n;if(r==="element"&&e.type==="row"&&E(e.from)!==null)return"a table's row holding the element \u2014 the element of a list inside an object is a member's item: hold it in a row `from` that member (`row({ label, from: unit.floor_plans, source: entry })`)";if(r!=="element"&&!(e.type!=="row"&&r==="row"&&typeof o=="string"&&t[o]?.type==="row"))return"bound to something outside its item \u2014 an item of a list inside an object reads its element, a row `from` its member, or a row beside it"}function He(e){let t="object";if(e.source!==void 0)throw new Error(`${t} declares \`source\`, but an object is a pure container with no value of its own \u2014 declare it on the field that holds the value.`);if(Object.hasOwn(e.fields,"label")&&e.fields.label!==e.label)throw new Error(`${t} declares a field keyed "label" \u2014 the key is reserved for the object's label: write its source as \`label\`, beside \`fields\`.`);let n=On.find(f=>Object.hasOwn(e.fields,f));if(n!==void 0)throw new Error(`${t} field "${n}" is named like its binding's own \`${n}\` \u2014 a field is read straight off its object's binding, which owns ${On.map(f=>`\`${f}\``).join(", ")}. Rename the field.`);let r=e.label===void 0?void 0:ga(t,e.label,e.fields),o=r!==void 0&&!("type"in r)?r:void 0,i={...r===void 0||o!==void 0?{}:{label:r},...e.fields};if(Object.keys(i).length===0)throw new Error(`${t} declares no fields \u2014 an object groups at least one.`);for(let[f,p]of Object.entries(i)){let b=wa(p);if(b!==void 0)throw new Error(`${t} field "${f}" is ${b}.`);if(f!=="label"&&p.label===void 0)throw new Error(`${t} field "${f}" declares no \`label\` \u2014 every field of an object states the name the editor shows it by.`)}let s=Ko(i);for(let[f,p]of Object.entries(i)){let b=qo(p,s);if(b!==void 0)throw new Error(`${t} field "${f}" ${Vo(b)}`)}let a=Ho(s),l={};for(let[f,p]of Object.entries(i))l[f]=me(se(p,a));let d={type:"object",...e.locked===!0?{locked:!0}:{},...o!==void 0?{label:o}:{},fields:l,...e.when!==void 0?{when:e.when}:{}};return Object.defineProperty(d,rr,{value:i,enumerable:!1}),d}function Yo(e){let t=e.indexOf("/");return t===-1?e:e.slice(t+1)}function Jo(e,t=[]){let n=new Map;for(let s of e)for(let a of s.sections){let l=Yo(a.section);n.has(l)||n.set(l,a.instance_id)}let r=new Set(t.filter(s=>!s.enabled).map(s=>s.page_id)),o=s=>{let a=n.get(s);return a===void 0||e.filter(d=>d.sections.some(f=>f.instance_id===a)).every(d=>r.has(d.id))?void 0:a};function i(s,a){if(s.kind==="home")return{layer:"home",key:s.key};let l=s.section===Yo(a.section)?a.instanceId:o(s.section);return l===void 0?void 0:{layer:"section",instanceId:l,slot:s.slot}}return{readable:o,locate:i}}function Zo(e){if(e.type==="object")return null;let t=e.source;if(t===null||typeof t!="object")return null;let{kind:n,section:r,slot:o}=t;return n==="section"&&typeof r=="string"&&typeof o=="string"?{kind:"section",section:r,slot:o}:null}var ut=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function zt(e,t){if(Object.hasOwn(e,t))return e[t];let n=t.indexOf(".");if(n<=0)return;let r=e[t.slice(0,n)];if(r?.type!=="object"||!ut(r.fields))return;let o=t.slice(n+1);return Object.hasOwn(r.fields,o)?r.fields[o]:void 0}function xa(e,t,n){if(t.siblings!==void 0&&Object.hasOwn(t.siblings,n))return{path:t.container===void 0?n:`${t.container}.${n}`,def:t.siblings[n],sibling:!0};if(t.nested===!0)return;let r=zt(e,n);return r===void 0?void 0:{path:n,def:r,sibling:!1}}function Qo(e){return e==="row"||e==="address"}function ft(e,t,n){let r=xa(e,t,n);if(!(r===void 0||!Qo(r.def.type)))return{...r,kind:r.def.type}}function Sa(e){return E(e.from)}function Ie(e){if(!Array.isArray(e.from)){let t=Sa(e);return t===null?[]:[t]}return e.from.flatMap(t=>E(t)??[])}function Gt(e,t){let n=new Set,r=[];for(let o of t){let i=e[o];for(let s of i){let a=Bt(s.id);a===null||n.has(a)||(n.add(a),r.push({id:a,table:o}))}}return r}function sr(e,t,n){if(t.length>1&&n!==null){let r=Gt(e,t).find(o=>o.id===n);if(r!==void 0)return r.table}return t[0]??null}function Ra(e){if(e===void 0)return;if(Xo(e.source))return e;if(e.type!=="object"||!ut(e.fields))return;let t=Object.values(e.fields).filter(n=>Xo(n.source));return t.length===1?t[0]:void 0}function ar(e){let t=Ra(e);return t?.type==="row"?Ie(t):[]}function Xo(e){return ut(e)&&e.kind==="element"}function ei(e,t){return _a(ir(e,e.section,e.slots,t,new Set))}function _a(e){return e.length===1?e[0]:null}function ir(e,t,n,r,o){let i=`${t??""}\0${r}`;if(o.has(i))return[];o.add(i);let s=zt(n,r);return s?.type==="row"?Ie(s):s?.type==="list"?Oa(e,t,n,s,o):[]}function Oa(e,t,n,r,o){let i=ut(r.source)?r.source:void 0;if(i===void 0||i.kind==="authored"||i.kind==="derived")return ar(r.element);let s=Gn(i);if(s!==null)return[s];let{kind:a,section:l,slot:d}=i;if(a!=="section"||typeof l!="string"||typeof d!="string")return[];if(l===t)return ir(e,t,n,d,o);let f=e.sectionSlots?.(l);return f===void 0?[]:ir(e,l,f,d,o)}var Bt=e=>typeof e=="string"&&e!==""?e:null;function Ae(e,t=null){if(typeof e=="string")return t===null?null:Bt(e);let n=$a(e);return n===null?null:Bt(e[n])}function $a(e){return ut(e)?["id","media","file"].find(t=>Bt(e[t])!==null)??null:null}function Ea(e,t){if(A(e)){if(E(e.key)===null)throw new Error(`list: "${t}" is sourced by the fact "${e.key}", which is no table \u2014 a list's source is a table, a list slot, a list-valued member, a \`compute()\` or a fill; a list of the property's media is picked (\`fill.pick\`) from its item's \`from\`, or computed over a media list (\`compute({ reads: [fact.property.property_media] }, \u2026)\`).`);return{kind:"home",key:e.key}}if(W(e))return{kind:"section",section:e.section,slot:e.slot};if(T(e))return{kind:"sibling",of:e};if(oe(e)!==void 0||L(e))return e;throw new Error(`list: "${t}" declares a source that is no list.`)}function ri(e){return A(e)?E(e.key):T(e)&&e.type==="list"?at(e):null}var Ia=new Set(["label","locked","placeholder","when","source"]);function Aa(e){let t={};for(let[n,r]of Object.entries(e))Ia.has(n)||(t[n]=r);return t}function ja(e,t){if(A(e)&&E(e.key)!==null)return{type:"row",from:e.key,source:{kind:"element"}};for(let r of G(e,`list: "${t}"`)??[]){if(r.verb==="write")throw new Error(oi(t,"declares no `item`"));if(r.verb==="pick")throw new Error(dr(t,"declares no `item`"))}if($e(e))return{type:"poi"};if(T(e)&&e.type==="list")return Pa(e,t);let n=oe(e);if(n!==void 0){let r=at(n);if(r!==null&&ie(r,e.field)==="image_list")return{type:"image"}}throw new Error(`list: "${t}" declares no \`item\`, and its source does not say what its elements are \u2014 declare \`item\`: a plain slot (\`item: image()\`), or a function of the element (\`item: (el) => object({ \u2026 })\`).`)}function oi(e,t){return`list: "${e}" is written by a \`fill.write\` and ${t} \u2014 the item is the kind every written element is: a value slot (\`item: text.short({ cap: 80 })\`), an object exactly one field of which holds the element (\`question: text.medium({ label: "Question", cap: 48, source: el })\`), or an object declared plainly whose members the write answers (\`item: object({ label: text.short({ label: "Unit" }), fields: { \u2026 } })\`).`}function ii(e){if(typeof e!="object"||e===null||e.type!=="object")return!1;let t=e.fields??{};return!Object.values(t).some(n=>B(n.source))}function ti(e,t){if(e.type!=="object")return;let n=Object.entries(e.fields).filter(([,r])=>r.type!=="row"&&r.source?.kind==="element");if(n.length!==1)throw new Error(oi(t,n.length===0?"its object item holds the element in no field":`its object item holds the element in ${String(n.length)} fields (${n.map(([r])=>`"${r}"`).join(", ")}) \u2014 one field holds it`))}function Pa(e,t){let n=e.element;if(n===void 0||n.type==="object")throw new Error(`list: "${t}" lists the items of a list of objects \u2014 declare \`item\` to say what each item holds.`);return n.type==="row"?{type:"row",from:n.from,source:{kind:"element"}}:Aa(n)}function dr(e,t){return`list: "${e}" is picked by a \`fill.pick\` and ${t} \u2014 the item holds the pick in the field holding its candidates: a candidate holder itself (\`item: image({ from: fact.property.property_media })\`, \`item: row({ label: "Agent", from: fact.property.contacts })\`), or an object exactly one field of which holds candidates and no source, which its siblings read by its const (\`const photo = image({ label: "Photo", from: fact.property.property_media }); object({ fields: { photo, caption: text.short({ label: "Caption", source: fill.write({ reads: [photo], brief }) }) } })\`).`}function cr(e){let t=N(e);return t.type==="row"?typeof t.from=="string":t.type==="select"?Array.isArray(t.values):typeof t.type=="string"&&(F(t.type)||t.type==="media")&&t.from!==void 0}function ur(e){return N(e).source===void 0&&q(e)===void 0}function si(e,t){if(e.type!=="object")return cr(e)&&ur(e)?null:void 0;let n=he(e)??e.fields??{},r=Object.entries(n).filter(([,s])=>typeof s=="object"&&s!==null&&cr(s)&&ur(s)),o=r.filter(([,s])=>N(s).type!=="select"),i=o.length>0?o:r;if(i.length>1)throw new Error(`list: "${t}"'s item declares ${String(i.length)} fields with \`from\` and no source (${i.map(([s])=>`"${s}"`).join(", ")}) \u2014 a picked list's item holds its pick in exactly one; give the others a source of their own.`);return i.length===1?i[0][0]:void 0}function ni(e){return{...me(e),source:{kind:"element"}}}function lr(e,t){if(t===void 0)return null;let n=t===null?e:(he(e)??e.fields)[t],r=N(n);return r.type==="row"?E(r.from):null}function Ta(e,t){if(t===null)return ni(e);let n=e,r=(he(e)??n.fields)[t],o=s=>s===r||typeof s=="object"&&s!==null&&N(s)===N(r)?{kind:"element"}:s,i={};for(let[s,a]of Object.entries(n.fields))i[s]=s===t?ni(a):se(a,o);return or({...n,fields:i},n)}function Ma(e,t,n){let r=i=>{if(!B(i))return i;if(Ro(i)!==t)throw new Error(`list: "${n}"'s item reads the element of another list \u2014 an element is read only inside its own list's item.`);return{kind:"element"}};if(e.type==="object"){let i=e,s={},a=!1;for(let[l,d]of Object.entries(i.fields))s[l]=me(se(d,r)),s[l]!==d&&(a=!0);return a?or({...i,fields:s},i):i}return me(se(e,r))}function ai(e,t){let n=e.type==="object"?Object.entries(e.fields):[["",e]];for(let[r,o]of n){let i=o.source;if(i?.kind==="home")throw new Error(`list: "${t}"'s item${r===""?"":` field "${r}"`} is bound to the fact "${String(i.key)}", which is the same value in every item \u2014 read the element or a row's member instead; a property fact belongs in a fill's or a \`compute()\`'s \`reads\`.`)}}function Ca(e,t){if(e.item===void 0)return ja(e.source,t);let n=new Set((G(e.source,`list: "${t}"`)??[]).map(l=>l.verb));if(n.has("pick")){let l=Fa(e.item,t);return n.has("write")&&ti(l,t),l}let r={},o=Object.freeze({kind:"element",[Hn]:r,[Kt]:ri(e.source)}),i=typeof e.item=="function"?e.item(o):e.item;if(typeof i!="object"||i===null||typeof i.type!="string")throw new Error(`list: "${t}"'s item is no slot \u2014 return a value slot, a row or an object.`);if(i.type==="list")throw new Error(`list: "${t}"'s item is a list \u2014 a list's item is a value slot, a row or an object; a list never holds lists.`);if(i.type!=="object"&&q(i)!==void 0)throw new Error(`list: "${t}"'s item declares a fill \u2014 one decision produces the whole list, so the fill belongs on the list's \`source:\`; a field of an object item may carry its own.`);ai(i,t);let s=Ma(i,r,t);if(n.has("write")&&!ii(e.item)&&ti(s,t),s.type==="object"||s.type==="row")return s;let a={...s};return delete a.locked,a}function Fa(e,t){if(typeof e=="function")throw new Error(dr(t,"declares its item as a function"));if(typeof e!="object"||e===null||typeof e.type!="string")throw new Error(`list: "${t}"'s item is no slot \u2014 return a value slot, a row or an object.`);let n=si(e,t);if(n===void 0)throw new Error(dr(t,"its item declares no field with `from` and no source"));ai(e,t);let r=Ta(e,n);if(r.type==="object"||r.type==="row")return r;let o={...r};return delete o.locked,o}function Da(e,t){let n=e.source;if(!(n===void 0||(G(n,"list")??[]).some(i=>i.verb==="pick"))||typeof e.item!="object"||e.item===null)return ri(n);let o=e.item;if(n===void 0){if(o.type!=="object")return lr(o,cr(o)?null:void 0);let i=Object.entries(he(o)??{}).filter(([,s])=>N(s).type==="row"&&ur(s));return i.length===1?lr(o,i[0][0]):null}return lr(o,si(o,t))}function H(e){let t=e.label??"list";for(let d of["fields","title","unique","count"]){if(e[d]===void 0)continue;let f={fields:"declare `item: (el) => object({ fields })` \u2014 an item function returning an object",title:"give the item's object a `label` \u2014 a string, or a text slot",unique:"a pick is unique by default (`fill.pick({ unique: false })` lifts it)",count:"`min` and `max` bound how many items any source yields"};throw new Error(`list: "${t}" declares \`${d}\`, which a list no longer takes \u2014 ${f[d]}.`)}let n=e.source,r=G(n,`list: "${t}"`),o=ii(e.item),i=r?.every(d=>d.verb==="pick"||d.verb==="write"&&o)===!0;if(r!==void 0&&e.max===void 0&&!i)throw new Error(`list: "${t}" is filled but declares no \`max\` \u2014 a fill is an open supply, so the list bounds it.`);for(let d of r??[])if(d.verb==="pick"&&d.of!==void 0)throw new Error(`list: "${t}"'s \`fill.pick\` states \`of\` \u2014 a list's pick chooses from its item's \`from\`; remove \`of\`.`);let s={type:"list",...lt(e,d=>Ea(d,t)),element:Ca(e,t),...e.min!==void 0?{min:e.min}:{},...e.max!==void 0?{max:e.max}:{}},a=L(n)?ar(s.element):void 0,l=a===void 0?Da(e,t):a.length===1?a[0]:null;return qt(s,l)}function Yt(e,t){if(t!==void 0&&(typeof t!="object"||t===null||Array.isArray(t)))throw new Error(`process.${e}(): takes an options object, or nothing.`);let n={kind:"process",verb:e};for(let[o,i]of Object.entries(t??{}))i!==void 0&&(n[o]=i);let r=$n(n);if(r!==null)throw new Error(`process.${e}(): ${r}.`);return n}function La(e){return Yt("cutout",e)}function Na(e){return Yt("autocrop",e)}function le(e,t){return Yt(e,t)}function Ha(e){return le("probe",e)}function Ua(e){return le("understand",e)}function Ka(e){return le("preview",e)}function qa(e){return le("ladder",e)}function Va(e){return le("transcode",e)}function Wa(e){return le("poster",e)}function Ba(e){return le("rasterize",e)}function za(e){return le("fetch",e)}function Ga(e){return le("tour_details",e)}function Ya(e){return Yt("crop",e)}var Xa={cutout:La,autocrop:Na},Xt={...Xa,probe:Ha,understand:Ua,preview:Ka,ladder:qa,transcode:Va,poster:Wa,rasterize:Ba,fetch:za,tour_details:Ga,crop:Ya};function Ja(e,t="a list"){return`${e} is sourced by ${t} \u2014 a row's slot source names a row, which it mirrors. A list's first row is a \`compute()\` over the list: \`source: compute({ reads: [list] }, (rows) => rows[0] ?? null)\`.`}function Za(e,t){if(A(e))throw new Error(`row: "${t}" is sourced by the fact "${e.key}" \u2014 a table is a row's \`from\`, never its source: \`row({ label, from: fact.${e.key} })\` holds its first row, which the user may re-pick.`);if(W(e))return{kind:"section",section:e.section,slot:e.slot};if(T(e))return{kind:"sibling",of:e};if(B(e)||L(e))return Object.freeze({...e});throw new Error(`row: "${t}" declares a source that is no element, slot, compute or pick.`)}function Qa(e,t){if(Array.isArray(e))return el(e,t);let n=A(e)?E(e.key):null;if(n!==null)return{key:e.key,tables:[n]};let r=oe(e);if(r!==void 0){let o=`${String(N(r).from)}.${e.field}`;if(Zn(o)!==null)return{key:o,tables:[]}}throw new Error(e===void 0?`row: "${t}" declares no \`from\` \u2014 a row names its fact data: a table (\`row({ label, from: fact.property.contacts })\`) or a row's list-valued member (\`from: unit.floor_plans\`).`:`row: "${t}"'s \`from\` is ${A(e)?`the fact "${e.key}", which is not a table`:"no table or list-valued member"} \u2014 a row's \`from\` is a fact table (\`fact.property.contacts\`) or a table row's list-valued member (\`unit.floor_plans\`).`)}function el(e,t){if(e.length===0)throw new Error(`row: "${t}" declares \`from: []\` \u2014 a row names the table it is a row of.`);let n=[],r=[];for(let o of e){let i=A(o)?E(o.key):null;if(i===null)throw new Error(`row: "${t}"'s \`from\` lists ${A(o)?`the fact "${o.key}", which is not a table`:"something that is no table"} \u2014 a row's list of \`from\` names tables (\`[fact.property.contacts, \u2026]\`); a list-valued member is a row's only \`from\`.`);if(r.includes(i))throw new Error(`row: "${t}" names the ${i} table twice in \`from\` \u2014 each table is named once.`);n.push(o.key),r.push(i)}return{key:n.length===1?n[0]:n,tables:r}}function tl(e,t,n){let r=at(T(e)||B(e)?e:void 0);if(!(r===null||t.includes(r)))throw new Error(`row: "${n}" is \`from\` the ${t.join(", ")} table${t.length===1?"":"s"} but its source holds a row of ${r} \u2014 a row's source yields a row of its own \`from\`.`)}function li(e){let{key:t,tables:n}=Qa(e.from,e.label),r=n[0]??null;if(r===null&&!B(e.source))throw new Error(`row: "${e.label}" is \`from\` the list-valued member "${t}" but its source is no element \u2014 a row from a member holds an item of it, the element of the list over that member: \`source: entry\`.`);if(T(e.source)&&e.source.type==="list")throw new Error(Ja(`row: "${e.label}"`));let o=G(e.source,`row: "${e.label}"`);for(let a of o??[]){if(a.verb!=="pick")throw new Error(`row: "${e.label}" is filled by \`fill.${a.verb}\` \u2014 a row holds a row that exists, which only a \`fill.pick({ brief })\` out of its \`from\` yields.`);if(a.of!==void 0)throw new Error(`row: "${e.label}"'s \`fill.pick\` states \`of\` \u2014 a row's pick chooses from its \`from\`; remove \`of\`.`)}o===void 0&&e.source!==void 0&&r!==null&&tl(e.source,n,e.label);let i=lt(e,a=>Za(a,e.label)),s=qt({type:"row",from:t,...i},r);return Fo(s,r,n.slice(1))}var nl=["property","library"];function de(e,t){if("label"in e)throw new Error("fact registry: a page head holds no `label` \u2014 the declaration states the fact's name");for(let n of["title","description"]){let r=e[n];if(typeof r=="string"&&r.trim()==="")throw new Error(`fact registry: a page declares an empty ${n}`)}return{head:e,declaration:t}}var rl=new Set(["home","item"]);function mr(e,t,n){let r=typeof t=="object"&&t!==null?n.pages.get(t):void 0;if(r!==void 0)return{kind:"home",key:`${n.home}.${r}`};if(_o(t)){let i=n.pages.get(t);if(i===void 0)throw new Error(`${e} reads a page that is not one of this registry's \u2014 a registry reads its own facts by their page's const.`);return{kind:"home",key:`${n.home}.${i}`}}let o=Le(t)?t.of:t;if(T(o)){let i=n.fields?.get(o);if(i===void 0)throw new Error(`${e} reads the declaration "${o.label??o.type}", which is not a field of the same item \u2014 a field reads its siblings by their consts, and a top-level fact by its page's const.`);return{kind:"item",field:i}}if(A(t)&&[...n.pages.values()].some(i=>t.key===`${n.home}.${i}`))return{kind:"home",key:t.key};if(A(t))throw new Error(`${e} is bound to the fact "${t.key}" \u2014 a registry declares the facts; it reads a sibling page by its const and binds none.`);if(W(t))throw new Error(`${e} reads a section's slot \u2014 a registry reads no section.`);if(B(t)&&n.picked===!0)return{kind:"element"};if(B(t))throw new Error(`${e} reads the element \u2014 a registry's list nothing picks is built by the user, so its item's fields read one another by const.`);if(oe(t)!==void 0)throw new Error(`${e} reads the member "${t.field}" of a row that is not a field of the same item.`);if(Un(t)&&typeof t.slot=="string")return{kind:"row",slot:t.slot,field:t.field};if(typeof t=="object"&&t!==null&&rl.has(String(t.kind)))return t;throw new Error(`${e} declares a read a registry cannot answer.`)}function ol(e,t,n){return Array.isArray(t)?t.length===1?fr(e,t[0],n):t.map(r=>fr(e,r,n)):fr(e,t,n)}function fr(e,t,n){let r=typeof t=="object"&&t!==null?n.pages.get(t):void 0,o=typeof t=="string"?t:r===void 0?void 0:`${n.home}.${r}`;if(o===void 0||!n.mediaLists.has(o))throw new Error(`${e} picks \`from\` something other than one of this registry's media lists \u2014 a media field picks from a list of media (the \`uploads\` page, a sorted list), by its const, or owns its media.`);return o}function hr(e,t,n){let r=t.reads.map(o=>mr(e,o,n));return t.requires===void 0?{kind:"compute",fn:t.fn,reads:r}:{kind:"compute",fn:t.fn,reads:r,requires:t.requires.map(o=>mr(e,o,n))}}function il(e,t){if(t.when!==void 0)throw new Error(`${e} declares \`when\` \u2014 a registry has no display variant; a page is drawn when a template reads it.`);if(t.required!==void 0)throw new Error(`${e} declares \`required\` \u2014 a fact requires nothing on its own account; what a property must answer is what its templates require.`);if(t.type==="poi")throw new Error(`${e} is a poi \u2014 a place the platform builds is no fact.`)}function sl(e,t,n){let r=q(n)??[];if(t==="library"&&r.length>0)throw new Error(`${e} declares a fill \u2014 a library's facts are the org's own, and nothing fills them.`);if(r.some(o=>o.verb==="find"))throw new Error(`${e} declares a \`find\` \u2014 a home's fact is answered, written or picked, never looked up.`)}function al(e,t){let{type:n,fields:r}=t;if(n!=="object"||r===void 0)return;let o=Object.entries(r).filter(([,i])=>i.type==="row");if(o.length>0)throw new Error(`${e} holds a picked row in ${o.map(([i])=>`"${i}"`).join(", ")} \u2014 a list picking rows declares the row as its item (\`item: row({ from })\`), whose members are the row's.`)}function ll(e){let t=new Map,n=e.fields;for(let r of[n,he(e)??{}])for(let[o,i]of Object.entries(r))typeof i=="object"&&i!==null&&t.set(i,o);return t}function yr(e,t,n){il(e,t),sl(e,n.home,t);let r=me(se(t,o=>mr(e,o,n)));switch(r.from!==void 0&&(F(String(r.type))||r.type==="media")&&(r={...r,from:ol(e,t.from,n)}),r.type){case"object":{let o={},i={...n,fields:ll(r)};for(let[s,a]of Object.entries(r.fields))o[s]=yr(`${e}.${s}`,a,i);r={...r,fields:o};break}case"list":{let o=r.max,i={home:n.home,pages:n.pages,mediaLists:n.mediaLists},s=q(t)?.some(l=>l.verb==="pick")===!0,a=yr(`${e}[]`,r.element,s?{...i,picked:!0}:i);al(`${e}[]`,a),r={...r,element:a,...Ft(o)?{max:hr(`${e}.max`,o,i)}:{}};break}default:break}return r}function dl(e,t,n,r){let o=`${e}.${t}`,i=yr(o,n.declaration,r);if(i.type==="object")throw new Error(`${o} is an object \u2014 a top-level fact is a value or a list; a group of fields is a list's item.`);if(i.label===void 0)throw new Error(`${o} declares no \`label\` \u2014 a top-level fact states the name its page and its Details section show it by.`);if(n.head===null)return{head:null,declaration:i};let{title:s,description:a}=n.head;return{head:{title:typeof s=="string"?s:hr(`${o}.title`,s,r),description:typeof a=="string"?a:hr(`${o}.description`,a,r)},declaration:i}}var cl=["home","pages"];function ul(e){return"head"in e&&"declaration"in e}function fl(e){let t=e.element;return e.type==="list"&&typeof t?.type=="string"&&(F(t.type)||t.type==="media")}function ci(e,t){if(!nl.includes(e))throw new Error(`fact registry: "${e}" is not a home`);let n=new Map,r=new Set,o={};for(let[l,d]of Object.entries(t)){if(cl.includes(l))throw new Error(`fact registry: ${e} declares a page keyed "${l}", a registry's own key`);n.set(d,l);let f=ul(d)?d:{head:null,declaration:d};o[l]=f,fl(f.declaration)&&r.add(`${e}.${l}`)}let i={home:e,pages:n,mediaLists:r},s={};for(let[l,d]of Object.entries(o))s[l]=dl(e,l,d,i);let a={home:e,pages:s};for(let l of Object.keys(t))a[l]={kind:"home",key:`${e}.${l}`};return a}var pl=[{value:"for_sale",label:"For sale",icon:"tag",description:"List price, finance details, and a sold-ready layout."},{value:"for_rent",label:"For rent",icon:"key",description:"Monthly rent, lease terms, pets, and utilities."}],ml=["sold","active"],hl=["total","monthly"];function yl(e){return e==null?"active":"sold"}function gl(e){return e==="for_rent"?"monthly":"total"}var bl=6371e3;function wl(e,t,n,r){let o=l=>l*Math.PI/180,i=o(n-e),s=o(r-t),a=Math.sin(i/2)**2+Math.cos(o(e))*Math.cos(o(n))*Math.sin(s/2)**2;return 2*bl*Math.asin(Math.sqrt(a))}function kl(e,t){return e?.latitude==null||e.longitude==null||t?.latitude==null||t.longitude==null?null:Math.round(wl(t.latitude,t.longitude,e.latitude,e.longitude))}var vl=de({title:"Your contacts",description:"The people your listings name, with the headshots and logos they carry."},H({label:"Contacts",item:()=>{let e=C.short({label:"Name",cap:256});return He({label:e,fields:{headshot:ae({label:"Headshot"}),name:e,title:C.short({label:"Title",cap:128}),org_name:C.short({label:"Organization",cap:256}),email:Wo({label:"Email"}),phone:Bo({label:"Phone"}),website:Ee({label:"Website"}),address:Vt({label:"Address"}),bio:C.long({label:"Bio",cap:4e3}),logo_dark:ae({label:"Logo for light backgrounds",process:[Xt.cutout()]}),logo_light:ae({label:"Logo for dark backgrounds",process:[Xt.cutout()]}),instagram:Ee({label:"Instagram"}),linkedin:Ee({label:"LinkedIn"}),x:Ee({label:"X"}),facebook:Ee({label:"Facebook"})}})}})),Qt=ci("library",{contacts:vl});Vn(Qt);var gr=de({title:"What\u2019s the address?",description:"We\u2019ll build your map and neighborhood details from this."},Vt({label:"Address"})),ui=de({title:"For sale or for rent?",description:"This adjusts the pricing details we ask for."},dt({label:"Listing intent",from:[...pl]})),ye=de({title:"Add photos, docs, and links",description:"Everything you add helps fill and enrich your website."},H({label:"Uploads",item:Wt()})),br=H({label:"Media",item:Wt({kinds:["image","video","tour"],from:ye}),source:z.pick({brief:"Does this upload show the property? It belongs when its name or account says it is a photograph, a rendering, a video or a virtual tour of the property: its building, rooms, grounds, amenities, surroundings or views. It does not belong when its name or account says it is a floor plan or another diagram; a logo, wordmark or brand graphic; a headshot, portrait or other photograph of a person or people; a flyer, ad, business card, slide or other image that is mostly text; a screenshot; a map; or a scanned document page. When neither its name nor its account says what it is, you cannot tell. Order what belongs as a walk through the property: aerial and street views first, then the approach and entry, then the interiors room by room (living spaces, kitchen and dining, bedrooms, bathrooms), then outdoor spaces, amenities, surroundings and views, with every shot of one space together. A video or tour sits with the space it shows, and one of the whole property comes first."})}),fi=H({label:"Floor plans",item:ae({label:"Floor plan",from:ye,process:[Xt.cutout({enclosed:"keep"})]}),source:z.pick({brief:"Is this upload exactly one floor plan? A floor plan is a top-down view of one floor of a dwelling's rooms and walls \u2014 drawn or rendered, flat or in 3D, at any size. It belongs when its name or account says it shows one floor plan, whatever title, figures or text are printed around it. It does not belong when its name or account says it holds two or more plans, or says it is something else: a building key or locator diagram (the building's outline with one unit shaded), a site, plot, parking or driveway diagram, a standalone legend, scale bar or north arrow, a logo, a photograph, or plain text. When neither its name nor its account says what it is, or how many plans it holds, you cannot tell. Order what belongs from the lowest floor to the highest; plans of several units go in the order the units are numbered, each unit's floors together."})}),xl=H({label:"Documents",item:Wt({kinds:["document","image","video"],from:ye}),source:z.pick({brief:"Does this upload set out the property's specifics? It belongs when its name or account says it records its figures, finances, terms, legal record, condition or plans: an offering memorandum, brochure, listing sheet, rent roll, financials, comparables, lease, survey, site plan, plan set, disclosure or report. It does not belong when its name or account says it is a photograph, rendering, video or tour showing the property; an image of floor plans or elevations; a logo; a photograph of people; an ad, sign or announcement; a map; or notes for whoever makes the marketing. When neither its name nor its account says what it is, you cannot tell. Order what belongs as a buyer reads it: the offering memorandum, brochure or listing sheet first, then the financials, rent roll and comparables, then the leases, legal record and disclosures, then the reports, surveys and plans."})}),Sl=ae({label:"Hero",from:br,source:z.pick({brief:"Choose the single cover photo for the property's page. The cover is a wide banner above the property's address, so it must stand for the whole property at a glance. Only an image whose name or account says it is a photograph of the property can be chosen. Never choose a logo, wordmark or other brand graphic; an agent, team or company headshot; a flyer, ad, business card, slide or any image that is mostly text; a screenshot; a map; a scanned document or brochure page; or a floor plan or other diagram \u2014 nor an image whose name and account do not say what it is. Among the photographs of the property prefer, in order: a front exterior of the building; another exterior or aerial view; the widest, brightest shot of the main living space. Rank close-up details, bathrooms, utility spaces, empty rooms and anything that reads as a fragment rather than a place last: they are weaker covers, never excluded, so when they are the only photographs of the property, choose the best of them. If not one candidate is a photograph of the property, choose none: no banner beats a banner that is not the property."})}),Rl=Ee({label:"Website"}),_l=`Is this floor plan labelled for this unit? Its label is read from its name and the text printed on it, never from the rooms drawn or any figures. It belongs when its label names this unit: the unit's label or a plain variant of it ("Unit 3", "#3", "Apt 3" and "Residence 3" all label "Unit 3"); a descriptor the unit's label carries in brackets, like "(PH)", may be left off. A plan labelling several units, such as a shared floor printed "Unit 1/2/3", belongs to each of them. It is excluded when it labels other units and not this one. When it labels no unit, you cannot tell. Order what belongs from the lowest floor to the highest.`,Ol=`Is this photo labelled for this unit? Its label is read from its name, the text printed on it and a caption its account records, never from the rooms it shows, any figures, how much it looks like the unit or where it falls among the uploads. It belongs when its label names this unit: the unit's label or a plain variant of it ("Unit 3", "#3", "Apt 3" and "Residence 3" all label "Unit 3"); a descriptor the unit's label carries in brackets, like "(PH)", may be left off. A photo labelled for several units belongs to each of them. It is excluded when it labels other units and not this one. When it labels no unit, you cannot tell.`,$l=[`List every dwelling the uploads present with its own specs printed \u2014 its beds, baths, square feet, asking price or rent written out for that dwelling: the home a listing describes, or each unit a building's documents name or number. A dwelling the uploads only name, picture or mark with a status, with no specs of its own, is not listed. A plan or row printed for several units ("Unit 4/6") lists each of those units, each with what is printed for it. A dwelling named in several uploads, or on several pages, is one item carrying everything they print for it. A unit-mix row standing for several unnamed units is not a dwelling; neither is a commercial space, a whole building, a comparable property, a market average or a portfolio total.`,"Every member is what an upload prints as text for that dwelling, and nothing else. An upload's own text, as its account quotes it (a document's or a sheet's content, an image's printed words), is what it prints; the account's description of what a drawing, a photo or a map shows (the rooms, the doors, the spaces) is never a member's source. Never count rooms; never compute, round or convert a figure; never carry one across from another dwelling, a unit-mix average or the building's totals; never add what is usual for a dwelling of its kind. A figure printed for a neighbourhood, a development or the building is never a dwelling's, and a count or fee is 0 only where the uploads print none for that dwelling. A member no upload prints for that dwelling is null, and a null is always better than a guess.",`label: the unit's own name as printed \u2014 its unit number or name ("201", "Residence 201", "4B", "Penthouse 501"), without a word marking its status ("model", "available") \u2014 and never its street address. A dwelling presented alone, with no unit name, is always labelled "Home", whatever name the uploads print for the home itself.`,"beds, baths, sqft: exactly as printed for that dwelling; a studio has one bedroom.",'price: the asking price or monthly rent as written for that dwelling, or its status word ("Sold", "Leased", "Request for Info").','floor: the floor of its building the dwelling sits on, as printed ("3", "PH", "Ground", "3 to 4"); never read off its unit number.',"hoa_monthly: the HOA, condo or strata fee printed per month for that dwelling. A fee printed for another period, or for the building, is null.",'parking: the number of parking spaces printed for that dwelling ("1 deeded space" is 1, "two-car garage" is 2). Parking printed with no count, or for the building, is null.',"lot_sqft: the lot size printed in square feet for that dwelling: a home's own lot. A lot in another unit, or the lot of a building several dwellings share, is null.",`amenities: a feature this dwelling has that the other dwellings in its building do not, in a few words as an upload states it, such as "Private roof deck", "Corner unit", "Harbor views". Check each one against the other dwellings: a feature printed for two of them, or for the building, is the building's and goes on no dwelling, however a sheet praises it; a routine fitting or finish, a note printed on a plan, or what its other members already say sets nothing apart. Most dwellings have none. Leave the list empty when nothing is this one's alone.`,"When the uploads present no dwelling with its own specs printed, return no items."].join(`
147
147
 
148
- `),pt=$.short({label:"Unit"}),Qs=E({label:"Beds"}),ea=E({label:"Baths",decimals:!0}),Zr=E({label:"Sq ft",thousandsSep:!0}),Qr=$.short({label:"Price",cap:40}),eo=$.short({label:"Building floor(s)",cap:20}),to=E({label:"Parking spaces"}),no=P({label:"Amenities",max:12,item:$.short({cap:40})});function ro(e,t){return P({label:"Floor plans",source:N.pick({reads:[e],brief:t}),item:Ee({fields:{image:J({label:"Floor plan",from:Jr}),floor:qe({label:"Floor",from:[...hr],creatable:!0})}})})}function oo(e,t){return P({label:"Photos",source:N.pick({reads:[e],brief:t}),item:J({label:"Photo",from:mn})})}var ta=Q({title:"Tell us about the units",description:"Add each unit\u2019s details and floor plans so they appear on your website."},P({label:"Units",source:N.write({reads:[se],brief:Zs}),item:Ee({label:pt,fields:{label:pt,beds:Qs,baths:ea,sqft:Zr,price:Qr,floor:eo,hoa_monthly:E({label:"Monthly HOA fee"}),parking:to,lot_sqft:E({label:"Lot sq ft",thousandsSep:!0}),amenities:no,floor_plans:ro(pt,Xs),photos:oo(pt,Js)}})})),na=`Is this floor plan labelled for this space? Its label is read from its name and the text printed on it, never from the rooms drawn or any figures. It belongs when its label names this space: the space's label or a plain variant of it ("Suite 200", "Ste 200" and "#200" all label "Suite 200"); a descriptor the space's label carries in brackets may be left off. A plan labelling several spaces belongs to each of them. It is excluded when it labels other spaces and not this one. When it labels no space, you cannot tell. Order what belongs from the lowest floor to the highest.`,ra=`Is this photo labelled for this space? Its label is read from its name, the text printed on it and a caption its account records, never from what it shows, any figures, how much it looks like the space or where it falls among the uploads. It belongs when its label names this space: the space's label or a plain variant of it ("Suite 200", "Ste 200" and "#200" all label "Suite 200"); a descriptor the space's label carries in brackets may be left off. A photo labelled for several spaces belongs to each of them. It is excluded when it labels other spaces and not this one. When it labels no space, you cannot tell.`,oa=["List every commercial space the uploads present with its own specs printed \u2014 its use, square feet, rent or price written out for that space: each shop, office suite, restaurant or other non-residential space a building's documents name or number. A space the uploads only name, picture or mark with a status, with no specs of its own, is not listed. A space named in several uploads, or on several pages, is one item carrying everything they print for it. A dwelling is never a commercial space; neither is a whole building, a comparable property, a market average or a portfolio total.","Every member is what an upload prints as text for that space, and nothing else. An upload's own text, as its account quotes it (a document's or a sheet's content, an image's printed words), is what it prints; the account's description of what a drawing, a photo or a map shows is never a member's source. Never compute, round or convert a figure; never carry one across from another space or the building's totals; never add what is usual for a space of its kind. A member no upload prints for that space is null, and a null is always better than a guess.",`label: the space's own name as printed ("Retail A", "Suite 200", "Ground-floor restaurant"), without a word marking its status ("available", "leased"), and never its street address.`,'use: what the space is for, as printed ("Retail", "Office", "Restaurant").',"sqft: the square feet printed for that space.",'price: the rent or price as written for that space ("$45/SF/yr", "$8,500/mo"), or its status word ("Leased", "Call for pricing").','floor: the floor of its building the space sits on, as printed ("1", "Ground", "Mezzanine"); never read off its suite number.',"parking: the number of parking spaces printed for that space. Parking printed with no count, or for the building, is null.",'amenities: the real selling points of that space, the qualitative features a tenant would notice that its use, size, floor, parking and price do not already say, such as "Corner frontage", "Drive-thru", "Grease trap". Name only what an upload says about that space, in a few words. Never make one up and never add one just to fill the list: a feature the whole building shares, a routine fitting or finish, a note printed on a plan or a restated size is not a selling point. Most spaces have none to three; leave the list empty when nothing stands out.',"When the uploads present no commercial space with its own specs printed, return no items."].join(`
148
+ `),Jt=C.short({label:"Unit"}),El=M({label:"Beds"}),Il=M({label:"Baths",decimals:!0}),pi=M({label:"Sq ft",thousandsSep:!0}),mi=C.short({label:"Price",cap:40}),hi=C.short({label:"Building floor(s)",cap:20}),yi=M({label:"Parking spaces"}),gi=H({label:"Amenities",max:12,item:C.short({cap:40})});function bi(e,t){return H({label:"Floor plans",source:z.pick({reads:[e],brief:t}),item:He({fields:{image:ae({label:"Floor plan",from:fi}),floor:dt({label:"Floor",from:[...$o],creatable:!0})}})})}function wi(e,t){return H({label:"Photos",source:z.pick({reads:[e],brief:t}),item:ae({label:"Photo",from:br})})}var Al=de({title:"Tell us about the units",description:"Add each unit\u2019s details and floor plans so they appear on your website."},H({label:"Units",source:z.write({reads:[ye],brief:$l}),item:He({label:Jt,fields:{label:Jt,beds:El,baths:Il,sqft:pi,price:mi,floor:hi,hoa_monthly:M({label:"Monthly HOA fee"}),parking:yi,lot_sqft:M({label:"Lot sq ft",thousandsSep:!0}),amenities:gi,floor_plans:bi(Jt,_l),photos:wi(Jt,Ol)}})})),jl=`Is this floor plan labelled for this space? Its label is read from its name and the text printed on it, never from the rooms drawn or any figures. It belongs when its label names this space: the space's label or a plain variant of it ("Suite 200", "Ste 200" and "#200" all label "Suite 200"); a descriptor the space's label carries in brackets may be left off. A plan labelling several spaces belongs to each of them. It is excluded when it labels other spaces and not this one. When it labels no space, you cannot tell. Order what belongs from the lowest floor to the highest.`,Pl=`Is this photo labelled for this space? Its label is read from its name, the text printed on it and a caption its account records, never from what it shows, any figures, how much it looks like the space or where it falls among the uploads. It belongs when its label names this space: the space's label or a plain variant of it ("Suite 200", "Ste 200" and "#200" all label "Suite 200"); a descriptor the space's label carries in brackets may be left off. A photo labelled for several spaces belongs to each of them. It is excluded when it labels other spaces and not this one. When it labels no space, you cannot tell.`,Tl=["List every commercial space the uploads present with its own specs printed \u2014 its use, square feet, rent or price written out for that space: each shop, office suite, restaurant or other non-residential space a building's documents name or number. A space the uploads only name, picture or mark with a status, with no specs of its own, is not listed. A space named in several uploads, or on several pages, is one item carrying everything they print for it. A dwelling is never a commercial space; neither is a whole building, a comparable property, a market average or a portfolio total.","Every member is what an upload prints as text for that space, and nothing else. An upload's own text, as its account quotes it (a document's or a sheet's content, an image's printed words), is what it prints; the account's description of what a drawing, a photo or a map shows is never a member's source. Never compute, round or convert a figure; never carry one across from another space or the building's totals; never add what is usual for a space of its kind. A member no upload prints for that space is null, and a null is always better than a guess.",`label: the space's own name as printed ("Retail A", "Suite 200", "Ground-floor restaurant"), without a word marking its status ("available", "leased"), and never its street address.`,'use: what the space is for, as printed ("Retail", "Office", "Restaurant").',"sqft: the square feet printed for that space.",'price: the rent or price as written for that space ("$45/SF/yr", "$8,500/mo"), or its status word ("Leased", "Call for pricing").','floor: the floor of its building the space sits on, as printed ("1", "Ground", "Mezzanine"); never read off its suite number.',"parking: the number of parking spaces printed for that space. Parking printed with no count, or for the building, is null.",`amenities: a feature this space has that the other spaces in its building do not, in a few words as an upload states it, such as "Corner frontage", "Drive-thru", "Grease trap". Check each one against the other spaces: a feature printed for two of them, or for the building, is the building's and goes on no space, however a sheet praises it; a routine fitting or finish, a note printed on a plan, or what its other members already say sets nothing apart. Most spaces have none. Leave the list empty when nothing is this one's alone.`,"When the uploads present no commercial space with its own specs printed, return no items."].join(`
149
149
 
150
- `),mt=$.short({label:"Space"}),ia=Q({title:"Tell us about the commercial spaces",description:"Add each space\u2019s details and floor plans so they appear on your website."},P({label:"Commercial spaces",source:N.write({reads:[se],brief:oa}),item:Ee({label:mt,fields:{label:mt,use:$.short({label:"Use",cap:40}),sqft:Zr,price:Qr,floor:eo,parking:to,amenities:no,floor_plans:ro(mt,na),photos:oo(mt,ra)}})})),sa="The uploads may present comparable properties \u2014 other properties set beside the one being marketed for comparison. Find every one and return it as an item. A comparable may appear as a row in a sales or rent comparables table, as a panel with its own photo and figures, as a numbered pin in a map legend, or as a line in a survey of recent trades. Read every upload whole, including tables that continue from one page to the next. Copy each figure exactly as an upload states it for that property, and each listing's remarks word for word. Specs come only from what is printed as text: never count rooms or take a figure from what a floor plan drawing, a photo or a map shows; a studio has one bedroom. Never compute one: not by multiplying a price per unit by a unit count, not by dividing a price by a size, not by counting the days between two dates, not by converting a yearly fee to a monthly one, not by averaging rows, and never by carrying a figure across from a neighbouring row, a summary or the subject. If a property is listed in more than one place \u2014 on several pages, or in several uploads \u2014 return one item carrying every figure those places state. A figure no upload states for that property is null; a null is always better than a guess. Do not return the subject property \u2014 the one at the read address, which the uploads are marketing \u2014 even where it appears in a comparables table or at the centre of a comparables map, and do not return a market, submarket or area average, a portfolio total, or anything that is not an individual property. When no upload presents a comparable property, return no items.",cn=ct({label:"Address"}),zr=Qt({label:"Sale date"}),aa=Q({title:"Which properties compare?",description:"Recently sold or listed homes like this one shape the pricing story."},P({label:"Comparables",max:50,source:N.write({reads:[se,pn],brief:sa}),item:Ee({label:cn,fields:{address:cn,price:E({label:"Price"}),sale_date:zr,beds:E({label:"Beds"}),baths:E({label:"Baths",decimals:!0}),sqft:E({label:"Sq ft"}),photo:J({label:"Photo"}),year_built:E({label:"Year built"}),lot_sqft:E({label:"Lot sq ft"}),stories:E({label:"Stories",decimals:!0}),units:E({label:"Units"}),hoa_monthly:E({label:"HOA per month"}),list_price:E({label:"List price"}),listed_date:Qt({label:"Listed date"}),mls_number:$.short({label:"MLS number"}),description:$.long({label:"Description"}),status:qe({label:"Status",from:[...Hs],locked:!0,source:ot({reads:[zr]},e=>qs(e))}),distance_m:E({label:"Distance (m)",locked:!0,source:ot({reads:[cn,pn]},(e,t)=>Vs(e,t))}),price_period:qe({label:"Price period",from:[...Us],locked:!0,source:ot({reads:[Xr]},e=>Ks(e))})}})})),la=Q({title:"Who\u2019s on this listing?",description:"Add the contacts for this property, and drag them into the order your marketing shows them."},P({label:"Contacts",min:1,max:12,source:N.pick({reads:[se],brief:"Choose this listing's contacts from the library's contacts, judging each one's name, title, organisation, email and phone against the read uploads' names and accounts. A contact may be chosen only when an upload's name or account says it prints their email or phone, or their full name, as a contact for this listing \u2014 an agent, broker, or sales or leasing contact. A contact the uploads leave out, where their accounts name the listing's contacts, is not chosen. A shared organisation, a matching first name, or a name printed in another role (an architect, a photographer, a seller) is not evidence. When no upload's account names any contact, choose none. Order those chosen as the uploads present them for this listing, the first or most prominent first."}),item:Vr({label:"Contact",from:Yr.contacts})})),hn=Gr("property",{address:pn,listing_intent:Xr,description:Q({title:"Describe the property",description:"Talk it up like you would to a buyer, and our AI writes your website copy."},$.long({label:"Description"})),uploads:se,property_media:mn,floor_plans:Jr,property_documents:zs,hero:Gs,site_url:Ys,units:ta,commercial_spaces:ia,contacts:la,comparables:aa});Yt(hn);function io(e,t){return`${e}.${t}`}function ca(e){let t=e.indexOf(".");return t<=0||t===e.length-1||e.includes(".",t+1)?null:{object:e.slice(0,t),field:e.slice(t+1)}}function so(e,t){let n=ca(t);if(n===null)return e[t];let r=e[n.object];return r!==null&&typeof r=="object"&&!Array.isArray(r)?r[n.field]:void 0}function Be(e){return/^processed\/crops\/([^/]+)\//.exec(e)?.[1]??null}var da={responsiveFor:()=>Promise.resolve(null)};async function ae(e,t){try{let n=await e.ladder(t);return{responsiveFor:async r=>{try{return await n.responsiveFor(r)}catch{return null}}}}catch{return da}}var We={asset_id:"",url:"",filename:"",content_type:"",size_bytes:0,poster:""};async function ua(e,t,n){if(!t)return e;try{e.poster=await n.fileUrl(t)}catch(i){return n.log?.warn({asset_id:e.asset_id,err:i.message},"resolve-document-slot: preview presign failed; no poster"),e}let o=await(await ae(n,[t])).responsiveFor(t);return o&&(e.poster_responsive=o),e}async function le(e,t,n){if(e===null)return null;if(typeof e!="object")return We;let r=e,o=typeof r.asset_id=="string"?r.asset_id:"";if(!o)return We;let i=t.get(o);if(i===void 0)return n.log?.warn({asset_id:o},"resolve-document-slot: no asset the render may reach"),We;let s=i.key;if(s===null)return n.log?.warn({asset_id:o},"resolve-document-slot: asset has no stored object"),We;try{let a=i.name,l={asset_id:o,url:n.namedFileUrl?await n.namedFileUrl(s,a):await n.fileUrl(s),filename:a,content_type:i.mime??"",size_bytes:i.bytes??0,poster:""};return await ua(l,i.renditions.poster?.key??null,n)}catch(a){return n.log?.error({asset_id:o,err:a.message},"resolve-document-slot: presign failed; soft-empty document"),We}}var ao=16/10;function ce(e){if(e===null||typeof e!="object")return{mode:"free",aspect:ao};let t=e,n=typeof t.aspect=="number"&&t.aspect>0?t.aspect:ao,r=t.mobile?.aspect,o=typeof r=="number"&&r>0&&Math.abs(r-n)>1e-4?r:void 0;return{mode:t.mode==="free"?"free":"locked",aspect:n,...o===void 0?{}:{mobileAspect:o}}}function fa(e,t){if(e===null||t===null)return e===t;let n=r=>Math.round(r*1e4)/1e4;return n(e.x)===n(t.x)&&n(e.y)===n(t.y)&&n(e.width)===n(t.width)&&n(e.height)===n(t.height)}function pa(e,t){if(e===null||!(e>0)||!(t>0))return null;let n=Math.min(1,t/e),r=Math.min(1,e/t),o={x:(1-n)/2,y:0,width:n,height:r};return fa(o,{x:0,y:0,width:1,height:1})?null:o}function lo(e,t,n,r){if(e!==null||n.mode==="free")return e;let o=r==="mobile"?n.mobileAspect:n.aspect;return o===void 0?null:pa(t,o)}function ye(){return{photo_id:"",url:"",alt:""}}function co(e,t){let n=t===void 0?void 0:e.renditions[t==="white"?"mask_white":"mask_black"]?.key,r=Mt(e.crop)?e.renditions.crop?.key:void 0;return n??e.renditions.cutout?.key??r??e.key}async function gn(e,t,n,r){if(t===void 0)return n.log?.warn({id:e},"resolve-asset-id: no image asset the render may reach; no asset"),null;if(t.kind!=="image")return n.log?.warn({id:e,kind:t.kind},"resolve-asset-id: asset is not an image; no asset"),null;try{let o=co(t,r?.mask);return{url:await n.servedUrl(o),source_key:o}}catch(o){return n.log?.error({id:e,err:o.message},"resolve-asset-id: presign failed; no asset"),null}}function ht(e){return e<0?0:e>1?1:e}function bn(e){let t=typeof e.nx=="number"?e.nx:0,n=typeof e.ny=="number"?e.ny:0,r=typeof e.nw=="number"?e.nw:1,o=typeof e.nh=="number"?e.nh:1;if(![t,n,r,o].every(Number.isFinite))return null;let i={nx:ht(t),ny:ht(n),nw:ht(r),nh:ht(o)};return i.nx===0&&i.ny===0&&i.nw===1&&i.nh===1?null:i}function uo(e){let t=e&&typeof e=="object"?e.key:void 0;return typeof t=="string"&&t.length>0?t:null}function fo(e,t,n){let r=e.rect&&typeof e.rect=="object"?bn(e.rect):null,o=r===null?null:{x:r.nx,y:r.ny,width:r.nw,height:r.nh};return t===void 0?o:lo(o,t.imageAspect,t.aspects,n)}function po(e,t,n){if(!Mt(n))return null;let r=e.renditions&&typeof e.renditions=="object"?e.renditions:{},o=uo(r.crop)??(typeof e.crop_key=="string"&&e.crop_key.length>0?e.crop_key:null);return o!==null&&Be(o)===t?o:null}function mo(e,t){return po(e,yt(e),fo(e,t))}function ho(e,t){let n=e.mobile&&typeof e.mobile=="object"?e.mobile:t===void 0?null:{};return n===null?null:po(n,yt(e),fo(n,t,"mobile"))}async function ma(e,t){try{return{url:await t.servedUrl(e)}}catch{return null}}function ha(e,t,n){let r=yt(e),o=e.renditions&&typeof e.renditions=="object"?e.renditions:{},i=a=>{let l=uo(o[a]);return l!==null&&l.startsWith(`processed/cutout/${r}/`)?l:null};return(t===null?null:i(t==="white"?"mask_white":"mask_black"))??i("cutout")??(t===null?mo(e,n):null)}function yt(e){return typeof e.photo_id=="string"&&e.photo_id?e.photo_id:typeof e.asset_id=="string"&&e.asset_id?e.asset_id:""}async function $e(e,t,n,r){if(e===null)return{value:null,desktopKey:null,mobileKey:null};if(!e||typeof e!="object")return{value:ye(),desktopKey:null,mobileKey:null};let o=e,i=o.rect&&typeof o.rect=="object"?bn(o.rect):null,s=typeof o.ar=="number"?o.ar:null,a=yt(o),l=o.mask==="white"||o.mask==="black"?o.mask:null,d=a?t.get(a):void 0,m=r===void 0?void 0:{aspects:r,imageAspect:ya(d,s)},g=a?ho(o,m):null,v=g?await ma(g,n):null,A=typeof o.alt=="string"?o.alt:"",Te=a?ha(o,l,m):null,ee,be;if(Te){ee={photo_id:a,url:await n.servedUrl(Te),alt:A},be=Te;let B=await gn(a,d,n);B&&B.url!==ee.url&&(ee.download_url=B.url)}else if(a){let B=await gn(a,d,n,l?{mask:l}:void 0);if(!B)return{value:yn(ye(),o),desktopKey:null,mobileKey:g};ee={photo_id:a,url:B.url,alt:A},be=B.source_key}else if(typeof o.url=="string"&&o.url.length>0)ee={photo_id:"",url:o.url,alt:A},be=null;else return{value:yn(ye(),o),desktopKey:null,mobileKey:null};return{value:yn(ga(ee,i,s,v),o),desktopKey:be,mobileKey:v?g:null}}function ya(e,t){return e?.kind==="image"&&e.width!==null&&e.height!==null&&e.width>0&&e.height>0?e.width/e.height:t!==null&&t>0?t:null}async function Ve(e,t){let n=e.flatMap(o=>[o.desktopKey,o.mobileKey]).filter(o=>!!o),r=await ae(t,n);for(let o of e){if(!o.value)continue;let i=await r.responsiveFor(o.desktopKey);if(i&&(o.value.responsive=i),o.value.mobile&&o.mobileKey){let s=await r.responsiveFor(o.mobileKey);s&&(o.value.mobile={...o.value.mobile,responsive:s})}}}async function ze(e,t,n,r){let o=await $e(e,t,n,r);return await Ve([o],n),o.value}function yn(e,t){let n=t.unit_id,r=t.unit_label;if(typeof n=="string"?e.unit_id=n:n===null&&(e.unit_id=null),typeof r=="string"?e.unit_label=r:r===null&&(e.unit_label=null),"floor_label"in t){let o=typeof t.floor_label=="string"?t.floor_label:null;e.floor_label=o,e.alt===""&&(e.alt=o??"Floor plan")}return e}function ga(e,t,n,r){return t&&(e.rect=t),n&&(e.ar=n),r&&(e.mobile=r),e}var Oe={tour_id:"",url:"",poster:"",alt:""};async function ba(e,t,n){if(!t||!e.poster)return e;let o=await(await ae(n,[t])).responsiveFor(t);return o&&(e.poster_responsive=o),e}async function de(e,t,n){if(e===null)return null;if(typeof e!="object")return Oe;let r=e,o=typeof r.tour_id=="string"&&r.tour_id?r.tour_id:typeof r.asset_id=="string"&&r.asset_id?r.asset_id:"";if(!o)return Oe;let i=t.get(o);if(i===void 0)return n.log?.warn({tour_id:o},"resolve-tour-slot: no tour asset the render may reach"),Oe;if(i.kind!=="tour")return n.log?.warn({tour_id:o,kind:i.kind},"resolve-tour-slot: asset is not a tour"),Oe;try{let s=Gn(i.url);if(s===null)return n.log?.warn({tour_id:o},"resolve-tour-slot: tour link embeds nowhere"),Oe;let a=i.renditions.poster?.key??null,l={tour_id:o,url:s,poster:a?await n.fileUrl(a):"",alt:typeof r.alt=="string"?r.alt:"",provider:i.provider};return ba(l,a,n)}catch(s){return n.log?.error({tour_id:o,err:s.message},"resolve-tour-slot: presign failed; soft-empty tour"),Oe}}var Ae={video_id:"",url:"",poster:"",alt:""};async function wn(e,t,n){if(!t||!e.poster)return e;let o=await(await ae(n,[t])).responsiveFor(t);return o&&(e.poster_responsive=o),e}async function ue(e,t,n){if(e===null)return null;if(typeof e!="object")return Ae;let r=e,o=typeof r.video_id=="string"&&r.video_id?r.video_id:typeof r.asset_id=="string"&&r.asset_id?r.asset_id:"";if(!o)return Ae;let i=t.get(o);if(i===void 0)return n.log?.warn({video_id:o},"resolve-video-slot: no video asset the render may reach"),Ae;if(i.kind!=="video")return n.log?.warn({video_id:o,kind:i.kind},"resolve-video-slot: asset is not a video"),Ae;let s=i.renditions.poster?.key??null,a=typeof r.alt=="string"?r.alt:"";try{if(Yn(i)==="link"){let g=i.url,v=zn(g);if(!v)return n.log?.warn({video_id:o},"resolve-video-slot: link upload embeds nowhere"),Ae;let A={video_id:o,url:v,poster:s?await n.fileUrl(s):"",alt:a,source:"link"};return i.provider!==null&&(A.provider=i.provider),wn(A,s,n)}let l=s?await n.fileUrl(s):"",d=i.renditions.encode;if(d===null)return n.log?.warn({video_id:o,state:i.state},"resolve-video-slot: no encode; poster-only"),i.state!=="failed"&&n.notePending?.({kind:"video",id:o}),wn({video_id:o,url:"",poster:l,alt:a},s,n);let m={video_id:o,url:await n.fileUrl(d.key),poster:l,alt:a};return d.width!==null&&(m.width=d.width),d.height!==null&&(m.height=d.height),wn(m,s,n)}catch(l){return n.log?.error({video_id:o,err:l.message},"resolve-video-slot: presign failed; soft-empty video"),Ae}}async function Ie(e,t,n,r){if(e===null||typeof e!="object")return null;let o=e.asset_id;if(typeof o!="string"||o==="")return null;let i=n.get(o);if(i===void 0)return r.log?.warn({asset_id:o},"resolve-media-slot: no asset the render may reach"),null;if(!V(t).includes(i.kind))return r.log?.warn({asset_id:o,kind:i.kind},"resolve-media-slot: asset is of a kind the slot does not hold"),null;let s={asset_id:o};switch(i.kind){case"image":{let a=await ze(e,n,r,ce(t.crop));return a===null?null:{...a,kind:"image"}}case"video":{let a=await ue(s,n,r);return a===null?null:{...a,kind:"video"}}case"tour":{let a=await de(s,n,r);return a===null?null:{...a,kind:"tour"}}case"document":{let a=await le(s,n,r);return a===null?null:{...a,kind:"document"}}}}function _n(e){return e==="image"?"image":e==="video"?"video":e==="tour"?"tour":e==="document"?"document":e==="media"?"media":e==="poi"?"poi":"scalar"}function ge(e){if(e?.type!=="list")return null;let t=e.fields??(e.element?.type==="object"?e.element?.fields:void 0);return t!=null?{kind:"record",fields:t}:{kind:"primitive",primitive:_n(e.element?.type)}}async function gt(e,t,n){if(!Array.isArray(e))return[];let r=ge(t);return r===null?e:r.kind==="record"?wa(e,r.fields,n):yo(e,r.primitive,n,t.element)}async function yo(e,t,n,r){switch(t){case"image":{let o=[];for(let i of e)o.push(await $e(i,n.assets,n.store,ce(r?.crop)));return await Ve(o,n.store),o.map(i=>i.value??ye())}case"video":return(await Promise.all(e.map(i=>ue(i,n.assets,n.store)))).filter(i=>i!==null);case"tour":return(await Promise.all(e.map(i=>de(i,n.assets,n.store)))).filter(i=>i!==null);case"document":return(await Promise.all(e.map(i=>le(i,n.assets,n.store)))).filter(i=>i!==null);case"media":return(await Promise.all(e.map(i=>Ie(i,r??{},n.assets,n.store)))).filter(i=>i!==null);case"poi":return e.map(o=>n.resolvePoi(o));case"scalar":return e}}async function wa(e,t,n){if(!Object.values(t).some(kn))return e;let r=[],o=await go(e,t,n,r);return await Ve(r,n.store),o}async function go(e,t,n,r){let o=Object.entries(t).filter(([,s])=>kn(s));if(o.length===0)return e;let i=[];for(let s of e){if(!s||typeof s!="object"||Array.isArray(s)){i.push(s);continue}let a={...s};for(let[l,d]of o)l in a&&(a[l]=await _a(a[l],d,n,r));i.push(a)}return i}function kn(e){if(_n(e.type)!=="scalar")return!0;let t=ge(e);return t===null?!1:t.kind==="record"?Object.values(t.fields).some(kn):t.primitive!=="scalar"}async function _a(e,t,n,r){if(ge(t)!==null)return ka(e,t,n,r);switch(_n(t.type)){case"image":{let o=await $e(e,n.assets,n.store,ce(t.crop));return r.push(o),o.value}case"video":return ue(e,n.assets,n.store);case"tour":return de(e,n.assets,n.store);case"document":return le(e,n.assets,n.store);case"media":return Ie(e,t,n.assets,n.store);case"poi":return n.resolvePoi(e);case"scalar":return e}}async function ka(e,t,n,r){if(!Array.isArray(e))return[];let o=ge(t);if(o===null)return e;if(o.kind==="record")return go(e,o.fields,n,r);if(o.primitive!=="image")return yo(e,o.primitive,n,t.element);let i=[];for(let s of e)i.push(await $e(s,n.assets,n.store,ce(t.element?.crop)));return r.push(...i),i.map(s=>s.value??ye())}function xn(e){return new Map(Object.entries(e??{}))}async function vn(e,t,n){if(t===void 0)return e;if(ge(t)!==null)return gt(e,t,n);switch(t.type){case"image":return ze(e,n.assets,n.store,ce(t.crop));case"video":return ue(e,n.assets,n.store);case"tour":return de(e,n.assets,n.store);case"document":return le(e,n.assets,n.store);case"media":return Ie(e,t,n.assets,n.store);case"poi":return n.resolvePoi(e);case"object":return xa(e,t,n);default:return e}}async function xa(e,t,n){if(t.fields==null||!e||typeof e!="object"||Array.isArray(e))return e;let[r]=await gt([e],{type:"list",fields:t.fields},n);return r}var bt=e=>e<0?0:e>1?1:e;function wt(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(l=>typeof l=="number"&&Number.isFinite(l)))return null;let i=bt(t),s=bt(n),a={nx:i,ny:s,nw:Math.min(bt(r),1-i),nh:Math.min(bt(o),1-s)};return a.nw<=0||a.nh<=0||a.nx===0&&a.ny===0&&a.nw===1&&a.nh===1?null:a}var va=/^processed\/crops\/([^/]+)\/(-?[\d.e-]+)_(-?[\d.e-]+)_(-?[\d.e-]+)_(-?[\d.e-]+)$/;function bo(e,t){return`processed/crops/${e}/${t.nx}_${t.ny}_${t.nw}_${t.nh}`}function Sa(e){let t=va.exec(e);if(t===null||Be(e)===null)return null;let n=wt({nx:Number(t[2]),ny:Number(t[3]),nw:Number(t[4]),nh:Number(t[5])});return n===null?null:{id:t[1],rect:n}}function Sn(e){return e==null?null:typeof e=="string"?e:e.url}function wo(e,t={}){let n=t.url??(s=>s),r=new Map;for(let s of e.values())for(let a of[s.file,s.posterFile]){let l=Sn(a);l!==null&&r.set(l,a)}let o=s=>r.has(s)?n(s):s,i=s=>{let a=s===null?void 0:r.get(s);return a===void 0||typeof a=="string"||a.responsive===null?null:{...a.responsive,sources:a.responsive.sources.map(l=>({...l,srcset:Ra(l.srcset,n)}))}};return{servedUrl:s=>{let a=Sa(s);if(a===null)return Promise.resolve(o(s));let l=Sn(e.get(a.id)?.file);return l===null?Promise.reject(new Error(`no image "${a.id}" to crop`)):Promise.resolve(t.crop===void 0?n(l):t.crop(l,a.rect))},fileUrl:s=>Promise.resolve(o(s)),ladder:()=>Promise.resolve({responsiveFor:s=>Promise.resolve(i(s))})}}function Ra(e,t){return e.split(",").map(n=>{let[r="",...o]=n.trim().split(/\s+/);return[t(r),...o].join(" ")}).join(", ")}function _o(e,t,n){let r=xn(e===null?null:Zn(e)),o=new Map;for(let i of t.values()){let s=Sn(i.file);s!==null&&i.sizeBytes!==void 0&&o.set(s,i.sizeBytes)}return new Map([...r].map(([i,s])=>{let a=s.bytes??(s.key===null?void 0:o.get(s.key)??n?.(s.key));return[i,a===void 0||a===s.bytes?s:{...s,bytes:a}]}))}async function ko(e){let t={store:e.store,assets:e.assets,resolvePoi:r=>r},n={};for(let[r,o]of Object.entries(e.slots)){let i=e.declared[r];n[r]=await vn(o,i,t)}return n}function Rn(e){return typeof e=="string"?e:e.url}function So(e,t){let{facts:n}=e,r=a=>e.media[a],o=a=>a?.file===null||a?.file===void 0?"":t(Rn(a.file)),i=a=>a?.posterFile!==void 0?t(Rn(a.posterFile)):a?.posterUrl??"",s=[];for(let a of re(n,{kinds:["image"],from:["property.property_media"]})){let l=r(a.id);s.push({id:a.id,kind:"photo",name:l?.filename||a.id,size:"",src:o(l)})}for(let a of re(n,{kinds:["image"],from:["property.floor_plans"]})){let l=r(a.id);s.push({id:a.id,kind:"plan",name:l?.filename||a.id,size:"",src:o(l)})}for(let a of re(n,{kinds:["video"],from:[Le]})){let l=a.provider??void 0;s.push({id:a.id,kind:"video",name:r(a.id)?.filename||a.name||a.id,size:"",src:i(r(a.id)),ready:!0,durationMs:a.duration_ms??null,...l===void 0?{}:{provider:l}})}for(let a of re(n,{kinds:["tour"],from:[Le]}))s.push({id:a.id,kind:"tour",name:`${a.provider??"Tour"} ${a.id}`,size:"",src:i(r(a.id)),url:a.url??"",provider:a.provider??""});for(let a of re(n,{kinds:["document"],from:[Le]})){let l=r(a.id)?.sizeBytes;s.push({id:a.id,kind:"document",name:a.name===""?a.id:a.name,size:"",src:"",mime:a.mime??"",...l===void 0?{}:{sizeBytes:l}})}return s}function Ro(e){let t={};for(let[n,r]of Object.entries(hn.pages)){let o=r.declaration;if(o.type!=="list"||V(o.element).length===0)continue;let i=`property.${n}`;t[i]=er(e.facts,i)??[]}return t}var Ea=["headshot","logo_dark","logo_light"];function Eo(e,t){return e.facts.contacts.map(n=>{let r={};for(let o of Ea){let i=xe(n[o]),s=i===void 0?void 0:e.media[i]?.file;i!==void 0&&s!==null&&s!==void 0&&(r[i]=t(Rn(s)))}return{id:n.id,images:r}})}function xo(e,t){let n={crop:{x:t.nx,y:t.ny,width:t.nw,height:t.nh},options:{}};return{key:bo(e,t),mime:null,width:null,height:null,bytes:null,over:n}}var $a={image:["asset_id","photo_id"],video:["asset_id","video_id"],tour:["asset_id","tour_id"],document:["asset_id"],media:["asset_id"]};function En(e,t){if(t==null)return t;let n=$a[e.type];if(n!==void 0){if(typeof t!="object")return null;let i=t,s=n.map(m=>i[m]).find(m=>typeof m=="string"&&m!=="");if(typeof s!="string")return null;if(e.type!=="image")return{asset_id:s};let a=wt(i.rect),l=typeof i.mobile=="object"&&i.mobile!==null?wt(i.mobile.rect):null,d="floor_label"in i?{floor_label:typeof i.floor_label=="string"?i.floor_label:null}:{};return{asset_id:s,...a===null?{}:{rect:a,renditions:{crop:xo(s,a)}},...l===null?{}:{mobile:{rect:l,renditions:{crop:xo(s,l)}}},...d}}if(e.type==="object")return vo(e.fields??{},t);if(e.type!=="list"||!Array.isArray(t))return t;let r=t,o=e.element;return o===void 0?r:o.type==="object"?r.map(i=>vo(o.fields??{},i)):r.map(i=>En(o,i))}function vo(e,t){if(typeof t!="object"||t===null)return t;let n={...t};for(let[r,o]of Object.entries(e))r in n&&(n[r]=En(o,n[r]));return n}async function $o(e){let{instance:t,slots:n,fixture:r,session:o,assetUrl:i}=e,s={...t.slots},a={},l=r.provenance[t.instance_id]??{};for(let g of Object.keys(n))a[g]=l[g]??{kind:"empty"};for(let[g,v]of Object.entries(o??{})){let A=n[g];A!==void 0&&(s[g]=En(A,v),a[g]={kind:"session"})}let d=new Map(Object.entries(r.media)),m=wo(d,{url:g=>i(g),crop:(g,v)=>i(g,{crop:v})});return{slots:await ko({slots:s,declared:n,assets:_o(r.facts,d),store:m}),provenance:a}}function Oo(e,t){let n={},r=o=>o.source?.kind==="derived";for(let[o,i]of Object.entries(e)){if(i.type==="object"){for(let[s,a]of Object.entries(i.fields??{})){let l=io(o,s);r(a)&&(n[l]=so(t,l))}continue}r(i)&&(n[o]=t[o])}return n}var Ao=1024*1024;function Aa(e){let t=W(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:{...Fe(e)}}}function Ia(e,t){return new Response(t,{status:e,headers:{"content-type":"text/plain; charset=utf-8"}})}function $n(e){return new Response(JSON.stringify(e),{headers:{"content-type":"application/json; charset=utf-8"}})}function On(e){return new Response(e,{headers:{"content-type":"text/html; charset=utf-8"}})}function Ta(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 Ge(e,t,n){let r=e.searchParams.get(t);if(r===null||r==="")throw new w(400,`${n} needs a ${t} parameter.`);return r}function ja(e){return`<script>
150
+ `),Zt=C.short({label:"Space"}),Ml=de({title:"Tell us about the commercial spaces",description:"Add each space\u2019s details and floor plans so they appear on your website."},H({label:"Commercial spaces",source:z.write({reads:[ye],brief:Tl}),item:He({label:Zt,fields:{label:Zt,use:C.short({label:"Use",cap:40}),sqft:pi,price:mi,floor:hi,parking:yi,amenities:gi,floor_plans:bi(Zt,jl),photos:wi(Zt,Pl)}})})),Cl="The uploads may present comparable properties: other properties an upload sets beside the subject for comparison. The subject is the property the uploads are marketing, at the read address; in a building, that is the building and every unit the uploads market in it. Find every comparable and return it as an item. A property is a comparable because an upload compares it with the subject, and it may appear as a row in a sales or rent comparables table, as a panel with its own photo and figures, as a numbered pin in a map legend, or as a line in a survey of recent trades. An upload presenting the subject or one of its units for itself, such as its listing sheet, brochure, price list or market history, presents the subject, whatever unit line it prints beside the read street. Read every upload whole, including tables that continue from one page to the next. Copy each figure exactly as an upload states it for that property, and each listing's remarks word for word. Specs come only from what is printed as text: never count rooms or take a figure from what a floor plan drawing, a photo or a map shows; a studio has one bedroom. Never compute one: not by multiplying a price per unit by a unit count, not by dividing a price by a size, not by counting the days between two dates, not by converting a yearly fee to a monthly one, not by averaging rows, and never by carrying a figure across from a neighbouring row, a summary or the subject. If a property is listed in more than one place \u2014 on several pages, or in several uploads \u2014 return one item carrying every figure those places state. A figure no upload states for that property is null; a null is always better than a guess. Never return the subject, even where it appears in a comparables table or at the centre of a comparables map. Another unit of the subject's building is a comparable only where an upload sets it beside the subject as one, such as a sister unit's earlier sale in a comps table. Do not return a market, submarket or area average, a portfolio total, or anything that is not an individual property. When no upload compares another property with the subject, return no items.",pr=Vt({label:"Address"}),di=tr({label:"Sale date"}),Fl=de({title:"Which properties compare?",description:"Recently sold or listed homes like this one shape the pricing story."},H({label:"Comparables",max:50,source:z.write({reads:[ye,gr],brief:Cl}),item:He({label:pr,fields:{address:pr,price:M({label:"Price"}),sale_date:di,beds:M({label:"Beds"}),baths:M({label:"Baths",decimals:!0}),sqft:M({label:"Sq ft"}),photo:ae({label:"Photo"}),year_built:M({label:"Year built"}),lot_sqft:M({label:"Lot sq ft"}),stories:M({label:"Stories",decimals:!0}),units:M({label:"Units"}),hoa_monthly:M({label:"HOA per month"}),list_price:M({label:"List price"}),listed_date:tr({label:"Listed date"}),mls_number:C.short({label:"MLS number"}),description:C.long({label:"Description"}),status:dt({label:"Status",from:[...ml],locked:!0,source:Ct({reads:[di]},e=>yl(e))}),distance_m:M({label:"Distance (m)",locked:!0,source:Ct({reads:[pr,gr]},(e,t)=>kl(e,t))}),price_period:dt({label:"Price period",from:[...hl],locked:!0,source:Ct({reads:[ui]},e=>gl(e))})}})})),Dl=de({title:"Who\u2019s on this listing?",description:"Add the contacts for this property, and drag them into the order your marketing shows them."},H({label:"Contacts",min:1,max:12,source:z.pick({reads:[ye],brief:"Choose this listing's contacts from the library's contacts, judging each one's name, title, organisation, email and phone against the read uploads' names and accounts. A contact may be chosen only when an upload's name or account says it prints their email or phone, or their full name, as a contact for this listing \u2014 an agent, broker, or sales or leasing contact. A contact the uploads leave out, where their accounts name the listing's contacts, is not chosen. A shared organisation, a matching first name, or a name printed in another role (an architect, a photographer, a seller) is not evidence. When no upload's account names any contact, choose none. Order those chosen as the uploads present them for this listing, the first or most prominent first."}),item:li({label:"Contact",from:Qt.contacts})})),ce=ci("property",{address:gr,listing_intent:ui,description:de({title:"Describe the property",description:"Talk it up like you would to a buyer, and our AI writes your website copy."},C.long({label:"Description"})),uploads:ye,property_media:br,floor_plans:fi,property_documents:xl,hero:Sl,site_url:Rl,units:Al,commercial_spaces:Ml,contacts:Dl,comparables:Fl});Vn(ce);function pt(e){return Wn(ce).has(e)}function Ll(e){let t=Wn(ce).get(e);if(t===void 0)throw new Error(`fact registry: "${e}" names no property fact`);return t}function wr(e){return Ll(e).value_type}function Nl(){return jo(ce)}function ki(e){return typeof e=="string"&&Nl().includes(e)}function Hl(e){return typeof e=="string"?e:null}function Ul(e){let t=pe(e);return t===void 0?null:{media:t}}function vi(e,t){let[,n="",r]=e.split("."),o=t[n];switch(wr(`property.${n}`)){case"address":{let i=Q(o);return r===void 0?i:i===null?null:i[r]}case"image":return Ul(o);case"number":return typeof o=="number"?o:null;case"text":return Hl(o)}}function xi(e){return e!==null&&typeof e=="object"?e:null}function je(e){let t=xi(e);if(t?.kind!=="row")return null;let{slot:n,field:r}=t;return typeof n!="string"||n===""||typeof r!="string"||r===""?null:{slot:n,field:r}}function Pe(e){return Object.entries(e??{}).filter(([,t])=>t.type==="row"&&xi(t.source)?.kind==="element").map(([t])=>t)}function Si(e){let t=new Set(Pe(e)),n={};for(let[r,o]of Object.entries(e??{})){let i=je(o.source);i!==null&&t.has(i.slot)&&(n[r]=i.field)}return n}function en(e){return Yn(Nt(e)==="library"?Qt:ce,e)}function Kl(e,t){return Jn(en(e),t)}function Ri(e){return Object.keys(en(e))}function Oi(e,t){if(t==="id")return{kind:"identity"};let n=t.indexOf("."),r=n===-1?t:t.slice(0,n),o=ie(e,r)??null;if(o===null)return{kind:"unknown",offers:Ri(e)};if(n!==-1){let i=t.slice(n+1);return o!=="address"?{kind:"unknown",offers:Ri(e)}:Oe(i)?{kind:"member",value_type:Bn(i),storable:_i(e,t)}:{kind:"unknown",offers:it.map(s=>`${r}.${s}`)}}return{kind:"member",value_type:o,storable:_i(e,t)}}function _i(e,t){if(t===void 0){if(E(e)!==null)return!0;if(!pt(e))return!1;let r=e.slice(0,e.lastIndexOf("."));return!(pt(r)&&wr(r)==="address")}if(!zn().includes(e))return!1;let n=Kl(e,t);return n!==void 0&&!Po(n)}function tn(e,t){let n=Object.entries(en(e)).filter(([,o])=>Lt(o)==="address").map(([o])=>o);return t[e].map(o=>{let i={...o};for(let s of n)i[s]=Q(o[s]);return i})}function kr(e,t,n){let r=Oi(e,n);if(r.kind==="identity")return t.id??null;if(r.kind==="unknown")return null;let o=n.indexOf(".");if(o===-1)return t[n]??null;let i=n.slice(o+1);return Oe(i)?So(t[n.slice(0,o)],i):null}function $i(e,t,n){return tn(e,n).find(r=>r.id===t)}function vr(e,t,n,r){let o=$i(e,t,r);return o===void 0?null:kr(e,o,n)}function nn(e,t,n,r={},o){let i=Pe(n);return ql(e,t,Si(n),i,r,o)}function ql(e,t,n,r,o,i){return(i===void 0?tn(e,t):i.flatMap(a=>{let l=$i(e,a,t);return l===void 0?[]:[l]})).map(a=>{let l={id:a.id};for(let d of r)l[d]=a.id;for(let[d,f]of Object.entries(n))l[d]=kr(e,a,f);for(let[d,f]of Object.entries(o))l[d]=f(p=>kr(e,a,p),a.id);return l})}function rn(e,t){if(pt(t))return vi(t,e);if(ki(t))return e[t.slice(9)];let n=E(t);if(n!==null)return tn(n,e);let r=Ht(t);if(r!==null)return tn(r.table,e).map(o=>o[r.member]??null)}function Ei(e,t){return e?.order?.[t]===!0}function Ii(e,t){return e?.scalar?.[t]===!0}function Ue(e,t){return`${e}.${t}`}function Ke(e){let t=e.indexOf(".");return t<=0||t===e.length-1||e.includes(".",t+1)?null:{object:e.slice(0,t),field:e.slice(t+1)}}function xr(e,t){let n=Ke(t);if(n===null)return e[t];let r=e[n.object];return r!==null&&typeof r=="object"&&!Array.isArray(r)?r[n.field]:void 0}function Ai(e,t){return{...e?.items?.[t]??{}}}function ji(e){if(e===null||typeof e!="object")return[];let t=e.reads;return Array.isArray(t)?t:[]}function Pi(e){let{kind:t,section:n,slot:r}=e??{};return t==="section"&&typeof n=="string"&&typeof r=="string"?{kind:t,section:n,slot:r}:null}function Ti(e){return ji(e).map((t,n)=>{let r=t??{},{kind:o,key:i,slot:s,field:a}=r;if(o==="home"&&typeof i=="string")return{kind:"home",key:i};if(o==="row"&&typeof s=="string"&&s!==""&&typeof a=="string")return{kind:"row",slot:s,field:a};if(o==="element")return{kind:"element"};let l=Pi(t);if(l!==null)return l;throw new Error(`reads[${String(n)}] is not a home, section, row or element ref: ${JSON.stringify(t)}`)})}function on(e){return ji(e).flatMap(t=>Pi(t)??[])}function Sr(e,t,n,r,o,i){let a=Ti(t).map(l=>{if(l.kind==="home")return rn(n,l.key);if(l.kind==="row"){if(o===void 0)throw new Error(`reads the row member "${l.field}" with no row in scope`);return o(l.field,l.slot)}if(l.kind==="element"){if(i===void 0)throw new Error("reads the element outside a list's item");return i()}return r?.(l)}).map(l=>ao(l,n));return fe(e(...a))}function mt(e){let t=e.display;return t!==null&&typeof t=="object"?t:{}}var ht=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function yt(e){return e.type==="list"&&e.element!==void 0}function gt(e){return e.element?.type==="object"?e.element.fields??{}:void 0}function qe(e,t){if(typeof e=="string")return e===""?null:e;if(t!==null&&ht(e)){let n=e.id;if(typeof n=="string"&&n!=="")return n}return Ae(e,t)}function sn(e,t,n){let[r]=t;if(r===void 0)return{table:null,id:qe(e,null),element:e};if(t.length>1)for(let o of t){let i=qe(e,o);if(i!==null&&Gt(n,[o]).some(s=>s.id===i))return{table:o,id:i}}return{table:r,id:qe(e,r)}}function Ve(e,t,n){return e.table!==null?e.id===null?null:fe(vr(e.table,e.id,t,n)):ht(e.element)?e.element[t]??null:null}function Vl(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function Rr(e){let t=new Map;return e.map(n=>{let r=Ae(n,null)??`el_${Vl(JSON.stringify(n)??"undefined")}`,o=t.get(r)??0;return t.set(r,o+1),o===0?r:`${r}_${String(o)}`})}function bt(e,t){let{element:n,table:r,facts:o,computes:i}=t,s=n.type==="object"?n.fields??{}:void 0;return r!==null?s===void 0?e.map(a=>a.id):e.flatMap(({element:a,id:l})=>{let d=typeof a=="string"?a:l,[f]=fe(nn(r,o,s,i,[d]));return f===void 0?[]:[Mi({...f,id:l},s,o)]}):n.type==="row"?e.map(a=>a.id):s===void 0?e.map(a=>a.element):e.map(a=>Mi(Wl(a,s,i),s,o))}function Ci(e){return yt(e)&&e.element?.type==="object"?e.element:void 0}function Fi(e,t,n){if(!Array.isArray(e))return e;let r=Rr(e);return bt(e.map((o,i)=>({element:o,id:r[i]})),{element:t,table:null,facts:n,computes:{}})}function Mi(e,t,n){for(let[r,o]of Object.entries(t)){let i=Ci(o);i!==void 0&&Object.hasOwn(e,r)&&(e[r]=Fi(e[r],i,n))}return e}function Wl({element:e,id:t,storedItem:n},r,o){let i=new Set(Pe(r)),s=l=>ht(e)?e[l]??null:null,a={id:t};for(let[l,d]of Object.entries(r)){if(i.has(l)){a[l]=t;continue}if(ht(d.source)&&d.source.kind==="element"){a[l]=e;continue}let f=je(d.source);f!==null&&i.has(f.slot)&&(a[l]=s(f.field))}for(let[l,d]of Object.entries(r)){let f=je(d.source);if(f===null||r[f.slot]?.type!=="address")continue;let p=Q(Object.hasOwn(a,f.slot)?a[f.slot]:n?.[f.slot]);a[l]=ht(p)?p[f.field]??null:null}for(let[l,d]of Object.entries(o))a[l]=d(s,e);return a}function Di(e){if(e.source===null||e.source===void 0||typeof e.source!="object")return null;let t=e.source;return t.kind!=="derived"?null:typeof t.transform=="string"?{transform:t.transform}:null}function an(e,t){let n=Array.isArray(e)?e:[];if(t!==null)return n.flatMap(o=>{let i=qe(o,t);return i===null?[]:[{element:i,id:i}]});let r=Rr(n);return n.map((o,i)=>({element:o,id:r[i]}))}function _r(e,t,n,r,o){let i={},s=new Set(Pe(t)),a={container:e,siblings:t??{},nested:o?.nested===!0},l=d=>{if(o===void 0)return;let f=ft(o.rows.slots,a,d);return f===void 0||f.sibling?void 0:o.rows.rows(f.path)};for(let[d,f]of Object.entries(t??{})){let p=Di(f);p!==null&&(i[d]=(b,h)=>{let x=(I,P)=>{if(s.has(P))return b(I);let xe=l(P);return xe===void 0?void 0:Ve(xe,I,n)};return wt(p.transform,f.source,n,r,{slot_id:`${e}.${d}`},void 0,x,()=>h)?.value??null})}return i}function wt(e,t,n,r,o,i,s,a){let l=r?.computed[e];try{if(l===void 0)throw new Error(`derived handle "${e}" is not in the section's computed map`);return{value:Sr(l,t,n,i,s,a)}}catch(d){return r?.log?.error({event:"derive_function_threw",section_key:r.section_key,...o,derived_handle:e,err:d},"derive: authored function threw or is missing; resolved to nothing"),null}}function Li(e,t,n,r){let o=typeof n=="string"?n:"";return e.cases?.includes(o)===!0?o:(r?.log?.error({event:"display_compute_out_of_vocabulary",section_key:r.section_key,display_entry:t,answer:n},"display: source compute answered outside its declared cases; falling back to the first case"),null)}function Ni(e,t){return e?.[t]===!0}var Hi=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function Ui(e){return D(e)??null}function te(e,t){let n=Ui(t);return n!==null?Ui(e)===n?e:t:Array.isArray(t)?Array.isArray(e)?Yl(e,t):t:Hi(t)&&Hi(e)?Gl(e,t):t}function Gl(e,t){let n={};for(let[r,o]of Object.entries(t))n[r]=te(e[r],o);return n}function Yl(e,t){let n=new Map;for(let r of e){let o=Ae(r);if(o===null)continue;let i=n.get(o);i===void 0?n.set(o,[r]):i.push(r)}return t.map(r=>{let o=Ae(r),i=o===null?void 0:n.get(o);return i===void 0||i.length===0?r:te(i.shift(),r)})}var Xl=e=>typeof e=="string"&&e.startsWith("tmp_");function Jl(e,t){let n=[],r=new Map;for(let o of t){let i=o[e],s=typeof i=="string"?r.get(i):void 0;if(s===void 0){typeof i=="string"&&r.set(i,n.length),n.push(o);continue}n[s]={...o,...n[s]}}return n}function ln(e,t,n,r,o,i){let s=i?{...e}:{};for(let[a,l]of Object.entries(t)){if(a===o){s[a]=l;continue}s[a]=n?.[a]===!0?e[a]:te(e[a],l)}for(let a of r)a in e&&(s[a]=e[a]);return s}function Or(e){let t=e.membership??"table",n=e.idKey??"id",r=Jl(n,e.current);if(t==="table")return Ql({...e,idKey:n,current:r});let{freshSource:o,overrides:i,generatedFields:s}=e,a=new Map;for(let d of r){let f=d[n];typeof f=="string"&&a.set(f,d)}if(t==="source")return e.ordered===!0?Zl(r,o,e,n):o.map(d=>{let f=d[n],p=typeof f=="string"?a.get(f):void 0;return p===void 0?d:ln(p,d,i?.[f],s,n,!0)});let l=new Map;for(let d of o){let f=d[n];typeof f=="string"&&l.set(f,d)}return r.map(d=>{let f=d[n],p=typeof f=="string"?l.get(f):void 0;return p===void 0?d:ln(d,p,i?.[f],s,n,!0)})}function Zl(e,t,n,r){let o=new Map;for(let a of t){let l=a[r];typeof l=="string"&&o.set(l,a)}let i=[],s=new Set;for(let a of e){let l=a[r],d=typeof l=="string"?o.get(l):void 0;d===void 0||s.has(l)||(i.push(ln(a,d,n.overrides?.[l],n.generatedFields,r,!0)),s.add(l))}for(let a of t){let l=a[r];typeof l=="string"&&s.has(l)||i.push(a)}return i}function Ql(e){let{current:t,freshSource:n,overrides:r,removed:o,generatedFields:i,idKey:s,ordered:a}=e,l=new Map;for(let b of n){let h=b[s];typeof h=="string"&&l.set(h,b)}let d=[],f=new Set;for(let b of t){let h=b[s];if(Xl(h)||typeof h!="string"){d.push(b);continue}let x=l.get(h);x!==void 0&&(d.push(ln(b,x,r?.[h],i,s,!1)),f.add(h))}for(let b of n){let h=b[s];typeof h!="string"||f.has(h)||o?.[h]!==!0&&d.push(b)}if(a===!0)return d;let p=new Map;return n.forEach((b,h)=>{let x=b[s];typeof x=="string"&&p.set(x,h)}),d.map((b,h)=>{let x=b[s],I=typeof x=="string"?p.get(x):void 0;return{row:b,i:h,idx:I}}).sort((b,h)=>b.idx===void 0&&h.idx===void 0?b.i-h.i:b.idx===void 0?1:h.idx===void 0?-1:b.idx-h.idx).map(b=>b.row)}var Er="display.",U=(e,t)=>`${e} ${t}`,dn=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function We(e,t){if(e===void 0)return;if(t===`${Er}visibility`)return e.enabled?"visible":"hidden";if(t===`${Er}variant`)return e.variant;if(Object.hasOwn(e.slots,t))return e.slots[t];let n=Ke(t);if(n===null)return;let r=e.slots[n.object];return dn(r)?r[n.field]:void 0}function Ar(e){let t=td(e.sections);if(t.size===0)return{contentDoc:e.contentDoc,changed:!1,changes:[]};let n=new Map(e.contentDoc.instances.map(c=>[c.instance_id,{...c}])),r=new Set,o=c=>(r.has(c.instance_id)||(c.slots={...c.slots},r.add(c.instance_id)),c.slots),i=(c,u,k)=>{let v=Ke(u),O=o(c);if(v===null||Object.hasOwn(O,u)){O[u]=k;return}let S=O[v.object];O[v.object]={...dn(S)?S:{},[v.field]:k}},{facts:s}=e,a=c=>(e.typing?.get(c)??e.sections.get(c))?.localKey,l=(c,u)=>e.placement.locate({kind:"section",section:u.section,slot:u.slot},{instanceId:c,section:a(c)??""})?.instanceId,d=(c,u)=>l(c.instanceId,u),f=(c,u)=>We(c===void 0?void 0:n.get(c),u),p=c=>e.typing?.get(c)??e.sections.get(c),b=c=>{let u=e.placement.readable(c);return u===void 0?void 0:p(u)?.schema.slots},h=(c,u)=>{let k=c===void 0?void 0:p(c);return k===void 0?null:ei({section:k.localKey,slots:k.schema.slots??{},sectionSlots:b},u)},x=new Map,I=(c,u)=>({element:c.def.element??{},table:u,facts:s,computes:_r(c.key,gt(c.def),s,c.section.bakeContext)}),P=(c,u,k,v)=>{let O=c.slots[u.key];return gt(u.def)===void 0?te(O,v):Or({current:Array.isArray(O)?O:[],freshSource:v,overrides:Ai(c.slot_overrides,u.key),generatedFields:[],membership:"source",ordered:Ei(c.slot_overrides,u.key)})},xe=(c,u,k)=>{let v=e.typing?.get(c)??e.sections.get(c),O=v===void 0?void 0:zt(v.schema.slots??{},u),S=f(c,u);if(O?.type==="address")return{value:Ve({table:null,id:null,element:Q(S)},k,s)};let $=typeof S=="string"&&S!==""?S:null,j=O===void 0?null:sr(s,Ie(O),$),V=x.get(U(c,u)),K=V!==void 0&&V.id===$?V:{table:j,id:$};if(!(K.table===null&&K.element===void 0&&K.id!==null))return{value:Ve(K,k,s)}},Xe=(c,u)=>{let k=c.section.schema.slots??{},v=Ke(c.key),O=v===null?void 0:k[v.object]?.fields,S=v===null||O===void 0?{}:{container:v.object,siblings:O};return ft(k,S,u)?.path},Ot=c=>(u,k)=>{let v=Xe(c,k);return v===void 0?void 0:xe(c.instanceId,v,u)?.value},pn=(c,u)=>{if(u.kind==="reader"){let S=xe(u.instanceId,u.rowPath,u.field);return S===void 0?void 0:{value:te(We(c,u.key),S.value)}}if(u.kind==="mirror"){let S=d(u,u.ref),$=f(S,u.ref.slot),j=h(u.instanceId,u.key);if(u.def.type==="row"){let K=sn($,Ie(u.def),s);return x.set(U(u.instanceId,u.key),{...K,element:$}),{value:K.id}}if(u.def.type!=="list")return{value:te(We(c,u.key),$??null)};let V=bt(an(Array.isArray($)?$:[],j),I(u,j));return{value:P(c,u,j,V)}}let k=wt(u.transform,u.source,s,u.section.bakeContext,{slot_id:u.key},S=>f(d(u,S),S.slot),Ot(u));if(u.def.type==="row"){let S=sn(k?.value??null,Ie(u.def),s);return x.set(U(u.instanceId,u.key),S),{value:S.id}}if(yt(u.def)){let S=h(u.instanceId,u.key),$=bt(an(k?.value??[],S),I(u,S));return{value:P(c,u,S,$)}}let v=u.def.type==="list",O=k===null?v?[]:null:k.value??(v?[]:null);return{value:te(We(c,u.key),O)}},mn=c=>{let u=n.get(c.instanceId);if(u===void 0)return!1;if(c.kind==="display")return ed(u,c,s,v=>f(d(c,v),v.slot),Ot(c));if(Ii(u.slot_overrides,c.key))return!1;let k=pn(u,c);return k===void 0||nd(We(u,c.key),k.value)?!1:(i(u,c.key,k.value),!0)},Ce=[],w=new Set,y=new Set,m=c=>{let u=U(c.instanceId,c.key);if(!(w.has(u)||y.has(u))){y.add(u);for(let k of c.slotRefs){let v=d(c,k),O=v===void 0?void 0:t.get(U(v,k.slot));O!==void 0&&m(O)}if(c.kind==="derived"||c.kind==="display")for(let k of Ir(c.source)){let v=Xe(c,k),O=v===void 0?void 0:t.get(U(c.instanceId,v));O!==void 0&&m(O)}y.delete(u),w.add(u),mn(c)&&Ce.push({instance_id:c.instanceId,slot:c.key})}};for(let c of t.values())m(c);if(Ce.length===0)return{contentDoc:e.contentDoc,changed:!1,changes:Ce};let g=e.contentDoc.instances.map(c=>n.get(c.instance_id)??c);return{contentDoc:{...e.contentDoc,instances:g},changed:!0,changes:Ce}}function ed(e,t,n,r,o){if(Ni(e.display_overrides,t.displayEntry))return!1;let i=wt(t.transform,t.source,n,t.section.bakeContext,{display_entry:t.displayEntry},r,o);if(i===null)return!1;let s=mt(t.section.schema)[t.displayEntry],a=s===void 0?null:Li(s,t.displayEntry,i.value,t.section.bakeContext);if(a===null)return!1;if(t.displayEntry==="visibility"){let l=a!=="hidden";return e.enabled===l?!1:(e.enabled=l,!0)}return e.variant===a?!1:(e.variant=a,!0)}function td(e){let t=new Map;for(let[n,r]of e){let o=r.schema.slots??{},i=[];for(let[l,d]of Object.entries(o)){if(i.push({path:l,def:d,reader:{}}),d.type!=="object")continue;let f=d.fields??{};for(let[p,b]of Object.entries(f))i.push({path:Ue(l,p),def:b,reader:{container:l,siblings:f}})}for(let{path:l,def:d}of i){let f=Zo(d);if(f!==null){t.set(U(n,l),{kind:"mirror",instanceId:n,key:l,slotRefs:[f],section:r,ref:f,def:d});continue}let p=$r(d.source),b=on(d.source);p===null||b.length===0||t.set(U(n,l),{kind:"derived",instanceId:n,key:l,slotRefs:b,section:r,transform:p,source:d.source,def:d})}let s=(l,d)=>{let f=ft(o,l,d)?.path,p=f===void 0?void 0:t.get(U(n,f));return p!==void 0&&(p.kind==="mirror"||p.kind==="derived")&&p.def.type==="row"?f:void 0};for(let l=!0;l;){l=!1;for(let{path:d,def:f,reader:p}of i){if(t.has(U(n,d)))continue;let b=je(f.source),h=b===null?void 0:s(p,b.slot);if(b!==null&&h!==void 0){t.set(U(n,d),{kind:"reader",instanceId:n,key:d,slotRefs:[{kind:"section",section:r.localKey,slot:h}],section:r,rowPath:h,field:b.field}),l=!0;continue}let x=$r(f.source);x===null||!Ir(f.source).some(I=>s(p,I)!==void 0)||(t.set(U(n,d),{kind:"derived",instanceId:n,key:d,slotRefs:[],section:r,transform:x,source:f.source,def:f}),l=!0)}}let a=mt(r.schema);for(let l of In){let d=a[l]?.source,f=$r(d),p=on(d);if(f===null||p.length===0&&!Ir(d).some(h=>s({},h)!==void 0))continue;let b=`${Er}${l}`;t.set(U(n,b),{kind:"display",instanceId:n,key:b,transform:f,source:d,slotRefs:p,section:r,displayEntry:l})}}return t}function Ir(e){return(dn(e)&&Array.isArray(e.reads)?e.reads:[]).flatMap(n=>dn(n)&&n.kind==="row"&&typeof n.slot=="string"?[n.slot]:[])}function $r(e){if(e===null||typeof e!="object")return null;let{kind:t,transform:n}=e;return t==="derived"&&typeof n=="string"?n:null}function nd(e,t){return JSON.stringify(e)===JSON.stringify(t)}function kt(e){return/^processed\/crops\/([^/]+)\//.exec(e)?.[1]??null}var od={responsiveFor:()=>Promise.resolve(null)};async function ge(e,t){try{let n=await e.ladder(t);return{responsiveFor:async r=>{try{return await n.responsiveFor(r)}catch{return null}}}}catch{return od}}var vt={asset_id:"",url:"",filename:"",content_type:"",size_bytes:0,poster:""};async function id(e,t,n){if(!t)return e;try{e.poster=await n.fileUrl(t)}catch(i){return n.log?.warn({media_id:e.asset_id,err:i.message},"resolve-document-slot: preview presign failed; no poster"),e}let o=await(await ge(n,[t])).responsiveFor(t);return o&&(e.poster_responsive=o),e}async function be(e,t,n){if(e===null)return null;if(typeof e!="object")return vt;let r=e,o=D(r)??"";if(!o)return vt;let i=t.get(o);if(i===void 0)return n.log?.warn({media_id:o},"resolve-document-slot: no media the render may reach"),vt;let s=i.key;if(s===null)return n.log?.warn({media_id:o},"resolve-document-slot: media has no stored object"),vt;try{let l=(r.picked===null&&typeof r.name=="string"&&r.name!==""?r.name:null)??i.name,d={asset_id:o,url:n.namedFileUrl?await n.namedFileUrl(s,l):await n.fileUrl(s),filename:l,content_type:i.mime??"",size_bytes:i.bytes??0,poster:""};return await id(d,i.renditions.poster?.key??null,n)}catch(a){return n.log?.error({media_id:o,err:a.message},"resolve-document-slot: presign failed; soft-empty document"),vt}}var Ki=16/10;function qi(e){if(e===null||typeof e!="object")return null;let t=e,[n,r,o,i]=["x","y","width","height"].map(s=>t[s]);return![n,r,o,i].every(s=>typeof s=="number"&&Number.isFinite(s))||n===0&&r===0&&o===1&&i===1?null:{x:n,y:r,width:o,height:i}}function we(e){if(e===null||typeof e!="object")return{mode:"free",aspect:Ki};let t=e,n=typeof t.aspect=="number"&&t.aspect>0?t.aspect:Ki,r=t.mobile?.aspect,o=typeof r=="number"&&r>0&&Math.abs(r-n)>1e-4?r:void 0;return{mode:t.mode==="free"?"free":"locked",aspect:n,...o===void 0?{}:{mobileAspect:o}}}function sd(e,t){if(e===null||t===null)return e===t;let n=r=>Math.round(r*1e4)/1e4;return n(e.x)===n(t.x)&&n(e.y)===n(t.y)&&n(e.width)===n(t.width)&&n(e.height)===n(t.height)}function ad(e,t){if(e===null||!(e>0)||!(t>0))return null;let n=Math.min(1,t/e),r=Math.min(1,e/t),o={x:(1-n)/2,y:0,width:n,height:r};return sd(o,{x:0,y:0,width:1,height:1})?null:o}function Vi(e,t,n,r){if(e!==null||n.mode==="free")return e;let o=r==="mobile"?n.mobileAspect:n.aspect;return o===void 0?null:ad(t,o)}function Te(){return{photo_id:"",url:"",alt:""}}function Wi(e,t){let n=t===void 0?void 0:e.renditions[t==="white"?"mask_white":"mask_black"]?.key,r=jn(e.crop)?e.renditions.crop?.key:void 0;return n??e.renditions.cutout?.key??r??e.key}async function jr(e,t,n,r){if(t===void 0)return n.log?.warn({id:e},"resolve-media-id: no image media the render may reach; no media"),null;if(t.kind!=="image")return n.log?.warn({id:e,kind:t.kind},"resolve-media-id: media is not an image; no media"),null;try{let o=Wi(t,r?.mask);return{url:await n.servedUrl(o),source_key:o}}catch(o){return n.log?.error({id:e,err:o.message},"resolve-media-id: presign failed; no media"),null}}function Bi(e){let t=e&&typeof e=="object"?e.key:void 0;return typeof t=="string"&&t.length>0?t:null}function zi(e,t,n){let r=qi(e.crop);return t===void 0?r:Vi(r,t.imageAspect,t.aspects,n)}function Gi(e,t,n){if(!jn(n))return null;let r=e.renditions&&typeof e.renditions=="object"?e.renditions:{},o=Bi(r.crop);return o!==null&&kt(o)===t?o:null}function Yi(e,t){return Gi(e,cn(e),zi(e,t))}function Xi(e,t){let n=e.mobile&&typeof e.mobile=="object"?e.mobile:t===void 0?null:{};return n===null?null:Gi(n,cn(e),zi(n,t,"mobile"))}async function ld(e,t){try{return{url:await t.servedUrl(e)}}catch{return null}}function dd(e,t,n){let r=cn(e),o=e.renditions&&typeof e.renditions=="object"?e.renditions:{},i=a=>{let l=Bi(o[a]);return l!==null&&l.startsWith(`processed/cutout/${r}/`)?l:null};return(t===null?null:i(t==="white"?"mask_white":"mask_black"))??i("cutout")??(t===null?Yi(e,n):null)}function cn(e){return D(e)??""}async function Be(e,t,n,r){if(e===null)return{value:null,desktopKey:null,mobileKey:null};if(!e||typeof e!="object")return{value:Te(),desktopKey:null,mobileKey:null};let o=e,i=typeof o.ar=="number"?o.ar:null,s=cn(o),a=o.mask==="white"||o.mask==="black"?o.mask:null,l=s?t.get(s):void 0,d=r===void 0?void 0:{aspects:r,imageAspect:cd(l,i)},f=s?Xi(o,d):null,p=f?await ld(f,n):null,b=typeof o.alt=="string"?o.alt:"",h=s?dd(o,a,d):null,x,I;if(h){x={photo_id:s,url:await n.servedUrl(h),alt:b},I=h;let P=await jr(s,l,n);P&&P.url!==x.url&&(x.download_url=P.url)}else if(s){let P=await jr(s,l,n,a?{mask:a}:void 0);if(!P)return{value:Te(),desktopKey:null,mobileKey:f};x={photo_id:s,url:P.url,alt:b},I=P.source_key}else return{value:Te(),desktopKey:null,mobileKey:null};return{value:p?{...x,mobile:p}:x,desktopKey:I,mobileKey:p?f:null}}function cd(e,t){return e?.kind==="image"&&e.width!==null&&e.height!==null&&e.width>0&&e.height>0?e.width/e.height:t!==null&&t>0?t:null}async function xt(e,t){let n=e.flatMap(o=>[o.desktopKey,o.mobileKey]).filter(o=>!!o),r=await ge(t,n);for(let o of e){if(!o.value)continue;let i=await r.responsiveFor(o.desktopKey);if(i&&(o.value.responsive=i),o.value.mobile&&o.mobileKey){let s=await r.responsiveFor(o.mobileKey);s&&(o.value.mobile={...o.value.mobile,responsive:s})}}}async function St(e,t,n,r){let o=await Be(e,t,n,r);return await xt([o],n),o.value}var ze={tour_id:"",url:"",poster:"",alt:""};async function ud(e,t,n){if(!t||!e.poster)return e;let o=await(await ge(n,[t])).responsiveFor(t);return o&&(e.poster_responsive=o),e}async function ke(e,t,n){if(e===null)return null;if(typeof e!="object")return ze;let r=e,o=D(r)??"";if(!o)return ze;let i=t.get(o);if(i===void 0)return n.log?.warn({tour_id:o},"resolve-tour-slot: no tour media the render may reach"),ze;if(i.kind!=="tour")return n.log?.warn({tour_id:o,kind:i.kind},"resolve-tour-slot: media is not a tour"),ze;try{let s=no(i.url);if(s===null)return n.log?.warn({tour_id:o},"resolve-tour-slot: tour link embeds nowhere"),ze;let a=i.renditions.poster?.key??null,l={tour_id:o,url:s,poster:a?await n.fileUrl(a):"",alt:typeof r.alt=="string"?r.alt:"",provider:i.provider};return ud(l,a,n)}catch(s){return n.log?.error({tour_id:o,err:s.message},"resolve-tour-slot: presign failed; soft-empty tour"),ze}}var Ge={video_id:"",url:"",poster:"",alt:""};async function Pr(e,t,n){if(!t||!e.poster)return e;let o=await(await ge(n,[t])).responsiveFor(t);return o&&(e.poster_responsive=o),e}async function ve(e,t,n){if(e===null)return null;if(typeof e!="object")return Ge;let r=e,o=D(r)??"";if(!o)return Ge;let i=t.get(o);if(i===void 0)return n.log?.warn({video_id:o},"resolve-video-slot: no video media the render may reach"),Ge;if(i.kind!=="video")return n.log?.warn({video_id:o,kind:i.kind},"resolve-video-slot: media is not a video"),Ge;let s=i.renditions.poster?.key??null,a=typeof r.alt=="string"?r.alt:"";try{if(ro(i)==="link"){let p=i.url,b=to(p);if(!b)return n.log?.warn({video_id:o},"resolve-video-slot: link upload embeds nowhere"),Ge;let h={video_id:o,url:b,poster:s?await n.fileUrl(s):"",alt:a,source:"link"};return i.provider!==null&&(h.provider=i.provider),Pr(h,s,n)}let l=s?await n.fileUrl(s):"",d=i.renditions.encode;if(d===null)return n.log?.warn({video_id:o,state:i.state},"resolve-video-slot: no encode; poster-only"),i.state!=="failed"&&n.notePending?.({kind:"video",id:o}),Pr({video_id:o,url:"",poster:l,alt:a},s,n);let f={video_id:o,url:await n.fileUrl(d.key),poster:l,alt:a};return d.width!==null&&(f.width=d.width),d.height!==null&&(f.height=d.height),Pr(f,s,n)}catch(l){return n.log?.error({video_id:o,err:l.message},"resolve-video-slot: presign failed; soft-empty video"),Ge}}async function Ye(e,t,n,r){if(e===null||typeof e!="object")return null;let o=D(e);if(o===void 0)return null;let i=n.get(o);if(i===void 0)return r.log?.warn({media_id:o},"resolve-media-slot: no media the render may reach"),null;if(!J(t).includes(i.kind))return r.log?.warn({media_id:o,kind:i.kind},"resolve-media-slot: media is of a kind the slot does not hold"),null;let s={media:o};switch(i.kind){case"image":{let a=await St(e,n,r,we(t.crop));return a===null?null:{...a,kind:"image"}}case"video":{let a=await ve(s,n,r);return a===null?null:{...a,kind:"video"}}case"tour":{let a=await ke(s,n,r);return a===null?null:{...a,kind:"tour"}}case"document":{let a=await be(s,n,r);return a===null?null:{...a,kind:"document"}}}}function Tr(e){return e==="image"?"image":e==="video"?"video":e==="tour"?"tour":e==="document"?"document":e==="media"?"media":e==="poi"?"poi":"scalar"}function Me(e){if(e?.type!=="list")return null;let t=e.element?.type==="object"?e.element?.fields:void 0;return t!=null?{kind:"record",fields:t}:{kind:"primitive",primitive:Tr(e.element?.type)}}async function un(e,t,n){if(!Array.isArray(e))return[];let r=Me(t);return r===null?e:r.kind==="record"?fd(e,r.fields,n):Ji(e,r.primitive,n,t.element)}async function Ji(e,t,n,r){switch(t){case"image":{let o=[];for(let i of e)o.push(await Be(i,n.records,n.store,we(r?.crop)));return await xt(o,n.store),o.map(i=>i.value??Te())}case"video":return(await Promise.all(e.map(i=>ve(i,n.records,n.store)))).filter(i=>i!==null);case"tour":return(await Promise.all(e.map(i=>ke(i,n.records,n.store)))).filter(i=>i!==null);case"document":return(await Promise.all(e.map(i=>be(i,n.records,n.store)))).filter(i=>i!==null);case"media":return(await Promise.all(e.map(i=>Ye(i,r??{},n.records,n.store)))).filter(i=>i!==null);case"poi":return e.map(o=>n.resolvePoi(o));case"scalar":return e}}async function fd(e,t,n){if(!Object.values(t).some(Mr))return e;let r=[],o=await Zi(e,t,n,r);return await xt(r,n.store),o}async function Zi(e,t,n,r){let o=Object.entries(t).filter(([,s])=>Mr(s));if(o.length===0)return e;let i=[];for(let s of e){if(!s||typeof s!="object"||Array.isArray(s)){i.push(s);continue}let a={...s};for(let[l,d]of o)l in a&&(a[l]=await pd(a[l],d,n,r));i.push(a)}return i}function Mr(e){if(Tr(e.type)!=="scalar")return!0;let t=Me(e);return t===null?!1:t.kind==="record"?Object.values(t.fields).some(Mr):t.primitive!=="scalar"}async function pd(e,t,n,r){if(Me(t)!==null)return md(e,t,n,r);switch(Tr(t.type)){case"image":{let o=await Be(e,n.records,n.store,we(t.crop));return r.push(o),o.value}case"video":return ve(e,n.records,n.store);case"tour":return ke(e,n.records,n.store);case"document":return be(e,n.records,n.store);case"media":return Ye(e,t,n.records,n.store);case"poi":return n.resolvePoi(e);case"scalar":return e}}async function md(e,t,n,r){if(!Array.isArray(e))return[];let o=Me(t);if(o===null)return e;if(o.kind==="record")return Zi(e,o.fields,n,r);if(o.primitive!=="image")return Ji(e,o.primitive,n,t.element);let i=[];for(let s of e)i.push(await Be(s,n.records,n.store,we(t.element?.crop)));return r.push(...i),i.map(s=>s.value??Te())}function Cr(e){return new Map(Object.entries(e??{}))}async function Fr(e,t,n){if(t===void 0)return e;if(Me(t)!==null)return un(e,t,n);switch(t.type){case"image":return St(e,n.records,n.store,we(t.crop));case"video":return ve(e,n.records,n.store);case"tour":return ke(e,n.records,n.store);case"document":return be(e,n.records,n.store);case"media":return Ye(e,t,n.records,n.store);case"poi":return n.resolvePoi(e);case"object":return hd(e,t,n);default:return e}}async function hd(e,t,n){if(t.fields==null||!e||typeof e!="object"||Array.isArray(e))return e;let[r]=await un([e],{type:"list",element:{type:"object",fields:t.fields}},n);return r}var fn=e=>e<0?0:e>1?1:e;function Lr(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(l=>typeof l=="number"&&Number.isFinite(l)))return null;let i=fn(t),s=fn(n),a={nx:i,ny:s,nw:Math.min(fn(r),1-i),nh:Math.min(fn(o),1-s)};return a.nw<=0||a.nh<=0||a.nx===0&&a.ny===0&&a.nw===1&&a.nh===1?null:a}var yd=/^processed\/crops\/([^/]+)\/(-?[\d.e-]+)_(-?[\d.e-]+)_(-?[\d.e-]+)_(-?[\d.e-]+)$/;function Qi(e,t){return`processed/crops/${e}/${t.nx}_${t.ny}_${t.nw}_${t.nh}`}function gd(e){let t=yd.exec(e);if(t===null||kt(e)===null)return null;let n=Lr({nx:Number(t[2]),ny:Number(t[3]),nw:Number(t[4]),nh:Number(t[5])});return n===null?null:{id:t[1],rect:n}}function Dr(e){return e==null?null:typeof e=="string"?e:e.url}function es(e,t={}){let n=t.url??(s=>s),r=new Map;for(let s of e.values())for(let a of[s.file,s.posterFile]){let l=Dr(a);l!==null&&r.set(l,a)}let o=s=>r.has(s)?n(s):s,i=s=>{let a=s===null?void 0:r.get(s);return a===void 0||typeof a=="string"||a.responsive===null?null:{...a.responsive,sources:a.responsive.sources.map(l=>({...l,srcset:bd(l.srcset,n)}))}};return{servedUrl:s=>{let a=gd(s);if(a===null)return Promise.resolve(o(s));let l=Dr(e.get(a.id)?.file);return l===null?Promise.reject(new Error(`no image "${a.id}" to crop`)):Promise.resolve(t.crop===void 0?n(l):t.crop(l,a.rect))},fileUrl:s=>Promise.resolve(o(s)),ladder:()=>Promise.resolve({responsiveFor:s=>Promise.resolve(i(s))})}}function bd(e,t){return e.split(",").map(n=>{let[r="",...o]=n.trim().split(/\s+/);return[t(r),...o].join(" ")}).join(", ")}function ts(e,t,n){let r=Cr(e===null?null:Tn(e)),o=new Map;for(let i of t.values()){let s=Dr(i.file);s!==null&&i.sizeBytes!==void 0&&o.set(s,i.sizeBytes)}return new Map([...r].map(([i,s])=>{let a=s.bytes??(s.key===null?void 0:o.get(s.key)??n?.(s.key));return[i,a===void 0||a===s.bytes?s:{...s,bytes:a}]}))}async function ns(e){let t={store:e.store,records:e.records,resolvePoi:r=>r},n={};for(let[r,o]of Object.entries(e.slots)){let i=e.declared[r];n[r]=await Fr(o,i,t)}return n}function Nr(e){return typeof e=="string"?e:e.url}function ss(e,t){let{facts:n}=e,r=a=>e.media[a],o=a=>a?.file===null||a?.file===void 0?"":t(Nr(a.file)),i=a=>a?.posterFile!==void 0?t(Nr(a.posterFile)):a?.posterUrl??"",s=[];for(let a of _e(n,{kinds:["image"],from:["property.property_media","property.floor_plans"]})){let l=r(a.id);s.push({id:a.id,kind:"photo",name:l?.filename||a.id,size:"",src:o(l)})}for(let a of _e(n,{kinds:["video"],from:[nt]})){let l=a.provider??void 0;s.push({id:a.id,kind:"video",name:r(a.id)?.filename||a.name||a.id,size:"",src:i(r(a.id)),ready:!0,durationMs:a.duration_ms??null,...l===void 0?{}:{provider:l}})}for(let a of _e(n,{kinds:["tour"],from:[nt]}))s.push({id:a.id,kind:"tour",name:`${a.provider??"Tour"} ${a.id}`,size:"",src:i(r(a.id)),url:a.url??"",provider:a.provider??""});for(let a of _e(n,{kinds:["document"],from:[nt]})){let l=r(a.id)?.sizeBytes;s.push({id:a.id,kind:"document",name:a.name===""?a.id:a.name,size:"",src:"",mime:a.mime??"",...l===void 0?{}:{sizeBytes:l}})}return s}function as(e){let t={};for(let[n,r]of Object.entries(ce.pages)){let o=r.declaration;if(o.type!=="list"||J(o.element).length===0)continue;let i=`property.${n}`;t[i]=co(e.facts,i)??[]}return t}var wd=["headshot","logo_dark","logo_light"];function ls(e,t){return e.facts.contacts.map(n=>{let r={};for(let o of wd){let i=pe(n[o]),s=i===void 0?void 0:e.media[i]?.file;i!==void 0&&s!==null&&s!==void 0&&(r[i]=t(Nr(s)))}return{id:n.id,images:r}})}var Hr=e=>({x:e.nx,y:e.ny,width:e.nw,height:e.nh});function rs(e){if(typeof e!="object"||e===null)return null;let{x:t,y:n,width:r,height:o}=e;return Lr({nx:t,ny:n,nw:r,nh:o})}function os(e,t){return{key:Qi(e,t),mime:null,width:null,height:null,bytes:null,over:{crop:Hr(t),options:{}}}}var kd={image:["file","media","photo_id"],video:["file","media","video_id"],tour:["file","media","tour_id"],document:["file","media","asset_id"],media:["file","media"]};function Rt(e,t){if(t==null)return t;let n=kd[e.type];if(n!==void 0){if(typeof t!="object")return null;let i=t,s=n.map(f=>i[f]).find(f=>typeof f=="string"&&f!=="");if(typeof s!="string")return null;if(e.type!=="image")return{file:s};let a=rs(i.crop),l=typeof i.mobile=="object"&&i.mobile!==null?rs(i.mobile.crop):null,d="floor_label"in i?{floor_label:typeof i.floor_label=="string"?i.floor_label:null}:{};return{file:s,...a===null?{}:{crop:Hr(a),renditions:{crop:os(s,a)}},...l===null?{}:{mobile:{crop:Hr(l),renditions:{crop:os(s,l)}}},...d}}if(e.type==="object")return is(e.fields??{},t);if(e.type!=="list"||!Array.isArray(t))return t;let r=t,o=e.element;return o===void 0?r:o.type==="object"?r.map(i=>is(o.fields??{},i)):r.map(i=>Rt(o,i))}function is(e,t){if(typeof t!="object"||t===null)return t;let n={...t};for(let[r,o]of Object.entries(e))r in n&&(n[r]=Rt(o,n[r]));return n}async function ds(e){let{instance:t,slots:n,fixture:r,session:o,assetUrl:i}=e,s={...t.slots},a={},l=r.provenance[t.instance_id]??{};for(let p of Object.keys(n))a[p]=l[p]??{kind:"empty"};for(let[p,b]of Object.entries(o??{})){let h=n[p];h!==void 0&&(s[p]=Rt(h,b),a[p]={kind:"session"})}let d=new Map(Object.entries(r.media)),f=es(d,{url:p=>i(p),crop:(p,b)=>i(p,{crop:b})});return{slots:await ns({slots:s,declared:n,records:ts(r.facts,d),store:f}),provenance:a}}function cs(e,t){let n={},r=o=>o.source?.kind==="derived";for(let[o,i]of Object.entries(e)){if(i.type==="object"){for(let[s,a]of Object.entries(i.fields??{})){let l=Ue(o,s);r(a)&&(n[l]=xr(t,l))}continue}r(i)&&(n[o]=t[o])}return n}async function fs(e){let{template:t,fixture:n,session:r,display:o,computes:i}=e,s=new Map(t.instances.map(h=>[h.instanceId,h]));if(!Object.values(r).some(h=>Object.keys(h.slots??{}).length>0)&&Object.keys(o).length===0)return new Map(n.instances.map(h=>[h.instance_id,h]));if(n.settled===void 0||i===void 0)return new Map(n.instances.map(h=>{let x=s.get(h.instance_id)?.sectionSchema.slots??{},I=o[h.instance_id]?.enabled??h.enabled;return[h.instance_id,{...ho(h,x,o),enabled:I}]}));let l=new Map,d=new Map;for(let h of n.settled){let x=s.get(h.instance_id);if(x===void 0)continue;let I=d.get(x.section);I===void 0&&d.set(x.section,I=i(x.section)),l.set(h.instance_id,await I)}let f={id:"fixture",sections:n.settled.flatMap(h=>{let x=s.get(h.instance_id);return x===void 0?[]:[{section:x.section,instance_id:h.instance_id}]})},{contentDoc:p}=Ar({contentDoc:{instances:n.settled.map(h=>vd(h,s.get(h.instance_id),r,o))},facts:n.facts,sections:l,placement:Jo([f])}),b=new Map;for(let h of p.instances){let x=s.get(h.instance_id);x!==void 0&&b.set(h.instance_id,xd(h,x))}return b}function vd(e,t,n,r){let o={...e.slots},i={},s=t?.sectionSchema.slots??{};for(let[p,b]of Object.entries(n[e.instance_id]?.slots??{})){let h=s[p];if(h===void 0)continue;let x=Rt(h,b);if(h.type==="object"&&us(x)){let I=us(o[p])?o[p]:{};for(let P of Object.keys(h.fields??{}))JSON.stringify(x[P])!==JSON.stringify(I[P])&&(i[`${p}.${P}`]=!0)}else i[p]=!0;o[p]=x}let a=r[e.instance_id],l={...e.display_overrides,...a?.enabled===void 0?{}:{visibility:!0},...a?.variant===void 0?{}:{variant:!0}},d=a?.variant??e.variant,f={scalar:i};return{instance_id:e.instance_id,enabled:a?.enabled??e.enabled,...d===void 0?{}:{variant:d},slots:o,slot_overrides:f,...Object.keys(l).length===0?{}:{display_overrides:l}}}function xd(e,t){let n={};for(let[r,o]of Object.entries(t.sectionSchema.slots)){let i=o.variant?.cases;i!==void 0&&(e.variant===void 0||!i.includes(e.variant))||(n[r]=e.slots[r])}return{instance_id:e.instance_id,section_key:t.section,enabled:e.enabled,...e.variant===void 0?{}:{variant:e.variant},slots:n}}var us=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);var ps=1024*1024;function Rd(e){let t=ne(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:{...Qe(e)}}}function _d(e,t){return new Response(t,{status:e,headers:{"content-type":"text/plain; charset=utf-8"}})}function Ur(e){return new Response(JSON.stringify(e),{headers:{"content-type":"application/json; charset=utf-8"}})}function Kr(e){return new Response(e,{headers:{"content-type":"text/html; charset=utf-8"}})}function Od(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 $d(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new _(400,"A render request's session is an object keyed by instance id.");let t={};for(let[n,r]of Object.entries(e)){let o=typeof r=="object"&&r!==null?r.slots:void 0;if(o!==void 0){if(typeof o!="object"||o===null||Array.isArray(o))throw new _(400,`The session of "${n}" has slots that are not an object keyed by slot id.`);t[n]={slots:o}}}return t}function _t(e,t,n){let r=e.searchParams.get(t);if(r===null||r==="")throw new _(400,`${n} needs a ${t} parameter.`);return r}function Ed(e){return`<script>
151
151
  (function () {
152
152
  try {
153
153
  var src = new EventSource(${JSON.stringify(e)});
@@ -156,6 +156,6 @@ ${e.body}
156
156
  });
157
157
  } catch (e) { /* no change channel; the page stays as it is */ }
158
158
  })();
159
- </script>`}function Pa(e){if(e===fe.catalog||e==="api/media"||e.startsWith("api/capture/")||e===G.frame||e===G.print)return!0;let[t,n,r]=e.split("/").filter(Boolean);return t==="fixtures"&&n!==void 0&&r==="live"}function Yu(e){let{reader:t,assetUrl:n,renderer:r}=e,o=(e.base??"/").endsWith("/")?e.base??"/":`${e.base??"/"}/`,i=p=>/^([a-z][a-z0-9+.-]*:|\/)/i.test(p)?p:`${o}${p}`,s=()=>[Ne.base,Ne.template].map(p=>i(n(p)));async function a(p){let{fixtures:u}=await t.fixtures(),c=u.find(f=>f.id===p);if(c===void 0){let f=u.map(y=>y.id).join(", ")||"none";throw new w(404,`There is no fixture "${p}" (have: ${f}).`)}return c}function l(p,u){let c=p.instances.find(f=>f.instance_id===u);if(c===void 0)throw new w(400,`The composition places no instance "${u}".`);return c}function d(p,u,c,f,y){if(p.output!=="website")return{selfAnchor:f,anchors:Nn(),pages:[]};let h=ir(u,y),k=p.pages.map(C=>({id:C.id,label:C.label,path:C.path??`/${C.id}`,sections:C.sections.map(te=>({key:te.section,anchor:te.section,enabled:h.get(te.instanceId)!==!1}))})),x=`${o}${fe.live(u.id,"/").replace(/\/$/,"")}`,O=cr({pages:k,currentPageId:c,basePath:x});return{selfAnchor:f,anchors:O.anchors,pages:O.pages}}async function m(p,u,c,f,y,h){let k=p.instances.find(q=>q.instanceId===f.instance_id);if(k===void 0)throw new Error(`The composition places no section "${f.section_key}".`);let x=sr(f,k.sectionSchema.slots,h),{slots:O,provenance:C}=await $o({instance:x,slots:k.sectionSchema.slots,fixture:u,session:y,assetUrl:n}),te=d(p,u,c,x.section_key,h),I=x.variant,je=await r.section(x.section_key),Ye=r.renderToString(r.createElement(je,{slots:O,nav:te,variant:I??""}),{identifierPrefix:x.instance_id}),_t=Oo(k.sectionSchema.slots,f.slots);return{html:Ye,resolvedProps:{slots:O,nav:te,variant:I},provenance:C,facts:u.facts,computed:_t}}async function g(p,u,c){let f=[];for(let y of c.sections){let h=l(u,y.instanceId);h.enabled&&f.push((await m(p,u,c.id,h,void 0,{})).html)}return f}function v(p,u,c){let f=p.pages.find(y=>y.id===u);if(f===void 0)throw new w(c,`The template declares no page "${u}".`);return f}function A(p,u){if(p.output==="website")throw new w(404,`"${p.key}" is a website \u2014 captures are for rendered templates; open its pages live instead.`);let c=u===null?p.formats[0]:p.formats.find(f=>f.id===u);if(c===void 0)throw new w(404,`The template declares no format "${u??""}" (have: ${p.formats.map(f=>f.id).join(", ")}).`);return c}async function Te(){let p=await t.islands(),u={wire:1,islands:{map:{...p.map},hostScript:p.canvasHost,importMap:{...p.importMap}},stylesheets:[Ne.base,Ne.template].map(h=>n(h))},c,f;try{c=await t.template(),f=await t.fixtures()}catch(h){return{...u,template:{key:"",name:"",output:"website",formats:[],pages:[],canvases:[],instances:[]},fixtures:[],capabilities:{hmr:t.live,capture:!1},error:h instanceof Error?h.message:String(h)}}let y=f.problems!==void 0&&f.fixtures.length===0?`No fixture could be rendered:
160
- ${f.problems}`:void 0;return{...u,template:{key:c.key,name:c.name,output:c.output,formats:c.output==="website"?[]:c.formats.map(Aa),pages:c.pages.map(h=>({id:h.id,label:h.label,...h.path===void 0?{}:{path:h.path},instanceIds:h.sections.map(k=>k.instanceId)})),canvases:c.canvases.map(h=>({id:h.id,label:h.label,pages:[...h.pages]})),instances:c.instances.map(h=>({...h,display:tr(h.display)}))},fixtures:f.fixtures.map(ar),capabilities:{hmr:t.live,capture:c.output!=="website"&&t.capture!==void 0},...y===void 0?{}:{error:y}}}async function ee(p){if(p.method!=="POST")throw new w(405,`POST a render request to ${fe.render}.`);let u=await p.text();if(new TextEncoder().encode(u).byteLength>Ao)throw new w(413,`request body exceeds ${Ao} bytes`);let c;try{c=u===""?void 0:JSON.parse(u)}catch(O){throw new w(400,`request body is not JSON: ${O instanceof Error?O.message:String(O)}`)}if(c===void 0||typeof c.page!="string"||typeof c.instance!="string"||typeof c.fixture!="string")throw new w(400,"A render request names a page, an instance and a fixture.");let f=typeof c.session=="object"&&c.session!==null?c.session:{},y=rr(c.display),h=await t.template(),k=await a(c.fixture),x=v(h,c.page,400);return or(h,y),m(h,k,x.id,l(k,c.instance),f.slots,y)}async function be(p){let u=await a(Ge(p,"fixture","api/media"));return{items:So(u,n),contacts:Eo(u,n),lists:Ro(u)}}async function B(p,u){let c=await t.template();if(c.output!=="website")throw new w(404,`"${c.key}" is a rendered ${c.output} template and has no live pages \u2014 preview it on the canvas.`);let f=c.pages.find(k=>k.path===u);if(f===void 0){let k=c.pages.map(x=>x.path??x.id).join(", ");throw new w(404,`The template declares no page at "${u}" (have: ${k}).`)}let y=await a(p),h=await g(c,y,f);return we({destination:"preview",root:{kind:"plain",bodyHtml:h.join(`
161
- `)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:s()},title:`${c.name} - ${f.label}`,extraCss:["html, body { background: #fff; }"],...t.live?{devScripts:[ja(`${o}${fe.hmr}`)]}:{}})}function An(p,u,c){let f=v(p,c,404);if(!nt(u,f.id))throw new w(404,`The fixture "${u.id}" switches the page "${f.id}" off, so it has no capture.`);return f}async function Io(p){let u=G.frame,c=await t.template(),f=A(c,p.searchParams.get("format")),y=await a(Ge(p,"fixture",u)),h=An(c,y,Ge(p,"page",u));return we({destination:"artifact",root:{kind:"frame",format:f,sectionHtml:await g(c,y,h)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:s()},title:`${c.name} \u2014 ${h.id}`})}async function To(p){let u=await t.template(),c=A(u,p.searchParams.get("format"));if(u.output!=="document")throw new w(404,`"${u.key}" is an ${u.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);let f=await a(Ge(p,"fixture",G.print)),y=[];for(let h of Ut(f,u.pages))y.push(await g(u,f,h));if(y.length===0)throw new w(404,`The fixture "${f.id}" switches every page off, so it has no PDF.`);return we({destination:"artifact",root:{kind:"frameStack",format:c,pages:y},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:s()},title:`${u.name} \u2014 print`})}async function jo(p,u){let c=p;if(c!=="screenshot"&&c!=="bundle"&&c!=="print")throw new w(404,`There is no capture at ${u.pathname}.`);let f=Ge(u,"fixture",`api/capture/${c}`),y=await t.template(),h=A(y,u.searchParams.get("format")),k=await a(f),x,O,C;if(c==="screenshot"){let I=u.searchParams.get("page")??Ut(k,y.pages)[0]?.id;if(I===void 0)throw new w(404,`The fixture "${f}" leaves no page on.`);An(y,k,I),x={kind:c,fixture:f,format:h,documents:[{path:qt(f,I,h.id),page:I,name:`${I}.png`}]},O="image/png",C=`${y.key}-${I}-${h.id}.png`}else if(c==="bundle"){if(y.output!=="image")throw new w(404,`"${y.key}" is a ${y.output} template \u2014 the zip is for the image class; a document downloads its PDF.`);let I=u.searchParams.get("canvas"),je=I===null?y.canvases[0]:y.canvases.find(q=>q.id===I);if(je===void 0)throw new w(404,`The template declares no canvas "${I??""}".`);let Ye=je.pages.filter(q=>nt(k,q));if(Ye.length===0)throw new w(404,`The fixture "${f}" switches every page of the canvas "${je.id}" off, so it has no zip.`);let _t=Ye.map(q=>({path:qt(f,q,h.id),page:q,name:`${y.pages.find(Co=>Co.id===q)?.label||q}.png`}));x={kind:c,fixture:f,format:h,documents:_t},O="application/zip",C=`${y.key}-${h.id}.zip`}else{if(y.output!=="document")throw new w(404,`"${y.key}" is an ${y.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);x={kind:c,fixture:f,format:h,documents:[{path:ur(f,h.id),page:null,name:`${y.key}.pdf`}]},O="application/pdf",C=`${y.key}.pdf`}if(t.capture===void 0)throw new w(501,"This playground has no captures to give.");let te=await t.capture(x);return new Response(new Uint8Array(te),{headers:{"content-type":O,"content-disposition":`attachment; filename="${encodeURIComponent(C)}"`}})}async function Po(p,u,c){if(c===fe.render)return $n(await ee(p));if(p.method!=="GET"&&p.method!=="HEAD"&&Pa(c))throw new w(405,`${c} only reads; the playground accepts no uploads and writes nothing.`);if(c===fe.catalog)return $n(await Te());if(c==="api/media")return $n(await be(u));if(c.startsWith("api/capture/"))return jo(c.slice(12),u);if(c===G.frame)return On(await Io(u));if(c===G.print)return On(await To(u));let[f,y,h,k,...x]=c.split("/").filter(Boolean);if(f==="fixtures"&&y!==void 0&&h==="live"){if(x.length>0)throw new w(404,`There is no route at ${u.pathname}.`);return On(await B(decodeURIComponent(y),k===void 0?"/":`/${decodeURIComponent(k)}`))}return null}return{async handle(p){let u=new URL(p.url);if(!u.pathname.startsWith(o)&&`${u.pathname}/`!==o)return null;let c=u.pathname.slice(o.length);try{return await Po(p,u,c)}catch(f){let y=Ta(f);if(y===null)throw f;return Ia(y,f instanceof Error?f.message:String(f))}}}}export{Yu as createHost};
159
+ </script>`}function Id(e){if(e===Se.catalog||e==="api/media"||e.startsWith("api/capture/")||e===re.frame||e===re.print)return!0;let[t,n,r]=e.split("/").filter(Boolean);return t==="fixtures"&&n!==void 0&&r==="live"}function Ch(e){let{reader:t,assetUrl:n,renderer:r}=e,o=(e.base??"/").endsWith("/")?e.base??"/":`${e.base??"/"}/`,i=w=>/^([a-z][a-z0-9+.-]*:|\/)/i.test(w)?w:`${o}${w}`,s=()=>[rt.base,rt.template].map(w=>i(n(w)));async function a(w){let{fixtures:y}=await t.fixtures(),m=y.find(g=>g.id===w);if(m===void 0){let g=y.map(c=>c.id).join(", ")||"none";throw new _(404,`There is no fixture "${w}" (have: ${g}).`)}return m}function l(w,y){let m=w.instances.find(g=>g.instance_id===y);if(m===void 0)throw new _(400,`The composition places no instance "${y}".`);return m}function d(w,y,m,g,c){if(w.output!=="website")return{selfAnchor:g,anchors:Jr(),pages:[]};let u=new Map([...c].map(([S,$])=>[S,$.enabled])),k=w.pages.map(S=>({id:S.id,label:S.label,path:S.path??`/${S.id}`,sections:S.sections.map($=>({key:$.section,anchor:$.section,enabled:u.get($.instanceId)!==!1}))})),v=`${o}${Se.live(y.id,"/").replace(/\/$/,"")}`,O=bo({pages:k,currentPageId:m,basePath:v});return{selfAnchor:g,anchors:O.anchors,pages:O.pages}}async function f(w,y,m,g,c,u){let k=w.instances.find(yn=>yn.instanceId===g.instance_id);if(k===void 0)throw new Error(`The composition places no section "${g.section_key}".`);let v=c.get(g.instance_id)??g,{slots:O,provenance:S}=await ds({instance:v,slots:k.sectionSchema.slots,fixture:y,session:u,assetUrl:n}),$=d(w,y,m,v.section_key,c),j=v.variant,V=await r.section(v.section_key),K=r.renderToString(r.createElement(V,{slots:O,nav:$,variant:j??""}),{identifierPrefix:v.instance_id}),hn=cs(k.sectionSchema.slots,g.slots),X={enabled:v.enabled,...j===void 0?{}:{variant:j}};return{html:K,resolvedProps:{slots:O,nav:$,variant:j},provenance:S,display:X,facts:y.facts,computed:hn}}async function p(w,y,m){let g=new Map(y.instances.map(u=>[u.instance_id,u])),c=[];for(let u of m.sections){let k=l(y,u.instanceId);k.enabled&&c.push((await f(w,y,m.id,k,g,void 0)).html)}return c}function b(w,y,m){let g=w.pages.find(c=>c.id===y);if(g===void 0)throw new _(m,`The template declares no page "${y}".`);return g}function h(w,y){if(w.output==="website")throw new _(404,`"${w.key}" is a website \u2014 captures are for rendered templates; open its pages live instead.`);let m=y===null?w.formats[0]:w.formats.find(g=>g.id===y);if(m===void 0)throw new _(404,`The template declares no format "${y??""}" (have: ${w.formats.map(g=>g.id).join(", ")}).`);return m}async function x(){let w=await t.islands(),y={wire:2,islands:{map:{...w.map},hostScript:w.canvasHost,importMap:{...w.importMap}},stylesheets:[rt.base,rt.template].map(u=>n(u))},m,g;try{m=await t.template(),g=await t.fixtures()}catch(u){return{...y,template:{key:"",name:"",output:"website",formats:[],pages:[],canvases:[],instances:[]},fixtures:[],capabilities:{hmr:t.live,capture:!1},error:u instanceof Error?u.message:String(u)}}let c=g.problems!==void 0&&g.fixtures.length===0?`No fixture could be rendered:
160
+ ${g.problems}`:void 0;return{...y,template:{key:m.key,name:m.name,output:m.output,formats:m.output==="website"?[]:m.formats.map(Rd),pages:m.pages.map(u=>({id:u.id,label:u.label,...u.path===void 0?{}:{path:u.path},instanceIds:u.sections.map(k=>k.instanceId)})),canvases:m.canvases.map(u=>({id:u.id,label:u.label,pages:[...u.pages]})),instances:m.instances.map(u=>({...u,display:uo(u.display)}))},fixtures:g.fixtures.map(yo),capabilities:{hmr:t.live,capture:m.output!=="website"&&t.capture!==void 0},...c===void 0?{}:{error:c}}}async function I(w){if(w.method!=="POST")throw new _(405,`POST a render request to ${Se.render}.`);let y=await w.text();if(new TextEncoder().encode(y).byteLength>ps)throw new _(413,`request body exceeds ${ps} bytes`);let m;try{m=y===""?void 0:JSON.parse(y)}catch($){throw new _(400,`request body is not JSON: ${$ instanceof Error?$.message:String($)}`)}if(m===void 0||typeof m.page!="string"||typeof m.instance!="string"||typeof m.fixture!="string")throw new _(400,"A render request names a page, an instance and a fixture.");let g=$d(m.session),c=po(m.display),u=await t.template(),k=await a(m.fixture),v=b(u,m.page,400);mo(u,c);let O=l(k,m.instance),S=await fs({template:u,fixture:k,session:g,display:c,computes:t.computes?.bind(t)});return f(u,k,v.id,O,S,g[O.instance_id]?.slots)}async function P(w){let y=await a(_t(w,"fixture","api/media"));return{items:ss(y,n),contacts:ls(y,n),lists:as(y)}}async function xe(w,y){let m=await t.template();if(m.output!=="website")throw new _(404,`"${m.key}" is a rendered ${m.output} template and has no live pages \u2014 preview it on the canvas.`);let g=m.pages.find(k=>k.path===y);if(g===void 0){let k=m.pages.map(v=>v.path??v.id).join(", ");throw new _(404,`The template declares no page at "${y}" (have: ${k}).`)}let c=await a(w),u=await p(m,c,g);return Fe({destination:"preview",root:{kind:"plain",bodyHtml:u.join(`
161
+ `)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:s()},title:`${m.name} - ${g.label}`,extraCss:["html, body { background: #fff; }"],...t.live?{devScripts:[Ed(`${o}${Se.hmr}`)]}:{}})}function Xe(w,y,m){let g=b(w,m,404);if(!Tt(y,g.id))throw new _(404,`The fixture "${y.id}" switches the page "${g.id}" off, so it has no capture.`);return g}async function Ot(w){let y=re.frame,m=await t.template(),g=h(m,w.searchParams.get("format")),c=await a(_t(w,"fixture",y)),u=Xe(m,c,_t(w,"page",y));return Fe({destination:"artifact",root:{kind:"frame",format:g,sectionHtml:await p(m,c,u)},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:s()},title:`${m.name} \u2014 ${u.id}`})}async function pn(w){let y=await t.template(),m=h(y,w.searchParams.get("format"));if(y.output!=="document")throw new _(404,`"${y.key}" is an ${y.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);let g=await a(_t(w,"fixture",re.print)),c=[];for(let u of Dn(g,y.pages))c.push(await p(y,g,u));if(c.length===0)throw new _(404,`The fixture "${g.id}" switches every page off, so it has no PDF.`);return Fe({destination:"artifact",root:{kind:"frameStack",format:m,pages:c},islands:(await t.islands()).documentLoader,stylesheets:{kind:"links",hrefs:s()},title:`${y.name} \u2014 print`})}async function mn(w,y){let m=w;if(m!=="screenshot"&&m!=="bundle"&&m!=="print")throw new _(404,`There is no capture at ${y.pathname}.`);let g=_t(y,"fixture",`api/capture/${m}`),c=await t.template(),u=h(c,y.searchParams.get("format")),k=await a(g),v,O,S;if(m==="screenshot"){let j=y.searchParams.get("page")??Dn(k,c.pages)[0]?.id;if(j===void 0)throw new _(404,`The fixture "${g}" leaves no page on.`);Xe(c,k,j),v={kind:m,fixture:g,format:u,documents:[{path:Ln(g,j,u.id),page:j,name:`${j}.png`}]},O="image/png",S=`${c.key}-${j}-${u.id}.png`}else if(m==="bundle"){if(c.output!=="image")throw new _(404,`"${c.key}" is a ${c.output} template \u2014 the zip is for the image class; a document downloads its PDF.`);let j=y.searchParams.get("canvas"),V=j===null?c.canvases[0]:c.canvases.find(X=>X.id===j);if(V===void 0)throw new _(404,`The template declares no canvas "${j??""}".`);let K=V.pages.filter(X=>Tt(k,X));if(K.length===0)throw new _(404,`The fixture "${g}" switches every page of the canvas "${V.id}" off, so it has no zip.`);let hn=K.map(X=>({path:Ln(g,X,u.id),page:X,name:`${c.pages.find(yn=>yn.id===X)?.label||X}.png`}));v={kind:m,fixture:g,format:u,documents:hn},O="application/zip",S=`${c.key}-${u.id}.zip`}else{if(c.output!=="document")throw new _(404,`"${c.key}" is an ${c.output} template \u2014 a PDF is for the document class; download its pages as a zip.`);v={kind:m,fixture:g,format:u,documents:[{path:ko(g,u.id),page:null,name:`${c.key}.pdf`}]},O="application/pdf",S=`${c.key}.pdf`}if(t.capture===void 0)throw new _(501,"This playground has no captures to give.");let $=await t.capture(v);return new Response(new Uint8Array($),{headers:{"content-type":O,"content-disposition":`attachment; filename="${encodeURIComponent(S)}"`}})}async function Ce(w,y,m){if(m===Se.render)return Ur(await I(w));if(w.method!=="GET"&&w.method!=="HEAD"&&Id(m))throw new _(405,`${m} only reads; the playground accepts no uploads and writes nothing.`);if(m===Se.catalog)return Ur(await x());if(m==="api/media")return Ur(await P(y));if(m.startsWith("api/capture/"))return mn(m.slice(12),y);if(m===re.frame)return Kr(await Ot(y));if(m===re.print)return Kr(await pn(y));let[g,c,u,k,...v]=m.split("/").filter(Boolean);if(g==="fixtures"&&c!==void 0&&u==="live"){if(v.length>0)throw new _(404,`There is no route at ${y.pathname}.`);return Kr(await xe(decodeURIComponent(c),k===void 0?"/":`/${decodeURIComponent(k)}`))}return null}return{async handle(w){let y=new URL(w.url);if(!y.pathname.startsWith(o)&&`${y.pathname}/`!==o)return null;let m=y.pathname.slice(o.length);try{return await Ce(w,y,m)}catch(g){let c=Od(g);if(c===null)throw g;return _d(c,g instanceof Error?g.message:String(g))}}}}export{Ch as createHost};