PageSourceSearch

https://www.thearchitecturalauthority.com/_next/static/chunks/app/start-your-project/page-bc0908046b7f395c.js

js thearchitecturalauthority.com collected 2026-10-08 05:31:58 UTC 336,416 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7129],{35609:function(e,t,r){Promise.resolve().then(r.bind(r,92885))},65697:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(57437),o=r(38392),a=r(2265),i=r(23181),l=r(28992),s=r.n(l);function c(e){let t=(0,a.useRef)(null),r=(0,a.useRef)(null),[l,c]=(0,a.useState)(!1),[d,u]=(0,a.useState)(!1),[p,h]=(0,o.O)(""),[m,g]=(0,a.useState)(0);(0,a.useEffect)(()=>{let n,o=!1;return r.current=null,c(!1),h(""),(async()=>{try{let a=await (0,i.loadStripe)(e.publishableKey);if(!a||o)throw Error();let l="project"===e.tone,s=a.initCheckoutElementsSdk({clientSecret:e.clientSecret,elementsOptions:{appearance:{theme:"flat",variables:{colorPrimary:l?"#efede6":"#242421",colorText:l?"#f1efe8":"#242421",colorBackground:l?"#202323":"#ffffff",colorDanger:l?"#efaaa0":"#965d57",fontFamily:"Arial, sans-serif",fontSizeBase:"12px",borderRadius:"2px",spacingUnit:"3px"},rules:{".Input":{border:l?"1px solid rgba(255,255,255,.16)":"1px solid #d9d9d6",boxShadow:"none",padding:"10px"},".Input:focus":{border:l?"1px solid #c9b589":"1px solid #73734e",boxShadow:"none"},".Label":{fontSize:"10px",fontWeight:"400",textTransform:"uppercase",marginBottom:"8px"}}}}}),d=await s.loadActions();if(o||"success"!==d.type)throw Error();r.current=d.actions,(n=s.createPaymentElement({layout:"tabs",wallets:{link:"never"}})).on("ready",()=>{o||c(!0)}),n.on("loaderror",()=>{o||h("The payment fields could not load. Please retry.")}),t.current&&n.mount(t.current)}catch(e){o||h("The payment fields could not load. Please retry.")}})(),()=>{o=!0,r.current=null,null==n||n.destroy()}},[m,e.clientSecret,e.publishableKey,e.tone,h]);let f=async t=>{if(t.preventDefault(),r.current&&l&&!d){u(!0),h("");try{let t=await r.current.confirm({redirect:"if_required"});"error"===t.type?h(t.error.message||"Payment could not be completed. Check your details and try again."):e.onComplete()}catch(e){h("Payment confirmation could not be completed. Please retry.")}finally{u(!1)}}};return(0,n.jsxs)("form",{className:s().creditPaymentForm,"data-tone":e.tone||"default",onSubmit:f,children:[(0,n.jsxs)("div",{className:s().creditPaymentSummary,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:e.packageName}),(0,n.jsxs)("strong",{children:[e.credits.toLocaleString()," AI credits"]})]}),(0,n.jsx)("b",{children:e.price})]}),l||p?null:(0,n.jsx)("p",{role:"status",children:"Loading secure payment fields…"}),(0,n.jsx)("div",{ref:t,"aria-label":"Secure payment details"}),(0,n.jsxs)("div",{className:s().creditPaymentActions,children:[(0,n.jsx)("button",{type:"button",onClick:e.onCancel,disabled:d,children:"Cancel"}),p&&!l?(0,n.jsx)("button",{type:"button",onClick:()=>g(e=>e+1),children:"Retry payment fields"}):(0,n.jsx)("button",{type:"submit",disabled:!l||d,children:d?"Confirming…":"Pay ".concat(e.price)})]}),"sandbox"===e.mode?(0,n.jsx)("small",{children:"Sandbox checkout \xb7 No real charge"}):null]})}},33085:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(57437),o=r(52932),a=r.n(o);function i(e){let{id:t,message:r}=e;return r?(0,n.jsx)("span",{id:t,className:a().description,children:r}):null}},94620:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(57437);function o(){return(0,n.jsx)("svg",{"aria-hidden":"true",focusable:"false",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"inline-block",verticalAlign:"-0.1em",flexShrink:0}
1,children:(0,n.jsx)("path",{d:"M6 18 18 6M6 6h12v12"})})}},31741:function(e,t,r){"use strict";r.d(t,{Gb:function(){return n},LG:function(){return a},wU:function(){return o}});let n={"& .MuiAutocomplete-noOptions, & .MuiAutocomplete-loading":{padding:"8px 12px",fontFamily:"'unica reg', 'unica', sans-serif",fontSize:"12px",fontWeight:400,lineHeight:1.4,color:"#6b6b65"}},o={popper:{sx:{zIndex:1000004}},paper:{sx:{...n,border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 6px 18px rgba(0,0,0,.14)"}}},a={sx:{maxHeight:"min(224px, 35vh)",overscrollBehavior:"contain",padding:"4px",fontFamily:"'unica reg', 'unica', sans-serif",fontSize:"12px","& .MuiAutocomplete-option":{minHeight:"36px",padding:"8px",borderRadius:"3px"},"& .MuiAutocomplete-option.Mui-focused":{backgroundColor:"#ececea"},'& .MuiAutocomplete-option[aria-selected="true"], & .MuiAutocomplete-option[aria-selected="true"].Mui-focused':{backgroundColor:"#ececea"}}}},5382:function(e,t,r){"use strict";r.d(t,{rx:function(){return l},iq:function(){return f},uS:function(){return c},Qi:function(){return g},yA:function(){return v}});var n=r(57437),o=r(2265);let a="taa_global_location_filter",i={id:"0",name:""},l="0|0|0";function s(e){return(null==e?void 0:e.id)&&"0"!==e.id?e:i}function c(e,t){let r=(null==e?void 0:e.id)&&"0"!==e.id?e.id:"0",n=(null==t?void 0:t.id)&&"0"!==t.id?t.id:"0",o=(null==t?void 0:t.stateCode)||"0";return"".concat(r,"|").concat(o,"|").concat(n)}function d(e){if(!e)return{country:i,city:i};try{let t;try{t=JSON.parse(decodeURIComponent(e))}catch(r){t=JSON.parse(e)}return{country:s(t.country),city:s(t.city)}}catch(e){return{country:i,city:i}}}let u="taa.globalLocationFilter.v1",p=(0,o.createContext)({initialized:!1,location:{country:i,city:i},setGlobalLocation:()=>void 0,clearGlobalLocation:()=>void 0});function h(e,t){if("undefined"==typeof document)return;let r=s(e),n=s(t);if(c(r,n)===l){document.cookie="".concat(a,"=; path=/; max-age=0; samesite=lax");return}document.cookie="".concat(a,"=").concat(encodeURIComponent(JSON.stringify({version:1,country:s(r),city:s(n)})),"; path=/; max-age=31536000; samesite=lax")}function m(e,t){let r=s(e),n=s(t);if(c(r,n)===l){window.localStorage.removeItem(u),h(r,n);return}window.localStorage.setItem(u,JSON.stringify({version:1,country:r,city:n})),h(r,n)}function g(e,t){return c(e,t)!==l}function f(e){let{children:t}=e,[r,l]=(0,o.useState)(!1),[c,g]=(0,o.useState)({country:i,city:i});(0,o.useEffect)(()=>{let e=window.localStorage.getItem(u),t=e?d(e):d(function(){if("undefined"==typeof document)return null;let e=document.cookie.split("; ").find(e=>e.startsWith("".concat(a,"=")));return e?e.slice(a.length+1):null}());g(t),h(t.country,t.city),l(!0);let r=e=>{e.key===u&&g(d(e.newValue))};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)},[]);let f=(0,o.useCallback)((e,t)=>{let r=s(e),n=s(t);m(r,n),g({country:r,city:n})},[]),v=(0,o.useCallback)(()=>{m(i,i),g({country:i,city:i})},[]),y=(0,o.useMemo)(()=>({initialized:r,location:c,setGlobalLocation:f,clearGlobalLocation:v}),[v,r,c,f]);return(0,n.jsx)(p.Provider,{value:y,children:t})}function v(){return(0,o.useContext)(p)}},32774:function(e,t,r){"use strict";r.d(t,{K:function(){return n}});let n="taa:open-location-explorer"},14979:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(57437),o=r(93421),a=r(50529),i=r(14433),l=r.n(i);function s(e){let{credits:t,rates:r}=e;return(0,n.jsx)("section",{className:l().usage,"aria-label":"Images per package",children:["text","reference"].map(e=>(0,n.jsxs)("table",{children:[(0,n.jsx)("caption",{children:"text"===e?"Text to Image":"Image to Image"}),(0,n.jsx)("tbody",{children:o.t.map(o=>{let{value:i,label:s}=o;return(0,n.jsxs)("tr",{children:[(0,n.jsxs)("th",{scope:"row",children:[s,(0,n.jsxs)("span",{className:l().resolution,children:[" \xb7 Up to ","rendering"===i?"4K":"2K"]}),(0,n.jsxs)("small",{children:[r[i][e]," credits / image"]})]}),(0,n.jsxs)("td",{children:[(0,a.r)(t,r[i][e]).toLocaleString(),(0,n.jsx)("small",{children:"images"})]})]},i)})})]},e))})}},92885:function(e,t,r){"use strict";r.d(t,{default:function(){return ry}});var n=r(57437),o=r(33085),a=r(38392),i=r(31194),l=r(91009);let s="project-planner:capture-auth-handoff";var c=r(2265),d=r(54887),u=r(6920),p=r(45079),h=r(98759),m=r(26770),g=r(86797),f=r(73101),v=r(13244),y=r.n(v),j=r(26453),b=r(67295);function x(e){let{projectId:t,spaces:r,roomId:o,onRoomChange:i,totalPhotoCount:l,photos:s,onAdd:d,onRemove:h,onBack:m,onContinue:g,signedIn:v,authReady:x,onSignIn:w,saving:k=!1,saveError:_=""}=e,[I,C]=(0,c.useState)(!1),[S,N]=(0,a.O)(""),[P,R]=(0,c.useState)(!1),[E,T]=(0,c.useState)(!1),M=(0,c.useRef)(o),A=()=>{var e;
1if(x){if(!v){w();return}M.current=o,null===(e=L.current)||void 0===e||e.click()}},L=(0,c.useRef)(null);(0,c.useEffect)(()=>{C(/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)},[]);let D=e=>{let t=e.files;(null==t?void 0:t.length)&&v&&(N(Array.from(t).some(e=>!e.type.startsWith("image/"))?"Please choose image files. Other files were not added.":""),d(t,M.current)),e.value=""};return(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().minimalSlide," ").concat(y().captureEntry),children:[(0,n.jsxs)("div",{className:y().introBlock,children:[(0,n.jsx)("h1",{children:"Start with your space."}),(0,n.jsx)("p",{children:"Add one or more photos of the space you want to transform."})]}),r&&r.length>1?(0,n.jsxs)("label",{className:y().captureSpacePicker,children:[(0,n.jsx)("span",{children:"Space"}),(0,n.jsx)("select",{"aria-label":"Capture space",value:o,disabled:k||P,onChange:e=>null==i?void 0:i(e.target.value),children:r.map(e=>(0,n.jsx)("option",{value:e.id,children:e.label},e.id))})]}):null,(0,n.jsx)("input",{ref:L,type:"file",accept:"image/*",multiple:!0,hidden:!0,disabled:k||!v,onChange:e=>D(e.currentTarget)}),(0,n.jsxs)("div",{className:y().captureLayout,children:[(0,n.jsxs)("div",{className:y().captureControls,children:[(0,n.jsxs)("div",{className:y().captureSources,children:[I?(0,n.jsxs)("button",{type:"button",disabled:k||!x,className:y().captureCameraButton,onClick:()=>{if(x){if(!v){w();return}M.current=o,R(!0)}},children:[(0,n.jsx)(u.G,{icon:p._jT,"aria-hidden":"true"}),(0,n.jsx)("strong",{children:"Take photo"})]}):null,(0,n.jsxs)("button",{type:"button",disabled:k||!x,onClick:A,children:[(0,n.jsx)(u.G,{icon:p.l9f,"aria-hidden":"true"}),(0,n.jsx)("strong",{children:"Photo library"})]})]}),s.length?(0,n.jsxs)("button",{type:"button",disabled:k,className:y().captureReviewButton,onClick:()=>T(!0),children:["Review photos ",(0,n.jsxs)("span",{children:["(",s.length,")"]})]}):null]}),(0,n.jsxs)("div",{className:y().captureGallery,"data-empty":!s.length,children:[s.length?null:(0,n.jsx)("div",{className:y().captureGalleryActions,children:(0,n.jsx)("button",{type:"button",disabled:k||!x,onClick:A,children:"Add photos"})}),s.length?(0,n.jsxs)("div",{className:y().capturePhotos,"aria-label":"Selected photos",children:[s.map(e=>(0,n.jsxs)("figure",{children:[(0,n.jsx)(f.Z,{src:e.url,projectId:t,captureId:e.captureId,alt:e.name}),(0,n.jsx)("button",{type:"button",disabled:k,"aria-label":"Remove ".concat(e.name),onClick:()=>h(e.id),children:(0,n.jsx)(u.G,{icon:p.$aW,"aria-hidden":"true"})})]},e.id)),(0,n.jsx)("button",{type:"button",disabled:k,className:y().captureAddPhoto,"aria-label":"Add more photos",onClick:A,children:(0,n.jsx)("span",{"aria-hidden":"true",children:"+"})})]}):(0,n.jsx)("div",{className:y().captureEmptyGallery,children:"Your selected photos will appear here."})]})]}),_?(0,n.jsx)("p",{role:"alert",children:_}):null,(0,n.jsxs)("div",{className:y().actions,children:[(0,n.jsx)("button",{type:"button",className:y().backButton,disabled:k,onClick:m,children:"Back"}),(0,n.jsx)("button",{type:"button",className:y().primaryButton,disabled:!(null!=l?l:s.length)||k,onClick:g,children:k&&s.some(e=>!e.captureId)?"Saving photos…":(0,n.jsxs)(n.Fragment,{children:["Continue ",(0,n.jsx)("span",{children:"→"})]})})]}),P&&v?(0,n.jsx)(j.Z,{projectId:t,photos:s,onAdd:e=>d(e,M.current),onRemove:h,onClose:()=>R(!1)}):null,E?(0,n.jsx)(b.Z,{projectId:t,photos:s,onRemove:h,onClose:()=>T(!1)}):null]})}var w=r(64715),k=r(57490),_=r(79699),I=r(99399),C=r(4739);let S=e=>"string"==typeof e?e.trim():"";function N(e){return Array.from(new Set([e.cityName,e.stateName,e.countryName].filter(Boolean))).join(", ")}async function P(e,t){let r=await fetch((0,i.D)(e),{signal:t,cache:"no-store"}),n=await r.json();if(!r.ok)throw Error(n.error||"Could not load this collection. Please try again.");return n}async function R(e,t){var r,n;let o=await P("ProjectBrowse/articles/".concat(e,"/photos"),t),a=(0,I.F5)(null===(r=o.photos)||void 0===r?void 0:r[0]);if(!a)throw Error("This project is no longer available.");return{article:a,photos:(0,I.cA)(o.photos,a),companies:Array.isArray(n=o.companies)?Array.from(new Map(n.flatMap(e=>{if(!e||!0!==e.active||!Number.isSafeInteger(e.profileId)||e.profileId<=0||!S(e.name))return[];let t=Array.isArray(e.categories)?e.categories.filter(e=>!!(e&&Number.isSafeInteger(e.id)&&Number(e.id)>0&&(0,C.Mw)(Number(e.id))&&S(e.name))).map(e=>({id:e.id,name:S(e.name)})):[];return t.length?[{profileId:e.profileId,name:S(e.name),slug:S(e.slug),thumbnail:(0,I.YZ)(e.thumbnail),active:!0===e.active,showThumbnail:!0===e.showThumbnail,categories:t,cityName:S(e.cityName),stateName:S(e.stateName),countryName:S(e.countryName)}]:[]}).map(e=>[e.profileId,e])).values()):[]}}async function E(e){let t=await P("Articles/getArticleSeries",e);if(!Array.isArray(t))throw Error("Series could not be loaded. Please try again.");return{series:Array.from(new Map(t.filter(e=>!1!==e.active&&/^[1-9]\d{0,8}$/.test(String(e.articleSerieID))&&"string"==typeof e.serieName&&e.serieName.trim()).map(e=>[String(e.articleSerieID),{value:String(e.articleSerieID),name:e.serieName.trim()}])).values())}}async function T(e,t,r){let n=await P("ProjectBrowse/professionals?".concat(new 
1URLSearchParams({page:String(e),pageSize:"12",discipline:t})),r);return{...n,items:n.items.map(C.xC).filter(Boolean)}}async function M(e,t,r,n){if(null==n?void 0:n.fromArticleCredit)return!1===n.active?{professional:n,items:[],nextPage:null}:{...await P("ProjectSearch/professionals/".concat(e,"/articles?page=").concat(t,"&pageSize=12"),r),professional:n};let o=await P("ProjectBrowse/professionals/".concat(e,"/projects?page=").concat(t,"&pageSize=12"),r),a=(0,C.xC)(o.professional);if(!a||a.profileId!==e)throw Error("This professional is no longer available.");return{...o,professional:a}}let A=e=>({x:e.reduce((e,t)=>e+t.x,0)/4,y:e.reduce((e,t)=>e+t.y,0)/4});function L(e){return 4===e.length&&e.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y)&&8>Math.abs(e.x)&&8>Math.abs(e.y))&&e.every((t,r)=>{let n=e[(r+1)%4],o=e[(r+2)%4];return(n.x-t.x)*(o.y-n.y)-(n.y-t.y)*(o.x-n.x)>1e-6})}function D(e,t,r){let n=.25*r/Math.max(.1,t);return[{x:e.x-.125,y:e.y-n/2},{x:e.x+.125,y:e.y-n/2},{x:e.x+.125,y:e.y+n/2},{x:e.x-.125,y:e.y+n/2}]}function B(e,t,r){if(e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(t)&&!(t<=0)&&Number.isFinite(r)&&!(r<=0))return D(e,t,r)}function U(e,t){return e.map(e=>({x:e.x+t.x,y:e.y+t.y}))}function W(e){let t=[[0,0],[1,0],[1,1],[0,1]].flatMap((t,r)=>{let[n,o]=t;return[[n,o,1,0,0,0,-e[r].x*n,-e[r].x*o,e[r].x],[0,0,0,n,o,1,-e[r].y*n,-e[r].y*o,e[r].y]]});for(let e=0;e<8;e++){let r=e;for(let n=e+1;n<8;n++)Math.abs(t[n][e])>Math.abs(t[r][e])&&(r=n);[t[e],t[r]]=[t[r],t[e]];let n=t[e][e];if(1e-12>Math.abs(n))throw Error("Adjust the placement corners so the object has a visible area.");for(let r=e;r<9;r++)t[e][r]/=n;for(let r=0;r<8;r++)if(r!==e){let n=t[r][e];for(let o=e;o<9;o++)t[r][o]-=n*t[e][o]}}return[...t.map(e=>e[8]),1]}async function O(e,t,r,n){if(!L(t))throw Error("Adjust the placement corners before generating.");let o=document.createElement("canvas");o.width=r,o.height=n;let a=o.getContext("2d"),i=e.getContext("2d").getImageData(0,0,e.width,e.height),l=a.createImageData(r,n),s=function(e){let[t,r,n,o,a,i,l,s,c]=e,d=[a*c-i*s,n*s-r*c,r*i-n*a,i*l-o*c,t*c-n*l,n*o-t*i,o*s-a*l,r*l-t*s,t*a-r*o],u=t*d[0]+r*d[3]+n*d[6];return d.map(e=>e/u)}(W(t)),c=Math.max(0,Math.floor(Math.min(...t.map(e=>e.x))*r)),d=Math.min(r,Math.ceil(Math.max(...t.map(e=>e.x))*r)),u=Math.max(0,Math.floor(Math.min(...t.map(e=>e.y))*n)),p=Math.min(n,Math.ceil(Math.max(...t.map(e=>e.y))*n));for(let t=u;t<p;t++){(t-u)%64==0&&await new Promise(e=>setTimeout(e,0));for(let o=c;o<d;o++){let a=function(e,t){let r=e[6]*t.x+e[7]*t.y+e[8];return{x:(e[0]*t.x+e[1]*t.y+e[2])/r,y:(e[3]*t.x+e[4]*t.y+e[5])/r}}(s,{x:(o+.5)/r,y:(t+.5)/n});if(a.x<0||a.x>1||a.y<0||a.y>1)continue;let c=Math.max(0,Math.min(e.width-1,a.x*e.width-.5)),d=Math.max(0,Math.min(e.height-1,a.y*e.height-.5)),u=Math.floor(c),p=Math.floor(d),h=c-u,m=d-p,g=[[u,p,(1-h)*(1-m)],[Math.min(u+1,e.width-1),p,h*(1-m)],[u,Math.min(p+1,e.height-1),(1-h)*m],[Math.min(u+1,e.width-1),Math.min(p+1,e.height-1),h*m]],f=0,v=[0,0,0];for(let[t,r,n]of g){let o=(r*e.width+t)*4,a=i.data[o+3]/255*n;f+=a;for(let e=0;e<3;e++)v[e]+=i.data[o+e]*a}let y=(t*r+o)*4;for(let e=0;e<3;e++)l.data[y+e]=f?v[e]/f:0;l.data[y+3]=255*f}}return a.putImageData(l,0,0),o}var G=r(88310),F=r(88191);function q(e){if(!e)return[];if(e.strokes)return e.strokes;let[t,r]=e.points;return[{id:e.id,width:.001,shape:"polygon",points:"rectangle"===e.kind?[t,{x:r.x,y:t.y},r,{x:t.x,y:r.y}]:e.points}]}function Y(e){let t=K(e),r=document.createElement("canvas");(0,F.tG)(r,q(e),Math.round(1024*(e.aspectRatio||1)),1024);let n=document.createElement("canvas");return n.width=Math.max(1,Math.round(r.width*t.width)),n.height=Math.max(1,Math.round(r.height*t.height)),n.getContext("2d").drawImage(r,t.x*r.width,t.y*r.height,t.width*r.width,t.height*r.height,0,0,n.width,n.height),n}let H="IMAGE 2 contains numbered isolated details, not a room or a proposed layout. Place the selected objects in IMAGE 1 near the labeled destination x/y percentages, measured from its top-left. Correct spatial fit takes priority over showing the complete object. Size each object proportionally to the space available, with plausible real-world dimensions. Walls, floors, ceilings, corners and openings define physical limits: objects must fit within them, never intersect them. Partial visibility must not conceal an impossible fit. Ignore the tile layout and labels in the final photo. Reconstruct each object in the base room's perspective and realistic scale, aligned to its wall or floor. The full object need not be visible: allow natural frame cropping, foreshortening and occlusion. Never turn it toward the camera, stretch it, miniaturize it or expand the room to show the whole piece. Preserve everything else: architecture, unrelated objects and finishes, framing, camera, lighting and photographic treatment. Only local shadows and occlusions needed for placement may change. Additional instructions below apply only to these connected details.",X=1600-H.length-2;function z(e,t,r){if(!(!e||!Number.isFinite(e.x)||!Number.isFinite(e.y)||[t,r].some(e=>!Number.isFinite(e.left)||!Number.isFinite(e.top)||!Number.isFinite(e.width)||!Number.isFinite(e.height)||e.width<=0||e.height<=0)))return{x:Math.max(0,Math.min(1,(t.left+e.x*t.width-r.left)/r.width)),y:Math.max(0,Math.min(1,(t.top+e.y*t.height-r.top)/r.height))}}function K(e){let t=e.points;if(t.length<("rectangle"===e.kind?2:3)||t.some(e=>!Number.isFinite(e.x)||!Number.isFinite(e.y)||e.x<0||e.x>1||e.y<0||e.y>1))throw Error("Select a valid area of the reference photo.");let r=Math.min(...t.map(e=>e.x)),n=Math.min(...t.map(e=>e.y)),o=Math.max(...t.map(e=>e.x))-r,a=Math.max(...t.map(e=>e.y))-n;
1if(o<.002||a<.002)throw Error("Select a larger area of the reference photo.");return{x:r,y:n,width:o,height:a}}async function V(e,t,r,n){var o,a,i;if(null===(o=r.details)||void 0===o?void 0:o.length){let o=r.details;if(o.some(e=>e.quad&&!L(e.quad)))throw Error("Adjust the placement corners before generating.");if(n&&o.some(e=>e.quad)&&!o.every(e=>e.quad))throw Error("Wait for all connected placements to load.");if(o.some(e=>!e.quad&&(!e.target||!Number.isFinite(e.target.x)||!Number.isFinite(e.target.y)||e.target.x<0||e.target.x>1||e.target.y<0||e.target.y>1)))throw Error("Wait for the room photo to load before applying connected details.");let a=Math.ceil(Math.sqrt(o.length)),l=Math.floor(2048/a),s=document.createElement("canvas");s.width=a*l,s.height=Math.ceil(o.length/a)*l;let c=s.getContext("2d");if(!c)throw Error("The connected details could not be prepared.");for(let e=0;e<o.length;e++){let t=o[e],r=await J({...t,selection:t.selection}),n=e%a*l,i=Math.floor(e/a)*l,s=Math.max(32,Math.round(.07*l));c.fillStyle="#fff",c.fillRect(n,i,l,s),c.fillStyle="#000",c.font="".concat(Math.round(.43*s),"px sans-serif");let d=t.quad?A(t.quad):t.target;c.fillText("".concat(e+1,": destination x=").concat((100*d.x).toFixed(1),"%, y=").concat((100*d.y).toFixed(1),"%"),n+8,i+.65*s,l-16);let u=Math.min((l-24)/r.width,(l-s-24)/r.height);c.drawImage(r,n+(l-r.width*u)/2,i+s+(l-s-r.height*u)/2,r.width*u,r.height*u)}let d=await Z(e,t,s,"reference-connected-details.png");if(n&&o.every(e=>e.quad&&L(e.quad))){let a=await J({id:"base",name:"base",url:n.url},!1),l=document.createElement("canvas");l.width=a.width,l.height=a.height;let s=l.getContext("2d"),c=new Uint8ClampedArray(a.width*a.height);for(let e of(s.drawImage(a,0,0),o)){let t=await O(await J(e),e.quad,a.width,a.height);s.drawImage(t,0,0),i=e.quad,function(e,t,r,n,o){let{radius:a,feather:i}=function(e,t,r){let n=(Math.max(...e.map(e=>e.x))-Math.min(...e.map(e=>e.x)))*t,o=(Math.max(...e.map(e=>e.y))-Math.min(...e.map(e=>e.y)))*r,a=Math.max(t,r),i=Math.max(4,Math.min(.035*a,Math.max(.006*a,.1*Math.hypot(n,o))));return{radius:i,feather:Math.max(2,.3*i)}}(o,r,n),l=r,s=n,c=-1,d=-1;for(let e=0;e<n;e++)for(let n=0;n<r;n++)0!==t[(e*r+n)*4+3]&&(l=Math.min(l,n),c=Math.max(c,n),s=Math.min(s,e),d=Math.max(d,e));if(c<l)return;let u=Math.ceil(a+i);l=Math.max(0,l-u),c=Math.min(r-1,c+u),s=Math.max(0,s-u);let p=c-l+1,h=(d=Math.min(n-1,d+u))-s+1,m=new Float32Array(p*h).fill(1/0);for(let e=0;e<h;e++)for(let n=0;n<p;n++)t[((e+s)*r+n+l)*4+3]>0&&(m[e*p+n]=0);let g=Math.SQRT2;for(let e=0;e<h;e++)for(let t=0;t<p;t++){let r=e*p+t;t&&(m[r]=Math.min(m[r],m[r-1]+1)),e&&(m[r]=Math.min(m[r],m[r-p]+1,t?m[r-p-1]+g:1/0,t+1<p?m[r-p+1]+g:1/0))}for(let t=h-1;t>=0;t--)for(let n=p-1;n>=0;n--){let o=t*p+n;n+1<p&&(m[o]=Math.min(m[o],m[o+1]+1)),t+1<h&&(m[o]=Math.min(m[o],m[o+p]+1,n?m[o+p-1]+g:1/0,n+1<p?m[o+p+1]+g:1/0));let c=Math.max(0,Math.min(1,(a+i-m[o])/i)),d=(t+s)*r+n+l;e[d]=Math.max(e[d],Math.round(255*c*c*(3-2*c)))}}(c,t.getContext("2d").getImageData(0,0,t.width,t.height).data,t.width,t.height,i)}let u=function(e,t,r){let n=document.createElement("canvas");n.width=t,n.height=r;let o=n.getContext("2d"),a=o.createImageData(t,r),i=!1;for(let t=0;t<e.length;t++)e[t]&&(i=!0),a.data[4*t]=a.data[4*t+1]=a.data[4*t+2]=255,a.data[4*t+3]=255-e[t];if(!i)throw Error("Move at least part of a connected object into the photo before generating.");return o.putImageData(a,0,0),n}(c,a.width,a.height),p=await Z(e,t,a,"placement-base.png"),h=await Z(e,t,l,"placement-guide.png"),m=await Z(e,t,u,"placement-mask.png");return{captureId:d,mode:"detail",referenceId:r.id,placement:{renderMode:"local-volume",baseCaptureId:p,guideCaptureId:h,maskCaptureId:m}}}return{captureId:d,mode:"detail",referenceId:r.id,instructions:H}}let l=r.selection?"detail":"style",s={mode:l,referenceId:r.id,selectionId:null===(a=r.selection)||void 0===a?void 0:a.id,target:r.selection?r.target:void 0};if(!r.selection&&r.captureId)return{...s,captureId:r.captureId};let c=await J(r),d=await Z(e,t,c,"detail"===l?"reference-detail.png":"reference-style.png");return{...s,captureId:d}}async function J(e){var t;let r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=await new Promise((t,r)=>{var n;let o=new Image;o.crossOrigin="anonymous",o.onload=()=>t(o),o.onerror=()=>
1r(Error("The reference could not be opened. Reopen it and try again.")),o.src=function(e){try{let t=new URL(e);if("https:"!==t.protocol||t.username||t.password||t.port||t.search||t.hash)return null;let r=decodeURIComponent(t.pathname);if(r.includes("\\")||r.split("/").some(e=>"."===e||".."===e))return null;return"s3.amazonaws.com"===t.hostname&&r.startsWith("/api.thelocalproject/public/")||"d31dpzy4bseog7.cloudfront.net"===t.hostname&&r.startsWith("/media/")?t.href:null}catch(e){return null}}(n=e.url)||n}),o=e.selection?K(e.selection):{x:0,y:0,width:1,height:1},a=r?Math.min(1,2048/Math.max(n.naturalWidth*o.width,n.naturalHeight*o.height)):1;if(!r&&n.naturalWidth*n.naturalHeight>25e6)throw Error("Use a room photo under 25 megapixels for object placement.");let i=document.createElement("canvas");i.width=Math.max(1,Math.round(n.naturalWidth*o.width*a)),i.height=Math.max(1,Math.round(n.naturalHeight*o.height*a));let l=i.getContext("2d");if(!l)throw Error("The reference selection could not be prepared.");return e.selection&&!e.selection.strokes&&"rectangle"!==e.selection.kind&&(l.beginPath(),e.selection.points.forEach((e,t)=>{let r=(e.x-o.x)/o.width*i.width,n=(e.y-o.y)/o.height*i.height;0===t?l.moveTo(r,n):l.lineTo(r,n)}),l.closePath(),l.clip()),l.drawImage(n,o.x*n.naturalWidth,o.y*n.naturalHeight,o.width*n.naturalWidth,o.height*n.naturalHeight,0,0,i.width,i.height),(null===(t=e.selection)||void 0===t?void 0:t.strokes)&&(l.globalCompositeOperation="destination-in",l.drawImage(Y(e.selection),0,0,i.width,i.height),l.globalCompositeOperation="source-over"),i}async function Z(e,t,r,n){let o=await new Promise((e,t)=>r.toBlob(r=>r?e(r):t(Error("The reference selection could not be prepared.")),"image/png")),a=URL.createObjectURL(o);try{return await (0,G.Zv)(e,{id:crypto.randomUUID(),roomId:t,name:n,url:a,width:r.width,height:r.height})}finally{URL.revokeObjectURL(a)}}var Q=r(60232),$=r.n(Q);function ee(e){let{url:t,selection:r,quad:o,image:a,canvas:i,selected:l,editable:s,onSelect:d,onChange:h,onDelete:m,onOpenSource:g}=e,[f,v]=(0,c.useState)("resize"),[y,j]=(0,c.useState)(null),[b,x]=(0,c.useState)("");(0,c.useEffect)(()=>{x(r.strokes?Y(r).toDataURL():"")},[r]);let w=(0,c.useRef)(null);if((0,c.useEffect)(()=>{s||(w.current=null,j(null))},[s]),!Number.isFinite(a.width)||!Number.isFinite(a.height)||a.width<=0||a.height<=0)return null;let k=s&&y||o,_=K(r),I=k.map(e=>({x:a.left-i.left+e.x*a.width,y:a.top-i.top+e.y*a.height})),C=function(e,t,r){if(!Number.isFinite(t)||!Number.isFinite(r)||t<=0||r<=0||!L(e))return null;try{return function(e){let[t,r,n,o,a,i,l,s]=W(e);return"matrix3d(".concat(t/100,",").concat(o/100,",0,").concat(l/100,",").concat(r/100,",").concat(a/100,",0,").concat(s/100,",0,0,1,0,").concat(n,",").concat(i,",0,1)")}(e.map(e=>({x:e.x*t,y:e.y*r})))}catch(e){return null}}(k,a.width,a.height),S=I.map(e=>"".concat(e.x,",").concat(e.y)).join(" "),N="rectangle"===r.kind?void 0:"polygon(".concat(r.points.map(e=>"".concat((e.x-_.x)/_.width*100,"% ").concat((e.y-_.y)/_.height*100,"%")).join(","),")"),P=(e,t)=>{var r;e.preventDefault(),e.stopPropagation(),d(),null===(r=e.currentTarget.ownerSVGElement)||void 0===r||r.focus(),e.currentTarget.setPointerCapture(e.pointerId),w.current={point:{x:e.clientX,y:e.clientY},quad:k,handle:t,next:k}},R=()=>{w.current=null,j(null)};return(0,n.jsxs)("div",{className:$().root,style:{left:i.left,top:i.top,width:i.width,height:i.height,zIndex:l?83:81},children:[C?(0,n.jsx)("div",{className:$().photoClip,style:{left:a.left-i.left,top:a.top-i.top,width:a.width,height:a.height},children:(0,n.jsx)("div",{className:$().cutout,style:{transform:C,clipPath:N,maskImage:b?"url(".concat(b,")"):void 0,WebkitMaskImage:b?"url(".concat(b,")"):void 0,maskSize:"100% 100%",WebkitMaskSize:"100% 100%"},children:(0,n.jsx)("img",{src:t,alt:"",draggable:!1,decoding:"async",style:{width:"".concat(100/_.width,"%"),height:"".concat(100/_.height,"%"),left:"".concat(-(100*_.x)/_.width,"%"),top:"".concat(-(100*_.y)/_.height,"%")}})})}):null,s?(0,n.jsxs)("svg",{tabIndex:-1,className:$().controls,width:i.width,height:i.height,onPointerMove:e=>{let t;let r=w.current;if(!r)return;let n={x:(e.clientX-r.point.x)/a.width,y:(e.clientY-r.point.y)/a.height};-1===r.handle?t=U(r.quad,n):r.handle<4&&"resize"===f?t=function(e,t,r,n){let o=e[(t+2)%4],a=e[t],i=(a.x-o.x)*n,l=a.y-o.y,s=Math.max(.05,1+(r.x*n*i+r.y*l)/(i*i+l*l));return e.map(e=>({x:o.x+(e.x-o.x)*s,y:o.y+(e.y-o.y)*s}))}(r.quad,r.handle,n,a.width/a.height):(t=r.quad.map(e=>({...e}
1)),(r.handle<4?[r.handle]:[r.handle-4,(r.handle-3)%4]).forEach(e=>{t[e].x+=n.x,t[e].y+=n.y})),L(t)&&(r.next=t,j(t))},onPointerUp:()=>{w.current&&h(w.current.next),w.current=null,j(null)},onPointerCancel:R,onKeyDown:e=>{if("Escape"===e.key&&(R(),e.preventDefault()),("Delete"===e.key||"Backspace"===e.key)&&(e.preventDefault(),m()),e.key.startsWith("Arrow")){e.preventDefault();let t=e.shiftKey?10:1;h(U(k,{x:("ArrowRight"===e.key?t:"ArrowLeft"===e.key?-t:0)/a.width,y:("ArrowDown"===e.key?t:"ArrowUp"===e.key?-t:0)/a.height}))}},children:[(0,n.jsx)("polygon",{points:S,className:$().outline,"data-selected":l,tabIndex:0,role:"button","aria-label":"Move placed reference; use arrow keys to reposition",onFocus:d,onPointerDown:e=>P(e,-1)}),l?(0,n.jsxs)(n.Fragment,{children:[I.map((e,t)=>(0,n.jsx)("rect",{className:$().corner,x:e.x-5,y:e.y-5,width:10,height:10,"aria-label":"Placement corner ".concat(t+1),onPointerDown:e=>P(e,t)},t)),I.map((e,t)=>{let r=I[(t+1)%4];return(0,n.jsx)("circle",{className:$().edge,cx:(e.x+r.x)/2,cy:(e.y+r.y)/2,r:4,"aria-label":"Placement edge ".concat(t+1),onPointerDown:e=>P(e,t+4)},t)})]}):null]}):null,s&&l?(0,n.jsxs)("div",{className:$().toolbar,role:"toolbar","aria-label":"Reference placement",children:[(0,n.jsxs)("button",{type:"button","aria-pressed":"resize"===f,onClick:()=>v("resize"),children:[(0,n.jsx)(u.G,{icon:p.$pG,"aria-hidden":"true"}),"Move/resize"]}),(0,n.jsxs)("button",{type:"button","aria-pressed":"perspective"===f,onClick:()=>v("perspective"),children:[(0,n.jsx)(u.G,{icon:p.ubJ,"aria-hidden":"true"}),"Perspective"]}),(0,n.jsx)("button",{type:"button","aria-label":"Open source photo",title:"Open source photo",onClick:g,children:(0,n.jsx)(u.G,{className:$().sourcePhotoIcon,icon:p.VmB,"aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button","aria-label":"Delete placement",title:"Delete placement",onClick:m,children:(0,n.jsx)(u.G,{icon:p.$aW,"aria-hidden":"true"})})]}):null]})}var et=r(66648),er=r(87138),en=r(5382),eo=r(21034),ea=r(32774),ei=r(27964),el=r.n(ei);function es(e){let{title:t,status:r,guidedTour:o=!1,archiveDisabled:a=!1,closeDisabled:i=!1,onArchive:l,onClose:s,onRename:d}=e,{location:h}=(0,en.yA)(),m=(0,eo.o_)(h.country,h.city),[g,f]=(0,c.useState)(null),v=(0,c.useRef)(!1),y=(0,c.useRef)(null);return(0,n.jsxs)("header",{className:el().appbar,children:[(0,n.jsxs)("div",{className:el().projectIdentity,children:[d&&!o?null!==g?(0,n.jsxs)("div",{className:el().projectTitleEditor,children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"/ "}),(0,n.jsxs)("span",{className:el().projectTitleField,children:[(0,n.jsx)("span",{className:el().projectTitleMeasure,"aria-hidden":"true",children:g||" "}),(0,n.jsx)("input",{className:el().projectTitleInput,"aria-label":"Project name",maxLength:35,value:g,autoFocus:!0,onFocus:e=>e.currentTarget.select(),onChange:e=>f(e.target.value),onBlur:()=>{let e=null==g?void 0:g.trim();!v.current&&e&&e!==t&&(null==d||d(e)),f(null)},onKeyDown:e=>{!e.nativeEvent.isComposing&&["Enter","Escape"].includes(e.key)&&(e.preventDefault(),v.current="Escape"===e.key,e.currentTarget.blur(),requestAnimationFrame(()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.focus()}))}})]})]}):(0,n.jsx)("button",{ref:y,type:"button",className:el().projectTitleButton,title:"Rename project","aria-label":"Rename project: ".concat(t),onClick:()=>{v.current=!1,f(t)},children:(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"/ "}),t]})}):(0,n.jsxs)("strong",{title:t,children:[o?null:(0,n.jsx)("span",{"aria-hidden":"true",children:"/ "}),t]}),r]}),(0,n.jsx)(er.default,{href:"/",className:el().brand,"aria-label":"The Architectural Authority home",children:(0,n.jsx)(et.default,{className:el().brandLogo,src:"/monogram.png",alt:"Architectural Authority monogram",width:48,height:48,priority:!0})}),(0,n.jsxs)("div",{className:el().appActions,children:[(0,n.jsxs)("button",{type:"button",className:el().locationButton,"aria-label":"Choose location. Current location: ".concat(m),"aria-haspopup":"dialog",title:m,onClick:()=>window.dispatchEvent(new Event(ea.K)),children:[(0,n.jsx)(u.G,{icon:p.g4A}),(0,n.jsx)("span",{children:m})]}),(0,n.jsxs)("button",{type:"button",className:el().savedProjectsButton,disabled:a,onClick:l,children:[(0,n.jsx)(u.G,{icon:p.cC_}),"Archive"]}),(0,n.jsxs)("button",{type:"button",className:el().closeButton,disabled:i,onClick:s,"aria-label":"Close project workspace",title:"Close",children:[(0,n.jsx)(u.G,{icon:p.WA2}),"Close"]})]})]})}var ec=r(77564),ed=r(6512),eu=r.n(ed);function ep(e,t){var r;return null!==(r=e.visible)&&void 0!==r?r:e.id===t}function eh(e,t){return[...e].reverse().find(e=>ep(e,t))}function em(e,t){return e.map(e=>{var r;return{...e,visible:ep(e,t),locked:null!==(r=e.locked)&&void 0!==r&&r}})}function eg(e,t){let r=e.rooms.filter(e=>t.includes(e));return r.length===e.rooms.length?e:{...e,rooms:r,approved:!1}}let ef=[10,25,50,100],ev=e=>"string"==typeof e?e.replace(/<[^>]*>/g,"").replace(/&amp;/g,"&").trim():"";async function ey(e,t){let r=await fetch((0,i.D)(e),{signal:t,cache:"no-store"});if(!r.ok){let e=await r.json().catch(()=>null);if((null==e?void 0:e.code)==="project_city_required")throw Error("Choose a suggested project city in step 1 to find nearby companies.");if((null==e?void 0:e.code)==="project_coordinates_unavailable")throw Error("Nearby search is not available for this city yet. Choose another suggested city in step 1.");throw Error("Companies could not be loaded. Please try again.")}return r.json()}async function ej(e,t){let r=await (0,eo.gU)(t),n=(0,eo.U)(r).filter(t=>"city"===t.kind&&(0,eo.Ny)(t.name)===(0,eo.Ny)(e));return{location:1===n.length?n[0]:void 0,services:C.f2.filter(e=>e.value).map(e=>({id:e.value,name:e.label}))}}function eb(e){let t=t=>{var r;return null!==(r=e[t])&&void 0!==r?r:e[t[0].toUpperCase()+t.slice(1)]},r=Number(t("profileID")),n=ev(t("companyName"));if(!Number.isSafeInteger(r)||r<=0||!n)return null;let o=Array.from(new Set([...String(t("typeIds")||"").split(",").map(Number),Number(t("primaryTypeID"))])).filter(C.Mw);if(!o.length)return null;let a=[t("matchedCityName"),t("matchedStateName"),t("matchedCountryName")].map(ev).filter(
1Boolean).join(", "),i=[t("cityName"),t("stateName")].map(ev).filter(Boolean).join(", "),l=t("locationMatchType"),s=t("distanceMiles"),c="number"==typeof s&&Number.isFinite(s)&&s>=0?s<1?"less than 1 mile away":"about ".concat(Math.round(s)," miles away"):"",d="service_area"===l?"Listed service area: ".concat(a||"project location"):"primary_location"===l||"secondary_location"===l?[a||i?"Office in ".concat(a||i):"",c].filter(Boolean).join(" \xb7 "):"";return{id:String(r),profileId:r,name:n,slug:ev(t("slug")),role:o.map(C.Jx).join(" \xb7 "),categoryIds:o,reason:i?"Based in ".concat(i):"",coverage:d,credits:[]}}async function ex(e,t,r,n,o){var a;let i=(0,C.U)(t).join(",");if(!i)throw Error("Choose a supported service.");if((null==r?void 0:r.kind)!=="city"||!r.city.id||"0"===r.city.id)throw Error("Choose a project city.");if(!ef.includes(n))throw Error("Choose a supported radius.");let l=new URLSearchParams({page:String(e),pageSize:"24",filterItem:i,countryId:r.country.id,cityId:r.city.id,stateId:r.city.stateCode||"0",radiusMiles:String(n)}),s=await ey("Profiles/GetProjectTeamCompanies?".concat(l),o),c=null!==(a=s.items)&&void 0!==a?a:s.Items;if(!Array.isArray(c))throw Error("Invalid company directory response.");return{items:c.map(eb).filter(e=>!!e),hasMore:!0===s.hasMore||!0===s.HasMore}}async function ew(e,t){let r=new Map,n=0;for(let o=0;o<e.length;o+=4){let a=e.slice(o,o+4),i=await Promise.allSettled(a.map(e=>R(e.articleId,t)));if(t.aborted)throw new DOMException("Aborted","AbortError");i.forEach((e,t)=>{if("rejected"===e.status){n++;return}let o=a[t],i=e.value;for(let e of i.companies){let t=e.categories.filter(e=>(0,C.Mw)(e.id));if(!t.length)continue;let n=String(e.profileId),a=r.get(n),l={articleId:o.articleId,title:i.article.title,roomIds:o.roomIds};r.set(n,{id:n,profileId:e.profileId,name:e.name,slug:e.slug,role:t.map(e=>e.name).join(" \xb7 "),categoryIds:t.map(e=>e.id),reason:"Credited in your inspiration",coverage:"",credits:[...(null==a?void 0:a.credits)||[],l]})}})}return{items:Array.from(r.values()),failures:n}}var ek=r(80194),e_=r.n(ek);let eI=[{label:"Project",detail:"Scope & preferences",title:"Confirm your project",description:"Choose the spaces and preferences for your team."},{label:"Companies",detail:"Choose your team",title:"Choose companies",description:"Choose who you’d like to work with."},{label:"Briefs",detail:"What to share",title:"Prepare your briefs",description:"Choose spaces and what each company receives."},{label:"Review",detail:"Ready to connect",title:"Review introductions",description:"Check each brief before reaching out."}];function eC(e){let{active:t,title:r,location:o,onLocationChange:a,idea:i,projectId:l,photos:s,references:d,rooms:h,edits:m,annotations:v,team:y,setTeam:j,onBack:b}=e,[x,w]=(0,c.useState)(0),[k,I]=(0,c.useState)(0),{includedRoomIds:S,briefs:N,preference:P,timing:R,budget:E}=y,T=e=>j(t=>({...t,briefs:e(t.briefs)})),[M,A]=(0,c.useState)(""),[L,D]=(0,c.useState)(25),[B,U]=(0,c.useState)(""),[W,O]=(0,c.useState)("source"),[G,F]=(0,c.useState)(null),[q,Y]=(0,c.useState)(o),H=(0,c.useRef)(null),X=(0,c.useRef)(null),z=h.filter(e=>null===S||S.includes(e.id)),K=z.map(e=>e.id),V=z.map(e=>e.label).join(", "),J=y.companies.map(_.$L).filter(e=>!!e),Z=J.map(e=>e.id),Q=function(e,t,r,n,o,a){let[i,l]=(0,c.useState)([]),[s,d]=(0,c.useState)(!1),[u,p]=(0,c.useState)(""),[h,m]=(0,c.useState)([]),[g,f]=(0,c.useState)(!1),[v,y]=(0,c.useState)(""),[j,b]=(0,c.useState)(!1),[x,w]=(0,c.useState)(1),[k,_]=(0,c.useState)(0),[I,C]=(0,c.useState)(null),[S,N]=(0,c.useState)("");(0,c.useEffect)(()=>{if(!e)return;let r=new AbortController;return C(null),N(""),f(!1),ej(t,r.signal).then(e=>{r.signal.aborted||C({...e,key:t})}).catch(()=>{r.signal.aborted||N("The location and service filters could not load.")}),()=>r.abort()},[e,t,k]),(0,c.useEffect)(()=>{if(!e)return;let t=new AbortController;return l([]),d(!0),p(""),ew(JSON.parse(r),t.signal).then(e=>{t.signal.aborted||(l(e.items),p(e.failures?"".concat(e.failures," inspiration project").concat(1===e.failures?"":"s"," could not load. Showing available credits."):""))}).catch(()=>{t.signal.aborted||p("Inspiration companies could not load.")}).finally(()=>{t.signal.aborted||d(!1)}),()=>t.abort()},[e,r,k]);let P="".concat(t,"|").concat(n,"|").concat(o),[R,E]=(0,c.useState)("");return(0,c.useEffect)(()=>{w(1),f(!1),m([]),y(""),b(!1),E(P)},[P]),(0,c.useEffect)(()=>
1{if(!e||!a||(null==I?void 0:I.key)!==t||R!==P||!I.location)return;let r=new AbortController;return f(!0),y(""),ex(x,n,I.location,o,r.signal).then(e=>{r.signal.aborted||(m(t=>1===x?e.items:Array.from(new Map([...t,...e.items].map(e=>[e.id,e])).values())),b(e.hasMore))}).catch(e=>{r.signal.aborted||y(e instanceof Error?e.message:"Companies could not load. Please retry.")}).finally(()=>{r.signal.aborted||f(!1)}),()=>r.abort()},[e,a,I,t,R,P,x,n,o,k]),{source:i,sourceLoading:s,sourceError:u,directory:R===P?h:[],directoryLoading:g,directoryError:v,hasMore:R===P&&j,setup:I,setupError:S,retry:()=>_(e=>e+1),loadMore:()=>w(e=>e+1)}}(t&&1===x,o,JSON.stringify((0,_.FJ)(K,s,d,v)),M,L,"alternative"===W),$="selected"===W?J:"source"===W?Q.source:Q.directory,ee=(0,ec.l)($,t&&1===x),et=$.filter(e=>(!M||e.categoryIds.some(e=>(0,C.U)(M).includes(e)))&&"".concat(e.name," ").concat(e.role).toLowerCase().includes(B.toLowerCase())),er=e=>(0,_.bU)(e,y,o,s,d,v),en=e=>{let t=eg(N[e]||{note:i||"",approved:!1,rooms:1===z.length?K:[],designs:!0,originals:!1,references:!0},K);return{...t,approved:t.approved&&t.approvalContext===er(t)&&t.rooms.length>0&&!!t.note.trim()}},eo=J.length>0,ea=J.filter(e=>en(e.id).approved).length,ei=J.length>0&&ea===J.length,el=J.find(e=>e.id===G)||J[0],es=el?en(el.id):null,ed=z.length>0&&!!q.trim(),ep=()=>{let e=q.trim();e&&e!==o&&a(e)},em=ed&&(0===x||(1===x?eo:2===x&&ei)),ev=e=>{0===x&&ep(),w(e),I(t=>Math.max(t,e))},ey=e=>e<=k&&(e<1||ed)&&(e<2||eo)&&(e<3||ei),eb=(e,t)=>T(r=>({...r,[e]:{...en(e),...t,approved:!1}})),ek=()=>T(e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,{...r,approved:!1}]}))),eC=e=>j(t=>({...t,...e,briefs:Object.fromEntries(Object.entries(t.briefs).map(e=>{let[t,r]=e;return[t,{...r,approved:!1}]}))})),eS=e=>{let t=K.includes(e)?K.filter(t=>t!==e):[...K,e];j(e=>({...e,includedRoomIds:t,briefs:Object.fromEntries(Object.entries(e.briefs).map(e=>{let[r,n]=e;return[r,eg(n,t)]}))}))},eN=e=>{let{id:t,profileId:r,name:n,slug:o,role:a,categoryIds:i}=e;j(e=>({...e,companies:e.companies.some(e=>e.id===t)?e.companies.filter(e=>e.id!==t):[...e.companies,{id:t,profileId:r,name:n,slug:o,role:a,categoryIds:i}],briefs:{...e.briefs,[t]:{...en(t),approved:!1}}}))},eP=e=>{F(e),ev(2)},eR=e=>h.filter(t=>e.rooms.includes(t.id)).map(e=>e.label).join(", "),eE=e=>[e.designs&&"Selected room designs",e.references&&"Connected details and source references",e.originals&&"Original room photos"].filter(Boolean).join(" \xb7 ")||"No attachments";return(0,c.useEffect)(()=>{Y(o)},[o]),(0,c.useEffect)(()=>{var e,r;t&&(null===(e=X.current)||void 0===e||e.scrollTo({top:0}),null===(r=H.current)||void 0===r||r.focus({preventScroll:!0}))},[t,x]),(0,n.jsxs)("section",{className:e_().root,hidden:!t,"aria-label":"Build your team",children:[(0,n.jsxs)("aside",{className:e_().sidebar,children:[(0,n.jsxs)("button",{type:"button",className:e_().backToDesign,onClick:b,children:[(0,n.jsx)(u.G,{icon:p.acZ}),"Back to design"]}),(0,n.jsx)("h2",{className:e_().flowName,children:"Build your team"}),(0,n.jsx)("nav",{"aria-label":"Team setup steps",children:(0,n.jsx)("ol",{className:e_().steps,children:eI.map((e,t)=>{let r=t<k&&(0===t?ed:1===t?eo:2===t&&ei);return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",className:e_().step,"aria-current":x===t?"step":void 0,disabled:x!==t&&!ey(t),onClick:()=>ev(t),children:[(0,n.jsx)("span",{className:e_().stepNumber,"data-complete":r&&x!==t,children:r&&x!==t?(0,n.jsx)(u.G,{icon:p.LEp}):t+1}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:e_().stepLabel,children:e.label}),(0,n.jsx)("span",{className:e_().stepDetail,children:e.detail})]})]})},e.label)})})}),(0,n.jsxs)("div",{className:e_().context,children:[(0,n.jsx)("strong",{children:r||"Your project"}),(0,n.jsx)("span",{children:o||"Location not set"}),(0,n.jsx)("span",{children:V||"No spaces selected"})]})]}),(0,n.jsxs)("div",{className:e_().workspace,children:[(0,n.jsx)("div",{className:e_().content,ref:X,children:(0,n.jsxs)("div",{className:e_().page,children:[(0,n.jsxs)("header",{className:e_().heading,children:[(0,n.jsxs)("div",{className:e_().headingMeta,children:[(0,n.jsxs)("span",{children:["Step ",x+1," of ",eI.length]}),(0,n.jsx)("span",{className:e_().previewLabel,children:"Introductions coming soon"})]}
1),(0,n.jsx)("h1",{ref:H,tabIndex:-1,children:eI[x].title}),(0,n.jsx)("p",{children:eI[x].description})]}),0===x?(0,n.jsxs)("div",{className:e_().project,children:[(0,n.jsxs)("fieldset",{className:e_().spaces,children:[(0,n.jsx)("legend",{children:"Spaces"}),(0,n.jsx)("p",{children:"Choose the spaces you want to start now."}),(0,n.jsx)("div",{className:e_().spaceGrid,children:h.map(e=>{var t;let r=s.filter(t=>t.roomId===e.id),o=r[0],a=o?eh((null===(t=m[o.id])||void 0===t?void 0:t.versions)||[],o.selectedGenerationId):void 0,i=Object.values(v.connections).reduce((e,t)=>e+t.filter(e=>r.some(t=>t.id===e.targetPhotoId)).length,0);return(0,n.jsxs)("label",{className:e_().spaceCard,"data-selected":K.includes(e.id),children:[(0,n.jsx)("input",{type:"checkbox",checked:K.includes(e.id),"aria-label":"Include ".concat(e.label," in team setup"),onChange:()=>eS(e.id)}),(0,n.jsx)("span",{className:e_().spaceThumbnail,children:o?(0,n.jsx)(f.Z,{projectId:l||void 0,generationId:null==a?void 0:a.id,captureId:a?void 0:o.captureId,src:(null==a?void 0:a.url)||o.originalUrl||o.url,alt:"".concat(e.label," \xb7 ").concat((null==a?void 0:a.name)||"Original photo")}):(0,n.jsx)(u.G,{icon:p.VmB,"aria-hidden":"true"})}),(0,n.jsxs)("span",{className:e_().spaceDetails,children:[(0,n.jsx)("strong",{children:e.label}),(0,n.jsx)("span",{children:o?(null==a?void 0:a.name)||"Original photo":"No photos yet"}),r.length>1?(0,n.jsxs)("span",{children:[r.length," photos"]}):null,i>0?(0,n.jsxs)("span",{children:[i," connected detail",1===i?"":"s"]}):null]})]},e.id)})}),z.length?null:(0,n.jsx)("p",{className:e_().hint,children:"Select at least one space to continue."})]}),(0,n.jsxs)("div",{className:"".concat(e_().locationField," ").concat(eu().fields),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ep()},children:[(0,n.jsx)("span",{children:"Project location"}),(0,n.jsx)(g.Z,{required:!0,className:eu().location,value:q,onChange:e=>{Y(e),ek()},placeholder:"Search city or region"}),q.trim()?null:(0,n.jsx)("small",{children:"Enter a location to continue."})]}),(0,n.jsxs)("div",{className:e_().fieldGrid,children:[(0,n.jsxs)("label",{className:e_().field,children:["When would you like to start?",(0,n.jsxs)("select",{value:R,onChange:e=>{eC({timing:e.target.value})},children:[(0,n.jsx)("option",{children:"Exploring options"}),(0,n.jsx)("option",{children:"Within 3 months"}),(0,n.jsx)("option",{children:"3–6 months"}),(0,n.jsx)("option",{children:"6+ months"})]})]}),(0,n.jsxs)("label",{className:e_().field,children:["Products",(0,n.jsxs)("select",{value:P,onChange:e=>{eC({preference:e.target.value})},children:[(0,n.jsx)("option",{children:"Exact items first"}),(0,n.jsx)("option",{children:"Open to similar items"}),(0,n.jsx)("option",{children:"Local alternatives first"})]})]})]}),(0,n.jsxs)("label",{className:e_().field,children:[(0,n.jsxs)("span",{children:["Budget ",(0,n.jsx)("small",{children:"\xb7 optional"})]}),(0,n.jsx)("input",{value:E,onChange:e=>{eC({budget:e.target.value})},placeholder:"e.g. USD 20,000–40,000"})]})]}):null,1===x?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:e_().tabs,"aria-label":"Company source",children:[(0,n.jsx)("button",{type:"button","aria-pressed":"source"===W,onClick:()=>O("source"),children:"From your inspiration"}),(0,n.jsx)("button",{type:"button","aria-pressed":"alternative"===W,onClick:()=>O("alternative"),children:"Other companies"}),(0,n.jsxs)("button",{type:"button","aria-pressed":"selected"===W,onClick:()=>O("selected"),children:["Your team \xb7 ",J.length]})]}),(0,n.jsxs)("div",{className:"".concat(e_().filters," ").concat("alternative"===W?e_().proximityFilters:""),children:[(0,n.jsxs)("label",{className:e_().search,children:[(0,n.jsx)(u.G,{icon:p.Y$T}),(0,n.jsx)("input",{"aria-label":"Filter loaded companies",value:B,onChange:e=>U(e.target.value),placeholder:"Filter loaded companies"})]}),(0,n.jsx)("select",{className:e_().serviceFilter,"aria-label":"Filter by service",value:M,onChange:e=>A(e.target.value),children:C.f2.map(e=>(0,n.jsx)("option",{value:e.value,children:e.value?e.label:"All services"},e.value))}),"alternative"===W?(0,n.jsx)("select",{className:e_().serviceFilter,"aria-label":"Company search radius",title:"Nearby offices",value:L,onChange:e=>D(Number(e.target.value)),children:ef.map(e=>(0,n.jsxs)("option",{value:e,children:["Within ",e," miles"]},e))}):null]}),"alternative"===W&&Q.setup&&!Q.setup.location?(0,n.jsx)("p",{className:e_().hint,children:"Choose a suggested project city in step 1 to find nearby companies."}
1):null,"source"===W&&Q.sourceLoading||"alternative"===W&&(Q.directoryLoading||!Q.setup&&!Q.setupError)?(0,n.jsx)("p",{className:e_().hint,role:"status",children:"Loading companies…"}):null,("source"===W?Q.sourceError:"alternative"===W?Q.setupError||Q.directoryError:"")?(0,n.jsxs)("p",{className:e_().hint,role:"alert",children:["source"===W?Q.sourceError:Q.setupError||Q.directoryError," ",(0,n.jsx)("button",{type:"button",className:e_().textButton,onClick:Q.retry,children:"Retry"})]}):null,(0,n.jsx)("div",{className:e_().companies,children:et.map(e=>(0,n.jsx)("article",{className:e_().company,children:(0,n.jsxs)("div",{className:e_().companyMain,children:[(0,n.jsx)(ec.Z,{name:e.name,sources:ee[e.profileId]}),(0,n.jsxs)("div",{className:e_().companyInfo,children:[(0,n.jsxs)("h2",{children:[e.slug?(0,n.jsx)("a",{href:"/profile/".concat(encodeURIComponent(e.slug)),target:"_blank",rel:"noreferrer",children:e.name}):e.name,(0,n.jsx)("span",{children:e.role})]}),"credits"in e&&e.credits.length?e.credits.map(e=>(0,n.jsxs)("p",{children:["Credited in ",e.title," \xb7 ",h.filter(t=>e.roomIds.includes(t.id)).map(e=>e.label).join(", ")]},e.articleId)):null,"coverage"in e&&e.coverage?(0,n.jsx)("p",{children:e.coverage}):null]}),(0,n.jsxs)("button",{type:"button",className:e_().selectCompany,"aria-pressed":Z.includes(e.id),"aria-label":"".concat(Z.includes(e.id)?"Remove":"Add"," ").concat(e.name," ").concat(Z.includes(e.id)?"from":"to"," team"),onClick:()=>eN(e),children:[(0,n.jsx)(u.G,{icon:Z.includes(e.id)?p.LEp:p.r8p}),Z.includes(e.id)?"Selected":"Add"]})]})},e.id))}),et.length||("source"===W?Q.sourceLoading||Q.sourceError:"alternative"===W&&(Q.directoryLoading||Q.directoryError||Q.setupError||!Q.setup||!Q.setup.location))?null:(0,n.jsxs)("div",{className:e_().empty,children:[(0,n.jsx)("p",{children:B||M?"No matches in the loaded companies.":"selected"===W?"Your team is empty.":"source"===W?"No credited companies found for these spaces. Explore other companies to start your team.":"No companies found nearby or listing this service area. Try a larger radius."}),B||M?(0,n.jsx)("button",{type:"button",className:e_().textButton,onClick:()=>{A(""),U("")},children:"Clear filters"}):"alternative"!==W?(0,n.jsx)("button",{type:"button",className:e_().textButton,onClick:()=>O("alternative"),children:"Explore other companies"}):null]}),"alternative"===W&&Q.hasMore?(0,n.jsx)("button",{type:"button",className:e_().secondary,disabled:Q.directoryLoading||!!Q.directoryError,onClick:Q.loadMore,children:"Load more companies"}):null,"selected"!==W&&et.length>0?(0,n.jsx)("p",{className:e_().hint,children:"Confirm availability and product delivery with each company."}):null]}):null,2===x&&el&&es?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:e_().tabs,"aria-label":"Company briefs",children:J.map(e=>(0,n.jsxs)("button",{type:"button","aria-pressed":el.id===e.id,onClick:()=>F(e.id),children:[en(e.id).approved?(0,n.jsx)(u.G,{icon:p.LEp}):null,e.name]},e.id))}),(0,n.jsxs)("fieldset",{className:e_().checks,children:[(0,n.jsxs)("legend",{children:["Spaces for ",el.name]}),z.map(e=>(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:es.rooms.includes(e.id),onChange:t=>eb(el.id,{rooms:t.target.checked?[...es.rooms,e.id]:es.rooms.filter(t=>t!==e.id)})}),e.label]},e.id))]}),(0,n.jsxs)("label",{className:e_().field,children:["What do you need from ",el.name,"?",(0,n.jsx)("textarea",{rows:4,value:es.note,onChange:e=>eb(el.id,{note:e.target.value}),placeholder:"Describe the work, products or advice you need for these spaces."})]}),(0,n.jsxs)("fieldset",{className:e_().checks,children:[(0,n.jsx)("legend",{children:"Include with this brief"}),(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:es.designs,onChange:e=>eb(el.id,{designs:e.target.checked})}),"Selected room designs"]}),(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:es.references,onChange:e=>eb(el.id,{references:e.target.checked})}),"Connected details and source references"]}),(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:es.originals,onChange:e=>eb(el.id,{originals:e.target.checked})}),"Original room photos"]})]}),(0,n.jsxs)("div",{className:e_().approveRow,children:[(0,n.jsxs)("span",{children:[eR(es)||"Select at least one room"," \xb7 ",R]}),(0,n.jsxs)("button",{type:"button",className:e_().secondary,disabled:!es.rooms.length||!es.note.trim()||es.approved,onClick:()=>
1{if(!el||!(null==es?void 0:es.rooms.length)||!es.note.trim())return;T(e=>({...e,[el.id]:{...es,approved:!0,approvalContext:er(es)}}));let e=J.find(e=>e.id!==el.id&&!en(e.id).approved);e&&F(e.id)},children:[es.approved?(0,n.jsx)(u.G,{icon:p.LEp}):null,es.approved?"Approved":"Approve brief"]})]}),es.note.trim()?null:(0,n.jsx)("p",{className:e_().hint,children:"Add a short description to approve this brief."})]}):null,3===x?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("section",{className:e_().reviewSection,children:[(0,n.jsxs)("div",{className:e_().reviewHeading,children:[(0,n.jsx)("h2",{children:r||"Your project"}),(0,n.jsx)("button",{type:"button",className:e_().textButton,onClick:()=>ev(0),children:"Edit project"})]}),(0,n.jsx)("p",{children:V}),(0,n.jsxs)("p",{children:[o||"Location to confirm"," \xb7 ",R]}),(0,n.jsxs)("p",{children:[P," \xb7 ",E||"Budget not specified"]})]}),J.map(e=>{let t=en(e.id);return(0,n.jsxs)("section",{className:e_().reviewSection,children:[(0,n.jsxs)("div",{className:e_().reviewHeading,children:[(0,n.jsxs)("h2",{children:[e.name,(0,n.jsx)("span",{children:e.role})]}),(0,n.jsx)("button",{type:"button",className:e_().textButton,onClick:()=>eP(e.id),children:"Edit brief"})]}),(0,n.jsx)("p",{className:e_().reviewNote,children:t.note}),(0,n.jsx)("p",{children:eR(t)}),(0,n.jsx)("p",{children:eE(t)}),(0,n.jsx)("span",{className:t.approved?e_().approved:e_().hint,children:t.approved?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.G,{icon:p.LEp})," Brief approved"]}):"Needs approval"})]},e.id)}),(0,n.jsx)("p",{className:e_().hint,children:"Each company receives only its approved brief. Contact details and attachments will be confirmed before sending is available."})]}):null]})}),(0,n.jsx)("footer",{className:e_().footer,children:(0,n.jsxs)("div",{className:e_().footerInner,children:[(0,n.jsx)("span",{className:e_().status,role:"status",children:0===x?"".concat(z.length," of ").concat(h.length," spaces selected"):1===x?"".concat(J.length," ").concat(1===J.length?"company":"companies"," selected"):2===x?"".concat(ea," of ").concat(J.length," briefs approved"):"Introductions are not available yet"}),(0,n.jsxs)("div",{className:e_().footerActions,children:[x>0?(0,n.jsx)("button",{type:"button",className:e_().back,onClick:()=>ev(x-1),children:"Back"}):null,(0,n.jsxs)("button",{type:"button",className:e_().primary,disabled:!em,onClick:()=>ev(x+1),children:[3===x?(0,n.jsx)(u.G,{icon:p.XCy}):null,["Choose companies","Prepare briefs","Review","Send introductions"][x],x<3?(0,n.jsx)(u.G,{icon:p.eFW}):null]})]})]})})]})]})}var eS=r(17899);async function eN(e){let t=e.projectId&&(e.generationId||e.captureId)?await (0,eS.VL)({projectId:e.projectId,generationId:e.generationId,captureId:e.captureId}):await fetch(e.url,{cache:"no-store",signal:AbortSignal.timeout(6e4)}).then(e=>{if(!e.ok)throw Error("The layer could not be downloaded. Please try again.");return e.blob()});if(!t.size||!t.type.startsWith("image/"))throw Error("The layer image is unavailable. Please try again.");let r={"image/jpeg":"jpg","image/png":"png","image/webp":"webp","image/heic":"heic","image/heif":"heif"}[t.type]||"png",n=e.name.replace(/\.[a-z0-9]{2,5}$/i,"").replace(/[<>:"/\\|?*\x00-\x1f]/g,"-").trim()||"Layer",o=URL.createObjectURL(t),a=document.createElement("a");a.href=o,a.download="".concat(n,".").concat(r),document.body.appendChild(a),a.click(),a.remove(),window.setTimeout(()=>URL.revokeObjectURL(o),6e4)}var eP=r(73551),eR=r.n(eP);function eE(e){let{strokes:t,onChange:r,width:o,height:a,tool:i,disabled:l=!1,label:s,controlsTarget:h}=e,m=(0,c.useRef)(null),g=(0,c.useRef)(null),f=(0,c.useRef)(null),[v,y]=(0,c.useState)([]),[j,b]=(0,c.useState)(34),[x,w]=(0,c.useState)([]),[k,_]=(0,c.useState)([]),[I,C]=(0,c.useState)(!1),S=!l&&"move"!==i&&"connect"!==i,N=S&&("paint"===i||"erase"===i);(0,c.useEffect)(()=>{if(N&&m.current)return(0,F.ld)(m.current,34,!0,f.current)},[N,h]);let P=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t;return!!m.current&&(0,F.tG)(m.current,e,o,a)};(0,c.useEffect)(()=>{C(P())},[t,o,a]),(0,c.useEffect)(()=>{g.current=null,y([]),P()},[i,l]);let R=e=>{w(e=>[...e.slice(-29),t]),_([]),r(e)},E=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.max(0,Math.min(1,(e.clientX-t.left)/t.width)),y:Math.max(0,Math.min(1,(e.clientY-t.top)/t.height))}},T=(e,t,r)=>
1({id:crypto.randomUUID(),width:r,..."erase"===t?{mode:"erase"}:{},...["rectangle","polygon","lasso"].includes(t)?{shape:"polygon"}:{},points:"rectangle"===t?[e[0],{x:e.at(-1).x,y:e[0].y},e.at(-1),{x:e[0].x,y:e.at(-1).y}]:(0,F.Cx)(e.filter((t,r)=>0===r||t.x!==e[r-1].x||t.y!==e[r-1].y))}),M=()=>{v.length>=3&&R([...t,T(v,"polygon",.001)]),y([])},A=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=g.current;if(n&&n.pointer===e.pointerId){if(e.preventDefault(),e.stopPropagation(),!r){let r=[...n.points,E(e)],o=(Math.max(...r.map(e=>e.x))-Math.min(...r.map(e=>e.x)))*(Math.max(...r.map(e=>e.y))-Math.min(...r.map(e=>e.y)));("paint"===n.tool||"erase"===n.tool||r.length>=("rectangle"===n.tool?2:3)&&o>1e-5)&&R([...t,T(r,n.tool,n.width)])}g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),P()}},L=S?(0,n.jsxs)("div",{className:"".concat(eR().controls," ").concat(h?eR().detached:""),"aria-label":"".concat(s," controls"),onPointerDown:e=>e.stopPropagation(),children:["paint"===i||"erase"===i?(0,n.jsx)("input",{ref:f,"aria-label":"".concat(s," ").concat("erase"===i?"eraser":"brush"," size"),title:"".concat("erase"===i?"Eraser":"Brush"," size"),type:"range",min:5,max:100,value:j,onChange:e=>b(Number(e.target.value))}):null,"polygon"===i&&v.length?(0,n.jsx)("button",{type:"button",disabled:v.length<3,onClick:M,children:"Close polygon"}):null,(0,n.jsx)("button",{className:eR().iconButton,type:"button",title:"Undo","aria-label":"Undo ".concat(s.toLowerCase()),disabled:!x.length,onClick:()=>{_(e=>[...e,t]),r(x.at(-1)),w(e=>e.slice(0,-1)),y([])},children:(0,n.jsx)(u.G,{icon:p.X7o})}),(0,n.jsx)("button",{className:eR().iconButton,type:"button",title:"Redo","aria-label":"Redo ".concat(s.toLowerCase()),disabled:!k.length,onClick:()=>{w(e=>[...e,t]),r(k.at(-1)),_(e=>e.slice(0,-1))},children:(0,n.jsx)(u.G,{icon:p.XSV})}),(0,n.jsx)("button",{className:eR().iconButton,type:"button",title:"Clear selection","aria-label":"Clear ".concat(s.toLowerCase()),disabled:!I&&!v.length,onClick:()=>{R([]),y([])},children:(0,n.jsx)(u.G,{icon:p.Vui})})]}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("canvas",{ref:m,className:eR().canvas,style:{pointerEvents:S?"auto":"none",cursor:N?"none":void 0},tabIndex:S?0:-1,"aria-label":"".concat(s,": ").concat(S?"paint"===i?"brush":i:"selected areas"),onPointerDown:e=>{if(!S||0!==e.button||!e.isPrimary)return;e.preventDefault(),e.stopPropagation(),e.currentTarget.focus({preventScroll:!0});let r=E(e);if("polygon"===i){let n=e.currentTarget.getBoundingClientRect();if(v.length>=3&&12>Math.hypot((r.x-v[0].x)*n.width,(r.y-v[0].y)*n.height)){M();return}if(v.length>=512)return;let o=[...v,r];y(o),P([...t,T(o,"polygon",.001)]);return}if(g.current)return;let n=e.currentTarget.getBoundingClientRect();g.current={pointer:e.pointerId,tool:i,points:[r],width:Math.min(1,j/Math.min(n.width,n.height))},e.currentTarget.setPointerCapture(e.pointerId),P([...t,T([r],i,g.current.width)])},onPointerMove:e=>{let r=g.current;if(!r||r.pointer!==e.pointerId)return;e.preventDefault(),e.stopPropagation();let n=E(e);r.points="rectangle"===r.tool?[r.points[0],n]:[...r.points,n],r.points.length>2048&&(r.points=(0,F.Cx)(r.points,.0025,1024)),P([...t,T(r.points,r.tool,r.width)])},onPointerUp:e=>A(e),onPointerCancel:e=>A(e,!0),onLostPointerCapture:e=>A(e,!0),onKeyDown:e=>{"Escape"===e.key&&(g.current=null,y([]),P(),e.stopPropagation()),"Enter"===e.key&&"polygon"===i&&(e.preventDefault(),M())}}),v.length?(0,n.jsxs)("svg",{className:eR().nodes,viewBox:"0 0 1000 1000",preserveAspectRatio:"none","aria-hidden":"true",children:[(0,n.jsx)("polyline",{points:v.map(e=>"".concat(1e3*e.x,",").concat(1e3*e.y)).join(" ")}),v.map((e,t)=>(0,n.jsx)("circle",{cx:1e3*e.x,cy:1e3*e.y,r:0===t?7:4},t))]}):null,h?(0,d.createPortal)(L,h):L]})}function eT(e){return e.generationId||/^(blob:|data:image\/)/.test(e.src)&&!e.captureId?(0,n.jsx)(eL,{...e},e.generationId||e.src):e.projectId&&e.captureId?(0,n.jsx)(eA,{...e,projectId:e.projectId,captureId:e.captureId},"".concat(e.projectId,":").concat(e.captureId)):(0,n.jsx)(eM,{...e},e.src)}function eM(e){let{src:t,alt:r="",uploading:o=!1,optimized:a=!1,fill:i=!1,sizes:l="96px",unavailableLabel:s="Photo unavailable"}=e,[d,h]=(0,c.useState)(t?"loading":"failed");return(0,n.jsxs)(n.Fragment,{children:[t&&"failed"!==d?(0,n.jsx)(et.default,{src:t,alt:r,...i?{fill:!0}:{width:96,height:72},sizes:l,unoptimized:!a,style:{visibility:"ready"===d?"visible":"hidden"},onLoad:()=>h("ready"),onError:()=>h("failed")}):null,o||"loading"===d?(0,n.jsx)("i",{className:el().thumbnailUploading,role:"status","aria-label":o?"Uploading":"Loading photo"}):"failed"===d?(0,n.jsx)("i",{className:el().thumbnailUnavailable,role:"img","aria-label":s,children:(0,n.jsx)(u.G,{icon:p.l9f})}):null]})}function eA(e){let{projectId:t,captureId:r,alt:o="",uploading:a=!1}=e,[i,l]=(0,c.useState)(""),[s,d]=(0,c.useState)("loading");return(0,c.useEffect)(()=>{let e=new AbortController,n="";return(async()=>{try{let o=await (0,eS.Fk)({projectId:t,captureId:r},e.signal);if(e.signal.aborted)return;n=URL.createObjectURL(o),l(n)}catch(t){e.signal.aborted||d("failed")}})(),()=>{e.abort(),n&&URL.revokeObjectURL(n)}},[t,r]),(0,n.jsxs)(n.Fragment,{children:[i&&"failed"!==s?(0,n.jsx)("img",{src:i,alt:o,width:160,height:160,decoding:"async",draggable:!1,style:{visibility:"ready"===s?"visible":"hidden"},onLoad:()=>d("ready"),onError:()=>d("failed")}):null,a||"loading"===s?(0,n.jsx)("i",{className:el().thumbnailUploading,role:"status","aria-label":a?"Uploading":"Loading photo"}):"failed"===s?(0,n.jsx)("i",{className:el().thumbnailUnavailable,role:"img","aria-label":"Photo unavailable",children:(0,n.jsx)(u.G,{icon:p.l9f})}):null]})}function eL(e){let[t,r]=(0,c.useState)("loading");return(0,n.jsxs)(n.Fragment,{children:["failed"!==t?(0,n.jsx)(f.Z,{src:e.src,alt:e.alt,projectId:e.projectId,captureId:e.captureId,generationId:e.generationId,style:{visibility:"ready"===t?"visible":"hidden"},onPreviewError:()=>r("failed"),onLoad:()=>r("ready"),onError:()=>r("failed")}):null,"loading"===t||e.uploading?(0,n.jsx)("i",{className:el().thumbnailUploading,role:"status","aria-label":e.uploading?"Uploading":"Loading photo"}):"failed"===t?(0,n.jsx)("i",{className:el().thumbnailUnavailable,role:"img","aria-label":e.unavailableLabel||"Photo unavailable",children:(0,n.jsx)(u.G,{icon:p.l9f})}):null]})}function eD(e){let{name:t,disabled:r,onSave:o}=e,[a,i]=(0,c.useState)(!1),[l,s]=(0,c.useState)(t),d=(0,c.useRef)(!1),u=()=>{r||(d.current=!0,s(t),i(!0))},p=e=>{if(!d.current)return;d.current=!1,i(!1);let r=l.trim();e&&r&&r!==t&&o(r)};return a?(0,n.jsx)("input",{className:el().layerTitleInput,"aria-label":"Layer title",value:l,maxLength:100,autoFocus:!0,onFocus:e=>e.currentTarget.select(),onChange:e=>s(e.currentTarget.value),onBlur:()=>p(!0),onKeyDown:e=>
1{("Enter"===e.key||"Escape"===e.key)&&(e.preventDefault(),e.stopPropagation(),p("Enter"===e.key))}}):(0,n.jsx)("strong",{className:el().layerTitle,role:"button",tabIndex:r?-1:0,"aria-label":"Rename layer ".concat(t),"aria-disabled":r||void 0,title:"Double-click to rename",onDoubleClick:u,onKeyDown:e=>{("Enter"===e.key||"F2"===e.key)&&(e.preventDefault(),u())},children:t})}var eB=r(740),eU=r.n(eB);let eW=[{id:"prompt",enabled:!0,title:"Text to Image",description:"Put the space you imagine into words.",icon:p.Qz9},{id:"upload",enabled:!0,title:"Image to Image",description:"Bring an inspiring image from your own gallery.",icon:p.l9f},{id:"style",enabled:!1,title:"By style",description:"Find your direction, from minimalist to coastal.",icon:p.AVo},{id:"bookmarks",enabled:!1,title:"My bookmarks",description:"Return to the ideas you have already saved.",icon:p.xVw},{id:"articles",enabled:!1,title:"By article",description:"Find inspiration in the projects and stories we publish.",icon:p.Xgz},{id:"professionals",enabled:!1,title:"By professional",description:"Discover spaces by designers in our directory.",icon:p.Cv1},{id:"room",enabled:!1,title:"By room type",description:"Browse reference images for the kind of space you are creating.",icon:p.TEX}];function eO(e){let{value:t,onChange:r,onBack:o,onContinue:a}=e,i=eW.find(e=>e.id===t&&e.enabled);return(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().minimalSlide," ").concat(eU().screen),children:[(0,n.jsxs)("div",{className:y().introBlock,children:[(0,n.jsx)("h1",{children:"Select your inspiration."}),(0,n.jsx)("p",{children:"How would you like to shape your space? Choose where your inspiration begins."})]}),(0,n.jsxs)("fieldset",{className:eU().options,children:[(0,n.jsx)("legend",{className:eU().srOnly,children:"Choose an inspiration source"}),eW.map(e=>(0,n.jsxs)("label",{className:eU().card,"data-selected":(null==i?void 0:i.id)===e.id,"data-disabled":!e.enabled,children:[(0,n.jsx)("input",{type:"radio",name:"inspiration-source",value:e.id,checked:(null==i?void 0:i.id)===e.id,disabled:!e.enabled,onChange:()=>{e.enabled&&r(e.id)}}),(0,n.jsx)(u.G,{icon:e.icon,className:eU().icon,"aria-hidden":"true"}),(0,n.jsx)("strong",{children:e.title}),(0,n.jsx)("span",{className:eU().description,children:e.description}),(0,n.jsx)("span",{className:eU().selection,"aria-hidden":"true",children:(null==i?void 0:i.id)===e.id?(0,n.jsx)(u.G,{icon:p.LEp}):null})]},e.id))]}),(0,n.jsxs)("div",{className:"".concat(y().actions," ").concat(eU().actions),children:[(0,n.jsx)("button",{type:"button",className:y().backButton,onClick:o,children:"Back"}),(0,n.jsx)("p",{className:eU().selectedSource,role:"status",children:i?"".concat(i.title," selected"):"Choose one to begin"}),"prompt"===t?(0,n.jsxs)("button",{type:"button",className:y().primaryButton,onClick:a,children:["Continue ",(0,n.jsx)("span",{children:"→"})]}):null]})]})}function eG(e){let{workspace:t,panel:r,open:o=!0,resizable:a=!0}=e,i=(0,c.useRef)(null),[l,s]=(0,c.useState)(0),[d,u]=(0,c.useState)(270),[p,h]=(0,c.useState)(null),m=(0,c.useRef)(null),g=l?Math.max(240,l-320):d,f=e=>Math.max(240,Math.min(g,e)),v=f(a&&null!=p?p:d),y=l?v/l:0;return(0,c.useEffect)(()=>{let e=i.current;if(!e)return;let t=()=>{s(Math.max(0,e.getBoundingClientRect().width-8));let t=Number.parseFloat(getComputedStyle(e).getPropertyValue("--project-panel-width"));Number.isFinite(t)&&u(t)};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[]),(0,c.useEffect)(()=>{var e;return o&&a||null===(e=m.current)||void 0===e||e.call(m),()=>{var e;null===(e=m.current)||void 0===e||e.call(m)}},[o,a]),(0,n.jsxs)("div",{ref:i,className:el().resizableArea,"data-resizing":!1,style:{gridTemplateColumns:"minmax(".concat(320,"px, 1fr) ").concat(o?8:0,"px ").concat(o?v:0,"px")},children:[t,(0,n.jsx)("div",{className:el().panelDivider,"data-hidden":!o,"data-disabled":!a,role:"separator",tabIndex:o&&a?0:-1,"aria-hidden":!o,"aria-label":a?"Resize inspiration panel":"Panel boundary","aria-orientation":"vertical","aria-controls":"desktop-inspiration-panel","aria-valuemin":Math.round(l?240/l*100:0),"aria-valuemax":Math.round(l?g/l*100:100),"aria-valuenow":Math.round(100*y),"aria-valuetext":"Inspiration uses ".concat(Math.round(100*y),"% of the workspace"),title:a?"Drag to resize. Double-click to restore the default width.":void 0,onPointerDown:e=>{var t;if(!o||!a||0!==e.button||!i.current)return;e.preventDefault(),null===(t=m.current)||void 0===t||t.call(m);let r=e.currentTarget,n=e.pointerId;
1r.focus({preventScroll:!0});try{r.setPointerCapture(n)}catch(e){}let l=i.current;l.dataset.resizing="true";let s=null,c=e=>{let t=l.getBoundingClientRect(),n=t.width-8;s=Math.max(240,Math.min(Math.max(240,n-320),t.right-e-4)),l.style.gridTemplateColumns="minmax(".concat(320,"px, 1fr) ").concat(8,"px ").concat(s,"px");let o=Math.round(n>0?s/n*100:0);r.setAttribute("aria-valuenow",String(o)),r.setAttribute("aria-valuetext","Inspiration uses ".concat(o,"% of the workspace"))},d=e=>{e.pointerId===n&&(e.preventDefault(),c(e.clientX))},u=()=>{l.dataset.resizing="false",window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),window.removeEventListener("blur",p),r.hasPointerCapture(n)&&r.releasePointerCapture(n),m.current=null},p=()=>{u(),null!==s&&h(s)},g=e=>{e.pointerId===n&&p()};m.current=u,window.addEventListener("pointermove",d,{passive:!1}),window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g),window.addEventListener("blur",p)},onDoubleClick:()=>{o&&a&&h(null)},onKeyDown:e=>{if(!o||!a)return;let t=e.shiftKey?80:40,r="ArrowLeft"===e.key?v+t:"ArrowRight"===e.key?v-t:"Home"===e.key?240:"End"===e.key?g:void 0;if("Enter"===e.key){e.preventDefault(),h(null);return}void 0!==r&&(e.preventDefault(),h(f(r)))},children:(0,n.jsx)("span",{"aria-hidden":"true"})}),r]})}let eF=(0,c.createContext)(null);function eq(){let e=(0,c.useContext)(eF);if(!e)throw Error("Drawer cards require a selection provider");return e}function eY(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=(0,c.useRef)(null),a=(0,c.useRef)(new Map),i=(0,c.useRef)(!0);return(0,c.useLayoutEffect)(()=>{i.current=!0},[e,t]),(0,c.useLayoutEffect)(()=>{var l;!t&&r&&i.current&&o.current&&(o.current.scrollTo({top:null!==(l=a.current.get(e))&&void 0!==l?l:n,behavior:"instant"}),i.current=!1)},[e,t,r,n]),{scroll:o,remember:()=>{t||!o.current||i.current||a.current.set(e,o.current.scrollTop)},reset:()=>{var e;a.current.clear(),i.current=!0,null===(e=o.current)||void 0===e||e.scrollTo({top:0,behavior:"instant"})}}}var eH=r(28584),eX=r.n(eH);function ez(e){let{companies:t,onOpenProfessional:r}=e,o=eq();return t.length?(0,n.jsxs)("section",{className:eX().companySection,"aria-label":"Project team",children:[(0,n.jsx)("h4",{children:"Project team"}),(0,n.jsx)("ul",{className:eX().companyList,children:t.map(e=>{let t=N(e),a=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:eX().companyAvatar,"aria-hidden":"true",children:e.showThumbnail&&e.thumbnail?(0,n.jsx)(eT,{src:e.thumbnail,fill:!0,sizes:"64px",optimized:(0,I._K)(e.thumbnail)}):e.name.split(/\s+/).slice(0,2).map(e=>e[0]).join("").toUpperCase()}),(0,n.jsxs)("span",{className:eX().companyDetails,children:[(0,n.jsx)("strong",{children:e.name}),e.categories.length?(0,n.jsx)("span",{children:e.categories.map(e=>e.name).join(" \xb7 ")}):null,t?(0,n.jsx)("small",{children:t}):null]}),r?(0,n.jsx)("span",{className:eX().companyArrow,"aria-hidden":"true",children:"→"}):null]});return(0,n.jsx)("li",{children:r?(0,n.jsx)("button",{type:"button",className:eX().companyCard,"aria-current":o.isProfessionalSelected(e.profileId)||void 0,"aria-label":"View ".concat(e.name," in Professionals"),onClick:()=>r(e),children:a}):(0,n.jsx)("div",{className:eX().companyCard,"aria-current":o.isProfessionalSelected(e.profileId)||void 0,children:a})},e.profileId)})})]}):null}var eK=r(94843);let eV=e=>Array.from(new Map(e.filter(e=>!1!==e.active&&e.name).map(e=>{var t;return[null!==(t=e.value)&&void 0!==t?t:e.name,e]})).values()),eJ={bookmarks:"My bookmarks",articles:"By article",style:"By style",room:"By room type"};function eZ(e){let{url:t,title:r}=e;return(0,n.jsx)("div",{className:eX().thumbnail,children:(0,n.jsx)(eT,{src:t,alt:"",fill:!0,sizes:"(min-width: 1500px) 200px, 150px",optimized:(0,I._K)(t),unavailableLabel:"No preview for ".concat(r)})})}async function eQ(e,t,r){let n=await fetch(e,{signal:t,headers:r,cache:"no-store"});if(!n.ok)throw Error(401===n.status?"Sign in again to see your bookmarks.":"Could not load these images. Please try again.");return n.json()}function e$(e){var t,r;let{source:o,initialRoom:a,initialStyle:l,viewer:s,onOpenPhoto:h,initialOrigin:m,onRestorePhotos:g,styleMenuTarget:f,onBrowseFilterChange:v,preloadedStyles:y,seriesMenuTarget:j,preloadedSeries:b,roomMenuTarget:x,preloadedRooms:w,onOpenProfessional:k}=e,_=eq(),C="articles"===o?b:"style"===o?y:"room"===o?w:void 0,[S,N]=(0,c.useState)(null!==(r=null==m?void 0:m.filter)&&void 0!==r?r:"room"===o?a:"style"===o&&l||""),[P,T]=(0,c.useState)(C?eV(C):[]),[M,A]=(0,c.useState)(!1),[L,D]=(0,c.useState)(!C),[B,U]=(0,c.useState)([]),[W,O]=(0,c.useState)([]),[G,F]=(0,c.useState)(1),[q,Y]=(0,c.useState)(0),[H,X]=(0,c.useState)(!0),[z,K]=(0,c.useState)(""),[V,J]=(0,c.useState)(0),[Z,Q]=(0,c.useState)((null==m?void 0:m.article)||null),[$,ee]=(0,c.useState)([]),[et,er]=(0,c.useState)(!!(null==m?void 0:m.article)),[en,eo]=(0,c.useState)(""),[ea,ei]=(0,c.useState)(0),[es,ec]=(0,c.useState)(null),{scroll:ed,remember:eu,reset:ep}=eY(Z?"article:".concat(Z.articleId):"list:".concat(o,":").concat(S),!!s,!(Z?et:H)),eh=(0,c.useRef)(null),em=(0,c.useRef)(!1),eg="style"===o||"room"===o,ef="style"===o?f:"room"===o?x:void 0,ev=eg&&void 0!==ef,ey="room"===o?"rooms":"styles",ej=null===(t=P.find(e=>e.name===S))||void 0===t?void 0:t.searchAliases,eb="style"===o?(null==ej?void 0:ej.length)?ej.join(","):S.split("/").map(e=>e.trim()).join(","):S;(0,c.useEffect)(()=>{"room"!==o||m||(N(a),F(1))},[o,a,m]),(0,c.useEffect)(()=>
1{if(!eg&&"articles"!==o)return;if(0===V&&void 0!==C){D(null===C),C&&(T(eV(C)),A(!1));return}let e=new AbortController;return D(!0),("articles"===o?E(e.signal):eQ((0,i.D)("StartProject/catalogs"),e.signal)).then(t=>{e.signal.aborted||(T(eV(("articles"===o?t.series:"style"===o?t.styles:t.spaceTypes)||[])),A(!1))}).catch(()=>{e.signal.aborted||A(!0)}).finally(()=>{e.signal.aborted||D(!1)}),()=>e.abort()},[o,eg,V,C]),(0,c.useEffect)(()=>{let e=new AbortController;return em.current=!0,X(!0),K(""),1===G&&(U([]),O([]),Y(0)),(async()=>{if("bookmarks"===o){let t=await (0,eK.C3)();if(e.signal.aborted)return;if(!t)throw Error("Sign in again to see your bookmarks.");let r=await eQ((0,i.D)("ProjectBrowse/me/bookmarks?page=".concat(G,"&pageSize=12")),e.signal,{Authorization:"Bearer ".concat(t)});e.signal.aborted||(U(e=>Array.from(new Map([...1===G?[]:e,...r.items].map(e=>[e.articleId,e])).values())),Y(r.pages))}else if("articles"===o){let t=await eQ((0,i.D)("ProjectBrowse/articles?page=".concat(G,"&pageSize=12").concat(eb?"&seriesId=".concat(encodeURIComponent(eb)):"")),e.signal);if(e.signal.aborted)return;U(e=>Array.from(new Map([...1===G?[]:e,...t.items].map(e=>[e.articleId,e])).values())),Y(t.pages)}else{let t=new URLSearchParams({page:String(G),pageSize:"12",seed:"workspace-inspiration"});eb&&t.set("style"===o?"styles":"room",eb);let r=await eQ((0,i.D)("ProjectBrowse/visuals?".concat(t)),e.signal);if(e.signal.aborted)return;O(e=>(0,I.Ye)(1===G?[]:e,(0,I.mE)(r.items))),Y(r.pages)}})().catch(t=>{e.signal.aborted||K(t.message||"Could not load inspiration.")}).finally(()=>{e.signal.aborted||(em.current=!1,X(!1))}),()=>e.abort()},[o,eb,G,V]),(0,c.useEffect)(()=>{if(!Z)return;let e=new AbortController;return ee([]),er(!0),eo(""),R(Z.articleId,e.signal).then(t=>{e.signal.aborted||(ee(t.photos),ec({articleId:Z.articleId,companies:t.companies}))}).catch(t=>{e.signal.aborted||eo(t.message)}).finally(()=>{e.signal.aborted||er(!1)}),()=>e.abort()},[Z,ea]);let ex=()=>{em.current||H||z||Z||s||G>=q||(em.current=!0,X(!0),F(G+1))};(0,c.useEffect)(()=>{if(!eh.current||H||z||Z||s||G>=q||!("IntersectionObserver"in window))return;let e=!0,t=new IntersectionObserver(r=>{e&&r.some(e=>e.isIntersecting)&&(e=!1,t.disconnect(),ex())},{root:ed.current,rootMargin:"0px 0px 800px 0px"});return t.observe(eh.current),()=>{e=!1,t.disconnect()}},[H,z,Z,s,G,q]);let ew=e=>{var t;ep(),(e!==S||1!==G)&&(em.current=!0,X(!0)),N(e),F(1),null===(t=ed.current)||void 0===t||t.scrollTo({top:0}),"articles"===o&&(Q(null),ee([])),(eg||"articles"===o)&&(null==v||v())},ek=Z?$:W,e_=(0,c.useRef)(g);e_.current=g;let eI=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(m&&!(Z?et:H)&&!eI.current){var e;eI.current=!0,null===(e=e_.current)||void 0===e||e.call(e_,ek)}},[m,ek,Z,et,H]);let eC=Z?et:H,eS=Z?en:z,eN=!eC&&!eS&&(Z||eg?!ek.length:!B.length);return(0,n.jsxs)("div",{className:eX().root,children:["articles"===o&&j?(0,d.createPortal)((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button","aria-pressed":!S,onClick:()=>ew(""),children:"All series"}),P.map(e=>(0,n.jsx)("button",{type:"button","aria-pressed":S===e.value,onClick:()=>ew(e.value),children:e.name},e.value)),M?(0,n.jsx)("button",{type:"button",onClick:()=>J(e=>e+1),children:"Retry loading series"}):L&&!P.length?(0,n.jsx)("span",{role:"status",children:"Loading series…"}):null]}),j):null,ev&&ef?(0,d.createPortal)((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button","aria-pressed":!S,onClick:()=>ew(""),children:"All ".concat(ey)}),S&&!P.some(e=>e.name===S)?(0,n.jsx)("button",{type:"button","aria-pressed":"true",onClick:()=>ew(S),children:S}):null,P.map(e=>(0,n.jsx)("button",{type:"button","aria-pressed":S===e.name,onClick:()=>ew(e.name),children:e.name},e.name)),M?(0,n.jsx)("button",{type:"button",onClick:()=>J(e=>e+1),children:"Retry loading ".concat(ey)}):L&&!P.length?(0,n.jsx)("span",{role:"status",children:"Loading ".concat(ey,"…")}):null]}),ef):null,s,(0,n.jsxs)("div",{className:eX().browser,hidden:!!s,children:[Z?(0,n.jsx)("div",{className:el().referencePanelBar,children:(0,n.jsxs)("button",{type:"button",onClick:()=>{eu(),Q(null)},children:["← Back to ","bookmarks"===o?"bookmarks":"articles"]})}):(0,n.jsxs)("div",{className:el().drawerHeading,children:[(0,n.jsx)("h2",{children:eJ[o]}),(0,n.jsx)("button",{type:"button","aria-label":"Refresh",title:"Refresh",disabled:H,onClick:()=>{ep(),em.current=!0,X(!0),F(1),J(e=>e+1)},children:(0,n.jsx)(u.G,{icon:p.mHK})})]}),Z?(0,n.jsx)("div",{className:eX().articleIntro,children:(0,n.jsx)("h3",{children:Z.title})}):eg&&!ev?(0,n.jsxs)("div",{className:eX().filters,children:[(0,n.jsx)("label",{htmlFor:"inspiration-".concat(o),children:"style"===o?"Design style":"Room type"}),(0,n.jsxs)("select",{id:"inspiration-".concat(o),value:S,onChange:e=>ew(e.target.value),children:[(0,n.jsx)("option",{value:"",children:"style"===o?"All tagged styles":"All tagged rooms"}),S&&!P.some(e=>
1e.name===S)?(0,n.jsx)("option",{value:S,children:S}):null,P.map(e=>(0,n.jsx)("option",{value:e.name,children:e.name},e.name))]}),M?(0,n.jsx)("button",{type:"button",onClick:()=>J(e=>e+1),children:"Retry loading filters"}):null]}):null,(0,n.jsxs)("div",{ref:ed,className:eX().scroll,"aria-busy":eC,children:[(0,n.jsx)("div",{className:eX().grid,children:Z||eg?ek.map(e=>{var t;return(0,n.jsxs)("button",{type:"button",className:eX().card,"aria-current":_.isPhotoSelected(e)||void 0,"aria-label":Z?e.name:void 0,onClick:()=>{eu(),h(e,ek,{source:o,filter:S,article:Z||void 0})},children:[(0,n.jsx)(eZ,{url:e.url,title:e.name}),Z?null:(0,n.jsx)("span",{children:e.articleTitle}),!Z&&(null===(t="style"===o?e.style:e.roomType)||void 0===t?void 0:t.trim())?(0,n.jsx)("small",{children:("style"===o?e.style:e.roomType).trim().replace(/\b\w/g,e=>e.toUpperCase())}):null]},e.id)}):B.map(e=>(0,n.jsxs)("button",{type:"button",className:eX().card,"aria-current":_.isArticleSelected(e.articleId)||void 0,onClick:()=>{eu(),_.selectArticle(e.articleId),ee([]),er(!0),Q(e)},children:[(0,n.jsx)(eZ,{url:e.thumbnail,title:e.title}),(0,n.jsx)("span",{children:e.title}),(0,n.jsx)("small",{children:"View project photos →"})]},e.articleId))}),!Z||et||en||(null==es?void 0:es.articleId)!==Z.articleId?null:(0,n.jsx)(ez,{companies:es.companies,onOpenProfessional:k}),(0,n.jsxs)("div",{className:eX().pagination,children:[eC&&(Z||G>=q)?(0,n.jsxs)("div",{className:eX().status,role:"status",children:["Loading ",Z?"project photos":"inspiration","…"]}):null,eS?(0,n.jsxs)("div",{className:eX().status,role:"alert",children:[(0,n.jsx)("p",{children:eS}),(0,n.jsx)("button",{type:"button",onClick:()=>Z?ei(e=>e+1):J(e=>e+1),children:"Try again"})]}):null,eN?(0,n.jsxs)("div",{className:eX().status,children:[(0,n.jsx)("h3",{children:"bookmarks"!==o||Z?"No photos here yet.":"Your saved inspiration starts here."}),(0,n.jsx)("p",{children:Z?"This article does not have a photo gallery yet.":"bookmarks"===o?"Bookmark projects on the site, then refresh to see them here.":eg?"There are no tagged photos for this selection yet. Try another filter as the collection grows.":"There are no articles available right now."}),eg&&S?(0,n.jsx)("button",{type:"button",onClick:()=>ew(""),children:"Show all tagged photos"}):null]}):null,!Z&&G<q?(0,n.jsx)("button",{ref:eh,className:eX().more,type:"button",disabled:H||!!z,onClick:ex,children:H?(0,n.jsx)("span",{role:"status",children:"Loading more…"}):"Load more"}):null]})]})]})]})}var e0=r(94620);function e1(e){let{viewer:t,onOpenPhoto:r,initialOrigin:o,onRestorePhotos:a,specialtyMenuTarget:i,onSpecialtyChange:l,onOpenProfessional:s}=e,h=eq(),[m,g]=(0,c.useState)((null==o?void 0:o.filter)||""),[f,v]=(0,c.useState)([]),[y,j]=(0,c.useState)((null==o?void 0:o.professional)||null),[b,x]=(0,c.useState)([]),[w,k]=(0,c.useState)((null==o?void 0:o.article)||null),[_,I]=(0,c.useState)([]),[S,N]=(0,c.useState)(1),[P,E]=(0,c.useState)(null),[A,L]=(0,c.useState)(1),[D,B]=(0,c.useState)(null),[U,W]=(0,c.useState)(!0),[O,G]=(0,c.useState)(!1),[F,q]=(0,c.useState)(!!(null==o?void 0:o.article)),[Y,H]=(0,c.useState)(""),[X,z]=(0,c.useState)(""),[K,V]=(0,c.useState)(""),[J,Z]=(0,c.useState)(0),[Q,$]=(0,c.useState)(0),[ee,et]=(0,c.useState)(0),[er,en]=(0,c.useState)(null),{scroll:eo,remember:ea,reset:ei}=eY(w?"article:".concat(w.articleId):y?"professional:".concat(y.profileId):"directory:".concat(m),!!t,!(w?F:y?O:U)),es=(0,c.useRef)(""),ec=(0,c.useRef)(null),ed=(0,c.useRef)(!1),eu=(0,c.useRef)(!1),ep=null==y?void 0:y.profileId,eh=null==y?void 0:y.name,em=null==y?void 0:y.slug,eg=!!y;(0,c.useEffect)(()=>{if(eg){W(!1);return}let e=JSON.stringify([S,m,J]);if(es.current===e){W(!1);return}let t=new AbortController;return ed.current=!0,W(!0),H(""),1===S&&(v([]),E(null)),T(S,m,t.signal).then(r=>{t.signal.aborted||(v(e=>Array.from(new Map([...1===S?[]:e,...r.items].map(e=>[e.id,e])).values())),E(r.nextPage),es.current=e)}).catch(e=>{t.signal.aborted||H(e.message)}).finally(()=>{t.signal.aborted||(ed.current=!1,W(!1))}),()=>t.abort()},[S,m,J,eg]),(0,c.useEffect)(()=>{if(!ep)return;let e=new AbortController;return eu.current=!0,G(!0),z(""),1===A&&(x([]),B(null)),M(ep,A,e.signal,y).then(t=>{e.signal.aborted||(j(e=>(null==e?void 0:e.profileId)===ep?{...t.professional,thumbnail:e.thumbnail}:e),x(e=>Array.from(new Map([...1===A?[]:e,...t.items].map(e=>
1[e.articleId,e])).values())),B(t.nextPage))}).catch(t=>{e.signal.aborted||z(t.message)}).finally(()=>{e.signal.aborted||(eu.current=!1,G(!1))}),()=>e.abort()},[ep,A,Q]),(0,c.useEffect)(()=>{if(!w||!ep)return;let e=new AbortController;return I([]),q(!0),V(""),R(w.articleId,e.signal).then(t=>{e.signal.aborted||(I(t.photos.map(e=>({...e,professionalId:ep,professionalName:eh,professionalSlug:em}))),en({articleId:w.articleId,companies:t.companies}))}).catch(t=>{e.signal.aborted||V(t.message)}).finally(()=>{e.signal.aborted||q(!1)}),()=>e.abort()},[w,ep,eh,em,ee]);let ef=(0,c.useRef)(a);ef.current=a;let ev=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(o&&!F&&!ev.current){var e;ev.current=!0,null===(e=ef.current)||void 0===e||e.call(ef,_)}},[o,_,F]);let ey=w?F:y?O:U,ej=w?K:y?X:Y,eb=w?null:y?D:P,ex=!ey&&!ej&&!(w?_.length:y?b.length:f.length),ew=()=>{let e=y?eu:ed;e.current||ey||ej||t||!eb||(e.current=!0,y?(G(!0),L(eb)):(W(!0),N(eb)))};(0,c.useEffect)(()=>{if(!ec.current||ey||ej||t||!eb||!("IntersectionObserver"in window))return;let e=!0,r=new IntersectionObserver(t=>{e&&t.some(e=>e.isIntersecting)&&(e=!1,r.disconnect(),ew())},{root:eo.current,rootMargin:"0px 0px 800px 0px"});return r.observe(ec.current),()=>{e=!1,r.disconnect()}},[ey,ej,t,eb,ep,y]);let ek=e=>{var r;(e!==m||y||t)&&(e===m&&Z(e=>e+1),v([]),E(null),W(!0),H(""),g(e),N(1),j(null),k(null),x([]),I([]),L(1),B(null),ei(),null===(r=eo.current)||void 0===r||r.scrollTo({top:0}),null==l||l())},e_=e=>{h.selectProfessional(e.profileId),ea(),x([]),L(1),B(null),z(""),G(!0),j(e)},eI=e=>{h.selectArticle(e.articleId),ea(),I([]),V(""),q(!0),k(e)},eC=C.f2.map(e=>(0,n.jsx)("button",{type:"button","aria-pressed":m===e.value,onClick:()=>ek(e.value),children:e.label},e.value));return(0,n.jsxs)("div",{className:eX().root,children:[i?(0,d.createPortal)(eC,i):null,t,(0,n.jsxs)("div",{className:eX().browser,hidden:!!t,children:[y?(0,n.jsx)("div",{className:el().referencePanelBar,children:(0,n.jsxs)("button",{type:"button",onClick:()=>{ea(),w?k(null):j(null)},children:["← Back to ",w?"projects":"professionals"]})}):(0,n.jsxs)("div",{className:el().drawerHeading,children:[(0,n.jsx)("h2",{children:"Professionals"}),(0,n.jsx)("button",{type:"button","aria-label":"Refresh",title:"Refresh",disabled:U,onClick:()=>{ei(),v([]),E(null),W(!0),N(1),Z(e=>e+1)},children:(0,n.jsx)(u.G,{icon:p.mHK})})]}),y||void 0!==i?null:(0,n.jsx)("div",{className:eX().filters,children:(0,n.jsxs)("label",{children:["Specialty",(0,n.jsx)("select",{value:m,onChange:e=>ek(e.target.value),children:C.f2.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))})]})}),y?(0,n.jsxs)("div",{className:eX().articleIntro,children:[(0,n.jsx)("h3",{children:w?w.title:!1!==y.active&&y.slug?(0,n.jsxs)("a",{className:eX().profileLink,href:"/profile/".concat(encodeURIComponent(y.slug)),target:"_blank",rel:"noopener noreferrer",children:[y.name," ",(0,n.jsx)("span",{"aria-hidden":"true",children:(0,n.jsx)(e0.Z,{})})]}):y.name}),(0,n.jsx)("p",{children:w?y.name:(0,C.J3)(y,m)}),!w&&y.location?(0,n.jsx)("p",{children:y.location}):null,!w&&y.description?(0,n.jsx)("p",{children:y.description}):null]}):null,(0,n.jsxs)("div",{ref:eo,className:eX().scroll,"aria-busy":ey,children:[(0,n.jsx)("div",{className:eX().grid,children:w?_.map(e=>(0,n.jsx)("button",{type:"button",className:eX().card,"aria-current":h.isPhotoSelected(e)||void 0,"aria-label":e.name,onClick:()=>{ea(),r(e,_,{source:"professionals",filter:m,article:w||void 0,professional:y||void 0})},children:(0,n.jsx)(eZ,{url:e.url,title:e.name})},e.id)):y?b.map(e=>(0,n.jsxs)("button",{type:"button",className:eX().card,"aria-current":h.isArticleSelected(e.articleId)||void 0,onClick:()=>eI(e),children:[(0,n.jsx)(eZ,{url:e.thumbnail,title:e.title}),(0,n.jsx)("span",{children:e.title}),(0,n.jsx)("small",{children:"View project photos →"})]},e.articleId)):f.map(e=>(0,n.jsxs)("button",{type:"button",className:eX().card,"aria-current":h.isProfessionalSelected(e.profileId)||void 0,onClick:()=>e_(e),children:[(0,n.jsx)(eZ,{url:e.thumbnail,title:e.name}),(0,n.jsx)("span",{children:e.name}),(0,n.jsx)("small",{children:(0,C.J3)(e,m)})]},e.id))}),!w||F||K||(null==er?void 0:er.articleId)!==w.articleId?null:(0,n.jsx)(ez,{companies:er.companies,onOpenProfessional:s}),(0,n.jsxs)("div",{className:eX().pagination,children:[ey&&!eb?(0,n.jsxs)("div",{className:eX().status,role:"status",children:["Loading ",w?"project photos":y?"projects":"professionals","…"]}):null,ej?(0,n.jsxs)("div",{className:eX().status,role:"alert",children:[(0,n.jsx)("p",{children:ej}),(0,n.jsx)("button",{type:"button",onClick:()=>w?et(e=>e+1):y?$(e=>e+1):Z(e=>e+1),children:"Try again"})]}):null,ex&&!eb?(0,n.jsxs)("div",{className:eX().status,children:[(0,n.jsx)("h3",{children:(null==y?void 0:y.active)===!1?"Portfolio unavailable.":y?"N
1o project photos available.":"No professionals found."}),(0,n.jsx)("p",{children:(null==y?void 0:y.active)===!1?"This company is credited on the project but does not have a public portfolio.":y?"This collection does not have published project photos available right now.":m?"Try another specialty as the collection grows.":"Professionals appear here when their public portfolios include published project photos."}),!y&&m?(0,n.jsx)("button",{type:"button",onClick:()=>ek(""),children:"All specialties"}):null]}):null,eb?(0,n.jsx)("button",{ref:ec,type:"button",className:eX().more,disabled:ey||!!ej,onClick:ew,children:ey?(0,n.jsx)("span",{role:"status",children:"Loading more…"}):"Load more"}):null]})]})]})]})}let e2=()=>({query:"",kind:"all",resultKey:"",items:[],page:0,nextPage:null,total:0,counts:{photos:0,articles:0,professionals:0},scrollTop:0}),e3=(e,t)=>JSON.stringify([e.trim(),t]),e5=e=>"".concat(e.kind,":").concat(e.entityId);function e4(e){return{id:"editorial-".concat(e.articleId,"-").concat(e.imageId),imageId:e.imageId,articleId:e.articleId,url:e.thumbnail,name:e.title,articleTitle:e.title,slug:e.slug,roomType:e.roomType,style:e.style}}var e6=r(77189),e8=r.n(e6);async function e9(e,t){let r=await fetch(e,{signal:t,cache:"no-store"}),n=await r.json();if(!r.ok)throw Error(n.error||"Could not load search. Please try again.");return n}let e7={"Image label":"Label","Image keywords":"Keyword","Article title":"Title","Related image":"Related"},te=[["all","All"],["photo","Photos"],["article","Articles"],["professional","Professionals"]];function tt(e){var t,r,o,a;let{state:l,setState:s,viewer:d,onOpenPhoto:h,onExitViewer:m,initialOrigin:g,onRestorePhotos:f,onOpenProfessional:v}=e,y=eq(),j=e3(l.query,l.kind),[b,x]=(0,c.useState)(null),[w,k]=(0,c.useState)(!1),[_,I]=(0,c.useState)(""),[C,S]=(0,c.useState)(0),N=(0,c.useRef)(!1),P=(0,c.useRef)(null),E=(0,c.useRef)(""),[T,M]=(0,c.useState)([]),[A,L]=(0,c.useState)([]),[D,B]=(0,c.useState)(1),[U,W]=(0,c.useState)(null),[O,G]=(0,c.useState)(!!(l.article||l.professional)),[F,q]=(0,c.useState)(""),[Y,H]=(0,c.useState)(0),[X,z]=(0,c.useState)(null),K=(0,c.useRef)(!1),V=null===(t=l.article)||void 0===t?void 0:t.articleId,J=null===(r=l.professional)||void 0===r?void 0:r.profileId,Z=l.resultKey===j,{scroll:Q,remember:$,reset:ee}=eY(V?"article:".concat(V):J?"professional:".concat(J):"search:".concat(j),!!d,!(V||J?O:w),V||J?0:l.scrollTop),et=(0,c.useRef)(l);et.current=l,(0,c.useEffect)(()=>{if(I(""),x(null),N.current=!1,l.query.trim().length<2||et.current.resultKey===j){k(!1);return}k(!0);let e=setTimeout(()=>{N.current=!0,x({key:j,page:1})},300);return()=>clearTimeout(e)},[j,C]),(0,c.useEffect)(()=>{if(!b||b.key!==j)return;let e=new AbortController;return N.current=!0,k(!0),I(""),e9((0,i.D)("ProjectSearch?".concat(new URLSearchParams({q:l.query.trim(),kind:l.kind,page:String(b.page),pageSize:"12"}))),e.signal).then(t=>{e.signal.aborted||s(e=>e3(e.query,e.kind)!==b.key?e:{...e,resultKey:b.key,items:Array.from(new Map([...1===b.page?[]:e.items,...t.items].map(e=>[e5(e),e])).values()),page:t.page,nextPage:t.nextPage,total:t.total,counts:t.counts})}).catch(t=>{e.signal.aborted||I(t.message)}).finally(()=>{e.signal.aborted||(N.current=!1,k(!1))}),()=>e.abort()},[b,j,s]),(0,c.useEffect)(()=>{if(!V&&!J)return;let e=JSON.stringify([J,D,Y]);if(!V&&E.current===e){K.current=!1,q(""),G(!1);return}let t=new AbortController;return K.current=!0,G(!0),q(""),V?M([]):1===D&&L([]),(V?R(V,t.signal):e9((0,i.D)("ProjectSearch/professionals/".concat(J,"/articles?page=").concat(D,"&pageSize=12")),t.signal)).then(r=>{t.signal.aborted||(V?(M(r.photos),z({articleId:V,companies:r.companies})):(E.current=e,L(e=>Array.from(new Map([...1===D?[]:e,...r.items].map(e=>[e.articleId,e])).values())),W(r.nextPage)))}).catch(e=>{t.signal.aborted||q(e.message)}).finally(()=>{t.signal.aborted||(K.current=!1,G(!1))}),()=>t.abort()},[V,J,D,Y]);let er=(0,c.useRef)(!1),en=(0,c.useRef)(f);en.current=f,(0,c.useEffect)(()=>{let e=V?T:Z?l.items.filter(e=>"photo"===e.kind).map(e4):[];if(g&&!er.current&&(V?!O:Z||!!_||l.query.trim().length<2)){var t;er.current=!0,null===(t=en.current)||void 0===t||t.call(en,e)}},[g,V,T,Z,l.items,O,_,l.query]);let eo=J&&!V?U:!V&&Z?l.nextPage:null,ea=V||J?O:w,ei=V||J?F:_,el=()=>{let e=J?K:N;e.current||ea||ei||d||!eo||(e.current=!0,J?(G(!0),B(eo)):(k(!0),x({key:j,page:eo})))};(0,c.useEffect)(()=>
1{if(!P.current||ea||ei||d||!eo||!("IntersectionObserver"in window))return;let e=!0,t=new IntersectionObserver(r=>{e&&r.some(e=>e.isIntersecting)&&(e=!1,t.disconnect(),el())},{root:Q.current,rootMargin:"0px 0px 800px 0px"});return t.observe(P.current),()=>{e=!1,t.disconnect()}},[ea,ei,d,eo,j,J]);let es=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.kind;ee(),E.current="",m(),B(1),M([]),L([]),s(t=>({...t,query:e,kind:r,article:void 0,professional:void 0,scrollTop:0})),null===(t=Q.current)||void 0===t||t.scrollTo({top:0})},ec={source:"search",filter:l.kind,article:l.article,search:{query:l.query,kind:l.kind,professional:l.professional}},ed=(e,t)=>{$();let r=e=>l.professional?{...e,professionalId:l.professional.profileId,professionalName:l.professional.title,professionalSlug:l.professional.slug}:e;h(r(e),t.map(r),ec)},eu=e=>{y.selectArticle(e.articleId),$(),M([]),G(!0),q(""),s(t=>({...t,article:e}))},ep=e=>{"photo"===e.kind?ed(e4(e),l.items.filter(e=>"photo"===e.kind).map(e4)):"article"===e.kind?eu({articleId:e.articleId,title:e.title,slug:e.slug,thumbnail:e.thumbnail}):(y.selectProfessional(e.profileId),$(),E.current="",L([]),B(1),W(null),G(!0),q(""),s(t=>({...t,professional:e})))},eh=e=>"all"===e?l.counts.photos+l.counts.articles+l.counts.professionals:l.counts["photo"===e?"photos":"article"===e?"articles":"professionals"];return(0,n.jsxs)("div",{className:eX().root,children:[(0,n.jsxs)("div",{className:e8().header,children:[(0,n.jsxs)("label",{className:e8().field,children:[(0,n.jsx)(u.G,{icon:p.Y$T,"aria-hidden":"true"}),(0,n.jsx)("input",{type:"search","aria-label":"Search inspiration",placeholder:"Search photos, articles, professionals…",maxLength:80,value:l.query,onChange:e=>es(e.target.value)}),l.query?(0,n.jsx)("button",{type:"button","aria-label":"Clear search",onClick:()=>es(""),children:(0,n.jsx)(u.G,{icon:p.g82})}):null]}),(0,n.jsx)("div",{className:e8().filters,role:"group","aria-label":"Search result type",children:te.map(e=>{let[t,r]=e;return(0,n.jsxs)("button",{type:"button","aria-pressed":l.kind===t,onClick:()=>es(l.query,t),children:[r,Z?(0,n.jsx)("small",{children:eh(t)}):null]},t)})})]}),d?(0,n.jsx)("div",{className:e8().viewer,children:d}):(0,n.jsxs)(n.Fragment,{children:[V||J?(0,n.jsxs)("div",{className:e8().detailHeading,children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{$(),s(e=>({...e,article:void 0,...e.article&&e.professional?{}:{professional:void 0}}))},children:["← Back to ",V&&J?"projects":"search"]}),(0,n.jsx)("h3",{children:(null===(o=l.article)||void 0===o?void 0:o.title)||(null===(a=l.professional)||void 0===a?void 0:a.title)}),J?(0,n.jsxs)("a",{href:"/profile/".concat(encodeURIComponent(l.professional.slug)),target:"_blank",rel:"noopener noreferrer",children:["View professional ",(0,n.jsx)(e0.Z,{})]}):null]}):null,(0,n.jsxs)("div",{ref:Q,className:eX().scroll,"aria-busy":ea,onScroll:e=>{if(!V&&!J){let t=e.currentTarget.scrollTop;s(e=>({...e,scrollTop:t}))}},children:[(0,n.jsx)("div",{className:eX().grid,children:V?T.map(e=>(0,n.jsx)("button",{type:"button",className:eX().card,"aria-current":y.isPhotoSelected(e)||void 0,"aria-label":e.name,onClick:()=>ed(e,T),children:(0,n.jsx)(eZ,{url:e.url,title:e.name})},e.id)):J?A.map(e=>(0,n.jsxs)("button",{type:"button",className:eX().card,"aria-current":y.isArticleSelected(e.articleId)||void 0,onClick:()=>eu(e),children:[(0,n.jsx)(eZ,{url:e.thumbnail,title:e.title}),(0,n.jsx)("span",{children:e.title})]},e.articleId)):Z?l.items.map(e=>(0,n.jsxs)("button",{type:"button",className:eX().card,"aria-current":("photo"===e.kind?y.isPhotoSelected(e4(e)):"article"===e.kind?y.isArticleSelected(e.articleId):y.isProfessionalSelected(e.profileId))||void 0,onClick:()=>ep(e),children:[(0,n.jsx)(eZ,{url:e.thumbnail||"",title:e.title}),(0,n.jsx)("span",{children:e.title}),(0,n.jsx)("small",{children:"photo"===e.kind?e7[e.matchLabel]||"Related":"article"===e.kind?"Article":"Professional"})]},"".concat(e.kind,":").concat(e.entityId))):null}),!V||O||F||(null==X?void 0:X.articleId)!==V?null:(0,n.jsx)(ez,{companies:X.companies,onOpenProfessional:v}),V||J||!(l.query.trim().length<2)?null:(0,n.jsx)("p",{className:eX().status,children:"Find an idea by object, room, style, article, or professional. Try “white bed”."}),ea?(0,n.jsx)("p",{className:eX().status,role:"status",children:V||J?"Loading photos and projects…":"Searching…"}):null,ei?(0,n.jsxs)("div",{className:eX().status,role:"alert",children:[(0,n.jsx)("p",{children:ei}),(0,n.jsx)("button",{type:"button",onClick:()=>{V||J?H(e=>e+1):Z&&l.nextPage?(I(""),x({key:j,page:l.nextPage})):(s(e=>({...e,resultKey:""})),S(e=>e+1))},children:"Try again"})]}):null,ea||ei||(V?T.length:J?A.length:!Z||l.items.length)?null:(0,n.jsx)("p",{className:eX().status,children:J?"No published project photos yet.":"No matches. Try another name or keyword."}),eo?(0,n.jsx)("button",{type:"button",ref:P,className:eX().more,disabled:ea||!!ei,onClick:el,children:ea?"Loa
1ding more…":"Load more"}):null]})]})]})}let tr={prompt:"Text to Image",upload:"Image to Image",style:"Styles",bookmarks:"Bookmarks",articles:"Articles",professionals:"Professionals",room:"Rooms"},tn=[...eW.filter(e=>"prompt"===e.id||"upload"===e.id),...eW.filter(e=>"prompt"!==e.id&&"upload"!==e.id).sort((e,t)=>tr[e.id].localeCompare(tr[t.id],"en"))],to={"right-gallery":null,"right-layers":"gallery"},ta=[{id:"sandbox-kitchen",name:"Kitchen",initials:"KI",photoCount:4},{id:"sandbox-dining-room",name:"Dining room",initials:"DR",photoCount:3},{id:"sandbox-primary-bedroom",name:"Primary bedroom",initials:"PB",photoCount:6},{id:"sandbox-family-room",name:"Family room",initials:"FR",photoCount:5},{id:"sandbox-primary-bathroom",name:"Primary bathroom",initials:"BA",photoCount:4},{id:"sandbox-patio",name:"Patio",initials:"PA",photoCount:5}],ti={original:{url:"/project-planning/hero-construction-space.png",alt:"Original room during construction"},decluttered:{url:"/project-planning/hero-unfinished-space.webp",alt:"Decluttered concrete room"},final:{url:"/project-planning/hero-finished-space.webp",alt:"Final finished room design"}},tl=[{target:"setup-project-details",title:"Project details",description:"Add a project title and location for your reference, then choose the guided mode that best suits your project.",side:"right",section:"Getting started"},{target:"workspace-upload",title:"Add a room photo",description:"Upload a photo, or start on a phone and take a new one through the app or web.",side:"right",section:"Getting started"},{target:"right-gallery",title:"Project Gallery",description:"Open the Project Gallery to view photos and organize the spaces in your project.",side:"right",section:"Project Gallery tour"},{target:"gallery-spaces",title:"Spaces in this project",description:"Each space keeps its room photos together. These sample spaces preview how a larger house project will be organized.",side:"right",section:"Project Gallery tour"},{target:"gallery-filmstrip-toggle",title:"Show or hide the filmstrip",description:"Use this control to show photo thumbnails along the bottom of the workspace or hide them when you want more canvas space.",side:"right",section:"Project Gallery tour"},{target:"gallery-filmstrip",title:"Photos for this space",description:"Every photo for the selected space appears in this filmstrip, so you can move between views without leaving the workspace.",side:"right",section:"Project Gallery tour"},{target:"right-layers",title:"Layers",description:"Open Layers to compare the finished design with the room photo you started from.",side:"right",section:"Layers tour"},{target:"layers-original-photo",actionTarget:"layers-decluttered",actionLabel:"Select Decluttered",title:"Original photo",description:"The original active-construction photo stays at the bottom as the foundation for every cleaner design layer above it.",side:"right",section:"Layers tour"},{target:"layers-decluttered",actionTarget:"layers-final-space",actionLabel:"Select Final Space",title:"Decluttered",description:"This middle layer shows the same concrete room after the boxes, equipment, and construction mess have been cleared away.",side:"right",section:"Layers tour"},{target:"right-prompt",title:"Text to Image",description:"Describe the redesign you want in your own words.",side:"right"},{target:"right-upload",title:"Image to Image",description:"Upload inspiration images and connect their details to your room.",side:"right"},{target:"right-style",title:"Styles",description:"Explore design styles and use them to guide the visual direction.",side:"right"},{target:"right-bookmarks",title:"Bookmarks",description:"Bring in spaces and ideas you have saved elsewhere on the site.",side:"right"},{target:"right-articles",title:"Articles",description:"Browse editorial projects for relevant design inspiration.",side:"right"},{target:"right-professionals",title:"Professionals",description:"Discover professionals whose work fits the direction of your project.",side:"right"},{target:"right-room",title:"Rooms",description:"Organize and revisit inspiration based on the room you are designing.",side:"right"},{target:"left-move",title:"Move",description:"Pan around the canvas and inspect different parts of your room photo.",side:"left"},{target:"left-rectangle",title:"Rectangle select",description:"Select an area of your room photo or a detail in a reference image.",side:"left"},{target:"left-polygon",title:"Polygon select",description:"Outline an area on either photo with connected points.",side:"left"},{target:"left-lasso",title:"Lasso select",description:"Draw a freeform selection on either photo.",side:"left"},{target:"left-connect",title:"Connect selection",description:"Link a selected reference detail to the place it should influence in your room.",side:"left"},{target:"left-declutter-full",title:"Declutter",description:"Remove clutter in the room selection, or across the whole room when nothing is selected.",side:"left"},{target:"left-paint",title:"Brush",description:"Paint a selection on the room or a reference photo.",side:"left"},{target:"left-erase",title:"Erase selection",description:"Remove parts of a painted selection before applying an edit.",side:"left"}];function ts(e){let{title:t,action:r}=e;return(0,n.jsxs)("div",{className:el().drawerHeading,children:[(0,n.jsx)("h2",{children:t}),r]})}function tc(e){var t,r,o,i,l,s,d;let h=function(e){let{scope:t,professionalIds:r,articleId:n}=e,[o,a]=(0,c.useState)({scope:t}),i=o.scope===t?o:{},l=e=>a(r=>({...r.scope===t?r:{},...e,scope:t}));return{isProfessionalSelected:e=>!!(e&&(r.includes(e)||i.professionalId===e)),isArticleSelected:e=>!!(e&&(n===e||i.articleId===e)),isPhotoSelected:e=>{var t;return!!(e.imageId&&(null===(t=i.photo)||void 0===t?void 0:t.articleId)===e.articleId&&i.photo.imageId===e.imageId)},selectProfessional:e=>l({professionalId:e}),selectArticle:e=>l({articleId:e}),selectPhoto:e=>l({photo:{articleId:e.articleId,imageId:e.imageId},articleId:e.articleId,...e.professionalId?{professionalId:e.professionalId}:{}})}}({scope:"".concat(e.accountKey,":").concat(e.projectId),professionalIds:[...e.projectTeam.companies.map(e=>e.profileId),...e.entryProfessional?[e.entryProfessional.profileId]:[]],articleId:null===(t=e.entryArticle)||void 0===t?void 0:t.articleId}),m=(0,c.useRef)(null),[g,v]=(0,c.useState)(!1);(0,c.useEffect)(()=>{v((window.location.host,!1))},[]);let[y,j]=(0,c.useState)(!1),[b,x]=(0,a.O)(""),w=(0,c.useRef)(!1),[k,_]=(0,c.useState)(null),[C,S]=(0,c.useState)(!1),[P,R]=(0,c.useState)(""),[T,M]=(0,c.useState)([]),[L,U]=(0,c.useState)(null),[W,O]=(0,c.useState)(e2),[G,Y]=(0,c.useState)(null),[H,X]=(0,c.useState)(!1),[V,J]=(0,c.useState)(""),[Z,Q]=(0,c.useState)(""),$=(0,c.useRef)(!1),et=(0,c.useRef)(!1),[er,en]=(0,c.useState)(!1),[eo,ea]=(0,c.useState)(""),ei=(0,c.useRef)(!1),ec=(0,c.useId)(),[ed,eu]=(0,c.useState)("move"),[em,eg]=(0,c.useState)(null),[ef,ev]=(0,c.useState)(!1),[ey,ej]=(0,c.useState)({x:0,y:0}),[eb,ex]=(0,c.useState)(1),ew=(0,c.useRef)(null),ek=(0,c.useRef)(null),[e_,eI]=(0,c.useState)(null),[eS,eP]=(0,c.useState)(""),[eR,eM]=(0,c.useState)(""),[eA,eL]=(0,c.useState)(!0);(0,c.useEffect)(()=>
1{e.placementBusy&&eL(!1)},[e.placementBusy]);let eB=(0,c.useRef)(null),eU=(0,c.useRef)(null),[eO,eq]=(0,c.useState)(1),[eY,eH]=(0,c.useState)(null),[eX,ez]=(0,c.useState)(null),[eK,eV]=(0,c.useState)(null),[eJ,eZ]=(0,c.useState)(null),[eQ,e0]=(0,c.useState)(null),[e3,e5]=(0,c.useState)(null),[e4,e6]=(0,c.useState)(null);(0,c.useEffect)(()=>{let e=new AbortController;return E(e.signal).then(t=>{e.signal.aborted||e6(t.series)}).catch(()=>{e.signal.aborted||e6(void 0)}),()=>e.abort()},[]);let[e8,e9]=(0,c.useState)(null),[e7,te]=(0,c.useState)(null),[tc,td]=(0,c.useState)(!1),[tu,tp]=(0,c.useState)(-1),[th,tm]=(0,c.useState)(null),[tg,tf]=(0,c.useState)(null),tv=(0,c.useRef)(!1),ty=(0,c.useRef)(null),tj=(0,c.useRef)(null),tb=(0,c.useRef)(""),tx=e.spaces.find(t=>t.id===e.uploadRoomId)||e.spaces.find(t=>t.id===e.activeRoomId)||e.spaces[0],tw=t=>"".concat(t.label," (").concat(e.photos.filter(e=>e.roomId===t.id).length,")"),tk=(0,c.useRef)(""),t_=(0,c.useRef)(null),tI=(0,c.useRef)(null),tC=(0,c.useRef)(1),tS=(0,c.useRef)(0),[tN,tP]=(0,c.useState)(1),[tR,tE]=(0,c.useState)({x:0,y:0}),[tT,tM]=(0,c.useState)("50% 50%"),[tA,tL]=(0,c.useState)(0),tD=(0,c.useCallback)(()=>{tp(-1),e.onExitGuidedTour()},[e.onExitGuidedTour]),tB=e.collectingPhotos?void 0:e.photos.find(t=>t.id===e.selectedPhotoId&&t.roomId===e.activeRoomId)||e.photos.find(t=>t.roomId===e.activeRoomId);(0,c.useEffect)(()=>{R(""),eP(""),eM("")},[e.activeRoomId]);let tU=e.setupRequired||!e.configured,tW=tU||!tB,tO=e.guidedTour||tu>=0,tG="team"===k&&!g||tU||tW&&"gallery"!==k&&!(e.entryArticle&&"articles"===k||e.entryProfessional&&"professionals"===k)?null:k;(0,c.useEffect)(()=>{e.onPhoneContext("upload"===tG?"reference":"space","upload"!==tG&&e.collectingPhotos?e.uploadRoomId:e.activeRoomId)},[tG,e.activeRoomId,e.uploadRoomId,e.collectingPhotos]);let tF=eW.find(e=>e.id===tG),tq="cleanup"===e.mode,tY=e.workspaceAnnotations.selections,tH=e.workspaceAnnotations.connections,tX=t=>e.setWorkspaceAnnotations(e=>({...e,selections:t(e.selections)})),tz=t=>e.setWorkspaceAnnotations(e=>({...e,connections:t(e.connections)})),tK=t=>{if(!e.signedIn){e.onSignIn();return}t()},tV=()=>tK(()=>{var t;tk.current=e.activeRoomId,null===(t=t_.current)||void 0===t||t.click()});(0,c.useEffect)(()=>{if(e.guidedTour&&!tv.current){tv.current=!0,tf(null),tp(0);return}e.guidedTour||(tv.current=!1,tf(null))},[e.guidedTour]),(0,c.useEffect)(()=>{if(tu<0)return;let e=tl[tu],t=()=>{var t,r;let n=null===(t=m.current)||void 0===t?void 0:t.querySelector('[data-workspace-tour="'.concat(e.target,'"]')),o=e.actionTarget?null===(r=m.current)||void 0===r?void 0:r.querySelector('[data-workspace-tour="'.concat(e.actionTarget,'"]')):n;if(!n||!o){tm(e=>e?{...e,actionTarget:{display:"none"},targetArrow:{display:"none"},targetEnabled:!1}:{target:{top:-12,left:-12,width:1,height:1},actionTarget:{display:"none"},bubble:{top:96,left:92},targetArrow:{display:"none"},targetEnabled:!1});return}let a=n.getBoundingClientRect(),i=o.getBoundingClientRect();tm({target:{top:a.top-5,left:a.left-5,width:a.width+10,height:a.height+10},actionTarget:e.actionTarget?{top:i.top-3,left:i.left-3,width:i.width+6,height:i.height+6}:{display:"none"},bubble:{top:96,left:92},targetArrow:{top:i.top+i.height/2-10,left:Math.max(12,i.left-44)},targetEnabled:o instanceof HTMLButtonElement&&!o.disabled})},r=window.requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{window.cancelAnimationFrame(r),window.removeEventListener("resize",t)}},[tG,tu,e.photos.length,tU]),(0,c.useEffect)(()=>{var e;if(tu<0||!th)return;null===(e=ty.current)||void 0===e||e.focus({preventScroll:!0});let t=e=>{"Escape"===e.key&&tD()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[tD,th,tu]),(0,c.useEffect)(()=>{e.projectId&&e.photos.length&&!e.collectingPhotos&&S(!0)},[e.projectId,e.photos.length,e.collectingPhotos]),(0,c.useEffect)(()=>{tP(1),tE({x:0,y:0}),tM("50% 50%")},[null==tB?void 0:tB.id]),(0,c.useEffect)(()=>{e.photos.length||(_(null),R(""),M([]))},[e.photos.length]),(0,c.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>tL(e=>e+1))},r=new ResizeObserver(t);
1return[tI.current,eU.current,eB.current].forEach(e=>{e&&r.observe(e)}),window.addEventListener("resize",t),t(),()=>{cancelAnimationFrame(e),r.disconnect(),window.removeEventListener("resize",t)}},[P,tG,tU]),(0,c.useLayoutEffect)(()=>{tL(e=>e+1)},[tN,tR.x,tR.y,tT,null==tB?void 0:tB.id]),(0,c.useEffect)(()=>{let e=e=>Math.min(3,Math.max(.5,e)),t=(t,r,n,o,a)=>{if(!t)return()=>{};let i={x:0,y:0},l={x:0,y:0},s=(e,r)=>{let n=t.getBoundingClientRect();null==a||a("".concat((e-n.left)/n.width*100,"% ").concat((r-n.top)/n.height*100,"%"))},c=t=>{t.preventDefault(),t.ctrlKey?(s(t.clientX,t.clientY),n(r=>e(r*Math.exp(-(.01*t.deltaY))))):o(e=>({x:e.x-t.deltaX,y:e.y-t.deltaY}))},d=e=>{e.preventDefault(),tC.current=r},u=t=>{t.preventDefault(),void 0!==t.clientX&&void 0!==t.clientY&&s(t.clientX,t.clientY),n(e(tC.current*t.scale))},p=e=>{if(2===e.touches.length){let t=e.touches[0],n=e.touches[1];tS.current=Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY),tC.current=r,i={x:(t.clientX+n.clientX)/2,y:(t.clientY+n.clientY)/2},o(e=>(l=e,e))}},h=t=>{if(2!==t.touches.length||!tS.current)return;t.preventDefault();let r=t.touches[0],a=t.touches[1],c={x:(r.clientX+a.clientX)/2,y:(r.clientY+a.clientY)/2};s(c.x,c.y),n(e(tC.current*Math.hypot(r.clientX-a.clientX,r.clientY-a.clientY)/tS.current)),o({x:l.x+c.x-i.x,y:l.y+c.y-i.y})};return t.addEventListener("wheel",c,{passive:!1}),t.addEventListener("gesturestart",d,{passive:!1}),t.addEventListener("gesturechange",u,{passive:!1}),t.addEventListener("touchstart",p,{passive:!0}),t.addEventListener("touchmove",h,{passive:!1}),()=>{t.removeEventListener("wheel",c),t.removeEventListener("gesturestart",d),t.removeEventListener("gesturechange",u),t.removeEventListener("touchstart",p),t.removeEventListener("touchmove",h)}},r=t(tI.current,tN,tP,tE,tM),n=t(eU.current,eb,ex,ej);return()=>{r(),n()}},[tN,eb,tU,P,tG]);let tJ=function(t){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!tW||!tU&&(e.entryArticle&&"articles"===t||e.entryProfessional&&"professionals"===t)){if(k===t){_(null),"prompt"===t&&"redesign"===e.mode&&e.onMode("inspiration");return}R(""),M([]),Y(null),U(null),_(t),"prompt"!==t||r?"redesign"===e.mode&&e.onMode("inspiration"):e.onSource(t)}},tZ=t=>{h.selectProfessional(t.profileId),R(""),M([]),Y(null),U({id:crypto.randomUUID(),professional:function(e){let t=e.categories.map(e=>e.name);return{id:"professional-".concat(e.profileId),profileId:e.profileId,name:e.name,slug:e.slug,thumbnail:e.showThumbnail?e.thumbnail:"",description:"",disciplines:t,primaryDiscipline:t.join(" \xb7 "),location:N(e),active:e.active,fromArticleCredit:!0}}(t)}),_("professionals"),("redesign"===e.mode||"cleanup"===e.mode)&&e.onMode("inspiration")},tQ=tG&&["bookmarks","articles","style","room","professionals"].includes(tG)?tG:null,t$=e.activeRoomId,t0=e.roomTypes[t$]||Object.values(e.roomTypes)[0]||"",t1="".concat(e.accountKey,":").concat(e.projectId,":").concat(tQ).concat("room"===tQ?":".concat(t$,":").concat(t0):""),t2=e.references.filter(t=>{var r;return t.roomId===e.activeRoomId||"reference"===t.roomId&&e.activeRoomId===(null===(r=e.spaces[0])||void 0===r?void 0:r.id)}),t3=tQ||"search"===tG?T:t2,t5=[...e.references,...Object.values(e.workspaceAnnotations.sources||{})],t4=t3.find(e=>e.id===P),t6=("upload"===tG||"search"===tG||!!tQ)&&!!t4&&!H,t8=!!(tB&&Object.values(tH).some(e=>e.some(e=>e.targetPhotoId===tB.id))),t9=(t,r,n)=>{h.selectPhoto(t);let o=t=>{var r,n;let o=t.sourcePhotoId||t.id,a=null===(r=e.workspaceAnnotations.sources)||void 0===r?void 0:r[o];return a&&(a.roomId===e.activeRoomId||!a.roomId&&e.activeRoomId===(null===(n=e.spaces[0])||void 0===n?void 0:n.id))?{...t,id:o,roomId:e.activeRoomId,sourcePhotoId:o}:(0,I.hB)(t,e.activeRoomId)},a=o({...t,browseOrigin:n||t.browseOrigin});M(r.map(e=>o({...e,browseOrigin:n||e.browseOrigin}))),R(a.id),e.setWorkspaceAnnotations(e=>({...e,sources:{...e.sources,[a.id]:a}}))},t7=(t,r)=>{if(("redesign"===e.mode||"cleanup"===e.mode)&&e.onMode("inspiration"),X(!1),eL(!0),eM(r.id),"articleId"in t){h.selectPhoto(t);let e=(0,I.XL)(t,r.browseOrigin);"search"===e.source&&O(t=>{var r,n,o;return{...t,query:(null===(r=e.search)||void 0===r?void 0:r.query)||"",kind:(null===(n=e.search)||void 0===n?void 0:n.kind)||"all",article:e.article,professional:null===(o=e.search)||void 0===o?void 0:o.professional}}),Y({id:crypto.randomUUID(),referenceId:t.id,origin:e,pending:!0}),M([{...t,browseOrigin:e}]),_(e.source)}else Y(null),_("upload");R(t.id)},re=t=>{var r;if(!G||P!==G.referenceId||("search"===tG?"search":tQ)!==G.origin.source)return;Y(e=>(null==e?void 0:e.id)===G.id?{...e,pending:!1}:e);let n=null===(r=e.workspaceAnnotations.sources)||void 0===r?void 0:r[G.referenceId];n&&t9(n,[n,...t.filter(e=>(e.sourcePhotoId||e.id)!==(n.sourcePhotoId||n.id))],G.origin)},rt=(0,c.useRef)("");(0,c.useEffect)(()=>{rt.current="",R(""),M([]),_(null),Y(null),U(null),O(e2())},[e.projectId,e.accountKey]),(0,c.useEffect)(()=>
1{if(!e.projectId||tU||rt.current===e.projectId)return;let t=new URLSearchParams(window.location.search),r=t.get("project")===e.projectId;if(e.entryProfessional&&(!r||!t.get("panel")||"professionals"===t.get("panel"))){rt.current=e.projectId,U({id:e.entryProfessional.id,professional:e.entryProfessional}),_("professionals");return}if(e.entryArticle&&(!r||!t.get("panel")||"articles"===t.get("panel"))){rt.current=e.projectId,_("articles");return}if(tW)return;let n=r&&t.get("reference")||e.entryReferenceId,o=e.references.find(t=>t.id===n&&t.roomId===e.activeRoomId);(!n||o)&&(r&&"references"===t.get("panel")||o)&&(rt.current=e.projectId,_("upload"),o&&R(o.id))},[e.projectId,e.accountKey,tU,tW,e.entryProfessional,e.entryArticle,e.entryReferenceId,e.references,e.activeRoomId]),(0,c.useEffect)(()=>{"room"===tQ&&(R(""),M([])),Y(null)},[t$,t0]),(0,c.useEffect)(()=>{X(!1),eP("")},[P]),(0,c.useEffect)(()=>{eg(null),ev(!1),ej({x:0,y:0}),ex(1)},[P]),(0,c.useEffect)(()=>{if("connect"===ed&&!t6&&!t8){eu("move");return}tB||t6||"move"===ed||(eu("move"),eg(null),ev(!1),eI(null))},[tB,t6,ed,t8]),(0,c.useEffect)(()=>{eg(null),ev(!1),eI(null),ew.current=null},[ed]);let rr=e=>{tX(t=>({...t,[P]:(t[P]||[]).filter(t=>t.id!==e)})),tz(t=>({...t,[P]:(t[P]||[]).filter(t=>t.selectionId!==e)})),eP("")},rn=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.max(0,Math.min(1,(e.clientX-t.left)/t.width)),y:Math.max(0,Math.min(1,(e.clientY-t.top)/t.height))}},ro=e=>{if(e_){var t,r,n;let o=null===(t=tI.current)||void 0===t?void 0:t.getBoundingClientRect(),a=null===(n=tI.current)||void 0===n?void 0:null===(r=n.querySelector('[aria-label="Declutter photos"] img'))||void 0===r?void 0:r.getBoundingClientRect();if(tB&&o&&a&&e.clientX>=a.left&&e.clientX<=a.right&&e.clientY>=a.top&&e.clientY<=a.bottom){let t={id:crypto.randomUUID(),selectionId:e_.selectionId,targetPhotoId:tB.id,browseOrigin:t4&&"articleId"in t4?t4.browseOrigin:void 0,target:{x:(e.clientX-o.left)/o.width,y:(e.clientY-o.top)/o.height}},r=(tY[P]||[]).find(e=>e.id===t.selectionId);if(r){let n=K(r);t.quad=D({x:(e.clientX-a.left)/a.width,y:(e.clientY-a.top)/a.height},n.width/n.height*eO,a.width/a.height)}eL(!0),eM(t.id),tz(e=>({...e,[P]:[...e[P]||[],t]}))}eI(null)}if(ew.current=null,ef){if(em&&em.points.length>2||(null==em?void 0:em.kind)==="rectangle"){let e=(null==em?void 0:em.kind)==="lasso"&&em.points.length>2?{...em,points:[...em.points,em.points[0]]}:em;e&&(eP(e.id),tX(t=>({...t,[P]:[...t[P]||[],e]})))}e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),eg(null),ev(!1)}};(0,c.useEffect)(()=>{let t=tI.current;if(!t||tq||"move"!==ed||tU||e.uploadBlocked)return;let r=e=>{0===e.button&&e.isPrimary&&(e.target instanceof Element&&e.target.closest('button, a, input, select, textarea, [role="button"], [contenteditable="true"]')||(e.preventDefault(),t.setPointerCapture(e.pointerId),ek.current={point:{x:e.clientX,y:e.clientY},pan:tR}))};return t.addEventListener("pointerdown",r),()=>t.removeEventListener("pointerdown",r)},[tq,ed,tU,e.uploadBlocked,tR]);
1let ra=e=>{ek.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},ri=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"rectangle"===e.kind&&e.points.length>1?(0,n.jsx)("rect",{"data-selection-id":t?void 0:e.id,"data-selected":!t&&e.id===eS,className:t?el().referenceDraftShape:void 0,x:1e3*Math.min(e.points[0].x,e.points[1].x),y:1e3*Math.min(e.points[0].y,e.points[1].y),width:1e3*Math.abs(e.points[1].x-e.points[0].x),height:1e3*Math.abs(e.points[1].y-e.points[0].y)},e.id):t?(0,n.jsx)("polyline",{className:el().referenceDraftShape,points:e.points.map(e=>"".concat(1e3*e.x,",").concat(1e3*e.y)).join(" ")},e.id):(0,n.jsx)("polygon",{"data-selection-id":e.id,"data-selected":e.id===eS,style:e.strokes?{fill:"transparent"}:void 0,points:e.points.map(e=>"".concat(1e3*e.x,",").concat(1e3*e.y)).join(" ")},e.id)},rl=e.spaces.map(t=>({id:t.id,photos:e.photos.filter(e=>e.roomId===t.id)})),rs=e.activeRoomId,rc=rs?e.photos.filter(e=>e.roomId===rs):e.photos,rd=()=>{var e,t,r;let n=null===(e=tI.current)||void 0===e?void 0:e.getBoundingClientRect(),o=null===(r=tI.current)||void 0===r?void 0:null===(t=r.querySelector('[aria-label="Declutter photos"] img'))||void 0===t?void 0:t.getBoundingClientRect();return t5.flatMap(e=>(tH[e.id]||[]).filter(e=>e.targetPhotoId===(null==tB?void 0:tB.id)).flatMap(t=>{let r=(tY[e.id]||[]).find(e=>e.id===t.selectionId);return r?[{id:e.id,url:e.url,name:e.name,selection:r,quad:t.quad||(n&&o?B(z(t.target,n,o),K(r).width/K(r).height*(e.id===P?eO:1),o.width/o.height):void 0),target:t.quad?A(t.quad):n&&o?z(t.target,n,o):void 0}]:[]}))},ru=!!((null==G?void 0:G.pending)&&P===G.referenceId&&tG===G.origin.source),rp=t4?(0,n.jsxs)("div",{className:el().referencePanel,children:[(0,n.jsxs)("div",{className:el().referencePanelBar,children:[(0,n.jsxs)("button",{type:"button",onClick:()=>R(""),children:["← Back to ","search"===tG?W.article?"photos":"search":tQ?"photos":"gallery"]}),!e.placementBusy&&rd().length?(0,n.jsx)("button",{type:"button",className:el().layerControl,"aria-pressed":eA,"aria-label":eA?"Hide placements":"Show placements",title:eA?"Hide placements":"Show placements",onClick:()=>eL(e=>!e),children:(0,n.jsx)(u.G,{icon:eA?p.Mdf:p.Aq,"aria-hidden":"true"})}):null]}),(0,n.jsxs)("div",{className:el().referenceContent,children:[H?(0,n.jsx)("p",{className:el().referenceImageError,role:"alert",children:"This photo could not be loaded. Choose another photo or return to the gallery."}):null,(0,n.jsxs)("div",{ref:eU,className:el().referencePreview,children:[(0,n.jsx)("div",{ref:eB,className:el().referenceImageSurface,style:{"--reference-ratio":eO},children:(0,n.jsxs)("div",{className:el().referencePanLayer,style:{transform:"translate(".concat(ey.x,"px, ").concat(ey.y,"px) scale(").concat(eb,")")},children:[(0,n.jsx)("img",{decoding:"async",src:t4.url,alt:t4.name,draggable:!1,onError:()=>X(!0),onLoad:e=>{var t,r,n;X(!1),eq(e.currentTarget.naturalWidth/e.currentTarget.naturalHeight);let o=null===(t=tI.current)||void 0===t?void 0:t.getBoundingClientRect(),a=null===(n=tI.current)||void 0===n?void 0:null===(r=n.querySelector('[aria-label="Declutter photos"] img'))||void 0===r?void 0:r.getBoundingClientRect(),i=e.currentTarget.naturalWidth/e.currentTarget.naturalHeight;o&&a&&(tH[P]||[]).some(e=>e.targetPhotoId===(null==tB?void 0:tB.id)&&!e.quad)&&tz(e=>({...e,[P]:(e[P]||[]).map(e=>{let t=(tY[P]||[]).find(t=>t.id===e.selectionId);if(e.quad||e.targetPhotoId!==(null==tB?void 0:tB.id)||!t)return e;let r=K(t),n=B(z(e.target,o,a),r.width/r.height*i,a.width/a.height);return n?{...e,quad:n}:e})}))}}),(0,n.jsxs)("svg",{className:el().referenceSelectionLayer,"data-tool":ed,viewBox:"0 0 1000 1000",preserveAspectRatio:"none",onPointerDown:t=>{if(e.busy||H)return;let r=t.target.dataset.selectionId;if("move"===ed&&r){eP(r),eM("");return}if("connect"===ed){if(!r)return;t.currentTarget.setPointerCapture(t.pointerId),eP(r),eL(!0),eI({selectionId:r,x:t.clientX,y:t.clientY});return}if("move"===ed){t.currentTarget.setPointerCapture(t.pointerId),ew.current={point:{x:t.clientX,y:t.clientY},pan:ey};return}if("rectangle"!==ed&&"polygon"!==ed&&"lasso"!==ed)return;let n=rn(t);if("polygon"===ed){eg(e=>{if((null==e?void 0:e.kind)==="polygon"){let t=e.points[0];if(e.points.length>=3&&.035>Math.hypot(n.x-t.x,n.y-t.y)){let r={...e,points:[...e.points,t]};return eP(r.id),tX(e=>({...e,[P]:[...e[P]||[],r]})),null}return{...e,points:[...e.points,n]}}return{id:crypto.randomUUID(),kind:"polygon",points:[n]}});return}t.currentTarget.setPointerCapture(t.pointerId),ev(!0),eg({id:crypto.randomUUID(),kind:ed,points:[n,n]})},onPointerMove:e=>{if(e_){eI(t=>t?{...t,x:e.clientX,y:e.clientY}:null);return}if(ew.current){let t=ew.current;ej({x:t.pan.x+e.clientX-t.point.x,y:t.pan.y+e.clientY-t.point.y});return}if(!ef||!em)return;let t=rn(e);eg(e=>{if(!e)return e;if("rectangle"===e.kind)return{...e,points:[e.points[0],t]};let r=e.points[e.points.length-1];return e.points.length>=2047||.002>Math.hypot(t.x-r.x,t.y-r.y)?e:{...e,points:[...e.points,t]}})},onPointerUp:ro,onPointerCancel:ro,"aria-label":"Reference selection canvas",children:[(tY[P]||[]).map(e=>ri(e)),em?ri(em,!0):null]}),(tY[P]||[]).filter(e=>e.strokes&&e.id!==eS).map(e=>(0,n.jsx)(eE,{label:"Reference selection",strokes:e.strokes,onChange:()=>{},width:Math.round(1024*eO),height:1024,tool:"move"},e.id)),"paint"===ed||"erase"===ed||(null===(r=(tY[P]||[]).find(e=>e.id===eS))||void 0===r?void 0:r.strokes)?(0,n.jsx)(eE,{label:"Reference selection",strokes:q((tY[P]||[]).find(e=>e.id===eS)),onChange:e=>{let t=eS||crypto.randomUUID(),r=document.createElement("canvas");if(!(0,F.tG)(r,e,Math.round(1024*eO),1024)){tX(e=>({...e,[P]:(e[P]||[]).filter(e=>e.id!==t)})),tz(e=>({...e,[P]:(e[P]||[]).filter(e=>e.selectionId!==t)}));return}let n=r.getContext("2d").getImageData(0,0,r.width,r.height).data,o=r.width,a=r.height,i=0,l=0;for(let e=0;e<r.height;e++)for(let t=0;t<r.width;t++)n[(e*r.width+t)*4+3]>=128&&(o=Math.min(o,t),i=Math.max(i,t+1),a=Math.min(a,e),l=Math.max(l,e+1));let s={id:t,kind:"lasso",strokes:e,aspectRatio:eO,points:[{x:o/r.width,y:a/r.height},{x:i/r.width,y:a/r.height},{x:i/r.width,y:l/r.height},{x:o/r.width,y:l/r.height}]};tX(e=>({...e,[P]:[...(e[P]||[]).filter(e=>e.id!==t),s]})),eP(t)},width:Math.round(1024*eO),height:1024,tool:"paint"===ed||"erase"===ed?ed:"move",disabled:e.busy||H,controlsTarget:eY},"".concat(P,":").concat(eS)):null,(null==em?void 0:em.kind)==="polygon"?em.points.map((e,t)=>(0,n.jsx)("i",{className:el().referencePolygonNode,"data-start":0===t,style:{left:"".concat(100*e.x,"%"),top:"".concat(100*e.y,"%"),width:"".concat((0===t?8:6)/eb,"px"),height:"".concat((0===t?8:6)/eb,"px")}},t)):null,eS&&(()=>{let e=(tY[P]||[]).find(e=>e.id===eS);if(!e)return null;let t=Math.max(...e.points.map(e=>e.x)),r=Math.min(...e.points.map(e=>e.y));return(0,n.jsx)("button",{type:"button",className:el().selectionDeleteButton,"aria-label":"Delete selection",title:"Delete selection",style:{left:"".concat(100*t,"%"),top:"".concat(100*r,"%"),transform:"translate(35%, -65%) scale(".concat(1/eb,")")},onPointerDown:e=>e.stopPropagation(),onClick:()=>rr(e.id),children:(0,n.jsx)(u.G,{icon:p.$aW})})})()]})}),(0,n.jsx)("div",{ref:eH,className:el().referenceSelectionControls})]}),(0,n.jsxs)("div",{className:el().referenceFilmstrip,"aria-label":"Reference images","aria-busy":ru,children:[t3.map(t=>{let r=!tQ&&e.uploadingReferenceIds.includes(t.id);return(0,n.jsx)("div",{className:el().filmstripTile,children:(0,n.jsx)("button",{type:"button","aria-busy":r||void 0,"aria-label":"View ".concat(t.name).concat(r?", uploading":""),"aria-pressed":t.id===t4.id,onClick:()=>{tQ||"search"===tG?t9(t,T):R(t.id)},children:(0,n.jsx)(eT,{projectId:e.projectId||void 0,captureId:"captureId"in t?t.captureId:void 0,src:t.url,optimized:(0,I._K)(t.url),uploading:r})})},t.id)}),ru?Array.from({length:6},(e,t)=>(0,n.jsx)("div",{className:el().referenceFilmstripPlaceholder,"aria-hidden":"true",children:(0,n.jsx)("i",{className:el().thumbnailUploading})},"placeholder-".concat(t))):null]}),tB?(0,n.jsx)(n.Fragment,{children:e.renderReferenceEditor({...t4,selection:(tY[P]||[]).find(e=>e.id===eS),details:rd()})}):null]})]}):null,rh=(0,n.jsxs)("div",{className:el().referencePanel,children:[(0,n.jsx)("input",{ref:t_,className:el().srOnly,type:"file",accept:"image/*",multiple:!0,disabled:!e.signedIn||e.busy,"aria-label":"Upload inspiration references",onChange:t=>{e.signedIn&&!e.busy&&e.onAddReferences(t.target.files,tk.current||e.activeRoomId),t.target.value=""}}),t4?null:(0,n.jsx)(ts,{title:"Image to Image"}),t4?rp:t2.length?(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:el().referenceGrid,children:[t2.map(t=>{let r=!t.captureId&&e.uploadingReferenceIds.includes(t.id);return(0,n.jsxs)("div",{className:el().referenceCard,children:[(0,n.jsx)("button",{type:"button",className:el().referenceOpen,"aria-busy":r||void 0,"aria-label":"Open ".concat(t.name).concat(r?", uploading":""),onClick:()=>R(t.id),children:(0,n.jsx)("div",{className:el().referenceThumbnail,children:(0,n.jsx)(eT,{projectId:e.projectId||void 0,captureId:t.captureId,src:t.url,alt:t.name,uploading:r})})}),(0,n.jsx)("button",{type:"button",className:el().thumbnailDelete,"aria-label":"Delete reference ".concat(t.name),title:"Delete reference",disabled:e.busy||r,onClick:()=>
1e.onRemoveReference(t.id),children:(0,n.jsx)(u.G,{icon:p.$aW})})]},t.id)}),(0,n.jsx)("button",{type:"button",className:el().referenceAddTile,"aria-label":"Add reference images",title:"Add reference images",disabled:e.busy,onClick:tV,children:(0,n.jsx)(u.G,{icon:p.r8p})})]})}):(0,n.jsxs)("div",{className:el().referenceEmpty,children:[(0,n.jsx)(u.G,{icon:p.l9f}),(0,n.jsx)("span",{children:"UPLOAD A REFERENCE"}),(0,n.jsxs)("button",{type:"button",className:el().uploadButton,onClick:tV,children:[(0,n.jsx)(u.G,{icon:p.A$k}),"Upload from gallery"]}),(0,n.jsx)("small",{children:"Add one or multiple inspiration images."})]})]}),rm=tB?eh((null===(o=e.declutterEdits[tB.id])||void 0===o?void 0:o.versions)||[],tB.selectedGenerationId):void 0,rg=!tB||null===(d=null===(i=e.declutterEdits[tB.id])||void 0===i?void 0:i.backgroundLocked)||void 0===d||d,rf=async()=>{if(tB&&!w.current){w.current=!0,j(!0),x("");try{var t;let r=e.guidedTour?ti[tg||"original"]:null;await eN(r?{url:r.url,name:r.alt}:{projectId:e.projectId||void 0,generationId:null==rm?void 0:rm.id,captureId:rm?void 0:tB.captureId,url:(null==rm?void 0:rm.url)||tB.originalUrl||tB.url,name:(null==rm?void 0:rm.name)||(null===(t=e.declutterEdits[tB.id])||void 0===t?void 0:t.backgroundName)||"Original photo"})}catch(e){x(e instanceof Error?e.message:"The layer could not be downloaded. Please try again.")}finally{w.current=!1,j(!1)}}},rv=(0,n.jsxs)("div",{className:el().layersPanel,children:[(0,n.jsx)(ts,{title:"Layers",action:(0,n.jsx)("button",{type:"button",disabled:!tB||y,"aria-label":y?"Downloading layer":"Download selected layer",title:"Download selected layer","aria-busy":y,onClick:()=>void rf(),children:(0,n.jsx)(u.G,{icon:y?p.LM3:p.q7m,spin:y})})}),(0,n.jsxs)("div",{className:el().layerList,children:[e.guidedTour?(0,n.jsxs)("button",{type:"button",className:el().layerItem,onClick:()=>tf("final"),"aria-pressed":"final"===tg,"data-workspace-tour":"layers-final-space",children:[(0,n.jsx)(f.Z,{src:"/project-planning/hero-finished-space.webp",alt:"Finished room design"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Final Space"}),(0,n.jsx)("span",{children:"Completed design"})]})]}):null,e.guidedTour&&tB?(0,n.jsxs)("button",{type:"button",className:el().layerItem,onClick:()=>tf("decluttered"),"aria-pressed":"decluttered"===tg,"data-workspace-tour":"layers-decluttered",children:[(0,n.jsx)(f.Z,{src:"/project-planning/hero-unfinished-space.webp",alt:"Decluttered concrete room"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Decluttered"}),(0,n.jsx)("span",{children:"Cleaned construction site"})]})]}):tB?[...(null===(l=e.declutterEdits[tB.id])||void 0===l?void 0:l.versions)||[]].reverse().map(t=>{let r=ep(t,tB.selectedGenerationId);return(0,n.jsxs)("div",{className:el().layerItem,"data-displayed":(null==rm?void 0:rm.id)===t.id,children:[(0,n.jsx)(f.Z,{projectId:e.projectId||void 0,generationId:t.id,src:t.url,alt:""}),(0,n.jsxs)("div",{className:el().layerDescription,children:[(0,n.jsx)(eD,{name:t.name,disabled:e.busy,onSave:r=>e.onRenameLayer(tB.id,t.id,r)},"".concat(tB.id,":").concat(t.id)),(0,n.jsx)("span",{children:"reference"===t.kind?"Image to Image":"redesign"===t.kind?"Text to Image":"Edited layer"})]}),(0,n.jsx)("button",{type:"button",className:el().layerControl,disabled:e.busy||!!t.locked,"aria-pressed":r,"aria-label":"".concat(r?"Hide":"Show"," ").concat(t.name),title:t.locked?"Unlock this layer to change visibility":"".concat(r?"Hide":"Show"," ").concat(t.name),onClick:()=>e.onToggleLayer(tB.id,t.id,"visible"),children:(0,n.jsx)(u.G,{icon:r?p.Mdf:p.Aq})}),(0,n.jsx)("button",{type:"button",className:el().layerControl,disabled:e.busy,"aria-pressed":!!t.locked,"aria-label":"".concat(t.locked?"Unlock":"Lock"," ").concat(t.name),title:"".concat(t.locked?"Unlock":"Lock"," ").concat(t.name),onClick:()=>e.onToggleLayer(tB.id,t.id,"locked"),children:(0,n.jsx)(u.G,{icon:t.locked?p.byT:p._1N})})]},t.id)}):null,tB?e.guidedTour?(0,n.jsxs)("button",{type:"button",className:el().layerItem,onClick:()=>tf("original"),"aria-pressed":!tg||"original"===tg,"data-workspace-tour":"layers-original-photo",children:[(0,n.jsx)(f.Z,{src:"/project-planning/hero-construction-space.png",alt:"Original room"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"Original photo"}
1),(0,n.jsx)("span",{children:"Background"})]})]}):(0,n.jsxs)("div",{className:el().layerItem,"data-displayed":!rm,children:[(0,n.jsx)("span",{className:el().savedRoomThumbnail,children:(0,n.jsx)(eT,{projectId:e.projectId||void 0,captureId:tB.captureId,src:tB.originalUrl||tB.url})}),(0,n.jsxs)("div",{className:el().layerDescription,children:[(0,n.jsx)(eD,{name:(null===(s=e.declutterEdits[tB.id])||void 0===s?void 0:s.backgroundName)||"Original photo",disabled:e.busy,onSave:t=>e.onRenameLayer(tB.id,"original",t)},"".concat(tB.id,":original")),(0,n.jsx)("span",{children:"Background"})]}),(0,n.jsx)("span",{className:el().layerControl,title:"Background is always visible","aria-label":"Background is always visible",children:(0,n.jsx)(u.G,{icon:p.Mdf})}),(0,n.jsx)("button",{type:"button",className:el().layerControl,disabled:e.busy,"aria-pressed":rg,"aria-label":"".concat(rg?"Unlock":"Lock"," background"),title:"".concat(rg?"Unlock":"Lock"," background"),onClick:()=>e.onToggleLayer(tB.id,"original","locked"),children:(0,n.jsx)(u.G,{icon:rg?p.byT:p._1N})})]}):(0,n.jsx)("p",{children:"No photo selected."})]})]}),ry=async(t,r)=>{if($.current||et.current)return;let n=Z.trim();if(!n||n===r){J("");return}$.current=!0;try{await e.onRenameRoom(t,n)&&J(e=>e===t?"":e)}finally{$.current=!1}},rj=async()=>{if(!ei.current&&!e.busy&&eo.trim()){ei.current=!0;try{await e.onAddSpace(eo.trim())&&(ea(""),en(!1))}finally{ei.current=!1}}},rb=(0,n.jsxs)("div",{className:el().galleryPanel,children:[(0,n.jsx)(ts,{title:"Project Gallery",action:(0,n.jsx)("button",{type:"button","data-workspace-tour":"gallery-filmstrip-toggle","aria-label":C?"Hide filmstrip":"Show filmstrip",title:C?"Hide filmstrip":"Show filmstrip",onClick:()=>S(e=>!e),children:(0,n.jsx)(u.G,{icon:C?p.Mdf:p.Aq})})}),(0,n.jsxs)("div",{className:el().roomList,"data-workspace-tour":"gallery-spaces",children:[rl.map((t,r)=>{let o=e.roomLabels[t.id]||"Room ".concat(r+1),a=t.photos[0]?(0,n.jsx)("span",{className:el().savedRoomThumbnail,children:(0,n.jsx)(eT,{projectId:e.projectId||void 0,generationId:t.photos[0].selectedGenerationId,captureId:t.photos[0].captureId,src:t.photos[0].url})}):(0,n.jsx)("span",{className:el().emptyRoomThumbnail,"aria-hidden":"true",children:(0,n.jsx)(u.G,{icon:p._jT})}),i=(0,n.jsxs)("small",{children:[t.photos.length," photo",1===t.photos.length?"":"s"]}),l=e.occupiedSpaceIds.includes(t.id);return(0,n.jsxs)("div",{className:el().roomItem,"data-active":t.id===rs,children:[V===t.id?(0,n.jsxs)("div",{className:el().roomSelect,children:[a,(0,n.jsxs)("span",{className:el().roomText,children:[(0,n.jsx)("input",{className:el().roomTitleInput,value:Z,onChange:e=>Q(e.target.value),"aria-label":"Room name",maxLength:150,autoFocus:!0,readOnly:e.busy,onFocus:e=>e.currentTarget.select(),onBlur:()=>void ry(t.id,o),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.currentTarget.blur()),"Escape"===e.key&&(e.preventDefault(),et.current=!0,J(""))}}),i]})]}):(0,n.jsxs)("button",{className:el().roomSelect,type:"button",disabled:e.uploadBlocked,"aria-pressed":t.id===rs,onClick:()=>{e.onSelectRoom(t.id),t.photos[0]&&e.onSelectPhoto(t.photos[0].id),S(!0)},children:[a,(0,n.jsxs)("span",{className:el().roomText,children:[(0,n.jsx)("strong",{title:o,children:o}),i]})]}),(0,n.jsx)("button",{className:el().roomSettings,type:"button",disabled:e.busy||V===t.id,"aria-label":"Rename ".concat(o),title:"Rename ".concat(o),onClick:()=>{et.current=!1,J(t.id),Q(o)},children:(0,n.jsx)(u.G,{icon:p.IwR})}),(0,n.jsx)("button",{className:el().roomSettings,type:"button",disabled:e.busy||l||e.spaces.length<=1,"aria-label":"Delete ".concat(o),title:l?"Remove the photos and references in this space first":e.spaces.length<=1?"Keep at least one space in this project":"Delete ".concat(o),onClick:()=>void e.onRemoveSpace(t.id),children:(0,n.jsx)(u.G,{icon:p.$aW})})]},t.id)}),e.guidedTour?ta.map(e=>(0,n.jsx)("div",{className:"".concat(el().roomItem," ").concat(el().placeholderRoomItem),"aria-label":"".concat(e.name,", ").concat(e.photoCount," photos"),"aria-disabled":"true",children:(0,n.jsxs)("div",{className:el().placeholderRoomContent,children:[(0,n.jsx)("i",{"aria-hidden":"true",children:e.initials}),(0,n.jsxs)("span",{children:[(0,n.jsx)("strong",{children:e.name}),(0,n.jsxs)("small",{children:[e.photoCount," photos"]})]})]})},e.id)):null,rl.length?null:(0,n.jsx)("p",{children:"Upload a room photo to begin."}),e.canAddSpaces?er?(0,n.jsxs)("form",{className:el().addSpaceTile,onSubmit:e=>{e.preventDefault(),rj()},children:[(0,n.jsx)("input",{list:ec,value:eo,maxLength:150,autoFocus:!0,disabled:e.busy,"aria-label":"New space name",placeholder:"Choose or name a space",onChange:e=>ea(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),en(!1),ea(""))}}),(0,n.jsx)("datalist",{id:ec,children:[...e.spacePresets].sort((e,t)=>
1e.localeCompare(t,"en",{sensitivity:"base"})).map(e=>(0,n.jsx)("option",{value:e},e))}),(0,n.jsx)("button",{type:"submit",className:el().roomSettings,disabled:e.busy||!eo.trim(),"aria-label":"Save new space",title:"Add space",children:(0,n.jsx)(u.G,{icon:p.LEp})}),(0,n.jsx)("button",{type:"button",className:el().roomSettings,disabled:e.busy,"aria-label":"Cancel adding space",title:"Cancel",onClick:()=>{en(!1),ea("")},children:(0,n.jsx)(u.G,{icon:p.g82})})]}):(0,n.jsxs)("button",{type:"button",className:el().addSpaceTile,disabled:e.busy,onClick:()=>en(!0),children:[(0,n.jsx)(u.G,{icon:p.r8p,"aria-hidden":"true"}),"Add space"]}):null]})]}),rx=tG?(0,n.jsx)(eF.Provider,{value:h,children:(0,n.jsxs)("aside",{id:"desktop-dynamic-panel",className:el().dynamicPanel,"data-panel":tG,"aria-label":"gallery"===tG?"Project Gallery":"layers"===tG?"Layers":"search"===tG?"Search":(null==tF?void 0:tF.title)||"Inspiration",children:["search"===tG?(0,n.jsx)(tt,{onOpenProfessional:tZ,state:W,setState:O,initialOrigin:null==G?void 0:G.origin,onRestorePhotos:re,viewer:t4?rp:void 0,onOpenPhoto:t9,onExitViewer:()=>{R(""),M([])}},"".concat(e.accountKey,":").concat(e.projectId,":search:").concat((null==G?void 0:G.id)||"")):"gallery"===tG?rb:"layers"===tG?rv:"upload"===tG?rh:"prompt"===tG?null:"professionals"===tQ?(0,n.jsx)(e1,{onOpenProfessional:tZ,initialOrigin:(null==G?void 0:G.origin)||(L?{source:"professionals",filter:"",professional:L.professional}:void 0),onRestorePhotos:re,specialtyMenuTarget:e3,onSpecialtyChange:()=>{R(""),M([])},viewer:t4?rp:void 0,onOpenPhoto:t9},"".concat(e.accountKey,":").concat(e.projectId,":professionals:").concat((null==G?void 0:G.id)||(null==L?void 0:L.id)||"")):tQ?(0,n.jsx)(e$,{onOpenProfessional:tZ,source:tQ,initialRoom:"",initialOrigin:(null==G?void 0:G.origin)||("articles"===tQ&&e.entryArticle?{source:"articles",filter:"",article:e.entryArticle}:void 0),onRestorePhotos:re,initialStyle:e.preferredStyle,preloadedStyles:e.preloadedStyles,styleMenuTarget:eK,seriesMenuTarget:eJ,preloadedSeries:e4,roomMenuTarget:eQ,preloadedRooms:e.preloadedRooms,onBrowseFilterChange:()=>{R(""),M([])},viewer:t4?rp:void 0,onOpenPhoto:t9},"".concat(t1,":").concat((null==G?void 0:G.id)||"")):(0,n.jsx)("div",{className:el().sourcePanel,children:(0,n.jsx)(ts,{title:(null==tF?void 0:tF.title)||"Inspiration"})}),(0,n.jsx)("div",{ref:ez,className:el().contextTools,hidden:tU||"prompt"!==tG})]})}):null,rw=tu>=0?tl[tu]:null,rk=(null==rw?void 0:rw.section)?tl.filter(e=>e.section===rw.section):[],r_=(null==rw?void 0:rw.section)?"".concat(rw.section," \xb7 ").concat(rk.findIndex(e=>e.target===rw.target)+1," of ").concat(rk.length):"".concat(tu+1," of ").concat(tl.length),rI=!!(rw&&(rw.actionTarget||"right-gallery"===rw.target||"right-layers"===rw.target||"gallery-filmstrip-toggle"===rw.target)),rC=!!(rI&&!(null==rw?void 0:rw.actionTarget)&&(null==th?void 0:th.targetEnabled)),rS=e=>{var t;let r=null===(t=tl[e])||void 0===t?void 0:t.target;if(!r){tD();return}("setup-project-details"===r||"workspace-upload"===r)&&_(null),r in to?_(to[r]):r.startsWith("right-")&&_(r.slice(6)),r.startsWith("left-")&&_(null),("gallery-spaces"===r||"gallery-filmstrip-toggle"===r)&&(_("gallery"),S(!1)),"gallery-filmstrip"===r&&(_("gallery"),S(!0)),("layers-original-photo"===r||"layers-decluttered"===r||"layers-final-space"===r)&&(_("layers"),"layers-original-photo"===r&&tf("original"),"layers-decluttered"===r&&tf("decluttered")),tp(e)},rN=()=>{var e;if(!rw||!(null==th?void 0:th.targetEnabled))return;let t=rw.actionTarget||rw.target,r=null===(e=m.current)||void 0===e?void 0:e.querySelector('[data-workspace-tour="'.concat(t,'"]'));r instanceof HTMLButtonElement&&!r.disabled&&(r.click(),rI&&rS(Math.min(tu+1,tl.length-1)))},rP=tg?ti[tg]:null;return(0,n.jsxs)("div",{ref:m,className:el().app,"data-team-open":"team"===tG,"data-setup-open":tU,"data-uploading-references":e.uploadingReferenceIds.length>0,onErrorCapture:t=>{t.target instanceof HTMLImageElement&&e.onImageError(t.target.currentSrc||t.target.src)},children:[(0,n.jsx)(es,{onRename:e.busy||tO?void 0:e.onRenameProject,title:tO?"Guided tour":e.title.trim()||(e.hasProject?"Untitled project":"New project"),guidedTour:tO,archiveDisabled:!e.signedIn||e.busy,closeDisabled:e.busy,onArchive:e.onSaved,onClose:tO?tD:e.onExit,status:tO?null:e.signedIn?(0,n.jsxs)("span",{"data-error":!!(e.error||"unsaved"===e.saveStatus),role:"status",children:[(0,n.jsx)("i",{className:el().documentDot}),e.error?"Not saved":"saving"===e.saveStatus?"Saving…":"unsaved"===e.saveStatus?"Not saved":"saved"===e.saveStatus?"Saved":"Not saved yet"]}):(0,n.jsxs)("button",{type:"button",className:el().loginToSave,disabled:e.busy,onClick:e.onSignIn,children:[(0,n.jsx)("i",{className:el().documentDot}),"Login to save"]})},"".concat(e.accountKey,":").concat(e.projectId)),(0,n.jsxs)("aside",{className:el().toolRail,"aria-label":"Editing tools",children:[(0,n.jsx)("div",{className:el().workspaceToolGroup,role:"toolbar","aria-label":"Workspace selection tools",children:[["move","Move",p.qaO,!1],["rectangle","Rectangle select",p._mi,!tB&&!t6],["polygon","Polygon select",p.ubJ,!tB&&!t6],["lasso","Lasso select",p.Cuc,!tB&&!t6],["paint","Brush",p.XsY,!tB&&!t6],["erase","Eraser",p.xf2,!tB&&!t6],["connect","Connect selection to image",p.nNP,!t6&&!t8||!tB]].map(t=>{let[r,o,a,i]=t;return(0,n.jsxs)("button",{type:"button","data-workspace-tour":"left-".concat(r),"aria-label":o,"aria-pressed":!tq&&ed===r,disabled:tU||i||("move"===r?e.uploadBlocked:e.busy),onClick:()=>{("paint"===r||"erase"===r)&&t6&&!eS&&eP(crypto.randomUUID()),eu(r),"connect"===r&&eL(!0),"cleanup"===e.mode&&e.onMode("photos")},children:[(0,n.jsx)(u.G,{icon:a}),(0,n.jsx)("span",{children:o})]},r)})}),(0,n.jsx)("div",{className:el().toolRailDivider}),(0,n.jsx)("div",{className:el().workspaceToolGroup,children:(0,n.jsxs)("button",{type:"button","data-workspace-tour":"left-declutter-full","aria-label":"Empty room","aria-pressed":tq&&!tU&&!!tB,disabled:tU||!tB||e.busy,onClick:()=>
1{if(e.guidedTour){eu("move");return}e.onAiAction(()=>{eu("move"),e.onCleanupTool("full")})},children:[(0,n.jsx)(u.G,{icon:p.Z30}),(0,n.jsx)("span",{children:"Empty room"})]})}),(0,n.jsx)("div",{className:el().toolRailDivider,"aria-hidden":"true"}),(0,n.jsxs)("div",{className:el().workspaceToolGroup,children:[(0,n.jsx)("div",{ref:e9,className:el().historyToolsMount,children:tU||!tB?(0,n.jsxs)("div",{className:el().workspaceToolGroup,role:"toolbar","aria-label":"Edit history","aria-orientation":"vertical",children:[(0,n.jsxs)("button",{type:"button",disabled:!0,"aria-label":"Undo",children:[(0,n.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M9 7 4 12l5 5"}),(0,n.jsx)("path",{d:"M5 12h8a6 6 0 0 1 6 6"})]}),(0,n.jsx)("span",{children:"Undo"})]}),(0,n.jsxs)("button",{type:"button",disabled:!0,"aria-label":"Redo",children:[(0,n.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"m15 7 5 5-5 5"}),(0,n.jsx)("path",{d:"M19 12h-8a6 6 0 0 0-6 6"})]}),(0,n.jsx)("span",{children:"Redo"})]})]}):null}),(0,n.jsxs)("button",{type:"button",disabled:tU||e.uploadBlocked,onClick:()=>{tP(1),tE({x:0,y:0}),tM("50% 50%"),t6&&(ex(1),ej({x:0,y:0}))},"aria-label":"Fit photos to screen",children:[(0,n.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5"})}),(0,n.jsx)("span",{children:"Fit"})]})]}),(0,n.jsx)("div",{className:el().toolRailDivider,"aria-hidden":"true"}),(0,n.jsx)("div",{className:el().workspaceToolGroup,children:(0,n.jsxs)("button",{type:"button","aria-label":"Take photos with your phone",disabled:tU||e.busy||e.guidedTour,onClick:e.onPhoneCapture,children:[(0,n.jsx)(u.G,{icon:p.D_B,"aria-hidden":"true"}),(0,n.jsx)("span",{children:"Take photos with your phone"})]})})]}),(0,n.jsx)(eG,{panel:rx,open:!!tG,resizable:!!(tG&&"prompt"!==tG&&"gallery"!==tG&&"layers"!==tG),workspace:(0,n.jsxs)("section",{className:el().center,"aria-label":tU?"Project setup":"Photo workspace",children:[(0,n.jsx)("input",{className:el().srOnly,ref:tj,type:"file",accept:"image/*",multiple:!0,disabled:!e.signedIn||tU||e.uploadBlocked,"aria-label":"Upload room photos",onChange:t=>{var r;if(e.signedIn&&!tU&&!e.uploadBlocked&&(null===(r=t.target.files)||void 0===r?void 0:r.length)){let r=tb.current||e.activeRoomId;e.onAdd(t.target.files,r),e.onSelectRoom(r),S(!0)}t.target.value=""}}),(0,n.jsxs)("div",{className:el().workspaceContent,children:[tU?(0,n.jsx)("div",{className:el().setupCanvas,children:(0,n.jsxs)("form",{className:el().setupForm,"data-workspace-tour":"setup-project-details","aria-label":"Project setup",noValidate:!0,onSubmit:t=>{t.preventDefault(),e.configured&&!e.busy&&e.onCompleteSetup()},children:[(0,n.jsx)("span",{className:el().eyebrow,children:"SETUP"}),(0,n.jsx)("fieldset",{className:el().configuration,disabled:e.busy||tu>=0,"aria-label":"Project details",children:e.configuration}),e.error?(0,n.jsx)("p",{className:el().error,role:"alert",children:e.error}):null,(0,n.jsxs)("div",{className:el().setupActions,children:[(0,n.jsx)("button",{type:"button",className:el().sandboxButton,disabled:e.busy,onClick:()=>{tv.current=!0,tf(null),tp(0)},children:"Take a tour"}),(0,n.jsxs)("button",{type:"submit",className:el().primary,disabled:!e.configured||e.busy,children:["Start new project ",(0,n.jsx)("span",{"aria-hidden":"true",children:"→"})]})]})]})}
1):(0,n.jsxs)("div",{ref:tI,className:el().canvasBody,"data-dragging":tc,"data-move-tool":"move"===ed&&!tq,onPointerMove:e=>{if(!ek.current)return;let t=ek.current;tE({x:t.pan.x+e.clientX-t.point.x,y:t.pan.y+e.clientY-t.point.y})},onPointerUp:ra,onPointerCancel:ra,onLostPointerCapture:ra,onDragOver:t=>{tq||e.uploadBlocked||(t.preventDefault(),td(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||td(!1)},onDrop:t=>{t.preventDefault(),td(!1),tq||e.uploadBlocked||!t.dataTransfer.files.length||tK(()=>{let r=tB?e.activeRoomId:(null==tx?void 0:tx.id)||e.activeRoomId;e.onAdd(t.dataTransfer.files,r),e.onSelectRoom(r),S(!0)})},children:[(0,n.jsx)("div",{className:el().zoomSurface,style:{"--canvas-zoom":tN,"--canvas-pan-x":"".concat(tR.x,"px"),"--canvas-pan-y":"".concat(tR.y,"px"),"--zoom-origin":tT},children:tB?(0,n.jsxs)(n.Fragment,{children:[e.renderPhotoSurface(null,e8,e7,tq,ed),rP?(0,n.jsx)("img",{className:el().guidedLayerPreview,src:rP.url,alt:rP.alt}):null]}):(0,n.jsxs)("div",{className:el().emptyCanvas,"data-workspace-tour":"workspace-upload",children:[(0,n.jsxs)("div",{className:el().emptyUploadCopy,children:[(0,n.jsx)("span",{className:el().eyebrow,children:"SEE YOUR SPACE DIFFERENTLY"}),(0,n.jsxs)("h2",{children:["A fresh start.",(0,n.jsx)("br",{}),"From your own room."]}),(0,n.jsx)("p",{children:"Drop your room photos here, or choose them from your device."}),e.recoveryNotice?(0,n.jsx)("div",{className:el().recoveryNotice,role:"status",children:e.recoveryNotice}):null,(0,n.jsxs)("div",{className:el().uploadActions,"data-multi-space":e.canAddSpaces||e.spaces.length>1||void 0,children:[e.canAddSpaces||e.spaces.length>1?(0,n.jsxs)("label",{className:el().uploadSpacePicker,children:[(0,n.jsx)("span",{"aria-hidden":"true",children:tx?tw(tx):"Choose a space"}),(0,n.jsx)(u.G,{icon:p.ptq,"aria-hidden":"true"}),(0,n.jsxs)("select",{"aria-label":"Upload photos to space",value:(null==tx?void 0:tx.id)||"",disabled:e.uploadBlocked,onChange:t=>e.onSelectUploadRoom(t.target.value),children:[(0,n.jsx)("option",{value:"",disabled:!0,children:"Choose a space"}),e.spaces.map(e=>(0,n.jsx)("option",{value:e.id,children:tw(e)},e.id))]})]}):null,(0,n.jsxs)("button",{type:"button",className:el().uploadButton,disabled:e.uploadBlocked||!tx,"aria-label":e.canAddSpaces||e.spaces.length>1?"Upload photos to ".concat((null==tx?void 0:tx.label)||"selected space"):void 0,title:e.canAddSpaces||e.spaces.length>1?"Upload photos to ".concat((null==tx?void 0:tx.label)||"selected space"):void 0,onClick:()=>tK(()=>{var t;tb.current=(null==tx?void 0:tx.id)||e.activeRoomId,null===(t=tj.current)||void 0===t||t.click()}),children:[(0,n.jsx)(u.G,{icon:p.A$k}),!e.canAddSpaces&&e.spaces.length<=1?"Upload room photos":null]})]}),e.collectingPhotos&&e.photos.length>0?(0,n.jsx)("div",{className:el().uploadProgress,children:(0,n.jsxs)("button",{type:"button",className:el().uploadAdvance,disabled:e.busy||e.photos.some(e=>!e.captureId&&!e.isSample),onClick:e.onAdvancePhotos,children:["Advance ",(0,n.jsx)("span",{"aria-hidden":"true",children:"→"})]})}):null]}),(0,n.jsx)("div",{className:el().emptyPhoneEntry,ref:e.phoneCaptureMount,children:!e.signedIn||e.guidedTour?(0,n.jsxs)("div",{className:el().phoneEntryPlaceholder,children:[(0,n.jsx)("span",{className:el().eyebrow,children:"FROM YOUR PHONE"}),(0,n.jsx)("h3",{children:"Photograph your space"}),(0,n.jsx)("p",{children:"A QR code connects your phone’s camera directly to your project."}),(0,n.jsx)("button",{type:"button",className:"".concat(el().uploadButton," ").concat(el().phoneUploadButton),disabled:e.guidedTour,onClick:e.onPhoneCapture,children:e.guidedTour?"Available in your own project":"Sign in to connect your phone"})]}):null})]})}),(0,n.jsx)("div",{ref:te,className:el().cleanupActionMount}),"prompt"===tG?(0,n.jsx)("div",{className:el().promptPortalMount,children:e.renderEditor(eX,null)}):null]}),C&&!e.collectingPhotos?(0,n.jsxs)("div",{className:el().filmstrip,"data-workspace-tour":"gallery-filmstrip","aria-label":"Room photos",children:[rc.map((t,r)=>(0,n.jsxs)("div",{className:el().filmstripTile,children:[(0,n.jsxs)("button",{type:"button","aria-label":"Select ".concat(t.name).concat(t.captureId||t.isSample?"":", uploading"),"aria-pressed":t.id===(null==tB?void 0:tB.id),disabled:tU||e.uploadBlocked,onClick:()=>e.onSelectPhoto(t.id),children:[(0,n.jsx)(eT,{projectId:e.projectId||void 0,generationId:t.selectedGenerationId,captureId:t.captureId,src:t.url,uploading:!t.captureId&&!t.isSample}),(0,n.jsx)("span",{children:String(r+1).padStart(2,"0")})]}),t.id!==(null==tB?void 0:tB.id)||t.isSample?null:(0,n.jsx)("button",{type:"button",className:el().thumbnailDelete,"aria-label":"Delete room photo ".concat(t.name),title:"Delete room photo",disabled:tU||e.busy,onClick:()=>e.onRemove(t.id),children:(0,n.jsx)(u.G,{icon:p.$aW})})]},t.id)),(0,n.jsx)("button",{type:"button",className:el().addTile,"aria-label":"Add another room photo",title:"Add another room photo",disabled:tU||e.uploadBlocked,onClick:()=>tK(()=>{var t;tb.current=e.activeRoomId,null===(t=tj.current)||void 0===t||t.click()}),children:(0,n.jsx)(u.G,{icon:p.r8p})})]}):null]})]})}),g?(0,n.jsx)(eC,{active:"team"===tG,title:e.title,location:e.location,onLocationChange:e.onLocationChange,idea:e.idea,projectId:e.projectId,photos:e.photos,references:e.references,rooms:e.spaces,edits:e.declutterEdits,annotations:e.workspaceAnnotations,team:e.projectTeam,setTeam:e.setProjectTeam,onBack:()=>_("layers")},"".concat(e.accountKey,":").concat(e.projectId,":team")):null,(0,n.jsxs)("aside",{className:el().panelRail,"aria-label":"Panels",children:[(0,n.jsxs)("button",{type:"button","data-workspace-tour":"right-gallery","aria-label":"Project Gallery",disabled:tU,"aria-pressed":"gallery"===tG,onClick:()=>
1{if(tU)return;let t=()=>_(e=>tu>=0?"gallery":"gallery"===e?null:"gallery");e.guidedTour?t():tK(t)},children:[(0,n.jsx)(u.G,{icon:p.l9f}),(0,n.jsx)("span",{className:el().railText,children:"Project Gallery"}),(0,n.jsx)("span",{role:"tooltip",children:"Browse photos grouped by room"})]}),(0,n.jsxs)("button",{type:"button","data-workspace-tour":"right-layers","aria-label":"Layers",disabled:tW,"aria-pressed":"layers"===tG,onClick:()=>{if(tW)return;let t=()=>{_(e=>tu>=0?"layers":"layers"===e?null:"layers"),"redesign"===e.mode&&e.onMode("inspiration")};e.guidedTour?t():tK(t)},children:[(0,n.jsx)(u.G,{icon:p.Krp}),(0,n.jsx)("span",{className:el().railText,children:"Layers"}),(0,n.jsx)("span",{role:"tooltip",children:"View edits layered over the original photo"})]}),(0,n.jsx)("div",{className:el().panelRailDivider}),tn.map(t=>(0,n.jsxs)(c.Fragment,{children:[(0,n.jsxs)("button",{type:"button","data-workspace-tour":"right-".concat(t.id),"aria-label":t.title,"aria-expanded":"style"===t.id||"articles"===t.id||"room"===t.id||"professionals"===t.id?tG===t.id:void 0,"aria-controls":"style"===t.id?"desktop-style-submenu":"articles"===t.id?"desktop-series-submenu":"room"===t.id?"desktop-room-submenu":"professionals"===t.id?"desktop-specialty-submenu":void 0,disabled:tW&&!(!tU&&(e.entryArticle&&"articles"===t.id||e.entryProfessional&&"professionals"===t.id)),"aria-pressed":tG===t.id,onClick:()=>{if(e.guidedTour){tJ(t.id,!0);return}let r=()=>tJ(t.id);"prompt"===t.id?e.onAiAction(r):tK(r)},children:[(0,n.jsx)(u.G,{icon:t.icon}),(0,n.jsx)("span",{className:el().railText,children:tr[t.id]}),"style"===t.id||"articles"===t.id||"room"===t.id||"professionals"===t.id?(0,n.jsx)(u.G,{icon:p.ptq,className:el().submenuChevron}):null,(0,n.jsx)("span",{role:"tooltip",children:t.description})]}),"style"===t.id&&"style"===tG?(0,n.jsx)("div",{id:"desktop-style-submenu",className:el().styleSubmenu,ref:eV,role:"group","aria-label":"Design styles"}):null,"articles"===t.id&&"articles"===tG?(0,n.jsx)("div",{id:"desktop-series-submenu",className:el().styleSubmenu,ref:eZ,role:"group","aria-label":"Article series"}):null,"room"===t.id&&"room"===tG?(0,n.jsx)("div",{id:"desktop-room-submenu",className:el().styleSubmenu,ref:e0,role:"group","aria-label":"Room types"}):null,"professionals"===t.id&&"professionals"===tG?(0,n.jsx)("div",{id:"desktop-specialty-submenu",className:el().styleSubmenu,ref:e5,role:"group","aria-label":"Professional specialties"}):null,"upload"===t.id?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:el().panelRailDivider,"aria-hidden":"true"}),(0,n.jsxs)("button",{type:"button","aria-label":"Search inspiration","aria-pressed":"search"===tG,disabled:tW,onClick:()=>tK(()=>{_(e=>"search"===e?null:"search"),R(""),M([]),Y(null),("redesign"===e.mode||"cleanup"===e.mode)&&e.onMode("inspiration")}),children:[(0,n.jsx)(u.G,{icon:p.Y$T}),(0,n.jsx)("span",{className:el().railText,children:"Search"}),(0,n.jsx)("span",{role:"tooltip",children:"Search photos, articles, and professionals"})]})]}):null]},t.id)),(0,n.jsx)("div",{className:el().panelRailDivider,"aria-hidden":"true"}),(0,n.jsxs)("button",{type:"button",disabled:!0,children:[(0,n.jsx)(u.G,{icon:p.lTt}),(0,n.jsx)("span",{className:el().railText,children:"Cost estimation"}),(0,n.jsx)("span",{role:"tooltip",children:"Cost estimation \xb7 Coming soon"})]}),(0,n.jsxs)("button",{type:"button",disabled:!g||tW||e.busy,"aria-pressed":"team"===tG,onClick:()=>{g&&(_(e=>"team"===e?"layers":"team"),R(""),M([]),Y(null),("redesign"===e.mode||"cleanup"===e.mode)&&e.onMode("inspiration"))},children:[(0,n.jsx)(u.G,{icon:p.FVb}),(0,n.jsx)("span",{className:el().railText,children:"Build your team"}),(0,n.jsx)("span",{role:"tooltip",children:"Find and hire professionals through our platform"})]})]}),rw&&th?(0,n.jsxs)("div",{className:el().guidedTourLayer,role:"dialog","aria-modal":"true","aria-labelledby":"workspace-tour-title",children:[(0,n.jsx)("div",{className:el().guidedTourHighlight,style:th.target,role:rC?"button":void 0,tabIndex:rC?0:-1,"aria-label":rC?"Try ".concat(rw.title):void 0,"data-enabled":rC,onClick:rC?rN:void 0,onKeyDown:e=>
1{rC&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),rN())}}),rw.actionTarget?(0,n.jsx)("div",{className:el().guidedTourActionTarget,style:th.actionTarget,role:"button",tabIndex:th.targetEnabled?0:-1,"aria-label":rw.actionLabel||"Continue from ".concat(rw.title),"aria-disabled":!th.targetEnabled,onClick:rN,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),rN())}}):null,rI?(0,n.jsx)("span",{className:el().guidedTourTargetArrow,style:th.targetArrow,"aria-hidden":"true",children:(0,n.jsx)(u.G,{icon:p.eFW})}):null,(0,n.jsxs)("section",{className:el().guidedTourBubble,style:th.bubble,children:[(0,n.jsx)("div",{className:el().guidedTourProgress,children:r_}),(0,n.jsx)("h2",{id:"workspace-tour-title",children:rw.title}),(0,n.jsx)("p",{children:rw.description}),(0,n.jsxs)("div",{className:el().guidedTourActions,children:[(0,n.jsx)("button",{type:"button",className:el().guidedTourHide,onClick:tD,children:"Hide tour"}),(0,n.jsxs)("div",{children:[tu>0?(0,n.jsx)("button",{type:"button",className:el().guidedTourBack,onClick:()=>{(null==rw?void 0:rw.target)==="workspace-upload"&&e.onReturnToSandboxSetup(),(null==rw?void 0:rw.target)==="right-gallery"&&e.onReturnToSandboxUpload(),rS(tu-1)},children:"Back"}):null,(0,n.jsx)("button",{ref:ty,type:"button",className:el().guidedTourNext,disabled:rI,onClick:()=>{(null==rw?void 0:rw.target)==="setup-project-details"&&e.onOpenSandboxUpload(),(null==rw?void 0:rw.target)==="workspace-upload"&&e.onOpenSandbox(),tu===tl.length-1?tD():rS(tu+1)},children:tu===tl.length-1?"Finish":"Next"})]})]})]})]}):null,tB&&!tU&&"team"!==tG&&eA&&!e.placementBusy&&(()=>{var t,r,o,a,i;let l=t6?null===(t=eB.current)||void 0===t?void 0:t.getBoundingClientRect():void 0,s=t6?null===(r=eU.current)||void 0===r?void 0:r.getBoundingClientRect():void 0,c=null===(o=tI.current)||void 0===o?void 0:o.getBoundingClientRect(),d=null===(i=tI.current)||void 0===i?void 0:null===(a=i.querySelector('[aria-label="Declutter photos"] img'))||void 0===a?void 0:a.getBoundingClientRect(),h=(e,t)=>!!(t&&t.width>0&&t.height>0&&e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom),m=tY[P]||[],g=(e,t)=>{var r;let n=m.find(t=>t.id===e);if(!l||!(null==n?void 0:n.points.length))return null;let o="rectangle"===n.kind&&n.points.length>1?[{x:n.points[0].x,y:n.points[0].y},{x:n.points[1].x,y:n.points[0].y},{x:n.points[1].x,y:n.points[1].y},{x:n.points[0].x,y:n.points[1].y}]:n.points.filter((e,t,r)=>0===t||e.x!==r[t-1].x||e.y!==r[t-1].y);if(o.length<2)return null;let a=o.reduce((e,t)=>({x:e.x+t.x/o.length,y:e.y+t.y/o.length}),{x:0,y:0}),i=e=>({x:l.left+ey.x+(.5+(e.x-.5)*eb)*l.width,y:l.top+ey.y+(.5+(e.y-.5)*eb)*l.height}),s=i(a),c={x:t.x-s.x,y:t.y-s.y},d=[];return o.forEach((e,t)=>{let r=i(e),n=i(o[(t+1)%o.length]),a={x:n.x-r.x,y:n.y-r.y},l=c.x*a.y-c.y*a.x;if(1e-4>Math.abs(l))return;let u={x:r.x-s.x,y:r.y-s.y},p=(u.x*a.y-u.y*a.x)/l,h=(u.x*c.y-u.y*c.x)/l;p>=0&&h>=0&&h<=1&&d.push({point:{x:s.x+c.x*p,y:s.y+c.y*p},distance:p})}),d.sort((e,t)=>e.distance-t.distance),(null===(r=d[0])||void 0===r?void 0:r.point)||s},v=(tH[P]||[]).filter(e=>e.targetPhotoId===(null==tB?void 0:tB.id)).map(e=>{if(!c)return null;let t=e.quad?A(e.quad):null,r=t&&d?{x:d.left+t.x*d.width,y:d.top+t.y*d.height}:{x:c.left+e.target.x*c.width,y:c.top+e.target.y*c.height},o=g(e.selectionId,r);if(!o||!h(o,s)||!h(r,c)||!h(r,d))return null;let a=Math.max(70,.38*Math.abs(r.x-o.x));return(0,n.jsx)("path",{d:"M ".concat(o.x," ").concat(o.y," C ").concat(o.x-a," ").concat(o.y,", ").concat(r.x+a," ").concat(r.y,", ").concat(r.x," ").concat(r.y)},e.id)}),y=e_?g(e_.selectionId,{x:e_.x,y:e_.y}):null;if(y&&e_&&h(y,s)){let e=Math.max(70,.38*Math.abs(e_.x-y.x));v.push((0,n.jsx)("path",{className:el().activeConnection,d:"M ".concat(y.x," ").concat(y.y," C ").concat(y.x-e," ").concat(y.y,", ").concat(e_.x+e," ").concat(e_.y,", ").concat(e_.x," ").concat(e_.y)},"active"))}let j=e_?((e,t)=>{let r=(tY[e]||[]).find(e=>e.id===t);if(!(null==r?void 0:r.points.length))return null;let n=r.points.map(e=>e.x),o=r.points.map(e=>e.y);return{x:Math.min(...n),y:Math.min(...o),width:Math.max(.01,Math.max(...n)-Math.min(...n)),height:Math.max(.01,Math.max(...o)-Math.min(...o))}})(P,e_.selectionId):null,b=c&&d?Object.entries(tH).flatMap(e=>{let[t,r]=e;return r.filter(e=>e.targetPhotoId===(null==tB?void 0:tB.id)).map(e=>{let r=t5.find(e=>e.id===t),o=(tY[t]||[]).find(t=>
1t.id===e.selectionId);if(!r||!o)return null;let a=K(o),i=e.quad||B(z(e.target,c,d),a.width/a.height*(t===P?eO:1),d.width/d.height);return!i||d.width<=0||d.height<=0?null:(0,n.jsx)(ee,{url:r.url,selection:o,quad:i,image:d,canvas:c,selected:e.id===eR,editable:"connect"===ed,onOpenSource:()=>t7(r,e),onSelect:()=>{eM(e.id),eP("")},onChange:r=>tz(n=>({...n,[t]:(n[t]||[]).map(t=>t.id===e.id?{...t,quad:r}:t)})),onDelete:()=>{tz(r=>({...r,[t]:(r[t]||[]).filter(t=>t.id!==e.id)})),eM("")}},e.id)})}):[];return(0,n.jsxs)(n.Fragment,{children:["connect"===ed?(0,n.jsx)("svg",{className:el().connectionOverlay,"aria-hidden":"true",children:v}):null,b,"connect"===ed&&e_&&j?function(t,r,o,a,i){let l=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6?arguments[6]:void 0,d=t5.find(e=>e.id===r);return d?(0,n.jsxs)("div",{className:"".concat(el().selectionDragPreview," ").concat(l?el().selectionDragPreviewActive:el().connectionMarker),"data-selected":(null==s?void 0:s.id)===eR,style:{left:o,top:a,aspectRatio:i.width/i.height},onPointerDown:s?e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),eM(s.id),eP("")}:void 0,onPointerMove:s?e=>{if(!e.currentTarget.hasPointerCapture(e.pointerId)||!c)return;let t={x:Math.max(0,Math.min(1,(e.clientX-c.left)/c.width)),y:Math.max(0,Math.min(1,(e.clientY-c.top)/c.height))};tz(e=>({...e,[r]:(e[r]||[]).map(e=>e.id===s.id?{...e,target:t}:e)}))}:void 0,onPointerUp:s?e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}:void 0,children:[(0,n.jsx)(f.Z,{src:d.url,projectId:e.projectId||void 0,captureId:"captureId"in d?d.captureId:void 0,alt:"",style:{width:"".concat(100/i.width,"%"),height:"".concat(100/i.height,"%"),left:"".concat(-(100*i.x)/i.width,"%"),top:"".concat(-(100*i.y)/i.height,"%")}}),s?(0,n.jsx)("button",{type:"button","aria-label":"Delete connector",title:"Delete connector",onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),tz(e=>({...e,[r]:(e[r]||[]).filter(e=>
1e.id!==s.id)})),eM("")},children:(0,n.jsx)(u.G,{icon:p.$aW})}):null]},t):null}("active-preview",P,e_.x,e_.y,j,!0):null]})})()]})}var td=r(65697),tu=r(30561),tp=r.n(tu),th=r(14979),tm=r(50529);let tg=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",minimumFractionDigits:0,maximumFractionDigits:2}).format(e/100);async function tf(e,t){let r=await (0,eK.C3)();if(!r)throw Error("Your account session has expired. Please sign in again.");let n=await fetch((0,i.D)("".concat(e)),{...t,cache:"no-store",headers:{Authorization:"Bearer ".concat(r),...(null==t?void 0:t.body)?{"Content-Type":"application/json"}:{}}}),o=await n.json().catch(()=>null);if(!n.ok)throw Error((null==o?void 0:o.error)||"The credit service could not be reached.");return o}function tv(e){let{open:t,requiredCredits:r,availableCredits:o,onClose:i,onCreditsAvailable:l}=e,[s,u]=(0,c.useState)([]),[p,h]=(0,c.useState)(!1),[m,g]=(0,c.useState)("idle"),[f,v]=(0,c.useState)(""),[y,j]=(0,c.useState)(null),[b,x]=(0,c.useState)(null),[w,k]=(0,c.useState)(null),[_,I]=(0,a.O)(""),C=(0,c.useRef)(0);if((0,c.useEffect)(()=>{if(t){if(j(null),v(""),"ready"===m){I("");return}"idle"===m&&(h(!0),g("loading"),I(""),Promise.all([tf("StartProject/credits/packages"),tf("StartProject/credits/mode"),(0,tm.f)(tf).catch(()=>null)]).then(e=>{let[t,r,n]=e;u(Array.isArray(t)?t.map(e=>{var t,r,n,o;return{code:String(e.code||e.Code||""),name:String(e.name||e.Name||""),credits:Number(null!==(r=null!==(t=e.credits)&&void 0!==t?t:e.Credits)&&void 0!==r?r:0),amountCents:Number(null!==(o=null!==(n=e.amountCents)&&void 0!==n?n:e.AmountCents)&&void 0!==o?o:0),currency:String(e.currency||e.Currency||"USD")}}).filter(e=>e.code&&e.credits>0):[]),x("live"===String((null==r?void 0:r.mode)||(null==r?void 0:r.Mode)||"")?"live":"sandbox"),k(n),g("ready")}).catch(e=>{g("error"),I(e instanceof Error?e.message:"Credit packages are unavailable.")}).finally(()=>h(!1)))}},[t,I]),(0,c.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow;document.body.style.overflow="hidden";let r=e=>{"Escape"===e.key&&i()};return document.addEventListener("keydown",r),()=>{document.body.style.overflow=e,document.removeEventListener("keydown",r)}},[t,i]),!t)return null;let S=async e=>{let t=++C.current;v(e.code),j(null),I("");try{let r=await tf("StartProject/me/credits/checkout",{method:"POST",body:JSON.stringify({packageCode:e.code,clientRequestId:crypto.randomUUID()})});if(t!==C.current)return;let n="live"===r.mode?"live":"sandbox";if(!String(r.clientSecret||"").startsWith("live"===n?"cs_live_":"cs_test_")||!String(r.publishableKey||"").startsWith("live"===n?"pk_live_":"pk_test_"))throw Error("Stripe returned an invalid checkout.");j({clientSecret:r.clientSecret,publishableKey:r.publishableKey,mode:n,creditPackage:e})}catch(e){v(""),I(e instanceof Error?e.message:"Checkout could not be opened.")}},N=async()=>{j(null),v("");for(let n=0;n<12;n+=1){await new Promise(e=>window.setTimeout(e,n?1500:500));try{var e,t;let n=await tf("StartProject/me/credits"),o=Number(null!==(t=null!==(e=n.availableCredits)&&void 0!==e?e:n.AvailableCredits)&&void 0!==t?t:0);if(o>=r){l(o),i();return}}catch(e){}}I("Payment was submitted. This AI tool needs ".concat(r.toLocaleString()," credits; your balance will refresh as soon as Stripe confirms the purchase."))},P="idle"===m||"loading"===m||p;return(0,d.createPortal)((0,n.jsx)("div",{className:tp().overlay,"aria-busy":P,onMouseDown:e=>{e.target===e.currentTarget&&i()},children:P?null:(0,n.jsxs)("section",{className:tp().dialog,"data-checkout":!!y,role:"dialog","aria-modal":"true","aria-labelledby":"project-credit-gate-title",children:[(0,n.jsx)("button",{type:"button",className:tp().close,"aria-label":"Close",onClick:i,children:"\xd7"}),(0,n.jsx)("p",{className:tp().eyebrow,children:"AI CREDITS"}),(0,n.jsx)("h2",{id:"project-credit-gate-title",children:"Choose a package to continue"}),y?null:(0,n.jsx)("p",{className:tp().usageNote,children:"Each image count uses the full package at that quality. Counts are not combined."}),y||"sandbox"!==b?null:(0,n.jsx)("span",{className:tp().sandbox,children:"SA
1NDBOX"}),y?(0,n.jsx)(td.Z,{clientSecret:y.clientSecret,publishableKey:y.publishableKey,packageName:y.creditPackage.name,credits:y.creditPackage.credits,price:tg(y.creditPackage.amountCents,y.creditPackage.currency),mode:y.mode,tone:"project",onCancel:()=>{C.current+=1,j(null),v("")},onComplete:()=>void N()}):(0,n.jsx)("div",{className:tp().packages,children:s.length?s.map(e=>(0,n.jsxs)("article",{className:tp().package,children:[(0,n.jsx)("p",{children:e.name}),(0,n.jsx)("strong",{children:e.credits.toLocaleString()}),w?(0,n.jsx)(th.Z,{credits:e.credits,rates:w}):(0,n.jsx)("p",{className:tp().ratesUnavailable,children:"Image counts are temporarily unavailable."}),(0,n.jsx)("div",{className:tp().packageAction,children:(0,n.jsx)("button",{type:"button",disabled:!!f,onClick:()=>void S(e),children:f===e.code?"Preparing checkout…":"Buy credits \xb7 ".concat(tg(e.amountCents,e.currency))})})]},e.code)):(0,n.jsx)("p",{children:"No credit packages are available right now."})})]})}),document.body)}var ty=r(41722),tj=r.n(ty);function tb(e){let{title:t,error:r,onBack:o,onClose:a,onRetry:i}=e;return(0,n.jsxs)("main",{className:tj().workspace,"aria-label":"Opening project workspace",children:[(0,n.jsx)(es,{title:t.trim()||"Untitled project",onArchive:o,onClose:a,status:(0,n.jsx)("span",{"data-error":!!r,children:r?"Couldn’t open":"Opening…"})}),(0,n.jsx)("section",{className:tj().canvas,children:r?(0,n.jsxs)("div",{className:tj().message,role:"alert",children:[(0,n.jsx)("h2",{children:"Couldn’t open this project"}),(0,n.jsx)("p",{children:r}),(0,n.jsx)("button",{type:"button",onClick:i,children:"Try again"})]}):(0,n.jsxs)("div",{className:tj().message,role:"status","aria-live":"polite",children:[(0,n.jsx)("span",{className:tj().spinner,"aria-hidden":"true"}),(0,n.jsx)("p",{children:"Opening your project…"})]})})]})}var tx=r(12376);let tw=()=>({versions:[]});async function tk(){var e,t,r,n;let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"standard",a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=a?"reference":"text",l=await (0,G.WY)("redesign/quote?qualityTier=".concat(o,"&generationMode=").concat(i));if((null!==(e=l.qualityTier)&&void 0!==e?e:l.QualityTier)!==o||a&&(null!==(t=l.generationMode)&&void 0!==t?t:l.GenerationMode)!==i)throw Error("Generation quality options are being updated. Please try again shortly.");let s=Number(null!==(r=l.creditsRequired)&&void 0!==r?r:l.CreditsRequired),c=Number(null!==(n=l.availableCredits)&&void 0!==n?n:l.AvailableCredits);if(!Number.isFinite(s)||!Number.isFinite(c))throw Error("The generation cost could not be confirmed.");return{qualityTier:o,generationMode:i,creditsRequired:s,availableCredits:c,hasEnoughCredits:c>=s}}async function t_(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return;let r=await new Promise((t,r)=>{let n=new Image;n.onload=()=>t(n),n.onerror=()=>r(Error("The selected room photo could not be opened.")),n.src=e.url});return(0,F.dp)(t,r.naturalWidth,r.naturalHeight)}async function tI(e,t){if(!t.selectedGenerationId&&!t.captureId)return{photo:t,release:()=>{}};let r=await (0,eS.VL)({projectId:e,...t.selectedGenerationId?{generationId:t.selectedGenerationId}:{captureId:t.captureId}}),n=URL.createObjectURL(r);return{photo:{...t,url:n},release:()=>URL.revokeObjectURL(n)}}async function tC(e,t){if(t.captureId&&!t.selectedGenerationId)return t.captureId;let r=await new Promise((e,r)=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth,height:n.naturalHeight}),n.onerror=()=>r(Error("The chosen photo could not be opened. Please reopen the project.")),n.src=t.url});return(0,G.Zv)(e,{...r,id:crypto.randomUUID(),roomId:t.roomId,name:t.selectedGenerationId?"decluttered-space.png":t.name,url:t.url,sourceGenerationId:t.selectedGenerationId})}function tS(e){return{...e,versions:e.versions.map(e=>({...e,url:"",sourceUrl:void 0})),job:e.job?{...e.job,sourceUrl:void 0,generation:e.job.generation?{...e.job.generation,url:void 0}:void 0}:void 0}}async function tN(e,t){var r;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>(0,G.oG)(e,t);if(!t)return tw();let o=new Map,a=e=>(o.has(e)||o.set(e,n(e)),o.get(e)),i=await Promise.all(t.versions.map(async e=>{let t=await a(e.id);if(!t.url)throw Error("A generated design could not be loaded. Please try again.");let r=e.sourceGenerationId?await a(e.sourceGenerationId):void 0;return{...e,url:t.url,sourceUrl:null==r?void 0:r.url}})),l=(null===(r=t.job)||void 0===r?void 0:r.sourceGenerationId)?await a(t.job.sourceGenerationId):void 0;return{...t,versions:i,job:t.job?{...t.job,sourceUrl:null==l?void 0:l.url}:void 0}}function tP(e){return Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,{...r,versions:r.versions.map(e=>({...e,url:""})),job:r.job?{...r.job,generation:r.job.generation?{...r.job.generation,url:void 0}:void 0}:void 0}]}))}function tR(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a={...t};return{photos:e.map(e=>{var i;let l=r.versions.filter(t=>t.photoId===e.id);if(!l.length)return e;let s=t[e.id]||{versions:[],masks:{},captureIds:{}},c=l.filter(e=>!s.versions.some(t=>t.id===e.id)),d=(null===(i=r.selectedByPhoto)||void 0===i?void 0:i[e.id])||r.selectedId,u=n||(o&&c.some(e=>e.id===d)?d:void 0);if(!c.length&&!l.some(e=>e.id===u))return e;let p=em(s.versions,e.selectedGenerationId);p.push(...c.map(e=>({id:e.id,url:e.url,name:"Design ".concat(l.indexOf(e)+1),kind:e.reference?"reference":"redesign",visible:!1,locked:!1})));let h=p.find(e=>e.id===u);h&&!(h.locked&&!h.visible)&&(p=[...p.filter(e=>e.id!==h.id),{...h,visible:!0}]),a[e.id]={...s,versions:p};let m=eh(p),g=e.originalUrl||e.url;return{...e,originalUrl:g,url:(null==m?void 0:m.url)||g,selectedGenerationId:null==m?void 0:m.id}}),edits:a}}function tE(e,t){return{...e,versions:e.versions.map(e=>{var r,n,o;let a=(null===(r=t[e.photoId])||void 0===r?void 0:r.versions)||[];return{...e,url:(null===(n=a.find(t=>
1t.id===e.id))||void 0===n?void 0:n.url)||e.url,sourceUrl:(null===(o=a.find(t=>t.id===e.sourceGenerationId))||void 0===o?void 0:o.url)||e.sourceUrl}})}}var tT=r(88222);async function tM(e){let t=new Map,r=r=>(t.has(r)||t.set(r,(0,G.oG)(e.id,r)),t.get(r)),[n,o]=await Promise.all([(async()=>{let[t,n]=await Promise.all([(0,G.$Q)(e.id),(0,k.ED)(e.id)]),o={allowMissing:!0,captures:Promise.resolve(t)},[a,i]=await Promise.all([(0,tx.hA)(e.id,e.photos||[],o),(0,tx.hA)(e.id,e.references||[],o)]),l=(0,k.If)(a,n.filter(e=>"reference"!==e.destination)),s=(0,tT.sh)(t),c=i.map(e=>{let t=s.find(t=>t.captureId===e.captureId);return t?{...e,articleReference:t.articleReference}:e}),d=(0,k.If)((0,k.If)(c,s),n.filter(e=>"reference"===e.destination)),u={};return await Promise.all(l.map(async t=>{var n;let o=(null===(n=e.declutterEdits)||void 0===n?void 0:n[t.id])||{versions:[],masks:{},captureIds:{}},a=await Promise.all(o.versions.map(async e=>{let t=await r(e.id);if(!t.url)throw Error("An edited photo could not be loaded. Please try again.");return{...e,url:t.url}}));u[t.id]={...o,versions:em(a,t.selectedGenerationId),captureIds:{...o.captureIds,original:t.captureId}};let i=eh(a,t.selectedGenerationId);t.selectedGenerationId=null==i?void 0:i.id,i&&(t.originalUrl=t.url,t.url=i.url)})),{photos:l,references:d,edits:u}})(),tN(e.id,e.redesign,r)]);return{...tR(n.photos,n.edits,o,void 0,!0),references:n.references,designs:o,missingPhotoCount:(e.photos||[]).filter(e=>!n.photos.some(t=>t.id===e.id||e.captureId&&t.captureId===e.captureId)).length,missingReferenceCount:(e.references||[]).filter(e=>!n.references.some(t=>t.id===e.id||e.captureId&&t.captureId===e.captureId)).length}}function tA(e,t){if(!t||t.id!==e.id)return e;let r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return[...e,...t.filter(t=>!e.some(e=>e.id===t.id||t.captureId&&e.captureId===t.captureId))]};return{...e,photos:r(e.photos,t.photos),references:r(e.references,t.references),declutterEdits:{...t.declutterEdits,...e.declutterEdits}}}var tL=r(82829),tD=r(38483),tB=r.n(tD);let tU=e=>Math.min(100,Math.max(0,e)),tW=e=>Math.min(96,Math.max(4,e)),tO=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function tG(){let e=(0,c.useRef)(null),t=(0,c.useRef)(!1),r=(0,c.useRef)(100),o=(0,c.useRef)(100),a=(0,c.useRef)(!1),i=(0,c.useRef)(()=>void 0),[l,s]=(0,c.useState)(100),[d,u]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let e=window.matchMedia("(prefers-reduced-motion: reduce)").matches;e&&(r.current=50,o.current=50,s(50));let n=0,a=performance.now(),l=[{time:0,value:100},{time:650,value:100},{time:3200,value:0},{time:3750,value:0},{time:5100,value:50}],c=e=>{r.current=e,s(e)},d=i=>{let s=!0;if(t.current){let e=r.current,t=o.current,n=.02>Math.abs(t-e),a=n?t:e+(t-e)*.105;a!==e&&c(a),s=!n}else if(e)c(50),s=!1;else{let e=i-a,t=l.findIndex(t=>t.time>=e);if(-1===t)c(50),s=!1;else if(0===t)c(l[0].value);else{let r=l[t-1],n=l[t],o=tO(tU((e-r.time)/(n.time-r.time)));c(r.value+(n.value-r.value)*o)}}n=s?window.requestAnimationFrame(d):0};return i.current=()=>{n||(n=window.requestAnimationFrame(d))},i.current(),()=>{i.current=()=>void 0,n&&window.cancelAnimationFrame(n)}},[]),(0,c.useEffect)(()=>{let r=()=>{o.current=50,u(!1),i.current()},n=n=>{var a;if("mouse"!==n.pointerType)return;let l=null===(a=e.current)||void 0===a?void 0:a.getBoundingClientRect();if(l){if(!(n.clientY>=l.top&&n.clientY<=l.bottom&&n.clientX>=l.left&&n.clientX<=l.right)){r();return}t.current=!0,u(!0),o.current=tW((n.clientX-l.left)/l.width*100),i.current()}};return window.addEventListener("pointermove",n,{passive:!0}),window.addEventListener("blur",r),document.documentElement.addEventListener("mouseleave",r),()=>{window.removeEventListener("pointermove",n),window.removeEventListener("blur",r),document.documentElement.removeEventListener("mouseleave",r)}},[]);let p=t=>{var r;let n=null===(r=e.current)||void 0===r?void 0:r.getBoundingClientRect();n&&(o.current=tW((t.clientX-n.left)/n.width*100),i.current())},h=()=>{t.current=!0,u(!0)},m=e=>{a.current=!1,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},g=Math.round(100-l);return(0,n.jsxs)("div",{ref:e,className:"".concat(tB().frame," ").concat(d?tB().interactive:tB().demonstrating),role:"slider",tabIndex:0,"aria-label":"Compare the unfinished construction shell with the finished space","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":g,"aria-valuetext":"".concat(g,"% finished render visible"),onPointerMove:e=>{"mouse"!==e.pointerType&&a.current&&(h(),p(e))},onPointerDown:e=>
1{h(),a.current="mouse"!==e.pointerType,e.currentTarget.setPointerCapture(e.pointerId),p(e)},onPointerUp:m,onPointerCancel:m,onPointerLeave:e=>{"mouse"!==e.pointerType&&(a.current=!1,o.current=50,u(!1),i.current())},onKeyDown:e=>{let t=o.current;if("ArrowLeft"===e.key)t-=4;else if("ArrowRight"===e.key)t+=4;else if("Home"===e.key)t=4;else{if("End"!==e.key)return;t=96}e.preventDefault(),h(),o.current=tW(t),i.current()},children:[(0,n.jsx)(et.default,{className:tB().image,src:"/project-planning/hero-unfinished-space.webp",alt:"",fill:!0,priority:!0,sizes:"100vw"}),(0,n.jsx)("div",{className:tB().renderLayer,style:{clipPath:"inset(0 0 0 ".concat(l,"%)")},"aria-hidden":"true",children:(0,n.jsx)(et.default,{className:tB().image,src:"/project-planning/hero-finished-space.webp",alt:"",fill:!0,priority:!0,sizes:"100vw"})}),(0,n.jsx)("span",{className:tB().drawingLabel,"aria-hidden":"true",children:"Unfinished shell"}),(0,n.jsx)("span",{className:tB().renderLabel,"aria-hidden":"true",children:"Finished space"}),(0,n.jsx)("span",{className:tB().divider,style:{left:"".concat(l,"%")},"aria-hidden":"true"}),(0,n.jsx)("span",{className:tB().hint,"aria-hidden":"true",children:"Move to reveal"})]})}function tF(e){var t;let r=["quick-capture","whole-home"].includes(e.projectType||""),n=Math.max(1,Math.min(7,e.step||1)),o=r?e.captureStage||(n<=2&&(null===(t=e.photos)||void 0===t?void 0:t.some(e=>e.captureId))?"declutter":void 0):void 0,a="details"===o?void 0:o;return{step:"details"===o?2:a?1:n,captureStage:a,number:"details"===o?1:"capture"===a?2:"declutter"===a?3:"inspiration"===a?4:n<=2?1:n+(r?2:-1),total:r?9:6}}var tq=r(93421),tY=r(67812),tH=r.n(tY);function tX(e){let{value:t,onChange:r,disabled:o=!1,referencePricing:a=!1}=e,i=tq.t.find(e=>e.value===t);return(0,n.jsxs)("label",{className:tH().control,title:"".concat(i.description).concat(a?" \xb7 Includes reference analysis":""),children:[(0,n.jsx)("span",{"aria-hidden":"true",children:i.label}),(0,n.jsx)("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",fill:"none",children:(0,n.jsx)("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,n.jsx)("select",{"aria-label":"Generation quality",value:t,disabled:o,onChange:e=>r(e.target.value),children:(0,n.jsx)("optgroup",{label:a?"Includes reference analysis":"Generation quality",children:tq.t.map(e=>(0,n.jsxs)("option",{value:e.value,children:[e.label," — ",e.description]},e.value))})})]})}var tz=r(82870),tK=r(91199),tV=r.n(tK);function tJ(e){var t,r,o,i,l,s;let{qualityTier:u,onQualityChange:p,projectId:h,photo:m,prompt:g,onPromptChange:v,state:y,persist:j,ensureProject:b,onBack:x,onContinue:w,onBusyChange:k,onInsufficientCredits:_,desktop:I=!1,toolsTarget:C,reference:S,onProgressChange:N,selectionStrokes:P}=e,[R,E]=(0,c.useState)(null),T=y.job?!!y.job.reference:!!S,M=y.job?null!==(l=y.job.qualityTier)&&void 0!==l?l:"standard":u,A=(null==R?void 0:R.generationMode)===(T?"reference":"text")&&(null==R?void 0:R.qualityTier)===M?R:null,[L,D]=(0,a.O)(""),[B,U]=(0,c.useState)(""),[W,O]=(0,c.useState)(!1),[F,q]=(0,c.useState)(!1),[Y,H]=(0,c.useState)(null),[z,K]=(0,c.useState)(null),J=(0,c.useRef)(null),Z=(0,c.useRef)(null),Q=(0,c.useRef)(null),$=(0,c.useRef)(!1),ee=(0,c.useRef)(0),et=(0,c.useRef)(!1),er=(0,c.useRef)(y);async function en(){let e=++ee.current;q(!0),D(""),E(null);try{var t;let r=await tk(er.current.job?null!==(t=er.current.job.qualityTier)&&void 0!==t?t:"standard":u,er.current.job?!!er.current.job.reference:!!S);et.current&&e===ee.current&&E(r)}catch(t){et.current&&e===ee.current&&D(t instanceof Error&&!t.message.includes("404")?t.message:"Generation is not available yet. You can still write and save your idea.")}finally{et.current&&e===ee.current&&q(!1)}}async function eo(){var e,t,r,n,o,a;let i=g.trim()||(S?(null===(e=S.details)||void 0===e?void 0:e.length)?"Apply the connected details to my room, preserving everything else.":S.selection?"Apply only this selected detail to my room.":"Redesign my room using the whole reference, including its major fixtures, cabinetry, furnishings and finishes where they fit. Preserve my room’s structure, openings, camera and perspective.":"");
1if(!m||er.current.job&&er.current.job.photoId!==m.id||$.current||!er.current.job&&!i)return;$.current=!0,D(""),H({photoId:m.id,prompt:(null===(t=er.current.job)||void 0===t?void 0:t.prompt)||i}),U("Checking AI credits…");let l=er.current;try{let e,t=l.job;if(!(null==t?void 0:t.generation)){q(!0);let e=await tk(t?null!==(r=t.qualityTier)&&void 0!==r?r:"standard":u,t?!!t.reference:!!S);if(!et.current)return;if(E(e),q(!1),!e.hasEnoughCredits){null==_||_(e,()=>void eo());return}}if(O(!0),k(!0),!t){if((null==S?void 0:null===(n=S.details)||void 0===n?void 0:n.length)&&i.length>X)throw Error("Shorten your prompt to leave room for the connected-detail instructions.");U("Preparing your chosen photo…");let e=await b(),r=l.versions.find(e=>{var t;return e.id===(I?m.selectedGenerationId:(null===(t=l.selectedByPhoto)||void 0===t?void 0:t[m.id])||l.selectedId)&&e.photoId===m.id}),a=r?{...m,url:r.url,selectedGenerationId:r.id}:m,s=a.selectedGenerationId||!S&&(null==P?void 0:P.length)||(null==S?void 0:null===(o=S.details)||void 0===o?void 0:o.some(e=>e.quad))?await tI(e,a):{photo:a,release:()=>{}};try{let n=S?void 0:await t_(s.photo,P),o=await tC(e,s.photo),l=S?await V(e,m.roomId,S,s.photo):void 0;t={projectId:e,photoId:m.id,sourceGenerationId:a.selectedGenerationId,sourceUrl:a.url,baseVersionId:null==r?void 0:r.id,captureId:o,requestId:crypto.randomUUID(),qualityTier:u,prompt:i,mask:n,reference:l}}finally{s.release()}l={...l,job:t},await j(l,!0)}if(t.generation||await j({...l,job:t},!0),U("Creating your redesign…"),t.generation)e=await (0,G.oG)(t.projectId,t.generation.id);else{U("Checking AI credits…");let r=await tk(null!==(a=t.qualityTier)&&void 0!==a?a:"standard",!!t.reference);if(et.current&&E(r),!r.hasEnoughCredits){null==_||_(r,()=>void eo());return}U("Creating your redesign…"),e=await function(e){var t,r;let n=[null===(t=e.reference)||void 0===t?void 0:t.instructions,e.prompt].filter(Boolean).join("\n\n");if(n.length>1600)throw Error("Shorten your prompt to leave room for the connected-detail instructions.");return(0,G.WY)("projects/".concat(encodeURIComponent(e.projectId),"/captures/").concat(encodeURIComponent(e.captureId),"/").concat(e.reference?"reference-redesign":"redesign"),{clientRequestId:e.requestId,qualityTier:null!==(r=e.qualityTier)&&void 0!==r?r:"standard",prompt:n,reference:e.reference,...!e.reference&&e.mask?{mask:e.mask}:{}}).then(G.A_)}(t)}et.current&&E(t=>(0,G.XW)(t,e)),t={...t,generation:e},l={...l,job:t},await j(l,!0);let s=e;for(let e=0;e<280;e++){if(et.current&&U((0,G.T2)(s.phase)),"failed"===s.status||"cancelled"===s.status)throw await j({...l,job:void 0}),et.current&&v(t.prompt),Error(s.error||"Generation did not finish. Your source photo is still available.");if("succeeded"===s.status&&s.url){let e={id:s.id,url:s.url,photoId:t.photoId,sourceGenerationId:t.sourceGenerationId,sourceUrl:t.sourceUrl,baseVersionId:t.baseVersionId,reference:t.reference,prompt:t.prompt};await j({...l,job:void 0,selectedId:s.id,versions:[...l.versions.filter(e=>
1e.id!==s.id),e]},!0),et.current&&(U("Your redesign is ready."),en());return}if(!et.current||(await new Promise(e=>setTimeout(e,3e3)),!et.current))return;s=await (0,G.oG)(t.projectId,s.id),et.current&&E(e=>(0,G.XW)(e,s))}et.current&&U("Your design is still processing. Check progress again shortly.")}catch(e){et.current&&D(e instanceof tz.p1?"":e instanceof Error?e.message:"Generation could not be completed. Check progress to retry safely.")}finally{$.current=!1,et.current&&(H(null),q(!1),O(!1),k(!1))}}er.current=y,(0,c.useEffect)(()=>(et.current=!0,()=>{et.current=!1,k(!1)}),[k]),(0,c.useEffect)(()=>{var e;null===(e=J.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"nearest"})},[y.versions.length,null===(t=y.job)||void 0===t?void 0:t.requestId,null==Y?void 0:Y.prompt,B]),(0,c.useEffect)(()=>{var e,t;z?null===(e=Q.current)||void 0===e||e.showModal():null===(t=Q.current)||void 0===t||t.close()},[z]),(0,c.useEffect)(()=>{let e=Z.current;e&&(e.style.height="auto",e.style.height="".concat(Math.min(e.scrollHeight,160),"px"))},[g]),(0,c.useEffect)(()=>{K(null),D(""),U("")},[null==m?void 0:m.id,D]),(0,c.useEffect)(()=>{var e;null==N||N(W&&m?{photoId:(null===(e=y.job)||void 0===e?void 0:e.photoId)||m.id,message:B||"Creating your redesign…"}:null)},[W,B,null==m?void 0:m.id,null===(r=y.job)||void 0===r?void 0:r.photoId,N]),(0,c.useEffect)(()=>()=>null==N?void 0:N(null),[N]),(0,c.useEffect)(()=>(en(),()=>{ee.current++}),[u,T]);let ea=y.versions.find(e=>{var t;return e.id===(I?null==m?void 0:m.selectedGenerationId:(null===(t=y.selectedByPhoto)||void 0===t?void 0:t[(null==m?void 0:m.id)||""])||y.selectedId)&&e.photoId===(null==m?void 0:m.id)}),ei=y.versions.filter(e=>e.photoId===(null==m?void 0:m.id)),el=(null===(o=y.job)||void 0===o?void 0:o.photoId)===(null==m?void 0:m.id)?y.job:void 0,es=(null==el?void 0:el.sourceUrl)||((null==el?void 0:el.photoId)===(null==m?void 0:m.id)?null==m?void 0:m.url:void 0),ec=(null==el?void 0:el.prompt)||((null==Y?void 0:Y.photoId)===(null==m?void 0:m.id)?null==Y?void 0:Y.prompt:void 0),ed=!!(ei.length||ec),eu=(null==ea?void 0:ea.url)||(null==m?void 0:m.url),ep=ei.findIndex(e=>e.id===(null==ea?void 0:ea.id)),eh=ea?"Design ".concat(ep+1):(null==m?void 0:m.selectedGenerationId)?"Decluttered photo":"Original photo",em=!!(m&&(g.trim()||S)&&(null==A?void 0:A.hasEnoughCredits)&&!F&&!W&&!y.job),eg=(e,t)=>K({url:e,title:t}),ef=()=>{A&&!A.hasEnoughCredits&&(null==_||_(A,()=>void eo()))},ev=(0,n.jsxs)("div",{className:tV().composerDock,children:[L&&!A?(0,n.jsx)("button",{type:"button",disabled:F,onClick:()=>void en(),children:"Retry credit check"}):null,y.job&&!el?(0,n.jsx)("p",{className:tV().preparing,role:"status",children:"A design is pending for another photo. Open that photo to continue it."}):null,(0,n.jsxs)("form",{className:tV().composer,onSubmit:e=>{e.preventDefault(),em&&eo()},children:[S||ed||!eu?null:(0,n.jsxs)("button",{type:"button",className:tV().attachment,onClick:()=>eg(eu,eh),"aria-label":"Preview attached ".concat(eh.toLowerCase()),children:[(0,n.jsx)(f.Z,{src:eu,projectId:h,captureId:null==m?void 0:m.captureId,generationId:(null==ea?void 0:ea.id)||(null==m?void 0:m.selectedGenerationId),alt:"Your attached space"}),(0,n.jsx)("span",{children:eh})]}),!S&&ed&&eu?(0,n.jsxs)("button",{type:"button",className:tV().editing,onClick:()=>eg(eu,eh),children:[(0,n.jsx)(f.Z,{src:eu,projectId:h,captureId:null==m?void 0:m.captureId,generationId:(null==ea?void 0:ea.id)||(null==m?void 0:m.selectedGenerationId),alt:""}),(0,n.jsxs)("span",{children:["Editing ",eh.toLowerCase()]})]}):null,(0,n.jsx)("label",{htmlFor:"design-message",className:tV().srOnly,children:ed?"Describe your next changes":"Describe your redesign"}),(0,n.jsx)("textarea",{id:"design-message",ref:Z,value:g,onChange:e=>v(e.target.value),disabled:W||!!y.job,rows:2,maxLength:(null==S?void 0:null===(i=S.details)||void 0===i?void 0:i.length)?X:1600,placeholder:S?"Describe what to bring into your room (optional)…":ed?"What would you like to change?":"Describe your space…"}),(0,n.jsxs)("div",{className:tV().composerFooter,children:[(0,n.jsxs)("div",{className:tV().creditStatus,children:[(0,n.jsx)("span",{id:"design-credit-cost",children:F?"Checking credits…":A?"".concat(A.creditsRequired," credits per image \xb7 ").concat(A.availableCredits," available"):"Credit check unavailable"}),!A||A.hasEnoughCredits||y.job?null:(0,n.jsx)("button",{type:"button",className:tV().creditLink,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),ef()},onClick:e=>{e.preventDefault(),e.stopPropagation(),0===e.detail&&ef()},children:"Get credits now."})]}
1),(0,n.jsxs)("div",{className:tV().sendControls,children:[(0,n.jsx)(tX,{referencePricing:T,value:y.job?null!==(s=y.job.qualityTier)&&void 0!==s?s:"standard":u,onChange:e=>{E(null),q(!0),p(e)},disabled:W||F||!!Y||!!y.job}),(0,n.jsx)("button",{type:"submit",className:tV().send,disabled:!em,"aria-label":W?"Generating design":"Send and generate design","aria-describedby":"design-credit-cost",children:(0,n.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M12 19V5m-6 6 6-6 6 6"})})})]})]})]}),(0,n.jsxs)("div",{className:tV().chatActions,hidden:!!S,children:[(0,n.jsx)("button",{type:"button",className:tV().back,disabled:W,onClick:x,children:"Back"}),ea?(0,n.jsxs)("button",{type:"button",className:tV().continue,disabled:W,onClick:w,children:[I?"Review project brief":"Continue"," ",(0,n.jsx)("span",{"aria-hidden":"true",children:"→"})]}):null]})]});return S?(0,n.jsxs)("section",{className:"".concat(tV().desktopComposer," ").concat(tV().referenceComposer),"aria-label":"Reference edit",children:[ev,el&&!W?(0,n.jsxs)("p",{role:"status",children:["Your edit is pending. ",(0,n.jsx)("button",{type:"button",onClick:()=>void eo(),children:"Check progress"})]}):null]}):I?(0,n.jsxs)("section",{className:tV().desktopCanvas,"aria-label":"Redesign workspace",children:[(0,n.jsxs)("div",{className:tV().desktopPhoto,children:[eu?(0,n.jsx)("img",{src:eu,alt:ea?"Selected design ".concat(ep+1):(null==m?void 0:m.name)||"Source room"}):null,W?(0,n.jsx)("div",{className:tV().desktopProcessing,role:"status",children:B||"Creating your redesign…"}):null]}),C?(0,d.createPortal)((0,n.jsxs)("div",{className:tV().desktopComposer,children:[(0,n.jsxs)("div",{className:tV().desktopMessages,role:"log","aria-label":"Design conversation","aria-live":"polite",children:[(0,n.jsx)("article",{className:tV().desktopAssistantMessage,"aria-label":"Design assistant",children:(0,n.jsx)("p",{children:"What do you imagine for this space?"})}),ei.map((e,t)=>(0,n.jsxs)("div",{className:tV().desktopTurn,children:[(0,n.jsx)("div",{className:tV().desktopUserMessage,"aria-label":"Your message ".concat(t+1),children:(0,n.jsx)("p",{children:e.prompt})}),(0,n.jsxs)("article",{className:tV().desktopResponse,"aria-label":"Design response ".concat(t+1),children:[(0,n.jsx)("p",{children:"Your redesigned space is ready."}),(0,n.jsx)("button",{type:"button","aria-label":"Show Design ".concat(t+1," on canvas"),disabled:W,onClick:()=>void j({...y,selectedId:e.id},!1,e.id).catch(e=>D(e instanceof Error?e.message:"Your selection could not be saved. Please try again.")),children:(0,n.jsx)(f.Z,{src:e.url,projectId:h,generationId:e.id,alt:"Generated design ".concat(t+1)})}),(0,n.jsx)("button",{type:"button",className:tV().desktopSelectResult,"aria-pressed":(null==ea?void 0:ea.id)===e.id,disabled:W,onClick:()=>void j({...y,selectedId:e.id},!1,e.id).catch(e=>D(e instanceof Error?e.message:"Your selection could not be saved. Please try again.")),children:(null==ea?void 0:ea.id)===e.id?"On canvas ✓":"Show on canvas"})]})]},e.id)),ec?(0,n.jsxs)("div",{className:tV().desktopTurn,children:[(0,n.jsx)("div",{className:tV().desktopUserMessage,"aria-label":"Your latest message",children:(0,n.jsx)("p",{children:ec})}),(0,n.jsxs)("div",{className:tV().desktopAssistantMessage,role:"status",children:[(0,n.jsx)("p",{children:W||Y?"Working…":"Your design request is saved."}),W||Y||!el?null:(0,n.jsx)("button",{type:"button",onClick:()=>void eo(),children:"Check progress"})]})]}):null,(0,n.jsx)("div",{ref:J})]}),ev]}),C):null]}):(0,n.jsxs)("section",{className:tV().screen,"aria-label":"Design conversation",children:[(0,n.jsx)("p",{className:tV().srOnly,role:"status",children:B}),(0,n.jsxs)("div",{className:tV().messages,role:"region","aria-label":"Messages",children:[(0,n.jsxs)("article",{className:tV().botOpening,"aria-label":"Design assistant",children:[(0,n.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"m12 3 2.5 6.5L21 12l-6.5 2.5L12 21l-2.5-6.5L3 12l6.5-2.5L12 3Z"})}),(0,n.jsx)("p",{children:"What do you imagine for this space?"})]}),ei.map((e,t)=>(0,n.jsxs)("div",{className:tV().turn,children:[(0,n.jsxs)("div",{className:tV().userMessage,"aria-label":"Your message ".concat(t+1),children:[(0===t||!e.baseVersionId)&&(e.sourceUrl||(null==m?void 0:m.originalUrl)||(null==m?void 0:m.url))?(0,n.jsx)("button",{type:"button",className:tV().sentAttachment,onClick:()=>eg(e.sourceUrl||(null==m?void 0:m.originalUrl)||m.url,"Source photo"),children:(0,n.jsx)(f.Z,{src:e.sourceUrl||(null==m?void 0:m.originalUrl)||m.url,projectId:h,captureId:null==m?void 0:m.captureId,generationId:e.sourceGenerationId,alt:"Attached space photo"})}):null,(0,n.jsx)("p",{children:e.prompt})]}),(0,n.jsxs)("article",{className:tV().response,"aria-label":"Design response ".concat(t+1),children:[(0,n.jsx)("span",{className:tV().responseLabel,children:"Your redesigned space"}),(0,n.jsx)("button",{type:"button",className:tV().resultImage,onClick:()=>eg(e.url,"Design ".concat(t+1)),children:(0,n.jsx)(f.Z,{src:e.url,projectId:h,generationId:e.id,alt:"Generated design ".concat(t+1)})}),(0,n.jsxs)("div",{className:tV().resultActions,children:[(0,n.jsxs)("span",{children:["Design ",t+1]}),(0,n.jsx)("button",{type:"button","aria-pressed":(null==ea?void 0:ea.id)===e.id,disabled:W,onClick:()=>void j({...y,selectedId:e.id}).catch(()=>D("Your selection could not be saved. Please try again.")),children:(null==ea?void 0:ea.id)===e.id?"Selected ✓":"Use this design"})]})]})]},e.id)),ec?(0,n.jsxs)("div",{className:tV().turn,children:[(0,n.jsxs)("div",{className:tV().userMessage,"aria-label":"Your latest message",children:[!ei.length&&es?(0,n.jsx)("button",{type:"button",className:tV().sentAttachment,onClick:()=>eg(es,"Source photo"),children:(0,n.jsx)(f.Z,{src:es,projectId:h,captureId:null==el?void 0:el.captureId,generationId:null==el?void 0:el.sourceGenerationId,alt:"Attached space photo"})}):null,(0,n.jsx)("p",{children:ec})]}
1),(0,n.jsxs)("div",{className:tV().pending,role:"status",children:[(0,n.jsx)("span",{className:W?tV().pulse:""}),W||Y?"Working…":"Your design request is saved.",W||Y||!el?null:(0,n.jsx)("button",{type:"button",onClick:()=>void eo(),children:"Check progress"})]})]}):null,(0,n.jsx)("div",{ref:J})]}),ev,(0,n.jsxs)("dialog",{ref:Q,className:tV().preview,onCancel:()=>K(null),onClick:e=>{e.target===e.currentTarget&&K(null)},children:[(0,n.jsx)("button",{type:"button",onClick:()=>K(null),children:"Close"}),z?(0,n.jsx)("img",{src:z.url,alt:z.title}):null]})]})}var tZ=r(33156),tQ=r.n(tZ);function t$(e){let{desktop:t=!1,disabled:r=!1,selectionDisabled:o=!1,pending:a=!1,isVersion:i=!1,selected:l="",showEditorPlaceholders:s=!1,tourTargets:c=!1,onAction:d}=e,h="Brush";return(0,n.jsxs)("div",{className:"".concat(tQ().rail," ").concat(t?tQ().desktopRail:""),role:"toolbar","aria-label":"Declutter tools","aria-orientation":"vertical",children:[(0,n.jsxs)("button",{type:"button","data-workspace-tour":c?"left-declutter-full":void 0,disabled:r||a,"aria-label":"Declutter","aria-pressed":"full"===l,onClick:()=>d("full"),children:[(0,n.jsx)(u.G,{icon:p.Z30}),(0,n.jsx)("span",{children:"Declutter"})]}),(0,n.jsxs)("button",{type:"button","data-workspace-tour":c?"left-declutter-paint":void 0,disabled:r||a||o,title:o?"Unlock this layer to edit its selection":void 0,"aria-label":h,"aria-pressed":"paint"===l,onClick:()=>d("paint"),children:[(0,n.jsx)(u.G,{icon:p.XsY}),(0,n.jsx)("span",{children:h})]}),t&&s?(0,n.jsx)("div",{className:tQ().desktopEditorPlaceholders,"aria-label":"Brush tools unavailable",children:(0,n.jsxs)("button",{type:"button","data-workspace-tour":c?"left-erase":void 0,disabled:!0,"aria-label":"Erase selected area",children:[(0,n.jsx)(u.G,{icon:p.xf2}),(0,n.jsx)("span",{children:"Erase selected area"})]})}):null]})}let t0=()=>({versions:[],masks:{},captureIds:{}}),t1=t0();function t2(e){var t,r,o,i,l;let{qualityTier:s,onQualityChange:h,projectId:m,photos:g,edits:v,setEdits:j,ensureProject:b,onBack:x,onContinue:w,onInsufficientCredits:k,onVersionChange:_,desktop:I=!1,active:C=!0,toolsTarget:S,historyTarget:N,actionsTarget:P,activePhotoId:R,onPhotoChange:E,onBusyChange:T,toolRequest:M,onToolHandled:A,externalProgress:L,selectionTool:D="move"}=e,[B,U]=(0,c.useState)((null===(t=g[0])||void 0===t?void 0:t.id)||""),[W,O]=(0,c.useState)("original"),[q,Y]=(0,c.useState)(""),[H,X]=(0,c.useState)(34),[z,K]=(0,c.useState)({width:4,height:3}),[V,J]=(0,c.useState)([]),[Z,Q]=(0,c.useState)([]),[$,ee]=(0,c.useState)(null),[et,er]=(0,c.useState)(!1),[en,eo]=(0,c.useState)(!1),[ea,ei]=(0,c.useState)(!1),[es,ec]=(0,c.useState)(""),[ed,eu]=(0,a.O)(""),ep=(0,c.useRef)(null),[eg,ef]=(0,c.useState)(null),ev=(0,c.useRef)(null),ey=(0,c.useRef)(null),[ej,eb]=(0,c.useState)(!1),ex=(0,c.useRef)(null),ew=(0,c.useRef)(null),ek=(0,c.useRef)([]),e_=(0,c.useRef)(v),eI=(0,c.useRef)(!0),eC=(0,c.useRef)(!1),eS=(0,c.useRef)(0),eN=(0,c.useRef)("");e_.current=v,(0,c.useEffect)(()=>(eI.current=!0,()=>{eI.current=!1}),[]),(0,c.useEffect)(()=>(null==T||T(ea),()=>null==T?void 0:T(!1)),[ea,T]),(0,c.useEffect)(()=>{C||(er(!1),eo(!1),ee(null),eS.current+=1)},[C]);let eP=g.find(e=>e.id===(R||B))||g[0],eR=v[null==eP?void 0:eP.id]||t1,eT=I?eh(eR.versions,null==eP?void 0:eP.selectedGenerationId):eR.versions.find(e=>e.id===W),eM=(null==eT?void 0:eT.id)||"original",eA=(null==eT?void 0:eT.url)||(null==eP?void 0:eP.originalUrl)||(null==eP?void 0:eP.url),eL=JSON.stringify([null==eP?void 0:eP.id,eM,eA]),eD=(null==eg?void 0:eg.key)===eL&&eg.element===ep.current,eB=eT?!!eT.locked:null!==(l=eR.backgroundLocked)&&void 0!==l?l:I,eU=eR.masks[eM]||[],eW=C&&!eB&&("paint"===q||"erase"===q);(0,c.useEffect)(()=>{if(!I&&eW&&!ea&&ev.current)return(0,F.ld)(ev.current,34,!1,ey.current)},[I,eW,ea,eL,eD]);let eO=!!((null==eP?void 0:eP.selectedGenerationId)&&eR.versions.some(e=>e.id===eP.selectedGenerationId)),eG=(e,t)=>j(r=>({...r,[e]:t(r[e]||t0())})),eF=e=>{(I||!eB)&&eG(eP.id,t=>({...t,masks:{...t.masks,[eM]:e}}))};function eq(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!eW||eC.current)return;if(e.preventDefault(),e.stopPropagation(),t){if(null!==ew.current)return;e.currentTarget.setPointerCapture(e.pointerId),ew.current=e.pointerId,ek.current=eU,Q(e=>[...e,eU]),J([]);let t=e.currentTarget.getBoundingClientRect();ex.current={id:crypto.randomUUID(),width:H/Math.min(t.width,t.height),points:[],..."erase"
1===q?{mode:"erase"}:{}}}if(ew.current!==e.pointerId||!ex.current)return;let r=function(e){let t=e.currentTarget.getBoundingClientRect();return{x:Math.max(0,Math.min(1,(e.clientX-t.left)/t.width)),y:Math.max(0,Math.min(1,(e.clientY-t.top)/t.height))}}(e),n=ex.current.points[ex.current.points.length-1];if(n&&.0025>Math.hypot(r.x-n.x,r.y-n.y))return;let o=[...ex.current.points,r];ex.current={...ex.current,points:o.length>2048?(0,F.Cx)(o,.003,1024):o},eF([...ek.current,ex.current])}function eY(e){e.preventDefault(),e.stopPropagation(),ew.current===e.pointerId&&(ew.current=null,ex.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))}async function eH(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;if(eC.current||en)return;eu(""),ee(null),er(!0),eo(!0);let t=++eS.current;try{let r=await (0,G.o3)(e);eI.current&&t===eS.current&&ee(r)}catch(e){eI.current&&t===eS.current&&eu(e instanceof Error?e.message:"The edit cost could not be checked.")}finally{eI.current&&t===eS.current&&eo(!1)}}async function eX(){let e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(eP&&!eC.current&&(t||I||!eB||"full"===q)){if(!t&&"full"!==q)try{if(I){if(!(e=(0,F.dp)(eU,z.width,z.height)))return}else{if(!ev.current)return;let t=(0,F.w6)(ev.current);if(!t.length)return;e={coordinateSpace:"normalized",sourceWidth:z.width,sourceHeight:z.height,strokes:t}}}catch(e){eu(e instanceof Error?e.message:"The selection could not be prepared.");return}eC.current=!0,ei(!0),eu(""),er(!1);try{var r,n,o,a;let i=null===(r=e_.current[eP.id])||void 0===r?void 0:r.job,l=t?i:void 0;if(!(null==l?void 0:l.generation)){ec("Checking AI credits…");let e=await (0,G.o3)(null!==(n=null==l?void 0:l.qualityTier)&&void 0!==n?n:l?"standard":s);if(eI.current&&ee(e),!e.hasEnoughCredits){eI.current&&ec(""),null==k||k(e,()=>void eX(!!l));return}}let c=(null==l?void 0:l.projectId)||await b();if(!l){ec("Uploading your photo…");let t=null===(o=e_.current[eP.id])||void 0===o?void 0:o.captureIds[eM];t||(t=await (0,G.Zv)(c,{id:crypto.randomUUID(),roomId:eP.roomId,name:eT?"".concat(eT.id,".png"):eP.name,url:eA,...z,sourceGenerationId:null==eT?void 0:eT.id}),eG(eP.id,e=>({...e,captureIds:{...e.captureIds,[eM]:t}}))),l={projectId:c,sourceId:eM,captureId:t,requestId:crypto.randomUUID(),qualityTier:s,mask:e},eG(eP.id,e=>({...e,job:l}))}if(!l)throw Error("No edit is waiting for this photo.");if(l.generation||(l={...l,generation:await (0,G.TI)(c,l.captureId,l.requestId,l.mask,null!==(a=l.qualityTier)&&void 0!==a?a:"standard")},eG(eP.id,e=>({...e,job:l}))),!l.generation)throw Error("The edit submission could not be confirmed. Check progress to retry safely.");let d=l.generation;eI.current&&ee(e=>(0,G.XW)(e,d));for(let e=0;e<100;e++){if("failed"===d.status)throw eG(eP.id,e=>({...e,job:void 0})),Error(d.error||"The edit could not be completed. Your original is unchanged.");if("succeeded"===d.status){if(!d.url)throw Error("The edited photo is not available yet. Check again shortly.");eG(eP.id,e=>({...e,job:void 0,versions:e.versions.some(e=>e.id===d.id)?e.versions:[...em(e.versions,eP.selectedGenerationId),{id:d.id,url:d.url,name:e.versions.length?"Refined ".concat(e.versions.length):"Decluttered",visible:!0,locked:!1}]})),eI.current&&(U(eP.id),O(d.id),ec(""),Y(""),null==_||_(eP.id,{id:d.id,url:d.url}));return}if(eI.current&&ec("Decluttering your photo…"),await new Promise(e=>setTimeout(e,3e3)),!eI.current)return;d=await (0,G.oG)(c,d.id),eI.current&&ee(e=>(0,G.XW)(e,d)),eG(eP.id,e=>({...e,job:{...l,generation:d}}))}ec("This edit is taking longer. Check its progress again shortly.")}catch(e){eI.current&&eu(e instanceof Error?e.message:"The edit could not be completed.")}finally{eC.current=!1,eI.current&&ei(!1)}}}function ez(e){var t;if(eP&&!eC.current&&("paint"!==e||!eB)&&(null===(t=eR.job)||void 0===t||!t.generation)){if(eR.job&&eG(eP.id,e=>({...e,job:void 0})),"full"===e){ew.current=null,ex.current=null;try{let e=(0,F.dp)(eU,z.width,z.height);eb(!!e),Y(e?"selected":"full"),eH()}catch(e){eu(e instanceof Error?e.message:"The selection could not be read.")}}else eS.current+=1,er(!1),eo(!1),ee(null),eu(""),Y(""),ew.current=null,ex.current=null,Y("paint")}}(0,c.useEffect)(()=>{let e=ev.current;e&&eb((0,F.tG)(e,eU,z.width,z.height))},[C,eU,z.width,z.height,q]),(0,c.useEffect)(()=>
1{if(!eW)return;let e=document.body,t=document.documentElement,r=window.scrollX,n=window.scrollY,o={position:e.style.position,top:e.style.top,left:e.style.left,right:e.style.right,width:e.style.width,overflow:e.style.overflow},a=t.style.overflow,i=t.style.scrollBehavior;return Object.assign(e.style,{position:"fixed",top:"".concat(-n,"px"),left:"".concat(-r,"px"),right:"0",width:"100%",overflow:"hidden"}),t.style.overflow="hidden",()=>{Object.assign(e.style,o),t.style.overflow=a,t.style.scrollBehavior="auto",window.scrollTo({left:r,top:n,behavior:"auto"}),t.style.scrollBehavior=i}},[eW]),(0,c.useEffect)(()=>{let e=null==eP?void 0:eP.selectedGenerationId;O(e&&eO?e:"original")},[null==eP?void 0:eP.id,null==eP?void 0:eP.selectedGenerationId,eO]),(0,c.useEffect)(()=>{ew.current=null,ex.current=null,Q([]),J([]),Y(""),eu(""),er(!1),eo(!1),ee(null),eS.current+=1},[null==eP?void 0:eP.id,eM,eB,eu]),(0,c.useEffect)(()=>{let e=ep.current;(null==e?void 0:e.complete)&&e.naturalWidth&&(K({width:e.naturalWidth,height:e.naturalHeight}),ef({key:eL,element:e}))},[eL]),(0,c.useEffect)(()=>{C&&M&&eN.current!==M.id&&eP&&(eN.current=M.id,ez(M.action),null==A||A())});let eK=(0,n.jsx)(t$,{desktop:I,disabled:!eP||ea,selectionDisabled:eB,pending:!!(null===(r=eR.job)||void 0===r?void 0:r.generation),isVersion:!!eT,selected:"full"===q?"full":"paint"===q||"selected"===q?"paint":"",onAction:ez}),eV=(0,n.jsxs)("div",{className:I?el().workspaceToolGroup:void 0,role:"toolbar","aria-label":"Edit history","aria-orientation":I?"vertical":void 0,children:[(0,n.jsxs)("button",{type:"button","aria-label":"Undo",disabled:!C||ea||eB||!Z.length,onClick:()=>{J(e=>[...e,eU]),eF(Z[Z.length-1]),Q(e=>e.slice(0,-1))},children:[(0,n.jsx)(u.G,{icon:p.X7o}),(0,n.jsx)("span",{children:"Undo"})]}),(0,n.jsxs)("button",{type:"button","aria-label":"Redo",disabled:!C||ea||eB||!V.length,onClick:()=>{Q(e=>[...e,eU]),eF(V[V.length-1]),J(e=>e.slice(0,-1))},children:[(0,n.jsx)(u.G,{icon:p.XSV}),(0,n.jsx)("span",{children:"Redo"})]})]}),eJ=I||eW&&!ea?(0,n.jsxs)("div",{className:"".concat(tQ().brushTools," ").concat(I?tQ().desktopBrushTools:""),role:"toolbar","aria-label":"Brush tools",children:[(0,n.jsxs)("button",{type:"button","aria-label":"Erase selected area",disabled:ea||eB||"paint"!==q&&"erase"!==q&&"selected"!==q,"aria-pressed":"erase"===q,onClick:()=>{ew.current=null,ex.current=null,Y(e=>"erase"===e?"paint":"erase")},children:[(0,n.jsx)(u.G,{icon:p.xf2}),(0,n.jsx)("span",{children:"Erase selected area"})]}),I?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:tQ().railRange,children:[(0,n.jsx)("input",{ref:ey,type:"range","aria-label":"erase"===q?"Eraser size":"Brush size",disabled:ea,min:10,max:70,value:H,onChange:e=>X(Number(e.target.value))}),(0,n.jsx)("span",{children:"erase"===q?"Eraser size":"Brush size"})]}),eV,(0,n.jsxs)("button",{type:"button","aria-label":"Finish selection",disabled:ea||!ej,onClick:()=>{ex.current=null,Y("selected"),eH()},children:[(0,n.jsx)(u.G,{icon:p.LEp}),(0,n.jsx)("span",{children:"Finish selection"})]})]})]}):null,eZ=C&&et&&("full"===q||"selected"===q&&ej)&&!ea?(0,n.jsxs)("div",{className:"".concat(tQ().declutterAction," ").concat(I?tQ().desktopDeclutterAction:""),role:"group","aria-label":"selected"===q?"Empty selected area":"Empty room",children:[(0,n.jsxs)("div",{className:tQ().actionLabel,children:[(0,n.jsx)("strong",{children:"selected"===q?"Empty selected area":"Empty room"}),en?(0,n.jsx)("small",{role:"status",children:"Checking credits…"}):$?(0,n.jsxs)("small",{title:$.hasEnoughCredits?void 0:"Not enough credits",children:[$.creditsRequired," credits \xb7 ",$.availableCredits," available"]}):(0,n.jsx)("button",{type:"button",className:tQ().retryQuote,onClick:()=>void eH(),children:"Retry credit check"})]}),(0,n.jsx)(tX,{value:s,onChange:e=>{h(e),eH(e)},disabled:en||ea}),(0,n.jsx)("button",{type:"button",className:"".concat(tQ().answer," ").concat($&&!$.hasEnoughCredits?tQ().creditAnswer:""),disabled:!$||en,onClick:function(){if($&&!$.hasEnoughCredits){null==k||k($,()=>void eX());return}eX()},children:(null==$?void 0:$.hasEnoughCredits)?"Yes":"Get credits"})]}):null;return eP?(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().minimalSlide," ").concat(tQ().editor," ").concat(I?tQ().desktopEditor:""),"aria-label":"Declutter photos",children:[(0,n.jsxs)("div",{className:tQ().workspace,children:[(0,n.jsxs)("div",{className:tQ().stage,children:[(0,n.jsxs)("div",{className:tQ().frame,style:{"--photo-ratio":z.width/z.height},children:[(0,n.jsx)("img",{ref:ep,src:eA,alt:eP.name,draggable:!1,onLoad:e=>{let t=e.currentTarget;
1t===ep.current&&t.naturalWidth&&(K({width:t.naturalWidth,height:t.naturalHeight}),ef({key:eL,element:t}))},onError:()=>ef(null)},eL),eT&&eD?(0,n.jsx)("span",{className:tQ().versionLabel,children:eT.name}):null,I&&eD?(0,n.jsx)(eE,{strokes:eU,onChange:eF,width:z.width,height:z.height,tool:D,disabled:ea||!!L||et||!!(null===(o=eR.job)||void 0===o?void 0:o.generation),label:"Room selection",controlsTarget:P},"".concat(eP.id,":").concat(eM)):null,!I&&C&&(eW||"selected"===q)?(0,n.jsx)("canvas",{ref:ev,className:tQ().mask,style:{pointerEvents:eW?void 0:"none",cursor:eW?"none":void 0},role:"img","aria-label":eW?"Paint areas to remove from this photo":"Selected areas to remove",onPointerDown:e=>eq(e,!0),onPointerMove:e=>eq(e),onPointerUp:eY,onPointerCancel:eY,onLostPointerCapture:function(e){e.stopPropagation(),ew.current===e.pointerId&&(ew.current=null,ex.current=null)}}):null]}),ea||(null==L?void 0:L.photoId)===eP.id?(0,n.jsx)("div",{className:tQ().processing,role:"status","aria-live":"polite",children:ea?es:null==L?void 0:L.message}):null]}),I?null:(0,n.jsxs)(n.Fragment,{children:[eK,eJ]}),I?P&&eZ?(0,d.createPortal)(eZ,P):null:eZ]}),I?null:(0,n.jsx)("div",{className:tQ().filmstrip,"aria-label":"Photos and versions",children:g.flatMap(e=>{var t;return[{id:"original",url:e.originalUrl||e.url,name:"Original"},...(null===(t=v[e.id])||void 0===t?void 0:t.versions)||[]].map(t=>{var r;return(0,n.jsxs)("button",{type:"button",disabled:ea,"aria-label":"".concat(e.name,", ").concat(t.name),"aria-pressed":e.id===eP.id&&t.id===eM,onClick:()=>{U(e.id),null==E||E(e.id),O(t.id)},children:[(0,n.jsx)(f.Z,{src:t.url,projectId:m,captureId:"original"===t.id?e.captureId||(null===(r=v[e.id])||void 0===r?void 0:r.captureIds.original):void 0,generationId:"original"===t.id?void 0:t.id,alt:""}),(0,n.jsx)("span",{children:t.name})]},"".concat(e.id,":").concat(t.id))})})}),C&&!ea&&(null===(i=eR.job)||void 0===i?void 0:i.generation)?(0,n.jsx)("button",{type:"button",className:tQ().checkProgress,onClick:()=>eX(!0),children:"Check edit progress"}):null,C&&!ea&&es&&!("Checking AI credits…"===es&&eR.job&&!eR.job.generation)?(0,n.jsx)("p",{className:tQ().message,role:"status",children:es}):null,I?null:(0,n.jsxs)("div",{className:y().actions,children:[(0,n.jsx)("button",{type:"button",className:y().backButton,disabled:ea,onClick:x,children:"Back"}),(0,n.jsxs)("button",{type:"button",className:y().primaryButton,disabled:ea,onClick:()=>w(eP.id,eA),children:["Continue ",(0,n.jsx)("span",{children:"→"})]})]})]}):(0,n.jsxs)("section",{className:y().slide,children:[(0,n.jsx)("p",{children:"Add a photo before decluttering."}),(0,n.jsx)("button",{type:"button",onClick:x,children:"Back to Capture"})]})}function t3(e,t,r){var n,o,a,i,l;let s=e.workspaceAnnotations,c={...e,workspaceAnnotations:s?{...s,selections:Object.fromEntries(Object.entries(s.selections).filter(e=>{let[n]=e;return"reference"!==t||n!==r})),connections:Object.fromEntries(Object.entries(s.connections).filter(e=>{let[n]=e;return"reference"!==t||n!==r}).map(e=>{let[n,o]=e;return[n,o.filter(e=>"room"!==t||e.targetPhotoId!==r)]}))}:void 0};if("reference"===t)return{...c,references:null===(n=e.references)||void 0===n?void 0:n.filter(e=>e.id!==r)};let d=(null===(o=e.redesign)||void 0===o?void 0:o.versions.filter(e=>e.photoId!==r))||[];return{...c,redesignDrafts:Object.fromEntries(Object.entries(e.redesignDrafts||{}).filter(e=>{let[t]=e;return t!==r})),photos:null===(a=e.photos)||void 0===a?void 0:a.filter(e=>e.id!==r),declutterEdits:Object.fromEntries(Object.entries(e.declutterEdits||{}).filter(e=>{let[t]=e;return t!==r})),renderSourceByRoom:Object.fromEntries(Object.entries(e.renderSourceByRoom||{}).filter(e=>{let[,t]=e;return t!==r})),redesign:e.redesign?{...e.redesign,versions:d,selectedByPhoto:Object.fromEntries(Object.entries(e.redesign.selectedByPhoto||{}).filter(e=>{let[t]=e;return t!==r})),job:(null===(i=e.redesign.job)||void 0===i?void 0:i.photoId)===r?void 0:e.redesign.job,selectedId:d.some(t=>{var r;return t.id===(null===(r=e.redesign)||void 0===r?void 0:r.selectedId)})?e.redesign.selectedId:null===(l=d.at(-1))||void 0===l?void 0:l.id}:void 0}}var t5=r(57574),t4=r(15887),t6=JSON.parse('[{"code":"modern-contemporary","names":["Modern / Contemporary"],"description":"Clean lines, open spaces and a restrained palette, with an emphasis on light and function."},{"code":"transitional","names":["Transitional"],"description":"Classic proportions meet modern simplicity for a balanced, comfortable and timeless space."},{"code":"traditional-classic","names":["Traditional / Classic","Traditional / Classical"],"description":"Elegant detailing, balanced layouts and rich finishes inspired by enduring architectural traditions."},{"code":"organic-modern","names":["Organic Modern"],"description":"Simple modern forms s
1oftened by natural materials, earthy tones and tactile textures."},{"code":"minimalist-japandi","names":["Minimalist / Japandi"],"description":"Quiet spaces, purposeful pieces and natural finishes that blend Japanese and Scandinavian influences."},{"code":"mid-century-modern","names":["Mid-Century Modern"],"description":"Sculptural furniture, warm woods and clean geometric lines with a playful use of color."},{"code":"coastal-tropical","names":["Coastal / Tropical"],"description":"Airy rooms, relaxed textures and sun-washed colors with a strong connection to the outdoors."},{"code":"mediterranean","names":["Mediterranean","Mediterranean / Spanish"],"description":"Warm plaster, natural stone, terracotta and graceful arches inspired by Mediterranean homes."},{"code":"industrial","names":["Industrial","Industrial / Urban"],"description":"Exposed structure, metal and raw finishes balanced with practical furnishings and warm accents."},{"code":"rustic-farmhouse","names":["Rustic / Farmhouse","Farmhouse / Rustic"],"description":"Weathered woods, honest materials and inviting layers that celebrate a relaxed, lived-in character."},{"code":"craftsman","names":["Craftsman"],"description":"Handcrafted details, substantial woodwork and built-in features grounded in natural materials."}]');let t8=e=>"Sandbox project"===e.projectName&&"Sample space"===e.location&&"quick-capture"===e.projectType;function t9(e){return e.slice(0,35)}let t7={"new-build":"Exterior","whole-home":"Renovate",interior:"Capture","quick-capture":"Capture","single-space":"Focus"},re=e=>!e||"quick-capture"===e||"single-space"===e,rt=["Primary bedroom","Secondary bedroom","Primary bathroom","Secondary bathroom","Living room","Family room","Dining room","Kitchen","Kitchenette","Pantry","Laundry","Walk-in closet","Home office","Entry","Outdoor area"],rr=["Guided Mode","Project Details","Direction","Photos","Inspiration","Visualize","Brief"],rn="project-planner:invitation-pending-auth",ro=[{name:"Modern / Contemporary",aliases:["modern","contemporary"]},{name:"Traditional / Classical",aliases:["traditional","classical","classic"]},{name:"Transitional",aliases:["transitional"]},{name:"Mediterranean / Spanish",aliases:["mediterranean","spanish"]},{name:"Mid-Century Modern",aliases:["mid century modern","mid century"]},{name:"Coastal / Tropical",aliases:["coastal","tropical"]},{name:"Farmhouse / Rustic",aliases:["farmhouse","rustic"]},{name:"Craftsman",aliases:["craftsman"]},{name:"Industrial / Urban",aliases:["industrial","urban"]}],ra=[{name:"Modern / Contemporary",aliases:["modern","contemporary"]},{name:"Transitional",aliases:["transitional"]},{name:"Traditional / Classic",aliases:["traditional","classic","classical"]},{name:"Organic Modern",aliases:["organic modern","modern organic","organic"]},{name:"Minimalist / Japandi",aliases:["minimalist","minimalism","japandi"]},{name:"Mid-Century Modern",aliases:["mid century modern","mid century"]},{name:"Coastal / Tropical",aliases:["coastal","tropical"]},{name:"Mediterranean",aliases:["mediterranean"]},{name:"Industrial",aliases:["industrial"]},{name:"Rustic / Farmhouse",aliases:["rustic","farmhouse"]}],ri=[...ro,...ra],rl=[{id:"primary-bedroom",label:"Primary bedroom",count:1},{id:"secondary-bedroom",label:"Secondary bedroom",count:2},{id:"primary-bathroom",label:"Primary bathroom",count:1},{id:"secondary-bathroom",label:"Secondary bathroom",count:2},{id:"living-room",label:"Living room",count:1},{id:"dining-room",label:"Dining room",count:1},{id:"kitchen",label:"Kitchen",count:1},{id:"laundry",label:"Laundry",count:1}];function rs(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")||"space-".concat(Date.now())}function rc(e){return e.toLocaleLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g," ").trim()}function rd(e,t){let r=rc(e||"");return!!r&&t.some(e=>{let t=rc(e);return"modern"===t?"modern"===r||r.startsWith("modern "):r===t||r.startsWith("".concat(t," "))||r.endsWith(" ".concat(t))})}function ru(e,t){return[rc(e),...t.map(rc).sort()].join("::")}function rp(e,t,r){return Math.min(r,Math.max(t,e))}function rh(e){var t;if(!(null===(t=e.polygon)||void 0===t?void 0:t.length))return;let r=Math.max(e.width,.01),n=Math.max(e.height,.01);return"polygon(".concat(e.polygon.map(t=>
1"".concat(rp((t.x-e.x)/r*100,0,100),"% ").concat(rp((t.y-e.y)/n*100,0,100),"%")).join(", "),")")}function rm(e){let t=Number(e.x),r=Number(e.y),n=Number(e.width),o=Number(e.height);if(!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(o)||n<=0||o<=0)return null;let a=Math.min(1,n),i=Math.min(1,o);return{x:rp(t-a/2,0,1-a),y:rp(r-i/2,0,1-i),width:a,height:i}}function rg(e,t){return re(e)?t.length?[{...(0,t4.wC)(t)[0],count:1}]:[]:(0,t4.wC)(t)}function rf(e){let t=e.currentTarget.getBoundingClientRect();return{x:Math.max(0,Math.min(1,(e.clientX-t.left)/t.width)),y:Math.max(0,Math.min(1,(e.clientY-t.top)/t.height))}}function rv(e){let{label:t,imageUrl:r,imageTitle:o,selected:a,single:i,onSelect:l,onDecrease:s,onIncrease:c}=e;return(0,n.jsxs)("article",{className:"".concat(y().spaceChoiceCard," ").concat(a?y().spaceChoiceActive:""),children:[(0,n.jsxs)("button",{type:"button",className:y().spaceChoiceSelect,"aria-pressed":!!a,onClick:l,children:[(0,n.jsxs)("span",{className:y().spaceChoiceImage,children:[r?(0,n.jsx)(f.Z,{src:r,alt:o||t,loading:"lazy"}):null,(0,n.jsx)("i",{"aria-hidden":"true",children:a?"✓":"+"})]}),(0,n.jsx)("strong",{children:t})]}),a?(0,n.jsxs)("div",{className:y().spaceChoiceFooter,children:[(0,n.jsx)("span",{children:i?"Selected":"Quantity"}),(0,n.jsxs)("div",{className:i?y().singleSpaceQuantity:"",children:[(0,n.jsx)("button",{type:"button","aria-label":"Remove one ".concat(t),onClick:s,children:"−"}),(0,n.jsx)("strong",{children:a.count}),i?null:(0,n.jsx)("button",{type:"button","aria-label":"Add one ".concat(t),onClick:c,children:"+"})]})]}):(0,n.jsx)("div",{className:"".concat(y().spaceChoiceFooter," ").concat(y().spaceChoiceFooterEmpty),children:(0,n.jsx)("span",{children:"Select space"})})]})}function ry(){var e,t,r,v,j,b,I;let{authState:C,authReady:S}=(0,h.a)(),[N,P]=(0,c.useState)("standard"),[R,E]=(0,c.useState)(0),[T,M]=(0,c.useState)(!1),[A,L]=(0,c.useState)(!1),[D,B]=(0,c.useState)(!1),[U,W]=(0,c.useState)(""),[O,F]=(0,c.useState)(!1),[q,Y]=(0,c.useState)(""),[H,X]=(0,c.useState)({}),[z,K]=(0,c.useState)(tw),[V,J]=(0,c.useState)(!1),[Z,Q]=(0,c.useState)(null),[$,ee]=(0,c.useState)({}),[et,er]=(0,c.useState)(""),[en,eo]=(0,c.useState)(""),[ea,ei]=(0,c.useState)(""),[el,es]=(0,c.useState)(""),[ec,ed]=(0,c.useState)([]),[ep,eg]=(0,c.useState)([]),[ef,ev]=(0,c.useState)(!1),ey=(0,c.useRef)(!1),[ej,eb]=(0,c.useState)(""),[ex,ew]=(0,c.useState)([]),[ek,e_]=(0,c.useState)([]),[eI,eC]=(0,c.useState)(_.vT),[eS,eN]=(0,c.useState)({selections:{},connections:{}}),[eP,eR]=(0,c.useState)(""),[eE,eT]=(0,c.useState)(!0),[eM,eA]=(0,c.useState)(),[eL,eD]=(0,c.useState)(),[eB,eU]=(0,c.useState)(),[eW,eG]=(0,c.useState)([]),[eF,eq]=(0,c.useState)({}),eY=(0,c.useRef)(new Set),[eH,eX]=(0,c.useState)(!1),[ez,eK]=(0,c.useState)(!1),[eV,eJ]=(0,c.useState)(!1),[eZ,eQ]=(0,c.useState)(null),[e$,e0]=(0,c.useState)(!1),[e1,e2]=(0,c.useState)({}),[e3,e5]=(0,c.useState)(""),[e4,e6]=(0,c.useState)([]),[e8,e9]=(0,c.useState)(null),[e7,te]=(0,c.useState)(null),[tt,tr]=(0,c.useState)(!1),[tn,to]=(0,c.useState)(""),[ta,ti]=(0,c.useState)(!1),tl=(0,c.useRef)(!1),ts=(0,c.useCallback)(e=>{tl.current=e,ti(e)},[]),td=(0,c.useRef)(""),tu=(0,c.useCallback)(e=>{td.current=e,to(e)},[]),tp=(0,c.useCallback)(()=>{let e=!!td.current,t=(td.current||(td.current="project-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8))),td.
1current);return e||to(t),t},[]),[th,tm]=(0,c.useState)(null),[tg,tf]=(0,c.useState)(""),[ty,tj]=(0,c.useState)(!1),[tk,t_]=(0,c.useState)(null);(0,c.useEffect)(()=>{let e=window.matchMedia("(min-width: 1051px)"),t=()=>tm(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]);let[tI,tC]=(0,a.O)(""),[tN,tT]=(0,c.useState)(!1),[tD,tB]=(0,c.useState)(0),tU=(0,c.useRef)(new Map),tW=(0,c.useRef)(null),tO=(0,c.useRef)(""),tq=(0,c.useRef)(null),tY=(0,c.useRef)(null),tH=(0,c.useRef)(!1),tX=(0,c.useRef)(0),tK=(0,c.useRef)(!0);(0,c.useEffect)(()=>(tK.current=!0,()=>{tK.current=!1}),[]);let[tV,tZ]=(0,c.useState)(!1);(0,c.useEffect)(()=>{tZ(!1)},[tI]);let[tQ,t$]=(0,c.useState)(!1),[t0,t1]=(0,c.useState)(!1),ry=(0,c.useRef)(null),[rj,rb]=(0,c.useState)([]),[rx,rw]=(0,a.O)(""),[rk,r_]=(0,c.useState)(""),[rI,rC]=(0,c.useState)(""),[rS,rN]=(0,c.useState)(!1),[rP,rR]=(0,c.useState)(null),rE=(0,c.useRef)(null),rT=(0,c.useRef)(!1),rM=(0,c.useRef)(!1),[rA,rL]=(0,c.useState)([]),[rD,rB]=(0,c.useState)(""),[rU,rW]=(0,c.useState)(!1),[rO,rG]=(0,c.useState)(""),[rF,rq]=(0,a.O)(""),[rY,rH]=(0,c.useState)(0),[rX,rz]=(0,c.useState)({}),[rK,rV]=(0,c.useState)({}),[rJ,rZ]=(0,c.useState)([]),[rQ,r$]=(0,c.useState)(null),[r0,r1]=(0,c.useState)(null),[r2,r3]=(0,c.useState)(""),[r5,r4]=(0,c.useState)(!1),[r6,r8]=(0,c.useState)(""),[r9,r7]=(0,a.O)(""),ne=(0,c.useRef)(""),[nt,nr]=(0,c.useState)(!1),[nn,no]=(0,c.useState)(!1),[na,ni]=(0,c.useState)(null),[nl,ns]=(0,c.useState)(1),[nc,nd]=(0,c.useState)(!1),[nu,np]=(0,c.useState)(!1),[nh,nm]=(0,c.useState)(!1),[ng,nf]=(0,c.useState)(""),[nv,ny]=(0,a.O)(""),nj=(0,c.useRef)(null),nb=(0,c.useRef)(null),nx=(0,c.useRef)(null),nw=(0,c.useRef)(""),nk=(0,c.useRef)(null),n_=(0,c.useRef)(new Map),nI=(0,c.useRef)(""),nC=(0,c.useRef)(new Set),nS=(0,c.useRef)(null),nN=(0,c.useRef)(""),nP=(0,c.useRef)(new Map),nR=(0,c.useRef)(null),nE=(0,c.useRef)([]),nT=(0,c.useRef)(null),nM=(0,c.useRef)(null),nA=(0,c.useRef)(null),nL=(0,c.useRef)(null),nD=(0,c.useRef)(null),nB=(0,c.useRef)(new Set),nU=(0,c.useRef)(!1),nW=(0,c.useRef)(null),nO=(0,c.useRef)([]),nG=(0,c.useRef)([]);nG.current=[...ex,...ek].flatMap(e=>[e.url,e.originalUrl||""]),(0,c.useEffect)(()=>()=>{for(let e of Array.from(new Set(nG.current)))e.startsWith("blob:")&&URL.revokeObjectURL(e)},[]);let[nF,nq]=(0,c.useState)({destination:"space",roomId:""}),[nY,nH]=(0,c.useState)(!1),[nX,nz]=(0,c.useState)(null),nK=(0,c.useRef)(""),nV=(0,c.useRef)(""),nJ=(0,c.useRef)(""),nZ=(0,c.useRef)(()=>{});(0,c.useEffect)(()=>{if(!S||!C.isAuthenticated){ni(null);return}let e=nW.current;nW.current=null,null==e||e()},[S,C.isAuthenticated,C.userID]);let nQ=(0,c.useCallback)(e=>{if(S){if(!C.isAuthenticated){nW.current=e,nr(!0);return}e()}},[S,C.isAuthenticated]),n$=(0,c.useCallback)((e,t)=>{ni(e.availableCredits),ns(e.creditsRequired),nW.current=t,nd(!0)},[]),n0=C.isAuthenticated?C.email?"email-".concat(C.email.toLowerCase()):C.userID?"id-".concat(C.userID):"":"",n1=n0?"".concat("taa.projectPlanner.projects.v1",":").concat(n0):"",n2=n0?"".concat("project-planner:invitation-accepted",":").concat(n0):"";nK.current=n0,(0,c.useEffect)(()=>{nH(!1)},[n0,tn]),(0,c.useEffect)(()=>{let e=nV.current;if(e!==n0){if(nV.current=n0,!e&&n0){nJ.current=n0;return}e&&(nJ.current="",nZ.current())}},[n0]),(0,c.useEffect)(()=>{!n0||nJ.current||tn||R>0||(nJ.current=n0)},[n0,tn,R]);let n3=(0,c.useCallback)(()=>{let e=nB.current.has(n2);try{e||(e=!!n2&&"true"===window.sessionStorage.getItem(n2))}catch(e){}if(e){E(e=>e>0?e:2),window.scrollTo({top:0,behavior:"smooth"});return}nf(""),ny(""),nm(!0)},[n2,ny]),n5=(0,c.useMemo)(()=>(null==eZ?void 0:eZ.projectTypes.filter(e=>e.code&&e.name).map(e=>({id:e.code,group:t7[e.code]||e.code.replace(/[-_]+/g," "),title:"quick-capture"===e.code?"Single Space Redesign":"whole-home"===e.code?"Multiple Space Redesign":e.name,description:e.description||"",enabled:!!e.active&&["quick-capture","whole-home"].includes(e.code)})).sort((e,t)=>Number(t.enabled)-Number(e.enabled)||e.title.localeCompare(t.title,"en",{sensitivity:"base"})))||[],[eZ]),n4=(0,c.useMemo)(()=>{var e;return null==eZ?void 0:null===(e=eZ.projectTypes.find(e=>e.code===et))||void 0===e?void 0:e.projectTypeID},[eZ,et]),n6=(0,c.useMemo)(()=>(null==eZ?void 0:eZ.styles.filter(e=>e.active&&(!n4||e.projectTypeID===n4)).sort((e,t)=>
1e.sortOrder-t.sortOrder))||[],[eZ,n4]),n8=(0,c.useMemo)(()=>{let e=n6.map(e=>{var t,r,n;return{name:e.name,description:(null===(t=e.description)||void 0===t?void 0:t.trim())||(null===(r=t6.find(t=>t.code===e.code))||void 0===r?void 0:r.description),aliases:(null===(n=e.searchAliases)||void 0===n?void 0:n.length)?e.searchAliases:[e.name]}});return e.length?e:"new-build"===et?ro:ra},[et,n6]),n9=(0,c.useMemo)(()=>{let e=ri.reduce((e,t)=>(e[t.name]=t.aliases,e),{});return null==eZ||eZ.styles.forEach(t=>{var r;t.name&&(e[t.name]=(null===(r=t.searchAliases)||void 0===r?void 0:r.length)?t.searchAliases:[t.name])}),e},[eZ]),n7=(0,c.useMemo)(()=>n6.reduce((e,t)=>(t.name&&t.cardImageURL&&(e[t.name]=t.cardImageURL),e),{}),[n6]),oe=(0,c.useMemo)(()=>{let e=null==eZ?void 0:eZ.spaceTypes.filter(e=>e.active&&e.name).sort((e,t)=>e.sortOrder-t.sortOrder).map(e=>e.name);return(null==e?void 0:e.length)?e:rt},[eZ]),ot=(0,c.useMemo)(()=>((null==eZ?void 0:eZ.spaceTypes)||[]).reduce((e,t)=>(t.active&&t.name&&t.cardImageURL&&(e[t.name]=t.cardImageURL),e),{}),[eZ]),or=n8.some(e=>!n7[e.name]),on=oe.some(e=>!ot[e]);(0,c.useEffect)(()=>{nE.current=rA},[rA]),(0,c.useEffect)(()=>{nO.current=ex},[ex]),(0,c.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch((0,i.D)("StartProject/catalogs"),{cache:"no-store"});if(!t.ok)throw Error("Unable to load project catalog");let r=await t.json();!e&&Array.isArray(r.projectTypes)&&Array.isArray(r.spaceTypes)&&eQ({projectTypes:r.projectTypes,styles:Array.isArray(r.styles)?r.styles:[],spaceTypes:r.spaceTypes})}catch(e){}finally{e||e0(!0)}})(),()=>{e=!0}},[]),(0,c.useEffect)(()=>{var e;if(!r5)return;let t=document.body.style.overflow,r=nM.current,n=e=>{"Escape"===e.key&&r4(!1)};return document.body.style.overflow="hidden",document.addEventListener("keydown",n),null===(e=nT.current)||void 0===e||e.focus({preventScroll:!0}),()=>{document.body.style.overflow=t,document.removeEventListener("keydown",n),null==r||r.focus({preventScroll:!0})}},[r5]),(0,c.useEffect)(()=>{let e=new URL(window.location.href);if("1"===e.searchParams.get("captureAuth")){let t=function(e){try{let t=e.getItem(s);if(e.removeItem(s),!t)return null;let{details:r,createdAt:n}=JSON.parse(t);if(!Number.isFinite(n)||n>Date.now()||Date.now()-n>36e5||!r||!["projectName","projectType","location","overallIdea","roomId"].every(e=>"string"==typeof r[e])||!Array.isArray(r.styles)||!r.styles.every(e=>"string"==typeof e)||!Array.isArray(r.spaces)||!r.spaces.every(e=>e&&"string"==typeof e.id&&"string"==typeof e.label&&Number.isInteger(e.count)&&e.count>0&&e.count<=20&&[e.instanceIds,e.instanceNames].every(e=>void 0===e||Array.isArray(e)&&e.every(e=>"string"==typeof e))))return null;return r}catch(e){return null}}(window.sessionStorage);e.searchParams.delete("captureAuth"),window.history.replaceState(window.history.state,"",e),t&&(eo(t.projectName),er(t.projectType),ei(t.location),es(t.overallIdea),ed(t.styles),eg((0,t4.wC)(t.spaces)),eR(t.roomId),e5(t.roomId),E(1),M(!0));return}"1"===e.searchParams.get("invitation")&&(np(!0),nr(!0),e.searchParams.delete("invitation"),window.history.replaceState(window.history.state,"",e))},[]),(0,c.useEffect)(()=>{if(!S||!C.isAuthenticated||!n2)return;let e=nU.current;try{e||(e="true"===window.sessionStorage.getItem(rn))}catch(e){}if(e){nU.current=!1,nB.current.add(n2);try{window.sessionStorage.removeItem(rn),window.sessionStorage.setItem(n2,"true")}catch(e){}}},[S,C.isAuthenticated,n2]),(0,c.useEffect)(()=>{if(S&&nu){if(C.isAuthenticated){nr(!1),np(!1);let e=nU.current;try{e||(e="true"===window.sessionStorage.getItem(rn))}catch(e){}if(e){nU.current=!1;try{window.sessionStorage.removeItem(rn)}catch(e){}if(n2){nB.current.add(n2);try{window.sessionStorage.setItem(n2,"true")}catch(e){}}o6(2)}else n3()}else nt||np(!1)}},[S,C.isAuthenticated,n3,n2,nu,nt]),(0,c.useEffect)(()=>{var e;if(!nh)return;let t=document.body.style.overflow,r=nL.current,n=e=>{"Escape"===e.key&&nm(!1)};return document.body.style.overflow="hidden",document.addEventListener("keydown",n),null===(e=nD.current)||void 0===e||e.focus(),()=>{document.body.style.overflow=t,document.removeEventListener("keydown",n),null==r||r.focus()}},[nh]);let oo=(0,c.useMemo)(()=>(0,t4.iI)(ep),[ep]),oa="quick-capture"===et&&!!(null==eB?void 0:eB.referenceId),oi=!!(en.trim()&&(ea.trim()||oa)&&oo.length&&n5.some(e=>e.id===et&&e.enabled));(0,c.useEffect)(()=>{oi&&rw(e=>
1e.startsWith("Complete the project title, location, guided mode, and space")?"":e)},[oi,rw]);let ol=oo.find(e=>e.id===e3)||oo[0],os=async(e,t)=>{if(tl.current||t8(e))return!1;e=tA(e,tY.current);let r=()=>!!n0&&tK.current&&nK.current===n0&&nJ.current===n0;if(!r())return!1;tB(e=>e+1);try{return await (0,tz.r2)(e,r,{...t,onSaved:t=>{var n;if(!r())return;tU.current.set(e.id,(0,tz.Y6)(e)),tX.current+=1;let o=[(0,tz.H3)(t),...nE.current.filter(t=>t.id!==e.id)].sort((e,t)=>(t.updatedAt||"").localeCompare(e.updatedAt||""));nE.current=o,rL(o),(null===(n=tW.current)||void 0===n?void 0:n.id)===e.id&&(0,tz.Y6)(tW.current)===(0,tz.Y6)(e)&&tC("")}})}catch(e){throw r()&&(tC("Your changes have not been saved. Keep this page open and retry."),tZ(!1)),e}finally{tK.current&&nK.current===n0&&tB(e=>Math.max(0,e-1))}},oc=async()=>{if(!n0)return!1;let e=++tX.current;tr(!1),tT(!1);try{let t=await (0,tz.g$)();if(!(tK.current&&nK.current===n0&&tX.current===e))return!1;return nE.current=t,rL(t),tH.current||tC(""),!0}catch(t){return tK.current&&nK.current===n0&&tX.current===e&&(tT(!0),tC("Could not load your saved projects. Please retry."),tZ(!1)),!1}finally{tK.current&&nK.current===n0&&tr(!0)}},od=function(e){var t,r,n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=new Date().toISOString(),i={id:e,projectType:et,projectName:en,location:ea,overallIdea:el,styles:ec,articleRoomEntry:eB,inspirationArticle:eL,inspirationProfessional:eM,spaces:(0,t4.wC)(ep),selections:e4,renderPlacements:rJ,step:R,promptEntryOpen:O,redesignDraft:q,redesignDrafts:H,activeRoomId:e3,redesign:tS(z),captureStage:T?"capture":A?"declutter":D?"inspiration":1===R||2===R?"details":void 0,photos:(0,tx.JA)(ex.filter(e=>e.captureId)),references:(0,tx.JA)(ek.filter(e=>e.captureId)),workspaceAnnotations:eS,team:eI,declutterEdits:tP($),inspirationSource:U,renderSourceByRoom:rX,createdAt:(null===(t=nP.current.get(e))||void 0===t?void 0:t.createdAt)||(null===(r=nE.current.find(t=>t.id===e))||void 0===r?void 0:r.createdAt)||a,updatedAt:a,...o},l=nP.current.get(e),s=(0,tz.xf)((n=tA(i,tY.current),l&&l.projectType===n.projectType&&!(tF(n).number>=tF(l).number)?{...n,step:l.step,captureStage:l.captureStage,promptEntryOpen:l.promptEntryOpen}:n));return nP.current.set(e,s),s};(0,c.useEffect)(()=>{!ta&&tt&&n1&&R>0&&oi&&!tn&&!rS&&tp()},[ta,tt,n1,R,oi,tn,rS,tp]),(0,c.useEffect)(()=>{rB(new URLSearchParams(window.location.search).get("project")||"")},[]),(0,c.useEffect)(()=>((0,tz.bU)(),nE.current=[],rL([]),n0?oc():tr(!0),()=>{tX.current+=1}),[n0]),(0,c.useEffect)(()=>{r5&&n0&&oc()},[r5]);let ou=!ta&&R>0&&tn&&!rS&&nJ.current===n0?od(tn):null;tW.current=ou;let op=ou?(0,tz.Y6)(ou):"";ou&&tO.current===ou.id&&(tU.current.set(ou.id,op),tO.current="");let oh=ex.some(e=>!e.captureId&&!e.isSample)||ek.some(e=>!e.captureId&&!e.isSample),om=!ta&&R>0&&!rS&&(oh||(ou?tU.current.get(ou.id)!==op:!!(en.trim()||ea.trim()||et)));tH.current=om;let og=tD||tQ||t0?"saving":om?"unsaved":tn?"saved":"new";(0,c.useEffect)(()=>{if(ta||!n0||nJ.current!==n0||!ou||!oi||ef||tQ||t0||rS||rM.current||tU.current.get(ou.id)===op)return;let e=!0,t=async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!e||rM.current)return!1;null!==nS.current&&window.clearTimeout(nS.current),nS.current=null;try{return await os(ou,{keepalive:t})}catch(e){return!1}};return nR.current=t,nS.current=window.setTimeout(()=>void t(),800),()=>{e=!1,null!==nS.current&&window.clearTimeout(nS.current),nR.current===t&&(nR.current=null)}},[n0,op,oi,ta,ef,tQ,t0,rS]),(0,c.useEffect)(()=>{let e=e=>{tH.current&&(e.preventDefault(),e.returnValue="")},t=e=>{var t,r;if(!tH.current||e.defaultPrevented||0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let n=null===(r=e.target)||void 0===r?void 0:null===(t=r.closest)||void 0===t?void 0:t.call(r,"a[href]");if(!(n instanceof HTMLAnchorElement)||"_blank"===n.target||n.hasAttribute("download"))return;let o=new URL(n.href,window.location.href);o.pathname===window.location.pathname&&o.search===window.location.search||window.confirm("You have unsaved changes. Leave this page and discard them?")||(e.preventDefault(),e.stopImmediatePropagation())};return window.addEventListener("beforeunload",e),document.addEventListener("click",t,!0),()=>{window.removeEventListener("beforeunload",e),document.removeEventListener("click",t,!0)}},[]);let of=async()=>
1{if(!tH.current||tl.current)return!0;if(!n0||!tW.current||!oi||oh)return window.confirm("You have unsaved changes. Leave this project and discard them?");null!==nS.current&&window.clearTimeout(nS.current);let e=tW.current;try{var t;if(!await os(e))return!1;return(null===(t=tW.current)||void 0===t?void 0:t.id)===e.id&&(0,tz.Y6)(tW.current)===(0,tz.Y6)(e)}catch(e){return!1}};(0,c.useEffect)(()=>{oo.length&&(oo.some(e=>e.id===e3)||e5(oo[0].id),oo.some(e=>e.id===eP)||eR(oo[0].id))},[e3,oo,eP]),(0,c.useEffect)(()=>{(1===R||2===R)&&e$&&et&&(n5.some(e=>e.id===et&&e.enabled)||(er(""),ed([]),e6([])))},[e$,et,n5,R]),(0,c.useEffect)(()=>{te(null),r3(""),r1(null)},[e3]),(0,c.useEffect)(()=>{rz(e=>{let t={};return oo.forEach(r=>{let n=ex.filter(e=>e.roomId===r.id);1===n.length?t[r.id]=n[0].id:n.length>1&&n.some(t=>t.id===e[r.id])&&(t[r.id]=e[r.id])}),t})},[oo,ex]),(0,c.useEffect)(()=>{let e=new Set(oo.map(e=>e.id)),t=new Set(e4.map(e=>e.id));rZ(r=>r.filter(r=>e.has(r.roomId)&&t.has(r.selectionId)))},[oo,e4]),(0,c.useEffect)(()=>()=>{var e,t;nx.current&&window.clearInterval(nx.current),null===(e=nb.current)||void 0===e||e.getTracks().forEach(e=>e.stop()),nw.current&&URL.revokeObjectURL(nw.current),null===(t=nk.current)||void 0===t||t.remove()},[]);let ov=(0,c.useCallback)(async()=>{if(!eH&&!ez){eK(!0),eJ(!1);try{let e=await fetch((0,i.D)("HybridSearch/VisualBrowse?page=1&pageSize=48&seed=project-planner"),{cache:"no-store"});if(!e.ok)throw Error("Unable to load inspiration");let t=await e.json();eG(Array.isArray(null==t?void 0:t.items)?t.items:[]),eX(!0)}catch(e){eJ(!0)}finally{eK(!1)}}},[eH,ez]);(0,c.useEffect)(()=>{let e=2===R&&on||3===R&&or;!e$||!e||eH||ez||eV||ov()},[e$,ov,on,R,or,eV,eH,ez]),(0,c.useEffect)(()=>{if(3!==R||!e$)return;let e=new AbortController;return Promise.all(n8.filter(e=>!n7[e.name]&&!eY.current.has(e.name)).map(async t=>{let r=new URLSearchParams({page:"1",pageSize:"1",seed:"planner-style-card",styles:t.aliases.join(",")});try{var n;let o=await fetch((0,i.D)("HybridSearch/VisualBrowse?".concat(r)),{signal:e.signal});if(!o.ok)return;let a=await o.json(),l=null==a?void 0:null===(n=a.items)||void 0===n?void 0:n[0];if(e.signal.aborted||!(null==l?void 0:l.imageUrl))return;eY.current.add(t.name),eq(e=>({...e,[t.name]:{imageUrl:l.imageUrl,title:l.title}}))}catch(e){}})),()=>e.abort()},[e$,n8,R,n7]);let oy=(0,c.useCallback)(async(e,t)=>{let r=ru(e.baseLabel,ec),n="".concat(r,":").concat(t);if(nC.current.has(n))return;nC.current.add(n),e2(e=>{let t=e[r];return{...e,[r]:{items:(null==t?void 0:t.items)||[],page:(null==t?void 0:t.page)||0,pages:(null==t?void 0:t.pages)||0,total:(null==t?void 0:t.total)||0,loading:!0,error:!1}}});let o=new URLSearchParams({page:String(t),pageSize:String(12),seed:"planner-".concat(r).slice(0,40),room:e.baseLabel}),a=Array.from(new Set(ec.flatMap(e=>n9[e]||[e])));a.length&&o.set("styles",a.join(","));try{let e=await fetch((0,i.D)("HybridSearch/VisualBrowse?".concat(o.toString())),{cache:"no-store"});if(!e.ok)throw Error("Unable to load inspiration");let n=await e.json(),a=Array.isArray(null==n?void 0:n.items)?n.items:[];e2(e=>{let o=e[r],i=1===t?a:[...(null==o?void 0:o.items)||[],...a],l=Array.from(new Map(i.map(e=>[e.imageId,e])).values());return{...e,[r]:{items:l,page:Number(null==n?void 0:n.page)||t,pages:Number(null==n?void 0:n.pages)||0,total:Number(null==n?void 0:n.total)||l.length,loading:!1,error:!1}}})}catch(e){e2(e=>{let t=e[r];return{...e,[r]:{items:(null==t?void 0:t.items)||[],page:(null==t?void 0:t.page)||0,pages:(null==t?void 0:t.pages)||0,total:(null==t?void 0:t.total)||0,loading:!1,error:!0}}})}finally{nC.current.delete(n)}},[n9,ec]),oj=(0,c.useMemo)(()=>n8.map(e=>{var t;let r=n7[e.name],n=eF[e.name],o=r?void 0:eW.find(t=>rd(t.style,e.aliases));return{name:e.name,description:e.description||(null===(t=t6.find(t=>t.names.includes(e.name)))||void 0===t?void 0:t.description)||"",imageUrl:r||(null==n?void 0:n.imageUrl)||(null==o?void 0:o.imageUrl)||"",title:r?e.name:(null==n?void 0:n.title)||(null==o?void 0:o.title)||e.name}}),[n8,n7,eF,eW]),ob=(0,c.useMemo)(()=>{let e=new Set;return oe.map(t=>{let r=ot[t],n=eW.filter(e=>(function(e,t){let r=rc(e||""),n=rc(t);if(!r||!n)return!1;let o=n.split(" ").filter(e=>!["primary","secondary","room","area","home","walk","in"].includes(e));return n.includes("kitchenette")&&o.push("kitchen"),n.includes("outdoor")&&o.push("patio","terrace"),"entry"===n&&o.push("foyer"),o.some(e=>r.includes(e))})(e.roomType,t)),o=n.find(t=>{var r;return!e.has(t.imageUrl)&&(!ec.length||(r=t.style,ec.some(e=>rd(r,n9[e]||[e]))))}),a=r?void 0:o||n.find(t=>!e.has(t.imageUrl))||n[0],i=r||(null==a?void 0:a.imageUrl)||"";return i&&e.add(i),{label:t,imageUrl:i,imageTitle:r?t:(null==a?void 0:a.title)||t}})},[n9,ec,ot,oe,eW]),ox=e=>{n5.some(t=>
1t.id===e&&t.enabled)&&e!==et&&(th||(ex.forEach(e=>{URL.revokeObjectURL(e.url),e.originalUrl&&URL.revokeObjectURL(e.originalUrl)}),ew([])),er(e),ed([]),eg(t=>t.length?rg(e,t):"new-build"===e?rl.map(e=>({...e})):[]),e6([]))},ow=e=>{var t,r;let n=(null===(t=oo[0])||void 0===t?void 0:t.id)||rs(e);((null===(r=ep[0])||void 0===r?void 0:r.id)!==n||1!==ep.length)&&("quick-capture"===et?ew(e=>e.map(e=>({...e,roomId:n}))):(ex.forEach(e=>{URL.revokeObjectURL(e.url),e.originalUrl&&URL.revokeObjectURL(e.originalUrl)}),ew([])),e6([])),eg([{id:n,label:e,count:1}])},ok=e=>{ed(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},o_=e=>{let t=rs(e);if(re(et)){var r;(null===(r=ep[0])||void 0===r?void 0:r.id)!==t&&(ex.forEach(e=>{URL.revokeObjectURL(e.url),e.originalUrl&&URL.revokeObjectURL(e.originalUrl)}),ew([]),e6([])),eg([{id:t,label:e,count:1}]);return}eg(r=>r.find(e=>e.id===t)?(0,t4.J$)(r,t,1):[...r,{id:t,label:e,count:1}])},oI=(e,t)=>{if(re(et)){t<0&&(ex.forEach(e=>{URL.revokeObjectURL(e.url),e.originalUrl&&URL.revokeObjectURL(e.originalUrl)}),ew([]),e6([]),eg([]));return}let r=(0,t4.J$)(ep,e,t),n=new Set((0,t4.iI)(r).map(e=>e.id));if(ex.some(e=>!n.has(e.roomId))){rw("Remove the photos in this space first.");return}eg(r)},oC=()=>{let e=ej.trim();e&&(o_(e),eb(""))},oS=(e,t)=>Array.from(e).filter(e=>e.type.startsWith("image/")).map(e=>({id:crypto.randomUUID(),roomId:t,name:e.name,url:URL.createObjectURL(e)})),oN=()=>{S&&(!function(e,t){try{e.setItem(s,JSON.stringify({details:t,createdAt:Date.now()}))}catch(e){}}(window.sessionStorage,{projectName:en,projectType:et,location:ea,overallIdea:el,styles:ec,spaces:(0,t4.wC)(ep),roomId:eP}),no(!0),nr(!0))},oP=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eP;if(!S||!C.isAuthenticated){oN();return}if(!e||!t)return;let r=oS(e,t);ew(e=>[...e,...r])},oR=e=>{nO.current=nO.current.filter(t=>t.id!==e),ew(t=>{let r=t.find(t=>t.id===e);return r&&(URL.revokeObjectURL(r.url),r.originalUrl&&URL.revokeObjectURL(r.originalUrl)),t.filter(t=>t.id!==e)})},oE=ol?ru(ol.baseLabel,ec):"",oT=oE?e1[oE]:void 0,oM=(null==oT?void 0:oT.items)||[];(0,c.useEffect)(()=>{5===R&&ol&&!oT&&oy(ol,1)},[oT,ol,oy,R]);let oA=(e,t,r,n)=>e4.some(o=>o.roomId===e&&o.imageId===t&&o.type===r&&(void 0===n||o.label===n)),oL=e=>{if(!ol)return;let t=e4.find(t=>t.roomId===ol.id&&t.imageId===e.imageId&&"image"===t.type);if(t){e6(e=>e.filter(e=>e.id!==t.id));return}e6(t=>[...t,{id:"image-".concat(ol.id,"-").concat(e.imageId),roomId:ol.id,imageId:e.imageId,imageUrl:e.imageUrl,title:e.title,type:"image",label:"Entire image"}])},oD=(e,t,r)=>{var n,o,a;if(!ol||!t.label)return;let i="placement-".concat(ol.id,"-").concat(e.imageId,"-").concat(null!==(n=t.id)&&void 0!==n?n:r);if(e4.some(e=>e.id===i)){e6(e=>e.filter(e=>e.id!==i));return}let l=rm(t),s=null!==(o=null==l?void 0:l.width)&&void 0!==o?o:.12,c=null!==(a=null==l?void 0:l.height)&&void 0!==a?a:.12,d=Number.isFinite(Number(t.x))?Number(t.x):.5,u=Number.isFinite(Number(t.y))?Number(t.y):.5;e6(r=>{var n,o,a;return[...r,{id:i,roomId:ol.id,imageId:e.imageId,imageUrl:e.imageUrl,title:e.title,type:"placement",label:t.label||"Tagged detail",region:{x:null!==(o=null==l?void 0:l.x)&&void 0!==o?o:Math.max(0,Math.min(1-s,d-s/2)),y:null!==(a=null==l?void 0:l.y)&&void 0!==a?a:Math.max(0,Math.min(1-c,u-c/2)),width:s,height:c,polygon:l&&(null===(n=t.polygon)||void 0===n?void 0:n.length)?t.polygon.map(e=>({x:e.x,y:e.y})):void 0}}]})},oB=(e,t)=>{if(0!==e.button)return;let r=rf(e);e.currentTarget.setPointerCapture(e.pointerId),te(null),e9({imageId:t,startX:r.x,startY:r.y,currentX:r.x,currentY:r.y})},oU=(e,t)=>{if(!e8||e8.imageId!==t)return;let r=rf(e);e9(e=>e?{...e,currentX:r.x,currentY:r.y}:null)},oW=(e,t)=>{if(!e8||e8.imageId!==t.imageId||!ol)return;let r=rf(e),n=Math.min(e8.startX,r.x),o=Math.min(e8.startY,r.y),a=Math.abs(r.x-e8.startX),i=Math.abs(r.y-e8.startY);e9(null),a<.04||i<.04||te({roomId:ol.id,imageId:t.imageId,imageUrl:t.imageUrl,title:t.title,region:{x:n,y:o,width:a,height:i},label:""})},oO=()=>{if(!(null==e7?void 0:e7.label.trim()))return;let e=e7.label.trim();e6(t=>[...t,{id:"region-".concat(e7.roomId,"-").concat(e7.imageId,"-").concat(Date.now()),roomId:e7.roomId,imageId:e7.imageId,imageUrl:e7.imageUrl,title:e7.title,type:"region",label:e,region:e7.region}]),te(null)},oG=e=>e8&&e8.imageId===e?{x:Math.min(e8.startX,e8.currentX),y:Math.min(e8.startY,e8.currentY),width:Math.abs(e8.currentX-e8.startX),height:Math.abs(e8.currentY-e8.startY)}:null,oF=e=>{e6(t=>t.filter(t=>t.id!==e)),rZ(t=>t.filter(t=>t.selectionId!==e))},oq=()=>{let e=nj.current;e&&"inactive"!==e.state&&e.stop()},oY=()=>{nw.current&&URL.revokeObjectURL(nw.current),nw.current="",rG(""),rH(0),rq("")},oH=async()=>{var e;if(rq(""),oY(),!(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.getUserMedia)||"undefined"==typeof MediaRecorder){rq("Voice narration is not supported in this browser. You can write the idea instead.");return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t="undefined"==typeof MediaRecorder?"":["audio/webm;codecs=opus","audio/mp4","audio/webm"].find(e=>
1MediaRecorder.isTypeSupported(e))||"",r=new MediaRecorder(e,t?{mimeType:t}:void 0),n=[];nb.current=e,nj.current=r,r.ondataavailable=e=>{e.data.size&&n.push(e.data)},r.onstop=()=>{if(nx.current&&window.clearInterval(nx.current),nx.current=null,e.getTracks().forEach(e=>e.stop()),nb.current=null,nj.current=null,rW(!1),!n.length){rq("No audio was captured. Please try again.");return}let r=new Blob(n,{type:t||"audio/webm"}),o=URL.createObjectURL(r);nw.current=o,rG(o)},r.start(1e3),rH(0),rW(!0),nx.current=window.setInterval(()=>{rH(e=>e>=299?("inactive"!==r.state&&r.stop(),300):e+1)},1e3)}catch(e){rq("Unable to access the microphone. Please check your browser settings.")}},oX=(e,t)=>{rX[e]!==t&&(r3(""),r1(null),rz(r=>({...r,[e]:t})),rZ(t=>t.filter(t=>t.roomId!==e)))},oz=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5;if(!ol||!au||!e.region)return;r3(""),r1(null);let n=rp(.19/Math.max(e.region.width/Math.max(e.region.height,.01),.35),.1,.3),o={x:rp(t-.095,0,.81),y:rp(r-n/2,0,1-n),width:.19,height:n};rZ(t=>[...t,{id:"composition-".concat(ol.id,"-").concat(e.id,"-").concat(Date.now()),roomId:ol.id,selectionId:e.id,imageUrl:e.imageUrl,label:e.label,sourceRegion:e.region,target:o}])},oK=e=>{let t=n_.current.get(e);if(!t)return null;let r=(t.querySelector("[data-composition-drag-preview]")||t).getBoundingClientRect();return{x:r.left+r.width/2,y:r.top+r.height/2,rect:r}},oV=(e,t,r)=>{let n=n_.current.get(e);if(!n)return!1;let o=(n.querySelector("[data-composition-drag-preview]")||n).getBoundingClientRect();return t>=o.left-12&&t<=o.right+12&&r>=o.top-12&&r<=o.bottom+12},oJ=(e,t)=>{var r;if(!t.region)return;r3(""),e.dataTransfer.setData("application/x-taa-reference",t.id),e.dataTransfer.setData("text/plain",t.label),e.dataTransfer.effectAllowed="copy";let n=e.currentTarget.querySelector("[data-composition-drag-preview]");if(!n)return;null===(r=nk.current)||void 0===r||r.remove();let o=n.getBoundingClientRect(),a=document.createElement("canvas");a.width=2,a.height=2;let i=a.getContext("2d");i&&(i.fillStyle="rgba(20, 20, 18, 0.01)",i.fillRect(0,0,2,2)),Object.assign(a.style,{position:"fixed",zIndex:"2147483647",left:"".concat(o.left,"px"),top:"".concat(o.top,"px"),width:"2px",height:"2px",pointerEvents:"none"}),document.body.appendChild(a),nk.current=a,a.offsetWidth,e.dataTransfer.setDragImage(a,1,1),r1({selectionId:t.id,startX:o.left+o.width/2,startY:o.top+o.height/2,endX:e.clientX||o.left+o.width/2,endY:e.clientY||o.top+o.height/2})},oZ=e=>{(e.clientX||e.clientY)&&r1(t=>t?{...t,endX:e.clientX,endY:e.clientY}:t)},oQ=()=>{var e;null===(e=nk.current)||void 0===e||e.remove(),nk.current=null,r1(null)},o$=(e,t)=>{if(0!==e.button)return;e.preventDefault(),e.stopPropagation();let r=e.currentTarget.parentElement;if(!r)return;let n=r.getBoundingClientRect(),o=t.target.x+t.target.width/2,a=t.target.y+t.target.height/2;r2&&r2!==t.id&&r3(""),e.currentTarget.setPointerCapture(e.pointerId);let i=oK(t.selectionId);r$({placementId:t.id,selectionId:t.selectionId,startX:e.clientX,startY:e.clientY,grabOffsetX:(e.clientX-n.left)/n.width-o,grabOffsetY:(e.clientY-n.top)/n.height-a,wasActive:r2===t.id}),i&&r1({selectionId:t.selectionId,placementId:t.id,startX:i.x,startY:i.y,endX:e.clientX,endY:e.clientY})},o0=e=>{if(!rQ)return;let t=e.currentTarget.parentElement;if(!t)return;let r=t.getBoundingClientRect(),n=oV(rQ.selectionId,e.clientX,e.clientY),o=rp((e.clientX-r.left)/r.width-rQ.grabOffsetX,0,1),a=rp((e.clientY-r.top)/r.height-rQ.grabOffsetY,0,1),i=e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom;r1(t=>t?{...t,endX:n||!i?e.clientX:r.left+o*r.width,endY:n||!i?e.clientY:r.top+a*r.height,returning:n}:t),rZ(e=>e.map(e=>e.id!==rQ.placementId?e:{...e,target:{...e.target,x:o-e.target.width/2,y:a-e.target.height/2}}))},o1=(e,t)=>{let r=oV(t.selectionId,e.clientX,e.clientY),n=rQ&&5>Math.hypot(e.clientX-rQ.startX,e.clientY-rQ.startY);if(r)rZ(e=>e.filter(e=>e.id!==t.id)),r3(""),r1(null);else if(n){let r=r2!==t.id;if(r3(r?t.id:""),r){let r=oK(t.selectionId),n=e.currentTarget,o=n.getBoundingClientRect();r&&r1({selectionId:t.selectionId,placementId:t.id,startX:r.x,startY:r.y,endX:o.left+o.width/2,endY:o.top+o.height/2}),n.focus({preventScroll:!0})}else r1(null),e.currentTarget.blur()}else(null==rQ?void 0:rQ.wasActive)?r1(e=>e?{...e,returning:!1}:e):r1(null);r$(null)},o2=(e,t)=>
1{if(rQ||r2&&r2!==t.id)return;let r=oK(t.selectionId);if(!r)return;let n=e.getBoundingClientRect();r1({selectionId:t.selectionId,placementId:t.id,startX:r.x,startY:r.y,endX:n.left+n.width/2,endY:n.top+n.height/2})},o3=e=>{rQ||r2===e||r1(t=>(null==t?void 0:t.placementId)===e?null:t)},o5=e=>{rZ(t=>t.filter(t=>t.id!==e)),r1(t=>(null==t?void 0:t.placementId)===e?null:t),r2===e&&r3("")},o4=async()=>{if(rT.current||!ex.length)return!1;if(ta)return rw(""),M(!1),L(!0),!0;if(n1&&tn&&ex.every(e=>e.captureId))return rw(""),M(!1),L(!0),window.scrollTo({top:0,behavior:"smooth"}),!0;rT.current=!0,t$(!0),rw(""),null!==nS.current&&window.clearTimeout(nS.current);try{if(!n1)throw Error("Sign in again to save your project and photos.");let e=tp();await os(od(e,{captureStage:"capture"}));let t=await (0,tx.dh)(e,ex),r={...$};return t.forEach(e=>{let t=r[e.id]||{versions:[],masks:{},captureIds:{}};r[e.id]={...t,captureIds:{...t.captureIds,original:e.captureId}}}),ew(t),ee(r),await os(od(e,{captureStage:"declutter",photos:(0,tx.JA)(t)})),M(!1),L(!0),window.scrollTo({top:0,behavior:"smooth"}),!0}catch(e){return rw(e instanceof Error?e.message:"Your photos could not be saved. Please try again."),!1}finally{rT.current=!1,t$(!1)}},o6=async e=>{(2!==R||0===e||2===e||oi)&&(0!==e||!(R>0)||await of())&&(M(!1),L(!1),B(!1),E(Math.max(0,Math.min(7,e))),window.scrollTo({top:0,behavior:"smooth"}))},o8=()=>{tq.current=null,tY.current=null,eU(void 0),eD(void 0),eA(void 0),ry.current=null,t1(!1),eT(!0),ts(!1),rw(""),r_(""),M(!1),L(!1),B(!1),ee({}),W(""),F(!1),Y(""),X({}),K(tw()),ex.forEach(e=>{URL.revokeObjectURL(e.url),e.originalUrl&&URL.revokeObjectURL(e.originalUrl)}),ek.forEach(e=>{URL.revokeObjectURL(e.url),e.originalUrl&&URL.revokeObjectURL(e.originalUrl)}),er(""),eo(""),ei(""),es(""),ed([]),eg([]),ew([]),e_([]),eC((0,_.vT)()),eN({selections:{},connections:{}}),e6([]),e5(""),eR(""),te(null),rz({}),rV({}),rZ([]),r$(null),r1(null),r3(""),rU&&oq(),oY()};nZ.current=()=>{nR.current=null,null!==nS.current&&window.clearTimeout(nS.current),nS.current=null,nW.current=null,rT.current=!1,nN.current="",nI.current="",nP.current.clear(),nE.current=[],nO.current=[],tu(""),rB(""),tf(""),rL([]),r4(!1),nd(!1),tC(""),tU.current.clear(),tW.current=null,tH.current=!1,tB(0),t$(!1),rN(!1),rE.current=null,rR(null),E(0),o8()};let o9=async()=>!!await of()&&(nR.current=null,null!==nS.current&&(window.clearTimeout(nS.current),nS.current=null),nN.current="",tu(""),tf(""),rB(""),r4(!1),o8(),!0),o7=async e=>{nL.current=e.currentTarget,await o9()&&(nf(""),ny(""),nm(!0))},ae=async e=>{if(rE.current||rS)return!1;let t={};rE.current=t;try{var r,n,o,a;if(!await of()||!(rE.current===t&&tK.current&&nK.current===n0))return!1;rN(!0),r4(!1),rR({id:e.id,title:e.projectName}),tC(""),rC("");let i=await (0,tz.Fl)(e.id);if(!(rE.current===t&&tK.current&&nK.current===n0))return!1;rR({id:e.id,title:i.projectName});let l=await tM(i);if(!(rE.current===t&&tK.current&&nK.current===n0))return!1;let s=l.photos,c=l.references,d=l.designs,{missingPhotoCount:u,missingReferenceCount:p}=l;r4(!1);let h=[(0,tz.H3)(i),...nE.current.filter(e=>e.id!==i.id)];nE.current=h,rL(h),tO.current=i.id,o8(),tu(i.id),tq.current={id:i.id,owner:n0},tY.current=function(e,t){let r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return e.filter(e=>!t.some(t=>t.id===e.id||e.captureId&&t.captureId===e.captureId))},n=r(e.photos,t.photos);return{id:e.id,photos:n,references:r(e.references,t.references),declutterEdits:Object.fromEntries(n.flatMap(t=>{var r;return(null===(r=e.declutterEdits)||void 0===r?void 0:r[t.id])?[[t.id,e.declutterEdits[t.id]]]:[]}))}}(i,l),nP.current.set(i.id,i),er(i.projectType||""),eU(i.articleRoomEntry),eD(i.inspirationArticle),eA(i.inspirationProfessional),eo(t9(i.projectName||"")),ei(i.location||""),es(i.overallIdea||""),ed(Array.isArray(i.styles)?i.styles:[]),eg(rg(i.projectType||"",Array.isArray(i.spaces)?i.spaces:[])),e6(Array.isArray(i.selections)?i.selections:[]),rZ(Array.isArray(i.renderPlacements)?i.renderPlacements:[]),ew(l.photos),eT(!s.length);let m=new URLSearchParams(window.location.search),g=m.get("project")===i.id?m.get("space"):null,f=g&&(0,t4.iI)(i.spaces||[]).some(e=>e.id===g)?g:i.activeRoomId||(null===(r=s[0])||void 0===r?void 0:r.roomId)||"";e5(f),eR(f),e_(c),eC((0,_.Ps)(i.team)),eN(i.workspaceAnnotations||{selections:{},connections:{}}),ee(l.edits),W(i.inspirationSource||""),F(!!i.promptEntryOpen),Y(null!==(a=i.redesignDraft)&&void 0!==a?a:(null===(n=i.redesign)||void 0===n?void 0:n.versions.length)||(null===(o=i.redesign)||void 0===o?void 0:o.job)?"":i.overallIdea||""),K(d),X(i.redesignDrafts||{}),rz(i.renderSourceByRoom||{});let v=tF(i);return E(v.step),window.scrollTo({top:0,behavior:"smooth"}),v.captureStage&&(E(1),M("capture"===v.captureStage||!s.length),L("declutter"===v.captureStage&&!!s.length),B("inspiration"===v.captureStage&&!!s.length)),u?r_("This project’s saved photo file is unavailable. Add the room photo again to continue."):p&&rw("One or more saved reference images are unavailable. Add them again to continue."),rR(null),!0}catch(n){if(!(rE.current===t&&tK.current&&nK.current===n0))return!1;let r=n instanceof Error?n.message:"The project could not be opened. Please try again.";return rR({id:e.id,title:e.projectName,error:r}),!1}finally{rE.current===t&&tK.current&&nK.current===n0&&(rE.current=null,rN(!1))}};(0,c.useEffect)(()=>
1{if(!tt||!n1||!rD||nI.current===rD)return;let e=rA.find(e=>e.id===rD);e&&(nI.current=rD,ae(e))},[n1,rD,rA,tt]);let at=async e=>{if(0===R&&n1&&!rS&&!ne.current&&window.confirm("Delete this project? This can’t be undone.")){ne.current=e.id,r8(e.id),r7("");try{if(await (0,tz._L)(e.id),nK.current!==n0)return;let t=nE.current.filter(t=>t.id!==e.id);nE.current=t,rL(t),nP.current.delete(e.id),td.current===e.id&&(nR.current=null,null!==nS.current&&window.clearTimeout(nS.current),tu(""),rB(""),tf(""),o8())}catch(e){nK.current===n0&&r7("Could not delete the project. Please try again.")}finally{ne.current="",r8("")}}},ar=async()=>{if(tn&&n0)try{if(await (0,tz._L)(tn),nK.current!==n0)return;let e=nE.current.filter(e=>e.id!==tn);nE.current=e,rL(e),tU.current.delete(tn)}catch(e){tC("Could not reset this project. Please retry.");return}nR.current=null,null!==nS.current&&window.clearTimeout(nS.current),o8(),tu(""),E(0)},an=n5.find(e=>e.id===et),ao=async()=>{if(!tD){if(tN){await oc();return}if(nO.current.some(e=>!e.captureId&&!e.isSample)){await aW();return}if(tH.current&&tW.current)try{await os(tW.current)}catch(e){}else await oc()}},aa=ex.length,ai=new Set(e4.map(e=>e.roomId)).size,al=ex.filter(e=>e.roomId===(null==ol?void 0:ol.id)),as=e4.filter(e=>e.roomId===(null==ol?void 0:ol.id)),ac=as.filter(e=>!!e.region),ad=rJ.filter(e=>e.roomId===(null==ol?void 0:ol.id)),au=al.find(e=>e.id===rX[(null==ol?void 0:ol.id)||""]),ap=ex.find(e=>e.id===rX[(null==ol?void 0:ol.id)||""])||ex.find(e=>e.roomId===(null==ol?void 0:ol.id)),ah=ek.find(e=>e.id===(null==eB?void 0:eB.referenceId)&&e.roomId===(null==ol?void 0:ol.id)),am=["quick-capture","whole-home"].includes(et)&&"prompt"===U,ag=async function(e){var t,r,n;let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2?arguments[2]:void 0,i=e.versions.find(t=>t.id===e.selectedId),l=a&&i?null===(t=$[i.photoId])||void 0===t?void 0:t.versions.find(e=>e.id===a):void 0;if((null==l?void 0:l.locked)&&!1===l.visible)throw Error("Unlock this design in Layers before showing it.");let s=a||(i&&!z.versions.some(e=>e.id===i.id)?i.id:void 0),c=tR(ex,$,e,s);ee(c.edits),ew(c.photos),i&&(e={...e,selectedByPhoto:{...z.selectedByPhoto,...e.selectedByPhoto,[i.photoId]:i.id}});let d=(null===(r=e.job)||void 0===r?void 0:r.photoId)||(null==i?void 0:i.photoId)||"",u=o&&d?{...H,[d]:""}:H;K(e),o&&(Y(""),X(u));let p=(null==i?void 0:i.prompt)||(null===(n=e.job)||void 0===n?void 0:n.prompt)||el;if(p&&re(et)&&es(p),null!==nS.current&&window.clearTimeout(nS.current),tl.current)return;let h=tp();await os(od(h,{redesign:tS(e),declutterEdits:tP(c.edits),photos:(0,tx.JA)(c.photos.filter(e=>e.captureId)),redesignDrafts:u,redesignDraft:o?"":q,overallIdea:re(et)?p:el}))},af=au?rK[au.id]:void 0,av=oo.filter(e=>{let t=ex.filter(t=>t.roomId===e.id);return t.length>1&&!t.some(t=>t.id===rX[e.id])}),ay=[2,3,4,5,6,7].map(e=>({label:5===e&&["quick-capture","whole-home"].includes(et)?"References":rr[e-1],step:e,capture:!1,declutter:!1,inspiration:!1}));["quick-capture","whole-home"].includes(et)&&ay.splice(1,0,{label:"Project Gallery",step:1,capture:!0,declutter:!1,inspiration:!1},{label:"Remove & declutter",step:1,capture:!1,declutter:!0,inspiration:!1},{label:"Inspiration",step:1,capture:!1,declutter:!1,inspiration:!0});let aj=2===R||1===R&&!T&&!A&&!D,ab=ay.findIndex(e=>e.step===(aj?2:R)&&e.capture===T&&e.declutter===A&&e.inspiration===D),ax=ab+1,aw=R>0&&(R<=2||6===R&&am),ak=!1!==th&&aw,a_=!0!==th||!aw,aI=D||6===R&&am?O||6===R?"redesign":"inspiration":A?"cleanup":"photos",aC=ex.find(e=>e.id===tg&&e.roomId===e3)||ex.find(e=>e.roomId===e3),aS=(null===(e=ak?aC:ap)||void 0===e?void 0:e.id)||"",aN=null!==(I=H[aS])&&void 0!==I?I:aS===(null===(t=ex[0])||void 0===t?void 0:t.id)?q:"",aP=e=>X(t=>({...t,[aS]:e})),aR=ef||tQ||rS||V||ty,aE=aR||t0,[aT,aM]=(0,a.O)("");(0,c.useEffect)(()=>{aM("")},[tn,n0,aM]);let aA=function(e){let t=(0,c.useRef)(e);t.current=e;let r=(0,c.useRef)(!0);(0,c.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let n=(0,c.useRef)({scope:"",attempts:new Map,pending:new Set,captures:null}),o="".concat(e.accountKey,":").concat(e.projectId);n.current.scope!==o&&(n.current={scope:o,attempts:new Map,pending:new Set,captures:null});let a=async function(e){var o,a,i,l;let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=t.current;if(!c.projectId||!c.accountKey||!e)return;let d=[...c.photos,...c.references].find(t=>t.url===e||t.originalUrl===e),u=Object.entries(c.edits).flatMap(e=>{let[t,r]=e;return r.versions.map(e=>({photoId:t,version:e}))}).find(t=>t.version.url===e),p=(null==u?void 0:u.version.id)||((null==d?void 0:d.url)===e?d.selectedGenerationId:void 0);if(!p&&!(null==d?void 0:d.captureId))return;let h=p?"generation:".concat(p):"capture:".concat(d.captureId),m=n.current;
1if(m.pending.has(h))return;let g=()=>r.current&&n.current===m&&t.current.projectId===c.projectId&&t.current.accountKey===c.accountKey,f=()=>{!s&&g()&&t.current.onError("A photo could not be loaded. Check your connection and reopen the project to retry.")};if(Date.now()-(null!==(o=m.attempts.get(h))&&void 0!==o?o:0)<3e4){f();return}m.attempts.set(h,Date.now()),m.pending.add(h);try{let r;if(p)r=(await (0,G.oG)(c.projectId,p)).url;else{if(!m.captures){let e=(0,G.$Q)(c.projectId);m.captures=e,e.finally(()=>{m.captures===e&&(m.captures=null)}).catch(()=>{})}let e=await m.captures;r=null===(i=e.find(e=>"ready"===e.status&&(e.captureID===d.captureId||e.clientCaptureKey===d.id)))||void 0===i?void 0:null===(a=i.downloads.find(e=>"source_photo"===e.assetType))||void 0===a?void 0:a.downloadUrl}if(!g())return;if(!r||r===e){f();return}if(s&&await (l=r,new Promise((e,t)=>{let r=new Image,n=window.setTimeout(()=>o(Error("Photo loading timed out.")),2e4),o=o=>{window.clearTimeout(n),r.onload=null,r.onerror=null,o?t(o):e()};r.onload=()=>o(),r.onerror=()=>o(Error("Photo could not be loaded.")),r.src=l})),!g())return;let n=r,o=t=>t.map(t=>t.url!==e&&t.originalUrl!==e?t:{...t,url:t.url===e?n:t.url,...t.originalUrl===e?{originalUrl:n}:{}});t.current.setPhotos(o),t.current.setReferences(o),p&&t.current.setEdits(t=>Object.fromEntries(Object.entries(t).map(t=>{let[r,o]=t;return[r,{...o,versions:o.versions.map(t=>t.id===p&&t.url===e?{...t,url:n}:t)}]})))}catch(e){f()}finally{m.pending.delete(h)}},i=(0,c.useRef)(a);return i.current=a,(0,c.useEffect)(()=>{if(!e.projectId||!e.accountKey)return;let r=()=>{if("hidden"===document.visibilityState||!navigator.onLine)return;let e=t.current;for(let t of Array.from(new Set([...e.photos.flatMap(e=>[e.url,e.originalUrl]),...e.references.flatMap(e=>[e.url,e.originalUrl]),...Object.values(e.edits).flatMap(e=>e.versions.map(e=>e.url))]))){if(!t)continue;let e=function(e){try{let t=new URL(e);if("https:"!==t.protocol&&"http:"!==t.protocol)return null;let r=t.searchParams.get("X-Amz-Date"),n=t.searchParams.get("X-Amz-Expires");if(r&&/^\d{8}T\d{6}Z$/.test(r)&&n&&/^\d+$/.test(n)){let e=Date.parse("".concat(r.slice(0,4),"-").concat(r.slice(4,6),"-").concat(r.slice(6,8),"T").concat(r.slice(9,11),":").concat(r.slice(11,13),":").concat(r.slice(13,15),"Z"));return Number.isFinite(e)?e+1e3*Number(n)-12e4:null}let o=t.searchParams.get("Expires");if(t.searchParams.has("Signature")&&o&&/^\d+$/.test(o))return 1e3*Number(o)-12e4}catch(e){}return null}(t);null!==e&&e<=Date.now()&&i.current(t,!0)}};r();let n=window.setInterval(r,3e4);return window.addEventListener("focus",r),window.addEventListener("online",r),document.addEventListener("visibilitychange",r),()=>{window.clearInterval(n),window.removeEventListener("focus",r),window.removeEventListener("online",r),document.removeEventListener("visibilitychange",r)}},[o]),a}({projectId:tn,accountKey:n0,photos:ex,references:ek,edits:$,setPhotos:ew,setReferences:e_,setEdits:ee,onError:aM}),aL=(e,t)=>{ew(r=>r.map(r=>{if(r.id!==e)return r;let n=r.originalUrl||r.url;return{...r,originalUrl:n,url:(null==t?void 0:t.url)||n,selectedGenerationId:null==t?void 0:t.id}}))},aD=async(e,t)=>{let r=("room"===e?ex:ek).find(e=>e.id===t);if(!r||r.isSample||aE||rM.current||!window.confirm("Delete this image? This can’t be undone."))return;let n=()=>td.current===tn&&nK.current===n0;rM.current=!0,null!==nS.current&&window.clearTimeout(nS.current),nR.current=null,t$(!0),rw("");try{if(!tl.current&&!await (0,tx.DQ)(tn,r,()=>
1n()&&!!n0&&nJ.current===n0)||!n())return;let o=t3(od(tn),e,t);if("room"===e){let n=ex.filter(e=>e.id!==t);nO.current=n,ew(n),tf(e=>{var o;return e===t?(null===(o=n.find(e=>e.roomId===r.roomId)||n[0])||void 0===o?void 0:o.id)||"":e}),ee(e=>Object.fromEntries(Object.entries(e).filter(e=>{let[r]=e;return r!==t}))),rz(o.renderSourceByRoom||{}),X(o.redesignDrafts||{}),K(r=>t3({redesign:r},e,t).redesign||tw())}else e_(e=>e.filter(e=>e.id!==t));eN(o.workspaceAnnotations||{selections:{},connections:{}}),URL.revokeObjectURL(r.url),r.originalUrl&&URL.revokeObjectURL(r.originalUrl),tl.current||await os(o)}catch(e){n()&&rw(e instanceof Error?e.message:"The image could not be deleted. Please try again.")}finally{rM.current=!1,n()&&t$(!1)}},aB=()=>{if(!oi)return rw("Complete the project title, location, guided mode, and space in Project details before processing."),!1;if(!S||!C.isAuthenticated)return oN(),!1;let e=tq.current;if(e&&e.id===tn&&e.owner===n0)return!0;let t=nB.current.has(n2);try{t||(t="true"===window.sessionStorage.getItem(n2))}catch(e){}return!!t||(n3(),!1)},aU=async()=>{if(!aB())throw Error("Complete project setup and sign in before processing.");if(tl.current)throw Error("Start a new project to use AI tools.");let e=tp();if(!await os(od(e)))throw Error("The project could not be saved. Please try again.");return e},aW=async()=>{if(ry.current||tl.current||!aB())return;let e=tp(),t={};ry.current=t;let r=()=>ry.current===t&&tK.current&&!!n0&&nK.current===n0&&nJ.current===n0&&td.current===e,n=()=>{var t;return{...(null===(t=tW.current)||void 0===t?void 0:t.id)===e?tW.current:od(e),photos:(0,tx.JA)(nO.current.filter(e=>e.captureId))}};t1(!0),rw("");try{if(!await os(n())||!r())return;for(;r();){let t=nO.current.find(e=>!e.captureId&&!e.isSample);if(t){let[n]=await (0,tx.dh)(e,[t],r);if(!r()||!n)return;let o=nO.current.map(e=>e.id===n.id?n:e);nO.current=o,ew(o)}if(!await os(n())||!r())return;if(!nO.current.some(e=>!e.captureId&&!e.isSample))break}}catch(e){if(r()){let t=e instanceof Error?e.message:"The uploaded photos could not be saved. Please try again.";rw(t),tC(t),tZ(!1)}}finally{ry.current===t&&(ry.current=null,t1(!1))}},aO=async(e,t)=>{if(!(null==e?void 0:e.length)||!t)return;if(!S||!C.isAuthenticated){nr(!0);return}let r=oS(e,t);r.length&&(r_(""),nO.current=[...nO.current,...r],ew(e=>[...e,...r]),aW())},aG=async(e,t)=>{if(!(null==e?void 0:e.length))return;if(!S||!C.isAuthenticated){nr(!0);return}let r=oS(e,t);if(!r.length||(e_(e=>[...e,...r]),tl.current||!aB()))return;let n=[...ek.filter(e=>!e.captureId),...r];rb(n.map(e=>e.id)),t$(!0),rw("");try{let e=tp();await os(od(e));let t=await (0,tx.dh)(e,n),r=new Map(t.map(e=>[e.id,e]));e_(e=>e.map(e=>r.get(e.id)||e)),await os(od(e,{references:(0,tx.JA)([...ek.filter(e=>e.captureId),...t])}))}catch(e){rw(e instanceof Error?e.message:"The reference images could not be saved. Please try again.")}finally{rb([]),t$(!1)}},aF=async e=>!aE&&("photos"===e?(o6(1),M(!0),!0):ex.length?!!(aB()&&await o4())&&(E(1),B(!1),"cleanup"!==e&&(L(!1),B(!0),F("redesign"===e),"redesign"===e&&W("prompt")),!0):(rw("Add a room photo to begin editing."),!1)),aq=async e=>{aC&&("cleanup"===aI||await aF("cleanup"))&&t_({id:crypto.randomUUID(),action:e})},aY=async e=>{if(ey.current||aE)return!1;let t=nK.current;ey.current=!0,ev(!0),rw(""),null!==nS.current&&window.clearTimeout(nS.current);try{if(tn&&!tl.current&&(!await os(od(tn,{spaces:(0,t4.wC)(e)}))||nK.current!==t))return!1;return eg((0,t4.wC)(e)),!0}catch(e){return rw(e instanceof Error?e.message:"Could not save project spaces. Please retry."),!1}finally{ey.current=!1,ev(!1)}},aH=[...ex,...ek,...e4,...rJ].map(e=>e.roomId),aX="whole-home"===et?(0,n.jsx)(t5.Z,{rooms:oo,presets:oe,busy:aE,occupiedIds:aH,onAdd:e=>aY((0,t4.L0)(ep,e)),onRename:(e,t)=>aY((0,t4.XQ)(ep,e,t)),onRemove:e=>aH.includes(e)||oo.length<=1?Promise.resolve(!1):aY((0,t4.WF)(ep,e))}):null,az=(0,n.jsxs)("div",{className:"".concat(y().formGrid," ").concat(eu().fields),style:{"--project-field-count":"quick-capture"===et?4:3},children:[(0,n.jsxs)("label",{"data-complete":!!en.trim(),children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("b",{children:"Project title"})," ",(0,n.jsx)("i",{children:"Required"})]}),(0,n.jsx)("input",{className:eu().control,required:!0,maxLength:35,value:en,onChange:e=>eo(t9(e.target.value)),placeholder:"Give your project a name"})]}),(0,n.jsxs)("label",{"data-complete":!!ea.trim(),children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("b",{children:"Location"})," ",(0,n.jsx)("i",{children:"Required"})]}),(0,n.jsx)(g.Z,{required:!0,className:"".concat(y().locationAutocomplete," ").concat(eu().location),value:ea,onChange:ei,placeholder:"Start typing..."})]}),(0,n.jsxs)("label",{className:y().spaceField,"data-complete":!!et,children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("b",{children:"Guided mode"})," ",(0,n.jsx)("i",{children:"Required"})]}),(0,n.jsxs)(l.Z,{className:eu().control,required:!0,disablePortal:ak,value:et,disabled:!e$,onValueChange:e=>e&&ox(e),"aria-label":"Guided mode",children:[(0,n.jsx)("option",{value:"",disabled:!0,children:e$?"Select a guided mode":"Loading guided modes…"}),n5.map(e=>(0,n.jsxs)("option",{value:e.id,disabled:!e.enabled,children:[e.title,e.enabled?"":" — Coming soon"]},e.id))]})]}),"quick-capture"===et?(0,n.jsxs)("label",{className:y().spaceField,"data-complete":!!(null===(r=ep[0])||void 0===r?void 0:r.label),children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("b",{children:"Space"})," ",(0,n.jsx)("i",{children:"Required"})]}),(0,n.jsxs)(l.Z,{className:eu().control,disablePortal:ak,value:(null===(v=ep[0])||void 0===v?void 0:v.label)||"",onValueChange:e=>e&&ow(e),required:!0,"aria-label":"Choose one space",children:[(0,n.jsx)("option",{value:"",children:"Choose one space"}),[...oe].sort((e,t)=>
1e.localeCompare(t,"en")).map(e=>(0,n.jsx)("option",{value:e,children:e},e))]})]}):null,aX]}),aK=async()=>{(tl.current||await o9())&&(ts(!0),eo("Sandbox project"),ei("Sample space"),er("quick-capture"),eg([{id:"living-room",label:"Living room",count:1}]),nO.current=[],ew([]),tf(""),M(!0),E(1),window.scrollTo({top:0,behavior:"smooth"}))},aV=async()=>{await o9()&&(E(0),window.scrollTo({top:0,behavior:"smooth"}))},aJ=tI&&!tV?(0,n.jsxs)("div",{className:y().projectSaveNotice,role:"alert",children:[(0,n.jsx)("span",{children:tI}),(0,n.jsx)("button",{type:"button",disabled:!!tD||rS,onClick:()=>{let e=rA.find(e=>e.id===rI);e?ae(e):ao()},children:"Retry"}),(0,n.jsx)("button",{type:"button",className:y().projectSaveNoticeDismiss,"aria-label":"Dismiss notification",onClick:()=>tZ(!0),children:"\xd7"})]}):null;return rP?(0,n.jsx)(tb,{title:rP.title,error:rP.error,onClose:()=>{rE.current=null,rN(!1),rR(null),r4(!1),o6(0)},onBack:()=>{rE.current=null,rN(!1),rR(null),r4(!0)},onRetry:()=>void ae({id:rP.id,projectName:rP.title})}):(0,n.jsxs)("main",{className:"".concat(y().page," ").concat(R>=1&&R<=4||6===R&&am?"".concat(y().mobileMinimalFunnel," project-planner-minimal-root"):""," innerRoot project-planner-root ").concat(0===R?"project-planner-welcome-root":""),children:[aT&&(0,n.jsx)("p",{role:"alert",className:y().notificationError,children:aT}),ak&&!ta&&C.isAuthenticated&&oi&&!aj&&tn?(0,n.jsx)(w.Z,{accountKey:n0,projectId:tn,defaultTarget:{...nF,roomId:nF.roomId||eP||e3},inlineTarget:nX,open:nY,ensureProject:aU,onClose:()=>nH(!1),onPhotos:e=>{if(td.current!==tn||nK.current!==n0||nJ.current!==n0||rM.current)return;let t=(0,k.If)(nO.current,e.filter(e=>"reference"!==e.destination));e_(t=>(0,k.If)(t,e.filter(e=>"reference"===e.destination))),t!==nO.current&&(nO.current=t,ew(t))}},"".concat(n0,":").concat(tn)):null,ak?(0,n.jsx)(tc,{entryReferenceId:null==eB?void 0:eB.referenceId,entryArticle:eL,entryProfessional:eM,accountKey:n1||"",preferredStyle:ec[0],preloadedStyles:e$?null==eZ?void 0:eZ.styles:null,preloadedRooms:e$?null==eZ?void 0:eZ.spaceTypes:null,roomTypes:Object.fromEntries(oo.map(e=>[e.id,e.baseLabel])),projectId:tn,title:en,onRenameProject:e=>eo(t9(e)),location:ea,onLocationChange:ei,idea:el,configuration:az,spaces:oo,activeRoomId:e3,onSelectRoom:e=>{var t;e5(e),eR(e),tf((null===(t=ex.find(t=>t.roomId===e))||void 0===t?void 0:t.id)||"")},uploadRoomId:eP,onSelectUploadRoom:eR,collectingPhotos:"whole-home"===et&&!ta&&eE,onAdvancePhotos:()=>{let e=ex.find(e=>e.roomId===eP&&e.captureId)||ex.find(e=>e.captureId);!e||aE||ex.some(e=>!e.captureId&&!e.isSample)||(e5(e.roomId),tf(e.id),eT(!1))},canAddSpaces:"whole-home"===et,spacePresets:oe,occupiedSpaceIds:aH,onAddSpace:e=>aY((0,t4.L0)(ep,e)),onRemoveSpace:e=>aH.includes(e)||oo.length<=1?Promise.resolve(!1):aY((0,t4.WF)(ep,e)),photos:ex,references:ek,roomLabels:Object.fromEntries(oo.map(e=>[e.id,e.label])),selectedPhotoId:(null==aC?void 0:aC.id)||"",onSelectPhoto:e=>{tf(e);let t=ex.find(t=>t.id===e);t&&e5(t.roomId)},declutterEdits:$,onToggleLayer:(e,t,r)=>{var n,o,a;if(aE)return;let i=ex.find(t=>t.id===e),l=$[e];if(!i)return;if("original"===t){if("locked"!==r)return;ee(t=>{var r;let n=t[e]||{versions:[],masks:{},captureIds:{}};return{...t,[e]:{...n,backgroundLocked:!(null===(r=n.backgroundLocked)||void 0===r||r)}}});return}if(!(null==l?void 0:l.versions.some(e=>e.id===t)))return;let s=(n=l.versions,o=i.selectedGenerationId,"visible"===r&&(null===(a=n.find(e=>e.id===t))||void 0===a?void 0:a.locked)?n:em(n,o).map(e=>e.id===t?{...e,[r]:!e[r]}:e));ee(t=>({...t,[e]:{...t[e],versions:s}})),aL(e,eh(s))},onRenameLayer:(e,t,r)=>{let n=r.trim().slice(0,100);!aE&&n&&ex.some(t=>t.id===e)&&ee(r=>{let o=r[e]||{versions:[],masks:{},captureIds:{}};return"original"===t?{...r,[e]:{...o,backgroundName:n}}:o.versions.some(e=>e.id===t)?{...r,[e]:{...o,versions:o.versions.map(e=>e.id===t?{...e,name:n}:e)}}:r})},onImageError:aA,uploadingReferenceIds:rj,projectTeam:eI,setProjectTeam:eC,workspaceAnnotations:eS,setWorkspaceAnnotations:eN,onAdd:(e,t)=>{oi&&!aj&&aO(e,t)},phoneCaptureMount:nz,onPhoneContext:(e,t)=>
1nq(r=>r.destination===e&&r.roomId===t?r:{destination:e,roomId:t}),onPhoneCapture:()=>{aB()&&aU().then(()=>nH(!0)).catch(e=>rw(e instanceof Error?e.message:"Save the project before connecting your phone."))},onAddReferences:(e,t)=>{oi&&!aj&&aG(e,t)},onRemove:e=>void aD("room",e),onRemoveReference:e=>void aD("reference",e),onRenameRoom:(e,t)=>aY((0,t4.XQ)(ep,e,t)),mode:aI,onMode:e=>void aF(e),onExit:()=>o6(0),onNew:()=>{o9().then(e=>{e&&E(2)})},onSaved:()=>r4(!0),onSave:()=>void aF("cleanup"),onSignIn:oN,signedIn:C.isAuthenticated,configured:oi||ta,guidedTour:ta,busy:aE,placementBusy:!!Z,uploadBlocked:aR,setupRequired:aj,onCompleteSetup:()=>{oi&&(ts(!1),o6(1),M(!0))},onOpenSandboxUpload:aK,onOpenSandbox:()=>{let e={id:"sandbox-room-photo",roomId:"living-room",name:"Sandbox room",url:"/project-planning/hero-construction-space.png",isSample:!0};nO.current=[e],ew([e]),tf(e.id),M(!0),E(1),window.scrollTo({top:0,behavior:"smooth"})},onReturnToSandboxSetup:()=>{nO.current=[],ew([]),tf(""),M(!1),L(!1),B(!1),E(2),window.scrollTo({top:0,behavior:"smooth"})},onReturnToSandboxUpload:()=>{nO.current=[],ew([]),tf(""),M(!0),L(!1),B(!1),E(1),window.scrollTo({top:0,behavior:"smooth"})},onExitGuidedTour:aV,error:rx,saveStatus:og,recoveryNotice:rk,hasProject:!!tn,onSource:()=>void aF("redesign"),onCleanupTool:e=>void aq(e),onAiAction:nQ,renderPhotoSurface:(e,t,r,o,a)=>(0,n.jsx)(t2,{qualityTier:N,onQualityChange:P,projectId:tn||void 0,externalProgress:Z,desktop:!0,active:o,selectionTool:aE?"move":a,toolsTarget:e,historyTarget:t,actionsTarget:r,photos:ex,edits:$,setEdits:ee,toolRequest:tk,onToolHandled:()=>t_(null),activePhotoId:null==aC?void 0:aC.id,onPhotoChange:e=>{tf(e);let t=ex.find(t=>t.id===e);t&&e5(t.roomId)},onBusyChange:tj,onVersionChange:aL,onInsufficientCredits:n$,ensureProject:aU,onBack:()=>void aF("photos"),onContinue:(e,t)=>{var r,n;let o=null===(n=$[e])||void 0===n?void 0:null===(r=n.versions.find(e=>e.url===t))||void 0===r?void 0:r.id;ew(r=>r.map(r=>r.id===e?{...r,originalUrl:r.originalUrl||r.url,url:t,selectedGenerationId:o}:r)),tf(e);let a=ex.find(t=>t.id===e);a&&(e5(a.roomId),rz(t=>({...t,[a.roomId]:e}))),o6(1),B(!0)}}),renderReferenceEditor:e=>(0,n.jsx)(tJ,{qualityTier:N,onQualityChange:P,projectId:tn||void 0,desktop:!0,reference:e,onProgressChange:Q,photo:aC,prompt:aN,onPromptChange:aP,state:tE(z,$),persist:ag,ensureProject:aU,onBusyChange:J,onInsufficientCredits:n$,onBack:()=>void aF("inspiration"),onContinue:()=>o6(7)}),renderEditor:e=>{var t;return(0,n.jsx)(tJ,{qualityTier:N,onQualityChange:P,selectionStrokes:aC?null===(t=$[aC.id])||void 0===t?void 0:t.masks[aC.selectedGenerationId||"original"]:void 0,projectId:tn||void 0,desktop:!0,toolsTarget:e,onProgressChange:Q,photo:aC,prompt:aN,onPromptChange:aP,state:tE(z,$),persist:ag,ensureProject:aU,onBusyChange:J,onInsufficientCredits:n$,onBack:()=>void aF("inspiration"),onContinue:()=>o6(7)})}}):null,r5?null:aJ,(0,n.jsxs)("div",{className:y().plannerContent,"data-workspace-step":aw,children:[r0?(0,n.jsxs)("svg",{className:"".concat(y().compositionWire," ").concat(r0.returning?y().compositionWireReturning:""),width:"100%",height:"100%","aria-hidden":"true",children:[(0,n.jsx)("path",{d:function(e){let t=e.endX-e.startX,r=e.endY-e.startY,n=Math.max(34,Math.min(120,.22*Math.hypot(t,r))),o=r>=0?1:-1;return"M ".concat(e.startX," ").concat(e.startY," C ").concat(e.startX+.16*t," ").concat(e.startY+n*o,", ").concat(e.endX-.16*t," ").concat(e.endY-n*o,", ").concat(e.endX," ").concat(e.endY)}(r0)}),(0,n.jsx)("circle",{cx:r0.endX,cy:r0.endY,r:"3"})]}):null,R>0&&!0!==th?(0,n.jsxs)("header",{className:"".concat(y().topbar," ").concat(R<=4||6===R&&am?y().minimalTopbar:""),children:[(0,n.jsx)("button",{type:"button",disabled:tQ||rS||V,className:y().wordmark,title:en.trim()||"Start Project",onClick:()=>o6(0),children:en.trim()||"Start Project"}),(0,n.jsx)("nav",{className:y().progress,"aria-label":"Project progress",style:{gridTemplateColumns:"repeat(".concat(ay.length,", minmax(0, 1fr))")},children:ay.map((e,t)=>(0,n.jsxs)("button",{type:"button",className:t===ab?y().progressActive:t<ab?y().progressComplete:"","aria-current":t===ab?"step":void 0,onClick:()=>{!(t>=ab)&&(o6(e.step),e.capture&&M(!0),e.declutter&&L(!0),e.inspiration&&B(!0))},disabled:t>ab||tQ||rS||V,children:[(0,n.jsx)("span",{children:String(t+1).padStart(2,"0")}),e.label]},e.label))}),(0,n.jsx)("div",{className:y().mobileProgress,children:(0,n.jsxs)("p",{children:[ax," / ",ay.length," \xb7 ",null===(j=ay[ab])||void 0===j?void 0:j.label]})}),R<=4||6===R&&am?(0,n.jsx)("span",{className:y().mobileProgressTrack,"aria-hidden":"true",children:(0,n.jsx)("i",{style:{width:"".concat(ax/ay.length*100,"%")}})}):null]}):null,0===R&&a_?(0,n.jsx)("section",{className:"".concat(y().slide," ").concat(y().welcome),children:(0,n.jsxs)("div",{className:y().welcomeHero,children:[(0,n.jsx)("div",{className:y().mobileWelcomeBackgroun
1d,children:(0,n.jsx)(tG,{})}),(0,n.jsx)("div",{className:y().mobileWelcomeScrim,"aria-hidden":"true"}),(0,n.jsxs)("div",{className:y().welcomeIntro,children:[(0,n.jsx)("p",{className:y().kicker,children:"GUIDED PROJECT PLANNING"}),(0,n.jsxs)("h1",{children:[(0,n.jsx)("span",{className:y().desktopWelcomeTitle,children:"Start your next project"}),(0,n.jsx)("span",{className:y().mobileWelcomeTitle,children:"Guided Project Planning"})]}),(0,n.jsx)("p",{className:y().welcomeCopy,children:"From documenting your existing space to defining the vision, visualizing the result, planning the investment and finding the right team—everything begins here."})]}),(0,n.jsxs)("div",{className:y().mobileWelcomeActions,children:[(0,n.jsxs)("button",{type:"button",className:"".concat(y().primaryButton," ").concat(y().desktopStartButton),"aria-haspopup":"dialog",disabled:!S,onClick:o7,children:["New project ",(0,n.jsx)("span",{children:"→"})]}),(0,n.jsxs)("button",{type:"button",className:"".concat(y().primaryButton," ").concat(y().mobileStartButton),"aria-haspopup":"dialog",disabled:!S,onClick:o7,children:["New project ",(0,n.jsx)("span",{children:"→"})]}),!S||C.isAuthenticated?(0,n.jsxs)("button",{ref:nM,type:"button",className:y().mobileSavedProjectsButton,"aria-haspopup":"dialog","aria-busy":!n1||!tt,disabled:!n1,onClick:()=>{r7(""),r4(!0)},children:[(0,n.jsx)("span",{children:"ARCHIVE"}),(0,n.jsx)("span",{className:y().savedProjectsCount,"aria-label":tt?"".concat(rA.length," saved projects"):"Loading saved projects",children:tt?rA.length:(0,n.jsx)("i",{className:y().savedProjectsCountSpinner,"aria-hidden":"true"})})]}):null]})]})}):null,a_&&1===R&&T?(0,n.jsx)(x,{projectId:tn||void 0,spaces:oo,roomId:eP,totalPhotoCount:ex.length,onRoomChange:e=>{eR(e),e5(e)},photos:ex.filter(e=>e.roomId===eP).map(e=>({...e,url:e.originalUrl||e.url})),onAdd:(e,t)=>oP(e,t||eP),onRemove:oR,onBack:()=>o6(2),signedIn:C.isAuthenticated,authReady:S,onSignIn:oN,saving:tQ,saveError:rx,onContinue:()=>void o4()}):null,a_&&1===R&&A?(0,n.jsx)(t2,{qualityTier:N,onQualityChange:P,projectId:tn||void 0,photos:ex,edits:$,setEdits:ee,onInsufficientCredits:n$,ensureProject:async()=>{let e=tp();return await os(od(e)),e},onBack:()=>{L(!1),M(!0),window.scrollTo({top:0,behavior:"smooth"})},onContinue:(e,t)=>{var r,n;let o=null===(n=$[e])||void 0===n?void 0:null===(r=n.versions.find(e=>e.url===t))||void 0===r?void 0:r.id;ee(t=>{let r=t[e];return r?{...t,[e]:{...r,versions:r.versions.map(e=>({...e,visible:e.id===o}))}}:t}),ew(r=>r.map(r=>r.id===e?{...r,originalUrl:r.originalUrl||r.url,url:t,selectedGenerationId:o}:r));let a=ex.find(t=>t.id===e);a&&(e5(a.roomId),rz(t=>({...t,[a.roomId]:e}))),o6(1),B(!0)}}):null,a_&&1===R&&D&&!O&&!ah?(0,n.jsx)(eO,{value:U,onChange:W,onContinue:()=>{"prompt"===U&&(F(!0),window.scrollTo({top:0,behavior:"smooth"}))},onBack:()=>{o6(1),L(!0)}}):null,a_&&1===R&&D&&ah&&ap?(0,n.jsxs)("section",{className:y().articleRoomMobile,"aria-label":"Your room and inspiration",children:[(0,n.jsxs)("div",{className:y().articleRoomPhotoPair,children:[(0,n.jsxs)("figure",{children:[(0,n.jsx)(f.Z,{projectId:tn||void 0,captureId:ap.captureId,generationId:ap.selectedGenerationId,src:ap.url,alt:"Your room"}),(0,n.jsx)("figcaption",{children:"Your room"})]}),(0,n.jsxs)("figure",{children:[(0,n.jsx)(f.Z,{projectId:tn||void 0,captureId:ah.captureId,src:ah.url,alt:"Inspiration"}),(0,n.jsx)("figcaption",{children:"Inspiration"})]})]}),(0,n.jsx)(tJ,{qualityTier:N,onQualityChange:P,projectId:tn||void 0,photo:ap,reference:ah,prompt:aN,onPromptChange:aP,state:tE(z,$),persist:ag,ensureProject:aU,onBusyChange:J,onInsufficientCredits:n$,onBack:()=>{o6(1),M(!0)},onContinue:()=>o6(7)})]}):null,a_&&(1===R&&D&&O&&!ah||6===R&&am)?(0,n.jsx)(tJ,{qualityTier:N,onQualityChange:P,projectId:tn||void 0,photo:ap,prompt:aN,onPromptChange:aP,state:tE(z,$),persist:ag,ensureProject:async()=>{let e=tp();return await os(od(e)),e},onBusyChange:J,onInsufficientCredits:n$,onBack:()=>{o6(1),B(!0),F(!1)},onContinue:()=>o6(7)}):null,3===R?(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().minimalSlide," ").concat(y().directionSlide),children:[(0,n.jsxs)("div",{className:y().introBlock,children:[(0,n.jsx)("h1",{children:"Set the starting point."}),(0,n.jsx)("p",{children:"Your visual direction can stay open and become clearer through the images you choose."})]}),(0,n.jsxs)("div",{className:y().mobileIntroBlock,children:[(0,n.jsx)("h1",{children:"What feels right?"}),(0,n.jsx)("span",{children:"Choose any directions that feel relevant, or leave this open for now."})]}),(0,n.jsxs)("fieldset",{className:y().styleFieldset,children:[(0,n.jsxs)("legend",{children:["Which directions feel relevant? ",(0,n.jsx)("i",{children:"Choose any or leave open"})]}),(0,n.jsx)("div",{className:y().directionGrid,"aria-busy":ez,children:oj.map(e=>{let t=ec.includes(e.name);return(0,n.jsxs)("button",{type:"button",className:t?y().directionActive:"",onClick:()=>ok(e.name),"aria-pressed":t,"aria-label":e.name,children:[(0,n.jsxs)("span",{className:y().directionImage,children:[e.imageUrl?(0,n.jsx)(f.Z,{src:e.imageUrl,alt:e.title}):null,(0,n.jsx)("strong",{className:y().directionImageTitle,"aria-hidden":"true",children:e.name}),(0,n.jsx)("i",{"aria-hidden":"true",children:t?"✓":"+"})]}),(0,n.jsxs)("span",{className:y().directionContent,children:[(0,n.jsx)("strong",{children:e.name}),e.description?(0,n.jsx)("span",{className:y().directionDescription,children:e.description}):null]})]},e.name)})})]}),(0,n.jsxs)("div",{className:y().actions,children:[(0,n.jsx)("button",{type:"button",className:y().backButton,onClick:()=>{o6(1),["quick-capture","whole-home"].includes(et)&&B(!0)},children:"Back"}),(0,n.jsxs)("button",{type:"button",className:y().primaryButton,onClick:()=>o6(4),children:[(0,n.jsx)("span",{className:y().desktopOnly,children:"Add project photos"}),(0,n.jsx)("span",{className:y().mobileOnly,children:"Add photos"})," ",(0,n.jsx)("span",{children:"→"})]})]})]},"direction"):null,aj&&a_?(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().minimalSlide," ").concat(y().projectDetailsSlide," ").concat(re(et)?y().singleSpaceSlide:""),children:[(0,n.jsxs)("div",{className:y().introBlock,children:[(0,n.jsx)("h1",{children:re(et)?"Tell us about the project.":"Choose the spaces in scope."}),(0,n.jsx)("p",{children:re(et)?"Enter a project title and location, then select a guided mode and the space you want to transform.":"interior"===et?"Add each area where you need products or a specialist service.":"Enter a project title and location, then select the spaces you want to transform."})]}),az,et&&"whole-home"!==et&&!re(et)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:y().spaceSelectionHeader,children:[(0,n.jsx)("span",{children:re(et)?"Choose one space":"Project spaces"}),(0,n.jsx)("b",{children:re(et)?"".concat(oo.length," selected"):"".concat(oo.length," total")})]}),(0,n.jsxs)("div",{className:y().spaceChoiceGrid,"aria-busy":ez,children:[ob.map(e=>{let t=rs(e.label),r=ep.find(e=>e.id===t);return(0,n.jsx)(rv,{label:e.label,imageUrl:e.imageUrl,imageTitle:e.imageTitle,selected:r,single:re(et),onSelect:()=>{(!r||re(et))&&o_(e.label)},onDecrease:()=>oI(t,-1),onIncrease:()=>oI(t,1)},t)}),ep.filter(e=>!oe.some(t=>rs(t)===e.id)).map(e=>(0,n.jsx)(rv,{label:e.label,selected:e,single:re(et),onSelect:()=>void 0,onDecrease:()=>oI(e.id,-1),onIncrease:()=>oI(e.id,1)},e.id)),(0,n.jsxs)("article",{className:y().customSpaceCard,children:[(0,n.jsx)("span",{className:y().customSpaceImage,children:(0,n.jsx)("i",{"aria-hidden":"true",children:"+"})}),(0,n.jsx)("strong",{children:"Another space"}),(0,n.jsxs)("div",{className:y().customSpaceControls,children:[(0,n.jsx)("input",{value:ej,onChange:e=>eb(e.target.value),onKeyDown:e=>"Enter"===e.key&&oC(),placeholder:"Name the space","aria-label":"Custom space name"}),(0,n.jsx)("button",{type:"button",onClick:oC,disabled:!ej.trim(),children:"Add"})]})]})]})]}):null,(0,n.jsxs)("div",{className:y().actions,children:[(0,n.jsx)("button",{type:"button",className:y().backButton,onClick:()=>o6(0),children:"Back"}),(0,n.jsxs)("button",{type:"button",className:y().primaryButton,disabled:!oi,onClick:()=>{o6(1),M(!0)},children:["Continue ",(0,n.jsx)("span",{children:"→"})]})]})]},"spaces"):null,4===R?(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().minimalSlide),children:[(0,n.jsxs)("div",{className:y().introBlock,children:[(0,n.jsx)("h1",{children:"Show what exists today."}),(0,n.jsx)("p",{children:"Photos are optional. Assign them to a space so the brief preserves the real conditions and structure you want to work with."})]}),(0,n.jsxs)("div",{className:y().mobileIntroBlock,children:[(0,n.jsx)("h1",{children:"Show us the space."}),(0,n.jsx)("span",{children:"Add a few photographs, or skip this 
1step for now."})]}),(0,n.jsxs)("div",{className:y().mobilePhotoRoom,children:[(0,n.jsx)("span",{children:"SPACE"}),(0,n.jsx)("strong",{children:(null===(b=oo[0])||void 0===b?void 0:b.label)||"Your space"})]}),(0,n.jsxs)("div",{className:y().uploadLayout,children:[(0,n.jsxs)("div",{className:y().uploadControl,children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("span",{children:"Add photos to"}),(0,n.jsx)(l.Z,{value:eP,onValueChange:e=>eR(e),children:oo.map(e=>(0,n.jsx)("option",{value:e.id,children:e.label},e.id))})]}),(0,n.jsxs)("label",{className:y().dropzone,children:[(0,n.jsx)("input",{type:"file",accept:"image/*",multiple:!0,disabled:!S,onClick:e=>{C.isAuthenticated||(e.preventDefault(),oN())},onChange:e=>{oP(e.target.files),e.target.value=""}}),(0,n.jsx)("span",{children:(0,n.jsx)(u.G,{icon:p.A$k,"aria-hidden":"true"})}),(0,n.jsx)("strong",{children:"Choose photographs"}),(0,n.jsx)("p",{children:"Wide views and natural light work best"})]}),(0,n.jsx)("p",{className:y().privacyNote,children:"Files stay on this device and disappear when this browser session ends."})]}),(0,n.jsx)("div",{className:y().uploadsByRoom,children:oo.map(e=>{let t=ex.filter(t=>t.roomId===e.id);return(0,n.jsxs)("div",{className:"".concat(y().roomUploadRow," ").concat(t.length?"":y().emptyRoomUploadRow),children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e.label}),(0,n.jsxs)("span",{children:[t.length||"No"," photo",1===t.length?"":"s"]})]}),t.length?(0,n.jsx)("div",{className:y().uploadThumbs,children:t.map(e=>(0,n.jsxs)("figure",{children:[(0,n.jsx)(f.Z,{src:e.url,projectId:tn||void 0,captureId:e.captureId,generationId:e.selectedGenerationId,alt:e.name}),(0,n.jsx)("button",{type:"button","aria-label":"Remove ".concat(e.name),onClick:()=>oR(e.id),children:"\xd7"})]},e.id))}):null]},e.id)})})]}),(0,n.jsxs)("div",{className:y().actions,children:[(0,n.jsx)("button",{type:"button",className:y().backButton,onClick:()=>o6(3),children:"Back"}),(0,n.jsxs)("button",{type:"button",className:y().primaryButton,onClick:()=>o6(5),children:[aa?"Continue":"Skip for now"," ",(0,n.jsx)("span",{children:"→"})]})]})]},"photos"):null,5===R?(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().inspirationSlide),children:[(0,n.jsxs)("div",{className:y().introBlock,children:[(0,n.jsx)("h1",{children:"Select what resonates with you."}),(0,n.jsx)("p",{children:"As you explore, save any image, tagged detail or specific area that feels relevant to the space you want to create."})]}),(0,n.jsx)("div",{className:y().roomTabs,role:"tablist","aria-label":"Project spaces",children:oo.map(e=>{let t=e4.filter(t=>t.roomId===e.id).length;return(0,n.jsxs)("button",{type:"button",role:"tab","aria-selected":(null==ol?void 0:ol.id)===e.id,className:(null==ol?void 0:ol.id)===e.id?y().roomTabActive:"",onClick:()=>e5(e.id),children:[e.label,t?(0,n.jsx)("span",{children:t}):null]},e.id)})}),oT&&(!oT.loading||oM.length)?(null==oT?void 0:oT.error)&&!oM.length?(0,n.jsxs)("div",{className:y().referenceMessage,children:[(0,n.jsx)("p",{children:"Tagged project images could not be loaded."}),(0,n.jsx)("button",{type:"button",onClick:()=>ol&&void oy(ol,1),children:"Try again"})]}):oM.length?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:y().referenceGrid,children:oM.map(e=>{let t=oG(e.imageId),r=(null==e7?void 0:e7.roomId)===(null==ol?void 0:ol.id)&&e7.imageId===e.imageId?e7:null,o=!!ol&&oA(ol.id,e.imageId,"image"),a=e4.filter(t=>t.roomId===(null==ol?void 0:ol.id)&&t.imageId===e.imageId&&"region"===t.type&&t.region);return(0,n.jsxs)("article",{className:y().referenceCard,children:[(0,n.jsxs)("div",{className:y().referenceImage,onPointerDown:t=>oB(t,e.imageId),onPointerMove:t=>oU(t,e.imageId),onPointerUp:t=>oW(t,e),children:[(0,n.jsx)("img",{src:e.imageUrl,alt:e.title,draggable:!1,loading:"lazy",decoding:"async"}),(0,n.jsx)("div",{className:y().referencePlacementOverlay,children:(e.placements||[]).map((t,r)=>{var o;if(!t.label||!Number.isFinite(Number(t.x))||!Number.isFinite(Number(t.y)))return null;let a=String(null!==(o=t.id)&&void 0!==o?o:"".concat(t.label,"-").concat(r)),i=!!ol&&oA(ol.id,e.imageId,"placement",t.label),l=rm(t),s=function(e){var t;let r=rm(e);if(r&&(null===(t=e.polygon)||void 0===t?void 0:t.length))return e.polygon.map(e=>"".concat(rp((e.x-r.x)/r.width*100,0,100),",").concat(rp((e.y-r.y)/r.height*100,
10,100))).join(" ")}(t),c=function(e){var t;let r=rm(e);if(r&&(null===(t=e.polygon)||void 0===t?void 0:t.length))return"polygon(".concat(e.polygon.map(e=>"".concat(rp((e.x-r.x)/r.width*100,0,100),"% ").concat(rp((e.y-r.y)/r.height*100,0,100),"%")).join(", "),")")}(t),d={onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),onClick:n=>{n.stopPropagation(),oD(e,t,r)}};if(l&&s&&c){let o="planner-polygon-highlight-".concat(e.imageId,"-").concat(r);return(0,n.jsxs)("div",{className:"".concat(y().referencePolygonTarget).concat(i?" ".concat(y().referencePlacementActive):""),style:{left:"".concat(100*Number(t.x),"%"),top:"".concat(100*Number(t.y),"%"),width:"".concat(100*l.width,"%"),height:"".concat(100*l.height,"%")},children:[(0,n.jsxs)("svg",{className:y().referencePolygonExposure,viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:[(0,n.jsx)("defs",{children:(0,n.jsx)("filter",{id:o,x:"-40%",y:"-40%",width:"180%",height:"180%",children:(0,n.jsx)("feGaussianBlur",{stdDeviation:"6"})})}),(0,n.jsx)("polygon",{points:s,fill:"white",filter:"url(#".concat(o,")")})]}),(0,n.jsx)("button",{type:"button",className:y().referencePolygonHitArea,"aria-label":"".concat(i?"Remove":"Select"," ").concat(t.label),style:{clipPath:c,WebkitClipPath:c},...d}),(0,n.jsx)("span",{className:y().referencePlacementLabel,"aria-hidden":"true",children:t.label})]},a)}return l?(0,n.jsx)("button",{type:"button",className:"".concat(y().referenceBoxTarget).concat(i?" ".concat(y().referencePlacementActive):""),"aria-label":"".concat(i?"Remove":"Select"," ").concat(t.label),style:{left:"".concat(100*Number(t.x),"%"),top:"".concat(100*Number(t.y),"%"),width:"".concat(100*l.width,"%"),height:"".concat(100*l.height,"%")},...d,children:(0,n.jsx)("span",{className:y().referencePlacementLabel,"aria-hidden":"true",children:t.label})},a):(0,n.jsx)("button",{type:"button",className:"".concat(y().referencePlacementDot).concat(i?" ".concat(y().referencePlacementActive):""),"aria-label":"".concat(i?"Remove":"Select"," ").concat(t.label),style:{left:"".concat(100*Number(t.x),"%"),top:"".concat(100*Number(t.y),"%")},...d,children:(0,n.jsx)("span",{className:y().referencePlacementLabel,"aria-hidden":"true",children:t.label})},a)})}),a.map(e=>{if(!e.region)return null;let t={left:"".concat(100*e.region.x,"%"),top:"".concat(100*e.region.y,"%"),width:"".concat(100*e.region.width,"%"),height:"".concat(100*e.region.height,"%")};return(0,n.jsx)("button",{type:"button",className:y().savedRegion,title:"Remove ".concat(e.label),style:t,onPointerDown:e=>e.stopPropagation(),onClick:()=>oF(e.id),children:(0,n.jsx)("span",{children:e.label})},e.id)}),t?(0,n.jsx)("span",{className:y().drawingRegion,style:{left:"".concat(100*t.x,"%"),top:"".concat(100*t.y,"%"),width:"".concat(100*t.width,"%"),height:"".concat(100*t.height,"%")}}):null,r?(0,n.jsx)("span",{className:y().pendingRegion,style:{left:"".concat(100*r.region.x,"%"),top:"".concat(100*r.region.y,"%"),width:"".concat(100*r.region.width,"%"),height:"".concat(100*r.region.height,"%")}}):null,(0,n.jsx)("span",{className:y().dragHint,children:"Drag to select an area"})]}),r?(0,n.jsxs)("form",{className:y().regionLabelEditor,onSubmit:e=>{e.preventDefault(),oO()},children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("span",{children:"Name this selection"}),(0,n.jsx)("input",{autoFocus:!0,value:r.label,maxLength:60,placeholder:"e.g. stone wall, pendant, color palette",onChange:e=>te(t=>t?{...t,label:e.target.value}:null),onKeyDown:e=>{"Escape"===e.key&&te(null)}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{type:"button",onClick:()=>te(null),children:"Cancel"}),(0,n.jsx)("button",{type:"submit",disabled:!r.label.trim(),children:"Save selection"})]})]}):null,(0,n.jsxs)("div",{className:y().referenceMeta,children:[(0,n.jsx)("button",{type:"button",className:o?y().saveImageActive:"",onClick:()=>oL(e),children:o?"✓ Image saved":"+ Save full image"}),(0,n.jsxs)("p",{children:[e.roomType||(null==ol?void 0:ol.baseLabel),e.style?" \xb7 ".concat(e.style):""]})]})]},"".concat(null==ol?void 0:ol.id,"-").concat(e.imageId))})}),oT.error||oT.page<oT.pages?(0,n.jsxs)("div",{className:y().loadMoreInspiration,children:[(0,n.jsx)("button",{type:"button",disabled:oT.loading,onClick:()=>{ol&&oy(ol,Math.max(1,oT.page+1))},children:oT.loading?"Loading inspiration…":oT.error?"Try loading again":"Load more inspiration"}),(0,n.jsxs)("span",{children:[oM.length,oT.total?" of ".concat(oT.total):""," images"]})]}):null]}):(0,n.jsx)("div",{className:y().referenceMessage,children:"No references match this space and direction yet."}):(0,n.jsx)("div",{className:y().referenceLoading,children:Array.from({length:6}).map((e,t)=>(0,n.jsx)("span",{},t))}),(0,n.jsxs)("div",{className:y().selectionSummary,children:[(0,n.jsxs)("span",{children:[e4.length," preference",1===e4.length?"":"s"," captured"]}),(0,n.jsxs)("span",{children:[ai," of ",oo.length," spaces explored"]})]}),(0,n.jsxs)("div",{className:y().actions,children:[(0,n.jsx)("button",{type:"button",className:y().backButton,onClick:()=>o6(4),children:"Back"}),(0,n.jsxs)("button",{type:"button",className:y().primaryButton,onClick:()=>o6(6),children:["Visualize the project ",(0,n.jsx)("span",{children:"→"})]})]})]},"inspiration"):null,6!==R||am?null:(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().visualizeSlide),children:[(0,n.jsxs)("div",{className:y().introBlock,children:[(0,n.jsx)("h1",{children:"Explain what the images cannot."}),(0,n.jsx)("p",{children:"Describe the feeling, function or change you want for each space. The
1se notes complete the visual references in your brief."})]}),(0,n.jsx)("div",{className:y().roomTabs,role:"tablist","aria-label":"Spaces to visualize",children:oo.map(e=>{let t=ex.filter(t=>t.roomId===e.id),r=t.length>1,o=t.some(t=>t.id===rX[e.id]);return(0,n.jsxs)("button",{type:"button",role:"tab","aria-selected":(null==ol?void 0:ol.id)===e.id,className:(null==ol?void 0:ol.id)===e.id?y().roomTabActive:"",onClick:()=>e5(e.id),children:[e.label,r?(0,n.jsx)("span",{children:o?"✓":"!"}):null]},e.id)})}),(0,n.jsxs)("div",{className:y().visualizeLayout,children:[(0,n.jsxs)("section",{className:y().visionInputPanel,children:[(0,n.jsxs)("label",{className:y().visionIdeaField,children:[(0,n.jsxs)("span",{children:["Overall idea ",(0,n.jsx)("i",{children:"Optional"})]}),(0,n.jsx)("textarea",{value:el,maxLength:1600,onChange:e=>es(e.target.value),placeholder:"Describe how you want the spaces to feel, what should change, what must remain and anything the references do not show."}),(0,n.jsxs)("small",{children:[el.length," / 1600"]})]}),(0,n.jsxs)("div",{className:y().narrationPanel,children:[(0,n.jsxs)("div",{className:y().narrationHeader,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:"Or narrate your idea"}),(0,n.jsx)("p",{children:"Speak naturally for up to five minutes. Transcription will be connected with the AI workflow later."})]}),(0,n.jsxs)("button",{type:"button",className:rU?y().narrationStop:y().narrationStart,onClick:rU?oq:oH,children:[(0,n.jsx)(u.G,{icon:rU?p.Bg$:p.UOM,"aria-hidden":"true"}),rU?"Stop":rO?"Record again":"Record"]})]}),rU?(0,n.jsxs)("div",{className:y().recordingStatus,children:[(0,n.jsx)("span",{})," Recording",(0,n.jsxs)("time",{children:[String(Math.floor(rY/60)).padStart(2,"0"),":",String(rY%60).padStart(2,"0")]})]}):null,rO?(0,n.jsxs)("div",{className:y().narrationPlayback,children:[(0,n.jsx)("audio",{controls:!0,src:rO,controlsList:"nodownload"}),(0,n.jsx)("button",{type:"button","aria-label":"Delete narration",onClick:oY,children:(0,n.jsx)(u.G,{icon:p.$aW,"aria-hidden":"true"})})]}):null,rF?(0,n.jsx)("p",{className:y().narrationError,children:rF}):null]}),(0,n.jsxs)("div",{className:y().visionInputsSummary,children:[(0,n.jsxs)("p",{className:y().sectionKicker,children:["Inputs ready for ",(null==ol?void 0:ol.label)||"this room"]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("strong",{children:al.length})," current-space photo",1===al.length?"":"s"]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("strong",{children:as.length})," saved reference",1===as.length?"":"s"]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("strong",{children:ec.length})," style direction",1===ec.length?"":"s"]})]})]})]}),(0,n.jsxs)("section",{className:y().renderPanel,children:[al.length>1?(0,n.jsxs)("div",{className:y().renderSourcePicker,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:"Choose the photo to render"}),(0,n.jsxs)("small",{children:[al.length," uploaded views"]})]}),(0,n.jsx)("div",{className:y().renderSourceGrid,children:al.map(e=>{let t=rX[(null==ol?void 0:ol.id)||""]===e.id;return(0,n.jsxs)("button",{type:"button",className:t?y().renderSourceActive:"","aria-pressed":t,onClick:()=>ol&&oX(ol.id,e.id),children:[(0,n.jsx)(f.Z,{src:e.url,projectId:tn||void 0,captureId:e.captureId,generationId:e.selectedGenerationId,alt:e.name}),(0,n.jsx)("span",{children:t?"Selected":"Use this view"})]},e.id)})})]}):null,(0,n.jsxs)("div",{className:y().renderHeader,children:[(0,n.jsx)("span",{children:"Room concept"}),(0,n.jsx)("strong",{children:(null==ol?void 0:ol.label)||"Select a space"})]}),ac.length?(0,n.jsxs)("div",{className:y().compositionTray,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:"Placeable details"}),(0,n.jsx)("small",{children:au?"Drag onto the room—or tap to add":"Choose a room photo first"})]}),(0,n.jsx)("div",{children:ac.map(e=>{var t;return(0,n.jsxs)("button",{type:"button",ref:t=>{t?n_.current.set(e.id,t):n_.current.delete(e.id)},className:"".concat((null==r0?void 0:r0.selectionId)===e.id?y().compositionSourceActive:""," ").concat((null==r0?void 0:r0.selectionId)===e.id&&r0.returning?y().compositionSourceReturning:""),draggable:!!au,disabled:!au,onDragStart:t=>oJ(t,e),onDrag:oZ,onDragEnd:oQ,onClick:()=>oz(e),children:[(0,n.jsx)("span",{className:y().compositionCrop,"data-composition-drag-preview":!0,style:{clipPath:rh(e.region)},children:(0,n.jsx)(f.Z,{src:e.imageUrl,alt:e.label,style:(t=e.region,{position:"absolute",width:"".concat(100/Math.max(t.width,.01),"%"),height:"".concat(100/Math.max(t.height,.01),"%"),left:"".concat(-t.x/Math.max(t.width,.01)*100,"%"),top:"".concat(-t.y/Math.max(t.height,.01)*100,"%"),maxWidth:"none"})})}),(0,n.jsx)("strong",{children:e.label})]},e.id)})})]}):null,(0,n.jsxs)("div",{className:"".concat(y().renderCanvas," ").concat(au?y().renderCanvasWithPhoto:""),style:{aspectRatio:af||"4 / 3"},onDragOver:e=>au&&e.preventDefault(),onDrop:e=>{e.preventDefault();let t=e.dataTransfer.getData("application/x-taa-reference"),r=as.find(e=>
1e.id===t&&e.region);if(!r)return;let n=e.currentTarget.getBoundingClientRect();oz(r,rp((e.clientX-n.left)/n.width,0,1),rp((e.clientY-n.top)/n.height,0,1)),r1(null)},onPointerDown:()=>{r3(""),r1(null),document.activeElement instanceof HTMLElement&&document.activeElement.blur()},children:[au?(0,n.jsx)("img",{src:au.url,alt:"".concat((null==ol?void 0:ol.label)||"Room"," source"),onLoad:e=>{let t=e.currentTarget;if(!t.naturalWidth||!t.naturalHeight)return;let r=t.naturalWidth/t.naturalHeight;rV(e=>e[au.id]===r?e:{...e,[au.id]:r})}}):null,au?ad.map(e=>(0,n.jsxs)("div",{className:"".concat(y().compositionAnchor," ").concat((null==r0?void 0:r0.placementId)===e.id?y().compositionAnchorConnected:""," ").concat(r2===e.id?y().compositionAnchorActive:""," ").concat((null==rQ?void 0:rQ.placementId)===e.id?y().compositionAnchorDragging:""),style:{left:"".concat((e.target.x+e.target.width/2)*100,"%"),top:"".concat((e.target.y+e.target.height/2)*100,"%")},role:"button",tabIndex:0,"aria-pressed":r2===e.id,"aria-label":"".concat(e.label," placement"),onPointerDown:t=>o$(t,e),onPointerMove:o0,onPointerUp:t=>o1(t,e),onPointerCancel:()=>{r$(null),r1(null)},onPointerEnter:t=>o2(t.currentTarget,e),onPointerLeave:()=>o3(e.id),onFocus:t=>o2(t.currentTarget,e),onBlur:()=>o3(e.id),children:[(0,n.jsx)("span",{"aria-hidden":"true"}),(0,n.jsx)("strong",{children:e.label}),(0,n.jsx)("div",{className:y().compositionControls,onPointerDown:e=>e.stopPropagation(),children:(0,n.jsx)("button",{type:"button","aria-label":"Remove ".concat(e.label),onClick:()=>o5(e.id),children:"\xd7"})})]},e.id)):null,al.length?au&&ad.length?(0,n.jsxs)("span",{className:y().compositionStatus,children:[ad.length," detail",1===ad.length?"":"s"," placed"]}):(0,n.jsxs)("div",{className:y().renderGuidance,children:[(0,n.jsx)("span",{children:"AI visualization"}),(0,n.jsx)("strong",{children:al.length>1&&!au?"Choose the view you want to transform.":au?"Place the details you want to carry into this room.":"A concept canvas is ready."}),(0,n.jsx)("p",{children:al.length>1&&!au?"Select one of the uploaded photos above. The model will use that view as the rendering structure.":au?"Drag or tap a cropped reference above, then position its marker where that detail should inform the room.":"Upload a current-space photo for a grounded transformation, or generate from the brief alone."})]}):(0,n.jsxs)("label",{className:y().renderUploadPrompt,children:[(0,n.jsx)("input",{type:"file",accept:"image/*",multiple:!0,onChange:e=>{oP(e.target.files,(null==ol?void 0:ol.id)||""),e.target.value=""}}),(0,n.jsx)("span",{children:(0,n.jsx)(u.G,{icon:p.A$k,"aria-hidden":"true"})}),(0,n.jsxs)("strong",{children:["Upload a photo of the ",(null==ol?void 0:ol.label.toLowerCase())||"space"]}),(0,n.jsx)("p",{children:"Add a clear, wide view of the existing room. This photo will become the grounded canvas for the visualization."}),(0,n.jsx)("small",{children:"Photos stay on this device and disappear when this browser session ends."})]})]}),(0,n.jsxs)("div",{className:y().roomConceptActions,children:[(0,n.jsxs)("button",{type:"button",className:y().clearRoomButton,disabled:!0,children:[(0,n.jsx)("span",{children:"Clear room"}),(0,n.jsx)("small",{children:"Structure only"})]}),(0,n.jsxs)("button",{type:"button",className:y().generateButton,disabled:!0,children:[(0,n.jsx)("span",{children:"Generate room concepts"}),(0,n.jsx)("small",{children:"AI connection pending"})]})]})]})]}),(0,n.jsxs)("div",{className:y().actions,children:[(0,n.jsx)("button",{type:"button",className:y().backButton,onClick:()=>o6(5),children:"Back"}),(0,n.jsxs)("div",{className:y().visualizeContinue,children:[av.length?(0,n.jsxs)("small",{children:["Choose a source photo for ",av.length," room",1===av.length?"":"s"]}):null,(0,n.jsxs)("button",{type:"button",className:y().primaryButton,disabled:rU||!!av.length,onClick:()=>o6(7),children:["Review project brief ",(0,n.jsx)("span",{children:"→"})]})]})]})]},"visualize"),7===R?(0,n.jsxs)("section",{className:"".concat(y().slide," ").concat(y().briefSlide),children:[(0,n.jsxs)("div",{className:y().introBlock,children:[(0,n.jsx)("h1",{children:en||"Your project direction"}),(0,n.jsx)("p",{children:"A working project brief built from the spaces, references and intentions you selected."})]}),(0,n.jsxs)("div",{className:y().briefStats,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:"Project"}
1),(0,n.jsx)("strong",{children:(null==an?void 0:an.title)||"Not selected"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:"Location"}),(0,n.jsx)("strong",{children:ea||"Open"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:"Spaces"}),(0,n.jsx)("strong",{children:oo.length})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{children:"Preferences"}),(0,n.jsx)("strong",{children:e4.length})]})]}),(0,n.jsxs)("div",{className:y().briefColumns,children:[(0,n.jsxs)("section",{children:[(0,n.jsx)("p",{className:y().sectionKicker,children:"Visual profile"}),(0,n.jsx)("h2",{children:am?"Your design direction":ec.length?ec.join(" \xb7 "):"Style remains open"}),el?(0,n.jsx)("p",{className:y().briefIdea,children:el}):null,(0,n.jsxs)("div",{className:y().briefSelections,children:[am&&z.versions.filter(e=>{var t;return e.id===((null===(t=z.selectedByPhoto)||void 0===t?void 0:t[e.photoId])||z.selectedId)}).map(e=>{var t;return(0,n.jsxs)("figure",{children:[(0,n.jsx)(f.Z,{src:e.url,projectId:tn||void 0,generationId:e.id,alt:"Selected room redesign"}),(0,n.jsx)("figcaption",{children:(null===(t=oo.find(t=>{var r;return t.id===(null===(r=ex.find(t=>t.id===e.photoId))||void 0===r?void 0:r.roomId)}))||void 0===t?void 0:t.label)||"Your generated design"})]},e.id)}),e4.slice(0,8).map(e=>(0,n.jsxs)("figure",{children:[(0,n.jsx)(f.Z,{src:e.imageUrl,alt:e.label}),e.region?(0,n.jsx)("span",{style:{left:"".concat(100*e.region.x,"%"),top:"".concat(100*e.region.y,"%"),width:"".concat(100*e.region.width,"%"),height:"".concat(100*e.region.height,"%"),clipPath:rh(e.region)}}):null,(0,n.jsx)("figcaption",{children:e.label})]},e.id)),e4.length||am?null:(0,n.jsx)("p",{children:"No references selected yet. The brief can still begin from the style and room schedule."})]})]}),(0,n.jsxs)("section",{children:[(0,n.jsx)("p",{className:y().sectionKicker,children:"Space schedule"}),(0,n.jsx)("div",{className:y().briefRoomList,children:oo.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e.label}),(0,n.jsxs)("span",{children:[ex.filter(t=>t.roomId===e.id).length," photos \xb7 ",e4.filter(t=>t.roomId===e.id).length," preferences"]})]},e.id))})]})]}),(0,n.jsxs)("div",{className:y().nextStage,children:[(0,n.jsxs)("div",{className:y().nextStageHeader,children:[(0,n.jsx)("p",{className:y().kicker,children:"What this brief can support next"}),(0,n.jsx)("span",{children:"Future services"})]}),(0,n.jsxs)("div",{className:y().nextStageGrid,children:[(0,n.jsxs)("article",{children:[(0,n.jsx)("span",{children:"01"}),(0,n.jsx)("h3",{children:"Concept directions"}),(0,n.jsx)("p",{children:"Develop alternatives that preserve the real structure of your spaces and respond to the references you selected."}),(0,n.jsx)("button",{type:"button",disabled:!0,children:"Generate concepts"})]}),(0,n.jsxs)("article",{children:[(0,n.jsx)("span",{children:"02"}),(0,n.jsx)("h3",{children:"Local project team"}),(0,n.jsx)("p",{children:("new-build"===et?["Architect","Interior designer","General contractor","Landscape designer"]:"whole-home"===et?["Architect","Interior designer","General contractor","Millwork"]:"interior"===et?["Furniture and materials","Specialty services","Installation","Moving and logistics"]:["Interior designer","Specialty contractor","Furniture and materials"]).join(" \xb7 ")}),(0,n.jsx)("button",{type:"button",disabled:!0,children:"Find verified matches"})]}),(0,n.jsxs)("article",{children:[(0,n.jsx)("span",{children:"03"}),(0,n.jsx)("h3",{children:"Estimated investment"}),(0,n.jsx)("p",{children:"Use location, scope and comparable Design Rates Database projects to build a more transparent starting range."}),(0,n.jsx)("button",{type:"button",disabled:!0,children:"Build estimate"})]})]}),(0,n.jsx)("p",{className:y().integrationNote,children:am?"Professional recommendations, pricing, and these future services are not active yet.":"These future services are not active yet. This prototype creates the brief only; it does not generate concepts, recommendations or pricing."})]}),(0,n.jsxs)("div",{className:y().actions,children:[(0,n.jsx)("button",{type:"button",className:y().backButton,onClick:()=>o6(6),children:"Refine visualization"}),(0,n.jsx)("button",{type:"button",className:y().resetButton,onClick:ar,children:"Start over"})]})]},"brief"):null]}),r5?(0,d.createPortal)((0,n.jsxs)("div",{className:y().savedProjectsModalOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"saved-projects-title",onMouseDown:e=>{e.target===e.currentTarget&&r4(!1)},children:[(0,n.jsxs)("section",{className:y().savedProjectsModal,children:[(0,n.jsx)("button",{ref:nT,className:y().savedProjectsModalClose,type:"button","aria-label":"Close saved projects",onClick:()=>r4(!1),children:"\xd7"}),(0,n.jsx)("p",{className:y().savedProjectsModalEyebrow,children:tt?tN?"Projects unavailable":"".concat(rA.length," saved"):"Loading projects"}),(0,n.jsx)("h2",{id:"saved-projects-title",children:"Select a project to continue"}),0===R&&r9?(0,n.jsx)("p",{role:"alert",children:r9}):null,(0,n.jsxs)("div",{className:y().savedProjectsModalList,"aria-live":"polite",children:[tt&&!tN&&0===rA.length?(0,n.jsx)("p",{className:y().savedProjectsModalEmpty,children:"You have no saved projects yet."}):null,rA.map(e=>{var t,r;let{number:o}=tF({...e,photos:e.thumbnailCaptureId?[{captureId:e.thumbnailCaptureId}]:[]}),a=null===(t=n5.find(t=>
1t.id===e.projectType))||void 0===t?void 0:t.title,i=t9((null===(r=e.projectName)||void 0===r?void 0:r.trim())||"")||"Untitled project";return(0,n.jsxs)("article",{className:y().savedProjectsModalProject,children:[(0,n.jsxs)("button",{type:"button",className:y().savedProjectsModalResume,disabled:rS||!!r6,onClick:()=>ae(e),children:[(0,n.jsx)(tL.Z,{projectId:e.id,captureId:e.thumbnailCaptureId,fallback:String(o).padStart(2,"0")}),(0,n.jsxs)("span",{className:y().savedProjectsModalProjectText,children:[(0,n.jsx)("strong",{children:i}),(0,n.jsx)("span",{children:a||"Project details not selected yet"}),(0,n.jsx)("small",{children:function(e){let t=new Date(e);return Number.isNaN(t.getTime())?"Saved recently":"Updated ".concat(new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:t.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(t))}(e.updatedAt)})]})]}),(0,n.jsx)("div",{className:y().savedProjectsModalActions,children:0===R?(0,n.jsx)("button",{type:"button",className:y().savedProjectsModalDelete,"aria-label":"Delete project ".concat(i),title:"Delete project",disabled:rS||!!r6,"aria-busy":r6===e.id,onClick:()=>void at(e),children:(0,n.jsx)(u.G,{icon:p.$aW})}):(0,n.jsx)("button",{type:"button",className:y().savedProjectsModalArrow,"aria-label":"Open project ".concat(i),disabled:rS||!!r6,onClick:()=>void ae(e),children:(0,n.jsx)("span",{"aria-hidden":"true",children:"→"})})})]},e.id)})]})]}),aJ]}),document.body):null,(0,n.jsx)(m.Z,{open:nt,initialMode:"sign-in",tone:"project",returnTo:nn?"/start-your-project?captureAuth=1":"/start-your-project?invitation=1",onClose:()=>{if(nr(!1),nn){no(!1);try{window.sessionStorage.removeItem(s)}catch(e){}}}}),(0,n.jsx)(tv,{open:nc,requiredCredits:nl,availableCredits:na,onClose:()=>nd(!1),onCreditsAvailable:e=>{ni(e);let t=nW.current;nW.current=null,null==t||t()}}),nh?(0,d.createPortal)((0,n.jsx)("div",{className:"project-coming-soon-overlay",onMouseDown:e=>{e.target===e.currentTarget&&nm(!1)},children:(0,n.jsxs)("section",{className:"project-coming-soon-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"planner-invitation-title","aria-describedby":"planner-invitation-description",children:[(0,n.jsx)("button",{ref:nA,className:"project-coming-soon-close",type:"button","aria-label":"Close",onClick:()=>nm(!1),children:"\xd7"}),(0,n.jsx)("p",{className:"project-coming-soon-label",children:"Beta access"}),(0,n.jsx)("h2",{className:"font-playfair",id:"planner-invitation-title",children:"Help shape what comes next."}),(0,n.jsx)("p",{id:"planner-invitation-description",children:"Start a Project is currently in private beta. Enter your beta access code to explore the experience and help us refine how great projects begin."}),(0,n.jsxs)("form",{className:y().notificationForm,noValidate:!0,onSubmit:e=>{if(e.preventDefault(),"2026"!==ng.trim()){var t;ny("That beta access code is not valid. Please try again."),null===(t=nD.current)||void 0===t||t.focus();return}if(!S||!C.isAuthenticated){nU.current=!0;try{window.sessionStorage.setItem(rn,"true")}catch(e){}nm(!1),o6(2);return}if(n2){nB.current.add(n2);try{window.sessionStorage.setItem(n2,"true")}catch(e){}}nm(!1),th&&0!==R||o6(2)},children:[(0,n.jsx)("label",{htmlFor:"project-invitation-code",children:"Beta access code"}),(0,n.jsxs)("div",{className:y().notificationControls,children:[(0,n.jsx)("input",{ref:nD,id:"project-invitation-code",type:"text",inputMode:"numeric",autoComplete:"off",maxLength:32,placeholder:"Enter your beta access code",required:!0,value:ng,"aria-invalid":!!nv,"aria-describedby":nv?"project-invitation-error":void 0,onChange:e=>{nf(e.target.value),ny("")}}),(0,n.jsx)("button",{type:"submit",children:"Enter the beta →"})]}),nv?(0,n.jsx)(o.Z,{id:"project-invitation-error",message:nv}):null]})]})}),document.body):null]})}},50529:function(e,t,r){"use strict";r.d(t,{f:function(){return o},r:function(){return a}});var n=r(93421);async function o(e){return Object.fromEntries(await Promise.all(n.t.map(async t=>{let{value:r}=t,[n,o]=await Promise.all(["text","reference"].map(async t=>{var n,o,a;let i=await e("StartProject/me/credits/quote?qualityTier=".concat(r,"&generationMode=").concat(t)),l=Number(null!==(n=null==i?void 0:i.creditsRequired)&&void 0!==n?n:null==i?void 0:i.CreditsRequired);if((null!==(o=null==i?void 0:i.qualityTier)&&void 0!==o?o:null==i?void 0:i.QualityTier)!==r||(null!==(a=null==i?void 0:i.generationMode)&&void 0!==a?a:null==i?void 0:i.GenerationMode)!==t||!Number.isSafeInteger(l)||l<=0)throw Error("Generation rates are unavailable.");return l}));return[r,{text:n,reference:o}]})))}let a=(e,t)=>Math.floor(e/t)},93421:function(e,t,r){"use strict";r.d(t,{t:function(){return n}});let n=[{value:"standard",label:"Standard",description:"Standard detail \xb7 up to 2K"},{value:"premium",label:"Premium",description:"High detail \xb7 up to 2K"},{value:"rendering",label:"Rendering",description:"High detail \xb7 maximum resolution"}]},41620:function(e,t){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n,o="dahlia",a="https://js.stripe.com",i="".concat(a,"/").concat(o,"/stripe.js"),l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,s=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,c="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",d=function(){for(var e=document.querySelectorAll('script[src^="'.concat(a,'"]')),t=0;t<e.length;t++){var r,n=e[t];if(r=n.src,l.test(r)||s.test(r))return n}return null},u=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");
1r.src="".concat(i).concat(t);var n=document.head||document.body;if(!n)throw Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r},p=function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"9.15.0",startTime:t})},h=null,m=null,g=null,f=function(e,t,n){if(null===e)return null;var a,i=t[0];if("string"!=typeof i)throw Error("Expected publishable key to be of type string, got type ".concat(r(i)," instead."));var l=i.match(/^pk_test/),s=3===(a=e.version)?"v3":a;l&&s!==o&&console.warn("Stripe.js@".concat(s," was loaded on the page, but @stripe/stripe-js@").concat("9.15.0"," expected Stripe.js@").concat(o,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var c=e.apply(void 0,t);return p(c,n),c},v=function(e){var t="invalid load parameters; expected object of shape\n\n    {advancedFraudSignals: boolean}\n\nbut received\n\n    ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==r(e))throw Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw Error(t)},y=!1,j=function(){for(var e,t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];y=!0;var a=Date.now();return(e=n,null!==h?h:(h=new Promise(function(t,r){if("undefined"==typeof window||"undefined"==typeof document){t(null);return}if(window.Stripe&&e&&console.warn(c),window.Stripe){t(window.Stripe);return}try{var n,o=d();o&&e?console.warn(c):o?o&&null!==g&&null!==m&&(o.removeEventListener("load",g),o.removeEventListener("error",m),null===(n=o.parentNode)||void 0===n||n.removeChild(o),o=u(e)):o=u(e),g=function(){window.Stripe?t(window.Stripe):r(Error("Stripe.js not available"))},m=function(e){r(Error("Failed to load Stripe.js",{cause:e}))},o.addEventListener("load",g),o.addEventListener("error",m)}catch(e){r(e);return}})).catch(function(e){return h=null,Promise.reject(e)})).then(function(e){return f(e,r,a)})};j.setLoadParameters=function(e){if(!(y&&n&&Object.keys(v(e)).reduce(function(t,r){var o;return t&&e[r]===(null===(o=n)||void 0===o?void 0:o[r])},!0))){if(y)throw Error("You cannot change load parameters after calling loadStripe");
1n=v(e)}},t.loadStripe=j},23181:function(e,t,r){e.exports=r(41620)},87138:function(e,t,r){"use strict";r.d(t,{default:function(){return o.a}});var n=r(231),o=r.n(n)},28992:function(e){e.exports={page:"account_page__UjyRe",gate:"account_gate__L0uoH",loadingPage:"account_loadingPage__U_lds",kicker:"account_kicker__QlBKT",accountGrid:"account_accountGrid__hz3GN",rail:"account_rail__Vw5fr",identity:"account_identity__s__sQ",activeView:"account_activeView__eCiDt",content:"account_content__dK3TO",section:"account_section__D9SO8",emptyPanel:"account_emptyPanel__btfrl",articleSettingsList:"account_articleSettingsList__vvq0y",articleTableAction:"account_articleTableAction__utHUl",articleReviewActions:"account_articleReviewActions__Rc_eu",notice:"account_notice__8PPFK",creditSettingsList:"account_creditSettingsList__HOycj",creditPackageHeading:"account_creditPackageHeading__JSnxn",creditPackageContent:"account_creditPackageContent__xTcDg",creditCheckoutNotice:"account_creditCheckoutNotice__Ov3Ds",creditPaymentForm:"account_creditPaymentForm__K0nxf",creditPaymentSummary:"account_creditPaymentSummary__7_T7c",creditPaymentError:"account_creditPaymentError__dWQiq",creditPaymentActions:"account_creditPaymentActions__rCo5x",creditCheckoutOverlay:"account_creditCheckoutOverlay__ACTAr",creditCheckoutDialog:"account_creditCheckoutDialog__U0lLn",creditCheckoutEyebrow:"account_creditCheckoutEyebrow__4tQRm",creditCheckoutClose:"account_creditCheckoutClose__JHREd",creditCheckoutPreparing:"account_creditCheckoutPreparing__7xSpL",creditCheckoutPreparingSpinner:"account_creditCheckoutPreparingSpinner__jLbyD",creditButtonSpin:"account_creditButtonSpin__pToU9",creditPackages:"account_creditPackages__nhNiW",creditPackage:"account_creditPackage__kYnni",creditButtonSpinner:"account_creditButtonSpinner__rDX_U",overviewSettings:"account_overviewSettings__5DH7Q",tabHeader:"account_tabHeader__zxWYA",settingsListGroups:"account_settingsListGroups__6X0K7",settingsListGroup:"account_settingsListGroup__0vJ71",fullWidthListGroup:"account_fullWidthListGroup__mnd7g",sectionHeading:"account_sectionHeading__pIF6J",settingsList:"account_settingsList__XsMKt",placeholderValue:"account_placeholderValue__4JcnK",settingLink:"account_settingLink__ZQtdN",aboutValue:"account_aboutValue__EeBAB",editPlaceholder:"account_editPlaceholder__UkG9X",inlineEditor:"account_inlineEditor__Zyruv",inlineEditActions:"account_inlineEditActions__oTnJE",photoModalBackdrop:"account_photoModalBackdrop__Mg2w_",photoModal:"account_photoModal__0cPY3",photoModalHeader:"account_photoModalHeader__V8nL9",photoModalImage:"account_photoModalImage__Fitew",changeRequestModal:"account_changeRequestModal__eH7cX",articleReviewModal:"account_articleReviewModal__FmuQg",articleReviewModalActions:"account_articleReviewModalActions__55Vqr",signOut:"account_signOut__PfTYh",gateInner:"account_gateInner__M2CK4",gateIntro:"account_gateIntro__3Q8my",gateForm:"account_gateForm__QgSg_"}},52932:function(e){e.exports={description:"FieldError_description__SkjHe"}},14433:function(e){e.exports={usage:"creditPackageUsage_usage__0OYnH",resolution:"creditPackageUsage_resolution__HFtW5"}},27964:function(e){e.exports={app:"desktopProjectWorkspace_app___dYCo",appbar:"desktopProjectWorkspace_appbar__5SBJa",brand:"desktopProjectWorkspace_brand__W_r0L",brandLogo:"desktopProjectWorkspace_brandLogo__XT5Hr",projectIdentity:"desktopProjectWorkspace_projectIdentity__MGBqX",projectTitleButton:"desktopProjectWorkspace_projectTitleButton__nsliH",projectTitleEditor:"desktopProjectWorkspace_projectTitleEditor__lLB8k",projectTitleField:"desktopProjectWorkspace_projectTitleField__GecCt",projectTitleMeasure:"desktopProjectWorkspace_projectTitleMeasure__0PSL8",projectTitleInput:"desktopProjectWorkspace_projectTitleInput__Zr7u4",loginToSave:"desktopProjectWorkspace_loginToSave__dtHX2",appActions:"desktopProjectWorkspace_appActions__BDrD6",locationButton:"desktopProjectWorkspace_locationButton__A_Qrg",savedProjectsButton:"desktopProjectWorkspace_savedProjectsButton__KpUOr",closeButton:"desktopProjectWorkspace_closeButton__4O7oW",historyToolsMount:"desktopProjectWorkspace_historyToolsMount__IvYzH",panelHeading:"desktopProjectWorkspace_panelHeading__pur1F",configuration:"desktopProjectWorkspace_configuration__gFmjh",navigation:"desktopProjectWorkspace_navigation__x4eiR",center:"desktopProjectWorkspace_center__En06i",canvasbar:"desktopProjectWorkspace_canvasbar__T4Idx",documentDot:"desktopProjectWorkspace_documentDot__B9ACc",canvasBody:"desktopProjectWorkspace_canvasBody__TjUYt",emptyCanvas:"desktopProjectWorkspace_emptyCanvas__3yrfp",zoomSurface:"desktopProjectWorkspace_zoomSurface__aZivl",guidedLayerPreview:"desktopProjectWorkspace_guidedLayerPreview__VdkJt",cleanupActionMount:"desktopProjectWorkspace_cleanupActionMount__AhXH3",emptyUploadCopy:"desktopProjectWorkspace_emptyUploadCopy__Ybz7n",eyebrow:"desktopProjectWorkspace_eyebrow__sgCf_",emptyPhoneEntry:"desktopProjectWorkspace_emptyPhoneEntry__3CaOj",phone
1EntryPlaceholder:"desktopProjectWorkspace_phoneEntryPlaceholder__Fgwom",recoveryNotice:"desktopProjectWorkspace_recoveryNotice__VAMqh",uploadButton:"desktopProjectWorkspace_uploadButton___fyJ0",uploadProgress:"desktopProjectWorkspace_uploadProgress___uaRn",uploadAdvance:"desktopProjectWorkspace_uploadAdvance__63vAv",uploadActions:"desktopProjectWorkspace_uploadActions__momnr",uploadSpacePicker:"desktopProjectWorkspace_uploadSpacePicker__5LdSk",phoneUploadButton:"desktopProjectWorkspace_phoneUploadButton__PJB5u",emptyJourney:"desktopProjectWorkspace_emptyJourney__rvdiU",photoStage:"desktopProjectWorkspace_photoStage__B71Bv",promptPortalMount:"desktopProjectWorkspace_promptPortalMount__BsS8T",filmstrip:"desktopProjectWorkspace_filmstrip__Mz4K7",addTile:"desktopProjectWorkspace_addTile__2zuC3",canvasFooter:"desktopProjectWorkspace_canvasFooter__sGBEG",toolRail:"desktopProjectWorkspace_toolRail__Fd9kR",workspaceToolGroup:"desktopProjectWorkspace_workspaceToolGroup__HsHGv",toolRailDivider:"desktopProjectWorkspace_toolRailDivider__QNPPb",toolsPanel:"desktopProjectWorkspace_toolsPanel__kS_WR",toolsHeading:"desktopProjectWorkspace_toolsHeading__N57d_",selectedCard:"desktopProjectWorkspace_selectedCard__oWqF0",primary:"desktopProjectWorkspace_primary__rTf0B",hint:"desktopProjectWorkspace_hint__tmqba",remove:"desktopProjectWorkspace_remove__OTNp9",nextUp:"desktopProjectWorkspace_nextUp__G8cXJ",resizableArea:"desktopProjectWorkspace_resizableArea__d5Wvp",panelDivider:"desktopProjectWorkspace_panelDivider___9zcG",dynamicPanel:"desktopProjectWorkspace_dynamicPanel__3Da_4",settingsPanelContent:"desktopProjectWorkspace_settingsPanelContent__65hoA",setupForm:"desktopProjectWorkspace_setupForm__QP_0x",setupActions:"desktopProjectWorkspace_setupActions__9JCFd",contextTools:"desktopProjectWorkspace_contextTools__Y9cYV",sourcePanel:"desktopProjectWorkspace_sourcePanel__OG_i_",layersPanel:"desktopProjectWorkspace_layersPanel__ri5Eg",galleryPanel:"desktopProjectWorkspace_galleryPanel__WpVqX",drawerHeading:"desktopProjectWorkspace_drawerHeading__MZgYx",referencePanelBar:"desktopProjectWorkspace_referencePanelBar__YiDTT",layerList:"desktopProjectWorkspace_layerList___WA8Y",layerItem:"desktopProjectWorkspace_layerItem__DNs3X",roomItem:"desktopProjectWorkspace_roomItem__7L2C4",roomList:"desktopProjectWorkspace_roomList__8fQP5",emptyRoomThumbnail:"desktopProjectWorkspace_emptyRoomThumbnail__a479q",layerDescription:"desktopProjectWorkspace_layerDescription__ZcNm2",layerTitle:"desktopProjectWorkspace_layerTitle__8V0KK",roomText:"desktopProjectWorkspace_roomText__TOz5J",layerTitleInput:"desktopProjectWorkspace_layerTitleInput__cvySx",roomTitleInput:"desktopProjectWorkspace_roomTitleInput__zlhIY",layerControl:"desktopProjectWorkspace_layerControl__g1f0M",placeholderRoomItem:"desktopProjectWorkspace_placeholderRoomItem__fDtpr",placeholderRoomContent:"desktopProjectWorkspace_placeholderRoomContent__NrYmw",roomSelect:"desktopProjectWorkspace_roomSelect__lYUv6",roomSettings:"desktopProjectWorkspace_roomSettings__UvTXK",addSpaceTile:"desktopProjectWorkspace_addSpaceTile__eyzsP",referencePanel:"desktopProjectWorkspace_referencePanel__gTKA_",referenceEmpty:"desktopProjectWorkspace_referenceEmpty__zFMEE",referenceGrid:"desktopProjectWorkspace_referenceGrid___n5l7",referenceThumbnail:"desktopProjectWorkspace_referenceThumbnail__sIJKg",referenceCard:"desktopProjectWorkspace_referenceCard__mzw52",referenceOpen:"desktopProjectWorkspace_referenceOpen___vwwX",referenceFilmstrip:"desktopProjectWorkspace_referenceFilmstrip__eab3P",referencePreview:"desktopProjectWorkspace_referencePreview__sEIqx",referenceImageSurface:"desktopProjectWorkspace_referenceImageSurface__Qcmfp",referencePanLayer:"desktopProjectWorkspace_referencePanLayer__yFl0h",referenceSelectionLayer:"desktopProjectWorkspace_referenceSelectionLayer__0oi52",referencePolygonNode:"desktopProjectWorkspace_referencePolygonNode__61HKs",selectionDeleteButton:"desktopProjectWorkspace_selectionDeleteButton__q51la",referenceDraftShape:"desktopProjectWorkspace_referenceDraftShape__2d98e",connectionOverlay:"desktopProjectWorkspace_connectionOverlay__Queqd",activeConnection:"desktopProjectWorkspace_activeConnection__cR_cD",selectionDragPreview:"desktopProjectWorkspace_selectionDragPreview__opi0O",connectionMarker:"desktopProjectWorkspace_connectionMarker__o8sL5",selectionDragPreviewActive:"desktopProjectWorkspace_selectionDragPreviewActive__N_mO_",referenceFilmstripPlaceholder:"desktopProjectWorkspace_referenceFilmstripPlaceholder__WBjIE",referenceAddTile:"desktopProjectWorkspace_referenceAddTile__iqJs6",filmstripTile:"desktopProjectWorkspace_filmstripTile__UPFtC",thumbnailDelete:"desktopProjectWorkspace_thumbnailDelete__O5U1_",thumbnailUploading:"desktopProjectWorkspace_thumbnailUploading__ag1Ur",filmstripUploadSpin:"desktopProjectWorkspace_filmstripUploadSpin__niiHT",thumbnailUnavailable:"desktopProjectWorkspace_thumbnailUnavailable__MCxNE",inspirationPanel:"desktopProjectWorkspace_inspirationPanel__PAnw9",inspirationHeading:"desktopProjectWorkspace_inspirationHeading__UupIn",sourceOptions:"desktopProjectWorkspace_sourceOptions__4t5w8",sourceBack:"desktopProjectWorkspace_sourceBack__hs3LG",error:"desktopProjectWorkspace_error__xfN5X",srOnly:"desktopProjectWorkspace_srOnly__
11AcUE",projectSummary:"desktopProjectWorkspace_projectSummary__uCVYY",detailsButton:"desktopProjectWorkspace_detailsButton__M0Hll",workspaceContent:"desktopProjectWorkspace_workspaceContent__nWKMX",setupCanvas:"desktopProjectWorkspace_setupCanvas__xHTpw",sandboxButton:"desktopProjectWorkspace_sandboxButton__HnVzV",setupNote:"desktopProjectWorkspace_setupNote__DGNW7",setupBackdrop:"desktopProjectWorkspace_setupBackdrop__nyNs_",panelRail:"desktopProjectWorkspace_panelRail__D60VB",railText:"desktopProjectWorkspace_railText__G_LZR",panelRailDivider:"desktopProjectWorkspace_panelRailDivider__Rel6L",submenuChevron:"desktopProjectWorkspace_submenuChevron__G3aPL",styleSubmenu:"desktopProjectWorkspace_styleSubmenu__4iS1D",guidedTourLayer:"desktopProjectWorkspace_guidedTourLayer__nErav",guidedTourHighlight:"desktopProjectWorkspace_guidedTourHighlight__u2llt",guidedTourActionTarget:"desktopProjectWorkspace_guidedTourActionTarget__pMhZ_",guidedTourTargetArrow:"desktopProjectWorkspace_guidedTourTargetArrow__djWJn",guidedTourTargetNudge:"desktopProjectWorkspace_guidedTourTargetNudge__Wiyzl",guidedTourBubble:"desktopProjectWorkspace_guidedTourBubble__GlpL_",guidedTourProgress:"desktopProjectWorkspace_guidedTourProgress__qNhwM",guidedTourActions:"desktopProjectWorkspace_guidedTourActions__X34E_",guidedTourHide:"desktopProjectWorkspace_guidedTourHide__SOASO",guidedTourBack:"desktopProjectWorkspace_guidedTourBack__uEFJg",guidedTourNext:"desktopProjectWorkspace_guidedTourNext__i4prm",referenceImageError:"desktopProjectWorkspace_referenceImageError__Cs0eg",referenceContent:"desktopProjectWorkspace_referenceContent__52qDv",savedRoomThumbnail:"desktopProjectWorkspace_savedRoomThumbnail__WzMCR",referenceSelectionControls:"desktopProjectWorkspace_referenceSelectionControls__DFceD"}},67812:function(e){e.exports={control:"generationQualitySelector_control__oLy5Q"}},28584:function(e){e.exports={root:"inspirationBrowser_root__B0Z0U",browser:"inspirationBrowser_browser__1Vw1I",intro:"inspirationBrowser_intro__SeR5X",filters:"inspirationBrowser_filters__f5aDy",articleIntro:"inspirationBrowser_articleIntro__OJTxw",scroll:"inspirationBrowser_scroll__2CVf1",grid:"inspirationBrowser_grid__2Xk_5",card:"inspirationBrowser_card__p1R2P",companyCard:"inspirationBrowser_companyCard__LR9KJ",more:"inspirationBrowser_more__KaWrG",companyDetails:"inspirationBrowser_companyDetails__o2_5t",thumbnail:"inspirationBrowser_thumbnail__fH1vo",status:"inspirationBrowser_status__RW970",pagination:"inspirationBrowser_pagination__Teulz",professionalFilters:"inspirationBrowser_professionalFilters__xU8Lw",filterPair:"inspirationBrowser_filterPair__6SFro",profileLink:"inspirationBrowser_profileLink___u85O",companySection:"inspirationBrowser_companySection__U_M6a",companyList:"inspirationBrowser_companyList___dL4B",companyAvatar:"inspirationBrowser_companyAvatar__3AEye",companyArrow:"inspirationBrowser_companyArrow__ICJA3"}},740:function(e){e.exports={screen:"inspirationSourceStep_screen__BezdL",options:"inspirationSourceStep_options__q_T2N",card:"inspirationSourceStep_card__4X0VS",srOnly:"inspirationSourceStep_srOnly__VbIpz",icon:"inspirationSourceStep_icon__3q_sa",description:"inspirationSourceStep_description__j9a_M",selection:"inspirationSourceStep_selection__hNM7V",actions:"inspirationSourceStep_actions__k_ij4",selectedSource:"inspirationSourceStep_selectedSource__zGuyK"}},73551:function(e){e.exports={canvas:"photoSelectionCanvas_canvas__Nz2KB",nodes:"photoSelectionCanvas_nodes__3bRtE",controls:"photoSelectionCanvas_controls__1NLxx",iconButton:"photoSelectionCanvas_iconButton__3LOAr",detached:"photoSelectionCanvas_detached__FucHr"}},30561:function(e){e.exports={overlay:"projectCreditGateModal_overlay__NPYmR",dialog:"projectCreditGateModal_dialog__sXKy5",close:"projectCreditGateModal_close__LMZJc",eyebrow:"projectCreditGateModal_eyebrow__GBPh8",sandbox:"projectCreditGateModal_sandbox__yQTOc",error:"projectCreditGateModal_error__h7Gy4",packages:"projectCreditGateModal_packages__TPXjd",package:"projectCreditGateModal_package__joXvm",packageAction:"projectCreditGateModal_packageAction__KVrsA",usageNote:"projectCreditGateModal_usageNote__eQPra",ratesUnavailable:"projectCreditGateModal_ratesUnavailable__qbJ0p"}},38483:function(e){e.exports={frame:"projectHeroReveal_frame__8Lhod",image:"projectHeroReveal_image__J5iq9",drawingSettle:"projectHeroReveal_drawingSettle___Rrb1",renderLayer:"projectHeroReveal_renderLayer__XMYMo",divider:"projectHeroReveal_divider__Ik_X6",drawingLabel:"projectHeroReveal_drawingLabel__78noc",renderLabel:"projectHeroReveal_renderLabel__GbNve",hint:"projectHeroReveal_hint__AuyEU",interactive:"projectHeroReveal_interactive___BGVj"}}
1,41722:function(e){e.exports={workspace:"projectOpeningWorkspace_workspace__10mzo",message:"projectOpeningWorkspace_message__wt5bJ",canvas:"projectOpeningWorkspace_canvas__KUgEa",spinner:"projectOpeningWorkspace_spinner__SEq2X",spin:"projectOpeningWorkspace_spin__HIBde"}},77189:function(e){e.exports={header:"projectSearch_header__7VIe9",field:"projectSearch_field__17vdO",filters:"projectSearch_filters__Cj3Kh",viewer:"projectSearch_viewer__P22RJ",detailHeading:"projectSearch_detailHeading__6kt4z"}},33156:function(e){e.exports={editor:"quickCaptureDeclutter_editor__PJck9",workspace:"quickCaptureDeclutter_workspace__BXVCG",stage:"quickCaptureDeclutter_stage__D0G6G",frame:"quickCaptureDeclutter_frame__m5BDU",versionLabel:"quickCaptureDeclutter_versionLabel__1NCkg",mask:"quickCaptureDeclutter_mask__68RkE",rail:"quickCaptureDeclutter_rail__mpyuq",brushTools:"quickCaptureDeclutter_brushTools__kPe3p",railRange:"quickCaptureDeclutter_railRange__qSaPU",declutterAction:"quickCaptureDeclutter_declutterAction__K72Sr",desktopDeclutterAction:"quickCaptureDeclutter_desktopDeclutterAction__4RGha",answer:"quickCaptureDeclutter_answer__fjIiw",creditAnswer:"quickCaptureDeclutter_creditAnswer__l0WLr",selectionAction:"quickCaptureDeclutter_selectionAction__HFIrS",selectionSize:"quickCaptureDeclutter_selectionSize__3r7ql",doneSelection:"quickCaptureDeclutter_doneSelection__Z7WBr",actionLabel:"quickCaptureDeclutter_actionLabel__Cs_hT",retryQuote:"quickCaptureDeclutter_retryQuote__kltPf",filmstrip:"quickCaptureDeclutter_filmstrip__LoJ9E",processing:"quickCaptureDeclutter_processing__Q2r8l",checkProgress:"quickCaptureDeclutter_checkProgress__61uDL",error:"quickCaptureDeclutter_error__NLLM5",message:"quickCaptureDeclutter_message__d8BMW",desktopEditor:"quickCaptureDeclutter_desktopEditor__d81W5",desktopRail:"quickCaptureDeclutter_desktopRail__5pvhJ",desktopBrushTools:"quickCaptureDeclutter_desktopBrushTools__mITnC",desktopEditorPlaceholders:"quickCaptureDeclutter_desktopEditorPlaceholders__UobmE"}},91199:function(e){e.exports={screen:"redesignChat_screen__amSET",back:"redesignChat_back__K9MVZ",continue:"redesignChat_continue__DLUMl",turn:"redesignChat_turn__mmJYE",userMessage:"redesignChat_userMessage__xqBZq",sentAttachment:"redesignChat_sentAttachment__Aheay",response:"redesignChat_response__J4A1Y",responseLabel:"redesignChat_responseLabel__ZnQVh",resultImage:"redesignChat_resultImage__LabSJ",resultActions:"redesignChat_resultActions__hVyBm",pending:"redesignChat_pending__MdelB",error:"redesignChat_error__5NDOk",pulse:"redesignChat_pulse__n3Ppu",composerDock:"redesignChat_composerDock__q3IBj",composer:"redesignChat_composer__R_Rn6",attachment:"redesignChat_attachment__EiFhS",editing:"redesignChat_editing__a7fle",composerFooter:"redesignChat_composerFooter__Zh3xV",creditStatus:"redesignChat_creditStatus__uugpe",creditLink:"redesignChat_creditLink__u7PyC",send:"redesignChat_send__CGKqi",preparing:"redesignChat_preparing__W89DM",srOnly:"redesignChat_srOnly__JICSb",preview:"redesignChat_preview__WJc_f",messages:"redesignChat_messages__ySYay",botOpening:"redesignChat_botOpening__dDo9_",chatActions:"redesignChat_chatActions__tMV9T",desktopCanvas:"redesignChat_desktopCanvas__iyc_Y",desktopPhoto:"redesignChat_desktopPhoto__Juj_4",desktopPhotoLabel:"redesignChat_desktopPhotoLabel__wDTiW",desktopProcessing:"redesignChat_desktopProcessing__gpM1a",desktopVersions:"redesignChat_desktopVersions__HWWAb",desktopComposer:"redesignChat_desktopComposer__PGtBX",desktopMessages:"redesignChat_desktopMessages__UHxGS",desktopTurn:"redesignChat_desktopTurn__DpsqP",desktopAssistantMessage:"redesignChat_desktopAssistantMessage__vDdbC",desktopResponse:"redesignChat_desktopResponse__73J9Y",desktopUserMessage:"redesignChat_desktopUserMessage__3c1qK",desktopSelectResult:"redesignChat_desktopSelectResult__ig4Dn",referenceComposer:"redesignChat_referenceComposer__MbXgC",sendControls:"redesignChat_sendControls__zfxWH"}},60232:function(e){e.exports={root:"referencePlacement_root__smCOq",photoClip:"referencePlacement_photoClip__Y7_3P",cutout:"referencePlacement_cutout__rMY9V",controls:"referencePlacement_controls__uHHoJ",outline:"referencePlacement_outline__7FEAO",corner:"referencePlacement_corner__822LI",edge:"referencePlacement_edge__Hoa6z",toolbar:"referencePlacement_toolbar__0CfmM",sourcePhotoIcon:"referencePlacement_sourcePhotoIcon__FuMyK"}}},function(e){e.O(0,[5139,8905,695,8825,1934,454,1970,7937,8530,3676,231,4598,8173,6920,4920,4324,9783,6371,1427,6770,2870,9755,8366,4286,2971,7023,1744],function(){return e(e.s=35609)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.