@neurodyn/core-ar 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-ar.chunk.27b4ab37.min.js +383 -0
- package/dist/core-ar.chunk.27b4ab37.min.js.LICENSE.txt +5 -0
- package/dist/core-ar.chunk.5d925ec9.min.js +61 -0
- package/dist/core-ar.chunk.66c7fd24.min.js +2 -0
- package/dist/core-ar.chunk.66c7fd24.min.js.LICENSE.txt +6 -0
- package/dist/core-ar.chunk.86e9b748.min.js +77 -0
- package/dist/core-ar.chunk.86e9b748.min.js.LICENSE.txt +63 -0
- package/dist/core-ar.chunk.87bc2890.min.js +1 -0
- package/dist/core-ar.chunk.b35bb825.min.js +12 -0
- package/dist/{core-ar.chunk.7a932efa.min.js → core-ar.chunk.df43e0ae.min.js} +7 -3
- package/dist/core-ar.chunk.e2e05712.min.js +983 -0
- package/dist/{core-ar.chunk.09fa4463.min.js.LICENSE.txt → core-ar.chunk.e2e05712.min.js.LICENSE.txt} +0 -30
- package/dist/core-ar.chunk.f136c05d.min.js +6 -0
- package/dist/core-ar.chunk.f136c05d.min.js.LICENSE.txt +36 -0
- package/dist/core-ar.chunk.f52e1e86.min.js +2 -0
- package/dist/core-ar.chunk.f52e1e86.min.js.LICENSE.txt +9 -0
- package/dist/core-ar.embed.min.js +2 -2
- package/dist/index.js +175 -13
- package/dist/static/svg/camera-intro.59d57f3d.svg +139 -0
- package/dist/static/svg/gesture-rotate.03dbf61b.svg +100 -0
- package/dist/static/svg/scan-floor.5dee2ec3.svg +66 -0
- package/dist/static/svg/scan-wall.23490063.svg +58 -0
- package/package.json +4 -2
- package/dist/core-ar.chunk.09fa4463.min.js +0 -987
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_neurodyn_core_ar=self.webpackChunk_neurodyn_core_ar||[]).push([["393"],{5847(e,t,r){r.r(t),r.d(t,{ArExperience:()=>im});var n=r(8525),i=r(828),a=r(6514),l=r(9081),o=r(243),s=r(9677),c=r(9811),u=r(1131);function d(e,t){var r,n;let i=(0,u.sq)(e),a=(0,u.Dj)(e),l=(0,u.uW)(e,t),o=a[0],s=(null==l||null==(n=l.native)||null==(r=n.glbUrl)?void 0:r.trim())?{glbUrl:l.native.glbUrl,hid:l.hid??null}:o?{glbUrl:o.glbUrl,hid:o.hid}:null;return s?{dimensions:i.dimensions,glbUrl:s.glbUrl,id:e.uuid??e.tinuuid??s.glbUrl,mechanic:i.mechanic,variantId:s.hid,variants:a}:null}var h=r(683),m=r(7218),p=r(6486),f=r(2838),g=r(851);let b=(0,r(1137).zu)({extend:{theme:{shadow:["surface","control","modal","switch-thumb"]}}});function x(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return b((0,g.$)(t))}var v=r(4656);function w(e){let{className:t,size:r="default",...i}=e;return(0,n.jsx)(v.bL,{"data-slot":"avatar","data-size":r,className:x("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",t),...i})}function j(e){let{className:t,...r}=e;return(0,n.jsx)(v._V,{"data-slot":"avatar-image",className:x("aspect-square size-full rounded-full object-cover",t),...r})}function y(e){let{className:t,...r}=e;return(0,n.jsx)(v.H4,{"data-slot":"avatar-fallback",className:x("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",t),...r})}var N=r(8763),M=r(384),C=r(8128),I=r(4382),R=r(1213),z=r(5445),L=r(2849);let S=(0,z.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-control hover:bg-primary/80",outline:"border-border bg-background shadow-control hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-control hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive shadow-control hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*=size-])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*=size-])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*=size-])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Z(e){let{className:t,variant:r="default",size:i="default",asChild:a=!1,...l}=e,o=a?L.bL:"button";return(0,n.jsx)(o,{"data-slot":"button","data-variant":r,"data-size":i,className:x(S({variant:r,size:i,className:t})),...l})}var W=r(5444);let Y="var(--v-borders-medium, #bebec8)";function k(e){let{className:t,role:r,"aria-label":i,"aria-live":a,size:l="default",state:o="loading",variant:s="default",...c}=e,u=i??("success"===o?"Success":"error"===o?"Error":"Loading");if("logo"===s){let e="sm"===l?4:5;return(0,n.jsxs)("svg",{...c,role:r??"status","aria-live":a??"polite","aria-label":u,width:"93",height:"91",viewBox:"0 0 93 91",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-slot":"spinner","data-size":l,"data-state":o,className:x("spinner-logo shrink-0","sm"===l?"size-9":"size-22",t),children:[(0,n.jsx)("g",{className:"spinner-logo__intro-shell",children:(0,n.jsx)("path",{d:"M15.7495 62.7798L46.4936 45.0297M46.4936 45.0297L77.2661 62.5451M46.4936 45.0297L46.7111 9.62225M49.9213 79.4237L74.5719 65.1917C75.6436 64.5705 76.5344 63.6811 77.1541 62.6137C77.7738 61.5462 78.1003 60.3385 78.1007 59.1129L78.1729 30.7811C78.1734 29.5494 77.851 28.3427 77.2373 27.2798C76.6236 26.2169 75.7398 25.3343 74.6729 24.7189L50.1007 10.6155C47.926 9.3694 45.2455 9.37719 43.0689 10.6339L18.4183 24.8659C16.2385 26.1244 14.8946 28.4401 14.8895 30.9447L14.8173 59.2766C14.8168 60.5082 15.1392 61.7149 15.7529 62.7778C16.3666 63.8408 17.2504 64.7233 18.3173 65.3387L42.8895 79.4421C45.0642 80.6882 47.7447 80.6805 49.9213 79.4237Z",className:"spinner-logo__outline spinner-logo__outline--intro",vectorEffect:"sm"===l?void 0:"non-scaling-stroke"})}),(0,n.jsx)("circle",{className:"spinner-logo__intro-orb",cx:"46.27",cy:"45.8",r:"11.18",fill:"white",stroke:Y,strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("circle",{className:"spinner-logo__result-ring",cx:"46.5",cy:"45.5",r:"33.46",fill:"white",stroke:Y,strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("g",{transform:"translate(27.786 31.4489)",children:(0,n.jsx)("g",{className:"spinner-logo__result-glyph spinner-logo__result-glyph--success",children:(0,n.jsx)("path",{d:"M13.6758 28.1023C13.3559 28.101 13.0397 28.0341 12.7467 27.9057C12.4537 27.7772 12.1902 27.59 11.9725 27.3557L0.632479 15.2923C0.208575 14.8406 -0.0185097 14.2389 0.00118164 13.6198C0.020873 13.0006 0.285727 12.4146 0.737479 11.9907C1.18923 11.5668 1.79088 11.3397 2.41006 11.3594C3.02924 11.3791 3.61524 11.6439 4.03915 12.0957L13.6525 22.339L33.2758 0.87233C33.475 0.624349 33.7227 0.419696 34.0038 0.270944C34.2849 0.122191 34.5935 0.0324784 34.9105 0.00731496C35.2276 -0.0178485 35.5464 0.0220682 35.8475 0.124615C36.1485 0.227162 36.4254 0.390174 36.6612 0.603637C36.897 0.8171 37.0866 1.07651 37.2185 1.36593C37.3503 1.65535 37.4216 1.96867 37.428 2.28665C37.4344 2.60463 37.3756 2.92056 37.2555 3.21502C37.1353 3.50949 36.9562 3.77627 36.7291 3.999L15.4025 27.3323C15.1868 27.5709 14.9242 27.7625 14.6311 27.895C14.338 28.0275 14.0208 28.0981 13.6991 28.1023H13.6758Z",fill:Y})})}),(0,n.jsx)("g",{transform:"translate(32.4879 31.4885)",children:(0,n.jsx)("g",{className:"spinner-logo__result-glyph spinner-logo__result-glyph--error",children:(0,n.jsx)("path",{d:"M17.3045 14.0095L27.3378 3.99955C27.5554 3.78199 27.728 3.52371 27.8457 3.23946C27.9635 2.95521 28.0241 2.65055 28.0241 2.34288C28.0241 2.03521 27.9635 1.73055 27.8457 1.4463C27.728 1.16205 27.5554 0.903769 27.3378 0.686213C27.1203 0.468656 26.862 0.296082 26.5778 0.178341C26.2935 0.0606 25.9889 -4.58466e-09 25.6812 0C25.3735 4.58466e-09 25.0689 0.0606 24.7846 0.178341C24.5003 0.296082 24.2421 0.468656 24.0245 0.686213L14.0145 10.7195L4.00451 0.686213C3.56514 0.246838 2.96921 -4.62957e-09 2.34784 0C1.72647 4.62957e-09 1.13055 0.246838 0.691177 0.686213C0.251802 1.12559 0.0049634 1.72151 0.0049634 2.34288C0.00496339 2.96425 0.251802 3.56017 0.691177 3.99955L10.7245 14.0095L0.691177 24.0195C0.472196 24.2363 0.29836 24.4943 0.179723 24.7787C0.0610849 25.063 0 25.3681 0 25.6762C0 25.9843 0.0610849 26.2894 0.179723 26.5737C0.29836 26.8581 0.472196 27.1161 0.691177 27.3329C0.908091 27.5516 1.16616 27.7252 1.4505 27.8436C1.73484 27.9621 2.03982 28.0231 2.34784 28.0231C2.65587 28.0231 2.96085 27.9621 3.24519 27.8436C3.52953 27.7252 3.7876 27.5516 4.00451 27.3329L14.0145 17.2995L24.0245 27.3329C24.296 27.6078 24.6314 27.8111 25.0007 27.9245C25.3701 28.0379 25.7618 28.0579 26.1407 27.9828C26.5197 27.9077 26.8741 27.7397 27.1722 27.4939C27.4703 27.2481 27.7028 26.9322 27.8488 26.5745C28.0272 26.1459 28.0736 25.6738 27.9821 25.2187C27.8907 24.7636 27.6655 24.346 27.3355 24.0195L17.3045 14.0095Z",fill:Y})})})]})}return(0,n.jsx)(W.A,{"data-slot":"spinner",role:r??"status","aria-live":a??"polite","aria-label":u,className:x("size-4 animate-spin",t),...c})}function T(e){return(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,n.jsx)("path",{d:"M22.5601 16.3031L14.8901 3.58311C14.58 3.09793 14.1526 2.69864 13.6476 2.42205C13.1425 2.14546 12.5759 2.00049 12.0001 2.00049C11.4243 2.00049 10.8577 2.14546 10.3526 2.42205C9.84755 2.69864 9.42024 3.09793 9.1101 3.58311L1.4401 16.3031C1.16915 16.7548 1.02189 17.2698 1.01311 17.7964C1.00434 18.323 1.13436 18.8427 1.3901 19.3031C1.68578 19.8214 2.11376 20.2518 2.6303 20.5505C3.14684 20.8492 3.73343 21.0054 4.3301 21.0031H19.6701C20.2629 21.0094 20.8468 20.8593 21.363 20.5678C21.8792 20.2764 22.3093 19.8539 22.6101 19.3431C22.8734 18.8779 23.0075 18.3508 22.9987 17.8163C22.9899 17.2818 22.8385 16.7594 22.5601 16.3031ZM20.8601 18.3531C20.7399 18.5597 20.5655 18.7295 20.3557 18.8441C20.146 18.9586 19.9089 19.0136 19.6701 19.0031H4.3301C4.09132 19.0136 3.85422 18.9586 3.64446 18.8441C3.4347 18.7295 3.26029 18.5597 3.1401 18.3531C3.05233 18.2011 3.00613 18.0286 3.00613 17.8531C3.00613 17.6776 3.05233 17.5051 3.1401 17.3531L10.8201 4.62311C10.9581 4.44082 11.1365 4.29298 11.3412 4.19119C11.5459 4.08939 11.7715 4.03642 12.0001 4.03642C12.2287 4.03642 12.4543 4.08939 12.659 4.19119C12.8637 4.29298 13.0421 4.44082 13.1801 4.62311L20.8501 17.3431C20.9413 17.4954 20.9902 17.6693 20.992 17.8468C20.9937 18.0243 20.9482 18.199 20.8601 18.3531Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M12.0001 17.0001C12.2653 17.0001 12.5197 16.8948 12.7072 16.7073C12.8948 16.5197 13.0001 16.2654 13.0001 16.0001C13.0001 15.7349 12.8948 15.4806 12.7072 15.293C12.5197 15.1055 12.2653 15.0001 12.0001 15.0001C11.7349 15.0001 11.4806 15.1055 11.293 15.293C11.1055 15.4806 11.0001 15.7349 11.0001 16.0001C11.0001 16.2654 11.1055 16.5197 11.293 16.7073C11.4806 16.8948 11.7349 17.0001 12.0001 17.0001Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M12.0001 8.00023C11.7349 8.00023 11.4806 8.10559 11.293 8.29313C11.1055 8.48066 11.0001 8.73502 11.0001 9.00023V13.0002C11.0001 13.2655 11.1055 13.5198 11.293 13.7073C11.4806 13.8949 11.7349 14.0002 12.0001 14.0002C12.2653 14.0002 12.5197 13.8949 12.7072 13.7073C12.8948 13.5198 13.0001 13.2655 13.0001 13.0002V9.00023C13.0001 8.73502 12.8948 8.48066 12.7072 8.29313C12.5197 8.10559 12.2653 8.00023 12.0001 8.00023Z",fill:"currentColor"})]})}function D(e){return(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,n.jsx)("path",{d:"M18 3H6C5.20435 3 4.44129 3.31607 3.87868 3.87868C3.31607 4.44129 3 5.20435 3 6V18C3 18.7956 3.31607 19.5587 3.87868 20.1213C4.44129 20.6839 5.20435 21 6 21H18C18.7956 21 19.5587 20.6839 20.1213 20.1213C20.6839 19.5587 21 18.7956 21 18V6C21 5.20435 20.6839 4.44129 20.1213 3.87868C19.5587 3.31607 18.7956 3 18 3ZM6 5H18C18.2652 5 18.5196 5.10536 18.7071 5.29289C18.8946 5.48043 19 5.73478 19 6V14.36L15.8 11.63C15.3042 11.222 14.6821 10.999 14.04 10.999C13.3979 10.999 12.7758 11.222 12.28 11.63L5 17.7V6C5 5.73478 5.10536 5.48043 5.29289 5.29289C5.48043 5.10536 5.73478 5 6 5ZM18 19H6.56L13.56 13.16C13.6945 13.0602 13.8575 13.0062 14.025 13.0062C14.1925 13.0062 14.3555 13.0602 14.49 13.16L19 17V18C19 18.2652 18.8946 18.5196 18.7071 18.7071C18.5196 18.8946 18.2652 19 18 19Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M7.99983 9.99992C8.39766 9.99992 8.77919 9.84188 9.06049 9.56058C9.34179 9.27927 9.49983 8.89774 9.49983 8.49992C9.49983 8.10209 9.34179 7.72056 9.06049 7.43925C8.77919 7.15795 8.39766 6.99992 7.99983 6.99992C7.60201 6.99992 7.22047 7.15795 6.93917 7.43925C6.65787 7.72056 6.49983 8.10209 6.49983 8.49992C6.49983 8.89774 6.65787 9.27927 6.93917 9.56058C7.22047 9.84188 7.60201 9.99992 7.99983 9.99992Z",fill:"currentColor"})]})}function P(e){return(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,n.jsx)("path",{d:"M12 2C11.7348 2 11.4804 2.10536 11.2929 2.29289C11.1054 2.48043 11 2.73478 11 3V5C11 5.26522 11.1054 5.51957 11.2929 5.70711C11.4804 5.89464 11.7348 6 12 6C12.2652 6 12.5196 5.89464 12.7071 5.70711C12.8946 5.51957 13 5.26522 13 5V3C13 2.73478 12.8946 2.48043 12.7071 2.29289C12.5196 2.10536 12.2652 2 12 2Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M21.0002 11H19.0002C18.735 11 18.4806 11.1054 18.2931 11.2929C18.1055 11.4804 18.0002 11.7348 18.0002 12C18.0002 12.2652 18.1055 12.5196 18.2931 12.7071C18.4806 12.8946 18.735 13 19.0002 13H21.0002C21.2654 13 21.5197 12.8946 21.7073 12.7071C21.8948 12.5196 22.0002 12.2652 22.0002 12C22.0002 11.7348 21.8948 11.4804 21.7073 11.2929C21.5197 11.1054 21.2654 11 21.0002 11Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M6 12C6 11.7348 5.89464 11.4804 5.70711 11.2929C5.51957 11.1054 5.26522 11 5 11H3C2.73478 11 2.48043 11.1054 2.29289 11.2929C2.10536 11.4804 2 11.7348 2 12C2 12.2652 2.10536 12.5196 2.29289 12.7071C2.48043 12.8946 2.73478 13 3 13H5C5.26522 13 5.51957 12.8946 5.70711 12.7071C5.89464 12.5196 6 12.2652 6 12Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M6.22009 5.00298C6.02357 4.82786 5.76656 4.7362 5.50358 4.74744C5.2406 4.75869 4.99234 4.87196 4.8115 5.06322C4.63065 5.25447 4.53143 5.50867 4.5349 5.77187C4.53838 6.03507 4.64426 6.28656 4.83009 6.47298L6.27009 7.86298C6.36673 7.95629 6.48117 8.02917 6.60659 8.07728C6.73201 8.12538 6.86584 8.14773 7.00009 8.14298C7.1348 8.14246 7.26801 8.11474 7.39173 8.06147C7.51546 8.0082 7.62714 7.93048 7.72009 7.83298C7.90634 7.64561 8.01088 7.39216 8.01088 7.12798C8.01088 6.86379 7.90634 6.61034 7.72009 6.42298L6.22009 5.00298Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M17 8.14285C17.2575 8.14182 17.5047 8.04153 17.69 7.86285L19.13 6.47285C19.3057 6.2893 19.4049 6.04577 19.4075 5.79172C19.4102 5.53767 19.316 5.29214 19.1441 5.10502C18.9723 4.91789 18.7356 4.80319 18.4823 4.78421C18.2289 4.76524 17.9779 4.84341 17.78 5.00285L16.34 6.42285C16.1538 6.61021 16.0493 6.86366 16.0493 7.12785C16.0493 7.39203 16.1538 7.64548 16.34 7.83285C16.5132 8.01557 16.7489 8.12627 17 8.14285Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M12 17.9999C11.7348 17.9999 11.4804 18.1053 11.2929 18.2928C11.1054 18.4803 11 18.7347 11 18.9999V20.9999C11 21.2651 11.1054 21.5195 11.2929 21.707C11.4804 21.8946 11.7348 21.9999 12 21.9999C12.2652 21.9999 12.5196 21.8946 12.7071 21.707C12.8946 21.5195 13 21.2651 13 20.9999V18.9999C13 18.7347 12.8946 18.4803 12.7071 18.2928C12.5196 18.1053 12.2652 17.9999 12 17.9999Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M17.7302 16.1399C17.5392 15.9556 17.2829 15.8547 17.0175 15.8594C16.7521 15.864 16.4995 15.974 16.3152 16.1649C16.1309 16.3559 16.0299 16.6122 16.0346 16.8776C16.0393 17.143 16.1492 17.3956 16.3402 17.5799L17.7802 18.9999C17.9702 19.1835 18.2251 19.2845 18.4893 19.2808C18.7535 19.277 19.0055 19.1688 19.1902 18.9799C19.2837 18.8868 19.3579 18.7762 19.4085 18.6543C19.4591 18.5325 19.4851 18.4019 19.4851 18.2699C19.4851 18.138 19.4591 18.0073 19.4085 17.8855C19.3579 17.7637 19.2837 17.653 19.1902 17.5599L17.7302 16.1399Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M6.27011 16.141L4.83011 17.531C4.73638 17.624 4.66198 17.7346 4.61121 17.8564C4.56045 17.9783 4.53431 18.109 4.53431 18.241C4.53431 18.373 4.56045 18.5037 4.61121 18.6256C4.66198 18.7474 4.73638 18.858 4.83011 18.951C4.9239 19.0467 5.03596 19.1226 5.15965 19.1741C5.28333 19.2256 5.41612 19.2518 5.55011 19.251C5.79662 19.2531 6.03522 19.1641 6.22011 19.001L7.66011 17.611C7.75466 17.5197 7.83031 17.4107 7.88273 17.2902C7.93516 17.1697 7.96334 17.0401 7.96566 16.9087C7.96798 16.7773 7.9444 16.6467 7.89626 16.5244C7.84813 16.4022 7.77637 16.2905 7.68511 16.196C7.59384 16.1014 7.48484 16.0258 7.36433 15.9734C7.24383 15.9209 7.11418 15.8928 6.98278 15.8904C6.85139 15.8881 6.72082 15.9117 6.59854 15.9598C6.47626 16.008 6.36466 16.0797 6.27011 16.171V16.141Z",fill:"currentColor"})]})}var X=r(6642);function A(e){let{className:t,...r}=e;return(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:(0,X.cn)("size-6",t),...r,children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0625 1.70412C12.1393 1.70359 12.2136 1.7151 12.2842 1.73439C12.6576 1.76978 13.0261 1.88527 13.3604 2.08303L19.7012 5.84084L19.7031 5.84181C20.1036 6.08032 20.4348 6.42322 20.665 6.83498C20.8952 7.24671 21.0168 7.71415 21.0166 8.19142V8.19338L20.998 15.7403C20.9979 16.1352 20.9124 16.526 20.751 16.8848C20.7319 16.9557 20.7049 17.026 20.667 17.0928C20.6355 17.1482 20.5983 17.1987 20.5576 17.2442C20.3296 17.6 20.023 17.8979 19.6631 18.1133L13.2998 21.9072C12.4738 22.3996 11.4611 22.4004 10.6436 21.917L10.6416 21.916L4.30078 18.1582L4.29883 18.1572C3.91023 17.9258 3.58764 17.5957 3.3584 17.2002C3.35105 17.1885 3.34181 17.1773 3.33496 17.1651C3.32803 17.1526 3.32268 17.1387 3.31641 17.126C3.09976 16.7236 2.98517 16.2703 2.98535 15.8076V15.8057L3.00391 8.25588C3.00603 7.28279 3.51293 6.37777 4.33984 5.88478L10.7021 2.09181C11.0682 1.87369 11.4708 1.75231 11.877 1.72658C11.9365 1.71245 11.999 1.70462 12.0625 1.70412ZM5.16895 7.36818C4.87108 7.54583 4.6844 7.87497 4.68359 8.23635L4.66602 15.3838L9.45801 12.5254C9.51085 12.7718 9.60256 13.0142 9.73535 13.2442C9.90127 13.5315 10.1161 13.7727 10.3633 13.9639L5.49512 16.8662L11.499 20.4248C11.8036 20.6044 12.1738 20.6008 12.4707 20.4238L18.5107 16.8233L13.4971 13.877C13.9543 13.482 14.2391 12.9423 14.3242 12.3672L19.3193 15.3037L19.3379 8.21291L19.3369 8.21388C19.3369 8.03517 19.2923 7.85955 19.2061 7.7051C19.1196 7.55056 18.9947 7.42151 18.8447 7.33205L12.8887 3.80275L12.8535 9.73439C12.3304 9.51037 11.7366 9.46806 11.1738 9.63576L11.21 3.76662L5.16895 7.36818Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.91641 8.60885C11.7928 7.52595 14.1912 8.16845 15.2748 10.0444C16.3582 11.9209 15.7156 14.3211 13.8393 15.4047C11.9627 16.4879 9.56339 15.8446 8.47989 13.9682C7.39671 12.0916 8.03987 9.69227 9.91641 8.60885ZM13.8031 10.894C13.189 9.83118 11.8293 9.46704 10.766 10.0805C9.7026 10.6945 9.33693 12.0551 9.95059 13.1186C10.5646 14.1821 11.9261 14.5469 12.9897 13.9331C14.0529 13.3189 14.4171 11.9575 13.8031 10.894Z",fill:"currentColor"})]})}var O=r(6103);function G(e){return(0,R.J)(e.uuid)??(0,R.J)(e.tinuuid)}function U(e){var t;return null==(t=(0,u.Dj)(e)[0])?void 0:t.hid}function H(e,t){return(!t||(0,u.nf)(e)===t)&&(0,u.Dj)(e).length>0}function E(e){let{catalog:t,isEmptySearch:r,isFetchingNextPage:i,mechanic:a,placingObject:l,search:s,onSelectObject:c,onShowAllItems:u}=e,{t:d}=(0,o.Bd)();return r?(0,n.jsx)("div",{className:"grid min-h-[360px] place-items-center px-8 text-center",children:(0,n.jsxs)("div",{className:"grid justify-items-center gap-3",children:[(0,n.jsxs)("div",{className:"grid gap-1",children:[(0,n.jsx)("p",{className:"text-base font-medium text-[#212124]",children:d("catalog.noResults",{search:s.trim()})}),(0,n.jsx)("p",{className:"text-sm font-medium text-[#64646c]",children:d("catalog.noResultsHint")})]}),(0,n.jsx)(Z,{type:"button",variant:"outline",className:"h-8 rounded-full border-[#dadae0] px-4 text-xs font-semibold text-[#212124]",onClick:u,children:d("catalog.showAllItems")})]})}):0===t.length?(0,n.jsx)("div",{className:"grid min-h-[300px] place-items-center px-8 text-center",children:(0,n.jsxs)("div",{className:"grid max-w-64 justify-items-center gap-2",children:[(0,n.jsx)(O.A,{"aria-hidden":"true",className:"size-8 text-[#bebec8]"}),(0,n.jsx)("p",{className:"text-sm font-medium text-[#64646c]",children:d("catalog.empty")})]})}):(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-x-2.5 gap-y-4 px-5 pt-4",children:[t.map((e,t)=>{let r=(0,R.J)(e.name)??d("catalog.unnamedProduct"),i=(0,I.pU)(e),o=H(e,a),s=l===e;return(0,n.jsxs)("button",{type:"button","aria-label":r,className:"ar-catalog-card group relative grid min-w-0 touch-manipulation gap-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-45",disabled:!o||null!==l,onClick:()=>c(e),children:[(0,n.jsx)("span",{className:"ar-catalog-media-frame",children:i?(0,n.jsx)("img",{src:i,alt:"",loading:"lazy",className:"ar-catalog-media-img",decoding:"async",draggable:!1}):(0,n.jsx)(D,{"aria-hidden":"true",className:"size-8 text-[#bebec8]"})}),(0,n.jsx)("span",{className:"line-clamp-2 text-[13px] leading-snug font-medium text-[#212124]",children:r}),s&&(0,n.jsx)("span",{className:"absolute inset-0 grid place-items-center rounded-lg bg-white/75",role:"status",children:(0,n.jsx)(k,{className:"size-6"})})]},G(e)??`catalog-object-${t}`)}),i&&(0,n.jsx)("div",{className:"col-span-full grid h-16 place-items-center",role:"status","aria-label":d("catalog.loadingMore"),children:(0,n.jsx)(k,{className:"size-6"})})]})}function F(e){let{className:t,type:r,...i}=e;return(0,n.jsx)("input",{type:r,"data-slot":"input",className:x("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base shadow-control transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...i})}var V=r(876);function J(e){let{className:t,onClear:r}=e,{t:i}=(0,o.Bd)();return(0,n.jsx)("button",{type:"button",className:t,onPointerDown:e=>e.preventDefault(),onClick:r,children:i("catalog.clear")})}function B(e){let{onClose:t}=e,{t:r}=(0,o.Bd)();return(0,n.jsx)(Z,{type:"button","aria-label":r("close"),variant:"secondary",size:"icon-lg",className:"size-11 rounded-full bg-[#ededed] text-[#212124] hover:bg-[#e3e3e8]",onClick:t,children:(0,n.jsx)(f.A,{className:"size-5","aria-hidden":"true"})})}function _(e){let{catalog:t,gridRef:r,isEmptySearch:i,isFetchingNextPage:a,mechanic:s,placingObject:c,search:u,onClearSearch:d,onClose:h,onScroll:m,onSearchChange:p,onSelectObject:f,onShowAllItems:g}=e,{t:b}=(0,o.Bd)(),x=(0,l.useRef)(null),v=u.trim().length>0;return(0,l.useLayoutEffect)(()=>{var e;null==(e=x.current)||e.focus({preventScroll:!0})},[]),(0,n.jsxs)("div",{className:"absolute inset-0 z-30 flex flex-col bg-white text-[#212124]","data-testid":"ar-catalog-search-overlay",children:[(0,n.jsxs)("div",{className:"flex gap-2 px-5 pt-[max(1rem,env(safe-area-inset-top))] pb-3",children:[(0,n.jsxs)("div",{className:"relative flex h-11 min-w-0 flex-1 items-center rounded-full bg-[#ededed] text-[#64646c]",children:[(0,n.jsx)(V.A,{className:"ml-3 size-5 shrink-0","aria-hidden":"true"}),(0,n.jsx)(F,{ref:x,autoFocus:!0,value:u,"aria-label":b("catalog.searchPlaceholder"),className:"h-11 flex-1 border-0 bg-transparent px-2 pr-24 text-base font-medium text-[#212124] shadow-none placeholder:text-[#64646c] focus-visible:ring-0 md:text-sm",autoComplete:"off",enterKeyHint:"search",inputMode:"search",placeholder:b("catalog.searchPlaceholder"),role:"searchbox",type:"text",onChange:e=>p(e.currentTarget.value)}),v&&(0,n.jsx)(J,{className:"absolute right-5 text-sm font-semibold text-primary",onClear:d})]}),(0,n.jsx)(B,{onClose:h})]}),(0,n.jsx)("div",{ref:r,className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pt-2 pb-[calc(1.5rem+var(--ar-catalog-keyboard-bottom,0px)+env(safe-area-inset-bottom))] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden","data-testid":"ar-catalog-search-results",onScroll:m,children:(0,n.jsx)(E,{catalog:t,isEmptySearch:i,isFetchingNextPage:a,mechanic:s,placingObject:c,search:u,onSelectObject:f,onShowAllItems:g})})]})}function Q(e){let{search:t,onClearSearch:r,onClose:i,onOpenSearch:a}=e,{t:l}=(0,o.Bd)(),s=t.trim().length>0;return(0,n.jsxs)("div",{className:"absolute inset-x-0 bottom-0 z-20 flex gap-2 bg-white px-5 pt-4 pb-[max(1.5rem,env(safe-area-inset-bottom))]",children:[(0,n.jsxs)("div",{className:"relative flex min-w-0 flex-1",children:[(0,n.jsxs)("button",{type:"button","aria-label":l("catalog.searchPlaceholder"),className:x("flex h-11 min-w-0 flex-1 items-center rounded-full bg-[#ededed] px-3 text-left text-base font-medium text-[#212124] md:text-sm",s?"pr-24":"text-[#64646c]"),onClick:a,children:[(0,n.jsx)(V.A,{className:"mr-2 size-5 shrink-0 text-[#64646c]","aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:s?t:l("catalog.searchPlaceholder")})]}),s&&(0,n.jsx)(J,{className:"absolute top-1/2 right-5 -translate-y-1/2 text-sm font-semibold text-primary",onClear:r})]}),(0,n.jsx)(B,{onClose:i})]})}var K=r(7984);let q=l.createContext(null);function $(){let e=l.use(q);if(!e)throw Error("useCarousel must be used within a <Carousel />");return e}function ee(e){let{orientation:t="horizontal",opts:r,setApi:i,plugins:a,className:o,children:s,...c}=e,[u,d]=(0,K.A)({...r,axis:"horizontal"===t?"x":"y"},a),[h,m]=l.useState(!1),[p,f]=l.useState(!1),g=l.useCallback(e=>{e&&(m(e.canScrollPrev()),f(e.canScrollNext()))},[]),b=l.useCallback(()=>{null==d||d.scrollPrev()},[d]),v=l.useCallback(()=>{null==d||d.scrollNext()},[d]),w=l.useCallback(e=>{"ArrowLeft"===e.key?(e.preventDefault(),b()):"ArrowRight"===e.key&&(e.preventDefault(),v())},[b,v]);return l.useEffect(()=>{d&&i&&i(d)},[d,i]),l.useEffect(()=>{if(d)return g(d),d.on("reInit",g),d.on("select",g),()=>{null==d||d.off("select",g)}},[d,g]),(0,n.jsx)(q,{value:{carouselRef:u,api:d,opts:r,orientation:t||((null==r?void 0:r.axis)==="y"?"vertical":"horizontal"),scrollPrev:b,scrollNext:v,canScrollPrev:h,canScrollNext:p},children:(0,n.jsx)("div",{onKeyDownCapture:w,className:x("relative",o),role:"region","aria-roledescription":"carousel","data-slot":"carousel",...c,children:s})})}function et(e){let{className:t,...r}=e,{carouselRef:i,orientation:a}=$();return(0,n.jsx)("div",{ref:i,className:"overflow-hidden","data-slot":"carousel-content",children:(0,n.jsx)("div",{className:x("flex","horizontal"===a?"-ml-4":"-mt-4 flex-col",t),...r})})}function er(e){let{className:t,...r}=e,{orientation:i}=$();return(0,n.jsx)("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:x("min-w-0 shrink-0 grow-0 basis-full","horizontal"===i?"pl-4":"pt-4",t),...r})}var en=r(295);function ei(e){let{...t}=e;return(0,n.jsx)(en._s.Root,{"data-slot":"drawer",...t})}function ea(e){let{...t}=e;return(0,n.jsx)(en._s.Portal,{"data-slot":"drawer-portal",...t})}function el(e){let{className:t,...r}=e;return(0,n.jsx)(en._s.Overlay,{"data-slot":"drawer-overlay",className:x("fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...r})}function eo(e){let{className:t,children:r,overlayClassName:i,portalContainer:a,showHandle:l=!0,...o}=e;return(0,n.jsxs)(ea,{"data-slot":"drawer-portal",container:a,children:[(0,n.jsx)(el,{className:i}),(0,n.jsxs)(en._s.Content,{"data-slot":"drawer-content",className:x("group/drawer-content fixed z-50 flex h-auto flex-col bg-popover text-sm text-popover-foreground data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",t),...o,children:[l&&(0,n.jsx)("div",{className:"mx-auto mt-4 hidden h-1 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),r]})]})}function es(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"drawer-header",className:x("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-0.5 md:text-left",t),...r})}function ec(e){let{className:t,...r}=e;return(0,n.jsx)("div",{"data-slot":"drawer-footer",className:x("mt-auto flex flex-col gap-2 p-4",t),...r})}function eu(e){let{className:t,...r}=e;return(0,n.jsx)(en._s.Title,{"data-slot":"drawer-title",className:x("font-heading text-base font-medium text-foreground",t),...r})}function ed(e){let{className:t,...r}=e;return(0,n.jsx)(en._s.Description,{"data-slot":"drawer-description",className:x("text-sm text-muted-foreground",t),...r})}var eh=r(9748);function em(e){let{className:t,children:r,...i}=e;return(0,n.jsxs)(eh.bL,{"data-slot":"scroll-area",className:x("relative",t),...i,children:[(0,n.jsx)(eh.LM,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:r}),(0,n.jsx)(ep,{}),(0,n.jsx)(eh.OK,{})]})}function ep(e){let{className:t,orientation:r="vertical",...i}=e;return(0,n.jsx)(eh.VM,{"data-slot":"scroll-area-scrollbar","data-orientation":r,orientation:r,className:x("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",t),...i,children:(0,n.jsx)(eh.lr,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}var ef=r(2828),eg=r(8930);async function eb(e){var t;let{title:r,url:n}=e;if("u"<typeof navigator)return"unavailable";if("function"==typeof navigator.share)try{return await navigator.share({title:r,url:n}),"shared"}catch{return"cancelled"}if(null==(t=navigator.clipboard)?void 0:t.writeText)try{return await navigator.clipboard.writeText(n),"copied"}catch{}return"unavailable"}function ex(e){let{object:t,placing:r=!1,portalContainer:i,showcaseHost:a,testId:s,onOpenChange:c,onPlace:u,onShared:d,onViewOnSite:h}=e,{t:m}=(0,o.Bd)(),[p,f]=(0,l.useState)(),[g,b]=(0,l.useReducer)((e,t)=>t,0),v=(0,l.useMemo)(()=>t?(0,I.H7)(t):[],[t]),w=t?(0,R.J)(t.name)??m("catalog.unnamedProduct"):"",j=(0,R.J)(null==t?void 0:t.description),y=(0,R.R)(a,null==t?void 0:t.tinuuid),N=async()=>{let e=await eb({title:w,url:y??("u"<typeof location?"":location.href)});null==d||d(e)};return(0,l.useEffect)(()=>{b(0)},[t]),(0,l.useEffect)(()=>{if(!p)return;let e=()=>b(p.selectedScrollSnap());return e(),p.on("select",e),p.on("reInit",e),()=>{p.off("select",e),p.off("reInit",e)}},[p]),(0,n.jsx)(ei,{open:!!t,onOpenChange:c,children:(0,n.jsxs)(eo,{"data-testid":s,overlayClassName:"bg-[#212124]/60 backdrop-blur-0",portalContainer:i,showHandle:!1,className:"right-2 bottom-2 left-2 mx-auto max-h-[calc(100svh-72px)] max-w-[386px] overflow-hidden rounded-[24px] border-0 bg-white text-[#212124] shadow-2xl data-[vaul-drawer-direction=bottom]:inset-x-2 data-[vaul-drawer-direction=bottom]:bottom-2 data-[vaul-drawer-direction=bottom]:mt-[72px] data-[vaul-drawer-direction=bottom]:max-h-[calc(100svh-72px)] data-[vaul-drawer-direction=bottom]:rounded-[24px]",children:[(0,n.jsx)("div",{className:"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-[#dadae0]"}),(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[(0,n.jsxs)(es,{className:"px-6 pt-4 pb-0 text-left",children:[(0,n.jsx)(eu,{className:"text-base font-medium leading-snug text-[#212124]",children:w}),(0,n.jsx)(ed,{className:"sr-only",children:m("catalog.productDetails")})]}),(0,n.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pt-4",children:(0,n.jsx)(em,{className:"h-full pr-1",children:(0,n.jsxs)("div",{className:"grid gap-4 pb-4",children:[(0,n.jsx)("div",{className:"grid gap-2",children:v.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ee,{className:"select-none touch-pan-y",setApi:f,opts:{duration:18,loop:v.length>1},children:(0,n.jsx)(et,{className:"-ml-0 touch-pan-y will-change-transform",children:v.map(e=>(0,n.jsx)(er,{className:"pl-0",children:(0,n.jsx)("div",{className:"ar-catalog-media-frame",children:(0,n.jsx)("img",{src:e,alt:"",className:"ar-catalog-media-img ar-catalog-media-img--passive",decoding:"async",draggable:!1,loading:"eager"})})},e))})}),v.length>1&&(0,n.jsx)("div",{className:"flex justify-center gap-1.5","aria-hidden":"true",children:v.map((e,t)=>(0,n.jsx)("span",{className:x("size-1.5 rounded-full",t===g?"bg-primary":"bg-[#d9d9d9]")},e))})]}):(0,n.jsx)("div",{className:"grid aspect-[338/237] place-items-center rounded-lg bg-[#ededed]",children:(0,n.jsx)(D,{"aria-hidden":"true",className:"size-10 text-[#bebec8]"})})}),j&&(0,n.jsx)("p",{className:"whitespace-pre-line text-sm font-medium leading-[1.5] text-[#212124]",children:j})]})})}),(0,n.jsxs)(ec,{className:"sticky bottom-0 gap-3 bg-white px-6 pt-3 pb-[max(1.875rem,env(safe-area-inset-bottom))]",children:[u&&(0,n.jsxs)(Z,{className:"w-full",size:"lg","data-testid":"ar-product-place",disabled:r,onClick:()=>void u(),children:[r?(0,n.jsx)(k,{className:"size-5"}):(0,n.jsx)(A,{className:"size-6","aria-hidden":"true"}),m("catalog.tryInRoom")]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[y&&(0,n.jsx)(Z,{asChild:!0,className:"min-w-0 flex-1",size:"lg",variant:u?"secondary":"default",children:(0,n.jsxs)("a",{href:y,target:"_blank",rel:"noreferrer",onClick:h,children:[m("catalog.viewOnSite"),(0,n.jsx)(ef.A,{className:"size-4","aria-hidden":"true"})]})}),(0,n.jsxs)(Z,{className:"min-w-0 flex-1",size:"lg",variant:"secondary","data-testid":"ar-product-share",onClick:()=>void N(),children:[(0,n.jsx)(eg.A,{className:"size-4","aria-hidden":"true"}),m("share")]})]})]})]})]})})}function ev(){if("u"<typeof document)return;let e=document.activeElement;e instanceof HTMLElement&&e.blur()}function ew(e,t){return{category:e.category,resultCount:t,search:e.search.trim()}}function ej(e){var t;let{catalog:r,categories:i,filters:a,isLoadingCategories:s,mechanic:c,owner:u,ownerAccount:d,pagination:h,setFilters:m,showcaseHost:f,onOpenChange:g,onPlace:b,open:x,portalContainer:v}=e,{t:w}=(0,o.Bd)(),j=(0,C.Xf)(),y=(0,M.Rl)(x),N=(0,M.f3)(x),{fetchNextPage:z,hasNextPage:L,isFetchingNextPage:S}=h,Z=(0,l.useRef)(null),W=(0,l.useRef)(ew(a,r.length)),Y=(0,l.useRef)(a.search.trim()),[k,T]=(0,l.useState)(null),[D,P]=(0,l.useState)(null),[X,A]=(0,l.useState)(!1),[O,G]=(0,l.useState)(!1),F=(0,l.useRef)(!1);x&&(W.current=ew(a,r.length)),(0,l.useEffect)(()=>{if(x)return j({catalog:W.current,name:"catalog_opened"}),()=>j({catalog:W.current,name:"catalog_closed"})},[j,x]),(0,l.useEffect)(()=>{let e=a.search.trim();if(!x){Y.current=e;return}if(e===Y.current)return;let t=window.setTimeout(()=>{Y.current=e,j({catalog:{category:a.category,search:e},name:"catalog_search_changed"})},400);return()=>window.clearTimeout(t)},[j,a.category,a.search,x]),(0,l.useEffect)(()=>{let e=Z.current;x&&e&&!S&&L&&e.scrollHeight<=e.clientHeight&&z()},[r.length,z,L,S,x,O]);let V=(0,l.useCallback)(e=>{if(!L||S)return;let{clientHeight:t,scrollHeight:r,scrollTop:n}=e.currentTarget;n+t>=r-96&&z()},[z,L,S]),J=(0,l.useCallback)(e=>{e||(G(!1),T(null),P(null),A(!1),m({category:null,search:""})),g(e)},[g,m]),B=(0,l.useCallback)(e=>{m(t=>({...t,search:e}))},[m]),K=(0,l.useCallback)(e=>{m(t=>({...t,category:e})),j({catalog:{category:e,search:a.search.trim()},name:"catalog_category_selected"})},[j,a.search,m]),q=(0,l.useCallback)(()=>{m(e=>({...e,search:""}))},[m]),$=(0,l.useCallback)(()=>{q(),ev()},[q]),ee=(0,l.useCallback)(()=>{G(!1),ev()},[]);(0,l.useEffect)(()=>{if(!O){F.current=!1;return}if(N){F.current=!0;return}if(!F.current)return;let e=window.setTimeout(ee,200);return()=>window.clearTimeout(e)},[ee,N,O]);let et=(0,l.useCallback)(()=>{m({category:null,search:""}),ee(),j({catalog:{category:null,search:""},name:"catalog_show_all_clicked"})},[ee,j,m]),er=(0,l.useCallback)(e=>{H(e,c)&&(ee(),A(!1),T(e),j({object:(0,C.ZY)(e,U(e)),name:"catalog_product_opened"}))},[ee,j,c]),en=(0,l.useCallback)(async()=>{if(!k)return;let e=U(k);e&&(P(k),A(!1),j({object:(0,C.ZY)(k,e),name:"catalog_product_place_clicked"}),await b(k,e).catch(()=>!1)?(j({object:(0,C.ZY)(k,e),name:"catalog_product_place_succeeded"}),J(!1)):(j({object:(0,C.ZY)(k,e),name:"catalog_product_place_failed"}),A(!0)),P(null))},[j,J,b,k]),ei=(t=w("catalog.unnamedOwner"),(0,R.J)(null==d?void 0:d.name)??(0,R.J)(null==u?void 0:u.name)??t),ea=(0,I.cV)(null==d?void 0:d.avatar)??(0,I.cV)(null==u?void 0:u.avatar),el=(0,I.cV)(null==d?void 0:d.background),eo=a.search.trim().length>0&&0===r.length;return(0,n.jsx)(p.lG,{open:x,onOpenChange:J,children:(0,n.jsxs)(p.Cf,{contentInsideOverlay:!0,"data-testid":"ar-catalog-dialog",className:"inset-0 top-0 left-0 flex h-[100svh] max-h-none w-full !max-w-none translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden rounded-none border-0 bg-white p-0 text-[#212124] shadow-none",portalContainer:v,style:y,showCloseButton:!1,onOpenAutoFocus:e=>{e.preventDefault()},onInteractOutside:e=>{e.preventDefault()},children:[(0,n.jsx)(p.L3,{className:"sr-only",children:w("catalog.title")}),(0,n.jsx)(p.rr,{className:"sr-only",children:w("catalog.description")}),(0,n.jsxs)("div",{ref:O?void 0:Z,"aria-hidden":O,className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[calc(5.75rem+var(--ar-catalog-keyboard-bottom,0px)+env(safe-area-inset-bottom))] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden","data-testid":"ar-catalog-grid",onScroll:V,children:[(0,n.jsx)(ey,{accountName:ei,avatarUrl:ea,backgroundUrl:el}),(0,n.jsx)(eN,{categories:i,filters:a,isLoading:s,onChange:K}),X&&(0,n.jsx)("p",{className:"mx-5 mt-4 rounded-xl bg-red-50 p-3 text-sm font-medium text-red-600","aria-live":"polite",children:w("catalog.placementFailed")}),(0,n.jsx)(E,{catalog:r,isEmptySearch:eo,isFetchingNextPage:S,mechanic:c,placingObject:D,search:a.search,onSelectObject:er,onShowAllItems:et})]}),O?(0,n.jsx)(_,{catalog:r,gridRef:Z,isEmptySearch:eo,isFetchingNextPage:S,mechanic:c,placingObject:D,search:a.search,onClearSearch:q,onClose:ee,onScroll:V,onSearchChange:B,onSelectObject:er,onShowAllItems:et}):(0,n.jsx)(Q,{search:a.search,onClearSearch:$,onClose:()=>J(!1),onOpenSearch:()=>G(!0)}),(0,n.jsx)(ex,{object:k,placing:D===k,portalContainer:v,showcaseHost:f,onOpenChange:e=>{e||T(null)},onPlace:en,onViewOnSite:()=>{k&&j({object:(0,C.ZY)(k,U(k)),name:"catalog_product_view_on_site_clicked"})}})]})})}function ey(e){let{accountName:t,avatarUrl:r,backgroundUrl:i}=e;return(0,n.jsxs)("section",{"data-testid":"ar-catalog-hero",children:[(0,n.jsx)("div",{className:"relative aspect-[4/1] w-full overflow-hidden bg-[#dadae0]",children:i?(0,n.jsx)("img",{src:i,alt:"",className:"absolute inset-0 size-full object-cover",decoding:"async"}):null}),(0,n.jsxs)("div",{className:"px-5 pb-4",children:[(0,n.jsxs)(w,{className:"-mt-9 size-[72px] border-[3px] border-white bg-[#c9c9d2] shadow-sm",children:[(0,n.jsx)(j,{src:r,alt:"",className:"object-cover"}),(0,n.jsx)(y,{className:"bg-[#c9c9d2] text-[#64646c]",children:(0,n.jsx)(N.A,{className:"size-8","aria-hidden":"true"})})]}),(0,n.jsx)("h2",{className:"mt-3 text-xl leading-tight font-semibold text-[#212124]",children:t})]})]})}function eN(e){let{categories:t,filters:r,isLoading:i,onChange:a}=e,{t:l}=(0,o.Bd)();return i?(0,n.jsx)("div",{className:"flex gap-5 overflow-x-auto px-5 pt-5 pb-3 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:[0,1,2].map(e=>(0,n.jsx)("span",{className:"h-5 w-20 shrink-0 rounded bg-[#ededed]"},e))}):0===t.length?null:(0,n.jsxs)("div",{className:"flex gap-5 overflow-x-auto border-b border-[#ededed] px-5 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:[(0,n.jsx)(eM,{active:!r.category,label:l("catalog.all"),onClick:()=>a(null)}),t.map(e=>{var t;return(0,n.jsx)(eM,{active:(null==(t=r.category)?void 0:t.id)===e.id&&r.category.kind===e.kind,label:e.name,onClick:()=>a(e)},`${e.kind}:${e.id}`)})]})}function eM(e){let{active:t,label:r,onClick:i}=e;return(0,n.jsxs)("button",{type:"button","aria-pressed":t,className:x("relative shrink-0 py-3 text-base font-medium whitespace-nowrap",t?"text-[#212124]":"text-[#64646c]"),onClick:i,children:[r,t?(0,n.jsx)("span",{"aria-hidden":"true",className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-primary"}):null]})}let eC="text-white/90 [text-shadow:0_1px_4px_rgba(0,0,0,.6)]",eI={"camera-intro":r.p+"static/svg/camera-intro.59d57f3d.svg","gesture-move":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwMCIgaGVpZ2h0PSI2MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iLTE3LjAgMTkuNCAxMzYuNSA4MS45IiBhcmlhLWhpZGRlbj0idHJ1ZSIgeG1sbnM6YzJwYT0iaHR0cDovL2MycGEub3JnL21hbmlmZXN0Ij4KPHN0eWxlPgouZ2VzdHVyZS1tb3ZlLXBlcnNwZWN0aXZlX19jdWJlLC5nZXN0dXJlLW1vdmUtcGVyc3BlY3RpdmVfX2Zpbmdlcnt0cmFuc2Zvcm0tYm94OnZpZXctYm94O3RyYW5zZm9ybS1vcmlnaW46MCAwO2FuaW1hdGlvbi1kdXJhdGlvbjoyLjRzO2FuaW1hdGlvbi1pdGVyYXRpb24tY291bnQ6aW5maW5pdGU7YW5pbWF0aW9uLWRpcmVjdGlvbjphbHRlcm5hdGU7YW5pbWF0aW9uLWZpbGwtbW9kZTpib3RofQouZ2VzdHVyZS1tb3ZlLXBlcnNwZWN0aXZlX19jdWJle2FuaW1hdGlvbi1uYW1lOmdlc3R1cmUtbW92ZS1wZXJzcGVjdGl2ZS1jdWJlO3RyYW5zZm9ybS1vcmlnaW46NjBweCA2NnB4fQouZ2VzdHVyZS1tb3ZlLXBlcnNwZWN0aXZlX19maW5nZXJ7YW5pbWF0aW9uLW5hbWU6Z2VzdHVyZS1tb3ZlLXBlcnNwZWN0aXZlLWZpbmdlcn0KQGtleWZyYW1lcyBnZXN0dXJlLW1vdmUtcGVyc3BlY3RpdmUtY3ViZXswJSwyMi45JXt0cmFuc2Zvcm06dHJh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N0cm9rZS13aWR0aD0iMS4yNCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+PC9nPgo8ZyBjbGFzcz0icmVzY2FuX19saWZ0Ij48ZyBjbGFzcz0icmVzY2FuX19wYW4iPgo8cmVjdCB4PSI0MCIgeT0iNTIiIHdpZHRoPSIxNiIgaGVpZ2h0PSIyOCIgcng9IjQuNSIgZmlsbD0iIzFCMUMyMSIgc3Ryb2tlPSIjRjRGNUY4IiBzdHJva2Utd2lkdGg9IjEuMjQiLz4KPHJlY3QgeD0iNDUiIHk9IjU1IiB3aWR0aD0iNiIgaGVpZ2h0PSIyLjUiIHJ4PSIxLjI1IiBmaWxsPSIjRjRGNUY4IiBmaWxsLW9wYWNpdHk9Ii44Ii8+CjwvZz48L2c+Cjwvc3ZnPgo=","scan-floor":r.p+"static/svg/scan-floor.5dee2ec3.svg","scan-wall":r.p+"static/svg/scan-wall.23490063.svg"};function eR(e){let{className:t,name:r,size:i=120}=e,a=eI[r];return a?(0,n.jsx)("img",{alt:"",className:x("shrink-0 select-none",t),"data-illustration":r,"data-testid":`ar-illustration-${r}`,draggable:!1,src:a,style:{maxHeight:i,maxWidth:i}}):(0,n.jsx)("div",{"aria-hidden":"true",className:x("grid shrink-0 place-items-center rounded-2xl border-2 border-dashed border-white/45 bg-black/55 p-3 text-center",t),"data-illustration":r,"data-testid":`ar-illustration-${r}`,style:{height:i,width:i},children:(0,n.jsx)("span",{className:"text-[10px] leading-tight font-medium tracking-wide text-white/70 uppercase",children:r})})}let ez={all:"scan-floor",ceiling:"scan-floor",floor:"scan-floor",wall:"scan-wall"};function eL(e){let{mechanic:t,positionStyle:r,showHelp:i}=e,{t:a}=(0,o.Bd)();return(0,n.jsxs)("div",{className:"pointer-events-none absolute inset-x-6 z-10 flex flex-col items-center gap-3","data-testid":"ar-scan-guide",style:r,children:[(0,n.jsxs)("div",{"aria-live":"polite",className:`grid max-w-full justify-items-center gap-3 px-8 pt-4 pb-6 text-center text-sm ${eC}`,"data-testid":"ar-scan-instruction",children:[(0,n.jsx)(eR,{name:ez[t],size:252}),(0,n.jsxs)("span",{className:"grid gap-1",children:[(0,n.jsx)("span",{className:"text-base font-semibold",children:a(`${t}.searching`)}),(0,n.jsx)("span",{children:a(`${t}.scanMove`)})]})]}),i?(0,n.jsx)("p",{"aria-live":"polite",className:"max-w-full px-3 py-1.5 text-center text-xs text-white/70 [text-shadow:0_1px_4px_rgba(0,0,0,.6)]","data-testid":"ar-scan-help",children:a("scan.help")}):null]})}function eS(e){let{mechanic:t,positionStyle:r}=e,[i,a]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=setTimeout(()=>a(!0),8e3);return()=>clearTimeout(e)},[t]),(0,n.jsx)(eL,{mechanic:t,positionStyle:r,showHelp:i})}var eZ=r(2083),eW=r(251),eY=r(4856),ek=r(9690);let eT={"camera-denied":"cameraDenied",error:"error",rescan:"rescan",unsupported:"unsupported",webview:"webview"},eD={"camera-denied":eZ.A,error:eW.A,rescan:eY.A,unsupported:eW.A,webview:ef.A},eP={rescan:"rescan"};function eX(e){let{cameraSettingsBrowser:t,variant:r}=e,{t:i}=(0,o.Bd)(),a=void 0===t?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"u"<typeof navigator?"":navigator.userAgent;if(!e)return null;let t=new ek.O(e),r=t.getBrowser().name??"";return"iOS"===(t.getOS().name??"")?/^(?:Safari|Mobile Safari)$/i.test(r)?"safari":null:/Firefox/i.test(r)?"firefox":/^(?:Chrome|Chromium|Edge|Mobile Chrome|Mobile Edge)$/i.test(r)?"chrome":null}():t,l=eT[r],s=r in eP?eP[r]:null,c=eD[r];return(0,n.jsxs)("div",{className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-black/85 p-8 text-center text-white",role:"alert",children:[s?(0,n.jsx)(eR,{className:"mb-3",name:s,size:192}):(0,n.jsx)(c,{"aria-hidden":"true",className:"size-10"}),(0,n.jsx)("h2",{className:"text-lg font-medium",children:i(`runtimeState.${l}.title`)}),(0,n.jsx)("p",{className:"max-w-sm text-sm text-white/80",children:i(`runtimeState.${l}.body`)}),"camera-denied"===r&&a?(0,n.jsx)("p",{className:"max-w-sm rounded-xl bg-white/10 px-3 py-2 text-sm text-white/90","data-testid":"ar-camera-settings-path",children:i(`runtimeState.cameraDenied.path.${a}`)}):null]})}function eA(e){let{status:t}=e;return"lost"!==t?null:(0,n.jsx)(eX,{variant:"rescan"})}function eO(e){return Math.min(10,Math.max(.45,e))}function eG(e,t){if("floor"!==e.kind)throw Error("Ceiling calibration requires a floor surface hit.");let r=eO(t),n=e.pose.position.y;return{floorY:n,position:{x:e.pose.position.x,y:n+r,z:e.pose.position.z},scale:1,suspensionHeight:r,yaw:0}}function eU(e){return{startedAt:e}}function eH(e,t,r){return r?e.suspensionHeight:Math.max(0,e.suspensionHeight-t*e.scale)}function eE(e){let{active:t=!1}=e;return(0,n.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 z-0","data-testid":"ar-bottom-scrim",style:{backgroundImage:"linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.86) 26%, rgba(0,0,0,.80) 46%, rgba(0,0,0,.68) 62%, rgba(0,0,0,.48) 75%, rgba(0,0,0,.26) 86%, rgba(0,0,0,.09) 94%, rgba(0,0,0,0) 100%)",height:"34%",opacity:t?1:.2,transition:t?"opacity 180ms cubic-bezier(0, 0, .2, 1)":"opacity 260ms cubic-bezier(.4, 0, 1, 1)"}})}var eF=r(308);function eV(){return{missingSince:null,status:"tracking"}}function eJ(e,t){if(t.hasPose)return eV();let r=e.missingSince??t.now,n=t.now-r;return n>=5e3?{missingSince:r,status:"lost"}:n>=1e3?{missingSince:r,status:"relocalizing"}:{missingSince:r,status:"tracking"}}let eB=`
|
|
2
|
+
uniform float uWidth, uDepth;
|
|
3
|
+
varying vec2 vPos;
|
|
4
|
+
void main() {
|
|
5
|
+
vec3 p = position;
|
|
6
|
+
p.x *= uWidth;
|
|
7
|
+
p.z *= uDepth;
|
|
8
|
+
vPos = p.xz;
|
|
9
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(p, 1.0);
|
|
10
|
+
}
|
|
11
|
+
`,e_=`
|
|
12
|
+
precision highp float;
|
|
13
|
+
uniform float uWidth, uDepth, uBorder, uRadius, uInset, uOpacity;
|
|
14
|
+
uniform vec3 uColor;
|
|
15
|
+
varying vec2 vPos;
|
|
16
|
+
|
|
17
|
+
float sdRoundRect(vec2 p, vec2 b, float r) {
|
|
18
|
+
vec2 q = abs(p) - (b - vec2(r));
|
|
19
|
+
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
void main() {
|
|
23
|
+
vec2 halfSize = 0.5 * vec2(uWidth, uDepth);
|
|
24
|
+
float safeRadius = max(0.0, min(halfSize.x, halfSize.y) - 0.0001);
|
|
25
|
+
float r = clamp(uRadius, 0.0, safeRadius);
|
|
26
|
+
float dOuter = sdRoundRect(vPos, halfSize - vec2(uInset), max(0.0, r - uInset));
|
|
27
|
+
float dInner = sdRoundRect(vPos, halfSize - vec2(uInset + uBorder), max(0.0, r - (uInset + uBorder)));
|
|
28
|
+
|
|
29
|
+
float aa = max(fwidth(dOuter), 0.0005);
|
|
30
|
+
float outer = smoothstep(0.0, aa, -dOuter);
|
|
31
|
+
float inner = smoothstep(0.0, aa, -dInner);
|
|
32
|
+
float borderMask = clamp(outer - inner, 0.0, 1.0);
|
|
33
|
+
|
|
34
|
+
float alpha = borderMask * uOpacity;
|
|
35
|
+
if (alpha < 0.001) discard;
|
|
36
|
+
gl_FragColor = vec4(uColor, alpha);
|
|
37
|
+
}
|
|
38
|
+
`,eQ=`
|
|
39
|
+
varying vec2 vUv;
|
|
40
|
+
void main() {
|
|
41
|
+
vUv = uv;
|
|
42
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
43
|
+
}
|
|
44
|
+
`,eK=`
|
|
45
|
+
precision highp float;
|
|
46
|
+
varying vec2 vUv;
|
|
47
|
+
uniform vec3 uColor;
|
|
48
|
+
uniform float uOpacity;
|
|
49
|
+
uniform float uSoftness;
|
|
50
|
+
|
|
51
|
+
void main() {
|
|
52
|
+
vec2 p = vUv * 2.0 - 1.0;
|
|
53
|
+
float radial = length(p);
|
|
54
|
+
float edge = max(0.01, min(0.99, 1.0 - uSoftness));
|
|
55
|
+
float mask = 1.0 - smoothstep(edge, 1.0, radial);
|
|
56
|
+
float alpha = mask * uOpacity;
|
|
57
|
+
if (alpha < 0.001) discard;
|
|
58
|
+
gl_FragColor = vec4(uColor, alpha);
|
|
59
|
+
}
|
|
60
|
+
`,eq="arSessionHelper";function e$(e){e.userData[eq]=!0}function e0(e){return!0===e.userData[eq]}function e1(e){for(let t=e;t;t=t.parent)if(!t.visible)return!1;return!0}let e2=new eF.kn4,e4=new eF.RlV,e3=new eF.Zcv(new eF.Pq0(0,1,0),0),e5=new eF.Pq0;function e9(e,t,r,n,i){if(!e1(e)||(e2.copy(e.matrixWorld).invert(),e4.copy(t.ray).applyMatrix4(e2),!e4.intersectPlane(e3,e5)||Math.abs(e5.x)>n||Math.abs(e5.z)>i))return;let a=e5.clone().applyMatrix4(e.matrixWorld),l=t.ray.origin.distanceTo(a);l<t.near||l>t.far||r.push({distance:l,object:e,point:a})}function e7(e,t){let{uniforms:r}=this.material;e9(this,e,t,r.uWidth.value/2,r.uDepth.value/2)}function e6(e,t){e1(this)&&eF.eaF.prototype.raycast.call(this,e,t)}function e8(e){let{border:t,color:r,depth:n,doubleSide:i,inset:a,opacity:l,radius:o,renderOrder:s,width:c}=e,u=new eF.bdM(1,1).rotateX(-Math.PI/2),d=new eF.BKk({depthWrite:!1,fragmentShader:e_,side:2*!!i,transparent:!0,uniforms:{uBorder:{value:t},uColor:{value:new eF.Q1f(r)},uDepth:{value:n},uInset:{value:a},uOpacity:{value:l},uRadius:{value:o},uWidth:{value:c}},vertexShader:eB}),h=new eF.eaF(u,d);return h.renderOrder=s,h.raycast=e7,e$(h),h}function te(e,t){let{depth:r,radius:n,width:i}=t,a=e.material;a.uniforms.uDepth.value=r,a.uniforms.uRadius.value=n,a.uniforms.uWidth.value=i}function tt(e){if(!e)return;e.geometry.dispose();let t=e.material;Array.isArray(t)?t.forEach(e=>e.dispose()):t.dispose()}let tr="#ffffff",tn={depth:.36,radius:.09,width:.36};function ti(e){let{phase:t,placing:r,selected:n}=e;return n||r&&"preview"===t}function ta(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;e.updateWorldMatrix(!0,!0);let n=r.matrixWorld.clone().invert(),i=new eF.NRn,a=new eF.NRn,l=new eF.kn4,o=!1;for(let r of(t=[],e.traverse(e=>{"isMesh"in e&&e.isMesh&&!e0(e)&&t.push(e)}),t))r.geometry.boundingBox||r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(a.copy(r.geometry.boundingBox),a.applyMatrix4(l.multiplyMatrices(n,r.matrixWorld)),o?i.union(a):(i.copy(a),o=!0));return o?{max:{x:i.max.x,y:i.max.y,z:i.max.z},min:{x:i.min.x,y:i.min.y,z:i.min.z}}:null}function tl(e,t){return{height:Math.max(.1,t+.1),width:Math.max(.1,e+.1)}}function to(e){let{elapsedMs:t,from:r,to:n}=e;return r+(n-r)*(1-(1-Math.min(1,Math.max(0,t/240)))**3)}let ts={floorY:0,position:{x:0,y:2,z:-1},scale:1,suspensionHeight:2,yaw:0};function tc(){return{...ts,position:{...ts.position}}}function tu(e){return e.runtime.modelHeight??e.resource.dimensions.height}var td=r(2326);let th=Object.freeze({engine:!0});function tm(e){let{bridge:t}=e;(0,td.D)(()=>void 0,1);let r=(0,td.C)(),n=(0,l.useRef)(r);return n.current=r,(0,l.useEffect)(()=>t.onFrame(e=>{let{time:t}=e;return(0,td.n)(t/1e3,!0,n.current,th)}),[t]),null}function tp(e){return e.slice(e.indexOf(".")+1)}function tf(e){return e.slice(0,e.indexOf("."))}let tg=new Set(["catalog","finish","gestures","move","rotate","select"]),tb=new Set(["catalog","finish","rotate"]),tx=["move","rotate","finish"],tv=["select","catalog"],tw=new Set(["ceiling","wall"]),tj={finish:"gesture-tap-away",move:"gesture-move",rotate:"gesture-rotate",select:"gesture-tap"};function ty(e){let t=tp(e);return tg.has(t)?tb.has(t)?t:tw.has(tf(e))?`${t}-with-floor-circle`:t:null}let tN={wall:{move:"gesture-move-wall"}},tM={move:"move",release:"finish",rotate:"rotate"};function tC(e){let{texture:t}=e,r=(0,td.C)(e=>e.scene);return(0,l.useEffect)(()=>(function(e,t){if(!e)return()=>void 0;let r=e.environment;return e.environment=t,()=>{e.environment=r}})(r,t),[r,t]),null}function tI(e){return{mechanic:e.mechanic,objectId:e.id,variantId:e.variantId}}function tR(e){return e instanceof Error?{message:e.message,name:e.name}:{message:"string"==typeof e?e:void 0}}var tz=r(7503),tL=r(2002),tS=r(112);let tZ="max(1.5rem, env(safe-area-inset-bottom))";function tW(e){let{currentVariantId:t,variants:r,onSelect:i}=e,{t:a}=(0,o.Bd)();return r.length<2?null:(0,n.jsx)("div",{className:"-mx-5 overflow-x-auto overscroll-x-contain px-5 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","data-testid":"ar-session-variant-tiles",children:(0,n.jsx)("div",{className:"flex w-max gap-2",children:r.map(e=>{let r=e.hid===t;return(0,n.jsx)("button",{type:"button","aria-label":e.name??a("variant"),"aria-pressed":r,className:`size-20 shrink-0 rounded-2xl p-[3px] shadow-[0_2px_10px_rgba(0,0,0,0.25)] transition-colors ${r?"bg-[#5B6BFF]":"bg-white/85"}`,"data-testid":r?"ar-session-variant-tile-current":"ar-session-variant-tile",onClick:()=>i(e.hid),children:e.previewUrl?(0,n.jsx)("img",{alt:"",className:"size-full rounded-[11px] object-cover",draggable:!1,src:e.previewUrl}):(0,n.jsx)("span",{className:"grid size-full place-items-center rounded-[11px] bg-[#e7e7ea] px-1 text-[11px] leading-tight text-[#44444c]",children:e.name})},e.hid)})})})}let tY="flex h-11 min-w-0 items-center gap-1.5 rounded-full bg-white px-4 text-sm font-medium text-[#212124] shadow-[0_2px_10px_rgba(0,0,0,0.18)]",tk="rounded-full bg-white text-[#212124] shadow-[0_2px_10px_rgba(0,0,0,0.18)] hover:bg-[#f3f3f5] active:bg-[#ededed]",tT="grid grid-cols-[minmax(0,1fr)] gap-3";function tD(e){let{children:t,show:r}=e,[i,a]=(0,l.useState)(r),o=(0,l.useRef)(t);return(r&&(o.current=t),(0,l.useEffect)(()=>{if(r)return void a(!0);let e=setTimeout(()=>a(!1),150);return()=>clearTimeout(e)},[r]),i||r)?(0,n.jsx)("div",{className:"ar-panel col-start-1 row-start-1","data-state":r?"entering":"exiting",inert:!r||void 0,children:r?t:o.current}):null}function tP(e){let{currentVariantId:t,productName:r,showShareButton:i,showVariantChip:a,variants:l,onOpenProduct:s,onOpenVariants:c,onShare:u}=e,{t:d}=(0,o.Bd)(),h=l.find(e=>e.hid===t)??null;return(0,n.jsxs)("div",{className:"flex items-center gap-2","data-testid":"ar-session-object-row",children:[i?(0,n.jsx)(m.$,{className:tk,size:"icon-lg",variant:"secondary","aria-label":d("share"),"data-testid":"ar-session-share",onClick:u,children:(0,n.jsx)(eg.A,{"aria-hidden":"true"})}):null,(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2",children:[a&&l.length>1?(0,n.jsxs)("button",{type:"button","aria-label":d("catalog.selectVariant"),className:`${tY} shrink-0`,"data-testid":"ar-session-variant-chip",onClick:c,children:[(0,n.jsx)("span",{className:"max-w-32 truncate",children:(null==h?void 0:h.name)||d("variant")}),(0,n.jsx)(tz.A,{"aria-hidden":"true",className:"size-4 shrink-0 text-[#64646c]"})]}):null,(0,n.jsxs)("button",{type:"button",className:`${tY} min-w-0 shrink`,"data-testid":"ar-session-product",onClick:s,children:[(0,n.jsx)("span",{className:"min-w-0 truncate",children:r}),(0,n.jsx)(tz.A,{"aria-hidden":"true",className:"size-4 shrink-0 text-[#64646c]"})]})]})]})}function tX(e){let{confirmDisabled:t,confirmLabel:r,controlsRef:i,currentVariantId:a,productName:l,calledOutCatalog:s=!1,showAddObjectButton:c=!1,showCatalogButton:u,showConfirmButton:d,showSetFloorButton:h,showShareButton:p,variantPicker:f="tiles",variants:g,onConfirm:b,onOpenCatalog:x,onOpenProduct:v,onOpenVariants:w,onSelectVariant:j,onSetFloorPoint:y,onShare:N}=e,{t:M}=(0,o.Bd)(),C=h||d||u||c,I=!!l,R=I&&C?"both":I?"object":C?"slots":"none",z="tiles"===f&&g.length>1,L=l?(0,n.jsxs)("div",{className:tT,children:[z?(0,n.jsx)(tW,{currentVariantId:a,variants:g,onSelect:j}):null,(0,n.jsx)(tP,{currentVariantId:a,productName:l,showShareButton:p,showVariantChip:!z,variants:g,onOpenProduct:v,onOpenVariants:w,onShare:N})]}):null,S=(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center",children:[(0,n.jsx)("div",{}),(0,n.jsxs)("div",{className:"flex justify-center",children:[h?(0,n.jsxs)(m.$,{size:"lg",onClick:y,children:[(0,n.jsx)(tL.A,{"aria-hidden":"true"}),M("ceiling.setFloor")]}):null,d?(0,n.jsxs)(m.$,{size:"lg","data-testid":"ar-session-confirm",disabled:t,onClick:b,children:[(0,n.jsx)(tL.A,{"aria-hidden":"true"}),r]}):null,c?(0,n.jsxs)(m.$,{size:"lg","data-testid":"ar-session-add-object",onClick:x,children:[(0,n.jsx)(tS.A,{"aria-hidden":"true"}),M("addObject")]}):null]}),(0,n.jsx)("div",{className:"flex justify-end",children:u?(0,n.jsx)(m.$,{className:`${tk} ${s?"ring-[3px] ring-[#5B6BFF] ring-offset-0":""}`,size:"icon-lg",variant:"secondary","aria-label":M("catalog.open"),"data-testid":"ar-session-catalog",onClick:x,children:(0,n.jsx)(tS.A,{"aria-hidden":"true"})}):null})]});return(0,n.jsxs)("div",{ref:i,className:`absolute inset-x-5 z-10 grid grid-cols-[minmax(0,1fr)] items-end ${"none"===R?"":"min-h-11"}`,style:{bottom:tZ},"data-testid":"ar-session-controls",children:[(0,n.jsx)(tD,{show:"object"===R,children:L}),(0,n.jsx)(tD,{show:"slots"===R,children:S}),(0,n.jsx)(tD,{show:"both"===R,children:(0,n.jsxs)("div",{className:tT,children:[L,S]})})]})}var tA=r(350),tO=r(2585),tG=r(5148);function tU(e){for(let t of Object.values(e))t instanceof eF.gPd&&t.dispose();e.dispose()}function tH(e){e.traverse(e=>{var t;null==(t=e.geometry)||t.dispose(),Array.isArray(e.material)?e.material.forEach(tU):e.material&&tU(e.material)})}class tE{register(e,t,r){this.holders.set(e,(this.holders.get(e)??0)+1),this.requested.add(e);let n=!1;this.scenes.get(e)!==t&&(this.scenes.set(e,t),n=!0),void 0!==r&&this.shownBy.get(r)!==e&&(this.shownBy.set(r,e),n=!0),n&&this.notify();let i=!0;return()=>{i&&(i=!1,this.holders.set(e,(this.holders.get(e)??1)-1),void 0!==r&&this.shownBy.get(r)===e&&(this.shownBy.delete(r),this.notify()),queueMicrotask(()=>this.dropUnheld(e)))}}request(e){this.requested.add(e)}want(e){this.requested.add(e),this.wanted.set(e,(this.wanted.get(e)??0)+1);let t=!0;return()=>{t&&(t=!1,this.wanted.set(e,(this.wanted.get(e)??1)-1),queueMicrotask(()=>this.dropUnheld(e)))}}has(e){return this.scenes.has(e)}showsModel(e){return this.shownBy.has(e)}get size(){return this.scenes.size}release(){if(!this.requested.size&&!this.scenes.size)return;this.scenes.forEach(tH);let e=new Set(this.scenes.keys());this.requested.forEach(t=>e.add(t)),e.forEach(e=>tG.p.clear(e)),this.scenes.clear(),this.holders.clear(),this.wanted.clear(),this.requested.clear(),this.shownBy.clear(),this.notify()}dropUnheld(e){if((this.holders.get(e)??0)>0||(this.wanted.get(e)??0)>0)return;let t=this.scenes.get(e),r=void 0!==t||this.requested.has(e);this.holders.delete(e),this.wanted.delete(e),this.requested.delete(e),t&&(tH(t),this.scenes.delete(e),this.notify()),r&&tG.p.clear(e)}notify(){this.listeners.forEach(e=>e())}constructor(){(0,tO._)(this,"scenes",new Map),(0,tO._)(this,"holders",new Map),(0,tO._)(this,"wanted",new Map),(0,tO._)(this,"requested",new Set),(0,tO._)(this,"shownBy",new Map),(0,tO._)(this,"listeners",new Set),(0,tO._)(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}))}}let tF=(0,l.createContext)(null);function tV(e){let{cache:t,children:r}=e,[i]=(0,l.useState)(()=>new tE),a=t??i;return(0,l.useEffect)(()=>()=>a.release(),[a]),(0,n.jsx)(tF,{value:a,children:r})}function tJ(e){let t=(0,l.use)(tF),r=(0,l.useCallback)(e=>t?t.subscribe(e):()=>void 0,[t]),n=(0,l.useCallback)(()=>!!(e&&(null==t?void 0:t.showsModel(e))),[t,e]);return(0,l.useSyncExternalStore)(r,n,n)}function tB(e){let{illustration:t=null,loadingProgress:r,loadingTitle:i=null,notice:a=null,positionStyle:l,text:s}=e,{t:c}=(0,o.Bd)();if(null===r&&!a&&!s)return null;let u=!!t&&null===r&&!a&&!!s,d=null!==r&&!!i,h=["max-w-full text-center text-sm",eC,u?"grid justify-items-center gap-3 px-8 pt-4 pb-6":d?"grid gap-1 px-6 py-4":"px-4 py-2"].join(" ");return(0,n.jsx)("div",{className:"pointer-events-none absolute inset-x-6 z-10 flex justify-center",style:l,"data-testid":"ar-session-hint-shell",children:null!==r?(0,n.jsx)("div",{className:h,"aria-live":"polite","data-testid":"ar-session-loading",role:"status",children:i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:i}),(0,n.jsx)("span",{className:"opacity-65",children:c("preparingObject",{progress:Math.round(r)})})]}):(0,n.jsx)("span",{children:c("loadingModel",{progress:Math.round(r)})})}):a?(0,n.jsxs)("p",{className:`${h} flex items-center gap-2`,"aria-live":"polite","data-testid":"ar-session-notice",role:"status",children:[(0,n.jsx)(tL.A,{"aria-hidden":"true",className:"size-4 shrink-0"}),a]}):(0,n.jsxs)("div",{className:h,"aria-live":"polite","data-testid":"ar-session-hint",role:"status",children:[u&&t?(0,n.jsx)(eR,{name:t,size:148}):null,(0,n.jsx)("span",{children:s})]})})}function t_(e){let t,r,{illustration:i=null,loadingTitle:a=null,modelCache:o,notice:s=null,pendingModelUrl:c,positionStyle:u,text:d}=e,{active:h,progress:m}=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],{active:t,progress:r}=(0,tA.p)(),[n,i]=(0,l.useState)({active:!1,progress:0}),a=(0,l.useRef)(0);return(0,l.useEffect)(()=>{if(e){a.current=0,i({active:!1,progress:0});return}if(t){a.current=Math.max(a.current,Math.round(r)),i({active:!0,progress:a.current});return}let n=window.setTimeout(()=>{a.current=0,i({active:!1,progress:0})},400);return()=>window.clearTimeout(n)},[t,e,r]),n}((t=(0,l.useCallback)(e=>o?o.subscribe(e):()=>void 0,[o]),r=(0,l.useCallback)(()=>!!(c&&(null==o?void 0:o.has(c))),[o,c]),(0,l.useSyncExternalStore)(t,r,r)||!c));return(0,n.jsx)(tB,{illustration:i,loadingProgress:a&&h?m:null,loadingTitle:a,notice:s,positionStyle:u,text:d})}var tQ=r(5807);function tK(e){let{w:t,x:r,y:n,z:i}=e.orientation;return Math.atan2(2*(t*n+r*i),1-2*(r*r+n*n))}function tq(e,t,r){let n=tK(r)-tK(t),i=Math.atan2(Math.sin(n),Math.cos(n)),a=Math.cos(i),l=Math.sin(i),o=e.position.x-t.position.x,s=e.position.z-t.position.z;return{...e,position:{x:r.position.x+a*o+l*s,y:e.position.y+r.position.y-t.position.y,z:r.position.z-l*o+a*s},yaw:e.yaw+i}}function t$(e,t){if("floor"!==e.kind)throw Error("Floor placement requires a floor surface hit.");return{position:{...e.pose.position},scale:(null==t?void 0:t.scale)??1,yaw:(null==t?void 0:t.yaw)??0}}function t0(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0,z:1},r=Math.hypot(e.x,e.z);return 0===r?{...t,y:0}:{x:0===e.x?0:e.x/r,y:0,z:0===e.z?0:e.z/r}}function t1(e,t){let r=t0(e),n=t0(t);return Math.min(1,Math.max(-1,r.x*n.x+r.z*n.z))}function t2(e,t){let r=t0(e.normal),n={x:t.x-e.pose.position.x,y:0,z:t.z-e.pose.position.z};return r.x*n.x+r.z*n.z>=0?r:{x:0===r.x?0:-r.x,y:0,z:0===r.z?0:-r.z}}function t4(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.height,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.depth/2,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(!(0,tQ.aq)(e))throw Error("Wall placement requires a wall surface hit.");let l=t2(e,r);return{orientationRoot:{pitch:0,position:{x:0,y:-(a+n/2),z:0}},userRoot:{scale:1,yaw:0},worldRoot:{normal:l,position:{x:e.pose.position.x+l.x*i,y:e.pose.position.y,z:e.pose.position.z+l.z*i},yaw:Math.atan2(l.x,l.z)}}}let t3=new WeakSet;function t5(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return-e.minZ*t}function t9(e){return{surface:e.surface,orientationRoot:{position:{...e.orientationRoot.position}},userRoot:{...e.userRoot},worldRoot:{normal:{...e.worldRoot.normal},position:{...e.worldRoot.position},yaw:e.worldRoot.yaw}}}let t7=.4*Math.PI/180,t6=1e3/60;function t8(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.22;if(!Number.isFinite(e)||e<=0)return t;let r=Math.min(4,e/t6);return 1-(1-t)**r}function re(e,t,r){let n=rt({position:e.worldRoot.position,scale:1,yaw:e.worldRoot.yaw},{position:t.worldRoot.position,scale:1,yaw:t.worldRoot.yaw},r),i=rt({position:{x:0,y:0,z:0},scale:e.userRoot.scale,yaw:e.userRoot.yaw},{position:{x:0,y:0,z:0},scale:t.userRoot.scale,yaw:t.userRoot.yaw},r);return{...t,userRoot:{scale:i.scale,yaw:i.yaw},worldRoot:{...t.worldRoot,position:n.position,yaw:n.yaw}}}function rt(e,t){var r,n;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.22,a=t.position.x-e.position.x,l=t.position.y-e.position.y,o=t.position.z-e.position.z,s=Math.hypot(a,l,o),c=(r=e.yaw,Math.atan2(Math.sin((n=t.yaw)-r),Math.cos(n-r)));return{position:s<.001?{...t.position}:{x:e.position.x+a*i,y:e.position.y+l*i,z:e.position.z+o*i},scale:.001>Math.abs(t.scale-e.scale)?t.scale:e.scale+(t.scale-e.scale)*i,yaw:Math.abs(c)<t7?t.yaw:e.yaw+c*i}}function rr(e,t){return null==e?1:Math.max(0,1-Math.min(1,Math.max(0,(t-e)/220))**2)}var rn=r(794),ri=r(2402),ra=r(2662),rl=r(2588);function ro(e){return new eF.BKk({depthTest:!1,depthWrite:!1,fragmentShader:e.fragmentShader,uniforms:eF.LlO.clone(e.uniforms),vertexShader:e.vertexShader})}let rs=(0,l.createContext)(null);function rc(e){let{children:t,renderer:r}=e;return(0,n.jsx)(rs,{value:r,children:t})}function ru(e){let{active:t,root:r,surface:i}=e,{shadow:a,stand:o,standShape:s}=(0,l.useMemo)(()=>{let e=ta(r);if(!e)return{shadow:null,stand:null,standShape:null};let t=function(e,t){let r={x:e.max.x-e.min.x,y:e.max.y-e.min.y,z:e.max.z-e.min.z},n={x:(e.min.x+e.max.x)/2,y:(e.min.y+e.max.y)/2,z:(e.min.z+e.max.z)/2};if("wall"===t){let t=tl(r.x,r.y);return{shadow:null,stand:{border:.016,color:tr,depth:t.height,doubleSide:!0,inset:.02,opacity:.92,position:{x:n.x,y:n.y,z:e.min.z-.006},radius:.06,renderOrder:15,rotationX:Math.PI/2,width:t.width}}}let i="ceiling"===t;return{shadow:i?null:{color:"#000000",depth:Math.max(.12,1.08*r.z),opacity:.28,position:{x:n.x,y:e.min.y+.002,z:n.z},renderOrder:12,softness:.7,width:Math.max(.12,1.08*r.x)},stand:{border:.02,color:tr,depth:Math.max(.14,r.z+.12),doubleSide:i,inset:.03,opacity:.94,position:{x:n.x,y:i?e.max.y-.006:e.min.y+.006,z:n.z},radius:.09,renderOrder:14,rotationX:0,width:Math.max(.14,r.x+.12)}}}(e,i),n=e8(t.stand);n.position.set(t.stand.position.x,t.stand.position.y,t.stand.position.z),n.rotation.x=t.stand.rotationX,n.visible=!1,te(n,tn);let a={depth:t.stand.depth,radius:t.stand.radius,width:t.stand.width};if(!t.shadow)return{shadow:null,stand:n,standShape:a};let l=function(e){let{color:t,depth:r,opacity:n,renderOrder:i,softness:a,width:l}=e,o=new eF.bdM(l,r).rotateX(-Math.PI/2),s=new eF.BKk({depthWrite:!1,fragmentShader:eK,side:2,transparent:!0,uniforms:{uColor:{value:new eF.Q1f(t)},uOpacity:{value:n},uSoftness:{value:a}},vertexShader:eQ}),c=new eF.eaF(o,s);return c.renderOrder=i,c.raycast=e6,e$(c),c}(t.shadow);return l.position.set(t.shadow.position.x,t.shadow.position.y,t.shadow.position.z),{shadow:l,stand:n,standShape:a}},[r,i]);(0,l.useEffect)(()=>()=>{tt(o),tt(a)},[a,o]);let c=function(e,t){let r=function(){let e=(0,l.use)(rs),{gl:t}=(0,td.C)();return e??t}(),[n,i]=(0,l.useState)(!1),a=(0,l.useRef)(!1),o=(0,l.useRef)(null);return(0,l.useEffect)(()=>(a.current=t,()=>{a.current=!1;let e=o.current;o.current=null,null==e||e.removeFromParent(),tt(e),i(!1)}),[t,r,e]),(0,td.D)(()=>{if(!a.current)return;a.current=!1;let t=ta(e);if(t)try{let n,a,l,s,c=function(e,t,r){let n,i=new eF.nWS(256,256),a=new eF.nWS(256,256),l=new eF.qUd(-r.width/2,r.width/2,r.depth/2,-r.depth/2,0,r.reach+.002);l.rotation.x=Math.PI/2,l.position.set(r.center.x,r.floorY-.002,r.center.z);let o=((n=new eF.CSG({side:2})).onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );",`float closeness = 1.0 - fragCoordZ;
|
|
61
|
+
gl_FragColor = vec4( vec3( 0.0 ), 0.30 + 0.70 * closeness * closeness * closeness );`)},n),s=ro(ra.F),c=ro(rl.r),u=new ri.F(s),d=[];t.traverse(e=>{if(e0(e)){e.visible&&(e.visible=!1,d.push(()=>{e.visible=!0}));return}if(e instanceof eF.eaF){let t=e.material;e.material=o,d.push(()=>{e.material=t})}});let h=e.getRenderTarget(),m=e.xr.enabled,p=e.autoClear,f=e.getClearColor(new eF.Q1f),g=e.getClearAlpha();t.add(l);let b=t=>{u.material=s,s.uniforms.tDiffuse.value=i.texture,s.uniforms.h.value=t/256,e.setRenderTarget(a),u.render(e),u.material=c,c.uniforms.tDiffuse.value=a.texture,c.uniforms.v.value=t/256,e.setRenderTarget(i),u.render(e)},x=!1;try{e.xr.enabled=!1,e.autoClear=!0,e.setClearColor(0,0),e.setRenderTarget(i),e.render(t,l),b(1.5),b(.6000000000000001),x=!0}finally{x||i.dispose(),l.removeFromParent(),d.forEach(e=>e()),e.setRenderTarget(h),e.xr.enabled=m,e.autoClear=p,e.setClearColor(f,g),o.dispose(),s.dispose(),c.dispose(),u.dispose(),a.dispose()}let v=new eF.bdM(r.width,r.depth).rotateX(Math.PI/2),w=new eF.V9B({depthWrite:!1,map:i.texture,opacity:.65,side:2,toneMapped:!1,transparent:!0}),j=new eF.eaF(v,w);j.position.set(r.center.x,r.floorY+.001,r.center.z),j.renderOrder=12;let y=r.footprint.width/2+.05,N=r.footprint.depth/2+.05;return j.raycast=function(e,t){e9(this,e,t,y,N)},e$(j),w.addEventListener("dispose",()=>i.dispose()),j}(r,e,(n=t.max.x-t.min.x,a=t.max.y-t.min.y,l=t.max.z-t.min.z,s=.05+.05*Math.max(n,l),{center:{x:(t.min.x+t.max.x)/2,z:(t.min.z+t.max.z)/2},depth:l+2*s,footprint:{depth:l,width:n},floorY:t.min.y,reach:Math.min(1.5,Math.max(.2,a)),width:n+2*s}));e.add(c),o.current=c,i(!0)}catch(e){(0,rn.Q0)()&&console.warn("[react-ar] the contact shadow could not be rendered.",e)}}),n}(r,null!==a),u=(0,l.useRef)({active:!1,elapsedMs:240,fromShape:tn});return((0,l.useEffect)(()=>{let e,r=u.current;r.active=t,r.elapsedMs=0,r.fromShape=o?{depth:(e=o.material).uniforms.uDepth.value,radius:e.uniforms.uRadius.value,width:e.uniforms.uWidth.value}:r.fromShape},[t,o]),(0,td.D)((e,t)=>{let r=u.current;if(r.elapsedMs>=240)return;r.elapsedMs+=1e3*t;let n=r.active||r.elapsedMs<240;if(!o||!s)return;let i=r.active?s:tn,a=r.fromShape;te(o,{depth:to({elapsedMs:r.elapsedMs,from:a.depth,to:i.depth}),radius:to({elapsedMs:r.elapsedMs,from:a.radius,to:i.radius}),width:to({elapsedMs:r.elapsedMs,from:a.width,to:i.width})}),o.visible=n}),o)?(0,td.o)((0,n.jsxs)(n.Fragment,{children:[a&&!c?(0,n.jsx)("primitive",{object:a}):null,(0,n.jsx)("primitive",{object:o})]}),r):null}class rd{follow(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!e)return;let a=t.x,l=t.y+n,o=t.z,s=e.position,c=Math.hypot(a-s.x,l-s.y,o-s.z);if(!this.tracking||i!==this.surface||c>.3){s.set(a,l,o),this.surface=i,this.tracking=!0;return}let u=t8(r,.3);s.set(s.x+(a-s.x)*u,s.y+(l-s.y)*u,s.z+(o-s.z)*u)}reset(){this.tracking=!1}constructor(){(0,tO._)(this,"surface",null),(0,tO._)(this,"tracking",!1)}}function rh(e){let{doubleSided:t=!1,flat:r=!1,ref:i}=e,a=(0,l.useMemo)(()=>e8(function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{border:.02,color:tr,depth:tn.depth,doubleSide:e,inset:.03,opacity:.94,radius:tn.radius,renderOrder:14,width:tn.width}}(t)),[t]);return(0,l.useEffect)(()=>()=>tt(a),[a]),(0,n.jsx)("group",{ref:i,"rotation-x":r?-Math.PI/2:0,visible:!1,children:(0,n.jsx)("primitive",{object:a,"rotation-x":Math.PI/2})})}function rm(e,t,r){return r<=0?0:(t-e)/r*Math.PI}function rp(e,t){return Math.min(2,Math.max(.6,e*t))}class rf{get count(){return this.pointers.size}get moved(){return this.hasMoved}get multiTouch(){return this.hadSecondPointer}get startX(){return this.startXValue}get startY(){return this.startYValue}down(e){this.pointers.set(e.pointerId,e),1===this.pointers.size?(this.hasMoved=!1,this.hadSecondPointer=!1,this.startXValue=e.clientX,this.startYValue=e.clientY):this.hadSecondPointer=!0}has(e){return this.pointers.has(e)}move(e){this.pointers.set(e.pointerId,e),this.hasMoved||(this.hasMoved=Math.hypot(e.clientX-this.startXValue,e.clientY-this.startYValue)>=4)}up(e){this.pointers.delete(e.pointerId)}beginPinch(){let e=this.measureSpan();return null!==e&&(this.pinchStart=e,!0)}pinchRatio(){let e=this.measureSpan();return null===e?1:e/Math.max(1,this.pinchStart)}reset(){this.pointers.clear(),this.hasMoved=!1,this.hadSecondPointer=!1}measureSpan(){if(this.pointers.size<2)return null;let e=this.pointers.values(),t=e.next().value,r=e.next().value;return t&&r?Math.hypot(r.clientX-t.clientX,r.clientY-t.clientY):null}constructor(){(0,tO._)(this,"pointers",new Map),(0,tO._)(this,"hasMoved",!1),(0,tO._)(this,"hadSecondPointer",!1),(0,tO._)(this,"pinchStart",0),(0,tO._)(this,"startXValue",0),(0,tO._)(this,"startYValue",0)}}class rg{measure(){let e=this.element.getBoundingClientRect();this.height=e.height,this.left=e.left,this.top=e.top,this.width=e.width}setRay(e){this.setPoint(e),this.castThroughPoint()}beginAnchoredDrag(e,t){this.setPoint(e),this.projected.copy(t).project(this.camera),this.projected.z>1?this.anchorOffset.set(0,0):this.anchorOffset.set(this.projected.x-this.point.x,this.projected.y-this.point.y)}setAnchoredRay(e){this.setPoint(e),this.point.add(this.anchorOffset),this.castThroughPoint()}intersectPlane(e,t){let r=this.raycaster.ray.intersectPlane(e,t);return r&&20>=r.distanceTo(this.raycaster.ray.origin)?r:null}castThroughPoint(){this.camera.projectionMatrixInverse.copy(this.camera.projectionMatrix).invert(),this.raycaster.setFromCamera(this.point,this.camera)}setPoint(e){this.point.set((e.clientX-this.left)/this.width*2-1,-(e.clientY-this.top)/this.height*2+1)}get ray(){return this.raycaster.ray}intersect(e){return e?this.raycaster.intersectObject(e,!0)[0]??null:null}nearest(e,t){let r=null;for(let n of e){let e=this.intersect(t(n));e&&(!r||e.distance<r.distance)&&(r={candidate:n,distance:e.distance,point:e.point})}return r?{candidate:r.candidate,point:r.point}:null}constructor(e,t){(0,tO._)(this,"element",void 0),(0,tO._)(this,"camera",void 0),(0,tO._)(this,"raycaster",void 0),(0,tO._)(this,"anchorOffset",void 0),(0,tO._)(this,"point",void 0),(0,tO._)(this,"projected",void 0),(0,tO._)(this,"height",void 0),(0,tO._)(this,"left",void 0),(0,tO._)(this,"top",void 0),(0,tO._)(this,"width",void 0),this.element=e,this.camera=t,this.raycaster=new eF.tBo,this.anchorOffset=new eF.I9Y,this.point=new eF.I9Y,this.projected=new eF.Pq0,this.height=0,this.left=0,this.top=0,this.width=0,this.measure()}}function rb(e,t){let r=new rg(e,t),n=()=>r.measure();return window.addEventListener("resize",n),window.addEventListener("orientationchange",n),{dispose:()=>{window.removeEventListener("resize",n),window.removeEventListener("orientationchange",n)},raycaster:r}}var rx=r(7292);function rv(e){return{x:e.x,y:e.y,z:e.z}}function rw(e){return{w:e.w,x:e.x,y:e.y,z:e.z}}let rj=!1;function ry(e,t,r,n){if(!e.getPose)return null;try{return e.getPose(t(),r)??null}catch(e){return null==n||n(),(0,rn.Q0)()&&!rj&&(rj=!0,console.warn("[react-ar] a WebXR space stopped answering; treating it as lost tracking.",e)),null}}class rN{setMechanic(e){e!==this.mechanic&&(this.mechanic=e,this.cachedFrame=null)}async attachRenderer(e){e.xr.enabled=!0,e.xr.setReferenceSpaceType("local-floor"),await e.xr.setSession(this.nativeSession)}getCenterHit(e){return this.cachedFrame===e||(this.cachedFrame=e,this.cachedHit=this.readCenterHit(e)),this.cachedHit}readCenterHit(e){let t=null;for(let r of this.readHitTestResults(e)){let e=function(e,t){var r;let n,i=e.getPose(t);if(!i)return null;let{matrix:a,orientation:l,position:o}=i.transform,s=(n=Math.hypot((r={x:a[4]??0,y:a[5]??1,z:a[6]??0}).x,r.y,r.z)||1,{x:r.x/n,y:r.y/n,z:r.z/n}),c={kind:(0,tQ.Q3)(s),nativeHit:e,normal:s,pose:{orientation:rw(l),position:rv(o)}};return"wall"!==c.kind||(0,tQ.aq)(c)?c:null}(r,this.floorSpace);if(e){if(function(e,t){switch(t){case"wall":return(0,tQ.aq)(e);case"ceiling":return"ceiling"===e.kind;case"floor":return"floor"===e.kind;case"all":return!0}}(e,this.mechanic))return e;t??(t=e)}}return t}readHitTestResults(e){try{return e.getHitTestResults(this.hitTestSource)}catch{return[]}}isTracking(e){return null!==ry(e,()=>this.viewerSpace,this.floorSpace)}async createAnchor(e){var t;let r=e.nativeHit;if(!(null==r?void 0:r.createAnchor))throw Error("WebXR anchors are unavailable.");let n=await r.createAnchor(),i=!1;return{delete:()=>{try{null==n||n.delete()}catch{}},getPose:e=>{var t;if(i)return null;let r=ry(e,()=>n.anchorSpace,this.floorSpace,()=>{i=!0});return r?{orientation:rw((t=r.transform).orientation),position:rv(t.position)}:null},isDetached:()=>i,nativeAnchor:n,pose:{orientation:rw((t=e.pose).orientation),position:rv(t.position)}}}async end(){this.cachedFrame=null,this.cachedHit=null,this.hitTestSource.cancel(),await this.nativeSession.end()}constructor(e,t,r,n){(0,tO._)(this,"nativeSession",void 0),(0,tO._)(this,"floorSpace",void 0),(0,tO._)(this,"hitTestSource",void 0),(0,tO._)(this,"viewerSpace",void 0),(0,tO._)(this,"cachedFrame",void 0),(0,tO._)(this,"cachedHit",void 0),(0,tO._)(this,"mechanic",void 0),this.nativeSession=e,this.floorSpace=t,this.hitTestSource=r,this.viewerSpace=n,this.cachedFrame=null,this.cachedHit=null,this.mechanic="all"}}class rM{async isSupported(){return(0,rx.f)(this.xrSystem)}async startSession(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.xrSystem)throw Error("WebXR immersive AR is not supported.");let t={optionalFeatures:["dom-overlay","plane-detection"],requiredFeatures:["anchors","hit-test","local-floor"]};e.overlayRoot&&(t.domOverlay={root:e.overlayRoot});let r=await this.xrSystem.requestSession("immersive-ar",t),[n,i]=await Promise.all([r.requestReferenceSpace("viewer"),r.requestReferenceSpace("local-floor")]),a=await r.requestHitTestSource({space:n});if(!a)throw await r.end(),Error("WebXR hit testing is unavailable.");return new rN(r,i,a,n)}constructor(e=function(){if("u">typeof navigator)return navigator.xr}()){(0,tO._)(this,"xrSystem",void 0),this.xrSystem=e}}function rC(e){let{interactionEnabledRef:t,onCentreHit:r,relocalize:n,sceneObjects:i,sessionHasTrackingRef:a,sessionRef:o,setTrackingStatus:s,updateObject:c}=e,u=(0,l.useRef)("tracking");(0,td.D)((e,l,d)=>{let h=o.current,m=performance.now(),p=1e3*l;if(h&&d){r(h.getCenterHit(d),m,p);let e=function(e,t,r,n){let i=!0,a="tracking";for(let s of e){var l,o;let e=s.runtime;if(e.anchor){let a=e.anchor.getPose(t);if(!a){let r=(0,tQ.gD)(e.anchor,e.lastAnchorPose??null);r&&(e.anchor=r,a=r.getPose(t))}i&&(i=null!==a),e.tracking=eJ(e.tracking,{hasPose:null!==a,now:r}),a&&n(s,a)}l=a,o=e.tracking.status,a="lost"===l||"lost"===o?"lost":"relocalizing"===l||"relocalizing"===o?"relocalizing":"tracking"}return{allAnchorPosesAvailable:i,status:a}}(i,d,m,n);t.current=a.current&&e.allAnchorPosesAvailable,u.current!==e.status&&(u.current=e.status,s(e.status))}for(let e of i)(a.current&&null===e.runtime.tracking.missingSince||null!=e.removingSince)&&c(e,m,p)})}function rI(e){return .5+.5*Math.sin(2*e)}let rR=null,rz=0;function rL(e,t){var r;let n,i,a,{shownUrl:o,swapping:s}=(null==(n=(0,l.use)(tF))||n.request(e),i=(0,l.useDeferredValue)(e),(0,l.useLayoutEffect)(()=>null==n?void 0:n.want(e),[n,e]),{shownUrl:i,swapping:e!==i}),c=(0,tG.p)(o),u=(0,l.useMemo)(()=>c.scene.clone(!0),[c.scene]);return r=c.scene,a=(0,l.use)(tF),(0,l.useLayoutEffect)(()=>null==a?void 0:a.register(o,r,t),[a,t,r,o]),(0,l.useLayoutEffect)(()=>{let e,t,r;return s?(rR??(rR=new eF.V9B({color:0xffffff,opacity:rI(performance.now()/1e3),toneMapped:!1,transparent:!0})),rz+=1,e=rR,t=new Map,u.traverse(r=>{!(r instanceof eF.eaF)||e0(r)||(t.set(r,r.material),r.material=Array.isArray(r.material)?r.material.map(()=>e):e)}),r=!0,()=>{r&&(r=!1,t.forEach((e,t)=>{t.material=e}),0===(rz=Math.max(0,rz-1))&&rR&&(rR.dispose(),rR=null))}):void 0},[s,u]),(0,td.D)(()=>{var e;s&&(e=performance.now()/1e3,rR&&(rR.opacity=rI(e)))}),{scene:u,swapping:s}}function rS(e){let{currentHitRef:t,manager:r,phase:i,phaseRef:a,placingObjectId:o,scaleEnabled:s,sceneObjects:c,selectedObjectId:u,sessionHasTrackingRef:d,sessionRef:h,setTrackingStatus:m,updatePhase:p}=e,{camera:f}=(0,td.C)(),g=(0,l.useRef)(null),b=(0,l.useMemo)(()=>new rd,[]),x=(0,l.useRef)(!0),v=tJ(o);return!function(e){let{interactionEnabledRef:t,manager:r,scaleEnabled:n}=e,{camera:i,gl:a}=(0,td.C)();(0,l.useEffect)(()=>{let e=a.domElement,{dispose:l,raycaster:o}=rb(e,i),s=new eF.Zcv,c=new eF.Pq0,u=new eF.Pq0,d=new eF.Pq0,h=new eF.Pq0,m=new rf,p=null,f=null,g=null,b=1,x=e=>e?r.getSnapshot().objects.find(t=>t.id===e):void 0,v=i=>{if(t.current&&r.isGestureEnabled()){if(i.preventDefault(),e.setPointerCapture(i.pointerId),o.measure(),m.down(i),1===m.count){var a;let e=r.beginGesture((o.setRay(i),(null==(a=o.nearest(r.getSnapshot().objects,e=>e.runtime.anchor?e.runtime.hitTarget:null))?void 0:a.candidate.id)??null));e&&((e,t)=>{let r=x(t.objectId);if(r&&(p=t,f=t.mode,g=t9(r.runtime.targetTransform),r.runtime.lastInteractionRef.current=performance.now(),"move"===f)){var n;let t={normal:{...(n=g).worldRoot.normal},point:{...n.worldRoot.position}};c.set(t.normal.x,t.normal.y,t.normal.z),u.set(t.point.x,t.point.y,t.point.z),s.setFromNormalAndCoplanarPoint(c,u),o.beginAnchoredDrag(e,u),o.setAnchoredRay(e),o.intersectPlane(s,d)?h.copy(d):f=null}})(i,e)}else if(2===m.count&&p&&n){let e=x(p.objectId);e&&m.beginPinch()&&(f="pinch",b=e.runtime.targetTransform.userRoot.scale)}}},w=n=>{if(!t.current||!r.isGestureEnabled()||!m.has(n.pointerId)||!p||!g)return;m.move(n);let i=x(p.objectId);if(i)if(i.runtime.lastInteractionRef.current=performance.now(),"pinch"===f&&2===m.count)i.runtime.targetTransform.userRoot.scale=rp(b,m.pinchRatio());else if(1===m.count&&m.moved&&"rotate"===f){var a,l;i.runtime.targetTransform=(a=g,l=rm(m.startX,n.clientX,e.clientWidth),{...a,userRoot:{...a.userRoot,yaw:a.userRoot.yaw+l}})}else 1===m.count&&m.moved&&"move"===f&&(o.setAnchoredRay(n),o.intersectPlane(s,d)&&(i.runtime.targetTransform=function(e,t,r){let{normal:n}=e.worldRoot,i={x:r.x-t.x,y:r.y-t.y,z:r.z-t.z},a=i.x*n.x+i.y*n.y+i.z*n.z;return{...e,worldRoot:{...e.worldRoot,position:{x:e.worldRoot.position.x+i.x-n.x*a,y:e.worldRoot.position.y+i.y-n.y*a,z:e.worldRoot.position.z+i.z-n.z*a}}}}(g,h,d),i.runtime.draggedAtRef.current=performance.now()))},j=e=>{m.up(e),m.count>0||(p&&r.endGesture({moved:m.moved,multiTouch:m.multiTouch}),p=null,f=null,g=null,m.reset())};return e.addEventListener("pointerdown",v),e.addEventListener("pointermove",w),e.addEventListener("pointerup",j),e.addEventListener("pointercancel",j),()=>{e.removeEventListener("pointerdown",v),e.removeEventListener("pointermove",w),e.removeEventListener("pointerup",j),e.removeEventListener("pointercancel",j),l()}},[i,a,t,r,n])}({interactionEnabledRef:x,manager:r,scaleEnabled:s}),rC({interactionEnabledRef:x,onCentreHit:(e,r,n)=>{let i=c.find(e=>e.id===o);if(t.current=i?e:null,g.current&&(g.current.visible=!!(i&&e)&&!v,g.current.visible||b.reset(),e)){let t=Math.abs(e.normal.y)>=.75;b.follow(g.current,e.pose.position,n,0,t?"flat":"upright"),t?g.current.rotation.set(-Math.PI/2,0,0):g.current.lookAt(f.position)}if(!e||!i)return;let l=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{height:t.height,maxY:t.height,minY:0},i=(0,tQ.Q3)(e.normal);if("wall"===i){let a=t4({...e,kind:"wall"},t,r,n.height);return{surface:i,orientationRoot:{position:{...a.orientationRoot.position}},userRoot:{...a.userRoot},worldRoot:{normal:{...a.worldRoot.normal},position:{...a.worldRoot.position},yaw:a.worldRoot.yaw}}}if("floor"===i){let t=t$({...e,kind:"floor"});return{surface:i,orientationRoot:{position:{x:0,y:-n.minY,z:0}},userRoot:{scale:t.scale,yaw:t.yaw},worldRoot:{normal:{x:0,y:1,z:0},position:t.position,yaw:0}}}return{surface:i,orientationRoot:{position:{x:0,y:-n.maxY,z:0}},userRoot:{scale:1,yaw:0},worldRoot:{normal:{x:0,y:-1,z:0},position:{...e.pose.position},yaw:0}}}(e,i.resource.dimensions,f.position,i.runtime.modelBounds);l.userRoot={...i.runtime.targetTransform.userRoot},i.runtime.targetTransform=l,"searching"===a.current&&(i.runtime.currentTransform=t9(l),i.runtime.lastInteractionRef.current=r,p("preview"))},relocalize:(e,t)=>{var r,n;let i,a,l,o,s,c=e.runtime;c.lastAnchorPose&&(r=c.targetTransform,n=c.lastAnchorPose,l=Math.cos(a=(i=tq({position:r.worldRoot.position,scale:1,yaw:r.worldRoot.yaw},n,t)).yaw-r.worldRoot.yaw),o=Math.sin(a),s=r.worldRoot.normal,c.targetTransform={...r,worldRoot:{...r.worldRoot,normal:{x:l*s.x+o*s.z,y:s.y,z:-o*s.x+l*s.z},position:i.position,yaw:i.yaw}}),c.lastAnchorPose=t},sceneObjects:c,sessionHasTrackingRef:d,sessionRef:h,setTrackingStatus:m,updateObject:(e,t,r)=>{let n=e.runtime;if(!n.root||!n.userRoot||!n.orientationRoot)return;let i=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.22,n=re(e,t,r),i=rt({position:e.orientationRoot.position,scale:1,yaw:0},{position:t.orientationRoot.position,scale:1,yaw:0},r);return{...n,orientationRoot:{position:i.position}}}(n.currentTransform,n.targetTransform,t8(r)),a=t-n.draggedAtRef.current<120?{...i,worldRoot:{...i.worldRoot,position:{...n.targetTransform.worldRoot.position}}}:i;n.currentTransform=a,n.root.position.set(a.worldRoot.position.x,a.worldRoot.position.y,a.worldRoot.position.z),n.root.rotation.set(0,a.worldRoot.yaw,0),n.userRoot.rotation.set(0,a.userRoot.yaw,0),n.userRoot.scale.setScalar(a.userRoot.scale*rr(e.removingSince,t)),n.orientationRoot.position.set(a.orientationRoot.position.x,a.orientationRoot.position.y,a.orientationRoot.position.z)}}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(rh,{ref:g,doubleSided:!0}),c.map(e=>(0,n.jsx)(l.Suspense,{fallback:null,children:(0,n.jsx)(rZ,{decorated:ti({phase:i,placing:e.id===o,selected:e.id===u}),object:e,visible:e.id!==o||"searching"!==i})},e.id))]})}function rZ(e){let{decorated:t,object:r,visible:i}=e;return(0,n.jsx)("group",{ref:e=>{r.runtime.root=e},visible:i,children:(0,n.jsx)("group",{ref:e=>{r.runtime.userRoot=e},children:(0,n.jsx)("group",{ref:e=>{r.runtime.orientationRoot=e},children:(0,n.jsx)("group",{ref:e=>{r.runtime.hitTarget=e},children:(0,n.jsx)(rW,{decorated:t,object:r})})})})})}function rW(e){let{decorated:t,object:r}=e,{scene:i}=rL(r.resource.glbUrl,r.id),a=function(e){let[t,r]=(0,l.useState)(e.runtime.currentTransform.surface);return(0,td.D)(()=>{let n=e.runtime.currentTransform.surface;n!==t&&r(n)}),t}(r);return(0,l.useLayoutEffect)(()=>{let e=ta(i),t=e?e.max.y-e.min.y:0;r.runtime.modelBounds={height:t>0?t:r.resource.dimensions.height,maxY:e?e.max.y:r.resource.dimensions.height,minY:e?e.min.y:0}},[r,i]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("primitive",{object:i}),(0,n.jsx)(ru,{active:t,root:i,surface:a})]})}let rY=new eF.Pq0(0,1,0);function rk(e){return{...e,position:{...e.position}}}function rT(e){let{currentHitRef:t,heightModeRef:r,manager:i,phase:a,phaseRef:o,placingObjectId:s,scaleEnabled:c,sceneObjects:u,selectedObjectId:d,sessionHasTrackingRef:h,sessionRef:m,setHeightLabel:p,setTrackingStatus:f,updatePhase:g}=e,b=(0,l.useRef)(null),x=(0,l.useMemo)(()=>new rd,[]),v=(0,l.useRef)(!0),w=(0,l.useRef)({count:0,firstHit:null}),j=(0,l.useRef)({hit:null,seenAt:0}),y=(0,l.useRef)(null);y.current="calibrating"===o.current?s:null;let N=(0,l.useCallback)(e=>{p(eH(e.runtime.targetTransform,tu(e),"calibrating"===o.current))},[o,p]),M=(0,l.useCallback)((e,t)=>{e.runtime.modelHeight!==t&&(e.runtime.modelHeight=t,(e.id===s||e.id===d)&&N(e))},[N,s,d]);return!function(e){let{calibrationObjectIdRef:t,heightModeRef:r,interactionEnabledRef:n,manager:i,onHeightChange:a,scaleEnabled:o}=e,{camera:s,gl:c}=(0,td.C)();(0,l.useEffect)(()=>{let e=c.domElement,{dispose:l,raycaster:u}=rb(e,s),d=new eF.Zcv(new eF.Pq0(0,1,0)),h=new eF.Pq0,m=new eF.Pq0,p=new eF.Pq0,f=new rf,g=null,b=null,x=null,v=1,w=e=>e?i.getSnapshot().objects.find(t=>t.id===e):void 0,j=a=>{if(n.current&&i.isGestureEnabled()){if(a.preventDefault(),e.setPointerCapture(a.pointerId),u.measure(),f.down(a),1===f.count)(e=>{let n=t.current,a=r.current?i.getSnapshot().selectedObjectId:n;if(a){let e=w(a);if(!e)return;g={mode:"move",objectId:a},b="height",x=rk(e.runtime.targetTransform);return}let l=(e=>{u.setRay(e);let t=null;for(let e of i.getSnapshot().objects){if(!e.runtime.anchor)continue;let r=u.intersect(e.runtime.hitTarget);r&&(!t||r.distance<t.distance)&&(t={distance:r.distance,floorGizmo:!1,id:e.id});let n=u.intersect(e.runtime.floorGizmo);n&&(!t||n.distance<t.distance)&&(t={distance:n.distance,floorGizmo:!0,id:e.id})}return t})(e),o=i.beginGesture((null==l?void 0:l.id)??null);if(!o)return;let s=w(o.objectId);if(s&&(g=o,b=o.mode,x=rk(s.runtime.targetTransform),s.runtime.lastInteractionRef.current=performance.now(),"move"===b)){let t=(null==l?void 0:l.floorGizmo)?x.floorY:x.position.y;p.set(x.position.x,t,x.position.z),d.set(rY,-t),u.beginAnchoredDrag(e,p),u.setAnchoredRay(e),u.intersectPlane(d,h)?m.copy(h):b=null}})(a);else if(2===f.count&&g&&o&&"height"!==b){let e=w(g.objectId);e&&f.beginPinch()&&(b="pinch",v=e.runtime.targetTransform.scale)}}},y=t=>{if(!i.isGestureEnabled()||!f.has(t.pointerId)||!g||!x)return;f.move(t);let r=w(g.objectId);if(r){if(r.runtime.lastInteractionRef.current=performance.now(),"pinch"===b&&2===f.count)r.runtime.targetTransform.scale=rp(v,f.pinchRatio());else if(1===f.count&&f.moved&&"height"===b)r.runtime.targetTransform=function(e,t,r,n){if(n<=0)return e;let i=eO(e.suspensionHeight+(t-r)/n*2.6);return{...e,position:{...e.position,y:e.floorY+i},suspensionHeight:i}}(x,f.startY,t.clientY,e.clientHeight),r.runtime.draggedAtRef.current=performance.now(),a(r);else if(1===f.count&&f.moved&&"rotate"===b)r.runtime.targetTransform.yaw=x.yaw+rm(f.startX,t.clientX,e.clientWidth);else if(1===f.count&&f.moved&&"move"===b&&(u.setAnchoredRay(t),u.intersectPlane(d,h))){var n;r.runtime.targetTransform={...n=x,position:{x:n.position.x+h.x-m.x,y:n.position.y,z:n.position.z+h.z-m.z}},r.runtime.draggedAtRef.current=performance.now()}}},N=e=>{f.up(e),f.count>0||(!t.current&&g&&i.endGesture({moved:f.moved,multiTouch:f.multiTouch}),g=null,b=null,x=null,f.reset())};return e.addEventListener("pointerdown",j),e.addEventListener("pointermove",y),e.addEventListener("pointerup",N),e.addEventListener("pointercancel",N),()=>{e.removeEventListener("pointerdown",j),e.removeEventListener("pointermove",y),e.removeEventListener("pointerup",N),e.removeEventListener("pointercancel",N),l()}},[t,s,c,r,n,i,a,o])}({calibrationObjectIdRef:y,heightModeRef:r,interactionEnabledRef:v,manager:i,onHeightChange:N,scaleEnabled:c}),rC({interactionEnabledRef:v,onCentreHit:(e,r,n)=>{let i=(null==e?void 0:e.kind)==="floor"?e:null,a=(null==e?void 0:e.kind)==="ceiling"?e:null,l=function(e,t){if(!t||"floor"!==t.kind)return{stableHit:null,state:{count:0,firstHit:null}};let r=null==e?void 0:e.firstHit,n=null!=r&&.25>=Math.hypot(t.pose.position.x-r.pose.position.x,t.pose.position.y-r.pose.position.y,t.pose.position.z-r.pose.position.z)?{count:((null==e?void 0:e.count)??0)+1,firstHit:r}:{count:1,firstHit:t};return{stableHit:n.count>=8?t:null,state:n}}(w.current,i);if(w.current=l.state,b.current){b.current.visible=function(e){let{hasHit:t,phase:r,placingObjectId:n}=e;return null!==n&&("searching"===r||"floor-ready"===r)&&t}({hasHit:null!==i||null!==a,phase:o.current,placingObjectId:s}),b.current.visible||x.reset();let e=i??a;e&&x.follow(b.current,e.pose.position,n,.002,e.kind)}let c=u.find(e=>e.id===s);if(a&&c&&"searching"===o.current)t.current=a,c.runtime.targetTransform=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("ceiling"!==e.kind)throw Error("Direct ceiling placement requires a ceiling surface hit.");let r=eO(e.pose.position.y-t);return{floorY:t,position:{x:e.pose.position.x,y:t+r,z:e.pose.position.z},scale:1,suspensionHeight:r,yaw:0}}(a),c.runtime.currentTransform={...c.runtime.targetTransform,position:{...c.runtime.targetTransform.position}},c.runtime.rise=eU(r),g("preview");else if(l.stableHit&&c&&"searching"===o.current){t.current=l.stableHit,j.current={hit:l.stableHit,seenAt:r};let e=c.runtime.targetTransform.suspensionHeight;c.runtime.targetTransform=eG(l.stableHit,e),c.runtime.currentTransform={...c.runtime.targetTransform,position:{...c.runtime.targetTransform.position}},p(null),g("floor-ready")}else if("floor-ready"===o.current){var d;d=j.current,j.current=(null==i?void 0:i.kind)==="floor"?{hit:i,seenAt:r}:r-d.seenAt>500?{hit:null,seenAt:d.seenAt}:d,t.current=j.current.hit,j.current.hit||g("searching")}},relocalize:(e,t)=>{let r=e.runtime;if(r.lastAnchorPose){let e=t.position.y-r.lastAnchorPose.position.y,n=tq(r.targetTransform,r.lastAnchorPose,t);r.targetTransform={...r.targetTransform,...n,floorY:r.targetTransform.floorY+e}}r.lastAnchorPose=t},sceneObjects:u,sessionHasTrackingRef:h,sessionRef:m,setTrackingStatus:f,updateObject:(e,t,r)=>{var n,i;if(!e.runtime.root)return;let a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.22,n=rt(e,t,r);return{...t,position:n.position,scale:n.scale,suspensionHeight:n.position.y-t.floorY,yaw:n.yaw}}(e.runtime.currentTransform,e.runtime.targetTransform,t8(r)),l=e.runtime.targetTransform,o=t-e.runtime.draggedAtRef.current<120?{...a,position:{...l.position},suspensionHeight:l.suspensionHeight}:a;e.runtime.currentTransform=o;let s=function(e,t,r,n){if(!e)return 0;let i=t.position.y-(t.floorY+r*t.scale);if(i<=0)return 0;let a=Math.min(1,Math.max(0,(n-e.startedAt)/1100));return i*(1-(a<.5?4*a**3:1-(-2*a+2)**3/2))}(e.runtime.rise,o,tu(e),t);i=e.runtime.rise,(!i||t-i.startedAt>=1100)&&(e.runtime.rise=null),e.runtime.root.position.set(o.position.x,o.position.y-s,o.position.z),e.runtime.root.rotation.set(0,o.yaw,0),null==(n=e.runtime.modelRoot)||n.scale.setScalar(o.scale*rr(e.removingSince,t))}}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(rh,{ref:b,flat:!0}),u.map(e=>(0,n.jsx)(l.Suspense,{fallback:null,children:(0,n.jsx)(rD,{decorated:ti({phase:a,placing:e.id===s,selected:e.id===d}),object:e,onMeasured:M,visible:function(e){let{isPlacing:t,phase:r}=e;return!t||"searching"!==r&&"floor-ready"!==r}({isPlacing:e.id===s,phase:a})})},e.id))]})}function rD(e){let{decorated:t,object:r,onMeasured:i,visible:a}=e,l=r.runtime.currentTransform;return(0,n.jsx)("group",{ref:e=>{r.runtime.root=e},children:(0,n.jsx)("group",{visible:a,children:(0,n.jsx)("group",{ref:e=>{r.runtime.hitTarget=e,r.runtime.modelRoot=e},scale:l.scale,children:(0,n.jsx)(rP,{decorated:t,glbUrl:r.resource.glbUrl,objectId:r.id,onMeasured:e=>i(r,e)})})})})}function rP(e){let{decorated:t,glbUrl:r,objectId:i,onMeasured:a}=e,{scene:o}=rL(r,i),s=(0,l.useRef)(null),c=(0,l.useRef)(a);return c.current=a,(0,l.useLayoutEffect)(()=>{let e,t=s.current;if(!t)return;let r=(e=ta(o,t))?(t.position.y=0===e.max.y?0:-e.max.y,e.max.y-e.min.y):(t.position.y=0,0);r>0&&c.current(r);let n=function(e){let t=ta(e);if(!t)return null;let r=new eF.eaF(new eF.iNn(Math.max(.01,t.max.x-t.min.x),Math.max(.01,t.max.y-t.min.y),Math.max(.01,t.max.z-t.min.z)),new eF.V9B({side:2,visible:!1}));return r.position.set((t.min.x+t.max.x)/2,(t.min.y+t.max.y)/2,(t.min.z+t.max.z)/2),e$(r),r}(o);if(n)return o.add(n),()=>{n.removeFromParent(),tt(n)}},[o]),(0,n.jsxs)("group",{ref:s,children:[(0,n.jsx)("primitive",{object:o}),(0,n.jsx)(ru,{active:t,root:o,surface:"ceiling"})]})}let rX=new eF.Pq0(0,1,0);function rA(e){let{currentHitRef:t,manager:r,phase:i,phaseRef:a,placingObjectId:o,scaleEnabled:s,sceneObjects:c,selectedObjectId:u,sessionHasTrackingRef:d,sessionRef:h,setTrackingStatus:m,updatePhase:p}=e,f=(0,l.useRef)(null),g=(0,l.useMemo)(()=>new rd,[]),b=(0,l.useRef)(0),x=(0,l.useRef)(!0),v=tJ(o);return!function(e){let{interactionEnabledRef:t,manager:r,scaleEnabled:n}=e,{camera:i,gl:a}=(0,td.C)();(0,l.useEffect)(()=>{let e=a.domElement,{dispose:l,raycaster:o}=rb(e,i),s=new eF.Zcv(new eF.Pq0(0,1,0)),c=new eF.Pq0,u=new rf,d=new eF.Pq0,h=new eF.Pq0,m=null,p=0,f=1,g=null,b=e=>e?r.getSnapshot().objects.find(t=>t.id===e):void 0,x=i=>{if(t.current&&r.isGestureEnabled()){if(i.preventDefault(),e.setPointerCapture(i.pointerId),o.measure(),u.down(i),1===u.count){var a;let e,t=r.beginGesture((o.setRay(i),(null==(a=o.nearest(r.getSnapshot().objects,e=>e.runtime.anchor?e.runtime.hitTarget:null))?void 0:a.candidate.id)??null));t&&(e=b(t.objectId))&&(m=t,g=t.mode,p=e.runtime.targetTransform.yaw,e.runtime.lastInteractionRef.current=performance.now(),"move"===g&&(d.set(e.runtime.targetTransform.position.x,e.runtime.targetTransform.position.y,e.runtime.targetTransform.position.z),s.set(rX,-d.y),o.beginAnchoredDrag(i,d),o.setAnchoredRay(i),o.intersectPlane(s,c)?h.copy(c):g=null));return}if(2===u.count&&m&&n){let e=b(m.objectId);e&&u.beginPinch()&&(g="pinch",f=e.runtime.targetTransform.scale)}}},v=n=>{if(!t.current||!r.isGestureEnabled()||!u.has(n.pointerId)||!m)return;u.move(n);let i=b(m.objectId);if(i){if(i.runtime.lastInteractionRef.current=performance.now(),"pinch"===g&&2===u.count){i.runtime.targetTransform.scale=rp(f,u.pinchRatio());return}if(1===u.count&&u.moved)if("rotate"===g)i.runtime.targetTransform.yaw=p+rm(u.startX,n.clientX,e.clientWidth);else"move"===g&&(o.setAnchoredRay(n),o.intersectPlane(s,c))&&(i.runtime.targetTransform.position={x:d.x+c.x-h.x,y:d.y,z:d.z+c.z-h.z},i.runtime.draggedAtRef.current=performance.now())}},w=e=>{u.up(e),u.count>0||(m&&r.endGesture({moved:u.moved,multiTouch:u.multiTouch}),m=null,g=null,u.reset())};return e.addEventListener("pointerdown",x),e.addEventListener("pointermove",v),e.addEventListener("pointerup",w),e.addEventListener("pointercancel",w),()=>{e.removeEventListener("pointerdown",x),e.removeEventListener("pointermove",v),e.removeEventListener("pointerup",w),e.removeEventListener("pointercancel",w),l()}},[i,a,t,r,n])}({interactionEnabledRef:x,manager:r,scaleEnabled:s}),rC({interactionEnabledRef:x,onCentreHit:(e,r,n)=>{let i=f.current,l=(null==e?void 0:e.kind)==="floor"?e:null;l?(t.current=l,b.current=r):r-b.current>250&&(t.current=null),i&&(i.visible=!!o&&function(e){let{hasFloorHit:t,lastFloorHitAt:r,modelInRoom:n,now:i,phase:a}=e;return"preview"===a&&!n&&(t||i-r<=250)}({hasFloorHit:null!==l,lastFloorHitAt:b.current,modelInRoom:v,now:r,phase:a.current}),i.visible||g.reset());let s=c.find(e=>e.id===o);l&&s&&(g.follow(i,l.pose.position,n,.002),s.runtime.targetTransform=t$(l,s.runtime.targetTransform),"searching"===a.current&&(s.runtime.lastInteractionRef.current=r,p("preview")))},relocalize:(e,t)=>{let r=e.runtime;r.lastAnchorPose&&(r.targetTransform=tq(r.targetTransform,r.lastAnchorPose,t)),r.lastAnchorPose=t},sceneObjects:c,sessionHasTrackingRef:d,sessionRef:h,setTrackingStatus:m,updateObject:(e,t,r)=>{let n=e.runtime;if(!n.root)return;let i=rt(n.currentTransform,n.targetTransform,t8(r)),a=t-n.draggedAtRef.current<120?{...i,position:{...n.targetTransform.position}}:i;n.currentTransform=a,n.root.position.set(a.position.x,a.position.y,a.position.z),n.root.rotation.set(0,a.yaw,0),n.root.scale.setScalar(a.scale*rr(e.removingSince,t))}}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(rh,{ref:f,flat:!0}),c.map(e=>(0,n.jsx)(l.Suspense,{fallback:null,children:(0,n.jsx)(rO,{decorated:ti({phase:i,placing:e.id===o,selected:e.id===u}),object:e,visible:e.id!==o||"searching"!==i})},e.id))]})}function rO(e){let{decorated:t,object:r,visible:i}=e;return(0,n.jsx)("group",{ref:e=>{r.runtime.root=e},visible:i,children:(0,n.jsx)("group",{ref:e=>{r.runtime.hitTarget=e},children:(0,n.jsx)(rG,{decorated:t,glbUrl:r.resource.glbUrl,objectId:r.id})})})}function rG(e){let{decorated:t,glbUrl:r,objectId:i}=e,{scene:a}=rL(r,i);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("primitive",{object:a}),(0,n.jsx)(ru,{active:t,root:a,surface:"floor"})]})}function rU(e){return"floor"===e.mechanic}function rH(e){return"wall"===e.mechanic}function rE(e){return"ceiling"===e.mechanic}function rF(e){return"all"===e.mechanic}function rV(e,t,r){for(let n of(t.current=r,e))rH(n)&&(n.runtime.gestureEnabledRef.current=null==n.removingSince&&(null===r||n.id===r))}function rJ(e){let{sessionHasTrackingRef:t,sessionRef:r,setTrackingStatus:n}=e,i=(0,l.useRef)(eV());return(0,td.D)((e,a,l)=>{let o=r.current;if(!o||!l){t.current=!1;return}let s=o.isTracking(l),c=i.current.status;t.current=s,i.current=eJ(i.current,{hasPose:s,now:performance.now()}),i.current.status!==c&&n(i.current.status)}),null}function rB(e){let{gestureOwnerIdRef:t,manager:r,placingObjectId:n}=e,{camera:i,gl:a}=(0,td.C)();return(0,l.useEffect)(()=>{let e=a.domElement,{dispose:l,raycaster:o}=rb(e,i),s=new Set,c=e=>{let i=s.size>0;if(s.add(e.pointerId),n||i)return;o.measure(),o.setRay(e);let a=r.getSnapshot(),l=null;for(let e of a.objects)if(null==e.removingSince&&("wall"===e.mechanic?null!==e.runtime.anchorRef.current:null!==e.runtime.anchor))for(let t of function(e){if("wall"!==e.mechanic)return e.runtime.hitTarget?[e.runtime.hitTarget]:[];let{floorControlRef:t,hitTargetRef:r}=e.runtime,n=[];return r.current&&n.push(r.current),t.current&&n.push(t.current.group),n}(e)){let r=o.intersect(t);r&&(!l||r.distance<l.distance)&&(l={distance:r.distance,object:e})}l&&(r.selectObject(l.object.id),rV(r.getSnapshot().objects,t,l.object.id))},u=e=>{s.delete(e.pointerId)};return e.addEventListener("pointerdown",c,!0),e.addEventListener("pointerup",u,!0),e.addEventListener("pointercancel",u,!0),()=>{e.removeEventListener("pointerdown",c,!0),e.removeEventListener("pointerup",u,!0),e.removeEventListener("pointercancel",u,!0),l()}},[i,t,a,r,n]),null}let r_={position:{x:0,y:0,z:-1},scale:1,yaw:0};function rQ(){return{...r_,position:{...r_.position}}}function rK(e,t){switch(e.mechanic){case"floor":let r;return{dispose:()=>{var e;return null==(e=r.anchor)?void 0:e.delete()},id:t,mechanic:"floor",resource:e,runtime:r={anchor:null,currentTransform:rQ(),hitTarget:null,lastAnchorPose:null,draggedAtRef:{current:-1/0},lastInteractionRef:{current:0},root:null,targetTransform:rQ(),tracking:eV()}};case"wall":let n;return{dispose:()=>{var e;return null==(e=n.current)?void 0:e.delete()},id:t,mechanic:"wall",resource:e,runtime:{anchorRef:n={current:null},confirmPlacementRef:{current:null},floorControlRef:{current:null},gestureEnabledRef:{current:!1},hitTargetRef:{current:null},phaseRef:{current:"searching"},tracking:eV()}};case"ceiling":let i;return{dispose:()=>{var e;return null==(e=i.anchor)?void 0:e.delete()},id:t,mechanic:"ceiling",resource:e,runtime:i={anchor:null,currentTransform:tc(),floorGizmo:null,hitTarget:null,lastAnchorPose:null,draggedAtRef:{current:-1/0},lastInteractionRef:{current:0},modelHeight:null,modelRoot:null,rise:null,root:null,targetTransform:tc(),tracking:eV()}};case"all":let a,l;return{dispose:()=>{var e;return null==(e=l.anchor)?void 0:e.delete()},id:t,mechanic:"all",resource:e,runtime:l={anchor:null,currentTransform:t9(a={surface:"floor",orientationRoot:{position:{x:0,y:0,z:0}},userRoot:{scale:1,yaw:0},worldRoot:{normal:{x:0,y:1,z:0},position:{x:0,y:0,z:-1},yaw:0}}),hitTarget:null,lastAnchorPose:null,draggedAtRef:{current:-1/0},lastInteractionRef:{current:0},modelBounds:{height:e.dimensions.height,maxY:e.dimensions.height,minY:0},orientationRoot:null,root:null,targetTransform:t9(a),tracking:eV(),userRoot:null}}}}let rq=45*Math.PI/180,r$=8*Math.PI/180,r0=19*Math.PI/180;function r1(e){let t=e.worldRoot.yaw+e.userRoot.yaw;return{x:Math.sin(t),y:0,z:Math.cos(t)}}function r2(e){for(let t of[1.45,1.07])if(.03>=Math.abs(e-t))return t;return e}function r4(e,t,r){let n=Math.cos(rq);if(!r||t1(t,r.normal)>=n-4*Number.EPSILON)return{candidateNormal:null,candidatePoint:null,count:0,shouldSwitch:!1};let i=(null==e?void 0:e.candidateNormal)&&e.candidatePoint&&Math.acos(t1(e.candidateNormal,r.normal))<r0&&.5>=Math.hypot(e.candidatePoint.x-r.point.x,e.candidatePoint.y-r.point.y,e.candidatePoint.z-r.point.z),a=i?e.count+1:1;return{candidateNormal:t0(r.normal),candidatePoint:i?e.candidatePoint:{...r.point},count:a,shouldSwitch:a>=8}}function r3(e,t,r,n){let i=Math.abs(Math.atan2(Math.sin(e-t),Math.cos(e-t))),a=r<=.4&&i<=(n?r0:r$);return{snapped:a,yaw:a?t:e}}function r5(e,t){let r=null;return t.forEach((t,n)=>{let i=t0(t.normal),a=Math.abs((e.x-t.point.x)*i.x+(e.z-t.point.z)*i.z);(!r||a<r.distance)&&(r={distance:a,index:n,wall:t})}),r}function r9(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=r?r5(e,[r]):r5(e,t),a=r?.35:.12;if(!i||i.distance>a)return{attachedWall:null,position:e,wall:null};let l=t0(i.wall.normal),o=(e.x-i.wall.point.x)*l.x+(e.z-i.wall.point.z)*l.z;return{attachedWall:i.wall,position:{x:e.x-l.x*(o-n),y:e.y,z:e.z-l.z*(o-n)},wall:i.wall}}function r7(e,t){if(e.some(e=>{let r=Math.abs(t1(e.normal,t.normal)),n=t0(e.normal),i=Math.abs((t.point.x-e.point.x)*n.x+(t.point.z-e.point.z)*n.z);return r>=Math.cos(15*Math.PI/180)&&i<=.12}))return e;let r=[...e,t];return r.length>12?r.slice(r.length-12):r}function r6(e,t){return(e.x-t.point.x)*t.normal.x+(e.z-t.point.z)*t.normal.z}function r8(e,t){let r=r6(e,t);return{x:e.x-t.normal.x*r,y:e.y,z:e.z-t.normal.z*r}}function ne(e){return{normal:e,yaw:Math.atan2(e.x,e.z)}}function nt(e){return e.bounds.height*e.scale/2}function nr(e,t,r){let n=t5(r.bounds,r.scale);return{orientationRoot:{pitch:0,position:{x:0,y:-(r.bounds.minY+r.bounds.height/2),z:0}},userRoot:{scale:r.scale,yaw:r.target.userRoot.yaw},worldRoot:{normal:{...e.normal},position:{x:t.x+e.normal.x*n,y:t.y,z:t.z+e.normal.z*n},yaw:e.yaw}}}let nn=Math.cos(15*Math.PI/180);function ni(){}function na(e,t){if(!e1(this))return;let r=t.length;eF.eaF.prototype.raycast.call(this,e,t);for(let n=r;n<t.length;n+=1)t[n].distance=e.near}function nl(e){return{orientationRoot:{pitch:e.orientationRoot.pitch,position:{...e.orientationRoot.position}},userRoot:{...e.userRoot},worldRoot:{normal:{...e.worldRoot.normal},position:{...e.worldRoot.position},yaw:e.worldRoot.yaw}}}function no(e,t){return{normal:e.worldRoot.normal,point:{x:e.worldRoot.position.x-e.worldRoot.normal.x*t,y:e.worldRoot.position.y,z:e.worldRoot.position.z-e.worldRoot.normal.z*t},yaw:e.worldRoot.yaw}}function ns(e){let{anchorRef:t,confirmPlacementRef:r,decorated:i,dimensions:a,floorControlRef:o,gestureEnabledRef:s,glbUrl:c,objectId:u,onGesture:d,phaseRef:h,removingSince:m,resourceHitTargetRef:p,scaleEnabled:f,sessionHasTrackingRef:g,sessionRef:b,setPlacementPending:x,setPlacementError:v,setTrackingStatus:w,updateAnchorTracking:j,updatePhase:y}=e,{camera:N}=(0,td.C)(),{scene:M}=rL(c,u),C=(0,l.useMemo)(()=>{M.updateMatrixWorld(!0);let e=new eF.NRn().setFromObject(M);if(e.isEmpty())return{height:a.height,minY:0,minZ:0,width:a.width};let t=e.getSize(new eF.Pq0);return{height:t.y,minY:e.min.y,minZ:e.min.z,width:t.x}},[a.height,a.width,M]),I=t5(C),R=(0,l.useRef)(null),z=(0,l.useRef)(null),L=(0,l.useRef)(null),S=(0,l.useRef)(null),Z=p??S,W=(0,l.useRef)(null),Y=(0,l.useMemo)(()=>new rd,[]),k=(0,l.useMemo)(()=>{let e=function(){let e=new eF.YJl,t=[],r=[],n=function(){let e=document.createElement("canvas");e.width=128,e.height=128;let t=e.getContext("2d");if(!t)return null;let r=t.createRadialGradient(64,64,0,64,64,64);r.addColorStop(0,"rgba(255,255,255,0.5)"),r.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=r,t.fillRect(0,0,128,128);let n=new eF.GOR(e);return n.minFilter=1006,n}(),i=(e,t)=>(t.push(e),e),a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return i(new eF.V9B({color:0xffffff,depthTest:!1,opacity:e,side:t,transparent:!0}),r)},l=(r,n,a)=>{let l=new eF.eaF(i(r,t),n);return l.renderOrder=a,e.add(l),l},o=l(new eF.iNn(1,1,1),a(.92),15);o.frustumCulled=!1,o.raycast=ni;let s=a(.92),c=[-1,1].map(e=>{let t=l(new eF.iNn(1,1,1),s,15);return t.frustumCulled=!1,t.raycast=ni,t.userData.side=e,t});if(n){let e=l(new eF.bdM(.4,.4).rotateX(-Math.PI/2),i(new eF.V9B({depthTest:!1,depthWrite:!1,map:n,transparent:!0}),r),13);e.position.y=.002,e.raycast=ni}let u=l(new eF.tcD(.075,40).rotateX(-Math.PI/2),a(.96,2),17);u.position.y=.004,u.raycast=na;let d=l(new eF.O3Y(.1,.006,14,44).rotateX(-Math.PI/2),a(.75,2),17);d.position.y=.004,d.raycast=na;let h=a(.95,2),m=Array.from({length:4},(e,t)=>{var r;let n,i,a,o,s,c,u=l((r=t*Math.PI/2,n=new eF.Pq0(Math.cos(r),0,Math.sin(r)),i=new eF.Pq0(-Math.sin(r),0,Math.cos(r)),a=n.clone().multiplyScalar(.155),o=n.clone().multiplyScalar(.115).addScaledVector(i,.028),s=n.clone().multiplyScalar(.115).addScaledVector(i,-.028),(c=new eF.LoY).setAttribute("position",new eF.THS(new Float32Array([a.x,.005,a.z,o.x,.005,o.z,s.x,.005,s.z]),3)),c),h,17);return u.raycast=na,u}),p=l(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,t=Math.PI-.35999999999999993-.3,r=[],n=[],i=(e,t)=>(r.push(Math.cos(e)*t,0,Math.sin(e)*t),r.length/3-1);for(let a=0;a<2;a+=1){let l=a*Math.PI+.15,o=r.length/3;for(let r=0;r<=e;r+=1){let n=l+t*r/e;i(n,.10600000000000001),i(n,.094)}for(let t=0;t<e;t+=1){let e=o+2*t;n.push(e,e+1,e+2,e+1,e+3,e+2)}let s=l+t;n.push(i(s,.124),i(s,.1-.024),i(s+.35999999999999993,.1))}let a=new eF.LoY;return a.setAttribute("position",new eF.qtW(r,3)),a.setIndex(n),a}(),a(.95,2),17);p.position.y=.004,p.raycast=na;let f="move",g=0,b=()=>{let e="placement"===f;d.visible=!e,m.forEach(t=>{t.visible=!e}),p.visible=e;let t=e?.145:.175,r=Math.max(.06,Math.max(.12,g)-t);c.forEach(e=>{e.scale.set(r,.006,.006),e.position.set(e.userData.side*(t+r/2),.004,0)})};b();let x=l(new eF.tcD(.3,28,Math.PI,Math.PI).rotateX(-Math.PI/2),i(new eF.V9B({side:2,visible:!1}),r),17);return x.position.y=.004,x.frustumCulled=!1,x.raycast=e6,{dispose:()=>{t.forEach(e=>e.dispose()),r.forEach(e=>e.dispose()),null==n||n.dispose()},grabArea:x,group:e,setStyle:e=>{e!==f&&(f=e,b())},update:t=>{let{floor:r,frameBottomHeight:n,wallYaw:i,yaw:a}=t;e.position.set(r.x,r.y,r.z),e.rotation.set(0,a,0),x.rotation.set(0,i-a,0);let l=Math.max(.02,n);o.scale.set(.006,l,.006),o.position.set(0,l/2+.003,0),g=t.halfWidth,b()}}}();return e.group.visible=!1,e.group.scale.setScalar(1e-4),e},[]);(0,l.useEffect)(()=>(o&&(o.current=k),()=>{(null==o?void 0:o.current)===k&&(o.current=null),k.dispose()}),[k,o]);let T=(0,l.useRef)({elapsedMs:240,from:1e-4,shown:!1}),D=(0,l.useRef)(null),P=(0,l.useRef)({freeHeading:null,lockedWall:null,switchFrames:0}),X=(0,l.useRef)(null),A=(0,l.useMemo)(()=>new eF.Pq0,[]),O=(0,l.useRef)(!1),G=(0,l.useRef)(!1);O.current=null!==m,(0,l.useEffect)(()=>(G.current=!0,()=>{G.current=!1}),[]);let U=(0,l.useMemo)(()=>({orientationRoot:{pitch:0,position:{x:0,y:-a.height/2,z:0}},userRoot:{scale:1,yaw:0},worldRoot:{normal:{x:0,y:0,z:1},position:{x:0,y:1.45,z:-1.25},yaw:0}}),[a]),H=(0,l.useRef)(nl(U)),E=(0,l.useRef)(nl(U)),F=(0,l.useRef)({count:0,hit:null}),V=(0,l.useRef)(null),J=(0,l.useRef)(!1),B=(0,l.useRef)([]),_=(0,l.useRef)({candidateNormal:null,candidatePoint:null,count:0,shouldSwitch:!1}),Q=(0,l.useRef)(!1),K=(0,l.useRef)(null),q=(0,l.useRef)(null),$=(0,l.useRef)(0),ee=(0,l.useRef)(-1/0),et=(0,l.useRef)(!1),er=(0,l.useRef)("tracking"),en=(0,l.useCallback)((e,r,n,i,a,l)=>{var o;O.current||!G.current?r.delete():(null==(o=t.current)||o.delete(),t.current=r,q.current=new eF.Pq0(e.pose.position.x,e.pose.position.y,e.pose.position.z),E.current=n,a&&(H.current=nl(n)),l&&(B.current=r7(B.current,no(n,t5(C,n.userRoot.scale)))),$.current=performance.now(),v(!1),y(i))},[t,C,v,y]);r.current=(0,l.useCallback)(()=>{let e=V.current,t=b.current;if(!e||!t||J.current||"preview"!==h.current)return;J.current=!0,null==x||x(!0);let r=nl(E.current),n=null!==P.current.lockedWall;t.createAnchor(e).catch(()=>(0,tQ.em)(e.pose)).then(t=>en(e,t,r,"placed",!0,n)).catch(()=>v(!0)).finally(()=>{J.current=!1,null==x||x(!1)})},[en,h,b,v,x]);let ei=(0,l.useCallback)(e=>{let t=b.current;t&&!J.current&&(J.current=!0,t.createAnchor(e).then(t=>{var r;let n=t4(e,a,N.position,C.height,t5(C,E.current.userRoot.scale),C.minY),i=null==(r=K.current)?void 0:r.call(K,n);i?(en(e,t,i,"selected",!1,!0),Q.current&&(ee.current=performance.now())):t.delete()}).catch(()=>v(!0)).finally(()=>{J.current=!1}))},[N.position,a,en,C,b,v]);!function(e){let{draggedAtRef:t,floorControl:r=null,floorYRef:n,gestureEnabledRef:i,interactionEnabledRef:a,knownWallsRef:o,lastInteractionRef:s,onGesture:c,phaseRef:u,resourceRef:d,scaleEnabled:h,targetTransformRef:m,updatePhase:p,wallOffset:f,wallSlideActiveRef:g,wallSlideSwitchRef:b}=e,{camera:x,gl:v}=(0,td.C)(),w=(0,l.useRef)(f);(0,l.useLayoutEffect)(()=>{w.current=f},[f]);let j=(0,l.useRef)(c);(0,l.useLayoutEffect)(()=>{j.current=c},[c]),(0,l.useEffect)(()=>{let e=v.domElement,{dispose:l,raycaster:c}=rb(e,x),f=new eF.Zcv(new eF.Pq0(0,1,0),0),y=new eF.Zcv,N=new eF.Pq0,M=new eF.Pq0,C=new eF.Pq0,I=new Map,R=null,z=0,L=0,S=0,Z=new eF.Pq0,W=new eF.Pq0,Y=new eF.Pq0,k=new eF.Pq0,T=null,D=!1,P=0,X=1,A=!1,O=!1,G=!1,U=()=>w.current*m.current.userRoot.scale,H=(e,t)=>{var r;return t?(c.setRay(e),(null==(r=c.intersect(t))?void 0:r.distance)??null):null},E=()=>{let e=m.current;if("preview"===u.current)return{distance:0,yaw:0};let t=r5(e.worldRoot.position,o.current);return t?t1(t.wall.normal,e.worldRoot.normal)>=nn&&.12>=Math.abs(t.distance-U())?{distance:0,yaw:0}:{distance:t.distance,yaw:t.wall.yaw-e.worldRoot.yaw}:null},F=()=>{let e=E();return null!==e&&r3(m.current.userRoot.yaw,e.yaw,e.distance,!1).snapped},V=e=>{let t=H(e,d.current),i=null!==t;if("preview"===u.current){R="rotate",z=e.clientX,L=e.clientY,S=m.current.userRoot.yaw,D=F();return}if("placed"===u.current){i&&p("selected"),R=null;return}if("selected"!==u.current){R=null;return}let a=r?H(e,r.group):null;if(g.current="wall-slide"===(R=function(e){let{startsOnFloorControl:t,startsOnResource:r}=e;return t?"floor-move":r?"wall-slide":"rotate"}({startsOnFloorControl:null!==a&&(null===t||a<t),startsOnResource:i})),z=e.clientX,L=e.clientY,S=m.current.userRoot.yaw,Z.set(m.current.worldRoot.position.x,m.current.worldRoot.position.y,m.current.worldRoot.position.z),"rotate"===R&&(D=F()),"wall-slide"===R){let t,r;t=m.current,Z.set(t.worldRoot.position.x,t.worldRoot.position.y,t.worldRoot.position.z),r=r1(t),N.set(r.x,r.y,r.z),y.setFromNormalAndCoplanarPoint(N,Z),c.beginAnchoredDrag(e,Z),c.setAnchoredRay(e),(!c.intersectPlane(y,C)||(W.copy(C),0))&&(R=null,g.current=!1)}else if("floor-move"===R){T=r9(Z,o.current,null,U()).attachedWall;let t=(null==n?void 0:n.current)??0;if(f.constant=-t,M.set(Z.x,t,Z.z),c.beginAnchoredDrag(e,M),c.setAnchoredRay(e),!c.intersectPlane(f,C)){R=null;return}Y.copy(C),k.copy(Z)}},J=t=>{if(a.current&&(null==i?void 0:i.current)!==!1){if(t.preventDefault(),e.setPointerCapture(t.pointerId),c.measure(),I.set(t.pointerId,t),s.current=performance.now(),1===I.size){O=!1,G=!1,A="selected"===u.current,V(t);return}if(G=!0,R=null,g.current=!1,2===I.size&&h&&A){let[e,t]=Array.from(I.values());R="pinch",P=Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY),X=m.current.userRoot.scale}}},B=r=>{if(a.current&&(null==i?void 0:i.current)!==!1&&I.has(r.pointerId)){if(I.set(r.pointerId,r),s.current=performance.now(),O||(O=Math.hypot(r.clientX-z,r.clientY-L)>=4),"pinch"===R&&2===I.size){let[e,t]=Array.from(I.values()),r=Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY),n=m.current,i=n.userRoot.scale,a=rp(X,r/Math.max(1,P));n.userRoot.scale=a;let l=w.current*(a-i);n.worldRoot.position={x:n.worldRoot.position.x+n.worldRoot.normal.x*l,y:n.worldRoot.position.y,z:n.worldRoot.position.z+n.worldRoot.normal.z*l};return}if(1===I.size){if("rotate"===R&&O){let t=S+rm(z,r.clientX,e.clientWidth),n=E(),i=n?r3(t,n.yaw,n.distance,D):{snapped:!1,yaw:t};D=i.snapped,m.current.userRoot.yaw=i.yaw}else if("wall-slide"===R){if(c.setAnchoredRay(r),c.intersectPlane(y,C)){let e,r,n;m.current.worldRoot.position=(e=t0(r1(m.current)),n=(r={x:C.x-W.x,y:C.y-W.y,z:C.z-W.z}).x*e.x+r.z*e.z,{x:Z.x+r.x-e.x*n,y:r2(Z.y+r.y),z:Z.z+r.z-e.z*n}),t&&(t.current=performance.now())}}else if("floor-move"===R&&(c.setAnchoredRay(r),c.intersectPlane(f,C))){let e=r9({x:k.x+C.x-Y.x,y:k.y,z:k.z+C.z-Y.z},o.current,T,U());T=e.attachedWall,m.current.worldRoot.position=e.position,t&&(t.current=performance.now()),e.wall&&(m.current.worldRoot.normal={...e.wall.normal},m.current.worldRoot.yaw=e.wall.yaw,m.current.userRoot.yaw=0,D=!0)}}}},_=e=>{let t=R,r=I.delete(e.pointerId);if(R=null,g.current=!1,1===I.size)V(Array.from(I.values())[0]);else if(0===I.size){let e;r&&(e=j.current)&&A&&!G&&("rotate"===t?e(O?"rotate":"release"):O&&("wall-slide"===t||"floor-move"===t)&&e("move")),A=!1}},Q=e=>{var t,r;let n,i,a,l;if("wall-slide"!==R)return null;let o=I.values().next().value;if(!o)return null;let s=r1({userRoot:m.current.userRoot,worldRoot:e.worldRoot});if(N.set(s.x,s.y,s.z),M.set(e.worldRoot.position.x,e.worldRoot.position.y,e.worldRoot.position.z),y.setFromNormalAndCoplanarPoint(N,M),c.setAnchoredRay(o),!c.intersectPlane(y,C))return null;let u=(t=m.current,r={offsetFromCurrentCenter:{x:W.x-Z.x,y:W.y-Z.y,z:W.z-Z.z},pointOnNextWall:C},i=Math.cos(n=e.worldRoot.yaw-t.worldRoot.yaw),a=Math.sin(n),l={x:r.offsetFromCurrentCenter.x*i+r.offsetFromCurrentCenter.z*a,y:r.offsetFromCurrentCenter.y,z:-r.offsetFromCurrentCenter.x*a+r.offsetFromCurrentCenter.z*i},e.userRoot={...t.userRoot},e.worldRoot.position={x:r.pointOnNextWall.x-l.x,y:r.pointOnNextWall.y-l.y,z:r.pointOnNextWall.z-l.z},e);Z.set(u.worldRoot.position.x,u.worldRoot.position.y,u.worldRoot.position.z),W.copy(C);let d=r1(u);return N.set(d.x,d.y,d.z),y.setFromNormalAndCoplanarPoint(N,Z),u};return b.current=Q,e.addEventListener("pointerdown",J),e.addEventListener("pointermove",B),e.addEventListener("pointerup",_),e.addEventListener("pointercancel",_),()=>{e.removeEventListener("pointerdown",J),e.removeEventListener("pointermove",B),e.removeEventListener("pointerup",_),e.removeEventListener("pointercancel",_),b.current===Q&&(b.current=null),l()}},[x,t,r,n,i,v,a,o,s,u,d,h,m,p,w,g,b])}({draggedAtRef:ee,floorControl:k,floorYRef:D,gestureEnabledRef:s,interactionEnabledRef:et,knownWallsRef:B,lastInteractionRef:$,onGesture:d,phaseRef:h,resourceRef:Z,scaleEnabled:f,targetTransformRef:E,updatePhase:y,wallOffset:I,wallSlideActiveRef:Q,wallSlideSwitchRef:K});let ea=(e,t)=>{let r="preview"===h.current,n=(r||"selected"===h.current)&&null===m,i=T.current;if(k.setStyle(r?"placement":"move"),i.shown!==n&&(i.shown=n,i.elapsedMs=0,i.from=k.group.scale.x),i.elapsedMs=Math.min(240,i.elapsedMs+t),k.group.scale.setScalar(to({elapsedMs:i.elapsedMs,from:i.from,to:n?1:1e-4})),k.group.visible=n||i.elapsedMs<240,k.group.visible){let t=D.current??0,r=e.userRoot.scale,n=tl(C.width,C.height);k.update({floor:{x:e.worldRoot.position.x,y:t,z:e.worldRoot.position.z},frameBottomHeight:e.worldRoot.position.y-n.height*r/2-t,halfWidth:C.width*r/2+.05,wallYaw:e.worldRoot.yaw,yaw:e.worldRoot.yaw+e.userRoot.yaw})}};return(0,td.D)((e,r,n)=>{var i,l,o,s;let c=1e3*r,u=performance.now(),d=b.current,p=!0;if(et.current=g.current,d&&n){let e=d.getCenterHit(n),r=(0,tQ.aq)(e)?e:null,m=function(e,t){var r,n,i,a;let l;if(!(0,tQ.aq)(t))return{stableHit:null,state:{count:0,hit:null}};let o=(null==e||null==(r=e.hit)?void 0:r.kind)==="wall"&&(n=e.hit,l=Math.abs(t1(n.normal,t.normal)),i=n.pose.position,a=t.pose.position,.5>=Math.hypot(i.x-a.x,i.y-a.y,i.z-a.z)&&l>=Math.cos(15*Math.PI/180)),s={count:o?e.count+1:1,hit:o?e.hit:t};return{stableHit:s.count>=8?t:null,state:s}}(F.current,r),f=null;if(F.current=m.state,(null==e?void 0:e.kind)==="floor"&&(D.current=Math.min(D.current??e.pose.position.y,e.pose.position.y)),r&&(f=t4(r,a,N.position,C.height,t5(C,E.current.userRoot.scale),C.minY)),m.stableHit){let e=t4(m.stableHit,a,N.position,C.height,I,C.minY);B.current=r7(B.current,no(e,I))}Q.current?(_.current=r4(_.current,E.current.worldRoot.normal,f&&r?{normal:f.worldRoot.normal,point:r.pose.position}:null),r&&_.current.shouldSwitch&&ei(r)):_.current=r4(void 0,E.current.worldRoot.normal,null);let b=null,x="searching"===h.current||"preview"===h.current,v=function(e){let{hit:t,now:r,searching:n,seenAt:i,tracking:a}=e;if(!n)return{assume:!1,seenAt:null};let l=(null==t?void 0:t.kind)==="floor",o=(0,tQ.aq)(t),s=o||null===i&&a?r:i;return{assume:null!==s&&r-s>=1e4&&!o&&!l,seenAt:s}}({hit:e,now:u,searching:x&&!!d.guessesWalls,seenAt:X.current,tracking:g.current});if(X.current=v.seenAt,x&&!J.current){let t=e;if(v.assume){let e,r,n,a,l;N.getWorldDirection(A),i=N.position,r=(e=Math.hypot(A.x,A.z))>1e-6?{x:A.x/e,y:0,z:A.z/e}:{x:0,y:0,z:-1},n=e>1e-6?A.y/e*1.25:0,a=i.y+Math.min(.9,Math.max(-1.2,n)),l={kind:"wall",normal:{x:-r.x,y:0,z:-r.z},pose:{orientation:{w:1,x:0,y:0,z:0},position:{x:i.x+1.25*r.x,y:a,z:i.z+1.25*r.z}}},t3.add(l),t=l}let r=function(e,t){let{hit:r}=t,n=(0,tQ.aq)(r)?r:null;if(n)return function(e,t,r){let n=t2(t,r.cameraPosition),i={...ne(n),point:{...t.pose.position}},a=e.lockedWall,l=e.switchFrames,o=!1;if(a)!(null!==t&&t3.has(t))&&.5>t1(a.normal,n)?(l+=1)>=8&&(a=i,l=0,o=!0):(a=i,l=0);else a=i,o=!0;let s=r8(t.pose.position,a);s.y=Math.max(r.floorY+r2(t.pose.position.y-r.floorY),r.floorY+nt(r)+.02);let c=nr(a,s,r);return o&&(c.userRoot.yaw=0),{placement:c,source:"wall",state:{freeHeading:null,lockedWall:a,switchFrames:l}}}(e,n,t);let i={...e,switchFrames:0};return(null==r?void 0:r.kind)==="floor"?function(e,t,r){var n;let{freeHeading:i,lockedWall:a}=e;if(a){if(.35>Math.abs(r6(t,a))){let e=r8(t,a);return e.y=r.target.worldRoot.position.y,{placement:nr(a,e,r),source:"wall-held",state:{freeHeading:null,lockedWall:a,switchFrames:0}}}i={normal:a.normal,yaw:a.yaw},a=null}return{placement:nr(i??ne(t0({x:(n=r.cameraPosition).x-t.x,y:0,z:n.z-t.z})),{x:t.x,y:t.y+nt(r)+.02,z:t.z},r),source:"floor",state:{freeHeading:i,lockedWall:null,switchFrames:0}}}(i,r.pose.position,t):{placement:null,source:null,state:i}}(P.current,{bounds:C,cameraPosition:N.position,floorY:D.current??0,hit:t,scale:E.current.userRoot.scale,target:E.current});P.current=r.state,b=r.placement?t:null,l=V.current,o=b,s="preview"===h.current,V.current=o??(s?l:null),r.placement&&(E.current=r.placement,"searching"===h.current&&(H.current=nl(r.placement),$.current=u,y("preview")))}if(W.current&&(W.current.visible="searching"===h.current&&null!==b&&!J.current,W.current.visible||Y.reset(),b&&(Y.follow(W.current,b.pose.position,c,0,b.kind),W.current.lookAt(N.position))),("placed"===h.current||"selected"===h.current)&&t.current){let e=t.current.getPose(n),r=q.current;if(!e){let i=(0,tQ.gD)(t.current,r?{orientation:t.current.pose.orientation,position:{x:r.x,y:r.y,z:r.z}}:null);i&&(t.current=i,e=i.getPose(n))}let i=j(null!==e,u);p=null!==e,et.current&&(et.current=p),er.current!==i&&(er.current=i,w(i)),e&&r&&(E.current.worldRoot.position={x:E.current.worldRoot.position.x+e.position.x-r.x,y:E.current.worldRoot.position.y+e.position.y-r.y,z:E.current.worldRoot.position.z+e.position.z-r.z},r.set(e.position.x,e.position.y,e.position.z))}}if((!g.current||!p)&&null===m)return void ea(H.current,c);let f=R.current,x=z.current,v=L.current;if(!f||!x||!v)return;f.visible="searching"!==h.current;let M=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.22;return re(e,t,r)}(H.current,E.current,t8(c,"preview"===h.current?.15:.22)),S=u-ee.current<120?{...M,worldRoot:{...M.worldRoot,position:{...E.current.worldRoot.position}}}:M;H.current=S,f.position.set(S.worldRoot.position.x,S.worldRoot.position.y,S.worldRoot.position.z),f.rotation.set(0,S.worldRoot.yaw,0),x.rotation.set(0,S.userRoot.yaw,0),x.scale.setScalar(S.userRoot.scale*rr(m,u)),v.position.set(S.orientationRoot.position.x,S.orientationRoot.position.y,S.orientationRoot.position.z),v.rotation.set(S.orientationRoot.pitch,0,0),ea(S,c)}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(rh,{ref:W}),(0,n.jsx)("primitive",{object:k.group}),(0,n.jsx)("group",{ref:R,visible:!1,children:(0,n.jsx)("group",{ref:z,children:(0,n.jsx)("group",{ref:L,children:(0,n.jsx)("group",{ref:Z,children:(0,n.jsx)(nc,{decorated:i,scene:M})})})})})]})}function nc(e){let{decorated:t,scene:r}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("primitive",{object:r}),(0,n.jsx)(ru,{active:t,root:r,surface:"wall"})]})}function nu(e){let{forgetTrackingStatus:t,manager:r,object:i,onPlaced:a,phase:o,placing:s,scaleEnabled:c,selected:u,sessionHasTrackingRef:d,sessionRef:h,setPlacementError:m,setPlacementPending:p,setTrackingStatus:f,updateSessionPhase:g}=e,b=s?"preview"===o?"preview":"searching":u?"selected":"placed";(0,l.useLayoutEffect)(()=>{i.runtime.phaseRef.current=b},[i,b]);let x=(0,l.useCallback)(e=>{i.runtime.phaseRef.current=e,"selected"===e&&r.selectObject(i.id),s&&(g(e),"placed"===e&&a())},[r,i,a,s,g]),v=(0,l.useCallback)(e=>{"release"===e?r.releaseObject(i.id):r.reportGesture({kind:e,objectId:i.id})},[r,i.id]),w=null!=i.removingSince,j=(0,l.useCallback)(e=>{w||f(i.id,e)},[i.id,w,f]);(0,l.useEffect)(()=>()=>t(i.id),[t,i.id]);let y=(0,l.useCallback)((e,t)=>{var r;return r=i.runtime,r.tracking=eJ(r.tracking,{hasPose:e,now:t}),r.tracking.status},[i.runtime]);return(0,n.jsx)(ns,{anchorRef:i.runtime.anchorRef,confirmPlacementRef:i.runtime.confirmPlacementRef,floorControlRef:i.runtime.floorControlRef,decorated:ti({phase:o,placing:s,selected:u}),dimensions:i.resource.dimensions,gestureEnabledRef:i.runtime.gestureEnabledRef,glbUrl:i.resource.glbUrl,objectId:i.id,onGesture:v,phaseRef:i.runtime.phaseRef,removingSince:i.removingSince??null,resourceHitTargetRef:i.runtime.hitTargetRef,scaleEnabled:c,sessionHasTrackingRef:d,sessionRef:h,setPlacementError:m,setPlacementPending:p,setTrackingStatus:j,updateAnchorTracking:y,updatePhase:x})}let nd=(0,l.memo)(e=>{let{objects:t,phaseRef:r,placement:i,scaleEnabled:a,sessionHasTrackingRef:o,sessionRef:s,tracking:c}=e,{allManager:u,ceilingManager:d,floorManager:h,gestureOwnerIdRef:m,manager:p,snapshot:f}=t,{allHitRef:g,ceilingHitRef:b,floorHitRef:x,handleWallPlaced:v,heightModeRef:w,phase:j,placingObjectId:y,setHeightLabel:N,setPlacementError:M,setPlacementPending:C,updatePhase:I}=i,R=f.objects.find(e=>e.id===y)??null,z=e=>(null==R?void 0:R.mechanic)===e?R.id:null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(rJ,{sessionHasTrackingRef:o,sessionRef:s,setTrackingStatus:c.setSession}),(0,n.jsx)(rB,{gestureOwnerIdRef:m,manager:p,placingObjectId:y}),(0,n.jsx)(rA,{currentHitRef:x,manager:h,phase:j,phaseRef:r,placingObjectId:z("floor"),scaleEnabled:a,sceneObjects:f.objects.filter(rU),selectedObjectId:f.selectedObjectId,sessionHasTrackingRef:o,sessionRef:s,setTrackingStatus:c.setFloor,updatePhase:I}),(0,n.jsx)(rT,{currentHitRef:b,heightModeRef:w,manager:d,phase:j,phaseRef:r,placingObjectId:z("ceiling"),scaleEnabled:a,sceneObjects:f.objects.filter(rE),selectedObjectId:f.selectedObjectId,sessionHasTrackingRef:o,sessionRef:s,setHeightLabel:N,setTrackingStatus:c.setCeiling,updatePhase:I}),(0,n.jsx)(rS,{currentHitRef:g,manager:u,phase:j,phaseRef:r,placingObjectId:z("all"),scaleEnabled:a,sceneObjects:f.objects.filter(rF),selectedObjectId:f.selectedObjectId,sessionHasTrackingRef:o,sessionRef:s,setTrackingStatus:c.setAll,updatePhase:I}),f.objects.filter(rH).map(e=>(0,n.jsx)(l.Suspense,{fallback:null,children:(0,n.jsx)(nu,{forgetTrackingStatus:c.forgetWall,manager:p,object:e,phase:j,placing:e.id===y,scaleEnabled:a,selected:e.id===f.selectedObjectId,sessionHasTrackingRef:o,sessionRef:s,setPlacementError:M,setPlacementPending:C,setTrackingStatus:c.setWall,updateSessionPhase:I,onPlaced:v})},e.id))]})});nd.displayName="ArSessionLayers";let nh="var(--v-borders-medium)";function nm(e){let{className:t,variant:r="default",size:i="default",state:a="loading",role:l,"aria-live":o,"aria-label":s,...c}=e;switch(r){case"logo":{let e="sm"===i?4:5;return(0,n.jsxs)("svg",{...c,role:l??"status","aria-live":o??"polite","aria-label":s??("success"===a?"Success":"error"===a?"Error":"Loading"),width:"93",height:"91",viewBox:"0 0 93 91",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-slot":"spinner","data-size":i,"data-state":a,className:(0,X.cn)("spinner-logo shrink-0","sm"===i?"size-9":"size-22",t),children:[(0,n.jsx)("g",{className:"spinner-logo__intro-shell",children:(0,n.jsx)("path",{d:"M15.7495 62.7798L46.4936 45.0297M46.4936 45.0297L77.2661 62.5451M46.4936 45.0297L46.7111 9.62225M49.9213 79.4237L74.5719 65.1917C75.6436 64.5705 76.5344 63.6811 77.1541 62.6137C77.7738 61.5462 78.1003 60.3385 78.1007 59.1129L78.1729 30.7811C78.1734 29.5494 77.851 28.3427 77.2373 27.2798C76.6236 26.2169 75.7398 25.3343 74.6729 24.7189L50.1007 10.6155C47.926 9.3694 45.2455 9.37719 43.0689 10.6339L18.4183 24.8659C16.2385 26.1244 14.8946 28.4401 14.8895 30.9447L14.8173 59.2766C14.8168 60.5082 15.1392 61.7149 15.7529 62.7778C16.3666 63.8408 17.2504 64.7233 18.3173 65.3387L42.8895 79.4421C45.0642 80.6882 47.7447 80.6805 49.9213 79.4237Z",className:"spinner-logo__outline spinner-logo__outline--intro",vectorEffect:"sm"===i?void 0:"non-scaling-stroke"})}),(0,n.jsx)("circle",{className:"spinner-logo__intro-orb",cx:"46.27",cy:"45.8",r:"11.18",fill:"white",stroke:nh,strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("circle",{className:"spinner-logo__result-ring",cx:"46.5",cy:"45.5",r:"33.46",fill:"white",stroke:nh,strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.jsx)("g",{transform:"translate(27.786 31.4489)",children:(0,n.jsx)("g",{className:"spinner-logo__result-glyph spinner-logo__result-glyph--success",children:(0,n.jsx)("path",{d:"M13.6758 28.1023C13.3559 28.101 13.0397 28.0341 12.7467 27.9057C12.4537 27.7772 12.1902 27.59 11.9725 27.3557L0.632479 15.2923C0.208575 14.8406 -0.0185097 14.2389 0.00118164 13.6198C0.020873 13.0006 0.285727 12.4146 0.737479 11.9907C1.18923 11.5668 1.79088 11.3397 2.41006 11.3594C3.02924 11.3791 3.61524 11.6439 4.03915 12.0957L13.6525 22.339L33.2758 0.87233C33.475 0.624349 33.7227 0.419696 34.0038 0.270944C34.2849 0.122191 34.5935 0.0324784 34.9105 0.00731496C35.2276 -0.0178485 35.5464 0.0220682 35.8475 0.124615C36.1485 0.227162 36.4254 0.390174 36.6612 0.603637C36.897 0.8171 37.0866 1.07651 37.2185 1.36593C37.3503 1.65535 37.4216 1.96867 37.428 2.28665C37.4344 2.60463 37.3756 2.92056 37.2555 3.21502C37.1353 3.50949 36.9562 3.77627 36.7291 3.999L15.4025 27.3323C15.1868 27.5709 14.9242 27.7625 14.6311 27.895C14.338 28.0275 14.0208 28.0981 13.6991 28.1023H13.6758Z",fill:nh})})}),(0,n.jsx)("g",{transform:"translate(32.4879 31.4885)",children:(0,n.jsx)("g",{className:"spinner-logo__result-glyph spinner-logo__result-glyph--error",children:(0,n.jsx)("path",{d:"M17.3045 14.0095L27.3378 3.99955C27.5554 3.78199 27.728 3.52371 27.8457 3.23946C27.9635 2.95521 28.0241 2.65055 28.0241 2.34288C28.0241 2.03521 27.9635 1.73055 27.8457 1.4463C27.728 1.16205 27.5554 0.903769 27.3378 0.686213C27.1203 0.468656 26.862 0.296082 26.5778 0.178341C26.2935 0.0606 25.9889 -4.58466e-09 25.6812 0C25.3735 4.58466e-09 25.0689 0.0606 24.7846 0.178341C24.5003 0.296082 24.2421 0.468656 24.0245 0.686213L14.0145 10.7195L4.00451 0.686213C3.56514 0.246838 2.96921 -4.62957e-09 2.34784 0C1.72647 4.62957e-09 1.13055 0.246838 0.691177 0.686213C0.251802 1.12559 0.0049634 1.72151 0.0049634 2.34288C0.00496339 2.96425 0.251802 3.56017 0.691177 3.99955L10.7245 14.0095L0.691177 24.0195C0.472196 24.2363 0.29836 24.4943 0.179723 24.7787C0.0610849 25.063 0 25.3681 0 25.6762C0 25.9843 0.0610849 26.2894 0.179723 26.5737C0.29836 26.8581 0.472196 27.1161 0.691177 27.3329C0.908091 27.5516 1.16616 27.7252 1.4505 27.8436C1.73484 27.9621 2.03982 28.0231 2.34784 28.0231C2.65587 28.0231 2.96085 27.9621 3.24519 27.8436C3.52953 27.7252 3.7876 27.5516 4.00451 27.3329L14.0145 17.2995L24.0245 27.3329C24.296 27.6078 24.6314 27.8111 25.0007 27.9245C25.3701 28.0379 25.7618 28.0579 26.1407 27.9828C26.5197 27.9077 26.8741 27.7397 27.1722 27.4939C27.4703 27.2481 27.7028 26.9322 27.8488 26.5745C28.0272 26.1459 28.0736 25.6738 27.9821 25.2187C27.8907 24.7636 27.6655 24.346 27.3355 24.0195L17.3045 14.0095Z",fill:nh})})})]})}case"default":return(0,n.jsx)(P,{...c,role:l??"status","aria-live":o??"polite","aria-label":s??"Loading","data-slot":"spinner",className:(0,X.cn)("size-4 animate-spin",t)});default:return r}}function np(e){let{isStarting:t,onStart:r}=e,{t:i}=(0,o.Bd)();return(0,n.jsxs)("div",{className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-6 bg-[#17171b] px-8 text-center text-white","data-testid":"ar-intro",children:[(0,n.jsx)(p.HM,{asChild:!0,children:(0,n.jsx)(m.$,{className:"absolute right-6 bg-white/10 text-white hover:bg-white/20 active:bg-white/25",style:{top:"max(1.5rem, env(safe-area-inset-top))"},size:"icon","aria-label":i("close"),"data-testid":"ar-intro-close",children:(0,n.jsx)(f.A,{"aria-hidden":"true"})})}),(0,n.jsxs)("div",{className:"relative -mx-8 flex w-screen max-w-[calc(100%+4rem)] justify-center",children:[(0,n.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-1/2 aspect-square w-[160%] -translate-x-1/2 -translate-y-1/2 rounded-full bg-[radial-gradient(circle,rgba(255,255,255,0.15)_0%,rgba(255,255,255,0.06)_45%,transparent_72%)]"}),(0,n.jsx)(eR,{className:"relative",name:"camera-intro",size:390})]}),(0,n.jsxs)("div",{className:"grid gap-2",children:[(0,n.jsx)("h2",{className:"typo-base-18 font-medium",children:i("intro.title")}),(0,n.jsx)("p",{className:"typo-base-14 max-w-xs text-white/75",children:i("intro.body")})]}),(0,n.jsx)(m.$,{"data-testid":"ar-intro-start",disabled:t,size:"lg",onClick:r,children:i(t?"intro.starting":"intro.action")}),(0,n.jsx)("p",{className:"typo-base-14 max-w-xs text-xs text-white/55",children:i("intro.privacy")})]})}var nf=r(557),ng=r(1083);function nb(e){if(e&&"object"==typeof e&&"name"in e){let t=e.name;if("NotAllowedError"===t||"SecurityError"===t)return"camera-denied";if("NotSupportedError"===t)return"unsupported"}return"error"}var nx=r(7026);async function nv(){let{backend:e,registry:t={"8thwall":new nx.VU,webxr:new rM},webview:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e?[e]:r?["webxr"]:rx.A,i=[];for(let e of n){let r=t[e];await r.isSupported().catch(()=>!1)&&i.push(r)}if(i.length)return i;if("u">typeof window&&!window.isSecureContext)throw Error("AR needs a secure connection. Open this page over HTTPS or localhost.");throw Error("AR is not available on this device.")}class nw{async isSupported(){try{return await this.resolve(),!0}catch{return!1}}async startSession(e){let t=await this.resolve();for(let r=0;r<t.length;r+=1)try{return await t[r].startSession(e)}catch(e){if(r===t.length-1||"camera-denied"===nb(e))throw e;this.resolution=Promise.resolve(t.slice(r+1))}throw Error("AR is not available on this device.")}resolve(){return this.resolution||(this.resolution=nv(this.options).catch(e=>{throw this.resolution=null,e})),this.resolution}constructor(e={}){(0,tO._)(this,"options",void 0),(0,tO._)(this,"resolution",void 0),this.options=e,this.resolution=null}}function nj(e){return e&&"renderBridge"in e?e.renderBridge??null:null}let ny=(0,l.createContext)(null);function nN(){return(0,l.use)(ny)}function nM(){let{t:e}=(0,o.Bd)();return(0,n.jsx)(p.HM,{asChild:!0,children:(0,n.jsxs)(m.$,{className:"absolute top-3 right-6 z-30",variant:"secondary",children:[e("close"),(0,n.jsx)(f.A,{})]})})}function nC(e){var t,r;let i,a,{children:o,tracker:s,waiting:c=!1}=e,u=(0,l.useMemo)(()=>(0,rn.Bo)().backend,[]),d=(0,l.useMemo)(()=>(0,nf.N0)(),[]),h=function(e){let{tracker:t,webview:r}=e,n=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(null),o=(0,l.useRef)(!1),s=(0,l.useRef)(!0),c=(0,l.useRef)(!1),[u,d]=(0,l.useState)(!1),[h,m]=(0,l.useState)(!1),[p,f]=(0,l.useState)(!1),[g,b]=(0,l.useState)(0),[x,v]=(0,l.useState)(null),[w,j]=(0,l.useState)(!1),[y,N]=(0,l.useState)(null);(0,l.useEffect)(()=>{let e=!0;return s.current=!0,t.isSupported().then(t=>{e&&(t?j(!0):N(r?"webview":"unsupported"))}).catch(t=>e&&N(nb(t))),()=>{e=!1,s.current=!1;let t=a.current;a.current=null,o.current=!1,null==t||t.end().catch(()=>void 0)}},[t,r]);let M=(0,l.useCallback)(async(e,t)=>{a.current=null,o.current=!1,await (null==e?void 0:e.end().catch(()=>void 0)),d(!1),m(!1),N(r?"webview":nb(t)),v({error:t})},[r]),C=(0,l.useCallback)(async e=>{let t=i.current;if(t&&!o.current){o.current=!0;try{await e.attachRenderer(t),m(!0)}catch(t){a.current===e&&await M(e,t)}}},[M]),I=(0,l.useCallback)(async()=>{let e=n.current;if(!e||a.current||c.current)return;c.current=!0,o.current=!1,m(!1),f(!0),b(e=>e+1),v(null),N(null);let r=null;try{if(r=await t.startSession({overlayRoot:e}),!s.current)return void await r.end().catch(()=>void 0);a.current=r,d(!0),await C(r)}catch(e){await M(r,e)}finally{c.current=!1,f(!1)}},[C,M,t]),R=(0,l.useCallback)(e=>{n.current=e},[]),z=(0,l.useCallback)(e=>{i.current=e;let t=a.current;t&&C(t)},[C]);return(0,l.useMemo)(()=>({hasStarted:u,isAttached:h,isStarting:p,runtimeState:y,sessionRef:a,setOverlayRoot:R,setRenderer:z,start:I,startAttempts:g,startFailure:x,supported:w}),[u,h,p,y,R,z,I,g,x,w])}({tracker:(0,l.useMemo)(()=>s??new nw({backend:u,webview:d}),[u,d,s]),webview:d}),[m,p]=(0,l.useState)(null),[f,g]=(0,l.useState)(null),[b,v]=(0,l.useState)(!1),w=(t=h.sessionRef,r=h.hasStarted,i=(0,l.useCallback)(e=>{if(!r)return()=>void 0;let n=0,i=()=>{if(t.current&&"renderBridge"in t.current){if(nj(t.current))return void e();n=requestAnimationFrame(i)}};return i(),()=>cancelAnimationFrame(n)},[r,t]),a=(0,l.useCallback)(()=>r?nj(t.current):null,[r,t]),(0,l.useSyncExternalStore)(i,a,()=>null)),j=(0,l.useCallback)(e=>{h.setOverlayRoot(e),p(e)},[]),y=(0,l.useCallback)(()=>{v(!0),(0,ng.oP)(),h.start()},[h]),N=h.supported&&!h.runtimeState&&!h.hasStarted&&(!b||h.isStarting),M=`${h.startAttempts}:${c}`;(0,l.useEffect)(()=>{let e=window.setTimeout(()=>g(M),4e3);return()=>window.clearTimeout(e)},[M]);let C=h.sessionRef.current,I=C&&"renderBridge"in C?!!w:h.isAttached,R=c||function(e){let{hasStarted:t,isDrawing:r,runtimeState:n,timedOut:i}=e;return!n&&!i&&(!t||!r)}({hasStarted:h.hasStarted,isDrawing:I,runtimeState:h.runtimeState,timedOut:f===M}),z=(0,l.useMemo)(()=>({overlayRoot:m,renderBridge:w,runtime:h}),[m,w,h]);return(0,n.jsxs)("div",{ref:j,className:"absolute inset-0 overflow-hidden bg-black","data-testid":"ar-session-surface",children:[(0,n.jsx)(ny,{value:z,children:o}),(0,n.jsx)("div",{"aria-hidden":!R,className:x("absolute inset-0 z-10 flex items-center justify-center bg-radial from-background-containers to-background-base-2 transition-opacity",R?"pointer-events-auto opacity-100 duration-0":"pointer-events-none opacity-0 duration-300 ease-in-out"),"data-testid":"ar-session-cover",children:(0,n.jsx)(nm,{variant:"logo"})}),N?(0,n.jsx)(np,{isStarting:h.isStarting,onStart:y}):null,h.runtimeState?(0,n.jsx)(eX,{variant:h.runtimeState}):null,(R||h.runtimeState)&&!N?(0,n.jsx)(nM,{}):null]})}var nI=r(5615);function nR(e){let{asCancel:t,show:r,onDelete:i}=e,{t:a}=(0,o.Bd)();return r?(0,n.jsx)(m.$,{className:"absolute left-6 z-10 bg-black/50 text-white hover:bg-black/60 active:bg-black/70",style:{top:"max(1.5rem, env(safe-area-inset-top))"},size:"icon",variant:"secondary","aria-label":a(t?"cancelPlacement":"deleteObject"),"data-testid":"ar-session-delete",onClick:i,children:t?(0,n.jsx)(f.A,{"aria-hidden":"true"}):(0,n.jsx)(nI.A,{"aria-hidden":"true"})}):null}function nz(e){return Math.min(4.5,Math.max(.45,e))}function nL(e){return`${e.toFixed(1)} m`}function nS(e){let{currentVariantId:t,open:r,portalContainer:i,variants:a,onOpenChange:l,onSelect:s}=e,{t:c}=(0,o.Bd)();return(0,n.jsx)(ei,{open:r,onOpenChange:l,children:(0,n.jsxs)(eo,{className:"bg-white text-[#212124]",portalContainer:i,children:[(0,n.jsxs)(es,{className:"px-6 pt-4 pb-0 text-left",children:[(0,n.jsx)(eu,{className:"text-left text-base font-medium",children:c("catalog.selectVariant")}),(0,n.jsx)(ed,{className:"sr-only",children:c("catalog.selectVariant")})]}),(0,n.jsx)("div",{className:"grid grid-cols-3 gap-3 p-6","data-testid":"ar-session-variant-sheet",children:a.map(e=>(0,n.jsxs)("button",{type:"button","aria-pressed":e.hid===t,className:x("grid gap-1 rounded-xl border-2 bg-white p-2 text-left",e.hid===t?"border-primary":"border-[#ededed]"),onClick:()=>s(e.hid),children:[(0,n.jsx)("span",{className:"ar-catalog-media-frame",children:e.previewUrl?(0,n.jsx)("img",{alt:"",className:"ar-catalog-media-img",src:e.previewUrl}):null}),e.name?(0,n.jsx)("span",{className:"truncate text-xs text-[#64646c]",children:e.name}):null]},e.hid))})]})})}var nZ=r(8993);function nW(e){let{ariaLabel:t,className:r,formatHeight:i=nL,height:a,onHeightChange:o}=e,s=100-100*((nz(a)-.45)/4.05),c=(0,l.useRef)(null),u=void 0!==o,d=(0,l.useCallback)(e=>{if(!o)return;let t=e.currentTarget.getBoundingClientRect();t.height<=0||o(.45+(1-Math.min(1,Math.max(0,(e.clientY-t.top)/t.height*100/100)))*4.05)},[o]),h=(0,l.useCallback)(e=>{o&&(e.preventDefault(),e.stopPropagation(),c.current=e.pointerId,e.currentTarget.setPointerCapture(e.pointerId),d(e))},[o,d]),m=(0,l.useCallback)(e=>{c.current===e.pointerId&&(e.preventDefault(),e.stopPropagation(),d(e))},[d]),p=(0,l.useCallback)(e=>{c.current===e.pointerId&&(e.preventDefault(),e.stopPropagation(),c.current=null,e.currentTarget.releasePointerCapture(e.pointerId))},[]),f=(0,l.useCallback)(e=>{if(!o)return;let t=e.shiftKey?.5:.1,r={ArrowDown:-t,ArrowLeft:-t,ArrowRight:t,ArrowUp:t,End:.45-a,Home:4.5-a,PageDown:-.5,PageUp:.5}[e.key];void 0!==r&&(e.preventDefault(),o(nz(a+r)))},[a,o]);return(0,n.jsxs)("div",{"aria-hidden":!u||void 0,"aria-label":u?t:void 0,"aria-valuemax":u?4.5:void 0,"aria-valuemin":u?.45:void 0,"aria-valuenow":u?Number(a.toFixed(1)):void 0,"aria-valuetext":u?i(a):void 0,className:x("absolute top-1/2 right-5 z-10 h-[clamp(180px,56vh,500px)] w-11 -translate-y-1/2 touch-none select-none",u?"pointer-events-auto cursor-ns-resize":"pointer-events-none",r),"data-testid":"ar-session-ceiling-height-scale",role:u?"slider":void 0,tabIndex:u?0:void 0,onKeyDown:f,onPointerCancel:p,onPointerDown:h,onPointerMove:m,onPointerUp:p,children:[(0,n.jsx)("div",{className:"absolute top-0 left-1/2 h-full w-1 -translate-x-1/2 rounded-full bg-[#212124]/50"}),(0,n.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 -translate-y-1/2","data-testid":"ar-session-ceiling-height-scale-handle",style:{"--ar-ceiling-height-scale-top":`${s}%`,top:"var(--ar-ceiling-height-scale-top)"},children:[(0,n.jsx)("div",{className:"grid size-11 place-items-center rounded-full bg-[#4796ff] [background-image:radial-gradient(ellipse_50%_50%_at_50%_50%,#4796ff_0%,#3f73ed_100%)] text-white shadow-[0_4px_12px_rgba(51,51,65,0.12)]",children:(0,n.jsx)(nZ.A,{"aria-hidden":"true",className:"size-6",strokeWidth:2})}),(0,n.jsx)("span",{className:"absolute top-1/2 right-full mr-2 -translate-y-1/2 rounded-[4px] bg-[#212124] px-1 text-[12px] leading-[1.6] font-medium tracking-[0.24px] whitespace-nowrap text-white tabular-nums","data-testid":"ar-session-ceiling-height-scale-label",children:i(a)})]})]})}var nY=r(7807);let nk="neurodyn_ar_learned_lessons";function nT(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nD();if(!e)return[];try{let t=JSON.parse(e.getItem(nk)??"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch{return[]}}function nD(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}function nP(e,t,r){let n,i=null,a=null,l=()=>{let l=e.getSnapshot(),o=null==r?void 0:r.current;if(a&&i===l&&n===o)return a;let s=l.objects.filter(e=>t(e)&&null==e.removingSince&&(!r||e.id===o)),c=s.some(e=>e.id===l.selectedObjectId)?l.selectedObjectId:null;return i=l,n=o,a={objects:s,selectedObjectId:c}};return{beginGesture(t,n){let i=l(),a=null===t?i.selectedObjectId??(null==r?void 0:r.current)??(null==n?void 0:n.backgroundObjectId)??null:null;return(null===t?null!==a&&i.objects.some(e=>e.id===a):i.objects.some(e=>e.id===t))?e.beginGesture(t,{backgroundObjectId:a}):null},endGesture:t=>e.endGesture(t),getSnapshot:l,isGestureEnabled:()=>!r||l().objects.length>0}}class nX{addObject(e){if(this.snapshot.objects.some(t=>t.id===e.id))throw Error(`Scene object already exists: ${e.id}`);this.setSnapshot({...this.snapshot,objects:[...this.snapshot.objects,e]})}beginGesture(e,t){if(this.activeGesture)return null;if(e)return this.hasObject(e)?(this.selectObject(e),this.activeGesture={mode:"move",objectId:e,startedOnBackground:!1},{mode:"move",objectId:e}):null;let r=this.snapshot.selectedObjectId,n=(null==t?void 0:t.backgroundObjectId)??r;return n&&this.hasObject(n)?(this.activeGesture={mode:"rotate",objectId:n,startedOnBackground:!0},{mode:"rotate",objectId:n}):null}endGesture(e){let{moved:t,multiTouch:r=!1}=e,n=this.activeGesture;if(this.activeGesture=null,n&&!r){if(t)return void this.reportGesture({kind:n.mode,objectId:n.objectId});n.startedOnBackground&&this.releaseObject(n.objectId)}}beginObjectRemoval(e,t){let r=this.snapshot.objects.find(t=>t.id===e);return!!r&&null==r.removingSince&&(this.activeGesture=null,this.setSnapshot({objects:this.snapshot.objects.map(r=>r.id===e?{...r,removingSince:t}:r),selectedObjectId:this.snapshot.selectedObjectId===e?null:this.snapshot.selectedObjectId}),this.removalTimers.set(e,setTimeout(()=>this.removeObject(e),270)),!0)}removeObject(e){var t;let r=this.snapshot.objects.find(t=>t.id===e),n=this.removalTimers.get(e);return void 0!==n&&(clearTimeout(n),this.removalTimers.delete(e)),!!r&&(this.activeGesture=null,null==(t=r.dispose)||t.call(r),this.setSnapshot({objects:this.snapshot.objects.filter(t=>t.id!==e),selectedObjectId:this.snapshot.selectedObjectId===e?null:this.snapshot.selectedObjectId}),!0)}removeSelectedObject(){return!!this.snapshot.selectedObjectId&&this.removeObject(this.snapshot.selectedObjectId)}releaseObject(e){this.snapshot.selectedObjectId===e&&(this.selectObject(null),this.reportGesture({kind:"release",objectId:e}))}reportGesture(e){this.gestureListeners.forEach(t=>t(e))}selectObject(e){(null===e||this.hasObject(e))&&this.snapshot.selectedObjectId!==e&&this.setSnapshot({...this.snapshot,selectedObjectId:e})}replaceObjectResource(e,t){let r=this.snapshot.objects.find(t=>t.id===e);return!!r&&r.resource!==t&&(this.setSnapshot({...this.snapshot,objects:this.snapshot.objects.map(r=>r.id===e?{...r,resource:t}:r)}),!0)}dispose(){this.removalTimers.forEach(e=>clearTimeout(e)),this.removalTimers.clear()}hasObject(e){return this.snapshot.objects.some(t=>t.id===e&&null==t.removingSince)}setSnapshot(e){this.snapshot=e,this.listeners.forEach(e=>e())}constructor(){(0,tO._)(this,"activeGesture",null),(0,tO._)(this,"gestureListeners",new Set),(0,tO._)(this,"listeners",new Set),(0,tO._)(this,"removalTimers",new Map),(0,tO._)(this,"snapshot",{objects:[],selectedObjectId:null}),(0,tO._)(this,"getSnapshot",()=>this.snapshot),(0,tO._)(this,"isGestureEnabled",()=>!0),(0,tO._)(this,"subscribe",e=>(this.listeners.add(e),()=>this.listeners.delete(e))),(0,tO._)(this,"subscribeGestures",e=>(this.gestureListeners.add(e),()=>this.gestureListeners.delete(e)))}}let nA={tracking:0,relocalizing:1,lost:2};function nO(e){return e.reduce((e,t)=>nA[t]>nA[e]?t:e,"tracking")}function nG(e){return nN()?(0,n.jsx)(nU,{...e}):(0,n.jsx)(nC,{children:(0,n.jsx)(nU,{...e})})}function nU(e){var t,r;let{catalog:i,catalogCategories:a,catalogFilters:s,catalogPagination:c,environmentUrl:u,initialResource:g,isLoadingCatalogCategories:b,object:x,owner:v,ownerAccount:w,resolveCatalogObjectVariant:j,scaleEnabled:y=!1,setCatalogFilters:N,showcaseHost:M}=e,{t:I}=(0,o.Bd)(),z=(0,C.Xf)(),L=(0,l.useRef)(!1),S=(0,l.useRef)("searching"),Z=(0,l.useRef)("tracking"),{overlayRoot:W,renderBridge:Y,runtime:k}=function(){let e=nN();if(!e)throw Error("An AR scene has to render inside an <ArSessionSurface>.");return e}(),T=`${g.id}:0`,D=function(e){let{initialObject:t,initialObjectId:r,initialResource:n}=e,i=(0,l.useRef)(null),a=(0,l.useRef)(1),[o]=(0,l.useState)(()=>{let e=new nX;return e.addObject(rK(n,r)),e}),s=(0,l.useSyncExternalStore)(o.subscribe,o.getSnapshot,o.getSnapshot);(0,l.useEffect)(()=>()=>o.dispose(),[o]);let c=(0,l.useMemo)(()=>nP(o,rU,i),[o]),u=(0,l.useMemo)(()=>nP(o,rE,i),[o]),d=(0,l.useMemo)(()=>nP(o,rF,i),[o]),h=(0,l.useRef)(null);h.current??(h.current=new Map(t?[[r,t]]:[]));let m=h.current,p=(0,l.useCallback)(e=>`${e}:${a.current++}`,[]);return(0,l.useMemo)(()=>({allManager:d,ceilingManager:u,createInstanceId:p,floorManager:c,gestureOwnerIdRef:i,manager:o,snapshot:s,sourceObjects:m}),[d,u,p,c,o,s,m])}({initialObject:x,initialObjectId:T,initialResource:g}),{createInstanceId:P,gestureOwnerIdRef:X,manager:A,snapshot:O,sourceObjects:G}=D,[U,H]=(0,l.useState)(!1),{learn:E,learnedLessons:F}=function(){let[e,t]=(0,l.useState)(()=>nT());return(0,l.useEffect)(()=>{!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nD();if(!t||0===e.length)return;let r=nT(t),n=e.filter(e=>!r.includes(e));if(0!==n.length)try{t.setItem(nk,JSON.stringify([...r,...n]))}catch{}}(e)},[e]),{learn:(0,l.useCallback)(e=>{e&&t(t=>t.includes(e)?t:[...t,e])},[]),learnedLessons:e}}(),[V,J]=(0,l.useState)(!1),[B,_]=(0,l.useState)(0),[Q,K]=(0,l.useState)(null),q=(0,l.useRef)(null),$=(0,l.useCallback)(e=>{q.current&&clearTimeout(q.current),K(e),q.current=setTimeout(()=>K(null),2500)},[]);(0,l.useEffect)(()=>()=>{q.current&&clearTimeout(q.current)},[]);let ee=(0,l.useRef)(null),[et,er]=(0,l.useState)(null),[en]=(0,l.useState)(()=>new tE),ei=function(){let e=(0,l.useRef)(new Map),[t,r]=(0,l.useState)("tracking"),[n,i]=(0,l.useState)({all:"tracking",ceiling:"tracking",floor:"tracking",wall:"tracking"}),a=(0,l.useCallback)((e,t)=>{i(r=>r[e]===t?r:{...r,[e]:t})},[]),o=(0,l.useCallback)((t,r)=>{e.current.set(t,r),a("wall",nO(Array.from(e.current.values())))},[a]),s=(0,l.useCallback)(t=>{e.current.delete(t),a("wall",nO(Array.from(e.current.values())))},[a]),c=(0,l.useCallback)(e=>a("all",e),[a]),u=(0,l.useCallback)(e=>a("ceiling",e),[a]),d=(0,l.useCallback)(e=>a("floor",e),[a]);return(0,l.useMemo)(()=>({forgetWall:s,setAll:c,setCeiling:u,setFloor:d,setSession:r,setWall:o,status:nO([t,...Object.values(n)])}),[s,n,t,c,u,d,o])}(),ea=k.sessionRef;!function(e){let{emitAnalytics:t,phaseRef:r,resource:n,runtime:i}=e,a=(0,l.useRef)({emitAnalytics:t,phaseRef:r,resource:n});(0,l.useLayoutEffect)(()=>{a.current={emitAnalytics:t,phaseRef:r,resource:n}});let o=(0,l.useRef)(0),s=(0,l.useRef)(!1),c=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(i.startAttempts<=o.current)return;o.current=i.startAttempts;let{emitAnalytics:e,phaseRef:t,resource:r}=a.current;e({name:"ar_session_start_clicked",object:tI(r),session:{phase:t.current}})},[i.startAttempts]),(0,l.useEffect)(()=>{if(!i.hasStarted||s.current)return;s.current=!0;let{emitAnalytics:e,phaseRef:t,resource:r}=a.current;e({name:"ar_session_started",object:tI(r),session:{phase:t.current}})},[i.hasStarted]),(0,l.useEffect)(()=>{if(!i.startFailure||c.current===i.startFailure)return;c.current=i.startFailure;let{emitAnalytics:e,phaseRef:t,resource:r}=a.current;e({error:tR(i.startFailure.error),name:"ar_session_failed",object:tI(r),session:{phase:t.current}})},[i.startFailure])}({emitAnalytics:z,phaseRef:S,resource:g,runtime:k}),(0,l.useEffect)(()=>()=>A.getSnapshot().objects.forEach(e=>{var t;return null==(t=e.dispose)?void 0:t.call(e)}),[A]);let el=function(e){let{createInstanceId:t,emitAnalytics:r,forgetWallTracking:n,initialPlacingObjectId:i,manager:a,phaseRef:o,resolveCatalogObjectVariant:s,sessionRef:c,sourceObjects:u}=e,h=(0,l.useRef)(null),m=(0,l.useRef)(null),p=(0,l.useRef)(null),f=(0,l.useRef)(!1),g=(0,l.useRef)(!1),[b,x]=(0,l.useState)(i),[v,w]=(0,l.useState)("searching"),[j,y]=(0,l.useState)(null),[N,M]=(0,l.useState)(null),[I,R]=(0,l.useState)(!1),[z,L]=(0,l.useState)(!1),S=(0,l.useCallback)(e=>{o.current=e,w(e)},[o]),Z=(0,l.useCallback)(e=>{g.current=e,L(e)},[]),W=(0,l.useCallback)(()=>a.getSnapshot().objects.find(e=>e.id===b)??null,[a,b]),Y=(0,l.useCallback)(()=>{x(null),M(null),f.current=!1,S("placed")},[S]),k=(0,l.useCallback)(()=>{let e=W();e&&r({name:"object_placed",object:tI(e.resource),session:{phase:"placed"}}),x(null),S("placed")},[r,W,S]),T=(0,l.useCallback)(async()=>{var e,t,n;let i=W(),l=c.current;if(!i||!l||g.current)return;if("wall"===i.mechanic){r({name:"object_place_clicked",object:tI(i.resource),session:{phase:o.current}}),null==(e=(t=i.runtime.confirmPlacementRef).current)||e.call(t);return}let s=function(e,t){switch(e.mechanic){case"floor":var r;return(null==(r=t.floor)?void 0:r.kind)==="floor"?t.floor:null;case"ceiling":return t.ceiling;case"all":return t.all}}(i,{all:p.current,ceiling:m.current,floor:h.current});if(s){R(!1),Z(!0),r({name:"object_place_clicked",object:tI(i.resource),session:{phase:o.current}});try{let e=await l.createAnchor(s),t=a.getSnapshot().objects.find(e=>e.id===i.id);if(!t||null!=t.removingSince)return void e.delete();null==(n=i.runtime.anchor)||n.delete(),i.runtime.anchor=e,i.runtime.lastAnchorPose=e.pose,"ceiling"===i.mechanic&&null===j&&y(i.runtime.targetTransform.suspensionHeight),i.runtime.lastInteractionRef.current=performance.now(),Y(),r({name:"object_placed",object:tI(i.resource),session:{phase:"placed"}})}catch(e){R(!0),r({error:tR(e),name:"object_place_failed",object:tI(i.resource),session:{phase:o.current}})}finally{Z(!1)}}},[j,r,W,a,o,c,Y,Z]),D=(0,l.useCallback)(()=>{var e;let t=W();if((null==t?void 0:t.mechanic)!=="ceiling")return;let r=m.current;if(!r||"floor"!==r.kind)return;let n=(e=t.runtime.targetTransform.suspensionHeight,eO(j??e));t.runtime.targetTransform=eG(r,n),t.runtime.currentTransform={...t.runtime.targetTransform,position:{...t.runtime.targetTransform.position}},t.runtime.rise=eU(performance.now());let i=null===j?"calibrating":"preview";M(eH(t.runtime.targetTransform,tu(t),"calibrating"===i)),S(i)},[j,W,S]),P=(0,l.useCallback)(async(e,n)=>{if(b)return!1;let i=await s(e,n),l=d(i,n);if(!l)return r({name:"object_unavailable",object:(0,C.ZY)(i,n)}),!1;let o=t(l.id);return u.set(o,i),a.selectObject(null),a.addObject(rK(l,o)),x(o),M(null),f.current=!1,h.current=null,m.current=null,p.current=null,S("searching"),Z(!1),r({name:"object_ready",object:(0,C.ZY)(i,n)}),!0},[t,r,a,b,s,u,S,Z]),X=(0,l.useCallback)(e=>{let t=a.getSnapshot(),n=t.objects.find(e=>e.id===(b??t.selectedObjectId));if(!n)return!1;let i=n.resource.variants.find(t=>t.hid===e);return!!i&&i.hid!==n.resource.variantId&&(a.replaceObjectResource(n.id,{...n.resource,glbUrl:i.glbUrl,variantId:i.hid}),r({name:"object_variant_changed",object:{...tI(n.resource),variantId:i.hid},session:{phase:o.current}}),!0)},[r,a,o,b]),A=(0,l.useCallback)(()=>{let e=a.getSnapshot(),t=e.objects.find(e=>e.id===b)??null,i=t??e.objects.find(t=>t.id===e.selectedObjectId)??null;i&&(r({name:"object_removed",object:tI(i.resource),session:{phase:t?o.current:"selected"}}),"wall"===i.mechanic&&n(i.id),a.beginObjectRemoval(i.id,performance.now()),u.delete(i.id),t&&(x(null),S("placed")),M(null),f.current=!1)},[r,n,a,o,b,u,S]);return(0,l.useMemo)(()=>({addCatalogObject:P,allHitRef:p,ceilingHitRef:m,floorHitRef:h,handleWallPlaced:k,heightLabel:N,heightModeRef:f,phase:v,place:T,placementError:I,placementPending:z,placingObjectId:b,removeActiveObject:A,selectCeilingFloorPoint:D,setHeightLabel:M,setPlacementError:R,setPlacementPending:Z,switchVariant:X,updatePhase:S}),[P,k,N,v,T,I,z,b,A,D,X,S,Z])}({createInstanceId:P,emitAnalytics:z,forgetWallTracking:ei.forgetWall,initialPlacingObjectId:(null==(t=O.objects[0])?void 0:t.id)??null,manager:A,phaseRef:S,resolveCatalogObjectVariant:j,sessionRef:ea,sourceObjects:G}),{addCatalogObject:eo,heightLabel:es,phase:ec,place:eu,placementError:ed,placementPending:eh,placingObjectId:em,removeActiveObject:ep,selectCeilingFloorPoint:ef,setHeightLabel:eg,switchVariant:ev}=el,ew=function(e,t){let[r,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(!t||!e)return;let r=!0,i=null;return new nY.Y().loadAsync(e).then(e=>{r?(e.mapping=303,i=e,n(e)):e.dispose()}).catch(()=>{}),()=>{r=!1,n(null),null==i||i.dispose()}},[t,e]),r}(u??null,k.isStarting||k.hasStarted),ey=(0,l.useMemo)(()=>{if(!Y)return;let e=Y.camera;return e.manual=!0,e},[Y]),eN=ei.status,{activeCeilingObject:eM,activeMechanic:eC,activeObject:eI,activeSourceObject:eR,ceilingHeightScaleValue:ez,ceilingScaleCalibrating:eL,currentVariant:eZ,displayPhase:eW,hintKey:eY,placingObject:ek,primaryAction:eT,productCardObject:eD,selectedObject:eP,showCeilingScale:eX,showConfirm:eF,showObjectBar:eV,trackingLossStatus:eJ}=function(e){var t,r,n,i;let a,l,{initialObjectId:o,initialResource:s,phase:c,placingObjectId:u,productCardObjectId:d,snapshot:h,sourceObjects:m,trackingStatus:p}=e,f=h.objects.find(e=>e.id===u)??null,g=h.objects.find(e=>e.id===h.selectedObjectId)??null,b=f??g,x=(t=h.objects,r=h.selectedObjectId,n=s.mechanic,(null==(l=(a=u??r)?t.find(e=>e.id===a):t.at(-1))?void 0:l.mechanic)??n),v=f?c:g?"selected":"placed",w=(i=(null==f?void 0:f.mechanic)??null,i?"ceiling"===i&&"floor-ready"===c?"set-floor":"ceiling"===i&&"calibrating"===c?"set-height":"preview"===c?"done":null:null),j="searching"===v,y="tracking"===p||j?`${x}.${"placed"===v?"select":"selected"===v?"gestures":"floor-ready"===v?"floorReady":v}`:`${x}.relocalizing`,N=(null==b?void 0:b.resource.variants)??[],M=Math.max(0,N.findIndex(e=>e.hid===(null==b?void 0:b.resource.variantId))),C=b?m.get(b.id)??null:null,I=(null==b?void 0:b.id)===o,R="done"===w||"set-height"===w,z=!!b&&(!f||R),L=!!f&&I&&R,S=(null==b?void 0:b.mechanic)==="ceiling"?b:null,Z=!!(f&&(null==S?void 0:S.id)===f.id&&"calibrating"===c);return{activeCeilingObject:S,activeMechanic:x,activeObject:b,activeSourceObject:C,ceilingHeightScaleValue:S?eH(S.runtime.targetTransform,tu(S),Z):null,ceilingScaleCalibrating:Z,currentVariant:N[M]??null,displayPhase:v,hintKey:y,nextVariant:N.length>1?N[(M+1)%N.length]??null:null,placingObject:f,primaryAction:w,productCardObject:b&&d===b.id?C:null,selectedObject:g,showCeilingScale:function(e){let{isPlacingCeiling:t,isSelectedCeiling:r,phase:n}=e;return t&&("calibrating"===n||"preview"===n)||!t&&r}({isPlacingCeiling:(null==f?void 0:f.mechanic)==="ceiling",isSelectedCeiling:!!(!f&&(null==g?void 0:g.mechanic)==="ceiling"),phase:v}),showConfirm:z,showObjectBar:z&&!L,trackingLossStatus:j?"tracking":p}}({initialObjectId:T,initialResource:g,phase:ec,placingObjectId:em,productCardObjectId:et,snapshot:O,sourceObjects:G,trackingStatus:eN}),eB=em??O.selectedObjectId;rV(O.objects,X,eB),(0,l.useEffect)(()=>{var e,t;null==(t=ea.current)||null==(e=t.setMechanic)||e.call(t,eC)},[eC,k.hasStarted,ea]);let e_=function(e){var t;let r,{hintKey:n,learnedLessons:i,roomEmpty:a,rising:l=!1}=e,o=function(e,t){let r=tp(e);if("select"===r){let r=tf(e),n=tv.find(e=>{let n=ty(`${r}.${e}`);return null!==n&&!t.includes(n)});return`${r}.${n??"catalog"}`}if("gestures"!==r)return e;let n=tf(e),i=tx.find(e=>{let r=ty(`${n}.${e}`);return null!==r&&!t.includes(r)});return`${n}.${i??"finish"}`}(n,i),s=!a&&function(e){let{hintKey:t,learnedLessons:r}=e,n=ty(t);return null===n||!r.includes(n)}({hintKey:o,learnedLessons:i}),c=s&&!l;return{callsOutCatalog:s&&"catalog"===tp(o),illustration:c?(r=tp(o),(null==(t=tN[tf(o)])?void 0:t[r])??tj[r]??null):null,key:o,shown:c}}({hintKey:eY,learnedLessons:F,roomEmpty:0===O.objects.length}),eQ=e_.shown?I(e_.key):null,eK=eY.endsWith(".searching");(0,l.useEffect)(()=>A.subscribeGestures(e=>{var t;let{kind:r,objectId:n}=e,i=A.getSnapshot().objects.find(e=>e.id===n);i&&E((t=i.mechanic,ty(`${t}.${tM[r]}`)))}),[E,A]);let eq=(null==eP?void 0:eP.mechanic)??null;(0,l.useEffect)(()=>{eq&&E(ty(`${eq}.select`))},[E,eq]);let e$=()=>(0,C.ZY)(eR,null==eI?void 0:eI.resource.variantId,null==eI?void 0:eI.mechanic),e0=(0,l.useCallback)(e=>{if(eM){var t,r;let n;eM.runtime.targetTransform=(t=eM.runtime.targetTransform,r=tu(eM),n=eO(eL?e:e+r*t.scale),{...t,position:{...t.position,y:t.floorY+n},suspensionHeight:n}),eM.runtime.lastInteractionRef.current=performance.now(),eM.runtime.draggedAtRef.current=performance.now(),eg(eH(eM.runtime.targetTransform,tu(eM),eL))}},[eM,eL,eg]);(0,l.useLayoutEffect)(()=>{let e=ee.current;if(!e)return;let t=()=>_(Math.round(e.getBoundingClientRect().height));if(t(),"u"<typeof ResizeObserver)return;let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[]);let e1=(0,l.useMemo)(()=>({"--ar-session-hint-bottom":B>0?`calc(${tZ} + ${B}px + 0.375rem)`:tZ,bottom:"var(--ar-session-hint-bottom)"}),[B]);return(0,l.useEffect)(()=>{if(Z.current===eN)return;Z.current=eN;let e=ek??eP;z({name:"tracking_status_changed",object:e?tI(e.resource):tI(g),session:{phase:eW,trackingStatus:eN}})},[eW,z,g,ek,eP,eN]),(0,n.jsxs)("div",{className:"absolute inset-0 z-[1] overflow-hidden","data-testid":"ar-session-scene",children:[(0,n.jsxs)(h.Hl,{className:"relative z-[1] touch-none",camera:ey??{far:100,near:.01},frameloop:Y?"never":"always",gl:{alpha:!0,antialias:!0},scene:Y?Y.sceneRoot:void 0,onCreated:e=>{let{gl:t}=e;return k.setRenderer(t)},children:[Y?(0,n.jsx)(tm,{bridge:Y}):null,(0,n.jsx)(tC,{texture:ew}),ew?null:(0,n.jsx)("ambientLight",{intensity:1.2}),(0,n.jsx)(tV,{cache:en,children:(0,n.jsx)(rc,{renderer:(null==Y?void 0:Y.renderer)??null,children:(0,n.jsx)(nd,{objects:D,phaseRef:S,placement:el,scaleEnabled:y,sessionHasTrackingRef:L,sessionRef:ea,tracking:ei})})})]},Y?"engine":"host"),eX&&null!==ez?(0,n.jsx)(nW,{formatHeight:e=>I("ceiling.heightValue",{height:e.toFixed(1)}),ariaLabel:I("ceiling.heightMode"),height:ez,onHeightChange:e0}):null,(0,n.jsx)(eE,{active:eK||!!(eQ||Q)}),eK?(0,n.jsx)(eS,{mechanic:eC,positionStyle:e1}):(0,n.jsx)(t_,{illustration:e_.illustration,loadingTitle:I(`${eC}.found`),modelCache:en,pendingModelUrl:(null==eI?void 0:eI.resource.glbUrl)??null,notice:Q,positionStyle:e1,text:eQ}),(0,n.jsx)(eA,{status:eJ}),(0,n.jsx)(nR,{asCancel:!!ek,show:eV&&!!eI,onDelete:ep}),(0,n.jsx)(tX,{onSelectVariant:ev,calledOutCatalog:e_.callsOutCatalog,confirmDisabled:eh||"set-height"===eT&&null===es,confirmLabel:I(`${eC}.${ek?"place":"done"}`),controlsRef:ee,currentVariantId:(null==eZ?void 0:eZ.hid)??null,productName:eV&&!ek&&eR?(null==(r=eR.name)?void 0:r.trim())||I("catalog.unnamedProduct"):null,showAddObjectButton:0===O.objects.length,showCatalogButton:!eI&&O.objects.length>0,showConfirmButton:eF&&!!ek,showSetFloorButton:"set-floor"===eT,showShareButton:eV&&!ek&&!!eR,variants:(null==eI?void 0:eI.resource.variants)??[],onConfirm:()=>ek?void eu():A.selectObject(null),onOpenCatalog:()=>{H(!0),E(ty(`${eC}.catalog`))},onOpenProduct:()=>{er((null==eI?void 0:eI.id)??null),z({name:"catalog_product_opened",object:e$()})},onOpenVariants:()=>J(!0),onSetFloorPoint:ef,onShare:()=>{var e;let t=(0,R.R)(M,null==eR?void 0:eR.tinuuid);eR&&t&&eb({title:(null==(e=eR.name)?void 0:e.trim())||I("catalog.unnamedProduct"),url:t}).then(e=>"copied"===e&&$(I("linkCopied")))}}),(0,n.jsx)(p.HM,{asChild:!0,children:(0,n.jsx)(m.$,{className:"absolute top-6 right-6 z-10 bg-black/50 text-white hover:bg-black/60 active:bg-black/70",style:{top:"max(1.5rem, env(safe-area-inset-top))"},size:"icon","aria-label":I("close"),children:(0,n.jsx)(f.A,{"aria-hidden":"true"})})}),ed?(0,n.jsx)("p",{className:"absolute inset-x-6 bottom-24 z-10 rounded-xl bg-black/70 p-4 text-center text-sm text-white",role:"alert",children:I(`${eC}.anchorError`)}):null,(0,n.jsx)(ex,{object:eD,portalContainer:W,showcaseHost:M,testId:"ar-session-product-card",onOpenChange:e=>!e&&er(null),onShared:e=>"copied"===e&&$(I("linkCopied")),onViewOnSite:()=>z({name:"catalog_product_view_on_site_clicked",object:e$()})}),(0,n.jsx)(nS,{currentVariantId:null==eI?void 0:eI.resource.variantId,open:V,portalContainer:W,variants:(null==eI?void 0:eI.resource.variants)??[],onOpenChange:J,onSelect:e=>ev(e)&&J(!1)}),(0,n.jsx)(ej,{catalog:i,categories:a,filters:s,isLoadingCategories:b,owner:v,ownerAccount:w,pagination:c,showcaseHost:M,setFilters:N,onOpenChange:H,onPlace:eo,open:U,portalContainer:W})]})}function nH(e){let{children:t}=e,{t:r}=(0,o.Bd)();return(0,n.jsxs)("div",{className:"relative flex size-full flex-col items-center justify-center gap-4 overflow-auto bg-radial from-background-containers to-background-base-2 p-4 text-foreground","data-neurodyn-ar-mount":"",children:[(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("h1",{className:"typo-base-18 font-medium",children:r("android.title")}),(0,n.jsx)("p",{className:"mt-1 typo-base-14 text-text-light",children:r("android.description")})]}),t]})}function nE(e){let{variant:t,showDialogCloseButton:r=!1}=e,{t:i}=(0,o.Bd)();return(0,n.jsxs)("div",{className:"relative z-30 flex size-full flex-col items-center justify-center gap-4 bg-radial from-background-containers to-background-base-2 p-4 text-center",children:[(0,n.jsx)(T,{className:"size-8 text-icons-light"}),(0,n.jsx)("h2",{className:"typo-base-16 font-medium text-text-dark",children:i(`accessError.${t}`)}),r&&(0,n.jsx)(p.HM,{asChild:!0,children:(0,n.jsx)(m.$,{variant:"secondary",children:i("close")})})]})}var nF=r(4956),nV=r(9055),nJ=r(2966),nB=r(6198),n_=r(575);async function nQ(e,t){let{uuid:r,username:n}=e,i=null==r?void 0:r.trim(),a=null==n?void 0:n.trim().toLowerCase();if(!i&&!a)throw Error("fetchPublicAccount: uuid or username is required");let l=await (0,n_.DFU)(i?{userId:i}:{username:a},t);if(!(null==l?void 0:l.id))throw Error(`Account ${i??n} not found`);return{uuid:l.id,username:l.username,name:l.name??"",type:l.type,useObjTags:l.useObjTags,privacy:"public",...l.avatarUrl?{avatar:{uuid:l.avatarFileId??void 0,url:l.avatarUrl}}:{},...l.backgroundUrl?{background:{uuid:l.backgroundFileId??void 0,url:l.backgroundUrl}}:{}}}let nK="core-ar";function nq(e){let t="string"==typeof e&&e.trim()?Number(e):e;return"number"==typeof t&&Number.isFinite(t)?t:void 0}function n$(e){return{baseURL:e.baseURL,headers:(0,c.s2)(e.brand),signal:e.signal}}async function n0(e,t){var r,n,i,a;try{return await t({baseURL:e.baseURL,headers:{...(0,c.s2)(e.brand),"x-api-key":e.apiKey},signal:e.signal})}catch(u){let l=(0,s.Es)(u);if(401!==l&&403!==l||(null==(r=e.signal)?void 0:r.aborted))throw u;let o=null==(n=await (null==(i=e.getWidgetSessionToken)?void 0:i.call(e)))?void 0:n.trim();if(!o||(null==(a=e.signal)?void 0:a.aborted))throw u;return await t({baseURL:e.baseURL,headers:{...(0,c.s2)(e.brand),[c.qw]:o},signal:e.signal})}}async function n1(e,t){return t.apiKey?await n0(t,r=>(0,n_.ytc)({tinuuid:e},{productType:nK,variantId:t.variantId},r)):await (0,n_.Ago)({tinuuid:e},n$(t))}async function n2(e,t,r){var n,i;let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=(0,R.J)(a.search),o=nq(null==(n=a.category)?void 0:n.id),s=null==(i=a.category)?void 0:i.kind,c={owners:[e],page:t,...l?{search:l}:{},..."category"===s&&void 0!==o?{catId:o}:{},..."tag"===s&&void 0!==o?{tagId:o}:{}};return r.apiKey?await n0(r,e=>(0,n_.avi)(c,{productType:nK},e)):await (0,n_.qgy)(c,n$(r))}async function n4(e,t){return nQ({uuid:e},n$(t))}function n3(e){let t=nq(e.id),r=(0,R.J)(e.name);return void 0!==t&&r&&e.hasObjs?{id:t,kind:"category",name:r}:null}function n5(e){let t=nq(e.id),r=(0,R.J)(e.name);return void 0!==t&&r?{id:t,kind:"tag",name:r}:null}function n9(e,t){return e.id===t.id?0:90===e.id?1:90===t.id?-1:0}async function n7(e,t){return t.apiKey?await n0(t,n_.c03):await (0,n_._8U)({ownerUuid:e},n$(t))}async function n6(e,t){return t.apiKey?await n0(t,n_.T07):await (0,n_.adr)({ownerUuid:e},n$(t))}async function n8(e,t,r){return"custom"===t?((await n7(e,r)).tags??[]).map(n5).filter(e=>!!e).sort(n9):((await n6(e,r)).cats??[]).map(n3).filter(e=>!!e).sort(n9)}let ie="https://cdn.neurodyn.ai/hdr/modern_bathroom_1k.hdr";function it(e){return"string"==typeof e&&/^https?:\/\//i.test(e)}async function ir(e){try{let t=await (0,n_.b6)(void 0,{baseURL:e.baseURL,headers:(0,c.s2)(e.brand),signal:e.signal});return function(e){var t,r,n;if(!e)return null;if(it(e.hdr_neutral))return e.hdr_neutral;let i=null==(t=e.internal)?void 0:t.hdr_neutral;if(it(i))return i;let a=null==(n=e.internal)||null==(r=n.links)?void 0:r.find(e=>"hdr_neutral"===e.type&&it(e.url));return(null==a?void 0:a.url)??null}(t)??ie}catch{return ie}}let ii={category:null,search:""},ia=[],il=(0,l.createContext)(null);function io(e){var t,r,i;let{apiKey:a,children:o,hid:d,initialWidgetSessionToken:h,tenant:m,tinuuid:p}=e,f=(null==a?void 0:a.trim())||void 0,g=(null==d?void 0:d.trim())||void 0,b=(null==p?void 0:p.trim())??"",x=(null==h?void 0:h.trim())||void 0,v=(0,l.useRef)(null),w=(0,l.useCallback)(async()=>{let e=v.current;return e?await e.getTokenForRequest().catch(()=>e.token):x},[x]),j=x?w:void 0,y={apiKey:f,baseURL:m.apiOrigin,brand:m.brand,getWidgetSessionToken:j},N=!!b,M=(0,nV.I)({queryKey:["ar","object",{apiKey:(t={...y,variantId:g}).apiKey??null,baseURL:t.baseURL,brand:t.brand??null,tinuuid:b,variantId:t.variantId??null}],enabled:N,queryFn:e=>{let{signal:t}=e;return n1(b,{...y,signal:t,variantId:g})}}),C=(0,nV.I)({queryKey:["ar","scene-environment",{baseURL:y.baseURL,brand:y.brand??null}],queryFn:e=>{let{signal:t}=e;return ir({...y,signal:t})},retry:!1,staleTime:1/0}),I=(0,nV.I)({queryKey:["ar","widget-session",{apiKey:f??null,handoffTokenDigest:(0,c.a4)(h),baseURL:m.apiOrigin,brand:m.brand}],enabled:!!f,gcTime:0,refetchOnMount:"always",queryFn:e=>{let{signal:t}=e;if(!f)throw Error("API key is required to activate a widget session.");return(0,c.Uu)({apiBaseUrl:m.apiOrigin,apiKey:f,brand:m.brand,initialWidgetSessionToken:h,signal:t})}});(0,l.useEffect)(()=>{v.current=I.data??null},[I.data]);let z=M.data??null,L=(null==z?void 0:z.owner)??null,S=null==L?void 0:L.uuid,[Z,W]=(0,l.useState)({filters:ii}),Y=Z.ownerUuid===S?Z.filters:ii,k=(0,l.useCallback)(e=>{W(t=>{var r;return{filters:(r=t.ownerUuid===S?t.filters:ii,"function"==typeof e?e(r):e),ownerUuid:S}})},[S]),T=(0,nV.I)({queryKey:["ar","owner-account",{baseURL:y.baseURL,brand:y.brand??null,ownerUuid:S??null}],enabled:!!S,queryFn:e=>{let{signal:t}=e;if(!S)throw Error("Owner uuid is required.");return n4(S,{...y,signal:t})}}),D=T.data??null,P=(null==D?void 0:D.useObjTags)===!0?"custom":"standard",X=(0,nV.I)({queryKey:["ar","owner-categories",{apiKey:y.apiKey??null,categoryMode:P,baseURL:y.baseURL,brand:y.brand??null,ownerUuid:S??null}],enabled:!!(S&&D),queryFn:e=>{let{signal:t}=e;if(!S)throw Error("Owner uuid is required.");return n8(S,P,{...y,signal:t})}}),A=X.data??ia,O=!!(S&&(!D||T.isLoading||T.isError||X.isLoading||X.isError)),U=(0,l.useMemo)(()=>{let e,t=(e=Y.search.trim(),{category:Y.category,search:e}),r=t.category;return!r||O||A.some(e=>e.id===r.id&&e.kind===r.kind)?t:{...t,category:null}},[A,Y,O]),H=function(e,t){let[r,n]=(0,l.useState)(e);return(0,l.useEffect)(()=>{if(r===e)return;let t=window.setTimeout(()=>n(e),400);return()=>window.clearTimeout(t)},[400,r,e]),r}(U.search,0),E=(0,l.useMemo)(()=>({category:U.category,search:H}),[H,U.category]),{data:F,error:V,fetchNextPage:J,hasNextPage:B,isFetchingNextPage:_}=(0,nJ.q)({queryKey:["ar","owner-objects",{apiKey:y.apiKey??null,categoryId:(null==(r=E.category)?void 0:r.id)??null,categoryKind:(null==(i=E.category)?void 0:i.kind)??null,baseURL:y.baseURL,brand:y.brand??null,ownerUuid:S??null,search:(0,R.J)(E.search)??null}],enabled:!!S,queryFn:e=>{let{pageParam:t,signal:r}=e;if(!S)throw Error("Owner uuid is required.");return n2(S,t,{...y,signal:r},E)},initialPageParam:1,getNextPageParam:(e,t,r)=>{var n;return void 0!==e.pages_count?r<e.pages_count?r+1:void 0:(null==(n=e.objs)?void 0:n.length)?r+1:void 0},placeholderData:nB.rX}),Q=(0,l.useMemo)(()=>(function(e,t){if(!e)return t;let r=G(e);return[e,...t.filter(e=>!r||G(e)!==r)]})(z,(null==F?void 0:F.pages.flatMap(e=>e.objs??[]))??[]),[null==F?void 0:F.pages,z]),K=(0,l.useCallback)(async(e,t)=>{var r;let n=null==(r=e.tinuuid)?void 0:r.trim();return n?n1(n,{apiKey:f,baseURL:m.apiOrigin,brand:m.brand,getWidgetSessionToken:j,variantId:t}):e},[j,f,m.apiOrigin,m.brand]),q=null;b?M.error?q=(0,s.QG)(M.error,"object"):z&&!S?q="owner-missing":V&&(q=(0,s.QG)(V,"catalog")):q="missing-tinuuid";let $=N&&M.isLoading,ee=q?"error":$||!z?"loading":"ready",et=(0,l.useMemo)(()=>({catalog:Q,catalogCategories:A,catalogFilters:U,environmentUrl:C.data??null,error:q,fetchNextPage:async()=>{await J()},hasNextPage:!!B,isFetchingNextPage:_,isLoadingCatalogCategories:O,metadata:z?(0,u.sq)(z):null,object:z,owner:L,ownerAccount:D,resolveCatalogObjectVariant:K,setCatalogFilters:k,showcaseHost:m.showcaseHost,status:ee,variant:z?(0,u.uW)(z,g):null,widgetSession:I.data??null}),[Q,A,C.data,q,J,B,_,O,U,g,z,L,D,K,k,ee,m.showcaseHost,I.data]);return(0,n.jsx)(il,{value:et,children:o})}function is(){let e=(0,l.use)(il);if(!e)throw Error("useArData must be used inside ArDataProvider");return e}function ic(e){let{label:t,value:r}=e;return(0,n.jsxs)("div",{className:"grid grid-cols-[7rem_minmax(0,1fr)] gap-3 border-b border-border py-2 last:border-0",children:[(0,n.jsx)("dt",{className:"text-text-light",children:t}),(0,n.jsx)("dd",{className:"min-w-0 break-words font-mono",children:r??"—"})]})}function iu(e){var t,r,i,a,l,s,c,u;let{showDialogCloseButton:d=!1,value:h}=e,{t:g}=(0,o.Bd)(),b=null==(t=h.metadata)?void 0:t.dimensions;return(0,n.jsxs)("section",{className:"w-full max-w-2xl overflow-auto rounded-xl border border-border bg-background-containers p-5 shadow-lg",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("h1",{className:"typo-base-18 font-medium",children:g("data.title")}),d&&(0,n.jsx)(p.HM,{asChild:!0,children:(0,n.jsx)(m.$,{size:"icon",variant:"secondary","aria-label":g("close"),children:(0,n.jsx)(f.A,{"aria-hidden":"true"})})})]}),(0,n.jsxs)("dl",{className:"mt-3 typo-base-14",children:[(0,n.jsx)(ic,{label:g("data.object"),value:`${(null==(r=h.object)?void 0:r.name)??"—"} (${(null==(i=h.object)?void 0:i.tinuuid)??"—"})`}),(0,n.jsx)(ic,{label:g("data.variant"),value:`${(null==(a=h.variant)?void 0:a.name)??"—"} (${(null==(l=h.variant)?void 0:l.hid)??"—"})`}),(0,n.jsx)(ic,{label:g("data.owner"),value:`${(null==(s=h.owner)?void 0:s.name)??"—"} (${(null==(c=h.owner)?void 0:c.uuid)??"—"})`}),(0,n.jsx)(ic,{label:g("data.mechanic"),value:null==(u=h.metadata)?void 0:u.mechanic}),(0,n.jsx)(ic,{label:g("data.dimensions"),value:b?`${b.width} \xd7 ${b.height} \xd7 ${b.depth} ${b.unit}`:"—"})]}),(0,n.jsxs)("div",{className:"mt-5 flex items-center justify-between gap-3",children:[(0,n.jsxs)("h2",{className:"typo-base-16 font-medium",children:[g("data.catalog"),(0,n.jsxs)("span",{children:[" ","(",h.catalog.length,")"]})]}),h.hasNextPage&&(0,n.jsx)(m.$,{type:"button",variant:"secondary",disabled:h.isFetchingNextPage,onClick:()=>void h.fetchNextPage(),children:h.isFetchingNextPage?g("data.loading"):g("data.loadNextPage")})]}),(0,n.jsx)("ul",{className:"mt-2 grid gap-2",children:h.catalog.map((e,t)=>(0,n.jsx)("li",{className:"rounded-md border border-border px-3 py-2 typo-base-14",children:e.name??e.tinuuid??e.uuid??g("data.unnamedObject")},e.uuid??e.tinuuid??t))})]})}let id=new Set(["catalog_category_selected","catalog_opened","catalog_product_opened","catalog_product_place_clicked","catalog_product_view_on_site_clicked","catalog_show_all_clicked","object_placed","object_removed","object_variant_changed"]),ih=new i.E({defaultOptions:{queries:{gcTime:3e5,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1,retry:(e,t)=>{let r=(0,s.Es)(t);return("number"!=typeof r||!(r>=400)||!(r<500))&&e<2}}}});function im(e){let{apiBaseUrl:t,apiKey:r,hid:i,initialWidgetSessionToken:s,language:c,onAnalyticsEvent:u,scaleEnabled:d=!1,tinuuid:h}=e,{i18n:m}=(0,o.Bd)(),p=function(){let{i18n:e}=(0,o.Bd)(),t=e.resolvedLanguage??e.language;return(0,nF.hs)(t)}(),f=(0,nF._K)(c?(0,nF.hs)(c):p),g=(0,nF.BC)(t),b=g?{...f,apiOrigin:g}:f;return(0,l.useEffect)(()=>{c&&m.language!==c&&m.changeLanguage(c)},[m,c]),(0,n.jsx)(a.Ht,{client:ih,children:(0,n.jsx)(io,{apiKey:r,hid:i,initialWidgetSessionToken:s,tenant:b,tinuuid:h,children:(0,n.jsx)(ip,{onAnalyticsEvent:u,children:(0,n.jsx)(ig,{scaleEnabled:d})})})})}function ip(e){var t,r,i;let{children:a,onAnalyticsEvent:o}=e,s=is(),u=(0,l.useRef)([]),h=(0,l.useRef)(null),m=(0,l.useRef)(null),p=(0,l.useCallback)(()=>{var e,t;return(0,C.ZY)(s.object,null==(e=s.variant)?void 0:e.hid,null==(t=s.metadata)?void 0:t.mechanic)},[null==(t=s.metadata)?void 0:t.mechanic,s.object,null==(r=s.variant)?void 0:r.hid]),f=(0,l.useCallback)((e,t)=>{let r=s.widgetSession;if(!r)return!1;if("widget_opened"===e){if(r.continued||m.current===r.sid)return!0;m.current=r.sid}if("ar_launched"===e){if(h.current===r.sid)return!0;h.current=r.sid}return(0,c.Kq)(r,e,{objectId:t.objectId,variantId:t.variantId}),!0},[s.widgetSession]),g=(0,l.useCallback)(e=>{(0,C.lA)(o,e);let t="ar_session_started"===e.name?"ar_launched":id.has(e.name)?"interacted":null;if(!t)return;let r=e.object??p();!f(t,r)&&u.current.length<10&&u.current.push({event:t,object:r})},[p,o,f]);return(0,l.useEffect)(()=>{var e;if(("ready"===s.status&&s.object?d(s.object,null==(e=s.variant)?void 0:e.hid):null)&&f("widget_opened",p()),!u.current.length)return;let t=u.current;u.current=t.filter(e=>!f(e.event,e.object))},[s.object,s.status,null==(i=s.variant)?void 0:i.hid,p,f]),(0,n.jsx)(C.Nz,{onEvent:g,children:a})}function ig(e){var t,r,i;let{scaleEnabled:a}=e,o=is(),c=(0,C.Xf)(),u=(0,l.useRef)(null),h=(0,l.useMemo)(()=>{var e;return"ready"===o.status&&o.object?d(o.object,null==(e=o.variant)?void 0:e.hid):null},[o.object,o.status,null==(t=o.variant)?void 0:t.hid]);if((0,l.useEffect)(()=>{if(!o.error)return;let e=`error:${o.error}`;u.current!==e&&(u.current=e,c({error:{code:o.error},name:"object_load_failed"}))},[o.error,c]),(0,l.useEffect)(()=>{var e,t,r,n,i;if("ready"!==o.status){"loading"===o.status&&(u.current=null);return}let a=h?`ready:${h.id}:${h.glbUrl}:${h.mechanic}:${(null==(e=o.variant)?void 0:e.hid)??""}`:`unavailable:${(null==(t=o.object)?void 0:t.uuid)??""}:${(null==(r=o.variant)?void 0:r.hid)??""}`;u.current!==a&&(u.current=a,c({name:h?"object_ready":"object_unavailable",object:(0,C.ZY)(o.object,null==(n=o.variant)?void 0:n.hid,null==(i=o.metadata)?void 0:i.mechanic)}))},[null==(r=o.metadata)?void 0:r.mechanic,o.object,o.status,null==(i=o.variant)?void 0:i.hid,c,h]),o.error)return(0,n.jsx)(nE,{variant:(0,s.wT)(o.error),showDialogCloseButton:!0});if("ready"===o.status&&!h)return(0,n.jsx)(nE,{variant:"unavailable",showDialogCloseButton:!0});if("ready"===o.status&&(0,rn.R5)())return(0,n.jsx)(iu,{showDialogCloseButton:!0,value:o});let m="loading"===o.status;return(0,n.jsx)(nH,{children:(0,n.jsx)(nC,{waiting:m,children:h?(0,n.jsx)(ib,{data:o,initialResource:h,scaleEnabled:a}):null})})}function ib(e){let{data:t,initialResource:r,scaleEnabled:i}=e;return(0,n.jsx)(nG,{catalog:t.catalog,catalogPagination:{fetchNextPage:t.fetchNextPage,hasNextPage:t.hasNextPage,isFetchingNextPage:t.isFetchingNextPage},catalogCategories:t.catalogCategories,catalogFilters:t.catalogFilters,environmentUrl:t.environmentUrl,initialResource:r,isLoadingCatalogCategories:t.isLoadingCatalogCategories,object:t.object,owner:t.owner,ownerAccount:t.ownerAccount,resolveCatalogObjectVariant:t.resolveCatalogObjectVariant,scaleEnabled:i,setCatalogFilters:t.setCatalogFilters,showcaseHost:t.showcaseHost},`${r.id}:${r.glbUrl}`)}}}]);
|