@neurodyn/room-viewer 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7236,7 +7236,7 @@ Defaulting to \`null\`.`));let u=vA(a,c)?a:null,d=vh(u)?s(u,c):void 0;return(0,e
|
|
|
7236
7236
|
font-display: swap;
|
|
7237
7237
|
unicode-range: U+6??, U+750-77F, U+870-891, U+897-8E1, U+8E3-8FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
|
|
7238
7238
|
}
|
|
7239
|
-
`,""]);let s=o.toString()},"../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@rsbuild/core/compiled/css-loader/api.js"(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r}).join("")},t.i=function(e,r,n,i,a){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(n)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);n&&o[u[0]]||(void 0!==a&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),r&&(u[2]&&(u[1]="@media ".concat(u[2]," {").concat(u[1],"}")),u[2]=r),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},"../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@rsbuild/core/compiled/css-loader/noSourceMaps.js"(e){e.exports=function(e){return e[1]}}},xv={};function xb(e){var t=xv[e];if(void 0!==t)return t.exports;var r=xv[e]={id:e,exports:{}};return xm[e](r,r.exports,xb),r.exports}xb.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return xb.d(t,{a:t}),t},xb.d=(e,t)=>{for(var r in t)xb.o(t,r)&&!xb.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},xb.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let xy=(0,ec.createContext)({theme:"system",setTheme:()=>null});function xw({children:e,defaultTheme:t="system",storageKey:r="v-theme",root:n=window.document.documentElement,enableStorage:i=!1,...a}){let[o,s]=(0,ec.useState)(()=>i&&localStorage.getItem(r)||t);return(0,ec.useEffect)(()=>{if(n.classList.remove("light","dark"),"system"===o){let e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";n.classList.add(e);return}n.classList.add(o)},[o,n]),(0,el.jsx)(xy,{...a,value:{theme:o,setTheme:e=>{i&&localStorage.setItem(r,e),s(e)}},children:e})}var xx=xb("../ui/src/styles/fonts.css?inline");let xC={en:{translation:{matting:"Matting",close:"Close",mattingOptions:{none:"None"},units:{cm:"cm",in:"in"},ar:{viewInPlace:"View in place",scanQrCode:"Scan this QR code with your phone's camera to view the object in Augmented Reality",deviceRequirementsDisclaimer:"*Requires AR-supported device and browser. We recommend iOS 18 or later with Safari, or Android 7.0 or later with Chrome.",appClipScanTitle:"Scan with your phone camera",appClipRequirement:"AR view works on iOS 18 or later"},legal:{termsOfUse:"Terms of Use",conjunction:" and ",privacyPolicy:"Privacy Policy"},shareMessage:{"wall-panel":"Preview wall panels",wallart:"Preview wall art",rugs:"Preview rug",flooring:"Preview flooring"},rooms:{"room-example-11":"Room Example 11","room-example-12":"Room Example 12","room-example-13":"Room Example 13","room-example-14":"Room Example 14","room-example-15":"Room Example 15","carpet-bathroom":"Bathroom","carpet-bedroom":"Bedroom","carpet-entryway":"Entryway","carpet-living-room":"Living Room"},scene:{tunePosition:"Tune position",angle:"Angle",rotation:"Rotation",resetPosition:"Reset"},accessError:{unauthorized:"Invalid API key","payment-required":"Viewer temporarily unavailable"},loadError:{"viewer-load-failed":"We could not load the viewer. Please try again.","artwork-load-failed":"The image could not be loaded — its link is missing or incorrect in the widget settings.","room-load-failed":"The room photo could not be loaded. Please try again."},missingSurface:{floor:{title:"We couldn't find the floor",body:"Try a photo that shows the floor."},wall:{title:"We couldn't find a wall",body:"Try a photo that shows a wall."},uploadAnother:"Upload another photo"},wallPanel:{loading:"Loading material",panelActions:"Panel {{number}} actions",retry:"Could not load. Select again to retry.",actions:"Panel actions",materials:"Materials",materialFallback:"Material {{number}}",rotate:"Rotate panel",delete:"Delete panel"},wallArt:{pictureFrame:"Frame"},resourceType:{"wall-panel":{productCategory:"Wall panel",productCardTitle:"Selected panel",replaceProduct:"Replace panel",replaceProductShort:"Replace"},wallart:{productCardTitle:"Selected wall art",appearance:"Replace"},rugs:{productCategory:"Rug",productCardTitle:"Selected rug",replaceProduct:"Replace rug",replaceProductShort:"Replace"},flooring:{productCategory:"Flooring",productCardTitle:"Selected flooring",replaceProduct:"Replace flooring",replaceProductShort:"Replace"}},floor:{scene:{share:"Share",download:"Download",hideCatalog:"Hide catalog",description:"Description",select:"Select",interiorCardTitle:"Interior",tryAtHome:"Try at home",tryAtHomeBody:"Through your phone camera"},materialSelection:{flooring:"Choose flooring",rugs:"Choose a rug","wall-panel":"Choose a panel",title:"Material Selection"},interiorSelection:{title:"Choose interior",uploadPhoto:"Upload your photo",invalidFile:"Could not upload photo, please try again",customTitle:"Your photos",presetsTitle:"Preset interiors",currentInterior:"Current interior",chooseInterior:"Choose interior",chooseInteriorShort:"Choose"},processing:{title:"Preparing your room",progressLabel:"Room preparation progress",stages:{reading:"Reading your photo...",mapping:"Finding floors and walls...",lighting:"Balancing light and perspective...",finalizing:"Building your preview...",ready:"Room is ready..."}},error:{title:"Something went wrong",processingBody:"This time we could not upload and process the photo",loadBody:"We could not load the viewer. Please try again.",tryAgain:"Try again",cancel:"Cancel"}}}},ru:{translation:{matting:"Паспарту",close:"Закрыть",mattingOptions:{none:"Нет"},units:{cm:"см",in:"in"},ar:{viewInPlace:"Примерить в комнате",scanQrCode:"Отсканируйте этот QR-код камерой телефона, чтобы просмотреть объект в дополненной реальности",deviceRequirementsDisclaimer:"*Требуется устройство и браузер с поддержкой AR. Рекомендуем iOS 18 или новее с Safari либо Android 7.0 или новее с Chrome.",appClipScanTitle:"Наведите камеру телефона",appClipRequirement:"AR-просмотр работает на iOS 18 и новее"},legal:{termsOfUse:"Условия использования",conjunction:" и ",privacyPolicy:"Политика конфиденциальности"},shareMessage:{"wall-panel":"Примерить стеновые панели",wallart:"Примерить настенный декор",rugs:"Примерить ковер",flooring:"Примерить напольное покрытие"},rooms:{"room-example-11":"Пример комнаты 11","room-example-12":"Пример комнаты 12","room-example-13":"Пример комнаты 13","room-example-14":"Пример комнаты 14","room-example-15":"Пример комнаты 15","carpet-bathroom":"Ванная","carpet-bedroom":"Спальня","carpet-entryway":"Прихожая","carpet-living-room":"Гостиная"},scene:{tunePosition:"Настроить положение",angle:"Угол",rotation:"Поворот",resetPosition:"Сбросить"},accessError:{unauthorized:"Неверный API-ключ","payment-required":"Просмотр временно недоступен"},loadError:{"viewer-load-failed":"Не удалось загрузить просмотр. Попробуйте ещё раз.","artwork-load-failed":"Не удалось загрузить изображение — ссылка на него отсутствует или указана неверно в настройках виджета.","room-load-failed":"Не удалось загрузить фото комнаты. Попробуйте ещё раз."},missingSurface:{floor:{title:"Не получилось найти пол",body:"Попробуйте фото, на котором виден пол."},wall:{title:"Не получилось найти стену",body:"Попробуйте фото, на котором видна стена."},uploadAnother:"Загрузить другое фото"},wallPanel:{loading:"Загрузка материала",panelActions:"Действия с панелью {{number}}",retry:"Не удалось загрузить. Нажмите ещё раз.",actions:"Действия с панелью",materials:"Материалы",materialFallback:"Материал {{number}}",rotate:"Повернуть панель",delete:"Удалить панель"},wallArt:{pictureFrame:"Рамка"},resourceType:{"wall-panel":{productCategory:"Стеновая панель",productCardTitle:"Выбранная панель",replaceProduct:"Заменить панель",replaceProductShort:"Заменить"},wallart:{productCardTitle:"Выбранный настенный декор",appearance:"Заменить"},rugs:{productCategory:"Ковер",productCardTitle:"Выбранный ковер",replaceProduct:"Заменить ковер",replaceProductShort:"Заменить"},flooring:{productCategory:"Напольное покрытие",productCardTitle:"Выбранное напольное покрытие",replaceProduct:"Заменить",replaceProductShort:"Заменить"}},floor:{scene:{share:"Поделиться",download:"Скачать",hideCatalog:"Скрыть каталог",description:"Описание",select:"Выбрать",interiorCardTitle:"Интерьер",tryAtHome:"Примерить дома",tryAtHomeBody:"Через камеру телефона"},materialSelection:{flooring:"Выберите покрытие",rugs:"Выберите ковёр","wall-panel":"Выберите панель",title:"Выбор материала"},interiorSelection:{title:"Выберите интерьер",uploadPhoto:"Загрузить свое фото",invalidFile:"Не получилось загрузить фото, попробуйте еще раз",customTitle:"Ваши фото",presetsTitle:"Готовые интерьеры",currentInterior:"Текущий интерьер",chooseInterior:"Выбрать интерьер",chooseInteriorShort:"Выбрать"},processing:{title:"Готовим вашу комнату",progressLabel:"Прогресс подготовки комнаты",stages:{reading:"Читаем ваше фото...",mapping:"Ищем пол и стены...",lighting:"Настраиваем свет и перспективу...",finalizing:"Собираем превью...",ready:"Комната готова..."}},error:{title:"Что-то пошло не так",processingBody:"В этот раз не получилось загрузить обработать фотографию",loadBody:"Не удалось загрузить просмотр. Попробуйте снова.",tryAgain:"Попробовать еще раз",cancel:"Отменить"}}}},ar:{translation:{matting:"الحافة الداخلية",close:"إغلاق",mattingOptions:{none:"بدون"},units:{cm:"سم",in:"بوصة"},ar:{viewInPlace:"اعرضه في مكانك",scanQrCode:"امسح رمز QR هذا بكاميرا هاتفك لعرض المنتج بتقنية الواقع المعزز",deviceRequirementsDisclaimer:"*يتطلب جهازًا ومتصفحًا يدعمان الواقع المعزز. نوصي بنظام iOS 18 أو أحدث مع Safari، أو Android 7.0 أو أحدث مع Chrome.",appClipScanTitle:"امسح الرمز بكاميرا هاتفك",appClipRequirement:"يعمل عرض الواقع المعزز على iOS 18 أو أحدث"},legal:{termsOfUse:"شروط الاستخدام",conjunction:" و",privacyPolicy:"سياسة الخصوصية"},shareMessage:{"wall-panel":"معاينة ألواح الجدران",wallart:"معاينة اللوحة الفنية",rugs:"معاينة السجادة",flooring:"معاينة الأرضية"},rooms:{"room-example-11":"غرفة نموذجية 11","room-example-12":"غرفة نموذجية 12","room-example-13":"غرفة نموذجية 13","room-example-14":"غرفة نموذجية 14","room-example-15":"غرفة نموذجية 15","carpet-bathroom":"الحمّام","carpet-bedroom":"غرفة النوم","carpet-entryway":"المدخل","carpet-living-room":"غرفة المعيشة"},scene:{tunePosition:"ضبط الموضع",angle:"الزاوية",rotation:"الدوران",resetPosition:"إعادة التعيين"},accessError:{unauthorized:"مفتاح API غير صالح","payment-required":"العارض غير متاح مؤقتًا"},loadError:{"viewer-load-failed":"تعذّر تحميل العارض. يُرجى المحاولة مرة أخرى.","artwork-load-failed":"تعذّر تحميل الصورة — رابطها مفقود أو غير صحيح في إعدادات الأداة.","room-load-failed":"تعذّر تحميل صورة الغرفة. يُرجى المحاولة مرة أخرى."},missingSurface:{floor:{title:"لم نتمكن من العثور على الأرضية",body:"جرّب صورة تظهر فيها الأرضية."},wall:{title:"لم نتمكن من العثور على جدار",body:"جرّب صورة يظهر فيها جدار."},uploadAnother:"رفع صورة أخرى"},wallPanel:{loading:"جارٍ تحميل الخامة",panelActions:"إجراءات اللوح {{number}}",retry:"تعذّر التحميل. اختر مرة أخرى لإعادة المحاولة.",actions:"إجراءات اللوح",materials:"الخامات",materialFallback:"الخامة {{number}}",rotate:"تدوير اللوح",delete:"حذف اللوح"},wallArt:{pictureFrame:"الإطار"},resourceType:{"wall-panel":{productCategory:"لوح جداري",productCardTitle:"اللوح المحدد",replaceProduct:"استبدال اللوح",replaceProductShort:"استبدال"},wallart:{productCardTitle:"اللوحة الفنية المحددة",appearance:"استبدال"},rugs:{productCategory:"سجادة",productCardTitle:"السجادة المحددة",replaceProduct:"استبدال السجادة",replaceProductShort:"استبدال"},flooring:{productCategory:"أرضية",productCardTitle:"الأرضية المحددة",replaceProduct:"استبدال الأرضية",replaceProductShort:"استبدال"}},floor:{scene:{share:"مشاركة",download:"تنزيل",hideCatalog:"إخفاء الكتالوج",description:"الوصف",select:"اختيار",interiorCardTitle:"التصميم الداخلي",tryAtHome:"جرّبه في منزلك",tryAtHomeBody:"عبر كاميرا هاتفك"},materialSelection:{flooring:"اختر الأرضية",rugs:"اختر سجادة","wall-panel":"اختر لوحًا",title:"اختيار الخامة"},interiorSelection:{title:"اختر التصميم الداخلي",uploadPhoto:"ارفع صورتك",invalidFile:"تعذّر رفع الصورة، يُرجى المحاولة مرة أخرى",customTitle:"صورك",presetsTitle:"تصاميم داخلية جاهزة",currentInterior:"التصميم الداخلي الحالي",chooseInterior:"اختر التصميم الداخلي",chooseInteriorShort:"اختر"},processing:{title:"جارٍ تجهيز غرفتك",progressLabel:"تقدّم تجهيز الغرفة",stages:{reading:"جارٍ قراءة صورتك...",mapping:"جارٍ تحديد الأرضيات والجدران...",lighting:"جارٍ موازنة الإضاءة والمنظور...",finalizing:"جارٍ إنشاء المعاينة...",ready:"الغرفة جاهزة..."}},error:{title:"حدث خطأ ما",processingBody:"لم نتمكن هذه المرة من رفع الصورة ومعالجتها",loadBody:"تعذّر تحميل العارض. يُرجى المحاولة مرة أخرى.",tryAgain:"حاول مرة أخرى",cancel:"إلغاء"}}}}},xE=Object.keys(xC),xS={debug:!1,detection:{caches:[]},fallbackLng:"en",resources:xC,interpolation:{escapeValue:!1}};function xM(e){let t=e.resolvedLanguage??e.language;return xE.find(e=>e===t)??"en"}function xI(){let{i18n:e}=aO();return xM(e)}ab.createInstance().use(of).use({type:"3rdParty",init(e){((e={})=>{aC={...aC,...e}})(e.options.react),t=e}}).init(xS);let xB=/initial-value:([^;}]+)/i,xk=/inherits:\s*false(?:\s*;|\s*$)/i,xT=(F=(er=xb("./src/style.css?inline").A).replace(/:root\s*,\s*:host|:root/g,":host"),(N=Array.from(er.matchAll(/@property\s+(--[^{\s]+)\s*\{([^}]*)\}/g)).map(([,e,t])=>{if(!xk.test(t))return null;let r=t.match(xB)?.[1].trim()??"initial";return` ${e}: ${r};`}).filter(e=>null!==e).join("\n"))?`${F}
|
|
7239
|
+
`,""]);let s=o.toString()},"../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@rsbuild/core/compiled/css-loader/api.js"(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r}).join("")},t.i=function(e,r,n,i,a){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(n)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);n&&o[u[0]]||(void 0!==a&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),r&&(u[2]&&(u[1]="@media ".concat(u[2]," {").concat(u[1],"}")),u[2]=r),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},"../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@rsbuild/core/compiled/css-loader/noSourceMaps.js"(e){e.exports=function(e){return e[1]}}},xv={};function xb(e){var t=xv[e];if(void 0!==t)return t.exports;var r=xv[e]={id:e,exports:{}};return xm[e](r,r.exports,xb),r.exports}xb.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return xb.d(t,{a:t}),t},xb.d=(e,t)=>{for(var r in t)xb.o(t,r)&&!xb.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},xb.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let xy=(0,ec.createContext)({theme:"system",setTheme:()=>null});function xw({children:e,defaultTheme:t="system",storageKey:r="v-theme",root:n=window.document.documentElement,enableStorage:i=!1,...a}){let[o,s]=(0,ec.useState)(()=>i&&localStorage.getItem(r)||t);return(0,ec.useEffect)(()=>{if(n.classList.remove("light","dark"),"system"===o){let e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";n.classList.add(e);return}n.classList.add(o)},[o,n]),(0,el.jsx)(xy,{...a,value:{theme:o,setTheme:e=>{i&&localStorage.setItem(r,e),s(e)}},children:e})}var xx=xb("../ui/src/styles/fonts.css?inline");let xC={en:{translation:{matting:"Matting",close:"Close",mattingOptions:{none:"None"},units:{cm:"cm",in:"in"},ar:{viewInPlace:"View in place",scanQrCode:"Scan this QR code with your phone's camera to view the object in Augmented Reality",deviceRequirementsDisclaimer:"*Requires AR-supported device and browser. We recommend iOS 18 or later with Safari, or Android 7.0 or later with Chrome.",appClipScanTitle:"Scan with your phone camera",appClipRequirement:"AR view works on iOS 18 or later"},legal:{termsOfUse:"Terms of Use",conjunction:" and ",privacyPolicy:"Privacy Policy"},shareMessage:{"wall-panel":"Preview wall panels",wallart:"Preview wall art",rugs:"Preview rug",flooring:"Preview flooring"},rooms:{"room-example-11":"Room Example 11","room-example-12":"Room Example 12","room-example-13":"Room Example 13","room-example-14":"Room Example 14","room-example-15":"Room Example 15","carpet-bathroom":"Bathroom","carpet-bedroom":"Bedroom","carpet-entryway":"Entryway","carpet-living-room":"Living Room"},scene:{tunePosition:"Tune position",angle:"Angle",rotation:"Rotation",resetPosition:"Reset"},accessError:{unauthorized:"Invalid API key","payment-required":"Viewer temporarily unavailable"},loadError:{"viewer-load-failed":"We could not load the viewer. Please try again.","artwork-load-failed":"The image could not be loaded — its link is missing or incorrect in the widget settings.","room-load-failed":"The room photo could not be loaded. Please try again."},missingSurface:{floor:{title:"We couldn't find the floor",body:"Try a photo that shows the floor."},wall:{title:"We couldn't find a wall",body:"Try a photo that shows a wall."},uploadAnother:"Upload another photo"},wallPanel:{loading:"Loading material",panelActions:"Panel {{number}} actions",retry:"Could not load. Select again to retry.",actions:"Panel actions",materials:"Materials",materialFallback:"Material {{number}}",rotate:"Rotate panel",delete:"Delete panel"},wallArt:{pictureFrame:"Frame"},resourceType:{"wall-panel":{productCategory:"Wall panel",productCardTitle:"Selected panel",replaceProduct:"Replace panel",replaceProductShort:"Replace"},wallart:{productCardTitle:"Selected wall art",appearance:"Replace"},rugs:{productCategory:"Rug",productCardTitle:"Selected rug",replaceProduct:"Replace rug",replaceProductShort:"Replace"},flooring:{productCategory:"Flooring",productCardTitle:"Selected flooring",replaceProduct:"Replace flooring",replaceProductShort:"Replace"}},floor:{scene:{share:"Share",download:"Download",hideCatalog:"Hide catalog",description:"Description",interiorCardTitle:"Interior",tryAtHome:"Try at home",tryAtHomeBody:"Through your phone camera"},materialSelection:{flooring:"Choose flooring",rugs:"Choose a rug","wall-panel":"Choose a panel",title:"Material Selection"},interiorSelection:{title:"Choose interior",uploadPhoto:"Upload your photo",invalidFile:"Could not upload photo, please try again",customTitle:"Your photos",presetsTitle:"Preset interiors",currentInterior:"Current interior",chooseInterior:"Choose interior",chooseInteriorShort:"Choose"},processing:{title:"Preparing your room",progressLabel:"Room preparation progress",stages:{reading:"Reading your photo...",mapping:"Finding floors and walls...",lighting:"Balancing light and perspective...",finalizing:"Building your preview...",ready:"Room is ready..."}},error:{title:"Something went wrong",processingBody:"This time we could not upload and process the photo",loadBody:"We could not load the viewer. Please try again.",tryAgain:"Try again",cancel:"Cancel"}}}},ru:{translation:{matting:"Паспарту",close:"Закрыть",mattingOptions:{none:"Нет"},units:{cm:"см",in:"in"},ar:{viewInPlace:"Примерить в комнате",scanQrCode:"Отсканируйте этот QR-код камерой телефона, чтобы просмотреть объект в дополненной реальности",deviceRequirementsDisclaimer:"*Требуется устройство и браузер с поддержкой AR. Рекомендуем iOS 18 или новее с Safari либо Android 7.0 или новее с Chrome.",appClipScanTitle:"Наведите камеру телефона",appClipRequirement:"AR-просмотр работает на iOS 18 и новее"},legal:{termsOfUse:"Условия использования",conjunction:" и ",privacyPolicy:"Политика конфиденциальности"},shareMessage:{"wall-panel":"Примерить стеновые панели",wallart:"Примерить настенный декор",rugs:"Примерить ковер",flooring:"Примерить напольное покрытие"},rooms:{"room-example-11":"Пример комнаты 11","room-example-12":"Пример комнаты 12","room-example-13":"Пример комнаты 13","room-example-14":"Пример комнаты 14","room-example-15":"Пример комнаты 15","carpet-bathroom":"Ванная","carpet-bedroom":"Спальня","carpet-entryway":"Прихожая","carpet-living-room":"Гостиная"},scene:{tunePosition:"Настроить положение",angle:"Угол",rotation:"Поворот",resetPosition:"Сбросить"},accessError:{unauthorized:"Неверный API-ключ","payment-required":"Просмотр временно недоступен"},loadError:{"viewer-load-failed":"Не удалось загрузить просмотр. Попробуйте ещё раз.","artwork-load-failed":"Не удалось загрузить изображение — ссылка на него отсутствует или указана неверно в настройках виджета.","room-load-failed":"Не удалось загрузить фото комнаты. Попробуйте ещё раз."},missingSurface:{floor:{title:"Не получилось найти пол",body:"Попробуйте фото, на котором виден пол."},wall:{title:"Не получилось найти стену",body:"Попробуйте фото, на котором видна стена."},uploadAnother:"Загрузить другое фото"},wallPanel:{loading:"Загрузка материала",panelActions:"Действия с панелью {{number}}",retry:"Не удалось загрузить. Нажмите ещё раз.",actions:"Действия с панелью",materials:"Материалы",materialFallback:"Материал {{number}}",rotate:"Повернуть панель",delete:"Удалить панель"},wallArt:{pictureFrame:"Рамка"},resourceType:{"wall-panel":{productCategory:"Стеновая панель",productCardTitle:"Выбранная панель",replaceProduct:"Заменить панель",replaceProductShort:"Заменить"},wallart:{productCardTitle:"Выбранный настенный декор",appearance:"Заменить"},rugs:{productCategory:"Ковер",productCardTitle:"Выбранный ковер",replaceProduct:"Заменить ковер",replaceProductShort:"Заменить"},flooring:{productCategory:"Напольное покрытие",productCardTitle:"Выбранное напольное покрытие",replaceProduct:"Заменить",replaceProductShort:"Заменить"}},floor:{scene:{share:"Поделиться",download:"Скачать",hideCatalog:"Скрыть каталог",description:"Описание",interiorCardTitle:"Интерьер",tryAtHome:"Примерить дома",tryAtHomeBody:"Через камеру телефона"},materialSelection:{flooring:"Выберите покрытие",rugs:"Выберите ковёр","wall-panel":"Выберите панель",title:"Выбор материала"},interiorSelection:{title:"Выберите интерьер",uploadPhoto:"Загрузить свое фото",invalidFile:"Не получилось загрузить фото, попробуйте еще раз",customTitle:"Ваши фото",presetsTitle:"Готовые интерьеры",currentInterior:"Текущий интерьер",chooseInterior:"Выбрать интерьер",chooseInteriorShort:"Выбрать"},processing:{title:"Готовим вашу комнату",progressLabel:"Прогресс подготовки комнаты",stages:{reading:"Читаем ваше фото...",mapping:"Ищем пол и стены...",lighting:"Настраиваем свет и перспективу...",finalizing:"Собираем превью...",ready:"Комната готова..."}},error:{title:"Что-то пошло не так",processingBody:"В этот раз не получилось загрузить обработать фотографию",loadBody:"Не удалось загрузить просмотр. Попробуйте снова.",tryAgain:"Попробовать еще раз",cancel:"Отменить"}}}},ar:{translation:{matting:"الحافة الداخلية",close:"إغلاق",mattingOptions:{none:"بدون"},units:{cm:"سم",in:"بوصة"},ar:{viewInPlace:"اعرضه في مكانك",scanQrCode:"امسح رمز QR هذا بكاميرا هاتفك لعرض المنتج بتقنية الواقع المعزز",deviceRequirementsDisclaimer:"*يتطلب جهازًا ومتصفحًا يدعمان الواقع المعزز. نوصي بنظام iOS 18 أو أحدث مع Safari، أو Android 7.0 أو أحدث مع Chrome.",appClipScanTitle:"امسح الرمز بكاميرا هاتفك",appClipRequirement:"يعمل عرض الواقع المعزز على iOS 18 أو أحدث"},legal:{termsOfUse:"شروط الاستخدام",conjunction:" و",privacyPolicy:"سياسة الخصوصية"},shareMessage:{"wall-panel":"معاينة ألواح الجدران",wallart:"معاينة اللوحة الفنية",rugs:"معاينة السجادة",flooring:"معاينة الأرضية"},rooms:{"room-example-11":"غرفة نموذجية 11","room-example-12":"غرفة نموذجية 12","room-example-13":"غرفة نموذجية 13","room-example-14":"غرفة نموذجية 14","room-example-15":"غرفة نموذجية 15","carpet-bathroom":"الحمّام","carpet-bedroom":"غرفة النوم","carpet-entryway":"المدخل","carpet-living-room":"غرفة المعيشة"},scene:{tunePosition:"ضبط الموضع",angle:"الزاوية",rotation:"الدوران",resetPosition:"إعادة التعيين"},accessError:{unauthorized:"مفتاح API غير صالح","payment-required":"العارض غير متاح مؤقتًا"},loadError:{"viewer-load-failed":"تعذّر تحميل العارض. يُرجى المحاولة مرة أخرى.","artwork-load-failed":"تعذّر تحميل الصورة — رابطها مفقود أو غير صحيح في إعدادات الأداة.","room-load-failed":"تعذّر تحميل صورة الغرفة. يُرجى المحاولة مرة أخرى."},missingSurface:{floor:{title:"لم نتمكن من العثور على الأرضية",body:"جرّب صورة تظهر فيها الأرضية."},wall:{title:"لم نتمكن من العثور على جدار",body:"جرّب صورة يظهر فيها جدار."},uploadAnother:"رفع صورة أخرى"},wallPanel:{loading:"جارٍ تحميل الخامة",panelActions:"إجراءات اللوح {{number}}",retry:"تعذّر التحميل. اختر مرة أخرى لإعادة المحاولة.",actions:"إجراءات اللوح",materials:"الخامات",materialFallback:"الخامة {{number}}",rotate:"تدوير اللوح",delete:"حذف اللوح"},wallArt:{pictureFrame:"الإطار"},resourceType:{"wall-panel":{productCategory:"لوح جداري",productCardTitle:"اللوح المحدد",replaceProduct:"استبدال اللوح",replaceProductShort:"استبدال"},wallart:{productCardTitle:"اللوحة الفنية المحددة",appearance:"استبدال"},rugs:{productCategory:"سجادة",productCardTitle:"السجادة المحددة",replaceProduct:"استبدال السجادة",replaceProductShort:"استبدال"},flooring:{productCategory:"أرضية",productCardTitle:"الأرضية المحددة",replaceProduct:"استبدال الأرضية",replaceProductShort:"استبدال"}},floor:{scene:{share:"مشاركة",download:"تنزيل",hideCatalog:"إخفاء الكتالوج",description:"الوصف",interiorCardTitle:"التصميم الداخلي",tryAtHome:"جرّبه في منزلك",tryAtHomeBody:"عبر كاميرا هاتفك"},materialSelection:{flooring:"اختر الأرضية",rugs:"اختر سجادة","wall-panel":"اختر لوحًا",title:"اختيار الخامة"},interiorSelection:{title:"اختر التصميم الداخلي",uploadPhoto:"ارفع صورتك",invalidFile:"تعذّر رفع الصورة، يُرجى المحاولة مرة أخرى",customTitle:"صورك",presetsTitle:"تصاميم داخلية جاهزة",currentInterior:"التصميم الداخلي الحالي",chooseInterior:"اختر التصميم الداخلي",chooseInteriorShort:"اختر"},processing:{title:"جارٍ تجهيز غرفتك",progressLabel:"تقدّم تجهيز الغرفة",stages:{reading:"جارٍ قراءة صورتك...",mapping:"جارٍ تحديد الأرضيات والجدران...",lighting:"جارٍ موازنة الإضاءة والمنظور...",finalizing:"جارٍ إنشاء المعاينة...",ready:"الغرفة جاهزة..."}},error:{title:"حدث خطأ ما",processingBody:"لم نتمكن هذه المرة من رفع الصورة ومعالجتها",loadBody:"تعذّر تحميل العارض. يُرجى المحاولة مرة أخرى.",tryAgain:"حاول مرة أخرى",cancel:"إلغاء"}}}}},xE=Object.keys(xC),xS={debug:!1,detection:{caches:[]},fallbackLng:"en",resources:xC,interpolation:{escapeValue:!1}};function xM(e){let t=e.resolvedLanguage??e.language;return xE.find(e=>e===t)??"en"}function xI(){let{i18n:e}=aO();return xM(e)}ab.createInstance().use(of).use({type:"3rdParty",init(e){((e={})=>{aC={...aC,...e}})(e.options.react),t=e}}).init(xS);let xB=/initial-value:([^;}]+)/i,xk=/inherits:\s*false(?:\s*;|\s*$)/i,xT=(F=(er=xb("./src/style.css?inline").A).replace(/:root\s*,\s*:host|:root/g,":host"),(N=Array.from(er.matchAll(/@property\s+(--[^{\s]+)\s*\{([^}]*)\}/g)).map(([,e,t])=>{if(!xk.test(t))return null;let r=t.match(xB)?.[1].trim()??"initial";return` ${e}: ${r};`}).filter(e=>null!==e).join("\n"))?`${F}
|
|
7240
7240
|
|
|
7241
7241
|
@layer base {
|
|
7242
7242
|
:host,
|
|
@@ -7286,5 +7286,5 @@ ${N}
|
|
|
7286
7286
|
}
|
|
7287
7287
|
if (coverage < 0.01) discard;
|
|
7288
7288
|
diffuseColor = vec4(1.0, 1.0, 1.0, coverage);
|
|
7289
|
-
`)},s.customProgramCacheKey=()=>"wall-panel-exterior-outline-v1",{mask:t,maskMaterial:r,maskModel:n,maskScene:i,material:s,resolution:a,radius:o,clearColor:new cb.Q1f}},[e]);return(0,ec.useLayoutEffect)(()=>Sv(r.material,t,{shading:!1}),[r,t]),(0,ec.useLayoutEffect)(()=>()=>{r.mask.dispose(),r.maskMaterial.dispose(),r.material.dispose()},[r]),(0,el.jsx)("mesh",{material:r.material,frustumCulled:!1,renderOrder:3,raycast:()=>{},onBeforeRender:(t,n,i)=>{let a=t.getRenderTarget(),o=t.getActiveCubeFace(),s=t.getActiveMipmapLevel(),l=t.autoClear,c=t.getClearAlpha();t.getClearColor(r.clearColor),t.getDrawingBufferSize(r.resolution);let{x:u,y:d}=r.resolution;(r.mask.width!==u||r.mask.height!==d)&&r.mask.setSize(u,d),r.radius.value=2*t.getPixelRatio(),e.updateWorldMatrix(!0,!0),r.maskModel.matrix.copy(e.matrixWorld);try{t.autoClear=!0,t.setClearColor(0,0),t.setRenderTarget(r.mask),t.render(r.maskScene,i)}finally{t.setRenderTarget(a,o,s),t.setClearColor(r.clearColor,c),t.autoClear=l}},children:(0,el.jsx)("planeGeometry",{args:[2,2]})})}function SD({source:e,patch:t,isPointVisible:r,outlined:n}){let{model:i,materials:a}=(0,ec.useMemo)(()=>{let t=e.clone(!0),r=Sb(t);return{model:t,materials:r}},[e]);return(0,ec.useLayoutEffect)(()=>{let e=a.map(e=>Sv(e,t));return i.traverse(e=>{e instanceof cb.eaF&&(e.raycast=function(e,t){let n=[];cb.eaF.prototype.raycast.call(this,e,n),t.push(...n.filter(e=>!r||r(e.point)))})}),()=>e.forEach(e=>e())},[r,a,i,t]),(0,ec.useLayoutEffect)(()=>()=>a.forEach(e=>e.dispose()),[a]),(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)("primitive",{object:i,dispose:null}),n&&(0,el.jsx)(SP,{model:i,patch:t})]})}function S_({size:e,patch:t,isPointVisible:r,onClick:n}){let[i,a]=(0,ec.useState)(!1),o=(0,ec.useMemo)(()=>{let e=document.createElement("canvas");e.width=e.height=256;let t=e.getContext("2d");if(t.lineJoin="miter",t.lineCap="round",t.beginPath(),i)t.rect(16,16,224,224);else for(let[e,r,n,i]of[[16,16,1,1],[240,16,-1,1],[16,240,1,-1],[240,240,-1,-1]])t.moveTo(e+22*n,r),t.lineTo(e,r),t.lineTo(e,r+22*i);t.strokeStyle="rgba(255,255,255,.80)",t.lineWidth=5,t.stroke(),t.strokeStyle=i?"#59636d":"rgba(70,80,90,.60)",t.lineWidth=2,t.stroke(),t.beginPath(),t.arc(128,128,29,0,2*Math.PI),t.fillStyle=i?"#ffffff":"#f5f6f7",t.fill(),t.strokeStyle="rgba(35,45,55,.32)",t.lineWidth=2,t.stroke(),t.beginPath(),t.moveTo(117,128),t.lineTo(139,128),t.moveTo(128,117),t.lineTo(128,139),t.strokeStyle="#35414d",t.lineWidth=3,t.stroke();let r=new cb.GOR(e);return r.colorSpace="srgb",r},[i]),s=(0,ec.useMemo)(()=>new cb.V9B({map:o,transparent:!0,depthWrite:!1,toneMapped:!1}),[o]);return(0,ec.useLayoutEffect)(()=>{let e=Sv(s,t,{shading:!1});return s.alphaToCoverage=!1,e},[s,t]),(0,ec.useLayoutEffect)(()=>()=>{s.dispose(),o.dispose()},[s,o]),(0,el.jsx)("mesh",{material:s,renderOrder:2,onPointerOver:()=>a(!0),onPointerOut:()=>a(!1),raycast:function(e,t){let n=[];cb.eaF.prototype.raycast.call(this,e,n),t.push(...n.filter(e=>!r||r(e.point)))},onPointerDown:e=>{e.stopPropagation(),e.nativeEvent.stopPropagation()},onClick:e=>{e.stopPropagation(),n()},children:(0,el.jsx)("planeGeometry",{args:[e,e]})})}function SL({isPointVisible:e,visible:t,dragging:r,panelKey:n,number:i,size:a,depth:o,patch:s}){let l=Ex(),{t:c}=aO(),{camera:u,gl:d}=fd(),h=(0,ec.useRef)(null),p=(0,ec.useRef)(null),A=(0,ec.useMemo)(()=>new cb.Pq0,[]),f=(0,ec.useMemo)(()=>{let e=document.createElement("canvas");e.width=e.height=128;let t=e.getContext("2d");for(let e of(t.beginPath(),t.arc(64,64,61,0,2*Math.PI),t.fillStyle="#f5f6f7",t.fill(),t.strokeStyle="rgba(35,45,55,.32)",t.lineWidth=2,t.stroke(),t.fillStyle="#35414d",[40,64,88]))t.beginPath(),t.arc(e,64,5,0,2*Math.PI),t.fill();let r=new cb.GOR(e);return r.colorSpace="srgb",r},[]),g=(0,ec.useMemo)(()=>new cb.V9B({map:f,transparent:!0,depthWrite:!1,toneMapped:!1}),[f]);(0,ec.useLayoutEffect)(()=>{let e=Sv(g,s,{shading:!1});return g.alphaToCoverage=!1,e},[g,s]),(0,ec.useLayoutEffect)(()=>()=>{g.dispose(),f.dispose()},[g,f]),fh(()=>{h.current&&p.current&&(h.current.getWorldPosition(A),p.current.tabIndex=!r&&(!e||e(A))?0:-1)});let m=()=>{if(!h.current)return;A.set(.05,-.05,0),h.current.localToWorld(A).project(u);let e=d.domElement.getBoundingClientRect();l.openMenu(n,{x:e.left+(A.x+1)*e.width/2,y:e.top+(1-A.y)*e.height/2})};return(0,el.jsxs)("group",{ref:h,position:[a/2-a/12-.05,-a/2+a/20+.05,o+.002],children:[(0,el.jsx)("mesh",{name:"panel-actions",material:g,visible:t&&!r,renderOrder:3,raycast:function(n,i){if(!t||r)return;let a=[];cb.eaF.prototype.raycast.call(this,n,a),i.push(...a.filter(t=>t.uv&&.48>=Math.hypot(t.uv.x-.5,t.uv.y-.5)&&(!e||e(t.point))))},onPointerDown:e=>{e.stopPropagation(),e.nativeEvent.stopPropagation()},onPointerUp:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),m()},children:(0,el.jsx)("planeGeometry",{args:[.1,.1]})}),(0,el.jsx)(mc,{style:{pointerEvents:"none"},children:(0,el.jsx)("button",{ref:p,type:"button","data-panel-key":n,className:"sr-only","aria-label":c("wallPanel.panelActions",{number:i}),"aria-haspopup":"menu",onFocus:()=>l.select(n),onClick:e=>{e.stopPropagation(),m()}})})]})}function SF({glbUrl:e,position:t,quaternion:r,materialPatch:n,isPointVisible:i,onDragStart:a,onDrag:o,onDragEnd:s}){let{data:l}=o0({...Em(e),enabled:!0,suspense:!0,throwOnError:oJ,placeholderData:void 0},sa,void 0),c=Ex(),{room:u}=Ea(),[d,h]=(0,ec.useState)(null),{resourceRef:p,sceneGestures:{setIsDragging:A}}=El(),f=Ec("isDragging"),{gl:g}=fd(),m=f?"grabbing":d?.action?"pointer":d?"grab":"auto";(0,ec.useLayoutEffect)(()=>{let e=g.domElement.style.cursor;return g.domElement.style.cursor=m,()=>{g.domElement.style.cursor=e}},[g,m]);let v=(e,t)=>h(r=>r?.key===e&&r.action===t?r:{key:e,action:t}),b=(0,ec.useRef)(null),y=l.width,w=`${u.id}:${c.generation}`,[x,C]=(0,ec.useState)({size:y,roomKey:w,x:0,y:0});if(x.roomKey!==w)C({size:y,roomKey:w,x:0,y:0});else if(x.size!==y){let e=c.panels.reduce((e,t)=>({minX:Math.min(e.minX,t.x),maxX:Math.max(e.maxX,t.x),minY:Math.min(e.minY,t.y),maxY:Math.max(e.maxY,t.y)}),{minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0}),t=x.size-y;C({size:y,roomKey:w,x:x.x+(e.minX+e.maxX)/2*t,y:x.y+(e.minY+e.maxY)/2*t})}(0,ec.useLayoutEffect)(()=>()=>A(!1),[A]);let E=(e,t=!1)=>{let r=b.current;r&&r.pointerId===e.pointerId&&(e.stopPropagation(),b.current=null,e.target.releasePointerCapture(e.pointerId),A(!1),s(),t||r.moved||(c.select(r.key),c.closeMenu()))};return(0,el.jsx)("group",{ref:p,position:t,quaternion:r,onPointerMissed:c.clearSelection,children:(0,el.jsxs)("group",{position:[x.x,x.y,0],children:[c.panels.map((e,t)=>{let r=c.options.find(t=>t.material.hid===e.materialId)?.model??l;return(0,el.jsxs)("group",{position:[e.x*y,e.y*y,0],onPointerOver:t=>{t.stopPropagation(),v(Ev(e),"panel-actions"===t.object.name)},onPointerOut:()=>h(null),onPointerDown:t=>{0===t.button&&!b.current&&(t.stopPropagation(),t.nativeEvent.stopPropagation(),b.current={x:t.clientX,y:t.clientY,key:Ev(e),moved:!1,pointerId:t.pointerId},t.target.setPointerCapture(t.pointerId),A(!0),a())},onPointerMove:t=>{v(Ev(e),"panel-actions"===t.object.name);let r=b.current;r&&r.pointerId===t.pointerId&&(t.stopPropagation(),!r.moved&&Math.hypot(t.clientX-r.x,t.clientY-r.y)>4&&(r.moved=!0,c.select(r.key),c.closeMenu()),r.moved&&o())},onPointerUp:e=>E(e),onPointerCancel:e=>E(e,!0),children:[(0,el.jsx)(SL,{panelKey:Ev(e),number:t+1,size:y,depth:r.depth,patch:n,isPointVisible:i,dragging:f,visible:c.selected===Ev(e)||d?.key===Ev(e)}),(0,el.jsx)("group",{"rotation-z":-e.turns*Math.PI/2,children:(0,el.jsx)("group",{position:r.mountingOffset,children:(0,el.jsx)(SD,{outlined:c.selected===Ev(e)||d?.key===Ev(e),source:r.scene,patch:n,isPointVisible:i})})})]},Ev(e))}),c.selected&&c.neighbors.map(e=>(0,el.jsx)("group",{position:[e.x*y,e.y*y,.002],children:(0,el.jsx)(S_,{size:y,patch:n,isPointVisible:i,onClick:()=>c.add(e)})},Ev(e)))]})})}function SN(e){let{glbUrl:t}=Eo();return t?(0,el.jsx)(SF,{...e,glbUrl:t}):null}let SO={"modelled-resource":function({position:e,quaternion:t,materialPatch:r,onDrag:n,onDragEnd:i,onDragStart:a}){let{type:o}=En(),{glbUrl:s}=Eo();return s?"rotate-on-floor"===CW[o].manipulation?(0,el.jsx)(SS,{glbUrl:s,position:e,quaternion:t,materialPatch:r}):(0,el.jsx)(g5,{autoTransform:!1,onDrag:n,onDragEnd:i,onDragStart:a,children:(0,el.jsx)(SS,{glbUrl:s,position:e,quaternion:t,materialPatch:r})}):null},"textured-resource":function({position:e,quaternion:t,materialPatch:r,onDrag:n,onDragEnd:i,onDragStart:a}){let{src:o,setLoadError:s}=Eo();return o?(0,el.jsx)(EZ,{onError:()=>s("artwork-load-failed"),children:(0,el.jsx)(g5,{autoTransform:!1,onDrag:n,onDragEnd:i,onDragStart:a,children:(0,el.jsx)(SR,{src:o,position:e,quaternion:t,materialPatch:r})})}):null}};function SQ(e){e.setCrossOrigin("anonymous")}let SU=E9(3,(e,t)=>{ff.clear(cb.Tap,e),t.dispose()}),Sz=E4(SU,e=>ff.clear(cb.Tap,e));function SG(){var e;let t,{room:r}=Ea(),n=fd(e=>e.scene),i=(e=CJ(r),Sz.request(e),t=ff(cb.Tap,e,SQ),(0,ec.useLayoutEffect)(()=>(Sz.clearPassed(e),SU.hold(e,t),()=>SU.release(t)),[e,t]),t);return(0,ec.useLayoutEffect)(()=>(i.colorSpace="srgb",n.background=i,()=>{n.background===i&&(n.background=null)}),[n,i]),null}function SH({plane:e,geometry:t,setPlaneRef:r}){let n={planeId:e.id,kind:e.kind};return(0,el.jsx)("mesh",{ref:t=>r(e,t),geometry:t,userData:n,children:(0,el.jsx)("meshBasicMaterial",{visible:!1,side:2})})}let Sj=(0,ec.memo)(()=>{let e,{type:t}=En(),r=Ex(),{setLoadError:n}=Eo(),i="panel-group"===(e=CW[t]).manipulation?SN:SO[e.identity],{room:a}=Ea(),{patchSceneLoad:o,resourceRef:s}=El(),{gl:l,size:c,camera:u,invalidate:d,raycaster:h,pointer:p}=fd(),A=(0,ec.useMemo)(()=>a.scene??EN(),[a.scene]),f=CK(t),g=function(e){let[t,r]=(0,ec.useState)(null);return(0,ec.useEffect)(()=>{let t=new AbortController,n=null;return Se.acquire(e,{neutralShadingPng:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGNoaGgAAAMEAYFL09IQAAAAAElFTkSuQmCC",signal:t.signal}).then(i=>{t.signal.aborted?Se.release(i):(n=i,r({request:e,state:{preparation:i,failed:!1}}))},n=>{t.signal.aborted||(console.error(n),r({request:e,state:{preparation:null,failed:!0}}))}),()=>{t.abort(),n&&Se.release(n)}},[e]),t?.request===e?t.state:E7}((0,ec.useMemo)(()=>({roomId:a.id,scene:A,surfaces:f}),[a.id,A,f])),m=function({camera:e,invalidate:t,pointer:r,roomPreparation:{preparation:n,failed:i},raycaster:a,resourceRef:o,roomId:s,scene:l,surfaces:c}){let u=`${s}:${[...c].sort().join(",")}`,d=(0,ec.useMemo)(()=>({value:null}),[]),[h,p]=(0,ec.useReducer)(Sp,u,Sh),A=(0,ec.useRef)(null),f=(0,ec.useRef)(null),g=(0,ec.useRef)(!1),m=(0,ec.useRef)(new Map),v=(0,ec.useRef)(null),b=h.placementKey===u,y=n?.planeIdMap??null,w=n?.masks??Sd,x=b?h.resourcePose:null,C=(0,ec.useMemo)(()=>Sl(l,c),[l,c]),E=(0,ec.useMemo)(()=>C.map(e=>e.id),[C]),S=(0,ec.useMemo)(()=>new Map(l.planes.map(e=>{let t,r;return[e.id,(t=e.polygon3D.flatMap(e=>(function(e,t){let[r,n,i]=e;return[r*(EV(t)*(t.camera.fx/t.camera.fy)),i,-n]})(e,l)),(r=new cb.LoY).setAttribute("position",new cb.qtW(t,3)),e.polygon3D.length>=4&&r.setIndex([0,1,2,0,2,3]),r)]})),[l]);(0,ec.useEffect)(()=>()=>S.forEach(e=>e.dispose()),[S]);let M=(0,ec.useMemo)(()=>({artifactsReady:null!==y,placementReady:null!==x,prepareReady:null!==x}),[y,x]),I=0===C.length?"no-allowed-surface":i?"plane-id-map-decode":null,B=(0,ec.useCallback)((e,t)=>{t?m.current.set(e.id,t):m.current.delete(e.id)},[]);(0,ec.useEffect)(()=>()=>{d.value=null},[d,w]),(0,ec.useEffect)(()=>{p({type:"reset-placement",placementKey:u}),A.current=null,f.current=null,g.current=!1,d.value=null,v.current=null},[d,u]);let k=(0,ec.useCallback)((r,n,i=null)=>{let a,s=Sa(r,n,e),l=i?(a=new cb.Pq0(...i).applyQuaternion(new cb.PTz(...s.quaternion)).add(new cb.Pq0(...s.position)),{...s,position:a.toArray()}):s;A.current=l.activePlaneId,f.current=l,g.current=!0,d.value=w.get(l.activePlaneId)?.texture??null,o.current?.position.fromArray(l.position),o.current?.quaternion.fromArray(l.quaternion),t()},[d,e,t,w,o]),T=(0,ec.useCallback)(t=>y?function({activePlaneId:e,allowedPlaneIds:t,camera:r,planeIdMap:n,planeMap:i,pointer:a,raycaster:o}){let s=new Set(t),l=[],c=new Set,u=e=>{!(null===e||c.has(e))&&s.has(e)&&(c.add(e),l.push(e))};for(let s of(u(Eq(a,n)),u(e),t.forEach(u),o.setFromCamera(a,r),l)){let e=i.get(s),t=e?o.intersectObject(e,!1)[0]:null;if(t)return t}return null}({activePlaneId:A.current,allowedPlaneIds:E,camera:e,planeIdMap:y,planeMap:m.current,pointer:t,raycaster:a}):null,[E,e,y,a]);(0,ec.useEffect)(()=>{if(!y||null!==x)return;let r=function({allowedPlanes:e,camera:t,planeMap:r}){let n=e[0],i=n?r.get(n.id):null;return i?Sa(i,function(e){let t=e.geometry.attributes.position,r=new cb.Pq0;for(let e=0;e<t.count;e++)r.add(new cb.Pq0(t.getX(e),t.getY(e),t.getZ(e)));return r.divideScalar(Math.max(1,t.count))}(i),t):null}({allowedPlanes:C,camera:e,planeMap:m.current});r&&(A.current=r.activePlaneId,f.current=r,d.value=w.get(r.activePlaneId)?.texture??null,p({type:"set-resource-pose",placementKey:u,resourcePose:r}),t())},[d,C,e,t,w,u,y,x]);let R=(0,ec.useCallback)(()=>{let t,n=T(r),i=f.current;if(!n||!i){v.current=null;return}let a=Sa(n.object,n.point,e);t=new cb.PTz(...a.quaternion).invert(),v.current=new cb.Pq0(...i.position).sub(new cb.Pq0(...a.position)).applyQuaternion(t).toArray()},[e,T,r]),P=(0,ec.useCallback)(()=>{let e=T(r);e&&k(e.object,e.point,v.current)},[T,r,k]),D=(0,ec.useCallback)(()=>{v.current=null,g.current&&f.current&&(g.current=!1,p({type:"set-resource-pose",placementKey:u,resourcePose:f.current}))},[u]),_=(0,ec.useCallback)(t=>{let r,n=A.current,i=null===n?null:w.get(n);if(!i)return!1;let a=t.clone().project(e),o=function(e,t,r){if(t<0||t>1||r<0||r>1)return 0;let n=t*e.width-.5,i=r*e.height-.5,a=Math.floor(n),o=Math.floor(i),s=E3(a,e.width-1),l=E3(o,e.height-1),c=E3(a+1,e.width-1),u=E3(o+1,e.height-1),d=n-Math.floor(n),h=i-Math.floor(i);return((e.data[l*e.width+s]*(1-d)+e.data[l*e.width+c]*d)*(1-h)+(e.data[u*e.width+s]*(1-d)+e.data[u*e.width+c]*d)*h)/255}(i,(a.x+1)*.5,(1-a.y)*.5);return(r=E3((o-.4)/.29999999999999993,1))*r*(3-2*r)>.001},[e,w]);return{isPointerOnSurface:(0,ec.useCallback)(e=>{let t=y?Eq(e,y):null;return null!==t&&E.includes(t)},[E,y]),activeMaskTextureUniform:d,isPointVisible:_,failure:I,handleDrag:P,handleDragEnd:D,handleDragStart:R,planeGeometries:S,readiness:M,resourcePose:x,setPlaneRef:B}}({camera:u,invalidate:d,pointer:p,roomPreparation:g,raycaster:h,resourceRef:s,roomId:`${a.id}:${r?.generation??0}`,scene:A,surfaces:f});!function(e,t,r){let{gl:n}=fd(),{sceneGestures:{setRotation:i,setIsDragging:a}}=El();(0,ec.useEffect)(()=>{if(!e)return;let r=n.domElement,o=null,s=e=>{e.preventDefault(),e.stopImmediatePropagation()},l=()=>{let e=o;o=null,e&&r.hasPointerCapture(e.id)&&r.releasePointerCapture(e.id),e&&a(!1)},c=e=>{if(o)return void s(e);if(!e.isPrimary||0!==e.button)return;let n=r.getBoundingClientRect();t(new cb.I9Y((e.clientX-n.left)/n.width*2-1,1-(e.clientY-n.top)/n.height*2))&&(s(e),o={id:e.pointerId,startX:e.clientX,lastX:e.clientX,rotating:!1},r.setPointerCapture(e.pointerId),a(!0))},u=e=>{if(!o||o.id!==e.pointerId||(s(e),!o.rotating&&5>Math.abs(e.clientX-o.startX)))return;o.rotating=!0;let t=e.clientX-o.lastX;o.lastX=e.clientX,i(e=>e+.5*t)},d=e=>{o?.id===e.pointerId&&(s(e),l())};return r.addEventListener("pointerdown",c,!0),r.addEventListener("pointermove",u,!0),r.addEventListener("pointerup",d,!0),r.addEventListener("pointercancel",d,!0),r.addEventListener("lostpointercapture",d,!0),window.addEventListener("blur",l),()=>{r.removeEventListener("pointerdown",c,!0),r.removeEventListener("pointermove",u,!0),r.removeEventListener("pointerup",d,!0),r.removeEventListener("pointercancel",d,!0),r.removeEventListener("lostpointercapture",d,!0),window.removeEventListener("blur",l),l()}},[e,n,t,r,a,i])}("rotate-on-floor"===CW[t].manipulation,m.isPointerOnSurface,a.id);let v=(0,ec.useMemo)(()=>new cb.I9Y(1,1),[]),b=g.preparation?.lightingTexture??null,y=(0,ec.useMemo)(()=>b&&{lightingTexture:b,viewport:v,activeMaskTextureUniform:m.activeMaskTextureUniform,maxRoomGain:1.1},[m.activeMaskTextureUniform,b,v]);(0,ec.useLayoutEffect)(()=>{u instanceof cb.ubm&&(u.fov=A.camera.fovYDeg),u.position.set(0,0,0),u.up.set(0,0,1),u.lookAt(0,1,0),u.updateProjectionMatrix(),d()},[u,d,A.camera.fovYDeg]),(0,ec.useLayoutEffect)(()=>{l.getDrawingBufferSize(v),v.set(Math.max(1,v.x),Math.max(1,v.y))},[l,c.height,c.width,v]);let{artifactsReady:w,placementReady:x,prepareReady:C}=m.readiness,E=m.failure;return(0,ec.useEffect)(()=>{o({artifactsReady:w,placementReady:x,prepareReady:C})},[w,o,x,C]),(0,ec.useEffect)(()=>{if(E){if("no-allowed-surface"===E){Su({planes:A.planes,source:"room-scene",surfaces:f}),n("room-missing-surface");return}!function({failure:e,planes:t,resourceType:r}){So(t)}({failure:E,planes:A.planes,resourceType:t}),n("room-load-failed")}},[E,A.planes,n,f,t]),(0,el.jsxs)(el.Fragment,{children:[m.resourcePose&&y&&(0,el.jsx)(i,{position:m.resourcePose.position,quaternion:m.resourcePose.quaternion,materialPatch:y,isPointVisible:m.isPointVisible,onDrag:m.handleDrag,onDragEnd:m.handleDragEnd,onDragStart:m.handleDragStart}),A.planes.map(e=>(0,el.jsx)(SH,{plane:e,geometry:m.planeGeometries.get(e.id),setPlaneRef:m.setPlaneRef},e.id)),(0,el.jsx)(EZ,{onError:()=>n("room-load-failed"),children:(0,el.jsx)(SG,{})})]})});Sj.displayName="Room";let SV=["room-viewer","layout-config"],Sq=[Math.PI/2,0,0];function SW({onReadyChange:e}){return(0,ec.useLayoutEffect)(()=>(e?.(!0),()=>e?.(!1)),[e]),null}function SK({onReadyChange:e}){var t;let r=o0({queryKey:SV,queryFn:()=>xK(),staleTime:1/0},sa,void 0);if(r.isPending)return null;let n=(t=r.data,t?.internal?.links?.find(e=>"hdr_neutral"===e.type)?.url?.trim()||void 0);return(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(m9,{files:n?[n]:void 0,preset:n?void 0:"warehouse",environmentRotation:Sq,environmentIntensity:n?.5:.9}),(0,el.jsx)(SW,{onReadyChange:e})]})}function SJ({onReadyChange:e}){return(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(m9,{files:["https://cdn.neurodyn.ai/assets/hdr/neutral.hdr"],environmentRotation:Sq}),(0,el.jsx)(SW,{onReadyChange:e})]})}let SY=(0,ec.memo)(({lighting:e,onReadyChange:t})=>"remote-neutral-hdr"===e?(0,el.jsx)(SK,{onReadyChange:t}):(0,el.jsx)(SJ,{onReadyChange:t}));SY.displayName="RoomEnvironment";let SX=(0,ec.memo)(({ref:e,target:t})=>{let{camera:r,gl:n}=fd();return(0,ec.useImperativeHandle)(e,()=>({getScreenPoint(){if(!t.current)return null;let e=t.current.getWorldPosition(new cb.Pq0).project(r),i=n.domElement.getBoundingClientRect();return{x:i.left+(e.x+1)*i.width/2,y:i.top+(1-e.y)*i.height/2}}}),[r,n,t]),null});function SZ(e,t){for(let r of Object.keys(t))if(t[r]!==e[r])return{...e,...t};return e}function S$(e){return Object.entries(e).every(([e,t])=>"shadersReady"===e||t)}SX.displayName="SceneFocusBridge";let S0={placementReady:!1,prepareReady:!1,artifactsReady:!1,assetsReady:!1},S1=(0,ec.memo)(({sceneReady:e,onShadersReadyChange:t})=>{let r=fu(),n=(0,ec.useRef)("holding"),i=Ep(t);return(0,ec.useEffect)(()=>{if(n.current="holding",!e)return void i.current(!1);let t=!0,{camera:a,gl:o,scene:s}=r.getState();s.matrixWorldAutoUpdate&&s.updateMatrixWorld(),null===a.parent&&a.matrixWorldAutoUpdate&&a.updateMatrixWorld();let l=()=>{t&&(t=!1,n.current="compiled",r.getState().invalidate())},c=()=>{t&&(t=!1,n.current="drawing",i.current(!0))},u=setTimeout(()=>{console.warn("Room viewer scene shaders did not finish compiling ahead in time"),l()},1e4);return o.domElement?.addEventListener("webglcontextlost",c),Promise.resolve().then(()=>o.compileAsync(s,a)).catch(e=>{console.error("Room viewer scene shaders failed to compile ahead",e)}).then(l),()=>{t=!1,clearTimeout(u),o.domElement?.removeEventListener("webglcontextlost",c)}},[i,e,r]),fh(({camera:e,gl:t,scene:r})=>{"holding"!==n.current&&(t.render(r,e),"compiled"===n.current&&(n.current="drawing",i.current(!0)))},1),null});S1.displayName="ShaderPrecompile";let S2=(0,ec.memo)(({sceneLightingReady:e})=>{let{sceneLoad:t}=Es(),{patchSceneLoad:r}=El(),n=(0,ec.useCallback)(e=>{r({shadersReady:e})},[r]);return(0,el.jsx)(S1,{sceneReady:e&&S$(t),onShadersReadyChange:n})});S2.displayName="SceneShaderPrecompile";let S3={position:[0,0,0],up:[0,0,1],near:.01,far:100},S9=(0,ec.memo)(({className:e,ref:t,captureRef:r,contentKey:n,introductionTarget:i,focusRef:a,onSizeChange:o,...s})=>{let{type:l}=En(),{glbUrl:c}=Eo(),u=Ex(),d=u?.isBaseModelReady??!0,{materialSource:h}=EG(l),{room:p}=Ea(),{patchSceneLoad:A}=El(),f=m8(e=>e.active),[g,m]=(0,ec.useState)(!1),v=EV((0,ec.useMemo)(()=>p.scene??EN(),[p.scene])),b=(0,ec.useRef)(null),y=(0,ec.useRef)(!1),w=(0,ec.useCallback)(e=>{(b.current=e,"function"==typeof t)?t(e):t&&(t.current=e)},[t]),x=CV("(max-width: 639px)"),{width:C,height:E}=function(e){let t,{ref:r,box:n="content-box"}=e,[{width:i,height:a},o]=(0,ec.useState)(EC),s=(t=(0,ec.useRef)(!1),(0,ec.useEffect)(()=>(t.current=!0,()=>{t.current=!1}),[]),(0,ec.useCallback)(()=>t.current,[])),l=(0,ec.useRef)({...EC}),c=(0,ec.useRef)(void 0);return c.current=e.onResize,(0,ec.useEffect)(()=>{if(!r.current||"u"<typeof window||!("ResizeObserver"in window))return;let e=new ResizeObserver(([e])=>{let t="border-box"===n?"borderBoxSize":"device-pixel-content-box"===n?"devicePixelContentBoxSize":"contentBoxSize",r=EE(e,t,"inlineSize"),i=EE(e,t,"blockSize");if(l.current.width!==r||l.current.height!==i){let e={width:r,height:i};l.current.width=r,l.current.height=i,c.current?c.current(e):s()&&o(e)}});return e.observe(r.current,{box:n}),()=>{e.disconnect()}},[n,r,s]),{width:i,height:a}}({ref:b}),S=(0,ec.useMemo)(()=>{if(!C||!E||!v)return null;let e=C,t=E;return x?e=(t=E)*v:C/E>v?e=E*v:t=C/v,{width:e,height:t}},[C,E,v,x]);return(0,ec.useLayoutEffect)(()=>{S&&o?.(S.width,S.height)},[S,o]),(0,ec.useEffect)(()=>{if(!S||y.current)return;y.current=!0;let e=window.setTimeout(()=>{window.dispatchEvent(new Event("resize"))},250);return()=>{window.clearTimeout(e)}},[S]),(0,ec.useEffect)(()=>{A({layoutReady:null!==S})},[A,S]),(0,ec.useEffect)(()=>{"object-glb"===h&&A({materialReady:!!c&&d})},[c,h,d,A]),(0,ec.useEffect)(()=>{A({assetsReady:!f})},[n,f,A]),(0,el.jsx)("div",{ref:w,className:Cv("size-full flex items-center justify-center",e),...s,children:S&&(0,el.jsxs)(vt,{className:"touch-none bg-transparent",frameloop:"demand",camera:S3,gl:EH,style:{width:`${S.width}px`,height:`${S.height}px`},children:[(0,el.jsxs)(ec.Suspense,{fallback:null,children:[(0,el.jsx)(EX,{ref:r}),(0,el.jsx)(ec.Suspense,{fallback:null,children:(0,el.jsx)(Sj,{},n)}),i&&a&&(0,el.jsx)(SX,{ref:a,target:i})]}),(0,el.jsx)(ec.Suspense,{fallback:null,children:(0,el.jsx)(SY,{lighting:CW[l].lighting,onReadyChange:m})}),(0,el.jsx)(S2,{sceneLightingReady:g})]})})});S9.displayName="CanvasWrapper";let S4=(0,ec.memo)(({captureRef:e,introduction:t,className:r,contentKey:n,...i})=>{let a,o,s,l,c=Ec("isDragging"),u=(0,ec.useRef)(null),d=(0,ec.useRef)(null),h=(0,ec.useRef)(null),p=(a=(0,ec.useRef)(null),o=(0,ec.useRef)(!1),s=(0,ec.useCallback)(()=>{null!==a.current&&cancelAnimationFrame(a.current),a.current=null},[]),l=(0,ec.useCallback)(()=>{t&&(s(),t.onCancel())},[t,s]),(0,ec.useEffect)(()=>{if(!t){o.current=!1;return}if(!t.ready){o.current&&t.onCancel();return}return a.current=requestAnimationFrame(()=>{let e=u.current,r=h.current?.getScreenPoint(),n=e?.instance.wrapperComponent,i=e?.instance.contentComponent;if(!e||!r||!n||!i)return void t.onCancel();let{scale:s,positionX:l,positionY:c}=e.instance.transformState,d=n.getBoundingClientRect(),p=Math.min(e.instance.setup.maxScale,1.28*s),A=(e,t,r)=>r<t?(t-r)/2:Math.max(t-r,Math.min(0,e)),f=A(d.width/2-(r.x-d.left-l)/s*p,d.width,i.offsetWidth*p),g=A(d.height/2-(r.y-d.top-c)/s*p,d.height,i.offsetHeight*p);o.current=!0;let m=window.matchMedia("(prefers-reduced-motion: reduce)").matches,v=performance.now(),b=r=>{let n=m?1:Math.min(1,(r-v)/700),i=(1-Math.cos(Math.PI*n))/2;e.setTransform(l+(f-l)*i,c+(g-c)*i,s+(p-s)*i,0),n<1?a.current=requestAnimationFrame(b):(a.current=null,t.onComplete())};b(v)}),()=>{s()}},[h,t,s,u]),l),A=CV("(max-width: 639px)"),f=(0,ec.useRef)(!!t);f.current=!!t;let g=(0,ec.useCallback)(()=>{A&&u.current?.centerView(void 0,f.current?0:void 0)},[A]),m=(0,ec.useRef)(n);return(0,ec.useLayoutEffect)(()=>{m.current!==n&&(m.current=n,u.current?.resetTransform(0),g())},[n,g]),(0,el.jsx)("div",{className:Cv("relative flex items-center justify-center overflow-hidden",r),...i,onPointerDownCapture:e=>{p(),i.onPointerDownCapture?.(e)},onTouchStartCapture:e=>{p(),i.onTouchStartCapture?.(e)},onWheelCapture:e=>{p(),i.onWheelCapture?.(e)},children:(0,el.jsx)(pQ,{ref:u,disabled:c,children:(0,el.jsx)(pU,{wrapperClass:"neurodyn-rzpp-wrapper size-full!",contentClass:"neurodyn-rzpp-content h-full! min-w-full sm:max-w-full",children:(0,el.jsx)(S9,{captureRef:e??d,contentKey:n,introductionTarget:t?.target,focusRef:h,onSizeChange:g})})})})});async function S5(e){await navigator.clipboard.writeText(e)}function S8(e,t,{fadedOutIfMountedLoaded:r=!1}={}){let[n,i]=(0,ec.useState)(r&&!e);return e&&n&&i(!1),(0,ec.useEffect)(()=>{if(e)return;let r=!0;return Promise.allSettled((t.current?.getAnimations?.()??[]).map(e=>e.finished)).then(()=>{r&&i(!0)}),()=>{r=!1}},[e,t]),!e&&n}function S6({variant:e,missingSurfaceMessage:t,open:r,portalContainer:n,showDialogCloseButton:i=!1,onOpenChange:a,onTryAgain:o,onCancel:s}){let{t:l}=aO(),c="custom-interior-missing-surface"===e||"room-missing-surface"===e,u=l(c?`missingSurface.${t}.title`:"floor.error.title"),d=c?l(`missingSurface.${t}.body`):e?l("custom-interior-processing"===e?"floor.error.processingBody":"viewer-load-failed"===e?"floor.error.loadBody":"artwork-load-failed"===e||"room-load-failed"===e?`loadError.${e}`:`accessError.${e}`):"";return(0,el.jsx)(Cw,{open:r,onOpenChange:a,children:(0,el.jsxs)(CS,{portalContainer:n,showCloseButton:!1,className:"w-full max-w-85 gap-4 rounded-2xl p-6 text-center sm:max-w-85 sm:p-6",onInteractOutside:e=>{e.preventDefault()},children:[(0,el.jsxs)("div",{className:"grid gap-1",children:[(0,el.jsx)(CI,{children:u}),(0,el.jsx)(CB,{className:"typo-base-14 font-medium text-text-base",children:d})]}),(0,el.jsxs)("div",{className:"grid gap-2",children:[o&&(0,el.jsx)(Cy,{variant:"contrast",onClick:o,children:c?(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(Ck,{"aria-hidden":"true"}),l("missingSurface.uploadAnother")]}):(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(CQ,{"aria-hidden":"true"}),l("floor.error.tryAgain")]})}),s&&(0,el.jsx)(Cy,{variant:"outline",onClick:s,children:l("floor.error.cancel")}),i&&(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsx)(Cy,{variant:"outline",children:l("close")})})]})]})})}function S7({rooms:e,customRooms:t,selectedRoomId:r,isInvalidFile:n,uploadRetryRequestId:i=0,showCloseButton:a=!1,onSelectRoom:o,onUploadFile:s}){let l,{t:c}=aO(),u=(0,ec.useId)(),d=(0,ec.useRef)(null);function h(e){return e.map(e=>(0,el.jsxs)("button",{type:"button",className:"group relative aspect-[4/3] overflow-hidden rounded-2xl bg-background-base text-start transition focus-visible:ring-2 focus-visible:ring-icons-normal focus-visible:outline-hidden","aria-pressed":e.id===r,onClick:()=>o(e.id),children:[(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(e),alt:"",decoding:"async",className:"size-full scale-[1.02] transform-gpu object-cover transition duration-200 group-hover:scale-105"}),(0,el.jsx)("span",{className:"typo-base-12 absolute inset-x-0 bottom-0 truncate bg-linear-to-t from-black/45 via-black/10 to-transparent px-3 py-2 text-constant-white",children:c(`rooms.${e.id}`,{defaultValue:e.name})})]},e.id))}return(0,ec.useEffect)(()=>{i>0&&d.current?.click()},[i]),(0,el.jsxs)("section",{"aria-labelledby":"floor-interior-selection-title",className:"relative mx-auto grid h-auto min-h-0 max-h-[calc(100svh-8px)] w-full max-w-151 grid-rows-[auto_auto_minmax(0,1fr)_auto] gap-4 overflow-hidden rounded-t-2xl rounded-b-none bg-background-containers p-4 shadow-[var(--shadow-login)] sm:my-4 sm:max-h-[calc(100svh-32px)] sm:rounded-2xl sm:p-6","data-testid":"floor-interior-selection-panel","data-room-selection-panel":!0,children:[a&&(l=(0,el.jsx)(Cy,{type:"button",variant:"outline",size:"icon",className:"absolute top-4 end-4 sm:top-6 sm:end-6","aria-label":c("close"),"data-testid":"floor-interior-selection-icon-close",children:(0,el.jsx)(CR,{})}),(0,el.jsx)(CC,{asChild:!0,children:l})),(0,el.jsx)("h2",{id:"floor-interior-selection-title",className:"typo-base-16 font-medium sm:typo-base-18 text-text-dark",children:c("floor.interiorSelection.title")}),(0,el.jsxs)("div",{className:"grid gap-2","data-testid":"floor-interior-selection-upload",children:[(0,el.jsxs)("label",{htmlFor:u,className:"flex min-h-15 cursor-pointer items-center justify-center gap-2 rounded-xl border border-dashed border-background-blue bg-background-blue-transparent px-4 text-center typo-button-normal text-background-blue opacity-80 transition hover:bg-background-blue-transparent/80",onDragOver:e=>e.preventDefault(),onDrop:function(e){e.preventDefault();let t=e.dataTransfer.files[0];t&&s(t)},children:[(0,el.jsx)(Ck,{className:"size-5 text-background-blue"}),c("floor.interiorSelection.uploadPhoto"),(0,el.jsx)("input",{ref:d,id:u,type:"file",accept:"image/*",className:"sr-only",onChange:function(e){let t=e.target.files?.[0];e.target.value="",t&&s(t)}})]}),n&&(0,el.jsx)("p",{className:"typo-base-12 font-medium text-destructive",children:c("floor.interiorSelection.invalidFile")})]}),(0,el.jsx)("div",{className:"grid min-h-0 overflow-y-auto overflow-x-hidden overscroll-contain pe-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden","data-testid":"floor-interior-selection-scroll-content",children:(0,el.jsxs)("div",{className:"grid min-h-max gap-4",children:[t.length>0&&(0,el.jsxs)("div",{className:"grid gap-3",children:[(0,el.jsx)("h3",{className:"typo-base-16 font-medium text-text-light",children:c("floor.interiorSelection.customTitle")}),(0,el.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3","data-testid":"floor-custom-interior-selection-grid",children:h(t)})]}),(0,el.jsxs)("div",{className:"grid gap-3",children:[(0,el.jsx)("h3",{className:"typo-base-16 font-medium text-text-light",children:c("floor.interiorSelection.presetsTitle")}),(0,el.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3","data-testid":"floor-preset-interior-selection-grid",children:h(e)})]})]})}),a&&(0,el.jsx)(CM,{className:"-mt-2 shrink-0 p-0 sm:mt-0",children:(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsx)(Cy,{variant:"outline",className:"w-full",children:c("close")})})})]})}function Me(e){return(0,el.jsx)("div",{className:"absolute inset-0 z-20 grid items-end p-0 sm:items-center sm:p-4","data-testid":"floor-interior-selection-overlay",children:(0,el.jsx)(S7,{...e})})}function Mt({open:e,showCloseButton:t=!0,portalContainer:r,onOpenChange:n,...i}){let{t:a}=aO();return(0,el.jsx)(Cw,{open:e,onOpenChange:n,children:(0,el.jsxs)(CS,{contentInsideOverlay:!0,portalContainer:r,showCloseButton:!1,"data-testid":"floor-interior-selection-overlay",className:"top-auto bottom-0 grid max-h-[calc(100svh-8px)] w-[calc(100%-16px)] min-w-0 max-w-none translate-y-0 overflow-hidden rounded-t-2xl rounded-b-none border-none bg-transparent p-0 shadow-none sm:top-[50%] sm:bottom-auto sm:w-full sm:max-w-none sm:translate-y-[-50%] sm:rounded-none sm:p-4",children:[(0,el.jsx)(CI,{className:"sr-only",children:a("floor.interiorSelection.title")}),(0,el.jsx)(CB,{className:"sr-only"}),(0,el.jsx)(S7,{...i,showCloseButton:t})]})})}S4.displayName="Scene";let Mr="data-material-selection-action",Mn="data-material-selection-panel";function Mi(e){return"shopify"===e.source||void 0===e.apiKey?null:e.resourceType?CW[e.resourceType].catalogProductKind:null}let Ma=new Set([403,404]);async function Mo(e,t){let r=Mi(t);if(!r)return null;try{return await x9({objectTinuuid:e},{productKind:r},{baseURL:Ct(t.baseURL),headers:await Cu(t),signal:t.signal})}catch(e){if(cd(e)&&Ma.has(e.response?.status??0))return null;throw e}}async function Ms(e){let t=Mi(e);return t?(await x5({productKind:t},{baseURL:Ct(e.baseURL),headers:await Cu(e),signal:e.signal})).items:[]}async function Ml(e,t){let r=Mi(t);if(!r)return{items:[],pagesCount:0};let n=await x4({productKind:r,page:e,limit:50,sort:"position"},{baseURL:Ct(t.baseURL),headers:await Cu(t),signal:t.signal});return{items:n.items,pagesCount:Math.ceil(n.count/50)}}function Mc(e,t,{requiresMaterialModel:r,getCollapseKey:n}){var i;let a;return i=e.filter(e=>!!(e.tinuuid&&e.materials?.[0]&&function(e,t){if(!t)return!0;let r=e.materials?.[0]?.native?.glbUrl;return"string"==typeof r&&r.trim().length>0}(e,r)&&!(t?.uuid&&e.uuid===t.uuid||t?.tinuuid&&e.tinuuid===t.tinuuid))),a=new Set,i.filter(e=>{let t=n(e);return!a.has(t)&&(a.add(t),!0)})}function Mu(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function Md(e,t,r){return e.find(e=>e.id===t)?.options.find(e=>e.id===r)}let Mh="vizbl-rug:";function Mp(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function MA(e){return e.kit?.uuid??e.uuid??e.tinuuid??""}let Mf={"sized-design":{offersSizeVariants:!0,decodeVariant:function(e){let t=e.dimensions?.width,r=e.dimensions?.depth;return Mp(t)&&Mp(r)?{size:`${t/10}\xd7${r/10}`,shape:function(e){if(!e?.startsWith(Mh))return"rect";try{let t=JSON.parse(e.slice(Mh.length));return"round"===t.shape?"round":"rect"}catch{return"rect"}}(e.description)}:null},decodeProductVariant:(e,t,r)=>{if(!Mu(t.widthMm)||!Mu(t.depthMm))return null;let n=e.properties.find(e=>"shape"===e.key);return{size:`${t.widthMm/10}\xd7${t.depthMm/10}`,shape:n&&Md(r,n.definitionId,n.optionId)?.key==="round"?"round":"rect"}},getCollapseKey:function(e){return e.kit?.uuid?e.kit.uuid:`object:${MA(e)}`}},"color-design":{offersSizeVariants:!1,decodeVariant:function({description:e}){let t="vizbl-flooring:";if(!e?.startsWith(t))return null;try{let r=JSON.parse(e.slice(t.length));return null!==r&&"object"==typeof r&&"color"in r&&"string"==typeof r.color?{color:r.color}:null}catch{return null}},decodeProductVariant:(e,t,r)=>{let n=t.properties.find(e=>"color"===e.key),i=n&&Md(r,n.definitionId,n.optionId)?.label?.trim()||t.name?.trim();return i?{color:i}:null},getCollapseKey:MA},"single-listing":{offersSizeVariants:!1,decodeVariant:null,decodeProductVariant:null,getCollapseKey:MA}},Mg={"product-identity":{catalogsEveryMaterial:!0},finish:{catalogsEveryMaterial:!1},placeholder:{catalogsEveryMaterial:!1}};function Mm(e){return Mf[CW[e].composition]}function Mv(e,t,r,n="",i){return"name-prop"===CW[e].productNameSource?n:i?.trim()||t?.kit?.name?.trim()||t?.name?.trim()||r?.name?.trim()||n}function Mb(){let{tinuuid:e,selectedObject:t,selectResourceVariant:r,apiKey:n,baseURL:i,language:a,source:o,widgetSession:s}=Eo(),{type:l}=En(),{decodeVariant:c,decodeProductVariant:u}=Mm(l),d={apiKey:n,baseURL:i,language:a,source:o,widgetSession:s,resourceType:l},h=e??void 0,p=!!u&&null!==Mi(d),A=o0({queryKey:["room-viewer","product-by-object",{apiKey:d.apiKey??null,language:d.language??null,objectTinuuid:h??null,resourceType:d.resourceType??null,source:d.source}],enabled:p&&!!h,queryFn:({signal:e})=>{if(!h)throw Error("Object tinuuid is required.");return Mo(h,{...d,signal:e})},placeholderData:e=>e?.variants.some(e=>e.tinuuid===h)?e:void 0},sa,void 0),f=A.data??null,g=o0({queryKey:["room-viewer","product-properties",{apiKey:d.apiKey??null,language:d.language??null,resourceType:d.resourceType??null,source:d.source}],enabled:!!f,queryFn:({signal:e})=>Ms({...d,signal:e}),staleTime:1/0},sa,void 0),m=!p||A.isError||null===A.data,v=t?.kit?.uuid,b=t?.owner?.uuid,{data:y,fetchNextPage:w,hasNextPage:x,isFetchingNextPage:C,isFetchNextPageError:E}=o0({queryKey:Cp(v,b,d),enabled:m&&!!c&&!!v&&!!b,queryFn:({pageParam:e,signal:t})=>{if(!v||!b)throw Error("Kit uuid and owner uuid are required.");return Cg(v,b,e,{...d,signal:t})},initialPageParam:1,getNextPageParam:(e,t,r)=>r<e.pages_count?r+1:void 0},su,void 0);(0,ec.useEffect)(()=>{m&&x&&!C&&!E&&w({cancelRefetch:!1})},[m,y?.pages.length,w,x,C,E]);let S=(0,ec.useMemo)(()=>y?.pages.flatMap(e=>e.objs)??[],[y]),M=(0,ec.useMemo)(()=>{let e=new Set;return S.flatMap(t=>{let r=c?.(t);return!t.tinuuid||!t.materials?.[0]||!r||e.has(t.tinuuid)?[]:(e.add(t.tinuuid),[{tinuuid:t.tinuuid,...r}])})},[S,c]),I=g.data,B=(0,ec.useMemo)(()=>{var e;let t;return f&&u?(e=I??[],t=new Set,[...f.variants].sort((e,t)=>e.position-t.position).flatMap(r=>{let n=r.tinuuid&&!t.has(r.tinuuid)?u(f,r,e):null;return n?(t.add(r.tinuuid),[{tinuuid:r.tinuuid,...n}]):[]})):[]},[u,f,I]),k=m?M:B;return{variantItems:k,selectedTinuuid:e,selectVariant:e=>!!k.some(t=>t.tinuuid===e)&&(r(e),!0),product:m?null:f}}let My="product:";function Mw(e){return e.hid??""}function Mx({apiKey:e,baseURL:t,language:r,source:n,widgetSession:i}){return EU.map(a=>({queryKey:Ch(a,{apiKey:e,baseURL:t,language:r,source:n}),queryFn:({signal:o})=>CA(a,{apiKey:e,baseURL:t,language:r,signal:o,source:n,widgetSession:i})}))}function MC(){let{t:e}=aO(),{type:t}=En();return e(`floor.materialSelection.${CW[t].catalogTitle}`)}function ME({className:e,gridClassName:t,titleClassName:r,onOpenChange:n,...i}){let a=MC(),o=(0,ec.useRef)(null),{fetchNextMaterialsPage:s,hasNextPage:l,isFetchingNextPage:c,isLoading:u,materialItems:d,selectMaterial:h,selectedMaterialId:p}=function({includeEmbeddedObject:e=!1}={}){var t;let{material:r,tinuuid:n,embeddedObject:i,selectedObject:a,setMaterial:o,setTinuuid:s,selectResourceVariant:l,apiKey:c,baseURL:u,language:d,source:h,widgetSession:p,setAccessError:A,setLoadError:f}=Eo(),{type:g,name:m}=En(),v=i?.owner?.uuid,b={apiKey:c,baseURL:u,language:d,source:h,widgetSession:p,resourceType:g},y=null!==Mi(b),w=o0({queryKey:["room-viewer","products",{apiKey:b.apiKey??null,language:b.language??null,resourceType:b.resourceType??null,source:b.source}],enabled:y,queryFn:({pageParam:e,signal:t})=>Ml(e,{...b,signal:t}),initialPageParam:1,getNextPageParam:(e,t,r)=>r<e.pagesCount?r+1:void 0},su,void 0),{product:x}=Mb(),C=(0,ec.useMemo)(()=>w.data?.pages.flatMap(e=>e.items).flatMap(e=>e.defaultVariantTinuuid?[{materialId:`${My}${e.id}`,productName:e.name,previewUrl:e.preview??void 0,tinuuid:e.defaultVariantTinuuid}]:[])??[],[w.data]),E=y&&!w.isError&&(w.isLoading||C.length>0),{data:S,error:M,isFetchingNextPage:I,fetchNextPage:B,hasNextPage:k,isLoading:T}=o0({queryKey:["room-viewer","public-objects",{apiKey:(t={apiKey:c,baseURL:u,language:d,source:h,resourceType:g}).apiKey??null,language:t.language??null,ownerUuid:v??null,resourceType:t.resourceType??null,source:t.source}],enabled:!!v,queryFn:({pageParam:e,signal:t})=>{if(!v)throw Error("Owner uuid is required.");return Cf(v,e,{apiKey:c,baseURL:u,language:d,signal:t,source:h,widgetSession:p,resourceType:g})},initialPageParam:1,getNextPageParam:(e,t,r)=>r<e.pages_count?r+1:void 0,getPreviousPageParam:(e,t,r)=>r>1?r-1:void 0},su,void 0),{requiresMaterialModel:R}=EG(g),{getCollapseKey:P}=Mm(g),{catalogsEveryMaterial:D}=Mg[CW[g].materialRole],{composition:_}=CW[g],L=(0,ec.useMemo)(()=>S?.pages.flatMap(e=>e.objs)??[],[S]),F=(0,ec.useMemo)(()=>{let t={requiresMaterialModel:R,getCollapseKey:P};if(e)return Mc([...i?.tinuuid&&i.materials?.[0]?[i]:[],...L],null,t);return Mc(L,i,t)},[i,L,P,e,R]),N=(0,ec.useMemo)(()=>F.flatMap(e=>{if(!e.tinuuid)return[];let t="color-design"===_&&e.kit?.uuid,r=D&&!t?e.materials:e.materials?.slice(0,1);return r?.map(t=>{let r,n=Mw(t);return n&&e.tinuuid?{materialId:n,productName:Mv(g,e,t,m),material:t,previewUrl:(r=t.previews?.[0],r?.subRes?.small??r?.url),tinuuid:e.tinuuid}:null}).filter(e=>null!==e)??[]}),[D,_,F,g,m]),O="color-design"===_&&a?.tinuuid===n&&a?.kit?.uuid?F.find(e=>P(e)===P(a)):void 0,Q=O?.tinuuid!==n&&O?Mw(O.materials?.[0]??{}):r?Mw(r):"",U=F.find(e=>e.tinuuid===n),z=F.find(e=>e.tinuuid&&e.materials?.[0]);(0,ec.useEffect)(()=>{let e=x6(M);e?A(e):M&&f("viewer-load-failed")},[M,A,f]),(0,ec.useEffect)(()=>{S&&0===F.length&&k&&!I&&B()},[S,B,k,I,F.length]),(0,ec.useEffect)(()=>{if(null!==r)return;let e=U??z,t=e?.materials?.[0];e&&t&&e.tinuuid&&(o(t),s(e.tinuuid))},[z,U,r,o,s]);let G=(0,ec.useCallback)(()=>{if(E){w.hasNextPage&&!w.isFetchingNextPage&&w.fetchNextPage();return}!1===k||I||B()},[B,k,I,E,w]),H=(0,ec.useCallback)(e=>{let t=C.find(t=>t.materialId===e);return!!t&&(!!x&&e===`${My}${x.id}`||(l(t.tinuuid),!0))},[C,l,x]),j=(0,ec.useCallback)(e=>{let t=F.find(t=>t.materials?.some(t=>Mw(t)===e)),r=t?.materials?.find(t=>Mw(t)===e);return!!t&&!!r&&!!t.tinuuid&&(o(r),s(t.tinuuid),!0)},[F,o,s]);return E?{fetchNextMaterialsPage:G,hasNextPage:w.hasNextPage,isFetchingNextPage:w.isFetchingNextPage,isLoading:w.isLoading,materialItems:C,selectMaterial:H,selectedMaterialId:x?`${My}${x.id}`:""}:{fetchNextMaterialsPage:G,hasNextPage:k,isFetchingNextPage:I,isLoading:T,materialItems:N,selectMaterial:j,selectedMaterialId:Q}}({includeEmbeddedObject:!0});(0,ec.useEffect)(()=>{let e=o.current;e&&!u&&!c&&l&&0!==d.length&&e.scrollHeight<=e.clientHeight&&s()},[s,l,c,u,d.length]);let A=(0,ec.useCallback)(e=>{let{clientHeight:t,scrollHeight:r,scrollTop:n}=e.currentTarget;n+t>=r-64&&s()},[s]),f=(0,ec.useCallback)(e=>{h(e)&&n(!1)},[n,h]);return(0,el.jsxs)("div",{...i,className:Cv("flex min-h-0 flex-col gap-3 overflow-hidden text-text-dark outline-none",e),"data-testid":"material-selection-panel",onPointerDownCapture:e=>{e.stopPropagation(),i.onPointerDownCapture?.(e)},onMouseDownCapture:e=>{e.stopPropagation(),i.onMouseDownCapture?.(e)},children:[(0,el.jsx)("h2",{className:Cv("typo-base-16 font-medium sm:typo-base-14 sm:font-semibold text-text-dark",r),children:a}),(0,el.jsx)("div",{"data-testid":"material-selection-grid",ref:o,className:Cv("min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain pe-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",t),onScroll:A,children:(0,el.jsxs)("div",{className:"grid min-h-max grid-cols-3 gap-x-2 gap-y-2","data-testid":"material-selection-grid-items",children:[d.map(({materialId:e,previewUrl:t,tinuuid:r,productName:n})=>{let i=e===p;return(0,el.jsxs)("button",{type:"button","data-selected":i,"aria-pressed":i,className:"group flex min-w-0 flex-col gap-1 rounded-lg bg-background-containers text-start focus-visible:ring-2 focus-visible:ring-icons-normal focus-visible:outline-hidden",onClick:()=>f(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),f(e))},children:[(0,el.jsxs)("span",{className:"relative grid aspect-square w-full shrink-0 place-items-center overflow-hidden rounded-lg border border-border p-1 transition group-hover:border-icons-normal",children:[t?(0,el.jsx)("img",{src:t,alt:"",className:"size-full rounded-md object-cover"}):(0,el.jsx)(CL,{className:"size-6 text-icons-normal"}),i&&(0,el.jsx)("span",{className:"absolute top-1 end-1 grid size-6 place-items-center rounded-full bg-icons-blue text-icons-white","data-testid":"material-selection-selected-check",children:(0,el.jsx)(CT,{className:"size-4"})})]}),(0,el.jsx)("span",{className:"typo-base-12 line-clamp-3 w-full wrap-anywhere text-text-base",children:n})]},`${r}-${e}`)}),(u||c)&&(0,el.jsx)("div",{className:"col-span-3 grid h-16 place-items-center",children:(0,el.jsx)(CH,{className:"size-6"})})]})})]})}function MS({open:e,portalContainer:t,onOpenChange:r}){let{t:n}=aO(),i=MC();return(0,el.jsx)(Cw,{open:e,onOpenChange:r,children:(0,el.jsxs)(CS,{contentInsideOverlay:!0,"data-testid":"material-selection-mobile-overlay","data-material-selection-panel":"",className:"top-auto bottom-0 flex max-h-[calc(100svh-8px)] w-[calc(100%-16px)] !max-w-none translate-y-0 flex-col gap-2 overflow-hidden rounded-t-2xl rounded-b-none p-4 sm:hidden",portalContainer:t,showCloseButton:!1,children:[(0,el.jsx)(CI,{className:"sr-only",children:i}),(0,el.jsx)(CB,{className:"sr-only"}),(0,el.jsx)(ME,{className:"min-h-0",gridClassName:"max-h-none",onOpenChange:r}),(0,el.jsx)(CM,{className:"shrink-0 p-0",children:(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsx)(Cy,{type:"button",variant:"outline",className:"w-full",children:n("close")})})})]})})}function MM({className:e,value:t,max:r=100,...n}){let i=r>0?r:100,a="number"==typeof t?Math.min(Math.max(t/i*100,0),100):0;return(0,el.jsx)(vs,{"data-slot":"progress",className:Cv("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),value:t,max:i,...n,children:(0,el.jsx)(vc,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${a}%`}})})}let MI=[{minimumProgress:0,translationKey:"floor.processing.stages.reading"},{minimumProgress:28,translationKey:"floor.processing.stages.mapping"},{minimumProgress:56,translationKey:"floor.processing.stages.lighting"},{minimumProgress:82,translationKey:"floor.processing.stages.finalizing"},{minimumProgress:100,translationKey:"floor.processing.stages.ready"}];function MB({isComplete:e,open:t,onCloseAnimationEnd:r,onOpenChange:n,portalContainer:i}){let{t:a}=aO(),o=(0,ec.useRef)(t),[s,l]=(0,ec.useState)(8),c=e?100:s,u=function(e){for(let t=MI.length-1;t>=0;t-=1){let r=MI[t];if(r&&e>=r.minimumProgress)return r}return MI[0]}(c);(0,ec.useEffect)(()=>{t&&!o.current&&l(8),o.current=t},[t]),(0,ec.useEffect)(()=>{if(!t||e)return;let r=window.setInterval(()=>{l(e=>Math.min(92,e+Math.max(2,Math.round((92-e)/8))))},650);return()=>window.clearInterval(r)},[e,t]);let d=(0,el.jsxs)("div",{role:"status","aria-live":"polite",className:"grid content-start gap-4",children:[(0,el.jsx)("h2",{className:"typo-base-18 font-medium text-text-dark",children:a("floor.processing.title")}),(0,el.jsxs)("div",{"data-testid":"floor-processing-progress-panel",className:"grid min-h-[97px] min-w-0 content-center gap-2 overflow-hidden rounded-xl bg-background-base px-6 py-8",children:[(0,el.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,el.jsx)("span",{className:"typo-base-14 min-w-0 flex-1 truncate text-start font-medium text-text-light",children:a(u.translationKey)}),(0,el.jsxs)("span",{className:"typo-base-14 shrink-0 font-medium text-text-dark",children:[c,"%"]})]}),(0,el.jsx)(MM,{value:c,"aria-label":a("floor.processing.progressLabel"),className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-button-dark [&_[data-slot=progress-indicator]]:duration-500 [&_[data-slot=progress-indicator]]:ease-out"})]})]});return(0,el.jsx)(Cw,{open:t,onOpenChange:n,children:(0,el.jsxs)(CS,{portalContainer:i,showCloseButton:!1,"data-testid":"floor-processing-card",className:"top-auto bottom-2 w-[calc(100%-16px)] !max-w-none translate-y-0 gap-4 overflow-hidden rounded-2xl p-6 text-center sm:top-[50%] sm:bottom-auto sm:w-full sm:!max-w-[377px] sm:translate-y-[-50%] sm:p-6",onInteractOutside:e=>{e.preventDefault()},onAnimationEnd:e=>{e.currentTarget===e.target&&"closed"===e.currentTarget.getAttribute("data-state")&&r?.()},children:[(0,el.jsx)(CI,{className:"sr-only",children:a("floor.processing.title")}),(0,el.jsx)(CB,{className:"sr-only",children:a(u.translationKey)}),d]})})}function Mk(){if(!c){let e=new bH;c={os:e.getOS().name,type:e.getDevice().type}}return c}function MT(){return"iOS"===Mk().os}function MR(){return"Android"===Mk().os}function MP(e,t){return!(!e||MR()&&"mobile"===Mk().type||MR()&&"appclip"===e.ar)&&("floor"!==e.destination||!!t)}let MD=/oklch\(([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\)/;function M_(e,t){let r=e.match(MD);return r?{l:Number.parseFloat(r[1]),c:Number.parseFloat(r[2]),h:Number.parseFloat(r[3])}:{l:t[0],c:t[1],h:t[2]}}function ML({data:e,foreground:t,background:r,robustness:n="M",className:i,...a}){let[o,s]=(0,ec.useState)(null);return((0,ec.useEffect)(()=>{(async()=>{try{let i=getComputedStyle(document.documentElement),a=t??i.getPropertyValue("--foreground"),o=r??i.getPropertyValue("--background"),l=M_(a,[.21,.006,285.885]),c=M_(o,[.985,0,0]),u=await xA.toString(e,{type:"svg",color:{dark:xh(xp({mode:"oklch",...l})),light:xh(xp({mode:"oklch",...c}))},width:200,errorCorrectionLevel:n,margin:0});s(u)}catch(e){console.error(e)}})()},[e,t,r,n]),o)?(0,el.jsx)("div",{className:Cv("size-full","[&_svg]:size-full",i),dangerouslySetInnerHTML:{__html:o},...a}):null}async function MF(e){return await e.updateComplete,!e.canActivateAR&&navigator.xr?.isSessionSupported&&(await navigator.xr.isSessionSupported("immersive-ar").catch(()=>!1),await new Promise(e=>setTimeout(e))),e}async function MN(e){let t;await e.activateAR(),("session-started"===(t=e.getAttribute("ar-status"))||"object-placed"===t)&&await new Promise(t=>{let r=n=>{"not-presenting"===n.detail.status&&(e.removeEventListener("ar-status",r),t())};e.addEventListener("ar-status",r)})}function MO({className:e,buttonClassName:t,buttonLeadingIcon:n,buttonLabel:i,buttonSize:a,buttonVariant:o="contrast",...s}){let{type:l,width:c,height:u,name:d}=En(),{handoff:h}=CW[l],{setAccessError:p,src:A,tinuuid:f,widgetSession:g}=Eo(),{containerRef:m,resourceRef:v}=Es(),{t:b,i18n:y}=aO(),w="ru"===xI()?"arizo":"vizbl",[x,C]=(0,ec.useState)(""),[E,S]=(0,ec.useState)(""),[M,I]=(0,ec.useState)(()=>g?.token),[B,k]=(0,ec.useState)(!1),[T,R]=(0,ec.useState)(!1),P=(0,ec.useRef)(null),D=(0,ec.useRef)(null),[_,L]=(0,ec.useState)(!1),F=(0,ec.useRef)(!1),N=y.resolvedLanguage??y.language,O=EL[w],Q=(0,ec.useMemo)(()=>(function({height:e,language:t,name:r,src:n,tenantConfig:i,tinuuid:a,handoff:o,type:s,width:l,widgetSessionToken:c,pageUrl:u}){if(!o)return null;if("floor"===o.destination&&a){let e=new URL(i.ROOM_URL);return e.searchParams.set("type",s),e.searchParams.set("tinuuid",a),e.searchParams.set("name",r),e.searchParams.set("language",t),c&&e.searchParams.set("widgetSessionToken",c),e.toString()}let d=new URL(i.POSTER_URL);return n&&d.searchParams.set("texture",function(e,t){if(!t||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//"))return e;try{return new URL(e,t).href}catch{return e}}(n,u)),d.searchParams.set("texture_width",(100*l).toString()),d.searchParams.set("texture_height",(100*e).toString()),c&&d.searchParams.set("widgetSessionToken",c),d.toString()})({height:u,language:N,name:d,src:A,tenantConfig:O,tinuuid:f,handoff:h,type:l,width:c,widgetSessionToken:M,pageUrl:"u"<typeof window?void 0:window.location.href}),[A,f,h,l,c,u,d,N,O,M]),U=(0,ec.useMemo)(()=>{if(!f)return null;let e=new URL("https://appclip.apple.com/id");return e.searchParams.set("p","com.us.vizbl.Clip"),e.searchParams.set("tinuuid",f),e.toString()},[f]),z=(0,ec.useCallback)(e=>{P.current=e,e&&D.current?.resolve(e)},[]);function G(){D.current=null,L(!1)}async function H(){return g?.getTokenForRequest().catch(()=>g.token)}async function j(){I(await H())}async function V(){if(!g||!f)return"unavailable";let e=new Promise(e=>{window.setTimeout(()=>e("unavailable"),3e3)});return Promise.race([x7(g,{format:MT()?"usdz":"glb",launchId:function(){if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}(),tinuuid:f}),e])}let q=async()=>{let e;if(h?.ar==="appclip"){if(!f)return;if(MT()&&U){let e=await H(),t=new URL(U);e&&t.searchParams.set("widgetSessionToken",e),window.location.assign(t.toString());return}await j(),k(!0);return}if(!v.current||F.current)return;F.current=!0;try{e=await function(){if(!D.current){let e,t=new Promise(t=>{e=t});D.current={resolve:e,promise:Promise.resolve().then(r.bind(r,"../../node_modules/.pnpm/@google+model-viewer@4.2.0_three@0.185.1/node_modules/@google/model-viewer/lib/model-viewer.js")).then(()=>(L(!0),t),e=>{throw D.current=null,e})}}return D.current.promise.then(MF)}()}finally{F.current=!1}let t=v.current;if(!t)return void G();if(e.canActivateAR){if(await V()==="payment-required"){G(),p("payment-required");return}try{R(!0);let e=t.clone(!0);if(e.position.set(0,0,0),e.quaternion.identity(),e.updateMatrix(),e.updateMatrixWorld(!0),MT()){e.rotation.set(-Math.PI/2,0,0),e.updateMatrix(),e.updateMatrixWorld(!0);let t=new xg.U,r=await t.parseAsync(e,{ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"vertical"}}}),n=new File([r],"scene.usdz",{type:"model/vnd.usdz+zip"});C(URL.createObjectURL(n))}else{let t=new xf.r,r=await t.parseAsync(e,{binary:!0}),n=new File([r],"scene.glb",{type:"model/gltf-binary"});S(URL.createObjectURL(n))}}catch(e){throw G(),e}finally{R(!1)}}else G(),await j(),k(!0)};if((0,ec.useEffect)(()=>{let e=P.current;return e&&(""!==x||""!==E)&&MN(e).finally(G),()=>{""!==x&&URL.revokeObjectURL(x),""!==E&&URL.revokeObjectURL(E)}},[x,E]),!MP(h,f))return null;let W="appclip"===h.ar;return(0,el.jsxs)("div",{className:Cv(e),...s,children:[(0,el.jsxs)(Cy,{variant:o,size:a,disabled:T,onClick:q,className:t,children:[n,i??b("ar.viewInPlace")]}),(0,el.jsx)(Cw,{open:B,onOpenChange:k,children:(0,el.jsxs)(CS,{className:"gap-6 sm:max-w-120",showCloseButton:!1,portalContainer:m,children:[(0,el.jsx)("div",{className:"flex items-center justify-center p-10 bg-constant-white rounded-2xl",children:(0,el.jsx)(ML,{className:"size-48",robustness:"H",data:Q??""})}),W?(0,el.jsxs)("div",{className:"grid gap-2 text-center",children:[(0,el.jsx)("p",{className:"text-lg text-text-sub font-medium",children:b("ar.appClipScanTitle")}),(0,el.jsx)("p",{className:"text-sm text-text-light",children:b("ar.appClipRequirement")})]}):(0,el.jsx)("p",{className:"text-lg text-center text-text-sub font-medium",children:b("ar.scanQrCode")}),(0,el.jsxs)("p",{className:"text-xs text-center text-text-light",children:[!W&&(0,el.jsxs)(el.Fragment,{children:[b("ar.deviceRequirementsDisclaimer"),(0,el.jsx)("br",{})]}),(0,el.jsx)("a",{href:O.TERMS_URL,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 transition-colors duration-300 hover:text-text-dark",style:{textDecoration:"underline",textUnderlineOffset:"2px"},children:b("legal.termsOfUse")}),b("legal.conjunction"),(0,el.jsx)("a",{href:O.PRIVACY_URL,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 transition-colors duration-300 hover:text-text-dark",style:{textDecoration:"underline",textUnderlineOffset:"2px"},children:b("legal.privacyPolicy")})]}),(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsx)(Cy,{variant:"contrast",size:"lg",children:b("close")})})]})}),_&&(0,el.jsx)("model-viewer",{ref:z,className:"fixed w-px h-px opacity-0 pointer-events-none",src:E,iosSrc:x,reveal:"manual",ar:!0,cameraControls:!0,arPlacement:"wall",arModes:"webxr",arScale:"fixed",shadowIntensity:1,interactionPromptThreshold:100})]})}let MQ={"inline-compact":"h-9 w-full rounded-xl","inline-large":"h-11 w-full rounded-xl"},MU={"inline-compact":"size-5","inline-large":"size-6"},Mz={desktop:"floor-ar-card",tablet:void 0,phone:void 0};function MG({...e}){return(0,el.jsx)(nh,{"data-slot":"select",...e})}function MH({...e}){return(0,el.jsx)(ng,{"data-slot":"select-value",...e})}function Mj({className:e,size:t="default",children:r,...n}){return(0,el.jsxs)(nA,{"data-slot":"select-trigger","data-size":t,className:Cv("flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-background-white shadow-sm outline-none transition-colors cursor-pointer","border-border-medium","text-text-dark","hover:border-border-dark","focus-visible:border-border-dark","aria-invalid:border-border-red","disabled:cursor-not-allowed disabled:border-border-medium disabled:bg-background-base disabled:opacity-40","data-[size=default]:h-11 data-[size=default]:px-2 data-[size=default]:py-2.5 data-[size=default]:typo-base-16","data-[size=md]:h-9 data-[size=md]:px-2 data-[size=md]:py-2 data-[size=md]:typo-base-14","data-[size=sm]:h-[1.875rem] data-[size=sm]:px-2 data-[size=sm]:typo-base-12","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-6 [&_svg:not([class*=text-])]:text-text-dark",e),...n,children:[r,(0,el.jsx)(nm,{asChild:!0,children:(0,el.jsx)(CD,{className:"size-6"})})]})}function MV({className:e,children:t,position:r="item-aligned",align:n="center",portalContainer:i,...a}){return(0,el.jsx)(nv,{container:i,children:(0,el.jsxs)(ny,{"data-slot":"select-content",className:Cv("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border bg-background-white text-text-dark shadow-md","border-border-medium","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,align:n,...a,children:[(0,el.jsx)(MW,{}),(0,el.jsx)(nT,{className:Cv("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,el.jsx)(MK,{})]})})}function Mq({className:e,children:t,...r}){return(0,el.jsxs)(nO,{"data-slot":"select-item",className:Cv("relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md py-2.5 pe-8 ps-3 outline-hidden","typo-base-16 text-text-sub","focus:bg-background-base focus:text-text-dark","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-6 [&_svg:not([class*=text-])]:text-text-dark","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[(0,el.jsx)("span",{"data-slot":"select-item-indicator",className:"absolute end-2 flex size-6 items-center justify-center",children:(0,el.jsx)(nG,{children:(0,el.jsx)(CT,{className:"size-5"})})}),(0,el.jsx)(nU,{children:t})]})}function MW({className:e,...t}){return(0,el.jsx)(nj,{"data-slot":"select-scroll-up-button",className:Cv("flex cursor-default items-center justify-center py-1",e),...t,children:(0,el.jsx)(dt,{className:"size-4"})})}function MK({className:e,...t}){return(0,el.jsx)(nq,{"data-slot":"select-scroll-down-button",className:Cv("flex cursor-default items-center justify-center py-1",e),...t,children:(0,el.jsx)(dr,{className:"size-4"})})}let MJ=/^[a-z][a-z\d+.-]*:/i;function MY(e,t="m"){switch(t){case"cm":return e/100;case"in":return .0254*e;case"m":return e}}function MX(e,t){switch(t){case"cm":return 100*e;case"in":return e/.0254}}function MZ(e){let{t}=aO();return(0,ec.useMemo)(()=>[{value:0,label:t("mattingOptions.none")},{value:.05,label:`${Number(MX(.05,e).toFixed(2)).toString()} ${t(`units.${e}`)}`}],[e,t])}function M$({label:e,variant:t,size:r,className:n}){let{t:i}=aO(),{displayUnit:a}=En(),{containerRef:o}=Es(),{material:s,options:l,selectMaterial:c}=function(){let{material:e,setMaterial:t,setTinuuid:r,apiKey:n,baseURL:i,language:a,source:o,widgetSession:s}=Eo(),l=sp({queries:Mx({apiKey:n,baseURL:i,language:a,source:o,widgetSession:s})}),c=(0,ec.useMemo)(()=>l.flatMap(e=>{let t=e.data,r=t?.materials?.[0];return t?.tinuuid&&r?.hid?[{material:r,materialId:r.hid,tinuuid:t.tinuuid}]:[]}),[l]),u=(0,ec.useCallback)(e=>{let n=c.find(t=>t.materialId===e);return!!n&&(t(n.material),r(n.tinuuid),!0)},[c,t,r]);return{material:e,options:c,selectMaterial:u}}(),{matting:u,setMatting:d}=Eu(),h=MZ(a),p=(0,ec.useId)(),A=(0,ec.useId)();return(0,el.jsxs)(CY,{modal:!1,children:[(0,el.jsx)(CX,{asChild:!0,children:(0,el.jsxs)(Cy,{type:"button",variant:t,size:r,className:n,children:[(0,el.jsx)(CN,{className:"size-4"}),e]})}),(0,el.jsxs)(C$,{portalContainer:o,collisionBoundary:o,collisionPadding:8,align:"start",className:"flex w-56 max-w-[var(--radix-dropdown-menu-content-available-width)] flex-col",style:{maxHeight:"var(--radix-dropdown-menu-content-available-height)"},children:[(0,el.jsx)(C2,{id:p,children:i("wallArt.pictureFrame")}),(0,el.jsx)(CZ,{"aria-labelledby":p,className:"min-h-0 overflow-y-auto overscroll-contain",children:l.map(e=>(0,el.jsxs)(C1,{indicatorPosition:"right",checked:s?.hid===e.materialId,onCheckedChange:()=>c(e.materialId),onSelect:e=>e.preventDefault(),className:"gap-2 [@media(pointer:coarse)]:min-h-11",children:[(0,el.jsx)("span",{className:"pointer-events-none size-5 shrink-0 rounded-full border border-border-light",style:{backgroundColor:e.material.miniature?.color?.hex?`#${e.material.miniature.color.hex}`:void 0}}),(0,el.jsx)("span",{className:"min-w-0 flex-1",children:e.material.miniature?.color?.name??e.material.name})]},`${e.tinuuid}-${e.materialId}`))}),(0,el.jsx)(C3,{}),(0,el.jsx)(C2,{id:A,children:i("matting")}),(0,el.jsx)(CZ,{"aria-labelledby":A,className:"shrink-0",children:h.map(e=>(0,el.jsx)(C1,{indicatorPosition:"right",checked:u===e.value,onCheckedChange:()=>d(e.value),onSelect:e=>e.preventDefault(),className:"[@media(pointer:coarse)]:min-h-11",children:e.label},e.value))})]})]})}function M0({className:e,...t}){return(0,el.jsx)("div",{"data-slot":"field-group",className:Cv("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",e),...t})}let M1=uE("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function M2({className:e,orientation:t="vertical",...r}){return(0,el.jsx)("div",{role:"group","data-slot":"field","data-orientation":t,className:Cv(M1({orientation:t}),e),...r})}function M3({className:e,...t}){return(0,el.jsx)("div",{"data-slot":"field-label",className:Cv("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function M9({...e}){return(0,el.jsx)(n8,{"data-slot":"popover",...e})}function M4({...e}){return(0,el.jsx)(ie,{"data-slot":"popover-trigger",...e})}function M5({className:e,align:t="center",sideOffset:r=4,portalContainer:n,...i}){return(0,el.jsx)(ia,{container:n,children:(0,el.jsx)(is,{"data-slot":"popover-content",align:t,sideOffset:r,className:Cv("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...i})})}function M8({className:e,defaultValue:t,value:r,min:n=0,max:i=100,variant:a="default","aria-label":o,"aria-labelledby":s,...l}){let c=(0,ec.useMemo)(()=>Array.isArray(r)?r:Array.isArray(t)?t:[n],[r,t,n]);return(0,el.jsxs)(iM,{"data-slot":"slider",defaultValue:t,value:r,min:n,max:i,"data-variant":a,"aria-label":o,"aria-labelledby":s,className:Cv("relative flex w-full touch-none cursor-pointer items-center select-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e),...l,children:[(0,el.jsx)(iD,{"data-slot":"slider-track",className:Cv("relative grow overflow-hidden rounded-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5","editor"===a?"bg-border-light data-[orientation=horizontal]:h-0.5":"bg-muted data-[orientation=horizontal]:h-1.5"),children:(0,el.jsx)(iL,{"data-slot":"slider-range",className:Cv("absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full","editor"===a?"bg-background-blue":"bg-primary")})}),Array.from({length:c.length},(e,t)=>(0,el.jsx)(iN,{"data-slot":"slider-thumb","aria-label":o,"aria-labelledby":s,className:Cv("ring-ring/50 block shrink-0 rounded-full border bg-white transition-[color,box-shadow] focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50","editor"===a?"size-3 border-background-blue shadow-none hover:ring-2 focus-visible:ring-2":"size-4 border-primary shadow-sm hover:ring-4 focus-visible:ring-4")},t))]})}function M6({variant:e,size:t}){let{t:r}=aO(),{containerRef:n}=Es();return(0,el.jsxs)(M9,{children:[(0,el.jsx)(M4,{asChild:!0,children:(0,el.jsxs)(Cy,{type:"button",variant:e,size:t,className:"shrink-0",children:[(0,el.jsx)(CO,{className:"size-4"}),(0,el.jsx)("span",{className:"sr-only",children:r("scene.tunePosition")})]})}),(0,el.jsxs)(M5,{className:"flex flex-col gap-4 border-button-dark bg-button-dark px-3 py-3.5 text-text-white",side:"top",align:"start",portalContainer:n,collisionBoundary:n,collisionPadding:8,children:[(0,el.jsxs)(M0,{children:[(0,el.jsxs)(M2,{orientation:"horizontal",children:[(0,el.jsx)(M3,{children:r("scene.rotation")}),(0,el.jsx)(M7,{gesture:"rotation",min:-180,max:180,"aria-label":r("scene.rotation")})]}),(0,el.jsxs)(M2,{orientation:"horizontal",children:[(0,el.jsx)(M3,{children:r("scene.angle")}),(0,el.jsx)(M7,{gesture:"angle",min:-75,max:75,"aria-label":r("scene.angle")})]})]}),(0,el.jsx)(Ie,{})]})]})}function M7({gesture:e,min:t,max:r,"aria-label":n}){let i=Ec(e),{sceneGestures:{setAngle:a,setRotation:o}}=El(),s="angle"===e?a:o;return(0,el.jsx)(M8,{value:[i],onValueChange:([e])=>s(e??0),min:t,max:r,step:1,className:"w-40.5 **:data-[slot=slider-range]:bg-transparent **:data-[slot=slider-thumb]:border-background-base-3 **:data-[slot=slider-thumb]:bg-background-base-3 **:data-[slot=slider-track]:bg-icons-normal","aria-label":n})}function Ie(){let{t:e}=aO(),t=Ec("rotation"),r=Ec("angle"),{sceneGestures:{setAngle:n,setRotation:i}}=El();return(0,el.jsxs)(Cy,{type:"button",variant:"ghost",size:"sm",className:"w-full text-text-white hover:bg-white/10 hover:text-text-white active:bg-white/20",disabled:0===t&&0===r,onClick:()=>{i(0),n(0)},children:[(0,el.jsx)(CQ,{className:"size-4"}),e("scene.resetPosition")]})}let It={card:"flex min-h-24 w-fit max-w-100 items-center gap-4 rounded-2xl bg-background-containers p-4 text-start text-text-dark shadow-[var(--shadow-login)]","compact-card":"flex min-h-[116px] w-fit max-w-[421px] items-center gap-4 rounded-2xl bg-background-containers p-4 text-start text-text-dark shadow-[var(--shadow-login)]","flow-card":"flex items-center justify-start gap-4 border-b border-border-light bg-background-containers p-4 text-start"},Ir={card:"size-6 text-icons-normal","compact-card":"size-6 text-icons-normal","flow-card":"size-5 text-icons-normal"},In={desktop:"floor-desktop-product-card",tablet:"floor-tablet-product-card",phone:"floor-mobile-product-card"},Ii={default:"icon",sm:"icon-sm",lg:"icon-lg",icon:"icon","icon-sm":"icon-sm","icon-lg":"icon-lg"},Ia={card:"flex h-24 w-[254px] items-center gap-4 overflow-hidden rounded-2xl bg-background-containers p-4 text-start text-text-dark shadow-[var(--shadow-login)]","framed-row":"flex h-[72px] items-center justify-between gap-3 overflow-hidden rounded-2xl bg-background-containers p-4 text-start text-text-dark shadow-[var(--shadow-login)]","plain-row":"flex w-full items-center justify-between gap-3 rounded-full bg-background-containers text-start"},Io={desktop:"floor-room-card",tablet:"floor-tablet-room-card",phone:void 0},Is={desktop:"floor-desktop-room-name",tablet:"floor-tablet-room-name",phone:"floor-mobile-room-name"},Il={"product-card":function({actions:e,band:t,slot:r,presentation:n}){let i,{t:a}=aO(),{displayUnit:o,name:s,type:l}=En(),{containerRef:c}=Es(),{apiKey:u,embeddedObject:d,material:h,productRef:p,selectedObject:A,source:f,src:g,tinuuid:m,widgetSession:v}=Eo(),{onViewerDialogOpenChange:b,viewerSurface:y}=Ei(),{variantItems:w,selectedTinuuid:x,selectVariant:C,product:E}=Mb(),{materialSource:S,offersReplacement:M,hasPictureFrame:I}=EG(l),B="drag-with-rotation-and-angle"===CW[l].manipulation,k=In[t],T=a(`resourceType.${l}.${n.actionLabelResourceTypeKey}`),R=Cv("w-fit shrink-0","fixed"===n.actionWidth&&"w-[137px]"),P=a(`units.${o}`),D=e.isMaterialSelectionOpen,_=Mv(l,A,h,s,E?.name),L="artwork-src"===S?g:(i=h?.previews?.[0],i?.subRes?.small??i?.url??A?.preview?.subRes?.small??A?.preview?.url??A?.mainPreview),F=w.find(e=>e.tinuuid===x),N=function(e){let t=e?.trim();if(!t||MJ.test(t)&&!/^https?:/i.test(t)||/^[./?#]/.test(t)&&!t.startsWith("//"))return;let r=t.startsWith("//")?`https:${t}`:/^https?:/i.test(t)?t:`https://${t}`;try{let e=new URL(r);if("http:"!==e.protocol&&"https:"!==e.protocol||!e.hostname)return;return e.href}catch{return}}(A?.tinuuid===m?A.destinationUrl:void 0),O=D?e.onMaterialSelectionActionPointerDown:void 0,Q=!!(d?.tinuuid&&m&&d.tinuuid!==m);return(0,el.jsxs)("div",{className:It[n.appearance],"data-chrome-slot":r,"data-neurodyn-room-viewer-product":"","data-testid":k,children:[(0,el.jsx)("div",{className:"grid size-16 shrink-0 place-items-center overflow-hidden bg-background-base",children:L?(0,el.jsx)("img",{src:L,alt:"",className:"size-full min-h-0 object-cover"}):(0,el.jsx)(CL,{className:Ir[n.appearance]})}),(0,el.jsxs)("div",{className:"grid min-h-16 min-w-0 flex-1 grid-cols-1 content-center gap-3",children:[(0,el.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-4",children:[(0,el.jsxs)("div",{className:"min-w-0",children:[(0,el.jsx)("div",{className:"sr-only",children:a(`resourceType.${l}.productCardTitle`)}),(0,el.jsx)("div",{className:"typo-button-normal overflow-x-clip text-ellipsis whitespace-nowrap text-text-dark",children:_})]}),N&&(0,el.jsx)("a",{href:N,target:"_blank",rel:"noopener noreferrer",className:"typo-button-normal shrink-0 text-button-primary underline-offset-2 hover:underline","data-testid":`${k}-description-link`,children:a("floor.scene.description")})]}),(0,el.jsxs)("div",{className:"flex flex-nowrap items-center gap-4",children:[M&&(0,el.jsxs)(Cy,{type:"button",variant:n.actionVariant,size:n.actionSize,[Mr]:!0,"aria-expanded":D,className:R,onPointerDown:O?e=>{e.preventDefault(),e.stopPropagation(),O()}:void 0,onClick:D?e.closeMaterialSelection:e.openMaterialSelection,children:[D?(0,el.jsx)(CR,{className:"size-4"}):(0,el.jsx)(CN,{className:"size-4"}),D?a("floor.scene.hideCatalog"):T]}),(I||B)&&(0,el.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[I&&(0,el.jsx)(M$,{label:T,variant:n.actionVariant,size:n.actionSize,className:R}),B&&(0,el.jsx)(M6,{variant:n.actionVariant,size:Ii[n.actionSize]})]}),w.length>1&&!!F&&(0,el.jsxs)(MG,{value:x??void 0,onValueChange:C,children:[(0,el.jsx)(Mj,{size:"sm",className:"ms-auto w-fit min-w-0 shrink data-[size=sm]:h-8 *:data-[slot=select-value]:block *:data-[slot=select-value]:truncate","data-testid":`${k}-variant-select`,children:(0,el.jsx)(MH,{})}),(0,el.jsx)(MV,{portalContainer:c,children:w.map(e=>{var t;let r;return(0,el.jsx)(Mq,{value:e.tinuuid,children:"color"in e?e.color:(t=e.size,r=t.split("\xd7").map(e=>"cm"===o?e:Math.round(MX(Number(e)/100,o)).toString()).join("\xd7"),`${r} ${P}`)},e.tinuuid)})})]})]}),"dialog"===y&&(void 0!==u||"shopify"===f)&&(0,el.jsx)(Cy,{type:"button",variant:"default",size:n.actionSize,className:"w-full","data-testid":`${k}-select`,onClick:()=>{(Cc(v,"add_to_cart_from_widget",{productRef:Q?void 0:p}),function(e,t=window){let r=new CustomEvent("vizbl:product-selected",{bubbles:!0,cancelable:!0,detail:e});return!t.dispatchEvent(r)}({objectId:m,...Q||!p?{}:{productRef:p},...N?{destinationUrl:N}:{},replaced:Q}))?b?.(!1):Q&&N?window.location.assign(N):b?.(!1)},children:a("floor.scene.select")})]})]})},"room-card":function({actions:e,band:t,slot:r,presentation:n}){let{t:i}=aO(),{room:a}=Ea(),o=i(`rooms.${a.id}`,{defaultValue:a.name}),s=(0,el.jsx)(Cy,{type:"button",variant:n.actionVariant,size:n.actionSize,className:"card"===n.appearance?"w-fit":"shrink-0",onClick:e.openInteriorSelection,children:i(n.actionLabelKey)});return"card"===n.appearance?(0,el.jsxs)("div",{className:Ia[n.appearance],"data-chrome-slot":r,"data-neurodyn-room-viewer-room":"","data-testid":Io[t],children:[(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(a),alt:"",className:"size-16 shrink-0 rounded-lg object-cover"}),(0,el.jsxs)("span",{className:"grid min-w-0 flex-1 content-center gap-3",children:[(0,el.jsx)("span",{className:"typo-button-normal block overflow-x-clip text-ellipsis whitespace-nowrap text-text-dark","data-testid":Is[t],children:o}),s]})]}):(0,el.jsxs)("div",{className:Ia[n.appearance],"data-chrome-slot":r,"data-neurodyn-room-viewer-room":"","data-testid":Io[t],children:[(0,el.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(a),alt:"",className:"size-10 shrink-0 rounded-full object-cover"}),(0,el.jsxs)("span",{className:"grid min-w-0",children:[(0,el.jsx)("span",{className:"typo-base-12 truncate text-text-light",children:i("floor.scene.interiorCardTitle")}),(0,el.jsx)("span",{className:"typo-button-normal overflow-x-clip text-ellipsis whitespace-nowrap text-text-dark","data-testid":Is[t],children:o})]})]}),s]})},"ar-card":function({band:e,slot:t,presentation:r}){let{t:n}=aO(),{room:i}=Ea(),{type:a}=En(),{tinuuid:o}=Eo();return MP(CW[a].handoff,o)?"card"===r.appearance?(0,el.jsxs)("div",{className:"flex h-24 w-[280px] items-center gap-4 overflow-hidden rounded-2xl bg-background-containers p-4 text-text-dark shadow-[var(--shadow-login)]","data-chrome-slot":t,"data-neurodyn-room-viewer-try-at-home":"","data-testid":Mz[e],children:[(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(i),alt:"",className:"size-16 shrink-0 rounded-lg object-cover"}),(0,el.jsxs)("div",{className:"grid min-w-0 flex-1 content-center gap-2",children:[(0,el.jsx)(MO,{buttonLabel:n(r.actionLabelKey),buttonVariant:r.actionVariant,buttonSize:r.actionSize,buttonClassName:"w-fit"}),(0,el.jsx)("div",{className:"typo-base-12 truncate font-medium text-text-light",children:n("floor.scene.tryAtHomeBody")})]})]}):(0,el.jsx)(MO,{className:"w-full","data-chrome-slot":t,"data-neurodyn-room-viewer-try-at-home":"",buttonLabel:n(r.actionLabelKey),buttonLeadingIcon:(0,el.jsx)(Cz,{className:MU[r.appearance]}),buttonVariant:r.actionVariant,buttonSize:r.actionSize,buttonClassName:MQ[r.appearance]}):null}},Ic={"immersive-default":{desktop:[{slot:"product-card",container:"leading",appearance:"card",actionLabelResourceTypeKey:"replaceProduct",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"leading",appearance:"card",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"card",actionLabelKey:"floor.scene.tryAtHome",actionVariant:"secondary",actionSize:"sm"}],tablet:[{slot:"product-card",container:"leading",appearance:"compact-card",actionLabelResourceTypeKey:"replaceProduct",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"framed-row",actionLabelKey:"floor.interiorSelection.chooseInteriorShort",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"inline-compact",actionLabelKey:"floor.scene.tryAtHome",actionVariant:"secondary",actionSize:"default"}],phone:[{slot:"product-card",container:"leading",appearance:"flow-card",actionLabelResourceTypeKey:"replaceProductShort",actionVariant:"outline",actionSize:"sm",actionWidth:"fixed"},{slot:"room-card",container:"trailing",appearance:"plain-row",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"inline-large",actionLabelKey:"floor.scene.tryAtHome",actionVariant:"secondary",actionSize:"lg"}]},"immersive-panels":{desktop:[{slot:"product-card",container:"leading",appearance:"card",actionLabelResourceTypeKey:"replaceProduct",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"leading",appearance:"card",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"}],tablet:[{slot:"product-card",container:"leading",appearance:"compact-card",actionLabelResourceTypeKey:"replaceProduct",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"framed-row",actionLabelKey:"floor.interiorSelection.chooseInteriorShort",actionVariant:"outline",actionSize:"sm"}],phone:[{slot:"product-card",container:"leading",appearance:"flow-card",actionLabelResourceTypeKey:"replaceProductShort",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"plain-row",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"}]},"immersive-wallart":{desktop:[{slot:"product-card",container:"leading",appearance:"card",actionLabelResourceTypeKey:"appearance",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"leading",appearance:"card",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"card",actionLabelKey:"ar.viewInPlace",actionVariant:"secondary",actionSize:"sm"}],tablet:[{slot:"product-card",container:"leading",appearance:"compact-card",actionLabelResourceTypeKey:"appearance",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"framed-row",actionLabelKey:"floor.interiorSelection.chooseInteriorShort",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"inline-compact",actionLabelKey:"ar.viewInPlace",actionVariant:"secondary",actionSize:"default"}],phone:[{slot:"product-card",container:"leading",appearance:"flow-card",actionLabelResourceTypeKey:"appearance",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"plain-row",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"inline-large",actionLabelKey:"ar.viewInPlace",actionVariant:"secondary",actionSize:"lg"}]}};function Iu({actions:e,band:t,entry:r}){let n=Il[r.slot];return(0,el.jsx)(n,{actions:e,band:t,slot:r.slot,presentation:r})}function Id({actions:e,band:t,container:r}){let{type:n}=En(),i=Ic[CW[n].presentation];return(0,el.jsx)(el.Fragment,{children:i[t].filter(e=>e.container===r).map(r=>(0,el.jsx)(Iu,{actions:e,band:t,entry:r},r.slot))})}async function Ih(e,t={}){let r=t.source??"default",n={image:e};if(Cr({apiKey:t.apiKey,source:r})){let e=await t.widgetSession?.getTokenForRequest();return x3(n,{baseURL:t.baseURL,headers:{"x-api-key":t.apiKey,...e?{[Ca]:e}:{}},signal:t.signal,timeout:0,params:{productType:Cn({apiKey:t.apiKey,source:r,resourceType:t.resourceType})}})}return t.signal?xW(n,{signal:t.signal,timeout:0}):xW(n,{timeout:0})}let Ip=[{id:0,label:"empty",rgb:[0,0,0]},{id:1,label:"floor",rgb:[32,208,96]},{id:2,label:"wall-1",rgb:[255,59,48]},{id:3,label:"wall-2",rgb:[10,132,255]},{id:4,label:"ceiling",rgb:[255,214,10]},{id:5,label:"plane-5",rgb:[191,90,242]},{id:6,label:"plane-6",rgb:[255,159,10]},{id:7,label:"plane-7",rgb:[100,210,255]},{id:8,label:"plane-8",rgb:[255,45,85]}];function IA(){try{return"1"===window.localStorage.getItem("neurodyn-room-viewer:debug-mask-export")}catch{return!1}}async function If(e,t){var r,n,i;let a,o,s,l,c=await (r=e.planeIds.dataPng,new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>t(Error("Failed to load room plane id mask image.")),n.crossOrigin="anonymous",n.src=r})),u=e.planeIds.width||c.naturalWidth||c.width,d=e.planeIds.height||c.naturalHeight||c.height,h=document.createElement("canvas"),p=h.getContext("2d",{willReadFrequently:!0});if(!p)throw Error("Failed to prepare room plane mask canvas.");h.width=u,h.height=d,p.drawImage(c,0,0,u,d);let A=p.getImageData(0,0,u,d),f=document.createElement("canvas"),g=f.getContext("2d");if(!g)throw Error("Failed to prepare room debug mask canvas.");f.width=u,f.height=d;for(let e=0;e<u*d;e++){let t=4*e,r=function(e){return Ip.find(t=>t.id===e)??{id:e,label:`plane-${e}`,rgb:[73*e%255,151*e%255,211*e%255]}}(A.data[t]??0);A.data[t]=r.rgb[0],A.data[t+1]=r.rgb[1],A.data[t+2]=r.rgb[2],A.data[t+3]=255}g.putImageData(A,0,0),n=await new Promise((e,t)=>{f.toBlob(r=>{r?e(r):t(Error("Failed to export room plane mask image."))},"image/png")}),o=Array.from((a=t.lastIndexOf("."))>0?t.slice(0,a):t).map(e=>{let t=e.charCodeAt(0),r="."===e||"_"===e||"-"===e;return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||r?e:"-"}).join("").split("-").filter(Boolean).join("-"),i=`${o||"room"}.debug-mask.colors.png`,s=URL.createObjectURL(n),(l=document.createElement("a")).href=s,l.download=i,l.style.display="none",document.body.append(l),l.click(),l.remove(),window.setTimeout(()=>URL.revokeObjectURL(s),1e3)}let Ig="custom-interiors";function Im(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?`custom-interior-${crypto.randomUUID()}`:`custom-interior-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Iv(){let e="u"<typeof indexedDB?null:indexedDB;return e?new Promise((t,r)=>{let n=e.open("neurodyn-floor-custom-interiors",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(Ig)||e.createObjectStore(Ig,{keyPath:"id"})},n.onerror=()=>r(n.error??Error("Failed to open Custom Interior store.")),n.onsuccess=()=>t(n.result)}):Promise.resolve(null)}async function Ib(e,t,r=new Date){let n=await Iv();if(!n)return null;let i={id:Im(),schemaVersion:1,name:e.name,fileName:e.name,createdAt:r.toISOString(),imageBlob:e,scene:t};try{let e=n.transaction(Ig,"readwrite");return e.objectStore(Ig).put(i),await new Promise((t,r)=>{e.oncomplete=()=>t(),e.onerror=()=>r(e.error??Error("Custom Interior transaction failed.")),e.onabort=()=>r(e.error??Error("Custom Interior transaction aborted."))}),i}finally{n.close()}}async function Iy(){let e=await Iv();if(!e)return[];try{return await new Promise((t,r)=>{let n=e.transaction(Ig,"readonly").objectStore(Ig).getAll();n.onerror=()=>r(n.error??Error("Failed to read Custom Interiors.")),n.onsuccess=()=>{let e=n.result.filter(e=>1===e.schemaVersion).sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt));t(e)}})}finally{e.close()}}function Iw(e){let t=[];return{rooms:e.map(e=>{let r=URL.createObjectURL(e.imageBlob);return t.push(r),{id:e.id,name:e.name,image_url:r,scene:e.scene}}),revokeObjectUrls:()=>{for(let e of t)URL.revokeObjectURL(e);t.length=0}}}function Ix(e){let t="dialog"===e?"interior-selection":"scene";return{step:t,hasSceneSelection:"scene"===t,sceneResetKey:0}}function IC(e,t){switch(t.type){case"clear-interior-selection":return{...e,step:"interior-selection",hasSceneSelection:!1,automaticRoomId:t.automaticRoomId};case"select-initial-room":return{step:"scene",hasSceneSelection:!0,sceneResetKey:e.sceneResetKey+1,automaticRoomId:t.roomId};case"open-interior-selection":case"return-to-interior-selection":return{...e,step:"interior-selection"};case"dismiss-interior-selection":case"recover-to-scene":return e.hasSceneSelection?{...e,step:"scene"}:e;case"start-custom-interior-processing":return{...e,step:"processing-custom-interior"};case"commit-interior-selection":return{step:"scene",hasSceneSelection:!0,sceneResetKey:e.sceneResetKey+1}}}function IE(e,t){return!e.aborted&&t()}class IS extends Error{constructor(){super("Room Photo has a Missing Surface."),this.name="CustomInteriorMissingSurfaceError"}}async function IM({abortSignal:e,apiOptions:t,commitCustomInteriorSelection:r,downloadDebugMask:n,file:i,isActive:a,isDebugMaskExportEnabled:o,onDebugMaskError:s,onPersistenceError:l,onProcessingComplete:c,predictRoomScene:u,saveCustomInterior:d,surfaces:h,trackRuntimeCustomInterior:p,waitForProcessingCompletion:A}){let f=await u(i,{...t,signal:e});if(!IE(e,a))return null;if(o()&&n(f,i.name).catch(s),Sc(f,h))throw Su({planes:f.planes,source:"room-photo-upload",surfaces:h}),new IS;let g=p(i,f);return IE(e,a)&&g&&(d(i,f).catch(l),c(),await A(),IE(e,a))?(r(g),g):null}function II(){return new Promise(e=>window.setTimeout(e,250))}function IB(e){console.error("Failed to export room debug mask",e)}function Ik(e){console.error("Failed to persist Custom Interior",e)}function IT(e){console.error("Failed to prepare Custom Interior",e)}function IR({showDialogCloseButton:e=!1}){let{t}=aO(),{name:r,type:n}=En(),{missingSurfaceMessage:i}=CW[n],{accessError:a,glbUrl:o,apiKey:s,baseURL:l,hasRooms:c,source:u,widgetSession:d,isViewerAccessPending:h,loadError:p,selectedObject:A,tinuuid:f}=Eo(),{clearActiveError:g,handleAccessError:m}=function(){let{setAccessError:e,setLoadError:t}=Eo();return{clearActiveError:(0,ec.useCallback)(()=>{e(null),t(null)},[e,t]),handleAccessError:e}}(),{room:v,sourceRooms:b}=Ea(),{resourceRef:y,containerRef:w,setContainerRef:x,sceneLoad:C,isRoomScenePending:E}=Es(),{dialogPortalContainer:S,viewerSurface:M,viewerDialogOpen:I,onViewerDialogOpenChange:B}=Ei(),[k,T]=(0,ec.useState)(!1),[R,P]=(0,ec.useState)(!1),D=(0,ec.useRef)(null),_=(0,ec.useRef)(!1),L=a??p,F=!!L,N=A?.owner?.name??A?.brand??null,{canShare:O,download:Q,isDownloading:U,isSharing:z,share:G}=function({captureRef:e,fallbackToClipboard:t=!1,fileName:r="room-scene.png",shareMessage:n}){let[i,a]=(0,ec.useState)(!1),[o,s]=(0,ec.useState)(!1),l=(0,ec.useMemo)(()=>"u">typeof navigator&&"function"==typeof navigator.share||t&&"u">typeof navigator&&"function"==typeof navigator.clipboard?.writeText,[t]),c=(0,ec.useCallback)(async()=>{if(!l)return;let i="u">typeof navigator&&"function"==typeof navigator.share,o=window.location.href,s=`${n}
|
|
7289
|
+
`)},s.customProgramCacheKey=()=>"wall-panel-exterior-outline-v1",{mask:t,maskMaterial:r,maskModel:n,maskScene:i,material:s,resolution:a,radius:o,clearColor:new cb.Q1f}},[e]);return(0,ec.useLayoutEffect)(()=>Sv(r.material,t,{shading:!1}),[r,t]),(0,ec.useLayoutEffect)(()=>()=>{r.mask.dispose(),r.maskMaterial.dispose(),r.material.dispose()},[r]),(0,el.jsx)("mesh",{material:r.material,frustumCulled:!1,renderOrder:3,raycast:()=>{},onBeforeRender:(t,n,i)=>{let a=t.getRenderTarget(),o=t.getActiveCubeFace(),s=t.getActiveMipmapLevel(),l=t.autoClear,c=t.getClearAlpha();t.getClearColor(r.clearColor),t.getDrawingBufferSize(r.resolution);let{x:u,y:d}=r.resolution;(r.mask.width!==u||r.mask.height!==d)&&r.mask.setSize(u,d),r.radius.value=2*t.getPixelRatio(),e.updateWorldMatrix(!0,!0),r.maskModel.matrix.copy(e.matrixWorld);try{t.autoClear=!0,t.setClearColor(0,0),t.setRenderTarget(r.mask),t.render(r.maskScene,i)}finally{t.setRenderTarget(a,o,s),t.setClearColor(r.clearColor,c),t.autoClear=l}},children:(0,el.jsx)("planeGeometry",{args:[2,2]})})}function SD({source:e,patch:t,isPointVisible:r,outlined:n}){let{model:i,materials:a}=(0,ec.useMemo)(()=>{let t=e.clone(!0),r=Sb(t);return{model:t,materials:r}},[e]);return(0,ec.useLayoutEffect)(()=>{let e=a.map(e=>Sv(e,t));return i.traverse(e=>{e instanceof cb.eaF&&(e.raycast=function(e,t){let n=[];cb.eaF.prototype.raycast.call(this,e,n),t.push(...n.filter(e=>!r||r(e.point)))})}),()=>e.forEach(e=>e())},[r,a,i,t]),(0,ec.useLayoutEffect)(()=>()=>a.forEach(e=>e.dispose()),[a]),(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)("primitive",{object:i,dispose:null}),n&&(0,el.jsx)(SP,{model:i,patch:t})]})}function S_({size:e,patch:t,isPointVisible:r,onClick:n}){let[i,a]=(0,ec.useState)(!1),o=(0,ec.useMemo)(()=>{let e=document.createElement("canvas");e.width=e.height=256;let t=e.getContext("2d");if(t.lineJoin="miter",t.lineCap="round",t.beginPath(),i)t.rect(16,16,224,224);else for(let[e,r,n,i]of[[16,16,1,1],[240,16,-1,1],[16,240,1,-1],[240,240,-1,-1]])t.moveTo(e+22*n,r),t.lineTo(e,r),t.lineTo(e,r+22*i);t.strokeStyle="rgba(255,255,255,.80)",t.lineWidth=5,t.stroke(),t.strokeStyle=i?"#59636d":"rgba(70,80,90,.60)",t.lineWidth=2,t.stroke(),t.beginPath(),t.arc(128,128,29,0,2*Math.PI),t.fillStyle=i?"#ffffff":"#f5f6f7",t.fill(),t.strokeStyle="rgba(35,45,55,.32)",t.lineWidth=2,t.stroke(),t.beginPath(),t.moveTo(117,128),t.lineTo(139,128),t.moveTo(128,117),t.lineTo(128,139),t.strokeStyle="#35414d",t.lineWidth=3,t.stroke();let r=new cb.GOR(e);return r.colorSpace="srgb",r},[i]),s=(0,ec.useMemo)(()=>new cb.V9B({map:o,transparent:!0,depthWrite:!1,toneMapped:!1}),[o]);return(0,ec.useLayoutEffect)(()=>{let e=Sv(s,t,{shading:!1});return s.alphaToCoverage=!1,e},[s,t]),(0,ec.useLayoutEffect)(()=>()=>{s.dispose(),o.dispose()},[s,o]),(0,el.jsx)("mesh",{material:s,renderOrder:2,onPointerOver:()=>a(!0),onPointerOut:()=>a(!1),raycast:function(e,t){let n=[];cb.eaF.prototype.raycast.call(this,e,n),t.push(...n.filter(e=>!r||r(e.point)))},onPointerDown:e=>{e.stopPropagation(),e.nativeEvent.stopPropagation()},onClick:e=>{e.stopPropagation(),n()},children:(0,el.jsx)("planeGeometry",{args:[e,e]})})}function SL({isPointVisible:e,visible:t,dragging:r,panelKey:n,number:i,size:a,depth:o,patch:s}){let l=Ex(),{t:c}=aO(),{camera:u,gl:d}=fd(),h=(0,ec.useRef)(null),p=(0,ec.useRef)(null),A=(0,ec.useMemo)(()=>new cb.Pq0,[]),f=(0,ec.useMemo)(()=>{let e=document.createElement("canvas");e.width=e.height=128;let t=e.getContext("2d");for(let e of(t.beginPath(),t.arc(64,64,61,0,2*Math.PI),t.fillStyle="#f5f6f7",t.fill(),t.strokeStyle="rgba(35,45,55,.32)",t.lineWidth=2,t.stroke(),t.fillStyle="#35414d",[40,64,88]))t.beginPath(),t.arc(e,64,5,0,2*Math.PI),t.fill();let r=new cb.GOR(e);return r.colorSpace="srgb",r},[]),g=(0,ec.useMemo)(()=>new cb.V9B({map:f,transparent:!0,depthWrite:!1,toneMapped:!1}),[f]);(0,ec.useLayoutEffect)(()=>{let e=Sv(g,s,{shading:!1});return g.alphaToCoverage=!1,e},[g,s]),(0,ec.useLayoutEffect)(()=>()=>{g.dispose(),f.dispose()},[g,f]),fh(()=>{h.current&&p.current&&(h.current.getWorldPosition(A),p.current.tabIndex=!r&&(!e||e(A))?0:-1)});let m=()=>{if(!h.current)return;A.set(.05,-.05,0),h.current.localToWorld(A).project(u);let e=d.domElement.getBoundingClientRect();l.openMenu(n,{x:e.left+(A.x+1)*e.width/2,y:e.top+(1-A.y)*e.height/2})};return(0,el.jsxs)("group",{ref:h,position:[a/2-a/12-.05,-a/2+a/20+.05,o+.002],children:[(0,el.jsx)("mesh",{name:"panel-actions",material:g,visible:t&&!r,renderOrder:3,raycast:function(n,i){if(!t||r)return;let a=[];cb.eaF.prototype.raycast.call(this,n,a),i.push(...a.filter(t=>t.uv&&.48>=Math.hypot(t.uv.x-.5,t.uv.y-.5)&&(!e||e(t.point))))},onPointerDown:e=>{e.stopPropagation(),e.nativeEvent.stopPropagation()},onPointerUp:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),m()},children:(0,el.jsx)("planeGeometry",{args:[.1,.1]})}),(0,el.jsx)(mc,{style:{pointerEvents:"none"},children:(0,el.jsx)("button",{ref:p,type:"button","data-panel-key":n,className:"sr-only","aria-label":c("wallPanel.panelActions",{number:i}),"aria-haspopup":"menu",onFocus:()=>l.select(n),onClick:e=>{e.stopPropagation(),m()}})})]})}function SF({glbUrl:e,position:t,quaternion:r,materialPatch:n,isPointVisible:i,onDragStart:a,onDrag:o,onDragEnd:s}){let{data:l}=o0({...Em(e),enabled:!0,suspense:!0,throwOnError:oJ,placeholderData:void 0},sa,void 0),c=Ex(),{room:u}=Ea(),[d,h]=(0,ec.useState)(null),{resourceRef:p,sceneGestures:{setIsDragging:A}}=El(),f=Ec("isDragging"),{gl:g}=fd(),m=f?"grabbing":d?.action?"pointer":d?"grab":"auto";(0,ec.useLayoutEffect)(()=>{let e=g.domElement.style.cursor;return g.domElement.style.cursor=m,()=>{g.domElement.style.cursor=e}},[g,m]);let v=(e,t)=>h(r=>r?.key===e&&r.action===t?r:{key:e,action:t}),b=(0,ec.useRef)(null),y=l.width,w=`${u.id}:${c.generation}`,[x,C]=(0,ec.useState)({size:y,roomKey:w,x:0,y:0});if(x.roomKey!==w)C({size:y,roomKey:w,x:0,y:0});else if(x.size!==y){let e=c.panels.reduce((e,t)=>({minX:Math.min(e.minX,t.x),maxX:Math.max(e.maxX,t.x),minY:Math.min(e.minY,t.y),maxY:Math.max(e.maxY,t.y)}),{minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0}),t=x.size-y;C({size:y,roomKey:w,x:x.x+(e.minX+e.maxX)/2*t,y:x.y+(e.minY+e.maxY)/2*t})}(0,ec.useLayoutEffect)(()=>()=>A(!1),[A]);let E=(e,t=!1)=>{let r=b.current;r&&r.pointerId===e.pointerId&&(e.stopPropagation(),b.current=null,e.target.releasePointerCapture(e.pointerId),A(!1),s(),t||r.moved||(c.select(r.key),c.closeMenu()))};return(0,el.jsx)("group",{ref:p,position:t,quaternion:r,onPointerMissed:c.clearSelection,children:(0,el.jsxs)("group",{position:[x.x,x.y,0],children:[c.panels.map((e,t)=>{let r=c.options.find(t=>t.material.hid===e.materialId)?.model??l;return(0,el.jsxs)("group",{position:[e.x*y,e.y*y,0],onPointerOver:t=>{t.stopPropagation(),v(Ev(e),"panel-actions"===t.object.name)},onPointerOut:()=>h(null),onPointerDown:t=>{0===t.button&&!b.current&&(t.stopPropagation(),t.nativeEvent.stopPropagation(),b.current={x:t.clientX,y:t.clientY,key:Ev(e),moved:!1,pointerId:t.pointerId},t.target.setPointerCapture(t.pointerId),A(!0),a())},onPointerMove:t=>{v(Ev(e),"panel-actions"===t.object.name);let r=b.current;r&&r.pointerId===t.pointerId&&(t.stopPropagation(),!r.moved&&Math.hypot(t.clientX-r.x,t.clientY-r.y)>4&&(r.moved=!0,c.select(r.key),c.closeMenu()),r.moved&&o())},onPointerUp:e=>E(e),onPointerCancel:e=>E(e,!0),children:[(0,el.jsx)(SL,{panelKey:Ev(e),number:t+1,size:y,depth:r.depth,patch:n,isPointVisible:i,dragging:f,visible:c.selected===Ev(e)||d?.key===Ev(e)}),(0,el.jsx)("group",{"rotation-z":-e.turns*Math.PI/2,children:(0,el.jsx)("group",{position:r.mountingOffset,children:(0,el.jsx)(SD,{outlined:c.selected===Ev(e)||d?.key===Ev(e),source:r.scene,patch:n,isPointVisible:i})})})]},Ev(e))}),c.selected&&c.neighbors.map(e=>(0,el.jsx)("group",{position:[e.x*y,e.y*y,.002],children:(0,el.jsx)(S_,{size:y,patch:n,isPointVisible:i,onClick:()=>c.add(e)})},Ev(e)))]})})}function SN(e){let{glbUrl:t}=Eo();return t?(0,el.jsx)(SF,{...e,glbUrl:t}):null}let SO={"modelled-resource":function({position:e,quaternion:t,materialPatch:r,onDrag:n,onDragEnd:i,onDragStart:a}){let{type:o}=En(),{glbUrl:s}=Eo();return s?"rotate-on-floor"===CW[o].manipulation?(0,el.jsx)(SS,{glbUrl:s,position:e,quaternion:t,materialPatch:r}):(0,el.jsx)(g5,{autoTransform:!1,onDrag:n,onDragEnd:i,onDragStart:a,children:(0,el.jsx)(SS,{glbUrl:s,position:e,quaternion:t,materialPatch:r})}):null},"textured-resource":function({position:e,quaternion:t,materialPatch:r,onDrag:n,onDragEnd:i,onDragStart:a}){let{src:o,setLoadError:s}=Eo();return o?(0,el.jsx)(EZ,{onError:()=>s("artwork-load-failed"),children:(0,el.jsx)(g5,{autoTransform:!1,onDrag:n,onDragEnd:i,onDragStart:a,children:(0,el.jsx)(SR,{src:o,position:e,quaternion:t,materialPatch:r})})}):null}};function SQ(e){e.setCrossOrigin("anonymous")}let SU=E9(3,(e,t)=>{ff.clear(cb.Tap,e),t.dispose()}),Sz=E4(SU,e=>ff.clear(cb.Tap,e));function SG(){var e;let t,{room:r}=Ea(),n=fd(e=>e.scene),i=(e=CJ(r),Sz.request(e),t=ff(cb.Tap,e,SQ),(0,ec.useLayoutEffect)(()=>(Sz.clearPassed(e),SU.hold(e,t),()=>SU.release(t)),[e,t]),t);return(0,ec.useLayoutEffect)(()=>(i.colorSpace="srgb",n.background=i,()=>{n.background===i&&(n.background=null)}),[n,i]),null}function SH({plane:e,geometry:t,setPlaneRef:r}){let n={planeId:e.id,kind:e.kind};return(0,el.jsx)("mesh",{ref:t=>r(e,t),geometry:t,userData:n,children:(0,el.jsx)("meshBasicMaterial",{visible:!1,side:2})})}let Sj=(0,ec.memo)(()=>{let e,{type:t}=En(),r=Ex(),{setLoadError:n}=Eo(),i="panel-group"===(e=CW[t]).manipulation?SN:SO[e.identity],{room:a}=Ea(),{patchSceneLoad:o,resourceRef:s}=El(),{gl:l,size:c,camera:u,invalidate:d,raycaster:h,pointer:p}=fd(),A=(0,ec.useMemo)(()=>a.scene??EN(),[a.scene]),f=CK(t),g=function(e){let[t,r]=(0,ec.useState)(null);return(0,ec.useEffect)(()=>{let t=new AbortController,n=null;return Se.acquire(e,{neutralShadingPng:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGNoaGgAAAMEAYFL09IQAAAAAElFTkSuQmCC",signal:t.signal}).then(i=>{t.signal.aborted?Se.release(i):(n=i,r({request:e,state:{preparation:i,failed:!1}}))},n=>{t.signal.aborted||(console.error(n),r({request:e,state:{preparation:null,failed:!0}}))}),()=>{t.abort(),n&&Se.release(n)}},[e]),t?.request===e?t.state:E7}((0,ec.useMemo)(()=>({roomId:a.id,scene:A,surfaces:f}),[a.id,A,f])),m=function({camera:e,invalidate:t,pointer:r,roomPreparation:{preparation:n,failed:i},raycaster:a,resourceRef:o,roomId:s,scene:l,surfaces:c}){let u=`${s}:${[...c].sort().join(",")}`,d=(0,ec.useMemo)(()=>({value:null}),[]),[h,p]=(0,ec.useReducer)(Sp,u,Sh),A=(0,ec.useRef)(null),f=(0,ec.useRef)(null),g=(0,ec.useRef)(!1),m=(0,ec.useRef)(new Map),v=(0,ec.useRef)(null),b=h.placementKey===u,y=n?.planeIdMap??null,w=n?.masks??Sd,x=b?h.resourcePose:null,C=(0,ec.useMemo)(()=>Sl(l,c),[l,c]),E=(0,ec.useMemo)(()=>C.map(e=>e.id),[C]),S=(0,ec.useMemo)(()=>new Map(l.planes.map(e=>{let t,r;return[e.id,(t=e.polygon3D.flatMap(e=>(function(e,t){let[r,n,i]=e;return[r*(EV(t)*(t.camera.fx/t.camera.fy)),i,-n]})(e,l)),(r=new cb.LoY).setAttribute("position",new cb.qtW(t,3)),e.polygon3D.length>=4&&r.setIndex([0,1,2,0,2,3]),r)]})),[l]);(0,ec.useEffect)(()=>()=>S.forEach(e=>e.dispose()),[S]);let M=(0,ec.useMemo)(()=>({artifactsReady:null!==y,placementReady:null!==x,prepareReady:null!==x}),[y,x]),I=0===C.length?"no-allowed-surface":i?"plane-id-map-decode":null,B=(0,ec.useCallback)((e,t)=>{t?m.current.set(e.id,t):m.current.delete(e.id)},[]);(0,ec.useEffect)(()=>()=>{d.value=null},[d,w]),(0,ec.useEffect)(()=>{p({type:"reset-placement",placementKey:u}),A.current=null,f.current=null,g.current=!1,d.value=null,v.current=null},[d,u]);let k=(0,ec.useCallback)((r,n,i=null)=>{let a,s=Sa(r,n,e),l=i?(a=new cb.Pq0(...i).applyQuaternion(new cb.PTz(...s.quaternion)).add(new cb.Pq0(...s.position)),{...s,position:a.toArray()}):s;A.current=l.activePlaneId,f.current=l,g.current=!0,d.value=w.get(l.activePlaneId)?.texture??null,o.current?.position.fromArray(l.position),o.current?.quaternion.fromArray(l.quaternion),t()},[d,e,t,w,o]),T=(0,ec.useCallback)(t=>y?function({activePlaneId:e,allowedPlaneIds:t,camera:r,planeIdMap:n,planeMap:i,pointer:a,raycaster:o}){let s=new Set(t),l=[],c=new Set,u=e=>{!(null===e||c.has(e))&&s.has(e)&&(c.add(e),l.push(e))};for(let s of(u(Eq(a,n)),u(e),t.forEach(u),o.setFromCamera(a,r),l)){let e=i.get(s),t=e?o.intersectObject(e,!1)[0]:null;if(t)return t}return null}({activePlaneId:A.current,allowedPlaneIds:E,camera:e,planeIdMap:y,planeMap:m.current,pointer:t,raycaster:a}):null,[E,e,y,a]);(0,ec.useEffect)(()=>{if(!y||null!==x)return;let r=function({allowedPlanes:e,camera:t,planeMap:r}){let n=e[0],i=n?r.get(n.id):null;return i?Sa(i,function(e){let t=e.geometry.attributes.position,r=new cb.Pq0;for(let e=0;e<t.count;e++)r.add(new cb.Pq0(t.getX(e),t.getY(e),t.getZ(e)));return r.divideScalar(Math.max(1,t.count))}(i),t):null}({allowedPlanes:C,camera:e,planeMap:m.current});r&&(A.current=r.activePlaneId,f.current=r,d.value=w.get(r.activePlaneId)?.texture??null,p({type:"set-resource-pose",placementKey:u,resourcePose:r}),t())},[d,C,e,t,w,u,y,x]);let R=(0,ec.useCallback)(()=>{let t,n=T(r),i=f.current;if(!n||!i){v.current=null;return}let a=Sa(n.object,n.point,e);t=new cb.PTz(...a.quaternion).invert(),v.current=new cb.Pq0(...i.position).sub(new cb.Pq0(...a.position)).applyQuaternion(t).toArray()},[e,T,r]),P=(0,ec.useCallback)(()=>{let e=T(r);e&&k(e.object,e.point,v.current)},[T,r,k]),D=(0,ec.useCallback)(()=>{v.current=null,g.current&&f.current&&(g.current=!1,p({type:"set-resource-pose",placementKey:u,resourcePose:f.current}))},[u]),_=(0,ec.useCallback)(t=>{let r,n=A.current,i=null===n?null:w.get(n);if(!i)return!1;let a=t.clone().project(e),o=function(e,t,r){if(t<0||t>1||r<0||r>1)return 0;let n=t*e.width-.5,i=r*e.height-.5,a=Math.floor(n),o=Math.floor(i),s=E3(a,e.width-1),l=E3(o,e.height-1),c=E3(a+1,e.width-1),u=E3(o+1,e.height-1),d=n-Math.floor(n),h=i-Math.floor(i);return((e.data[l*e.width+s]*(1-d)+e.data[l*e.width+c]*d)*(1-h)+(e.data[u*e.width+s]*(1-d)+e.data[u*e.width+c]*d)*h)/255}(i,(a.x+1)*.5,(1-a.y)*.5);return(r=E3((o-.4)/.29999999999999993,1))*r*(3-2*r)>.001},[e,w]);return{isPointerOnSurface:(0,ec.useCallback)(e=>{let t=y?Eq(e,y):null;return null!==t&&E.includes(t)},[E,y]),activeMaskTextureUniform:d,isPointVisible:_,failure:I,handleDrag:P,handleDragEnd:D,handleDragStart:R,planeGeometries:S,readiness:M,resourcePose:x,setPlaneRef:B}}({camera:u,invalidate:d,pointer:p,roomPreparation:g,raycaster:h,resourceRef:s,roomId:`${a.id}:${r?.generation??0}`,scene:A,surfaces:f});!function(e,t,r){let{gl:n}=fd(),{sceneGestures:{setRotation:i,setIsDragging:a}}=El();(0,ec.useEffect)(()=>{if(!e)return;let r=n.domElement,o=null,s=e=>{e.preventDefault(),e.stopImmediatePropagation()},l=()=>{let e=o;o=null,e&&r.hasPointerCapture(e.id)&&r.releasePointerCapture(e.id),e&&a(!1)},c=e=>{if(o)return void s(e);if(!e.isPrimary||0!==e.button)return;let n=r.getBoundingClientRect();t(new cb.I9Y((e.clientX-n.left)/n.width*2-1,1-(e.clientY-n.top)/n.height*2))&&(s(e),o={id:e.pointerId,startX:e.clientX,lastX:e.clientX,rotating:!1},r.setPointerCapture(e.pointerId),a(!0))},u=e=>{if(!o||o.id!==e.pointerId||(s(e),!o.rotating&&5>Math.abs(e.clientX-o.startX)))return;o.rotating=!0;let t=e.clientX-o.lastX;o.lastX=e.clientX,i(e=>e+.5*t)},d=e=>{o?.id===e.pointerId&&(s(e),l())};return r.addEventListener("pointerdown",c,!0),r.addEventListener("pointermove",u,!0),r.addEventListener("pointerup",d,!0),r.addEventListener("pointercancel",d,!0),r.addEventListener("lostpointercapture",d,!0),window.addEventListener("blur",l),()=>{r.removeEventListener("pointerdown",c,!0),r.removeEventListener("pointermove",u,!0),r.removeEventListener("pointerup",d,!0),r.removeEventListener("pointercancel",d,!0),r.removeEventListener("lostpointercapture",d,!0),window.removeEventListener("blur",l),l()}},[e,n,t,r,a,i])}("rotate-on-floor"===CW[t].manipulation,m.isPointerOnSurface,a.id);let v=(0,ec.useMemo)(()=>new cb.I9Y(1,1),[]),b=g.preparation?.lightingTexture??null,y=(0,ec.useMemo)(()=>b&&{lightingTexture:b,viewport:v,activeMaskTextureUniform:m.activeMaskTextureUniform,maxRoomGain:1.1},[m.activeMaskTextureUniform,b,v]);(0,ec.useLayoutEffect)(()=>{u instanceof cb.ubm&&(u.fov=A.camera.fovYDeg),u.position.set(0,0,0),u.up.set(0,0,1),u.lookAt(0,1,0),u.updateProjectionMatrix(),d()},[u,d,A.camera.fovYDeg]),(0,ec.useLayoutEffect)(()=>{l.getDrawingBufferSize(v),v.set(Math.max(1,v.x),Math.max(1,v.y))},[l,c.height,c.width,v]);let{artifactsReady:w,placementReady:x,prepareReady:C}=m.readiness,E=m.failure;return(0,ec.useEffect)(()=>{o({artifactsReady:w,placementReady:x,prepareReady:C})},[w,o,x,C]),(0,ec.useEffect)(()=>{if(E){if("no-allowed-surface"===E){Su({planes:A.planes,source:"room-scene",surfaces:f}),n("room-missing-surface");return}!function({failure:e,planes:t,resourceType:r}){So(t)}({failure:E,planes:A.planes,resourceType:t}),n("room-load-failed")}},[E,A.planes,n,f,t]),(0,el.jsxs)(el.Fragment,{children:[m.resourcePose&&y&&(0,el.jsx)(i,{position:m.resourcePose.position,quaternion:m.resourcePose.quaternion,materialPatch:y,isPointVisible:m.isPointVisible,onDrag:m.handleDrag,onDragEnd:m.handleDragEnd,onDragStart:m.handleDragStart}),A.planes.map(e=>(0,el.jsx)(SH,{plane:e,geometry:m.planeGeometries.get(e.id),setPlaneRef:m.setPlaneRef},e.id)),(0,el.jsx)(EZ,{onError:()=>n("room-load-failed"),children:(0,el.jsx)(SG,{})})]})});Sj.displayName="Room";let SV=["room-viewer","layout-config"],Sq=[Math.PI/2,0,0];function SW({onReadyChange:e}){return(0,ec.useLayoutEffect)(()=>(e?.(!0),()=>e?.(!1)),[e]),null}function SK({onReadyChange:e}){var t;let r=o0({queryKey:SV,queryFn:()=>xK(),staleTime:1/0},sa,void 0);if(r.isPending)return null;let n=(t=r.data,t?.internal?.links?.find(e=>"hdr_neutral"===e.type)?.url?.trim()||void 0);return(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(m9,{files:n?[n]:void 0,preset:n?void 0:"warehouse",environmentRotation:Sq,environmentIntensity:n?.5:.9}),(0,el.jsx)(SW,{onReadyChange:e})]})}function SJ({onReadyChange:e}){return(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(m9,{files:["https://cdn.neurodyn.ai/assets/hdr/neutral.hdr"],environmentRotation:Sq}),(0,el.jsx)(SW,{onReadyChange:e})]})}let SY=(0,ec.memo)(({lighting:e,onReadyChange:t})=>"remote-neutral-hdr"===e?(0,el.jsx)(SK,{onReadyChange:t}):(0,el.jsx)(SJ,{onReadyChange:t}));SY.displayName="RoomEnvironment";let SX=(0,ec.memo)(({ref:e,target:t})=>{let{camera:r,gl:n}=fd();return(0,ec.useImperativeHandle)(e,()=>({getScreenPoint(){if(!t.current)return null;let e=t.current.getWorldPosition(new cb.Pq0).project(r),i=n.domElement.getBoundingClientRect();return{x:i.left+(e.x+1)*i.width/2,y:i.top+(1-e.y)*i.height/2}}}),[r,n,t]),null});function SZ(e,t){for(let r of Object.keys(t))if(t[r]!==e[r])return{...e,...t};return e}function S$(e){return Object.entries(e).every(([e,t])=>"shadersReady"===e||t)}SX.displayName="SceneFocusBridge";let S0={placementReady:!1,prepareReady:!1,artifactsReady:!1,assetsReady:!1},S1=(0,ec.memo)(({sceneReady:e,onShadersReadyChange:t})=>{let r=fu(),n=(0,ec.useRef)("holding"),i=Ep(t);return(0,ec.useEffect)(()=>{if(n.current="holding",!e)return void i.current(!1);let t=!0,{camera:a,gl:o,scene:s}=r.getState();s.matrixWorldAutoUpdate&&s.updateMatrixWorld(),null===a.parent&&a.matrixWorldAutoUpdate&&a.updateMatrixWorld();let l=()=>{t&&(t=!1,n.current="compiled",r.getState().invalidate())},c=()=>{t&&(t=!1,n.current="drawing",i.current(!0))},u=setTimeout(()=>{console.warn("Room viewer scene shaders did not finish compiling ahead in time"),l()},1e4);return o.domElement?.addEventListener("webglcontextlost",c),Promise.resolve().then(()=>o.compileAsync(s,a)).catch(e=>{console.error("Room viewer scene shaders failed to compile ahead",e)}).then(l),()=>{t=!1,clearTimeout(u),o.domElement?.removeEventListener("webglcontextlost",c)}},[i,e,r]),fh(({camera:e,gl:t,scene:r})=>{"holding"!==n.current&&(t.render(r,e),"compiled"===n.current&&(n.current="drawing",i.current(!0)))},1),null});S1.displayName="ShaderPrecompile";let S2=(0,ec.memo)(({sceneLightingReady:e})=>{let{sceneLoad:t}=Es(),{patchSceneLoad:r}=El(),n=(0,ec.useCallback)(e=>{r({shadersReady:e})},[r]);return(0,el.jsx)(S1,{sceneReady:e&&S$(t),onShadersReadyChange:n})});S2.displayName="SceneShaderPrecompile";let S3={position:[0,0,0],up:[0,0,1],near:.01,far:100},S9=(0,ec.memo)(({className:e,ref:t,captureRef:r,contentKey:n,introductionTarget:i,focusRef:a,onSizeChange:o,...s})=>{let{type:l}=En(),{glbUrl:c}=Eo(),u=Ex(),d=u?.isBaseModelReady??!0,{materialSource:h}=EG(l),{room:p}=Ea(),{patchSceneLoad:A}=El(),f=m8(e=>e.active),[g,m]=(0,ec.useState)(!1),v=EV((0,ec.useMemo)(()=>p.scene??EN(),[p.scene])),b=(0,ec.useRef)(null),y=(0,ec.useRef)(!1),w=(0,ec.useCallback)(e=>{(b.current=e,"function"==typeof t)?t(e):t&&(t.current=e)},[t]),x=CV("(max-width: 639px)"),{width:C,height:E}=function(e){let t,{ref:r,box:n="content-box"}=e,[{width:i,height:a},o]=(0,ec.useState)(EC),s=(t=(0,ec.useRef)(!1),(0,ec.useEffect)(()=>(t.current=!0,()=>{t.current=!1}),[]),(0,ec.useCallback)(()=>t.current,[])),l=(0,ec.useRef)({...EC}),c=(0,ec.useRef)(void 0);return c.current=e.onResize,(0,ec.useEffect)(()=>{if(!r.current||"u"<typeof window||!("ResizeObserver"in window))return;let e=new ResizeObserver(([e])=>{let t="border-box"===n?"borderBoxSize":"device-pixel-content-box"===n?"devicePixelContentBoxSize":"contentBoxSize",r=EE(e,t,"inlineSize"),i=EE(e,t,"blockSize");if(l.current.width!==r||l.current.height!==i){let e={width:r,height:i};l.current.width=r,l.current.height=i,c.current?c.current(e):s()&&o(e)}});return e.observe(r.current,{box:n}),()=>{e.disconnect()}},[n,r,s]),{width:i,height:a}}({ref:b}),S=(0,ec.useMemo)(()=>{if(!C||!E||!v)return null;let e=C,t=E;return x?e=(t=E)*v:C/E>v?e=E*v:t=C/v,{width:e,height:t}},[C,E,v,x]);return(0,ec.useLayoutEffect)(()=>{S&&o?.(S.width,S.height)},[S,o]),(0,ec.useEffect)(()=>{if(!S||y.current)return;y.current=!0;let e=window.setTimeout(()=>{window.dispatchEvent(new Event("resize"))},250);return()=>{window.clearTimeout(e)}},[S]),(0,ec.useEffect)(()=>{A({layoutReady:null!==S})},[A,S]),(0,ec.useEffect)(()=>{"object-glb"===h&&A({materialReady:!!c&&d})},[c,h,d,A]),(0,ec.useEffect)(()=>{A({assetsReady:!f})},[n,f,A]),(0,el.jsx)("div",{ref:w,className:Cv("size-full flex items-center justify-center",e),...s,children:S&&(0,el.jsxs)(vt,{className:"touch-none bg-transparent",frameloop:"demand",camera:S3,gl:EH,style:{width:`${S.width}px`,height:`${S.height}px`},children:[(0,el.jsxs)(ec.Suspense,{fallback:null,children:[(0,el.jsx)(EX,{ref:r}),(0,el.jsx)(ec.Suspense,{fallback:null,children:(0,el.jsx)(Sj,{},n)}),i&&a&&(0,el.jsx)(SX,{ref:a,target:i})]}),(0,el.jsx)(ec.Suspense,{fallback:null,children:(0,el.jsx)(SY,{lighting:CW[l].lighting,onReadyChange:m})}),(0,el.jsx)(S2,{sceneLightingReady:g})]})})});S9.displayName="CanvasWrapper";let S4=(0,ec.memo)(({captureRef:e,introduction:t,className:r,contentKey:n,...i})=>{let a,o,s,l,c=Ec("isDragging"),u=(0,ec.useRef)(null),d=(0,ec.useRef)(null),h=(0,ec.useRef)(null),p=(a=(0,ec.useRef)(null),o=(0,ec.useRef)(!1),s=(0,ec.useCallback)(()=>{null!==a.current&&cancelAnimationFrame(a.current),a.current=null},[]),l=(0,ec.useCallback)(()=>{t&&(s(),t.onCancel())},[t,s]),(0,ec.useEffect)(()=>{if(!t){o.current=!1;return}if(!t.ready){o.current&&t.onCancel();return}return a.current=requestAnimationFrame(()=>{let e=u.current,r=h.current?.getScreenPoint(),n=e?.instance.wrapperComponent,i=e?.instance.contentComponent;if(!e||!r||!n||!i)return void t.onCancel();let{scale:s,positionX:l,positionY:c}=e.instance.transformState,d=n.getBoundingClientRect(),p=Math.min(e.instance.setup.maxScale,1.28*s),A=(e,t,r)=>r<t?(t-r)/2:Math.max(t-r,Math.min(0,e)),f=A(d.width/2-(r.x-d.left-l)/s*p,d.width,i.offsetWidth*p),g=A(d.height/2-(r.y-d.top-c)/s*p,d.height,i.offsetHeight*p);o.current=!0;let m=window.matchMedia("(prefers-reduced-motion: reduce)").matches,v=performance.now(),b=r=>{let n=m?1:Math.min(1,(r-v)/700),i=(1-Math.cos(Math.PI*n))/2;e.setTransform(l+(f-l)*i,c+(g-c)*i,s+(p-s)*i,0),n<1?a.current=requestAnimationFrame(b):(a.current=null,t.onComplete())};b(v)}),()=>{s()}},[h,t,s,u]),l),A=CV("(max-width: 639px)"),f=(0,ec.useRef)(!!t);f.current=!!t;let g=(0,ec.useCallback)(()=>{A&&u.current?.centerView(void 0,f.current?0:void 0)},[A]),m=(0,ec.useRef)(n);return(0,ec.useLayoutEffect)(()=>{m.current!==n&&(m.current=n,u.current?.resetTransform(0),g())},[n,g]),(0,el.jsx)("div",{className:Cv("relative flex items-center justify-center overflow-hidden",r),...i,onPointerDownCapture:e=>{p(),i.onPointerDownCapture?.(e)},onTouchStartCapture:e=>{p(),i.onTouchStartCapture?.(e)},onWheelCapture:e=>{p(),i.onWheelCapture?.(e)},children:(0,el.jsx)(pQ,{ref:u,disabled:c,children:(0,el.jsx)(pU,{wrapperClass:"neurodyn-rzpp-wrapper size-full!",contentClass:"neurodyn-rzpp-content h-full! min-w-full sm:max-w-full",children:(0,el.jsx)(S9,{captureRef:e??d,contentKey:n,introductionTarget:t?.target,focusRef:h,onSizeChange:g})})})})});async function S5(e){await navigator.clipboard.writeText(e)}function S8(e,t,{fadedOutIfMountedLoaded:r=!1}={}){let[n,i]=(0,ec.useState)(r&&!e);return e&&n&&i(!1),(0,ec.useEffect)(()=>{if(e)return;let r=!0;return Promise.allSettled((t.current?.getAnimations?.()??[]).map(e=>e.finished)).then(()=>{r&&i(!0)}),()=>{r=!1}},[e,t]),!e&&n}function S6({variant:e,missingSurfaceMessage:t,open:r,portalContainer:n,showDialogCloseButton:i=!1,onOpenChange:a,onTryAgain:o,onCancel:s}){let{t:l}=aO(),c="custom-interior-missing-surface"===e||"room-missing-surface"===e,u=l(c?`missingSurface.${t}.title`:"floor.error.title"),d=c?l(`missingSurface.${t}.body`):e?l("custom-interior-processing"===e?"floor.error.processingBody":"viewer-load-failed"===e?"floor.error.loadBody":"artwork-load-failed"===e||"room-load-failed"===e?`loadError.${e}`:`accessError.${e}`):"";return(0,el.jsx)(Cw,{open:r,onOpenChange:a,children:(0,el.jsxs)(CS,{portalContainer:n,showCloseButton:!1,className:"w-full max-w-85 gap-4 rounded-2xl p-6 text-center sm:max-w-85 sm:p-6",onInteractOutside:e=>{e.preventDefault()},children:[(0,el.jsxs)("div",{className:"grid gap-1",children:[(0,el.jsx)(CI,{children:u}),(0,el.jsx)(CB,{className:"typo-base-14 font-medium text-text-base",children:d})]}),(0,el.jsxs)("div",{className:"grid gap-2",children:[o&&(0,el.jsx)(Cy,{variant:"contrast",onClick:o,children:c?(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(Ck,{"aria-hidden":"true"}),l("missingSurface.uploadAnother")]}):(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(CQ,{"aria-hidden":"true"}),l("floor.error.tryAgain")]})}),s&&(0,el.jsx)(Cy,{variant:"outline",onClick:s,children:l("floor.error.cancel")}),i&&(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsx)(Cy,{variant:"outline",children:l("close")})})]})]})})}function S7({rooms:e,customRooms:t,selectedRoomId:r,isInvalidFile:n,uploadRetryRequestId:i=0,showCloseButton:a=!1,onSelectRoom:o,onUploadFile:s}){let l,{t:c}=aO(),u=(0,ec.useId)(),d=(0,ec.useRef)(null);function h(e){return e.map(e=>(0,el.jsxs)("button",{type:"button",className:"group relative aspect-[4/3] overflow-hidden rounded-2xl bg-background-base text-start transition focus-visible:ring-2 focus-visible:ring-icons-normal focus-visible:outline-hidden","aria-pressed":e.id===r,onClick:()=>o(e.id),children:[(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(e),alt:"",decoding:"async",className:"size-full scale-[1.02] transform-gpu object-cover transition duration-200 group-hover:scale-105"}),(0,el.jsx)("span",{className:"typo-base-12 absolute inset-x-0 bottom-0 truncate bg-linear-to-t from-black/45 via-black/10 to-transparent px-3 py-2 text-constant-white",children:c(`rooms.${e.id}`,{defaultValue:e.name})})]},e.id))}return(0,ec.useEffect)(()=>{i>0&&d.current?.click()},[i]),(0,el.jsxs)("section",{"aria-labelledby":"floor-interior-selection-title",className:"relative mx-auto grid h-auto min-h-0 max-h-[calc(100svh-8px)] w-full max-w-151 grid-rows-[auto_auto_minmax(0,1fr)_auto] gap-4 overflow-hidden rounded-t-2xl rounded-b-none bg-background-containers p-4 shadow-[var(--shadow-login)] sm:my-4 sm:max-h-[calc(100svh-32px)] sm:rounded-2xl sm:p-6","data-testid":"floor-interior-selection-panel","data-room-selection-panel":!0,children:[a&&(l=(0,el.jsx)(Cy,{type:"button",variant:"outline",size:"icon",className:"absolute top-4 end-4 sm:top-6 sm:end-6","aria-label":c("close"),"data-testid":"floor-interior-selection-icon-close",children:(0,el.jsx)(CR,{})}),(0,el.jsx)(CC,{asChild:!0,children:l})),(0,el.jsx)("h2",{id:"floor-interior-selection-title",className:"typo-base-16 font-medium sm:typo-base-18 text-text-dark",children:c("floor.interiorSelection.title")}),(0,el.jsxs)("div",{className:"grid gap-2","data-testid":"floor-interior-selection-upload",children:[(0,el.jsxs)("label",{htmlFor:u,className:"flex min-h-15 cursor-pointer items-center justify-center gap-2 rounded-xl border border-dashed border-background-blue bg-background-blue-transparent px-4 text-center typo-button-normal text-background-blue opacity-80 transition hover:bg-background-blue-transparent/80",onDragOver:e=>e.preventDefault(),onDrop:function(e){e.preventDefault();let t=e.dataTransfer.files[0];t&&s(t)},children:[(0,el.jsx)(Ck,{className:"size-5 text-background-blue"}),c("floor.interiorSelection.uploadPhoto"),(0,el.jsx)("input",{ref:d,id:u,type:"file",accept:"image/*",className:"sr-only",onChange:function(e){let t=e.target.files?.[0];e.target.value="",t&&s(t)}})]}),n&&(0,el.jsx)("p",{className:"typo-base-12 font-medium text-destructive",children:c("floor.interiorSelection.invalidFile")})]}),(0,el.jsx)("div",{className:"grid min-h-0 overflow-y-auto overflow-x-hidden overscroll-contain pe-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden","data-testid":"floor-interior-selection-scroll-content",children:(0,el.jsxs)("div",{className:"grid min-h-max gap-4",children:[t.length>0&&(0,el.jsxs)("div",{className:"grid gap-3",children:[(0,el.jsx)("h3",{className:"typo-base-16 font-medium text-text-light",children:c("floor.interiorSelection.customTitle")}),(0,el.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3","data-testid":"floor-custom-interior-selection-grid",children:h(t)})]}),(0,el.jsxs)("div",{className:"grid gap-3",children:[(0,el.jsx)("h3",{className:"typo-base-16 font-medium text-text-light",children:c("floor.interiorSelection.presetsTitle")}),(0,el.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3","data-testid":"floor-preset-interior-selection-grid",children:h(e)})]})]})}),a&&(0,el.jsx)(CM,{className:"-mt-2 shrink-0 p-0 sm:mt-0",children:(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsx)(Cy,{variant:"outline",className:"w-full",children:c("close")})})})]})}function Me(e){return(0,el.jsx)("div",{className:"absolute inset-0 z-20 grid items-end p-0 sm:items-center sm:p-4","data-testid":"floor-interior-selection-overlay",children:(0,el.jsx)(S7,{...e})})}function Mt({open:e,showCloseButton:t=!0,portalContainer:r,onOpenChange:n,...i}){let{t:a}=aO();return(0,el.jsx)(Cw,{open:e,onOpenChange:n,children:(0,el.jsxs)(CS,{contentInsideOverlay:!0,portalContainer:r,showCloseButton:!1,"data-testid":"floor-interior-selection-overlay",className:"top-auto bottom-0 grid max-h-[calc(100svh-8px)] w-[calc(100%-16px)] min-w-0 max-w-none translate-y-0 overflow-hidden rounded-t-2xl rounded-b-none border-none bg-transparent p-0 shadow-none sm:top-[50%] sm:bottom-auto sm:w-full sm:max-w-none sm:translate-y-[-50%] sm:rounded-none sm:p-4",children:[(0,el.jsx)(CI,{className:"sr-only",children:a("floor.interiorSelection.title")}),(0,el.jsx)(CB,{className:"sr-only"}),(0,el.jsx)(S7,{...i,showCloseButton:t})]})})}S4.displayName="Scene";let Mr="data-material-selection-action",Mn="data-material-selection-panel";function Mi(e){return"shopify"===e.source||void 0===e.apiKey?null:e.resourceType?CW[e.resourceType].catalogProductKind:null}let Ma=new Set([403,404]);async function Mo(e,t){let r=Mi(t);if(!r)return null;try{return await x9({objectTinuuid:e},{productKind:r},{baseURL:Ct(t.baseURL),headers:await Cu(t),signal:t.signal})}catch(e){if(cd(e)&&Ma.has(e.response?.status??0))return null;throw e}}async function Ms(e){let t=Mi(e);return t?(await x5({productKind:t},{baseURL:Ct(e.baseURL),headers:await Cu(e),signal:e.signal})).items:[]}async function Ml(e,t){let r=Mi(t);if(!r)return{items:[],pagesCount:0};let n=await x4({productKind:r,page:e,limit:50,sort:"position"},{baseURL:Ct(t.baseURL),headers:await Cu(t),signal:t.signal});return{items:n.items,pagesCount:Math.ceil(n.count/50)}}function Mc(e,t,{requiresMaterialModel:r,getCollapseKey:n}){var i;let a;return i=e.filter(e=>!!(e.tinuuid&&e.materials?.[0]&&function(e,t){if(!t)return!0;let r=e.materials?.[0]?.native?.glbUrl;return"string"==typeof r&&r.trim().length>0}(e,r)&&!(t?.uuid&&e.uuid===t.uuid||t?.tinuuid&&e.tinuuid===t.tinuuid))),a=new Set,i.filter(e=>{let t=n(e);return!a.has(t)&&(a.add(t),!0)})}function Mu(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function Md(e,t,r){return e.find(e=>e.id===t)?.options.find(e=>e.id===r)}let Mh="vizbl-rug:";function Mp(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function MA(e){return e.kit?.uuid??e.uuid??e.tinuuid??""}let Mf={"sized-design":{offersSizeVariants:!0,decodeVariant:function(e){let t=e.dimensions?.width,r=e.dimensions?.depth;return Mp(t)&&Mp(r)?{size:`${t/10}\xd7${r/10}`,shape:function(e){if(!e?.startsWith(Mh))return"rect";try{let t=JSON.parse(e.slice(Mh.length));return"round"===t.shape?"round":"rect"}catch{return"rect"}}(e.description)}:null},decodeProductVariant:(e,t,r)=>{if(!Mu(t.widthMm)||!Mu(t.depthMm))return null;let n=e.properties.find(e=>"shape"===e.key);return{size:`${t.widthMm/10}\xd7${t.depthMm/10}`,shape:n&&Md(r,n.definitionId,n.optionId)?.key==="round"?"round":"rect"}},getCollapseKey:function(e){return e.kit?.uuid?e.kit.uuid:`object:${MA(e)}`}},"color-design":{offersSizeVariants:!1,decodeVariant:function({description:e}){let t="vizbl-flooring:";if(!e?.startsWith(t))return null;try{let r=JSON.parse(e.slice(t.length));return null!==r&&"object"==typeof r&&"color"in r&&"string"==typeof r.color?{color:r.color}:null}catch{return null}},decodeProductVariant:(e,t,r)=>{let n=t.properties.find(e=>"color"===e.key),i=n&&Md(r,n.definitionId,n.optionId)?.label?.trim()||t.name?.trim();return i?{color:i}:null},getCollapseKey:MA},"single-listing":{offersSizeVariants:!1,decodeVariant:null,decodeProductVariant:null,getCollapseKey:MA}},Mg={"product-identity":{catalogsEveryMaterial:!0},finish:{catalogsEveryMaterial:!1},placeholder:{catalogsEveryMaterial:!1}};function Mm(e){return Mf[CW[e].composition]}function Mv(e,t,r,n="",i){return"name-prop"===CW[e].productNameSource?n:i?.trim()||t?.kit?.name?.trim()||t?.name?.trim()||r?.name?.trim()||n}function Mb(){let{tinuuid:e,selectedObject:t,selectResourceVariant:r,apiKey:n,baseURL:i,language:a,source:o,widgetSession:s}=Eo(),{type:l}=En(),{decodeVariant:c,decodeProductVariant:u}=Mm(l),d={apiKey:n,baseURL:i,language:a,source:o,widgetSession:s,resourceType:l},h=e??void 0,p=!!u&&null!==Mi(d),A=o0({queryKey:["room-viewer","product-by-object",{apiKey:d.apiKey??null,language:d.language??null,objectTinuuid:h??null,resourceType:d.resourceType??null,source:d.source}],enabled:p&&!!h,queryFn:({signal:e})=>{if(!h)throw Error("Object tinuuid is required.");return Mo(h,{...d,signal:e})},placeholderData:e=>e?.variants.some(e=>e.tinuuid===h)?e:void 0},sa,void 0),f=A.data??null,g=o0({queryKey:["room-viewer","product-properties",{apiKey:d.apiKey??null,language:d.language??null,resourceType:d.resourceType??null,source:d.source}],enabled:!!f,queryFn:({signal:e})=>Ms({...d,signal:e}),staleTime:1/0},sa,void 0),m=!p||A.isError||null===A.data,v=t?.kit?.uuid,b=t?.owner?.uuid,{data:y,fetchNextPage:w,hasNextPage:x,isFetchingNextPage:C,isFetchNextPageError:E}=o0({queryKey:Cp(v,b,d),enabled:m&&!!c&&!!v&&!!b,queryFn:({pageParam:e,signal:t})=>{if(!v||!b)throw Error("Kit uuid and owner uuid are required.");return Cg(v,b,e,{...d,signal:t})},initialPageParam:1,getNextPageParam:(e,t,r)=>r<e.pages_count?r+1:void 0},su,void 0);(0,ec.useEffect)(()=>{m&&x&&!C&&!E&&w({cancelRefetch:!1})},[m,y?.pages.length,w,x,C,E]);let S=(0,ec.useMemo)(()=>y?.pages.flatMap(e=>e.objs)??[],[y]),M=(0,ec.useMemo)(()=>{let e=new Set;return S.flatMap(t=>{let r=c?.(t);return!t.tinuuid||!t.materials?.[0]||!r||e.has(t.tinuuid)?[]:(e.add(t.tinuuid),[{tinuuid:t.tinuuid,...r}])})},[S,c]),I=g.data,B=(0,ec.useMemo)(()=>{var e;let t;return f&&u?(e=I??[],t=new Set,[...f.variants].sort((e,t)=>e.position-t.position).flatMap(r=>{let n=r.tinuuid&&!t.has(r.tinuuid)?u(f,r,e):null;return n?(t.add(r.tinuuid),[{tinuuid:r.tinuuid,...n}]):[]})):[]},[u,f,I]),k=m?M:B;return{variantItems:k,selectedTinuuid:e,selectVariant:e=>!!k.some(t=>t.tinuuid===e)&&(r(e),!0),product:m?null:f}}let My="product:";function Mw(e){return e.hid??""}function Mx({apiKey:e,baseURL:t,language:r,source:n,widgetSession:i}){return EU.map(a=>({queryKey:Ch(a,{apiKey:e,baseURL:t,language:r,source:n}),queryFn:({signal:o})=>CA(a,{apiKey:e,baseURL:t,language:r,signal:o,source:n,widgetSession:i})}))}function MC(){let{t:e}=aO(),{type:t}=En();return e(`floor.materialSelection.${CW[t].catalogTitle}`)}function ME({className:e,gridClassName:t,titleClassName:r,onOpenChange:n,...i}){let a=MC(),o=(0,ec.useRef)(null),{fetchNextMaterialsPage:s,hasNextPage:l,isFetchingNextPage:c,isLoading:u,materialItems:d,selectMaterial:h,selectedMaterialId:p}=function({includeEmbeddedObject:e=!1}={}){var t;let{material:r,tinuuid:n,embeddedObject:i,selectedObject:a,setMaterial:o,setTinuuid:s,selectResourceVariant:l,apiKey:c,baseURL:u,language:d,source:h,widgetSession:p,setAccessError:A,setLoadError:f}=Eo(),{type:g,name:m}=En(),v=i?.owner?.uuid,b={apiKey:c,baseURL:u,language:d,source:h,widgetSession:p,resourceType:g},y=null!==Mi(b),w=o0({queryKey:["room-viewer","products",{apiKey:b.apiKey??null,language:b.language??null,resourceType:b.resourceType??null,source:b.source}],enabled:y,queryFn:({pageParam:e,signal:t})=>Ml(e,{...b,signal:t}),initialPageParam:1,getNextPageParam:(e,t,r)=>r<e.pagesCount?r+1:void 0},su,void 0),{product:x}=Mb(),C=(0,ec.useMemo)(()=>w.data?.pages.flatMap(e=>e.items).flatMap(e=>e.defaultVariantTinuuid?[{materialId:`${My}${e.id}`,productName:e.name,previewUrl:e.preview??void 0,tinuuid:e.defaultVariantTinuuid}]:[])??[],[w.data]),E=y&&!w.isError&&(w.isLoading||C.length>0),{data:S,error:M,isFetchingNextPage:I,fetchNextPage:B,hasNextPage:k,isLoading:T}=o0({queryKey:["room-viewer","public-objects",{apiKey:(t={apiKey:c,baseURL:u,language:d,source:h,resourceType:g}).apiKey??null,language:t.language??null,ownerUuid:v??null,resourceType:t.resourceType??null,source:t.source}],enabled:!!v,queryFn:({pageParam:e,signal:t})=>{if(!v)throw Error("Owner uuid is required.");return Cf(v,e,{apiKey:c,baseURL:u,language:d,signal:t,source:h,widgetSession:p,resourceType:g})},initialPageParam:1,getNextPageParam:(e,t,r)=>r<e.pages_count?r+1:void 0,getPreviousPageParam:(e,t,r)=>r>1?r-1:void 0},su,void 0),{requiresMaterialModel:R}=EG(g),{getCollapseKey:P}=Mm(g),{catalogsEveryMaterial:D}=Mg[CW[g].materialRole],{composition:_}=CW[g],L=(0,ec.useMemo)(()=>S?.pages.flatMap(e=>e.objs)??[],[S]),F=(0,ec.useMemo)(()=>{let t={requiresMaterialModel:R,getCollapseKey:P};if(e)return Mc([...i?.tinuuid&&i.materials?.[0]?[i]:[],...L],null,t);return Mc(L,i,t)},[i,L,P,e,R]),N=(0,ec.useMemo)(()=>F.flatMap(e=>{if(!e.tinuuid)return[];let t="color-design"===_&&e.kit?.uuid,r=D&&!t?e.materials:e.materials?.slice(0,1);return r?.map(t=>{let r,n=Mw(t);return n&&e.tinuuid?{materialId:n,productName:Mv(g,e,t,m),material:t,previewUrl:(r=t.previews?.[0],r?.subRes?.small??r?.url),tinuuid:e.tinuuid}:null}).filter(e=>null!==e)??[]}),[D,_,F,g,m]),O="color-design"===_&&a?.tinuuid===n&&a?.kit?.uuid?F.find(e=>P(e)===P(a)):void 0,Q=O?.tinuuid!==n&&O?Mw(O.materials?.[0]??{}):r?Mw(r):"",U=F.find(e=>e.tinuuid===n),z=F.find(e=>e.tinuuid&&e.materials?.[0]);(0,ec.useEffect)(()=>{let e=x6(M);e?A(e):M&&f("viewer-load-failed")},[M,A,f]),(0,ec.useEffect)(()=>{S&&0===F.length&&k&&!I&&B()},[S,B,k,I,F.length]),(0,ec.useEffect)(()=>{if(null!==r)return;let e=U??z,t=e?.materials?.[0];e&&t&&e.tinuuid&&(o(t),s(e.tinuuid))},[z,U,r,o,s]);let G=(0,ec.useCallback)(()=>{if(E){w.hasNextPage&&!w.isFetchingNextPage&&w.fetchNextPage();return}!1===k||I||B()},[B,k,I,E,w]),H=(0,ec.useCallback)(e=>{let t=C.find(t=>t.materialId===e);return!!t&&(!!x&&e===`${My}${x.id}`||(l(t.tinuuid),!0))},[C,l,x]),j=(0,ec.useCallback)(e=>{let t=F.find(t=>t.materials?.some(t=>Mw(t)===e)),r=t?.materials?.find(t=>Mw(t)===e);return!!t&&!!r&&!!t.tinuuid&&(o(r),s(t.tinuuid),!0)},[F,o,s]);return E?{fetchNextMaterialsPage:G,hasNextPage:w.hasNextPage,isFetchingNextPage:w.isFetchingNextPage,isLoading:w.isLoading,materialItems:C,selectMaterial:H,selectedMaterialId:x?`${My}${x.id}`:""}:{fetchNextMaterialsPage:G,hasNextPage:k,isFetchingNextPage:I,isLoading:T,materialItems:N,selectMaterial:j,selectedMaterialId:Q}}({includeEmbeddedObject:!0});(0,ec.useEffect)(()=>{let e=o.current;e&&!u&&!c&&l&&0!==d.length&&e.scrollHeight<=e.clientHeight&&s()},[s,l,c,u,d.length]);let A=(0,ec.useCallback)(e=>{let{clientHeight:t,scrollHeight:r,scrollTop:n}=e.currentTarget;n+t>=r-64&&s()},[s]),f=(0,ec.useCallback)(e=>{h(e)&&n(!1)},[n,h]);return(0,el.jsxs)("div",{...i,className:Cv("flex min-h-0 flex-col gap-3 overflow-hidden text-text-dark outline-none",e),"data-testid":"material-selection-panel",onPointerDownCapture:e=>{e.stopPropagation(),i.onPointerDownCapture?.(e)},onMouseDownCapture:e=>{e.stopPropagation(),i.onMouseDownCapture?.(e)},children:[(0,el.jsx)("h2",{className:Cv("typo-base-16 font-medium sm:typo-base-14 sm:font-semibold text-text-dark",r),children:a}),(0,el.jsx)("div",{"data-testid":"material-selection-grid",ref:o,className:Cv("min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain pe-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",t),onScroll:A,children:(0,el.jsxs)("div",{className:"grid min-h-max grid-cols-3 gap-x-2 gap-y-2","data-testid":"material-selection-grid-items",children:[d.map(({materialId:e,previewUrl:t,tinuuid:r,productName:n})=>{let i=e===p;return(0,el.jsxs)("button",{type:"button","data-selected":i,"aria-pressed":i,className:"group flex min-w-0 flex-col gap-1 rounded-lg bg-background-containers text-start focus-visible:ring-2 focus-visible:ring-icons-normal focus-visible:outline-hidden",onClick:()=>f(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),f(e))},children:[(0,el.jsxs)("span",{className:"relative grid aspect-square w-full shrink-0 place-items-center overflow-hidden rounded-lg border border-border p-1 transition group-hover:border-icons-normal",children:[t?(0,el.jsx)("img",{src:t,alt:"",className:"size-full rounded-md object-cover"}):(0,el.jsx)(CL,{className:"size-6 text-icons-normal"}),i&&(0,el.jsx)("span",{className:"absolute top-1 end-1 grid size-6 place-items-center rounded-full bg-icons-blue text-icons-white","data-testid":"material-selection-selected-check",children:(0,el.jsx)(CT,{className:"size-4"})})]}),(0,el.jsx)("span",{className:"typo-base-12 line-clamp-3 w-full wrap-anywhere text-text-base",children:n})]},`${r}-${e}`)}),(u||c)&&(0,el.jsx)("div",{className:"col-span-3 grid h-16 place-items-center",children:(0,el.jsx)(CH,{className:"size-6"})})]})})]})}function MS({open:e,portalContainer:t,onOpenChange:r}){let{t:n}=aO(),i=MC();return(0,el.jsx)(Cw,{open:e,onOpenChange:r,children:(0,el.jsxs)(CS,{contentInsideOverlay:!0,"data-testid":"material-selection-mobile-overlay","data-material-selection-panel":"",className:"top-auto bottom-0 flex max-h-[calc(100svh-8px)] w-[calc(100%-16px)] !max-w-none translate-y-0 flex-col gap-2 overflow-hidden rounded-t-2xl rounded-b-none p-4 sm:hidden",portalContainer:t,showCloseButton:!1,children:[(0,el.jsx)(CI,{className:"sr-only",children:i}),(0,el.jsx)(CB,{className:"sr-only"}),(0,el.jsx)(ME,{className:"min-h-0",gridClassName:"max-h-none",onOpenChange:r}),(0,el.jsx)(CM,{className:"shrink-0 p-0",children:(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsx)(Cy,{type:"button",variant:"outline",className:"w-full",children:n("close")})})})]})})}function MM({className:e,value:t,max:r=100,...n}){let i=r>0?r:100,a="number"==typeof t?Math.min(Math.max(t/i*100,0),100):0;return(0,el.jsx)(vs,{"data-slot":"progress",className:Cv("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),value:t,max:i,...n,children:(0,el.jsx)(vc,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${a}%`}})})}let MI=[{minimumProgress:0,translationKey:"floor.processing.stages.reading"},{minimumProgress:28,translationKey:"floor.processing.stages.mapping"},{minimumProgress:56,translationKey:"floor.processing.stages.lighting"},{minimumProgress:82,translationKey:"floor.processing.stages.finalizing"},{minimumProgress:100,translationKey:"floor.processing.stages.ready"}];function MB({isComplete:e,open:t,onCloseAnimationEnd:r,onOpenChange:n,portalContainer:i}){let{t:a}=aO(),o=(0,ec.useRef)(t),[s,l]=(0,ec.useState)(8),c=e?100:s,u=function(e){for(let t=MI.length-1;t>=0;t-=1){let r=MI[t];if(r&&e>=r.minimumProgress)return r}return MI[0]}(c);(0,ec.useEffect)(()=>{t&&!o.current&&l(8),o.current=t},[t]),(0,ec.useEffect)(()=>{if(!t||e)return;let r=window.setInterval(()=>{l(e=>Math.min(92,e+Math.max(2,Math.round((92-e)/8))))},650);return()=>window.clearInterval(r)},[e,t]);let d=(0,el.jsxs)("div",{role:"status","aria-live":"polite",className:"grid content-start gap-4",children:[(0,el.jsx)("h2",{className:"typo-base-18 font-medium text-text-dark",children:a("floor.processing.title")}),(0,el.jsxs)("div",{"data-testid":"floor-processing-progress-panel",className:"grid min-h-[97px] min-w-0 content-center gap-2 overflow-hidden rounded-xl bg-background-base px-6 py-8",children:[(0,el.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,el.jsx)("span",{className:"typo-base-14 min-w-0 flex-1 truncate text-start font-medium text-text-light",children:a(u.translationKey)}),(0,el.jsxs)("span",{className:"typo-base-14 shrink-0 font-medium text-text-dark",children:[c,"%"]})]}),(0,el.jsx)(MM,{value:c,"aria-label":a("floor.processing.progressLabel"),className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-button-dark [&_[data-slot=progress-indicator]]:duration-500 [&_[data-slot=progress-indicator]]:ease-out"})]})]});return(0,el.jsx)(Cw,{open:t,onOpenChange:n,children:(0,el.jsxs)(CS,{portalContainer:i,showCloseButton:!1,"data-testid":"floor-processing-card",className:"top-auto bottom-2 w-[calc(100%-16px)] !max-w-none translate-y-0 gap-4 overflow-hidden rounded-2xl p-6 text-center sm:top-[50%] sm:bottom-auto sm:w-full sm:!max-w-[377px] sm:translate-y-[-50%] sm:p-6",onInteractOutside:e=>{e.preventDefault()},onAnimationEnd:e=>{e.currentTarget===e.target&&"closed"===e.currentTarget.getAttribute("data-state")&&r?.()},children:[(0,el.jsx)(CI,{className:"sr-only",children:a("floor.processing.title")}),(0,el.jsx)(CB,{className:"sr-only",children:a(u.translationKey)}),d]})})}function Mk(){if(!c){let e=new bH;c={os:e.getOS().name,type:e.getDevice().type}}return c}function MT(){return"iOS"===Mk().os}function MR(){return"Android"===Mk().os}function MP(e,t){return!(!e||MR()&&"mobile"===Mk().type||MR()&&"appclip"===e.ar)&&("floor"!==e.destination||!!t)}let MD=/oklch\(([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\)/;function M_(e,t){let r=e.match(MD);return r?{l:Number.parseFloat(r[1]),c:Number.parseFloat(r[2]),h:Number.parseFloat(r[3])}:{l:t[0],c:t[1],h:t[2]}}function ML({data:e,foreground:t,background:r,robustness:n="M",className:i,...a}){let[o,s]=(0,ec.useState)(null);return((0,ec.useEffect)(()=>{(async()=>{try{let i=getComputedStyle(document.documentElement),a=t??i.getPropertyValue("--foreground"),o=r??i.getPropertyValue("--background"),l=M_(a,[.21,.006,285.885]),c=M_(o,[.985,0,0]),u=await xA.toString(e,{type:"svg",color:{dark:xh(xp({mode:"oklch",...l})),light:xh(xp({mode:"oklch",...c}))},width:200,errorCorrectionLevel:n,margin:0});s(u)}catch(e){console.error(e)}})()},[e,t,r,n]),o)?(0,el.jsx)("div",{className:Cv("size-full","[&_svg]:size-full",i),dangerouslySetInnerHTML:{__html:o},...a}):null}async function MF(e){return await e.updateComplete,!e.canActivateAR&&navigator.xr?.isSessionSupported&&(await navigator.xr.isSessionSupported("immersive-ar").catch(()=>!1),await new Promise(e=>setTimeout(e))),e}async function MN(e){let t;await e.activateAR(),("session-started"===(t=e.getAttribute("ar-status"))||"object-placed"===t)&&await new Promise(t=>{let r=n=>{"not-presenting"===n.detail.status&&(e.removeEventListener("ar-status",r),t())};e.addEventListener("ar-status",r)})}function MO({className:e,buttonClassName:t,buttonLeadingIcon:n,buttonLabel:i,buttonSize:a,buttonVariant:o="contrast",...s}){let{type:l,width:c,height:u,name:d}=En(),{handoff:h}=CW[l],{setAccessError:p,src:A,tinuuid:f,widgetSession:g}=Eo(),{containerRef:m,resourceRef:v}=Es(),{t:b,i18n:y}=aO(),w="ru"===xI()?"arizo":"vizbl",[x,C]=(0,ec.useState)(""),[E,S]=(0,ec.useState)(""),[M,I]=(0,ec.useState)(()=>g?.token),[B,k]=(0,ec.useState)(!1),[T,R]=(0,ec.useState)(!1),P=(0,ec.useRef)(null),D=(0,ec.useRef)(null),[_,L]=(0,ec.useState)(!1),F=(0,ec.useRef)(!1),N=y.resolvedLanguage??y.language,O=EL[w],Q=(0,ec.useMemo)(()=>(function({height:e,language:t,name:r,src:n,tenantConfig:i,tinuuid:a,handoff:o,type:s,width:l,widgetSessionToken:c,pageUrl:u}){if(!o)return null;if("floor"===o.destination&&a){let e=new URL(i.ROOM_URL);return e.searchParams.set("type",s),e.searchParams.set("tinuuid",a),e.searchParams.set("name",r),e.searchParams.set("language",t),c&&e.searchParams.set("widgetSessionToken",c),e.toString()}let d=new URL(i.POSTER_URL);return n&&d.searchParams.set("texture",function(e,t){if(!t||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//"))return e;try{return new URL(e,t).href}catch{return e}}(n,u)),d.searchParams.set("texture_width",(100*l).toString()),d.searchParams.set("texture_height",(100*e).toString()),c&&d.searchParams.set("widgetSessionToken",c),d.toString()})({height:u,language:N,name:d,src:A,tenantConfig:O,tinuuid:f,handoff:h,type:l,width:c,widgetSessionToken:M,pageUrl:"u"<typeof window?void 0:window.location.href}),[A,f,h,l,c,u,d,N,O,M]),U=(0,ec.useMemo)(()=>{if(!f)return null;let e=new URL("https://appclip.apple.com/id");return e.searchParams.set("p","com.us.vizbl.Clip"),e.searchParams.set("tinuuid",f),e.toString()},[f]),z=(0,ec.useCallback)(e=>{P.current=e,e&&D.current?.resolve(e)},[]);function G(){D.current=null,L(!1)}async function H(){return g?.getTokenForRequest().catch(()=>g.token)}async function j(){I(await H())}async function V(){if(!g||!f)return"unavailable";let e=new Promise(e=>{window.setTimeout(()=>e("unavailable"),3e3)});return Promise.race([x7(g,{format:MT()?"usdz":"glb",launchId:function(){if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t=Array.from(e,e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}(),tinuuid:f}),e])}let q=async()=>{let e;if(h?.ar==="appclip"){if(!f)return;if(MT()&&U){let e=await H(),t=new URL(U);e&&t.searchParams.set("widgetSessionToken",e),window.location.assign(t.toString());return}await j(),k(!0);return}if(!v.current||F.current)return;F.current=!0;try{e=await function(){if(!D.current){let e,t=new Promise(t=>{e=t});D.current={resolve:e,promise:Promise.resolve().then(r.bind(r,"../../node_modules/.pnpm/@google+model-viewer@4.2.0_three@0.185.1/node_modules/@google/model-viewer/lib/model-viewer.js")).then(()=>(L(!0),t),e=>{throw D.current=null,e})}}return D.current.promise.then(MF)}()}finally{F.current=!1}let t=v.current;if(!t)return void G();if(e.canActivateAR){if(await V()==="payment-required"){G(),p("payment-required");return}try{R(!0);let e=t.clone(!0);if(e.position.set(0,0,0),e.quaternion.identity(),e.updateMatrix(),e.updateMatrixWorld(!0),MT()){e.rotation.set(-Math.PI/2,0,0),e.updateMatrix(),e.updateMatrixWorld(!0);let t=new xg.U,r=await t.parseAsync(e,{ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"vertical"}}}),n=new File([r],"scene.usdz",{type:"model/vnd.usdz+zip"});C(URL.createObjectURL(n))}else{let t=new xf.r,r=await t.parseAsync(e,{binary:!0}),n=new File([r],"scene.glb",{type:"model/gltf-binary"});S(URL.createObjectURL(n))}}catch(e){throw G(),e}finally{R(!1)}}else G(),await j(),k(!0)};if((0,ec.useEffect)(()=>{let e=P.current;return e&&(""!==x||""!==E)&&MN(e).finally(G),()=>{""!==x&&URL.revokeObjectURL(x),""!==E&&URL.revokeObjectURL(E)}},[x,E]),!MP(h,f))return null;let W="appclip"===h.ar;return(0,el.jsxs)("div",{className:Cv(e),...s,children:[(0,el.jsxs)(Cy,{variant:o,size:a,disabled:T,onClick:q,className:t,children:[n,i??b("ar.viewInPlace")]}),(0,el.jsx)(Cw,{open:B,onOpenChange:k,children:(0,el.jsxs)(CS,{className:"gap-6 sm:max-w-120",showCloseButton:!1,portalContainer:m,children:[(0,el.jsx)("div",{className:"flex items-center justify-center p-10 bg-constant-white rounded-2xl",children:(0,el.jsx)(ML,{className:"size-48",robustness:"H",data:Q??""})}),W?(0,el.jsxs)("div",{className:"grid gap-2 text-center",children:[(0,el.jsx)("p",{className:"text-lg text-text-sub font-medium",children:b("ar.appClipScanTitle")}),(0,el.jsx)("p",{className:"text-sm text-text-light",children:b("ar.appClipRequirement")})]}):(0,el.jsx)("p",{className:"text-lg text-center text-text-sub font-medium",children:b("ar.scanQrCode")}),(0,el.jsxs)("p",{className:"text-xs text-center text-text-light",children:[!W&&(0,el.jsxs)(el.Fragment,{children:[b("ar.deviceRequirementsDisclaimer"),(0,el.jsx)("br",{})]}),(0,el.jsx)("a",{href:O.TERMS_URL,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 transition-colors duration-300 hover:text-text-dark",style:{textDecoration:"underline",textUnderlineOffset:"2px"},children:b("legal.termsOfUse")}),b("legal.conjunction"),(0,el.jsx)("a",{href:O.PRIVACY_URL,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 transition-colors duration-300 hover:text-text-dark",style:{textDecoration:"underline",textUnderlineOffset:"2px"},children:b("legal.privacyPolicy")})]}),(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsx)(Cy,{variant:"contrast",size:"lg",children:b("close")})})]})}),_&&(0,el.jsx)("model-viewer",{ref:z,className:"fixed w-px h-px opacity-0 pointer-events-none",src:E,iosSrc:x,reveal:"manual",ar:!0,cameraControls:!0,arPlacement:"wall",arModes:"webxr",arScale:"fixed",shadowIntensity:1,interactionPromptThreshold:100})]})}let MQ={"inline-compact":"h-9 w-full rounded-xl","inline-large":"h-11 w-full rounded-xl"},MU={"inline-compact":"size-5","inline-large":"size-6"},Mz={desktop:"floor-ar-card",tablet:void 0,phone:void 0};function MG({...e}){return(0,el.jsx)(nh,{"data-slot":"select",...e})}function MH({...e}){return(0,el.jsx)(ng,{"data-slot":"select-value",...e})}function Mj({className:e,size:t="default",children:r,...n}){return(0,el.jsxs)(nA,{"data-slot":"select-trigger","data-size":t,className:Cv("flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-background-white shadow-sm outline-none transition-colors cursor-pointer","border-border-medium","text-text-dark","hover:border-border-dark","focus-visible:border-border-dark","aria-invalid:border-border-red","disabled:cursor-not-allowed disabled:border-border-medium disabled:bg-background-base disabled:opacity-40","data-[size=default]:h-11 data-[size=default]:px-2 data-[size=default]:py-2.5 data-[size=default]:typo-base-16","data-[size=md]:h-9 data-[size=md]:px-2 data-[size=md]:py-2 data-[size=md]:typo-base-14","data-[size=sm]:h-[1.875rem] data-[size=sm]:px-2 data-[size=sm]:typo-base-12","*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-6 [&_svg:not([class*=text-])]:text-text-dark",e),...n,children:[r,(0,el.jsx)(nm,{asChild:!0,children:(0,el.jsx)(CD,{className:"size-6"})})]})}function MV({className:e,children:t,position:r="item-aligned",align:n="center",portalContainer:i,...a}){return(0,el.jsx)(nv,{container:i,children:(0,el.jsxs)(ny,{"data-slot":"select-content",className:Cv("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border bg-background-white text-text-dark shadow-md","border-border-medium","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,align:n,...a,children:[(0,el.jsx)(MW,{}),(0,el.jsx)(nT,{className:Cv("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,el.jsx)(MK,{})]})})}function Mq({className:e,children:t,...r}){return(0,el.jsxs)(nO,{"data-slot":"select-item",className:Cv("relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md py-2.5 pe-8 ps-3 outline-hidden","typo-base-16 text-text-sub","focus:bg-background-base focus:text-text-dark","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-6 [&_svg:not([class*=text-])]:text-text-dark","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[(0,el.jsx)("span",{"data-slot":"select-item-indicator",className:"absolute end-2 flex size-6 items-center justify-center",children:(0,el.jsx)(nG,{children:(0,el.jsx)(CT,{className:"size-5"})})}),(0,el.jsx)(nU,{children:t})]})}function MW({className:e,...t}){return(0,el.jsx)(nj,{"data-slot":"select-scroll-up-button",className:Cv("flex cursor-default items-center justify-center py-1",e),...t,children:(0,el.jsx)(dt,{className:"size-4"})})}function MK({className:e,...t}){return(0,el.jsx)(nq,{"data-slot":"select-scroll-down-button",className:Cv("flex cursor-default items-center justify-center py-1",e),...t,children:(0,el.jsx)(dr,{className:"size-4"})})}let MJ=/^[a-z][a-z\d+.-]*:/i;function MY(e,t="m"){switch(t){case"cm":return e/100;case"in":return .0254*e;case"m":return e}}function MX(e,t){switch(t){case"cm":return 100*e;case"in":return e/.0254}}function MZ(e){let{t}=aO();return(0,ec.useMemo)(()=>[{value:0,label:t("mattingOptions.none")},{value:.05,label:`${Number(MX(.05,e).toFixed(2)).toString()} ${t(`units.${e}`)}`}],[e,t])}function M$({label:e,variant:t,size:r,className:n}){let{t:i}=aO(),{displayUnit:a}=En(),{containerRef:o}=Es(),{material:s,options:l,selectMaterial:c}=function(){let{material:e,setMaterial:t,setTinuuid:r,apiKey:n,baseURL:i,language:a,source:o,widgetSession:s}=Eo(),l=sp({queries:Mx({apiKey:n,baseURL:i,language:a,source:o,widgetSession:s})}),c=(0,ec.useMemo)(()=>l.flatMap(e=>{let t=e.data,r=t?.materials?.[0];return t?.tinuuid&&r?.hid?[{material:r,materialId:r.hid,tinuuid:t.tinuuid}]:[]}),[l]),u=(0,ec.useCallback)(e=>{let n=c.find(t=>t.materialId===e);return!!n&&(t(n.material),r(n.tinuuid),!0)},[c,t,r]);return{material:e,options:c,selectMaterial:u}}(),{matting:u,setMatting:d}=Eu(),h=MZ(a),p=(0,ec.useId)(),A=(0,ec.useId)();return(0,el.jsxs)(CY,{modal:!1,children:[(0,el.jsx)(CX,{asChild:!0,children:(0,el.jsxs)(Cy,{type:"button",variant:t,size:r,className:n,children:[(0,el.jsx)(CN,{className:"size-4"}),e]})}),(0,el.jsxs)(C$,{portalContainer:o,collisionBoundary:o,collisionPadding:8,align:"start",className:"flex w-56 max-w-[var(--radix-dropdown-menu-content-available-width)] flex-col",style:{maxHeight:"var(--radix-dropdown-menu-content-available-height)"},children:[(0,el.jsx)(C2,{id:p,children:i("wallArt.pictureFrame")}),(0,el.jsx)(CZ,{"aria-labelledby":p,className:"min-h-0 overflow-y-auto overscroll-contain",children:l.map(e=>(0,el.jsxs)(C1,{indicatorPosition:"right",checked:s?.hid===e.materialId,onCheckedChange:()=>c(e.materialId),onSelect:e=>e.preventDefault(),className:"gap-2 [@media(pointer:coarse)]:min-h-11",children:[(0,el.jsx)("span",{className:"pointer-events-none size-5 shrink-0 rounded-full border border-border-light",style:{backgroundColor:e.material.miniature?.color?.hex?`#${e.material.miniature.color.hex}`:void 0}}),(0,el.jsx)("span",{className:"min-w-0 flex-1",children:e.material.miniature?.color?.name??e.material.name})]},`${e.tinuuid}-${e.materialId}`))}),(0,el.jsx)(C3,{}),(0,el.jsx)(C2,{id:A,children:i("matting")}),(0,el.jsx)(CZ,{"aria-labelledby":A,className:"shrink-0",children:h.map(e=>(0,el.jsx)(C1,{indicatorPosition:"right",checked:u===e.value,onCheckedChange:()=>d(e.value),onSelect:e=>e.preventDefault(),className:"[@media(pointer:coarse)]:min-h-11",children:e.label},e.value))})]})]})}function M0({className:e,...t}){return(0,el.jsx)("div",{"data-slot":"field-group",className:Cv("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",e),...t})}let M1=uE("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function M2({className:e,orientation:t="vertical",...r}){return(0,el.jsx)("div",{role:"group","data-slot":"field","data-orientation":t,className:Cv(M1({orientation:t}),e),...r})}function M3({className:e,...t}){return(0,el.jsx)("div",{"data-slot":"field-label",className:Cv("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function M9({...e}){return(0,el.jsx)(n8,{"data-slot":"popover",...e})}function M4({...e}){return(0,el.jsx)(ie,{"data-slot":"popover-trigger",...e})}function M5({className:e,align:t="center",sideOffset:r=4,portalContainer:n,...i}){return(0,el.jsx)(ia,{container:n,children:(0,el.jsx)(is,{"data-slot":"popover-content",align:t,sideOffset:r,className:Cv("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...i})})}function M8({className:e,defaultValue:t,value:r,min:n=0,max:i=100,variant:a="default","aria-label":o,"aria-labelledby":s,...l}){let c=(0,ec.useMemo)(()=>Array.isArray(r)?r:Array.isArray(t)?t:[n],[r,t,n]);return(0,el.jsxs)(iM,{"data-slot":"slider",defaultValue:t,value:r,min:n,max:i,"data-variant":a,"aria-label":o,"aria-labelledby":s,className:Cv("relative flex w-full touch-none cursor-pointer items-center select-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e),...l,children:[(0,el.jsx)(iD,{"data-slot":"slider-track",className:Cv("relative grow overflow-hidden rounded-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5","editor"===a?"bg-border-light data-[orientation=horizontal]:h-0.5":"bg-muted data-[orientation=horizontal]:h-1.5"),children:(0,el.jsx)(iL,{"data-slot":"slider-range",className:Cv("absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full","editor"===a?"bg-background-blue":"bg-primary")})}),Array.from({length:c.length},(e,t)=>(0,el.jsx)(iN,{"data-slot":"slider-thumb","aria-label":o,"aria-labelledby":s,className:Cv("ring-ring/50 block shrink-0 rounded-full border bg-white transition-[color,box-shadow] focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50","editor"===a?"size-3 border-background-blue shadow-none hover:ring-2 focus-visible:ring-2":"size-4 border-primary shadow-sm hover:ring-4 focus-visible:ring-4")},t))]})}function M6({variant:e,size:t}){let{t:r}=aO(),{containerRef:n}=Es();return(0,el.jsxs)(M9,{children:[(0,el.jsx)(M4,{asChild:!0,children:(0,el.jsxs)(Cy,{type:"button",variant:e,size:t,className:"shrink-0",children:[(0,el.jsx)(CO,{className:"size-4"}),(0,el.jsx)("span",{className:"sr-only",children:r("scene.tunePosition")})]})}),(0,el.jsxs)(M5,{className:"flex flex-col gap-4 border-button-dark bg-button-dark px-3 py-3.5 text-text-white",side:"top",align:"start",portalContainer:n,collisionBoundary:n,collisionPadding:8,children:[(0,el.jsxs)(M0,{children:[(0,el.jsxs)(M2,{orientation:"horizontal",children:[(0,el.jsx)(M3,{children:r("scene.rotation")}),(0,el.jsx)(M7,{gesture:"rotation",min:-180,max:180,"aria-label":r("scene.rotation")})]}),(0,el.jsxs)(M2,{orientation:"horizontal",children:[(0,el.jsx)(M3,{children:r("scene.angle")}),(0,el.jsx)(M7,{gesture:"angle",min:-75,max:75,"aria-label":r("scene.angle")})]})]}),(0,el.jsx)(Ie,{})]})]})}function M7({gesture:e,min:t,max:r,"aria-label":n}){let i=Ec(e),{sceneGestures:{setAngle:a,setRotation:o}}=El(),s="angle"===e?a:o;return(0,el.jsx)(M8,{value:[i],onValueChange:([e])=>s(e??0),min:t,max:r,step:1,className:"w-40.5 **:data-[slot=slider-range]:bg-transparent **:data-[slot=slider-thumb]:border-background-base-3 **:data-[slot=slider-thumb]:bg-background-base-3 **:data-[slot=slider-track]:bg-icons-normal","aria-label":n})}function Ie(){let{t:e}=aO(),t=Ec("rotation"),r=Ec("angle"),{sceneGestures:{setAngle:n,setRotation:i}}=El();return(0,el.jsxs)(Cy,{type:"button",variant:"ghost",size:"sm",className:"w-full text-text-white hover:bg-white/10 hover:text-text-white active:bg-white/20",disabled:0===t&&0===r,onClick:()=>{i(0),n(0)},children:[(0,el.jsx)(CQ,{className:"size-4"}),e("scene.resetPosition")]})}let It={card:"flex min-h-24 w-fit max-w-100 items-center gap-4 rounded-2xl bg-background-containers p-4 text-start text-text-dark shadow-[var(--shadow-login)]","compact-card":"flex min-h-[116px] w-fit max-w-[421px] items-center gap-4 rounded-2xl bg-background-containers p-4 text-start text-text-dark shadow-[var(--shadow-login)]","flow-card":"flex items-center justify-start gap-4 border-b border-border-light bg-background-containers p-4 text-start"},Ir={card:"size-6 text-icons-normal","compact-card":"size-6 text-icons-normal","flow-card":"size-5 text-icons-normal"},In={desktop:"floor-desktop-product-card",tablet:"floor-tablet-product-card",phone:"floor-mobile-product-card"},Ii={default:"icon",sm:"icon-sm",lg:"icon-lg",icon:"icon","icon-sm":"icon-sm","icon-lg":"icon-lg"},Ia={card:"flex h-24 w-[254px] items-center gap-4 overflow-hidden rounded-2xl bg-background-containers p-4 text-start text-text-dark shadow-[var(--shadow-login)]","framed-row":"flex h-[72px] items-center justify-between gap-3 overflow-hidden rounded-2xl bg-background-containers p-4 text-start text-text-dark shadow-[var(--shadow-login)]","plain-row":"flex w-full items-center justify-between gap-3 rounded-full bg-background-containers text-start"},Io={desktop:"floor-room-card",tablet:"floor-tablet-room-card",phone:void 0},Is={desktop:"floor-desktop-room-name",tablet:"floor-tablet-room-name",phone:"floor-mobile-room-name"},Il={"product-card":function({actions:e,band:t,slot:r,presentation:n}){let i,{t:a}=aO(),{displayUnit:o,name:s,type:l}=En(),{containerRef:c}=Es(),{material:u,selectedObject:d,src:h,tinuuid:p}=Eo(),{variantItems:A,selectedTinuuid:f,selectVariant:g,product:m}=Mb(),{materialSource:v,offersReplacement:b,hasPictureFrame:y}=EG(l),w="drag-with-rotation-and-angle"===CW[l].manipulation,x=In[t],C=a(`resourceType.${l}.${n.actionLabelResourceTypeKey}`),E=Cv("w-fit shrink-0","fixed"===n.actionWidth&&"w-[137px]"),S=a(`units.${o}`),M=e.isMaterialSelectionOpen,I=Mv(l,d,u,s,m?.name),B="artwork-src"===v?h:(i=u?.previews?.[0],i?.subRes?.small??i?.url??d?.preview?.subRes?.small??d?.preview?.url??d?.mainPreview),k=A.find(e=>e.tinuuid===f),T=function(e){let t=e?.trim();if(!t||MJ.test(t)&&!/^https?:/i.test(t)||/^[./?#]/.test(t)&&!t.startsWith("//"))return;let r=t.startsWith("//")?`https:${t}`:/^https?:/i.test(t)?t:`https://${t}`;try{let e=new URL(r);if("http:"!==e.protocol&&"https:"!==e.protocol||!e.hostname)return;return e.href}catch{return}}(d?.tinuuid===p?d.destinationUrl:void 0),R=M?e.onMaterialSelectionActionPointerDown:void 0;return(0,el.jsxs)("div",{className:It[n.appearance],"data-chrome-slot":r,"data-neurodyn-room-viewer-product":"","data-testid":x,children:[(0,el.jsx)("div",{className:"grid size-16 shrink-0 place-items-center overflow-hidden bg-background-base",children:B?(0,el.jsx)("img",{src:B,alt:"",className:"size-full min-h-0 object-cover"}):(0,el.jsx)(CL,{className:Ir[n.appearance]})}),(0,el.jsxs)("div",{className:"grid min-h-16 min-w-0 flex-1 grid-cols-1 content-center gap-3",children:[(0,el.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-4",children:[(0,el.jsxs)("div",{className:"min-w-0",children:[(0,el.jsx)("div",{className:"sr-only",children:a(`resourceType.${l}.productCardTitle`)}),(0,el.jsx)("div",{className:"typo-button-normal overflow-x-clip text-ellipsis whitespace-nowrap text-text-dark",children:I})]}),T&&(0,el.jsx)("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"typo-button-normal shrink-0 text-button-primary underline-offset-2 hover:underline","data-testid":`${x}-description-link`,children:a("floor.scene.description")})]}),(0,el.jsxs)("div",{className:"flex flex-nowrap items-center gap-4",children:[b&&(0,el.jsxs)(Cy,{type:"button",variant:n.actionVariant,size:n.actionSize,[Mr]:!0,"aria-expanded":M,className:E,onPointerDown:R?e=>{e.preventDefault(),e.stopPropagation(),R()}:void 0,onClick:M?e.closeMaterialSelection:e.openMaterialSelection,children:[M?(0,el.jsx)(CR,{className:"size-4"}):(0,el.jsx)(CN,{className:"size-4"}),M?a("floor.scene.hideCatalog"):C]}),(y||w)&&(0,el.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[y&&(0,el.jsx)(M$,{label:C,variant:n.actionVariant,size:n.actionSize,className:E}),w&&(0,el.jsx)(M6,{variant:n.actionVariant,size:Ii[n.actionSize]})]}),A.length>1&&!!k&&(0,el.jsxs)(MG,{value:f??void 0,onValueChange:g,children:[(0,el.jsx)(Mj,{size:"sm",className:"ms-auto w-fit min-w-0 shrink data-[size=sm]:h-8 *:data-[slot=select-value]:block *:data-[slot=select-value]:truncate","data-testid":`${x}-variant-select`,children:(0,el.jsx)(MH,{})}),(0,el.jsx)(MV,{portalContainer:c,children:A.map(e=>{var t;let r;return(0,el.jsx)(Mq,{value:e.tinuuid,children:"color"in e?e.color:(t=e.size,r=t.split("\xd7").map(e=>"cm"===o?e:Math.round(MX(Number(e)/100,o)).toString()).join("\xd7"),`${r} ${S}`)},e.tinuuid)})})]})]})]})]})},"room-card":function({actions:e,band:t,slot:r,presentation:n}){let{t:i}=aO(),{room:a}=Ea(),o=i(`rooms.${a.id}`,{defaultValue:a.name}),s=(0,el.jsx)(Cy,{type:"button",variant:n.actionVariant,size:n.actionSize,className:"card"===n.appearance?"w-fit":"shrink-0",onClick:e.openInteriorSelection,children:i(n.actionLabelKey)});return"card"===n.appearance?(0,el.jsxs)("div",{className:Ia[n.appearance],"data-chrome-slot":r,"data-neurodyn-room-viewer-room":"","data-testid":Io[t],children:[(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(a),alt:"",className:"size-16 shrink-0 rounded-lg object-cover"}),(0,el.jsxs)("span",{className:"grid min-w-0 flex-1 content-center gap-3",children:[(0,el.jsx)("span",{className:"typo-button-normal block overflow-x-clip text-ellipsis whitespace-nowrap text-text-dark","data-testid":Is[t],children:o}),s]})]}):(0,el.jsxs)("div",{className:Ia[n.appearance],"data-chrome-slot":r,"data-neurodyn-room-viewer-room":"","data-testid":Io[t],children:[(0,el.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(a),alt:"",className:"size-10 shrink-0 rounded-full object-cover"}),(0,el.jsxs)("span",{className:"grid min-w-0",children:[(0,el.jsx)("span",{className:"typo-base-12 truncate text-text-light",children:i("floor.scene.interiorCardTitle")}),(0,el.jsx)("span",{className:"typo-button-normal overflow-x-clip text-ellipsis whitespace-nowrap text-text-dark","data-testid":Is[t],children:o})]})]}),s]})},"ar-card":function({band:e,slot:t,presentation:r}){let{t:n}=aO(),{room:i}=Ea(),{type:a}=En(),{tinuuid:o}=Eo();return MP(CW[a].handoff,o)?"card"===r.appearance?(0,el.jsxs)("div",{className:"flex h-24 w-[280px] items-center gap-4 overflow-hidden rounded-2xl bg-background-containers p-4 text-text-dark shadow-[var(--shadow-login)]","data-chrome-slot":t,"data-neurodyn-room-viewer-try-at-home":"","data-testid":Mz[e],children:[(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(i),alt:"",className:"size-16 shrink-0 rounded-lg object-cover"}),(0,el.jsxs)("div",{className:"grid min-w-0 flex-1 content-center gap-2",children:[(0,el.jsx)(MO,{buttonLabel:n(r.actionLabelKey),buttonVariant:r.actionVariant,buttonSize:r.actionSize,buttonClassName:"w-fit"}),(0,el.jsx)("div",{className:"typo-base-12 truncate font-medium text-text-light",children:n("floor.scene.tryAtHomeBody")})]})]}):(0,el.jsx)(MO,{className:"w-full","data-chrome-slot":t,"data-neurodyn-room-viewer-try-at-home":"",buttonLabel:n(r.actionLabelKey),buttonLeadingIcon:(0,el.jsx)(Cz,{className:MU[r.appearance]}),buttonVariant:r.actionVariant,buttonSize:r.actionSize,buttonClassName:MQ[r.appearance]}):null}},Ic={"immersive-default":{desktop:[{slot:"product-card",container:"leading",appearance:"card",actionLabelResourceTypeKey:"replaceProduct",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"leading",appearance:"card",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"card",actionLabelKey:"floor.scene.tryAtHome",actionVariant:"secondary",actionSize:"sm"}],tablet:[{slot:"product-card",container:"leading",appearance:"compact-card",actionLabelResourceTypeKey:"replaceProduct",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"framed-row",actionLabelKey:"floor.interiorSelection.chooseInteriorShort",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"inline-compact",actionLabelKey:"floor.scene.tryAtHome",actionVariant:"secondary",actionSize:"default"}],phone:[{slot:"product-card",container:"leading",appearance:"flow-card",actionLabelResourceTypeKey:"replaceProductShort",actionVariant:"outline",actionSize:"sm",actionWidth:"fixed"},{slot:"room-card",container:"trailing",appearance:"plain-row",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"inline-large",actionLabelKey:"floor.scene.tryAtHome",actionVariant:"secondary",actionSize:"lg"}]},"immersive-panels":{desktop:[{slot:"product-card",container:"leading",appearance:"card",actionLabelResourceTypeKey:"replaceProduct",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"leading",appearance:"card",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"}],tablet:[{slot:"product-card",container:"leading",appearance:"compact-card",actionLabelResourceTypeKey:"replaceProduct",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"framed-row",actionLabelKey:"floor.interiorSelection.chooseInteriorShort",actionVariant:"outline",actionSize:"sm"}],phone:[{slot:"product-card",container:"leading",appearance:"flow-card",actionLabelResourceTypeKey:"replaceProductShort",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"plain-row",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"}]},"immersive-wallart":{desktop:[{slot:"product-card",container:"leading",appearance:"card",actionLabelResourceTypeKey:"appearance",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"leading",appearance:"card",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"card",actionLabelKey:"ar.viewInPlace",actionVariant:"secondary",actionSize:"sm"}],tablet:[{slot:"product-card",container:"leading",appearance:"compact-card",actionLabelResourceTypeKey:"appearance",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"framed-row",actionLabelKey:"floor.interiorSelection.chooseInteriorShort",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"inline-compact",actionLabelKey:"ar.viewInPlace",actionVariant:"secondary",actionSize:"default"}],phone:[{slot:"product-card",container:"leading",appearance:"flow-card",actionLabelResourceTypeKey:"appearance",actionVariant:"outline",actionSize:"sm",actionWidth:"auto"},{slot:"room-card",container:"trailing",appearance:"plain-row",actionLabelKey:"floor.interiorSelection.chooseInterior",actionVariant:"outline",actionSize:"sm"},{slot:"ar-card",container:"trailing",appearance:"inline-large",actionLabelKey:"ar.viewInPlace",actionVariant:"secondary",actionSize:"lg"}]}};function Iu({actions:e,band:t,entry:r}){let n=Il[r.slot];return(0,el.jsx)(n,{actions:e,band:t,slot:r.slot,presentation:r})}function Id({actions:e,band:t,container:r}){let{type:n}=En(),i=Ic[CW[n].presentation];return(0,el.jsx)(el.Fragment,{children:i[t].filter(e=>e.container===r).map(r=>(0,el.jsx)(Iu,{actions:e,band:t,entry:r},r.slot))})}async function Ih(e,t={}){let r=t.source??"default",n={image:e};if(Cr({apiKey:t.apiKey,source:r})){let e=await t.widgetSession?.getTokenForRequest();return x3(n,{baseURL:t.baseURL,headers:{"x-api-key":t.apiKey,...e?{[Ca]:e}:{}},signal:t.signal,timeout:0,params:{productType:Cn({apiKey:t.apiKey,source:r,resourceType:t.resourceType})}})}return t.signal?xW(n,{signal:t.signal,timeout:0}):xW(n,{timeout:0})}let Ip=[{id:0,label:"empty",rgb:[0,0,0]},{id:1,label:"floor",rgb:[32,208,96]},{id:2,label:"wall-1",rgb:[255,59,48]},{id:3,label:"wall-2",rgb:[10,132,255]},{id:4,label:"ceiling",rgb:[255,214,10]},{id:5,label:"plane-5",rgb:[191,90,242]},{id:6,label:"plane-6",rgb:[255,159,10]},{id:7,label:"plane-7",rgb:[100,210,255]},{id:8,label:"plane-8",rgb:[255,45,85]}];function IA(){try{return"1"===window.localStorage.getItem("neurodyn-room-viewer:debug-mask-export")}catch{return!1}}async function If(e,t){var r,n,i;let a,o,s,l,c=await (r=e.planeIds.dataPng,new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>t(Error("Failed to load room plane id mask image.")),n.crossOrigin="anonymous",n.src=r})),u=e.planeIds.width||c.naturalWidth||c.width,d=e.planeIds.height||c.naturalHeight||c.height,h=document.createElement("canvas"),p=h.getContext("2d",{willReadFrequently:!0});if(!p)throw Error("Failed to prepare room plane mask canvas.");h.width=u,h.height=d,p.drawImage(c,0,0,u,d);let A=p.getImageData(0,0,u,d),f=document.createElement("canvas"),g=f.getContext("2d");if(!g)throw Error("Failed to prepare room debug mask canvas.");f.width=u,f.height=d;for(let e=0;e<u*d;e++){let t=4*e,r=function(e){return Ip.find(t=>t.id===e)??{id:e,label:`plane-${e}`,rgb:[73*e%255,151*e%255,211*e%255]}}(A.data[t]??0);A.data[t]=r.rgb[0],A.data[t+1]=r.rgb[1],A.data[t+2]=r.rgb[2],A.data[t+3]=255}g.putImageData(A,0,0),n=await new Promise((e,t)=>{f.toBlob(r=>{r?e(r):t(Error("Failed to export room plane mask image."))},"image/png")}),o=Array.from((a=t.lastIndexOf("."))>0?t.slice(0,a):t).map(e=>{let t=e.charCodeAt(0),r="."===e||"_"===e||"-"===e;return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||r?e:"-"}).join("").split("-").filter(Boolean).join("-"),i=`${o||"room"}.debug-mask.colors.png`,s=URL.createObjectURL(n),(l=document.createElement("a")).href=s,l.download=i,l.style.display="none",document.body.append(l),l.click(),l.remove(),window.setTimeout(()=>URL.revokeObjectURL(s),1e3)}let Ig="custom-interiors";function Im(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?`custom-interior-${crypto.randomUUID()}`:`custom-interior-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Iv(){let e="u"<typeof indexedDB?null:indexedDB;return e?new Promise((t,r)=>{let n=e.open("neurodyn-floor-custom-interiors",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(Ig)||e.createObjectStore(Ig,{keyPath:"id"})},n.onerror=()=>r(n.error??Error("Failed to open Custom Interior store.")),n.onsuccess=()=>t(n.result)}):Promise.resolve(null)}async function Ib(e,t,r=new Date){let n=await Iv();if(!n)return null;let i={id:Im(),schemaVersion:1,name:e.name,fileName:e.name,createdAt:r.toISOString(),imageBlob:e,scene:t};try{let e=n.transaction(Ig,"readwrite");return e.objectStore(Ig).put(i),await new Promise((t,r)=>{e.oncomplete=()=>t(),e.onerror=()=>r(e.error??Error("Custom Interior transaction failed.")),e.onabort=()=>r(e.error??Error("Custom Interior transaction aborted."))}),i}finally{n.close()}}async function Iy(){let e=await Iv();if(!e)return[];try{return await new Promise((t,r)=>{let n=e.transaction(Ig,"readonly").objectStore(Ig).getAll();n.onerror=()=>r(n.error??Error("Failed to read Custom Interiors.")),n.onsuccess=()=>{let e=n.result.filter(e=>1===e.schemaVersion).sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt));t(e)}})}finally{e.close()}}function Iw(e){let t=[];return{rooms:e.map(e=>{let r=URL.createObjectURL(e.imageBlob);return t.push(r),{id:e.id,name:e.name,image_url:r,scene:e.scene}}),revokeObjectUrls:()=>{for(let e of t)URL.revokeObjectURL(e);t.length=0}}}function Ix(e){let t="dialog"===e?"interior-selection":"scene";return{step:t,hasSceneSelection:"scene"===t,sceneResetKey:0}}function IC(e,t){switch(t.type){case"clear-interior-selection":return{...e,step:"interior-selection",hasSceneSelection:!1,automaticRoomId:t.automaticRoomId};case"select-initial-room":return{step:"scene",hasSceneSelection:!0,sceneResetKey:e.sceneResetKey+1,automaticRoomId:t.roomId};case"open-interior-selection":case"return-to-interior-selection":return{...e,step:"interior-selection"};case"dismiss-interior-selection":case"recover-to-scene":return e.hasSceneSelection?{...e,step:"scene"}:e;case"start-custom-interior-processing":return{...e,step:"processing-custom-interior"};case"commit-interior-selection":return{step:"scene",hasSceneSelection:!0,sceneResetKey:e.sceneResetKey+1}}}function IE(e,t){return!e.aborted&&t()}class IS extends Error{constructor(){super("Room Photo has a Missing Surface."),this.name="CustomInteriorMissingSurfaceError"}}async function IM({abortSignal:e,apiOptions:t,commitCustomInteriorSelection:r,downloadDebugMask:n,file:i,isActive:a,isDebugMaskExportEnabled:o,onDebugMaskError:s,onPersistenceError:l,onProcessingComplete:c,predictRoomScene:u,saveCustomInterior:d,surfaces:h,trackRuntimeCustomInterior:p,waitForProcessingCompletion:A}){let f=await u(i,{...t,signal:e});if(!IE(e,a))return null;if(o()&&n(f,i.name).catch(s),Sc(f,h))throw Su({planes:f.planes,source:"room-photo-upload",surfaces:h}),new IS;let g=p(i,f);return IE(e,a)&&g&&(d(i,f).catch(l),c(),await A(),IE(e,a))?(r(g),g):null}function II(){return new Promise(e=>window.setTimeout(e,250))}function IB(e){console.error("Failed to export room debug mask",e)}function Ik(e){console.error("Failed to persist Custom Interior",e)}function IT(e){console.error("Failed to prepare Custom Interior",e)}function IR({showDialogCloseButton:e=!1}){let{t}=aO(),{name:r,type:n}=En(),{missingSurfaceMessage:i}=CW[n],{accessError:a,glbUrl:o,apiKey:s,baseURL:l,hasRooms:c,source:u,widgetSession:d,isViewerAccessPending:h,loadError:p,selectedObject:A,tinuuid:f}=Eo(),{clearActiveError:g,handleAccessError:m}=function(){let{setAccessError:e,setLoadError:t}=Eo();return{clearActiveError:(0,ec.useCallback)(()=>{e(null),t(null)},[e,t]),handleAccessError:e}}(),{room:v,sourceRooms:b}=Ea(),{resourceRef:y,containerRef:w,setContainerRef:x,sceneLoad:C,isRoomScenePending:E}=Es(),{dialogPortalContainer:S,viewerSurface:M,viewerDialogOpen:I,onViewerDialogOpenChange:B}=Ei(),[k,T]=(0,ec.useState)(!1),[R,P]=(0,ec.useState)(!1),D=(0,ec.useRef)(null),_=(0,ec.useRef)(!1),L=a??p,F=!!L,N=A?.owner?.name??A?.brand??null,{canShare:O,download:Q,isDownloading:U,isSharing:z,share:G}=function({captureRef:e,fallbackToClipboard:t=!1,fileName:r="room-scene.png",shareMessage:n}){let[i,a]=(0,ec.useState)(!1),[o,s]=(0,ec.useState)(!1),l=(0,ec.useMemo)(()=>"u">typeof navigator&&"function"==typeof navigator.share||t&&"u">typeof navigator&&"function"==typeof navigator.clipboard?.writeText,[t]),c=(0,ec.useCallback)(async()=>{if(!l)return;let i="u">typeof navigator&&"function"==typeof navigator.share,o=window.location.href,s=`${n}
|
|
7290
7290
|
${o}`;a(!0);try{if(!i&&t)return void await S5(s);let n=e.current;if(n)try{let e=await n.capture(),t=new File([e],r,{type:e.type||"image/png"});if(navigator.canShare?.({files:[t]}))return void await navigator.share({text:s,files:[t]})}catch(e){console.error("Failed to generate scene screenshot for sharing",e)}await navigator.share({text:s,url:o})}catch(e){e instanceof DOMException&&"AbortError"===e.name||console.error("Failed to share scene",e)}finally{a(!1)}},[l,e,t,r,n]);return{canShare:l,download:(0,ec.useCallback)(async()=>{let t=e.current;if(t){s(!0);try{var n;let e,i;n=await t.capture(),e=URL.createObjectURL(n),(i=document.createElement("a")).href=e,i.download=r,document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(e)}catch(e){console.error("Failed to download scene screenshot",e)}finally{s(!1)}}},[e,r]),isDownloading:o,isSharing:i,share:c}}({captureRef:D,fallbackToClipboard:!0,shareMessage:t(`shareMessage.${n}`)}),H=(0,ec.useCallback)(()=>{T(!1),P(!1)},[]),j=(0,ec.useCallback)(()=>{if(_.current){_.current=!1;return}T(!0),P(!1)},[]),V=(0,ec.useCallback)(()=>{_.current=!0,H()},[H]),q=(0,ec.useCallback)(()=>{P(!0),T(!1)},[]),W=function({activeError:e,apiKey:t,baseURL:r,clearActiveError:n,closeMaterialSelection:i,glbUrl:a,handleAccessError:o,hasDialogPortalContainer:s,hasRooms:l,isRoomScenePending:c,isViewerAccessPending:u,onViewerDialogOpenChange:d,resourceType:h,sceneLoad:p,source:A,sourceRooms:f,viewerDialogOpen:g,viewerSurface:m,widgetSession:v}){let b=function(e){let{initialRoomId:t,room:r,sourceRooms:n}=Ea(),{isViewerAccessPending:i,loadError:a,setLoadError:o}=Eo(),{type:s}=En(),{patchSceneLoad:l,sceneGestures:{setAngle:c,setRotation:u}}=El(),d=(0,ec.useMemo)(()=>({patchSceneLoad:l,setAngle:c,setRotation:u}),[l,c,u]),h=n.find(e=>e.id===t),p=!!h&&(!h?.scene||Sl(h.scene,CK(s)).length>0),A=function(e,t,r){let[n,i]=(0,ec.useReducer)(IC,e,Ix),[a,o]=(0,ec.useState)();!r?.isPending&&a!==r?.roomId&&(o(r?.roomId),r&&i(r.isAvailable?{type:"select-initial-room",roomId:r.roomId}:{type:"clear-interior-selection"}));let s=(0,ec.useCallback)(e=>{e(),function({patchSceneLoad:e,setAngle:t,setRotation:r}){t(0),r(0),e(S0)}(t),i({type:"commit-interior-selection"})},[t]),l=(0,ec.useCallback)(()=>{i({type:"dismiss-interior-selection"})},[]),c=(0,ec.useCallback)(()=>{i({type:"open-interior-selection"})},[]),u=(0,ec.useCallback)(()=>{i({type:"recover-to-scene"})},[]),d=(0,ec.useCallback)(()=>{i({type:"return-to-interior-selection"})},[]),h=(0,ec.useCallback)(()=>{i({type:"clear-interior-selection",automaticRoomId:n.automaticRoomId})},[n.automaticRoomId]),p=(0,ec.useCallback)(()=>{i({type:"start-custom-interior-processing"})},[]);return(0,ec.useMemo)(()=>({...n,commitInteriorSelection:s,dismissInteriorSelection:l,openInteriorSelection:c,recoverToScene:u,returnToInteriorSelection:d,clearInteriorSelection:h,startCustomInteriorProcessing:p}),[s,l,c,u,d,h,p,n])}(e,d,t?{roomId:t,isAvailable:p,isPending:i}:void 0),{automaticRoomId:f,clearInteriorSelection:g}=A;return(0,ec.useEffect)(()=>{f&&r.id===f&&C9(a)&&(g(),o(null))},[f,g,a,r.id,o]),A}(m),y=CK(h),{appendRuntimeCustomInterior:w,customRooms:x}=function({listCustomInteriors:e,surfaces:t}){let{appendRuntimeCustomInterior:r,customRooms:n,replaceRuntimeCustomInteriors:i}=function(){let[e,t]=(0,ec.useState)(()=>[]),r=(0,ec.useRef)(null),n=(0,ec.useCallback)(e=>{r.current?.revokeObjectUrls();let n=Iw(e);return r.current=n,t(n.rooms),n.rooms},[]),i=(0,ec.useCallback)((e,n)=>{let i=Iw([{id:Im(),schemaVersion:1,name:e.name,fileName:e.name,createdAt:new Date().toISOString(),imageBlob:e,scene:n}]),a=i.rooms[0];if(!a)return i.revokeObjectUrls(),null;let o=r.current;return r.current={rooms:[],revokeObjectUrls:()=>{o?.revokeObjectUrls(),i.revokeObjectUrls()}},t(e=>[a,...e.filter(e=>e.id!==a.id)]),a},[]);return(0,ec.useEffect)(()=>()=>{r.current?.revokeObjectUrls()},[]),(0,ec.useMemo)(()=>({appendRuntimeCustomInterior:i,customRooms:e,replaceRuntimeCustomInteriors:n}),[i,e,n])}(),a=(0,ec.useRef)(!0);(0,ec.useEffect)(()=>(a.current=!0,()=>{a.current=!1}),[]);let o=(0,ec.useCallback)(async()=>{let r=await e();a.current&&i(r.filter(e=>!Sc(e.scene,t)))},[e,i,t]);return(0,ec.useEffect)(()=>{o()},[o]),(0,ec.useMemo)(()=>({appendRuntimeCustomInterior:r,customRooms:n,replaceRuntimeCustomInteriors:i,refreshCustomInteriors:o}),[r,n,o,i])}({listCustomInteriors:Iy,surfaces:y}),C=(0,ec.useMemo)(()=>new Set(f.map(e=>e.id)),[f]),{commitCustomInteriorSelection:E,selectInterior:S}=function(e){let{room:t,setRoomId:r,setRooms:n}=Ea(),{productRef:i,widgetSession:a}=Eo();return function({floorFlow:e,customRooms:t,selectedRoomId:r,onInteriorSelected:n,restoreSourceRooms:i,setRoomId:a,setRooms:o}){let s=(0,ec.useCallback)(t=>{e.commitInteriorSelection(()=>{o(e=>[t,...i(e).filter(e=>e.id!==t.id)]),a(t.id)}),n?.()},[e,n,i,a,o]),l=(0,ec.useCallback)(t=>{let s=t===r;s&&e.hasSceneSelection||(e.commitInteriorSelection(()=>{o(i),a(t)}),s||n?.())},[e,n,i,r,a,o]),c=(0,ec.useCallback)(n=>{if(n===r&&e.hasSceneSelection)return;let i=t.find(e=>e.id===n);i&&s(i)},[e.hasSceneSelection,s,t,r]),u=(0,ec.useCallback)(e=>{t.some(t=>t.id===e)?c(e):l(e)},[t,c,l]);return(0,ec.useMemo)(()=>({commitCustomInteriorSelection:s,selectInterior:u}),[s,u])}({...e,selectedRoomId:t.id,onInteriorSelected:()=>Cc(a,"interior_selected",{productRef:i}),setRoomId:r,setRooms:n})}({floorFlow:b,customRooms:x,restoreSourceRooms:(0,ec.useCallback)(e=>[...f,...e.filter(e=>!C.has(e.id))],[C,f])}),M=function(e){let{setIsRoomScenePending:t}=El();return function({apiOptions:e,floorFlow:t,commitCustomInteriorSelection:r,downloadDebugMask:n,isDebugMaskExportEnabled:i,onAccessError:a,onDebugMaskError:o,onPersistenceError:s,onProcessingError:l,predictRoomScene:c,saveCustomInterior:u,setIsRoomScenePending:d,surfaces:h,trackRuntimeCustomInterior:p,waitForProcessingCompletion:A}){let[f,g]=(0,ec.useState)(!1),[m,v]=(0,ec.useState)(!1),[b,y]=(0,ec.useState)(null),[w,x]=(0,ec.useState)(null),[C,E]=(0,ec.useState)(!1),[S,M]=(0,ec.useState)(0),I=(0,ec.useRef)(null),B=(0,ec.useRef)(!1),k=(0,ec.useRef)(!0),T=(0,ec.useRef)(b);b&&(T.current=b),(0,ec.useEffect)(()=>(k.current=!0,()=>{k.current=!1,I.current?.abort()}),[]);let R=(0,ec.useCallback)(()=>{y(null),x(null),E(!1)},[]),P=(0,ec.useCallback)(e=>{R(),g(!1),e()},[R]),D=(0,ec.useCallback)(async f=>{if(R(),!f.type.startsWith("image/"))return void g(!0);g(!1),v(!1),t.startCustomInteriorProcessing(),B.current=!0;let m=new AbortController;I.current?.abort(),I.current=m,d(!0);try{await IM({abortSignal:m.signal,apiOptions:e,commitCustomInteriorSelection:r,downloadDebugMask:n,file:f,isActive:()=>k.current,isDebugMaskExportEnabled:i,onDebugMaskError:o,onPersistenceError:s,onProcessingComplete:()=>{v(!0)},predictRoomScene:c,saveCustomInterior:u,surfaces:h,trackRuntimeCustomInterior:p,waitForProcessingCompletion:A})}catch(r){if(m.signal.aborted)return;let e=x6(r);if(e){B.current&&E(!0),a(e);return}let t=r instanceof IS?"custom-interior-missing-surface":"custom-interior-processing";if("custom-interior-processing"===t&&l(r),B.current){x(t),E(!0);return}y(t)}finally{I.current===m&&(I.current=null,k.current&&d(!1))}},[e,t,r,n,i,a,o,s,l,c,R,u,d,h,p,A]),_=(0,ec.useCallback)(()=>{R(),g(!1),t.returnToInteriorSelection(),M(e=>e+1)},[t,R]),L=(0,ec.useCallback)(()=>{R(),t.returnToInteriorSelection()},[t,R]),F=(0,ec.useCallback)(({clearError:e,closeMaterialSelection:r})=>{e(),r(),t.hasSceneSelection&&t.recoverToScene()},[t]),N=(0,ec.useCallback)(()=>{B.current=!1,E(!1),w&&(y(w),x(null))},[w]),O=(0,ec.useCallback)(()=>k.current,[]);return(0,ec.useMemo)(()=>({displayedUploadError:b??T.current,isCustomInteriorProcessingComplete:m,isInvalidFile:f,isMounted:O,isProcessingDialogClosingForError:C,pendingUploadError:w,uploadError:b,uploadRetryRequestId:S,cancelUploadError:L,handleProcessingDialogCloseAnimationEnd:N,openInteriorSelection:P,processUploadFile:D,recoverFromActiveError:F,resetUploadErrorPresentation:R,tryUploadAgain:_}),[L,N,m,f,O,C,P,w,D,F,R,_,b,S])}({...e,setIsRoomScenePending:t})}({apiOptions:(0,ec.useMemo)(()=>({resourceType:h,apiKey:t,baseURL:r,source:A,widgetSession:v}),[t,r,h,A,v]),floorFlow:b,commitCustomInteriorSelection:E,downloadDebugMask:If,isDebugMaskExportEnabled:IA,onAccessError:o,onDebugMaskError:IB,onPersistenceError:Ik,onProcessingError:IT,predictRoomScene:Ih,saveCustomInterior:Ib,surfaces:y,trackRuntimeCustomInterior:w,waitForProcessingCompletion:II}),{dismissInteriorSelection:I,hasSceneSelection:B,openInteriorSelection:k,sceneResetKey:T,step:R}=b,{cancelUploadError:P,displayedUploadError:D,handleProcessingDialogCloseAnimationEnd:_,isCustomInteriorProcessingComplete:L,isInvalidFile:F,isProcessingDialogClosingForError:N,openInteriorSelection:O,pendingUploadError:Q,processUploadFile:U,recoverFromActiveError:z,resetUploadErrorPresentation:G,tryUploadAgain:H,uploadError:j,uploadRetryRequestId:V}=M,q=l&&B,W=(0,ec.useRef)(e),K=!!(e&&q&&a);e&&(W.current=e);let J=(0,ec.useCallback)(()=>{q&&(G(),I())},[I,q,G]),Y=(0,ec.useCallback)(()=>{i(),O(k)},[i,k,O]),X=(0,ec.useCallback)(()=>{z({clearError:n,closeMaterialSelection:i})},[n,i,z]),Z=(0,ec.useCallback)(()=>{n(),Y()},[n,Y]),$=(0,ec.useCallback)(e=>{if(!e){if(q)return void J();d?.(!1)}},[J,q,d]),ee=(0,ec.useCallback)(e=>{if(!e){if(K)return void X();d?.(!1)}},[K,X,d]),et=(0,ec.useCallback)(e=>{e||P()},[P]);!function({fallbackMs:e,handleProcessingDialogCloseAnimationEnd:t,isProcessingDialogClosingForError:r}){(0,ec.useEffect)(()=>{if(!r)return;let n=window.setTimeout(t,e);return()=>window.clearTimeout(n)},[e,t,r])}({fallbackMs:220,handleProcessingDialogCloseAnimationEnd:_,isProcessingDialogClosingForError:N});let er=function({activeError:e,canRecoverFromActiveError:t,floorFlow:r,hasDialogPortalContainer:n,hasRooms:i,isProcessingDialogClosingForError:a,isRoomScenePending:o,isViewerAccessPending:s,pendingUploadError:l,sceneLoad:c,uploadError:u,viewerDialogOpen:d,viewerSurface:h}){let p="dialog"===h&&n,A=!p||d,f=i&&r.hasSceneSelection,g=i||"scene"!==r.step?r.step:"interior-selection",m=!s&&f&&(!e||t),v=f||p,b=!s&&!e&&v,y=!s&&!e&&!v&&"interior-selection"===g;return{activeErrorDialog:{open:!a&&!!e&&A,showCloseButton:!t},interiorSelection:{open:b&&"interior-selection"===g&&A,presentation:b?"dialog":y?"screen":null,shouldRender:b||y},processingDialog:{open:!e&&!u&&!l&&o&&"processing-custom-interior"===r.step&&A},scene:{isLoading:o||!(S$(c)&&c.shadersReady),resetKey:r.sceneResetKey,shouldRender:m,shouldRenderDialog:m},surface:{usesSiblingDialogFlow:p},uploadErrorDialog:{open:!a&&!e&&!!u&&A}}}({activeError:e,canRecoverFromActiveError:K,floorFlow:{hasSceneSelection:B,sceneResetKey:T,step:R},hasDialogPortalContainer:s,hasRooms:l,isProcessingDialogClosingForError:N,isRoomScenePending:c,isViewerAccessPending:u,pendingUploadError:Q,sceneLoad:p,uploadError:j,viewerDialogOpen:g,viewerSurface:m});return{...er,activeErrorDialog:{...er.activeErrorDialog,onCancel:K?X:void 0,onOpenChange:ee,onTryAgain:"room-missing-surface"===e?Z:K?X:void 0,variant:e??W.current},customRooms:x,interiorSelection:{...er.interiorSelection,isInvalidFile:F,onOpenChange:$,onSelectRoom:S,onUploadFile:U,openFromScene:Y,uploadRetryRequestId:V},sourceRooms:f,processingDialog:{...er.processingDialog,isComplete:L,onCloseAnimationEnd:_,onOpenChange:er.surface.usesSiblingDialogFlow?d:void 0},step:R,uploadErrorDialog:{...er.uploadErrorDialog,onCancel:P,onOpenChange:et,onTryAgain:H,variant:D}}}({activeError:L,apiKey:s,baseURL:l,clearActiveError:g,closeMaterialSelection:H,glbUrl:o,handleAccessError:m,hasDialogPortalContainer:null!==S,hasRooms:c,isRoomScenePending:E,isViewerAccessPending:h,onViewerDialogOpenChange:B,resourceType:n,sceneLoad:C,source:u,sourceRooms:b,viewerDialogOpen:I,viewerSurface:M,widgetSession:d}),K=(0,ec.useRef)(null),J=!S8(W.scene.isLoading,K,{fadedOutIfMountedLoaded:!0}),Y=S8(W.scene.isLoading||!W.scene.shouldRender||!I,K),X=Ex(),{pending:Z,finish:$}=function(e,t,r){let[n,i]=(0,ec.useState)({open:e,pending:e&&t,sceneKey:r});n.open!==e?i({open:e,pending:e&&t,sceneKey:r}):n.sceneKey!==r?i({...n,sceneKey:r,pending:n.pending&&null===n.sceneKey}):n.pending&&!t&&i({...n,pending:!1});let a=(0,ec.useCallback)(()=>i(e=>({...e,pending:!1})),[]);return{pending:e&&n.pending,finish:a}}(I,CV("(max-width: 639px)")&&"focus-resource"===CW[n].introduction,W.scene.shouldRender?`${W.scene.resetKey}:${f??""}`:null),ee=X?.select,et=(0,ec.useCallback)(()=>{$(),ee?.("0,0")},[$,ee]),er=(0,ec.useMemo)(()=>Z?{ready:Y,target:y,onComplete:et,onCancel:$}:void 0,[Z,et,$,Y,y]),en=W.interiorSelection.openFromScene,ei=(0,ec.useCallback)(()=>{H(),en()},[H,en]),ea=(0,ec.useMemo)(()=>({isMaterialSelectionOpen:k,openMaterialSelection:j,closeMaterialSelection:H,onMaterialSelectionActionPointerDown:V,openInteriorSelection:ei}),[H,V,ei,j,k]),eo=(0,ec.useMemo)(()=>({isMaterialSelectionOpen:R,openMaterialSelection:q,closeMaterialSelection:H,openInteriorSelection:ei}),[H,ei,q,R]);(0,ec.useEffect)(()=>{if(k)return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)};function e(e){var t;(t=e.target)instanceof Element&&t.closest(`[${Mr}], [${Mn}]`)||T(!1)}function t(e){"Escape"===e.key&&T(!1)}},[k]);let es=W.surface.usesSiblingDialogFlow?S:w,eu=(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)("div",{className:"absolute inset-0 bg-constant-black","data-testid":"floor-scene-background-base"}),(0,el.jsx)("div",{"aria-hidden":!0,className:"absolute top-[-52px] right-[-1.36%] bottom-[-52px] left-[-1.36%] blur-[40px]","data-testid":"floor-blur-background",children:(0,el.jsx)("img",{crossOrigin:"anonymous",src:CJ(v),alt:"",className:"block size-full max-w-none object-cover object-center opacity-50"})}),(0,el.jsxs)("div",{className:"pointer-events-none absolute top-0 end-0 start-0 z-20 flex min-h-22 items-start justify-between gap-4 bg-linear-to-b from-black/75 via-black/35 to-transparent px-4 pt-4 pb-8 text-constant-white sm:px-6 lg:min-h-25 lg:pt-6",children:[(0,el.jsx)("div",{className:"min-w-0 pt-1",children:N?(0,el.jsx)("h1",{"data-testid":"floor-scene-header-company",className:"typo-base-16 truncate font-medium lg:typo-base-18",children:N}):null}),(0,el.jsxs)("div",{className:"pointer-events-auto inline-flex shrink-0 items-center gap-2",children:[(0,el.jsxs)(Cy,{type:"button",variant:"secondary","aria-label":t("floor.scene.share"),"data-neurodyn-room-viewer-share":"",disabled:!O||z,onClick:G,className:"size-10 rounded-full px-0 lg:h-9 lg:w-auto lg:rounded-xl lg:px-3.5",children:[(0,el.jsx)(CU,{className:"size-5"}),(0,el.jsx)("span",{className:"hidden lg:inline",children:t("floor.scene.share")})]}),(0,el.jsxs)(Cy,{type:"button",variant:"secondary","aria-label":t("floor.scene.download"),"data-neurodyn-room-viewer-download":"",disabled:U,onClick:Q,className:"size-10 rounded-full px-0 lg:h-9 lg:w-auto lg:rounded-xl lg:px-3.5",children:[(0,el.jsx)(CP,{className:"size-5"}),(0,el.jsx)("span",{className:"hidden lg:inline",children:t("floor.scene.download")})]}),e&&(0,el.jsx)(CC,{asChild:!0,children:(0,el.jsxs)(Cy,{type:"button",variant:"secondary","aria-label":t("close"),className:"size-10 rounded-full px-0 lg:h-9 lg:w-auto lg:rounded-xl lg:px-3.5",children:[(0,el.jsx)("span",{className:"hidden lg:inline",children:t("close")}),(0,el.jsx)(CR,{className:"!size-5"})]})})]})]}),(0,el.jsxs)("div",{className:"relative z-10 size-full min-h-0 min-w-0","data-testid":"floor-scene-viewport",children:[(0,el.jsx)(S4,{contentKey:W.scene.resetKey,introduction:er,captureRef:D,className:"relative z-10 size-full min-h-0"}),(0,el.jsx)("div",{"aria-hidden":!W.scene.isLoading,className:Cv("absolute inset-0 z-10 flex items-center justify-center bg-radial from-background-containers to-background-base-2 transition-opacity",W.scene.isLoading?"opacity-100 pointer-events-auto duration-0":"opacity-0 pointer-events-none duration-250ms"),ref:K,"data-testid":"floor-scene-loader",style:{transitionDuration:W.scene.isLoading?"0ms":"250ms"},children:J&&(0,el.jsx)(CH,{variant:"logo"})})]}),(0,el.jsxs)("div",{className:"pointer-events-none absolute end-6 bottom-6 start-6 z-20 hidden items-end justify-between gap-4 lg:flex","data-testid":"floor-desktop-cards",children:[(0,el.jsx)("div",{className:"pointer-events-auto flex min-w-0 items-stretch gap-3",children:(0,el.jsx)(Id,{actions:ea,band:"desktop",container:"leading"})}),(0,el.jsx)("div",{className:"pointer-events-auto",children:(0,el.jsx)(Id,{actions:ea,band:"desktop",container:"trailing"})})]}),(0,el.jsxs)("div",{className:"pointer-events-none absolute end-6 bottom-6 start-6 z-20 hidden items-end justify-between gap-2 sm:flex lg:hidden","data-testid":"floor-tablet-cards",children:[(0,el.jsx)("div",{className:"pointer-events-auto flex min-w-0 items-stretch gap-3",children:(0,el.jsx)(Id,{actions:ea,band:"tablet",container:"leading"})}),(0,el.jsx)("div",{className:"pointer-events-auto grid w-[254px] gap-2",children:(0,el.jsx)(Id,{actions:ea,band:"tablet",container:"trailing"})})]}),(0,el.jsxs)("div",{className:"relative z-20 grid bg-background-containers text-text-dark shadow-[var(--shadow-login)] sm:hidden","data-testid":"floor-mobile-cards",children:[(0,el.jsx)("div",{className:"grid",children:(0,el.jsx)(Id,{actions:eo,band:"phone",container:"leading"})}),(0,el.jsx)("div",{className:"grid gap-4 bg-background-containers px-6 pt-4 pb-6","data-testid":"floor-mobile-bottom-actions",children:(0,el.jsx)(Id,{actions:eo,band:"phone",container:"trailing"})})]}),k&&!F&&(0,el.jsx)(ME,{[Mn]:!0,className:"absolute bottom-[152px] start-6 z-30 hidden max-h-[calc(100%-252px)] w-[348px] rounded-2xl bg-background-containers sm:flex lg:bottom-[132px] lg:max-h-[calc(100%-232px)]",gridClassName:"px-4 pb-4",titleClassName:"px-4 pt-4",onOpenChange:H}),(0,el.jsx)(MS,{open:R&&!F,portalContainer:es,onOpenChange:P})]}),ed=W.interiorSelection.shouldRender?"dialog"===W.interiorSelection.presentation?(0,el.jsx)(Mt,{open:W.interiorSelection.open,showCloseButton:e||W.scene.shouldRender,portalContainer:es,rooms:W.sourceRooms,customRooms:W.customRooms,selectedRoomId:v.id,isInvalidFile:W.interiorSelection.isInvalidFile,uploadRetryRequestId:W.interiorSelection.uploadRetryRequestId,onOpenChange:W.interiorSelection.onOpenChange,onSelectRoom:W.interiorSelection.onSelectRoom,onUploadFile:W.interiorSelection.onUploadFile}):"screen"===W.interiorSelection.presentation?(0,el.jsx)(Me,{rooms:W.sourceRooms,customRooms:W.customRooms,selectedRoomId:v.id,isInvalidFile:W.interiorSelection.isInvalidFile,uploadRetryRequestId:W.interiorSelection.uploadRetryRequestId,showCloseButton:e,onSelectRoom:W.interiorSelection.onSelectRoom,onUploadFile:W.interiorSelection.onUploadFile}):null:null,eh=(0,el.jsx)(MB,{isComplete:W.processingDialog.isComplete,open:W.processingDialog.open,portalContainer:es,onCloseAnimationEnd:W.processingDialog.onCloseAnimationEnd,onOpenChange:W.processingDialog.onOpenChange}),ep=(0,el.jsxs)(el.Fragment,{children:[(0,el.jsx)(S6,{missingSurfaceMessage:i,variant:W.activeErrorDialog.variant,open:W.activeErrorDialog.open,portalContainer:es,showDialogCloseButton:e&&W.activeErrorDialog.showCloseButton,onOpenChange:W.activeErrorDialog.onOpenChange,onTryAgain:W.activeErrorDialog.onTryAgain,onCancel:W.activeErrorDialog.onCancel}),(0,el.jsx)(S6,{missingSurfaceMessage:i,variant:W.uploadErrorDialog.variant,open:W.uploadErrorDialog.open,portalContainer:es,onOpenChange:W.uploadErrorDialog.onOpenChange,onTryAgain:W.uploadErrorDialog.onTryAgain,onCancel:W.uploadErrorDialog.onCancel})]}),eA=(0,el.jsxs)("div",{ref:x,className:"relative grid size-full grid-rows-[minmax(0,1fr)_auto] overflow-hidden text-foreground sm:block","data-neurodyn-room-viewer-container":"","data-testid":"floor-viewer-root",children:[h?(0,el.jsx)("div",{className:"flex size-full items-center justify-center bg-radial from-background-containers to-background-base-2",children:(0,el.jsx)(CH,{variant:"logo"})}):W.scene.shouldRender?eu:null,!W.surface.usesSiblingDialogFlow&&ed,!W.surface.usesSiblingDialogFlow&&eh]});return W.surface.usesSiblingDialogFlow?(0,el.jsxs)(el.Fragment,{children:[(W.scene.shouldRenderDialog||h)&&(0,el.jsx)(Cw,{open:I,onOpenChange:B,children:(0,el.jsxs)(CS,{className:"inset-0 h-dvh min-w-full max-w-none translate-x-0 translate-y-0 rounded-none border-none bg-transparent p-0 shadow-none sm:p-0 sm:max-w-none",contentInsideOverlay:!0,portalContainer:S,showCloseButton:!1,onInteractOutside:e=>{e.preventDefault()},children:[(0,el.jsx)(CI,{className:"sr-only",children:r}),(0,el.jsx)(CB,{className:"sr-only"}),eA]})}),ed,eh,ep]}):(0,el.jsxs)(el.Fragment,{children:[eA,ep]})}function IP(e){return(0,el.jsx)(IR,{...e})}let ID={angle:0,rotation:0,isDragging:!1};function I_(){let e=ID,t=new Set;function r(r){return n=>{let i="function"==typeof n?n(e[r]):n;Object.is(i,e[r])||(e={...e,[r]:i},t.forEach(e=>e()))}}return{getState:()=>e,subscribe:e=>(t.add(e),()=>{t.delete(e)}),setAngle:r("angle"),setRotation:r("rotation"),setIsDragging:r("isDragging")}}let IL=[];function IF(e,t,r){if(t===r)return e;let n=new Set(t.map(e=>e.id)),i=new Set(r.map(e=>e.id)),a=e.filter(e=>!n.has(e.id)&&!i.has(e.id));return a.length>0?[...a,...r]:r}function IN({children:e,src:t,tinuuid:r,roomId:n,type:i,viewerSurface:a,dialogPortalContainer:o=null,viewerDialogOpen:s=!0,onViewerDialogOpenChange:l,width:c,height:u,displayUnit:d,name:h,apiKey:p,productRef:A,baseURL:f,source:g,externalWidgetSession:m}){var v,b;let y=MZ(d),w=xI(),x=EG(i),C=n?.trim()||void 0,E="panel-group"===CW[i].manipulation,{offersSizeVariants:S}=Mm(i),M="floor-room-presets"===CW[i].roomPresets?EQ:EO,I=Cr({apiKey:p,baseURL:f,source:g}),[B,k]=(0,ec.useState)(r),[T,R]=(0,ec.useState)(null),P=(0,ec.useCallback)(e=>{R(null),k(e)},[]),D=(0,ec.useCallback)(e=>{R(e),k(e)},[]),[_,L]=(0,ec.useState)(null),[F,N]=(0,ec.useState)(y[0].value),[O]=(0,ec.useState)(I_),[Q,U]=(0,ec.useState)(null),[z,G]=(0,ec.useState)(()=>({layoutReady:!1,placementReady:!1,materialReady:"artwork-src"===x.materialSource,artifactsReady:!1,assetsReady:!1,prepareReady:!1,shadersReady:!1})),[H,j]=(0,ec.useState)(!1),[V,q]=(0,ec.useState)(null),[W,K]=(0,ec.useState)(null),J=(0,ec.useRef)(null),Y=(0,ec.useRef)(!1),X="object-glb"===x.materialSource,Z="default"===g&&void 0!==p,$=Ci("wall-panel"===(v={apiKey:p,baseURL:f,source:g,resourceType:i}).resourceType?v:{...v,resourceType:void 0}),ee=o0({queryKey:["room-viewer","activate",{apiKey:p??null,source:g,resourceType:i}],enabled:Z,queryFn:({signal:e})=>xY($.query,{...$.config,baseURL:f,headers:{"x-api-key":p},signal:e})},sa,void 0),et=x6(ee.error),er=(0,ec.useMemo)(()=>{let e=ee.data;return Cl(e?.widgetSession,{apiConfig:{baseURL:f,headers:{"x-api-key":p}}})},[ee.data,p,f]),en=m instanceof Cs?m:null,ei=m instanceof Cs?null:m,ea=ei?.token,eo=ei?.sid,es=ei?.expiresIn,eu=(0,ec.useMemo)(()=>en||(Cl({token:ea,sid:eo,expiresIn:es},{apiConfig:{baseURL:f,headers:{"x-api-key":p}}})??er),[er,p,f,en,ea,eo,es]),ed="shopify"===g?null!==eu:Z&&ee.isSuccess,eh=o0({queryKey:["room-viewer","rooms",{apiKey:(b={apiKey:p,baseURL:f,language:w,source:g,widgetSession:eu,resourceType:i}).apiKey??null,language:b.language??null,source:b.source,resourceType:b.resourceType??null,widgetSessionId:b.widgetSession?.sid??null}],enabled:I&&ed,placeholderData:oU,queryFn:async({signal:e})=>{try{return await Cm({apiKey:p,baseURL:f,language:w,signal:e,source:g,widgetSession:eu,resourceType:i})}catch(e){if(x6(e))throw e;return[]}}},sa,void 0),ep=I?eh.data??IL:M,[eA,ef]=(0,ec.useState)(()=>({rooms:ep,sourceRooms:ep})),eg=(0,ec.useMemo)(()=>IF(eA.rooms,eA.sourceRooms,ep),[eA.rooms,eA.sourceRooms,ep]),em=(0,ec.useCallback)(e=>{ef(t=>{let r=IF(t.rooms,t.sourceRooms,ep);return{rooms:"function"==typeof e?e(r):e,sourceRooms:ep}})},[ep]),[ev,eb]=(0,ec.useState)(()=>C??M[0].id),[ey,ew]=(0,ec.useState)(C);ey!==C&&(ew(C),C&&(eb(C),G(e=>SZ(e,S0)),K(e=>C9(e)?null:e)));let ex=eg.find(e=>e.id===ev),eC=ex??eg[0]??M[0],eE="rotate-on-floor"===CW[i].manipulation;(0,ec.useLayoutEffect)(()=>{C&&(O.setAngle(0),O.setRotation(0))},[C,O]),(0,ec.useEffect)(()=>{eE&&O.setRotation(0)},[eE,eC.id,O]);let eS=eg.length>0;!ex&&eg[0]&&ev!==eg[0].id&&eb(eg[0].id);let eM=!Z||ee.isSuccess||ee.isError&&null===et,eI=o0({queryKey:Ch(r??void 0,{apiKey:p,baseURL:f,language:w,source:g,resourceType:i}),enabled:eM&&X&&null===_&&!!r,queryFn:async({signal:e})=>{if(!r)throw Error("Tinuuid is required.");return CA(r,{apiKey:p,baseURL:f,language:w,signal:e,source:g,widgetSession:eu,resourceType:i})}},sa,void 0),eB=o0({queryKey:Ch(B??void 0,{apiKey:p,baseURL:f,language:w,source:g,resourceType:i}),enabled:eM&&X&&!!B,placeholderData:oU,queryFn:async({signal:e})=>{if(!B)throw Error("Tinuuid is required.");return CA(B,{apiKey:p,baseURL:f,language:w,signal:e,source:g,widgetSession:eu,resourceType:i})}},sa,void 0),ek=eI.data??null,eT=eB.data??null,eR=ek?.materials?.[0]??null,eP=_?.native?.glbUrl??null,eD=x6(eI.error),e_=x6(eh.error),eL=I&&("shopify"===g?null===eu||eh.isLoading:ee.isSuccess&&eh.isLoading),eF=Z&&ee.isLoading||eL,eN=ee.error&&null===et?"viewer-load-failed":null,eO=eI.error&&null===eD?"viewer-load-failed":null,eQ="artwork-src"===x.materialSource&&("string"!=typeof t||0===t.trim().length)?"artwork-load-failed":null,eU=X&&!eF&&(!r||eI.isSuccess&&null===eR||null!==_&&null===eP)?"viewer-load-failed":null,ez=null!==T&&T===B&&(eB.isError||eB.isSuccess&&eT?.tinuuid===B&&!eT.materials?.[0]?.native?.glbUrl)?"viewer-load-failed":null,eG=sp({queries:Mx({apiKey:p,baseURL:f,language:w,source:g,widgetSession:eu}).map(e=>({...e,enabled:x.hasPictureFrame&&eM&&!eF}))}),eH=eG[0]?.data??null,ej=V??et??e_??eD,eV=W??ez??eN??eO??eU??eQ,eq=(0,ec.useCallback)(e=>{G(t=>SZ(t,e))},[]);(0,ec.useEffect)(()=>{if("dialog"!==a||!s){Y.current=!1;return}Y.current||eu&&(Cc(eu,"widget_opened",{productRef:A}),Y.current=!0)},[A,s,a,eu]),(0,ec.useEffect)(()=>{X&&(P(r),L(null),q(null),K(null))},[r,P,X]),(0,ec.useEffect)(()=>{q(null),K(null)},[p,g]),(0,ec.useEffect)(()=>{X&&ek&&null===_&&L(eR)},[_,eR,ek,X]),(0,ec.useEffect)(()=>{let e=eH?.materials?.[0],t=eH?.tinuuid;null===_&&e&&t&&(L(e),P(t))},[eH,_,P]),(0,ec.useEffect)(()=>{if(!X||!S&&!E&&T!==B||null===eT||eT.tinuuid!==B)return;let e=eT.materials?.[0];if(!e)return;let t=eT.materials?.some(e=>e===_||!!e.hid&&e.hid===_?.hid);if(T===B){R(null),L(e);return}(!t||E)&&_!==e&&L(e)},[E,_,S,eT,B,X,T]);let eW=(0,ec.useMemo)(()=>({type:i,name:h,width:c,height:u,displayUnit:d}),[i,h,c,u,d]),eK=(0,ec.useMemo)(()=>({viewerSurface:a,dialogPortalContainer:o,viewerDialogOpen:s,onViewerDialogOpenChange:l}),[a,o,s,l]),eJ=(0,ec.useMemo)(()=>({rooms:eg,sourceRooms:ep,setRooms:em,room:eC,initialRoomId:C,setRoomId:eb}),[eg,eC,C,em,ep]),eY=(0,ec.useMemo)(()=>({src:t,glbUrl:eP,tinuuid:B,embeddedObject:ek,selectedObject:eT,material:_,setTinuuid:P,selectResourceVariant:D,setMaterial:L,apiKey:p,productRef:A,baseURL:f,language:w,source:g,widgetSession:eu,hasRooms:eS,isViewerAccessPending:eF,accessError:ej,setAccessError:q,loadError:eV,setLoadError:K}),[t,eP,B,ek,eT,_,P,D,p,A,f,w,g,eu,eS,eF,ej,eV]),eX=(0,ec.useMemo)(()=>({setContainerRef:U,resourceRef:J,sceneGestures:O,patchSceneLoad:eq,setIsRoomScenePending:j}),[eq,O]),eZ=(0,ec.useMemo)(()=>({...eX,containerRef:Q,sceneLoad:z,isRoomScenePending:H}),[eX,Q,z,H]),e$=(0,ec.useMemo)(()=>({matting:F,setMatting:N}),[F]);return(0,el.jsx)(C4,{value:eW,children:(0,el.jsx)(C5,{value:eK,children:(0,el.jsx)(C8,{value:eJ,children:(0,el.jsx)(C6,{value:eY,children:(0,el.jsx)(Ee,{value:eX,children:(0,el.jsx)(C7,{value:eZ,children:(0,el.jsx)(Et,{value:e$,children:(0,el.jsx)(Ew,{children:e})})})})})})})})}let IO={poster:"wallart",carpet:"rugs"};function IQ(e){return"poster"===e||"carpet"===e}cb.gPd.DEFAULT_ANISOTROPY=4;let IU=new sv({defaultOptions:{queries:{gcTime:1/0,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1,retry:(e,t)=>{let r=function(e){if(cd(e))return e.response?.status}(t);return(void 0===r||!(r>=400)||!(r<500))&&e<2}}}});function Iz({type:e,src:t,tinuuid:r,roomId:n,name:i,height:a,width:o,language:s,dimensionUnit:l="m",displayUnit:c="cm",apiKey:u,productRef:d,source:h="default",showDialogCloseButton:p=!1,viewerSurface:A="inline",dialogPortalContainer:f=null,viewerDialogOpen:g=!0,onViewerDialogOpenChange:m,widgetSession:v}){let{i18n:b}=aO(),y=u?.trim()||void 0,w=r?.trim()||void 0,x=IQ(e)?IO[e]:e,C=EG(x).takesDimensionProps?function(e,t,r="m"){return{width:MY(e??0,r),height:MY(t??0,r)}}(o,a,l):null;return(0,ec.useEffect)(()=>{IQ(e)&&IO[e]},[e]),(0,ec.useEffect)(()=>{"string"==typeof s&&s!==b.language&&b.changeLanguage(s)},[b,s]),(0,el.jsx)(ov,{client:IU,children:(0,el.jsx)(IN,{src:t??null,tinuuid:w??null,roomId:n,type:x,viewerSurface:A,dialogPortalContainer:f,viewerDialogOpen:g,onViewerDialogOpenChange:m,name:i,width:C?.width??0,height:C?.height??0,displayUnit:c,apiKey:y,productRef:d?.trim()||void 0,baseURL:"shopify"===h?Ce:void 0,source:h,externalWidgetSession:v,children:(0,el.jsx)(IP,{showDialogCloseButton:p})})})}function IG({type:e,src:t,tinuuid:r,roomId:n,width:i,height:a,dimensionUnit:o,displayUnit:s,name:l,language:c,apiKey:u,productRef:d,source:h,widgetSession:p,disableClose:A=!1,open:f,defaultOpen:g,onOpenChange:m}){let[v,b]=(0,ec.useState)(null),[y]=(0,ec.useState)(()=>{let e;return(e=ab.createInstance()).use(of).init({...xS,lng:c}),e}),{language:w,direction:x}=function(e){let{i18n:t}=aO(void 0,{i18n:e}),r=xM(t);return{language:r,direction:"ar"===r?"rtl":"ltr"}}(y),[C,E]=(0,ec.useState)(g??!1),S=f??C,[M,I]=(0,ec.useState)(S),B=S||M;(0,ec.useEffect)(()=>{S&&I(!0)},[S]);let k=Ep({disableClose:A,onOpenChange:m,open:f}),T=(0,ec.useCallback)(e=>{let{disableClose:t,onOpenChange:r,open:n}=k.current;(e||!t)&&(void 0===n&&E(e),r?.(e))},[k]),R=(0,el.jsx)(Iz,{type:e,src:t,tinuuid:r,roomId:n,name:l,height:a,width:i,dimensionUnit:o,displayUnit:s,language:c,apiKey:u,productRef:d,source:h,widgetSession:p,showDialogCloseButton:!A,viewerSurface:"dialog",dialogPortalContainer:v,viewerDialogOpen:S,onViewerDialogOpenChange:T});return(0,el.jsxs)(el.Fragment,{children:[(0,ed.createPortal)((0,el.jsx)("style",{children:xx.A}),document.head),(0,ed.createPortal)((0,el.jsxs)(a9.div,{"data-neurodyn-room-viewer-root":"",style:{display:"block",letterSpacing:"normal",position:"relative",zIndex:0x7fffffff},children:[(0,el.jsx)("style",{children:":host{display:block!important;visibility:visible!important}"}),(0,el.jsx)("style",{children:xT}),(0,el.jsx)("div",{ref:b,dir:x,lang:w}),v&&(0,el.jsx)(xw,{root:v,storageKey:"neurodyn-theme",defaultTheme:"light",children:(0,el.jsx)(eE,{dir:x,children:(0,el.jsx)(aQ,{i18n:y,children:B&&R})})})]}),document.body)]})}xz({baseURL:"https://api.neurodyn.ai/"});let IH=0;class Ij{container=null;props=null;root=null;openState=!1;destroy(){this.root?.unmount(),this.root=null,this.container?.remove(),this.container=null,this.props=null,this.openState=!1}open(e){this.props=e,this.openState=!0,this.render()}handleOpenChange=e=>{this.openState=e,this.render()};ensureRoot(){return this.root||(this.container=document.createElement("div"),this.container.id=`neurodyn-room-viewer-dialog-root-${IH++}`,document.body.appendChild(this.container),this.root=(0,g7.createRoot)(this.container)),this.root}render(){this.props&&this.ensureRoot().render((0,ec.createElement)(IG,{...this.props,onOpenChange:this.handleOpenChange,open:this.openState}))}}function IV(e,t,r){return{kind:"attribute",name:e,parse:t.parse,values:t.values,...r}}function Iq(e){return{kind:"option",reason:e}}function IW(){return{parse:e=>e??void 0}}function IK(){return{parse:e=>e?Number(e):void 0}}function IJ(e){return{parse:t=>e.includes(t??"")?t:void 0,values:e}}let IY={prefix:"data-neurodyn-room-viewer-",markers:[{name:"data-neurodyn-room-viewer-dialog",description:"Marks an element for the embed build."}],fields:{type:IV("type",{parse:e=>e??void 0,values:["wallart","rugs","flooring","wall-panel"]},{required:!0,description:"Resource type."}),src:IV("src",IW(),{required:{when:"type",is:["wallart"]},description:"Wall-art image URL."}),tinuuid:IV("tinuuid",IW(),{required:{when:"type",is:["rugs","flooring","wall-panel"]},description:"The object's tinuuid."}),roomId:IV("room-id",IW(),{required:!1,description:"Initial Room ID from the available catalog. Skips the initial interior chooser; unavailable Rooms open the chooser. Empty values do nothing."}),name:IV("name",IW(),{required:!0,description:"Title shown in the dialog header."}),width:IV("width",IK(),{required:!1,description:"Wall-art width. Used when `type` is `wallart`."}),height:IV("height",IK(),{required:!1,description:"Wall-art height. Used when `type` is `wallart`."}),dimensionUnit:IV("dimension-unit",IJ(["m","cm","in"]),{required:!1,defaultValue:"`m`",description:"Unit used by wall-art width and height."}),displayUnit:IV("display-unit",IJ(["cm","in"]),{required:!1,defaultValue:"`cm`",description:"Unit used to display UI measurements."}),language:IV("language",IJ(["en","ru","ar"]),{required:!1,defaultValue:"User locale",description:"UI language override."}),apiKey:IV("api-key",IW(),{required:!0,description:"Public API key sent as `x-api-key`. Not needed when `source` is `shopify`."}),productRef:IV("product-ref",IW(),{required:!1,description:"The shop's own id of the product. Reported with widget events so views are counted per store product. The loader script sets it."}),source:IV("source",IJ(["default","shopify"]),{required:!1,defaultValue:"`default`",description:"Backend source mode."}),disableClose:IV("disable-close",{parse:e=>"true"===e},{required:!1,defaultValue:"`false`",description:"Set to `true` to hide close controls and prevent dismissal."}),widgetSession:Iq("An existing Widget Session handed over by an embedding surface such as Shopify."),open:Iq("The embed build owns the open state."),defaultOpen:Iq("The embed build owns the open state."),onOpenChange:Iq("The embed build owns the open state.")}};class IX{renderer=new Ij;triggers;props;destroyed=!1;constructor(e,t={}){for(const r of(this.triggers="string"==typeof e?Array.from(document.querySelectorAll(e)):[e],this.props=t,this.triggers))r.addEventListener("click",this.handleClick)}destroy(){if(!this.destroyed){for(let e of(this.destroyed=!0,this.triggers))e.removeEventListener("click",this.handleClick);this.renderer.destroy()}}handleClick=e=>{!this.destroyed&&e.currentTarget instanceof Element&&this.renderer.open(function(e,t={}){let r=function(e,t,r={}){let n={};for(let[i,a]of Object.entries(t.fields).filter(e=>"attribute"===e[1].kind)){let o=`${t.prefix}${a.name}`,s=r[i];if(void 0!==s){n[i]=a.normalizesOptions?a.parse(s,{attribute:o}):s;continue}n[i]=a.parse(function(e,t,r=[]){let n=e.getAttribute(t);if(0===r.length||n?.trim())return n;for(let t of r){let r=e.getAttribute(t);if(r?.trim())return r}return n}(e,o,a.legacyNames),{attribute:o})}return n}(e,IY,t);return{...r,type:r.type,name:r.name}}(e.currentTarget,this.props))}}window.RoomViewerDialog=IX})()})();
|