(self.webpackChunkalvanon_analytics_platform_frontend=self.webpackChunkalvanon_analytics_platform_frontend||[]).push([[8792],{4890(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},9819(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e58978%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},11455(e){"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M10 17l5-5-5-5v10z%27/%3E%3Cpath fill=%27none%27 d=%27M0 24V0h24v24H0z%27/%3E%3C/svg%3E"},13363(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},13490(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},13913(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},18420(e){"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M14 7l-5 5 5 5V7z%27/%3E%3Cpath fill=%27none%27 d=%27M24 0v24H0V0h24z%27/%3E%3C/svg%3E"},24420(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},25446(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%23333%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},26117(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},28869(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e54e33%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3C/svg%3E"},30557(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},37311(e){"use strict";e.exports="data:image/svg+xml,%0A%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 viewBox=%270 0 24 24%27%3E%3Cpath fill=%27none%27 d=%27M0 0h24v24H0V0z%27/%3E%3Cpath d=%27M7 14l5-5 5 5H7z%27 fill=%27gray%27/%3E%3C/svg%3E"},38328(e,t,n){"use strict";n.d(t,{A:()=>o});var a=n(31601),i=n.n(a),l=n(76314),r=n.n(l)()(i());r.push([e.id,".login-container{height:100vh;width:100vw;display:flex;justify-content:center;align-items:center;flex-direction:column}.login-container .user-input{margin:10px}.login-container img{width:300px}.login-container form{display:flex;flex-direction:column}",""]);const o=r},41795(e){"use strict";e.exports="data:image/svg+xml,%0A%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 viewBox=%270 0 24 24%27%3E%3Cpath fill=%27none%27 d=%27M0 0h24v24H0V0z%27/%3E%3Cpath d=%27M7 10l5 5 5-5H7z%27 fill=%27gray%27/%3E%3C/svg%3E"},43470(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},43737(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23666%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},47603(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z%27/%3E%3C/svg%3E"},47695(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3C/svg%3E"},47914(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2788%27 height=%2723%27 fill=%27none%27%3E%3Cpath fill=%27%23000%27 fill-opacity=%27.4%27 fill-rule=%27evenodd%27 d=%27M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%27/%3E%3Cpath fill=%27%23fff%27 d=%27m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z%27/%3E%3Cpath fill=%27%23e1e3e9%27 d=%27M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z%27/%3E%3Cpath d=%27M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z%27 style=%27fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001%27/%3E%3Cg style=%27stroke-width:1.12603545%27%3E%3Cpath d=%27M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668%27 style=%27color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3Cpath d=%27M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3%27 style=%27clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3Cpath d=%27M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%27 style=%27clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3C/g%3E%3C/svg%3E"},48460(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23999%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},50477(){},52265(e,t,n){"use strict";var a=n(96540),i=n(5338),l=n(69733),r=n(80817),o=n(75737),s=n(601),c=n(92826),d=(n(52463),n(24172),n(45483),n(66718),n(23024),n(41625),n(45588)),m=n(84976),p=n(47767),u=n(58132),g=n(88634),h=n(32483),E=n(93688),y=n(60431),x=n(31600),f=n(70791),b=n(60258);const v=(0,b.Z0)({name:"auth",initialState:{currentUser:{}},reducers:{signIn:(e,t)=>({...e,currentUser:t.payload}),signOut:e=>({...e,currentUser:{}})}}),{signIn:A,signOut:w}=v.actions,C=e=>e.auth.currentUser,S=v.reducer;var k=n(53292),_=n(88943),z=n(17862),R=n(5076),D=n(5556),O=n.n(D),F=n(81714),M=n.n(F),j=n(1642);const I=(0,j.A)({palette:{primary:{main:"#EC7700",secondary:"#FFFFFF"},success:{main:"#1AA464"},error:{main:"#FB4E3B"},disabled:{main:"#9B9B9B"},pale:{main:"#EEEEEE"},white:{main:"#FFFFFF"},inProgress:{main:"#2F80ED"},onHold:{main:"#BDBDBD"},default:{main:"#5F504D"}}}),T=({text:e,color:t="defalut",onClick:n=M(),selected:i=!1})=>a.createElement(E.A,{theme:I},a.createElement(z.A,{label:e,variant:i?"":"outlined",color:t,sx:{height:"22px",fontWeight:"500",color:i?"#FFFFFF":I[t]},onClick:n}));T.propTypes={text:O().string.isRequired,color:O().string,onClick:O().func,selected:O().bool};const B=T,$=[{value:"Initialized",color:"inProgress"},{value:"PA Sent",color:"inProgress"},{value:"PA Received",color:"inProgress"},{value:"In Progress",color:"inProgress"},{value:"Result Submitted",color:"success"},{value:"Completed",color:"success"},{value:"Cancelled",color:"error"},{value:"On Hold",color:"onHold"}],N=$.map(e=>e.value),q=[{key:"BODY",value:"Body",pomPathKey:"consultant"},{key:"HEAD",value:"Head",pomPathKey:"consultant_head"},{key:"HAND",value:"Hand",pomPathKey:"consultant_hand"}],L=[{id:"is_private",label:"Visibility*",type:"radio-group",display:N,options:[{key:"false",value:"Public"},{key:"true",value:"Private"}]},{id:"acid",label:"ACID*",type:"text",display:N,showInNew:!0},{id:"client",label:"Client*",type:"autocomplete",display:N,showInNew:!0},{id:"name",label:"Project Name*",type:"text",display:N,showInNew:!0},{id:"types",label:"Project Type*",type:"radio-group-multi-select",display:N},{id:"gender",label:"Gender*",type:"radio-group",display:N,options:["Male","Female","Male & Female"]},{id:"coordinator",label:"Project Manager / Coordinator*",type:"select",display:N},{id:"consultants",label:"Lead Consultant(s)*",type:"multi-select",display:N},{id:"consulting_coordinator",label:"Technical Project Manager*",type:"select",display:N},{id:"consulting_support",label:"Consulting Support*",type:"select",display:N},{id:"status",label:"Project Status",type:"colored-select",display:N},{id:"file_link",label:"Project Files Link*",type:"text",display:["Result Submitted","Completed"]},{id:"creation_date",label:"Open Date*",type:"datetime",display:N},{id:"close_date",label:"Close Date*",type:"datetime",display:["Completed","Cancelled"]},{id:"description",label:"Description",type:"text",display:N}],P=[{id:"acid",label:"ACID",sortable:!0,display:!0},{id:"client",label:"Client",sortable:!0,display:!0},{id:"name",label:"Project Name",sortable:!0,display:!0},{id:"gender",label:"Gender",sortable:!1,display:!0},{id:"creation_date",label:"Open Date",sortable:!0,display:!0},{id:"personnel",label:"Personnel",sortable:!1,display:!0},{id:"status",label:"Project Status",sortable:!1,display:!0},{id:"created_at",label:"Creation Date",sortable:!0,display:!1}],W=[{id:"title",label:"Project Name",sortable:!0},{id:"created_at",label:"Creation Date",sortable:!0},{id:"created_by",label:"Created By",sortable:!1},{id:"populations",label:"Analysis Objects",sortable:!1}],V=[{id:"title",label:"Insight Name",sortable:!0},{id:"created_at",label:"Creation Date",sortable:!0},{id:"created_by",label:"Created By",sortable:!1}],H=[{id:"title",label:"Sizeset Name",sortable:!0},{id:"created_at",label:"Creation Date",sortable:!0},{id:"created_by",label:"Created By",sortable:!1}],G=[{id:"coordinator",label:"Project Manager / Coordinator"},{id:"consultants",label:"Lead Consultant(s)"},{id:"consulting_coordinator",label:"Technical Project Manager"},{id:"consulting_support",label:"Consulting Support"}],U=(e,t)=>a.createElement("div",{key:`user-info-${e?.firstName}`,style:{display:"flex",flexDirection:"row",paddingBottom:"detail"===t?0:"10px",marginRight:"detail"===t?"10px":0}},"detail"===t?a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"left"}},a.createElement("div",{style:{height:"20px"}},a.createElement("b",null,`${e?.first_name||""} ${e?.last_name||""}`),!e?.is_active&&a.createElement(z.A,{label:"Inactive",size:"small",sx:{borderRadius:"5px",height:"20px",marginLeft:"8px",backgroundColor:"#FFEAE8",color:"#FB4E3B"}})),a.createElement("span",{style:{color:"#EC7700",textDecoration:"underline",fontWeight:"100",fontSize:"small"}},e?.email)):a.createElement("span",null,`${e?.first_name||""} ${e?.last_name||""}`)),Y=(e,t,n,i)=>"coordinator"===e||"consulting_coordinator"===e||"consulting_support"===e?U(0!==Object.keys(i).length?i:t,n):"consultants"===e?"detail"===n?a.createElement("div",{style:{display:"flex"}},t.map(e=>U(0!==Object.keys(i).length?i:e,n))):a.createElement("div",null,t.map(e=>U(0!==Object.keys(i).length?i:e))):"creation_date"===e||"close_date"===e||"created_at"===e?t?ke(t):"N/A":"is_private"===e?t?"Private":"Public":"status"===e?a.createElement(B,{text:t,color:$.find(e=>e.value===t)?.color||"primary"}):"file_link"===e?a.createElement(R.A,{href:t,target:"_blank",sx:{textDecoration:"underline !important"}},t):"populations"===e?a.createElement("div",{style:{display:"flex",flexDirection:"column"}},t.map(e=>a.createElement("div",{key:`population-${e.type}-${e.label}`,style:{display:"flex",flexDirection:"row",paddingBottom:"10px",marginRight:0}},a.createElement("div",{style:{width:"40%",minWidth:"40%",maxWidth:"40%",display:"inline-block",fontWeight:500,marginRight:"10px"}},`${"ABP"===e.type?"Standard":e.type}:`),a.createElement("div",{style:{width:"60%",display:"inline-block",fontWeight:500,marginRight:"10px"}},e.label)))):"types"===e?t.map(e=>q.find(t=>t.key===e)?.value||"").join(" & "):t;var Z=n(70960),J=n(69282),X=n(51869);const Q=(0,b.Z0)({name:"role",initialState:{currentRole:""},reducers:{switchToAdmin:e=>({...e,currentRole:"admin"}),switchToUser:e=>({...e,currentRole:""})}}),{switchToAdmin:K,switchToUser:ee}=Q.actions,te=Q.reducer,ne=(0,b.Z0)({name:"analysis",initialState:{currentAnalysis:{}},reducers:{setCurrentAnalysis:(e,t)=>({...e,currentAnalysis:t.payload})}}),{setCurrentAnalysis:ae}=ne.actions,ie=e=>e.analysis.currentAnalysis,le=ne.reducer,re=(0,b.Z0)({name:"project",initialState:{currentProject:{}},reducers:{setCurrentProject:(e,t)=>({...e,currentProject:t.payload})}}),{setCurrentProject:oe}=re.actions,se=e=>e.project.currentProject,ce=re.reducer,de=(0,b.Z0)({name:"snack",initialState:{analysisToDownload:"",source:""},reducers:{setAnalysisToDownload:(e,t)=>({...e,analysisToDownload:t.payload.analysisToDownload,source:t.payload?.source||"analysis_scan_data"})}}),{setAnalysisToDownload:me}=de.actions,pe=e=>e.snack.analysisToDownload,ue=e=>e.snack.source,ge=de.reducer,he=(0,b.Z0)({name:"salesBySize",initialState:{list:[]},reducers:{setSalesBySizeList:(e,t)=>({...e,list:t.payload})}}),{setSalesBySizeList:Ee}=he.actions,ye=e=>e.salesBySize.list,xe=he.reducer,fe={key:"root",storage:J.A,stateReconciler:X.A},be=(0,Z.rL)(fe,te),ve=(0,b.U1)({reducer:{auth:S,role:be,analysis:le,toastr:r.Ff,project:ce,snack:ge,salesBySize:xe},middleware:e=>e({serializableCheck:!1})}),Ae=(0,Z.GM)(ve),we={year:"numeric",month:"2-digit",day:"2-digit"},Ce={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"},Se={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"},ke=e=>e?new Date(e).toLocaleString("zh",{...we,timeZone:ve.getState().auth.currentUser.timezone||void 0}).replaceAll("/","-"):"----",_e=e=>new Date(e).toLocaleString("zh-cn",{...Ce,timeZone:ve.getState().auth.currentUser.timezone||void 0}).replaceAll("/","-"),ze=e=>e.toLocaleString("en-GB"),Re=e=>Array.from(new Set(e.map(e=>Object.keys(e)).flat())),De=e=>"string"==typeof e?e.replaceAll("&","%26"):e,Oe=e=>`?${Object.keys(e).map(t=>Array.isArray(e[t])?`${t}=${De(e[t].join(","))}`:`${t}=${De(e[t])}`).join("&")}`,Fe=e=>"string"==typeof e?e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):e,Me=e=>{const t=e.map(e=>({size:e?.size,...e?.country})),n=e.map(e=>({size:e?.size,...e?.pom?.cm})),a=e.map(e=>({size:e?.size,...e?.pom?.inch}));return[{name:"Size Conversion",headers:Re(t),data:t},{name:"cm",headers:Re(n),data:n},{name:"inch",headers:Re(a),data:a}]},je=(e,t)=>Array.isArray(t)?!!t.find(n=>e.includes(n)||t.includes("Global")):e.includes(t),Ie=(e,t)=>{if("core_size"===t)return e.map(e=>e.size);if("unit"===t)return["cm","inch"];if("pom"===t){const t=(e=>{const t=e.map(e=>({size:e?.size,...e?.country})),n=e.map(e=>({size:e?.size,...e?.pom?.cm})),a=e.map(e=>({size:e?.size,...e?.pom?.inch}));return[{name:"Size Conversion",headers:Re(t),data:t},{name:"Size Chart - cm",headers:Re(n),data:n},{name:"Size Chart - inch",headers:Re(a),data:a}]})(e),n=t[1],a=t[2];return Array.from(new Set([...n.headers,...a.headers])).filter(e=>"size"!==e)}return[]},Te=(e,t,n)=>"age"===e&&null!==n&&null!==t?`${t} - ${n}`:null===n?`${e||""} >= ${t}`:null===t?`${e||""} <= ${n}`:`${0===t?"":`${t} <=`} ${e} ${0===n?"":`<= ${n}`}`,Be=e=>Array.isArray(e)?e.map(e=>"object"==typeof e?Object.entries(e).map(e=>e.join(": ")).join(", "):e).join("; "):"object"==typeof e?Object.entries(e).map(e=>e.join(": ")).join(", "):e,$e=e=>{const t=Object.keys(e).sort();return t.length>0?t.map(t=>e?.[t].map(e=>({value:e,group:t}))).flat():[]},Ne=(e,t)=>"PROJECT_VIEW"===e||"BodyScan"===e?void 0!==t&&0!==t.length?t.map(e=>q.find(t=>t.key===e)?.pomPathKey):"consultant":"my_alva",qe={},Le=[],Pe=e=>{const{fileBlob:t,fileName:n}=e,a=decodeURI(n).split("=")[1],i=URL.createObjectURL(t),l=document.createElement("a");l.setAttribute("href",i),l.setAttribute("download",a),document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>{URL.revokeObjectURL(i)},1e4)},We="https://demo.aap.alva-services.com/",Ve=new Headers;Ve.append("User-Agent","Apifox/1.0.0 (https://www.apifox.cn)"),Ve.append("Accept","*/*"),Ve.append("Accept-Encoding","gzip, compress, br"),Ve.append("Access-Control-Allow-Headers","Origin, X-Requested-With, Content-Type, Accept");const He={headers:Ve,redirect:"follow",credentials:"include"},Ge=()=>{const e=(()=>{const e=document.cookie.split(";").filter(e=>e.includes("csrftoken=")).at(-1)||"";return e?.split("=")?.[1]||null})();Ve.set("x-csrftoken",e),Ve.set("Content-Type","application/json")},Ue=async(e,t)=>{try{const n=`${We}${e}`,i=await fetch(n,{...He,...t});if(i.ok){const e=i.headers.get("content-type");if("application/json"===e)return await i.json();if("image/png"===e)return await i.blob();if("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"===e||"application/x-zip-compressed"===e){return{fileBlob:await i.blob(),fileName:i.headers.get("content-disposition")}}}if(401===i.status&&"/login"!==window.location.pathname||403===i.status){const e=window.location.pathname+window.location.search;return"/login"!==window.location.pathname?window.location.assign(`/login?from=${encodeURIComponent(e)}`):window.location.assign("/login"),null}const l=await i.json();return r.ih.error("",{component:a.createElement(k.A,{open:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:5e3,sx:{bottom:"52px !important",right:"68px !important",".MuiPaper-root":{alignItems:"center",backgroundColor:"#f8332fd6"}}},a.createElement(_.A,{severity:"error",variant:"filled",sx:{".MuiAlert-message":{display:"flex",flexDirection:"row",minHeight:"30px",width:"200px",justifyContent:"space-between",alignItems:"center",overflow:"hidden",margin:0}}},a.createElement("p",null,l.detail)))}),null}catch(e){return r.ih.error("",{component:a.createElement(k.A,{open:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},autoHideDuration:5e3,sx:{bottom:"52px !important",right:"68px !important",".MuiPaper-root":{alignItems:"center",backgroundColor:"#f8332fd6"}}},a.createElement(_.A,{severity:"error",variant:"filled",sx:{".MuiAlert-message":{display:"flex",flexDirection:"row",minHeight:"30px",width:"200px",justifyContent:"space-between",alignItems:"center",overflow:"hidden",margin:0}}},a.createElement("p",null,"Sorry, unknown error occurred, please contact administrators")))}),null}},Ye=async(e,t)=>{const n=t?`${e}${Oe(t)}`:e;return await Ue(n,{method:"GET"})},Ze=async(e,t,n)=>{const a=n?`${e}${Oe(n)}`:e;return await Ue(a,{body:JSON.stringify(t||{}),method:"POST"})},Je=async(e,t,n)=>{const a=n?`${e}${Oe(n)}`:e;return await Ue(a,{body:JSON.stringify(t),method:"PATCH"})},Xe=async(e,t)=>{const n=t?`${e}${Oe(t)}`:e;return await Ue(n,{method:"DELETE"})},Qe={ADMIN:{userList:"api/v1/users",groups:"api/v1/groups",resetPassword:"api/v1/users/reset_password/",getTimezoneOptions:"api/v1/users/get_all_timezones"},AUTH:{login:"api/v1/login",logout:"api/v1/logout"},USER:{star:"api/v1/user_favorites_view",downloadList:"api/v1/download/record/management",settings:"api/v1/user_settings_view",releaseNote:"api/v1/release_note/management",releaseNoteCount:"api/v1/release_note/unread_note_count",readReleaseNote:"api/v1/release_note/read"},DATA_QUERY:{option:"api/v1/data_query/option",data:"api/v1/data_query/management",download:"api/v1/data_query/download"},SIZE_CHART:{getAllSizes:"api/v1/chart_summary",getAllBrands:"api/v1/size_chart/brands",getAllFilters:"api/v1/size_chart/multi_filter",getFilterOptions:"api/v1/competitor_overview_analysis/brand_size_option"},DATASET_PROFILER:{options:"api/v1/dataset/profile/option",data:"api/v1/dataset/profile/management",summary:"api/v1/dataset/profile/summary"},COMPETITOR_VIEW:{analysisList:"api/v1/competitor_overview_analysis",deliverables:"api/v1/competitor_overview_deliverables",downloadOverviewFiles:"api/v1/competitor_overview_analysis/download"},IKO:{getScatterPlotData:"api/v1/scatter_plots",getDistributionData:"api/v1/distribution",getRegionalPopulation:"api/v1/region_population"},SALES_BY_SIZE:{getBrands:"api/v1/sales_by_size/brand",getBrandFilters:"api/v1/sales_by_size/filter",getChartData:"api/v1/sales_by_size"},PROJECT_VIEW:{getProjectList:"api/v1/project_view",getProjectHistory:"api/v1/project_history_view",getOptions:"api/v1/admin/options_management",pptSource:"api/v1/project/ppt/selection",ppt:"api/v1/project/download_ppt",downloadSDAFile:"api/v1/scan_data_analysis/download",checkDownloadStatus:"api/v1/download/status",analysisList:"api/v1/scan_data_analysis/management",deliverables:"api/v1/scan_data_analysis/deliverables",deliverableSummaryStats:"api/v1/scan_data_analysis/deliverables/stats",summaryBM:"api/v1/consultant/analysis/summary_body_measurement",population:"api/v1/scan_data_analysis/population",populationMap:"api/v1/scan_data_analysis/population/dataset",populationOptions:"api/v1/scan_data_analysis/population/option",checkM4MData:"api/v1/scan_data_analysis/validate_pom_data",marketCoverage:"api/v1/scan_data_analysis/market_coverage",marketCoverageCharts:"api/v1/scan_data_analysis/market_coverage",standardSizeChartList:"api/v1/scan_data_analysis/market_coverage/standard_size_chart",getPomMapping:"api/v1/measurement_point_mapping",sbsList:"api/v1/project/sales_by_size",sbsDeliverables:"api/v1/project/sbs_deliverables"},ORGANIZATION:{organizations:"api/v1/organizations",permissionTemplate:"api/v1/organizations/get_permission_template"},MYALVA:{overviewOptions:"api/v1/myalva/overview/options",overviewData:"api/v1/myalva/overview",measurementOptions:"api/v1/myalva/options/body_measurement",analysisList:"api/v1/myalva/analysis/management",model3D:"api/v1/myalva/analysis/3d_model",deliverables:"api/v1/myalva/analysis/deliverables",populationOptions:"api/v1/myalva/options/population",populationCount:"api/v1/myalva/analysis/population_stats",summaryBM:"api/v1/myalva/analysis/summary_body_measurement",standardCollectionDetail:"api/v1/avatar_collection",deliverablesBatchUpdate:"api/v1/myalva/analysis/deliverables_batch",deliverableSummaryStats:"api/v1/myalva/analysis/deliverables/stats",listSizeset:"api/v1/avatar_size_set",encrytedObj:"api/v1/myalva/overview_3d_file"},THREE_D_AVATAR:{checkDraft:"api/v1/insights_3d/management_draft",project:"api/v1/insights_3d/management",avatar:"api/v1/insights_3d/management_avatars",deliverables:"api/v1/insights_3d/deliverables",pomStats:"api/v1/insights_3d/population_poms",nearestPom:"api/v1/insights_3d/nearest_poms",options:"api/v1/insights_3d/avatar_option",encrytedObj:"api/v1/deliverables/preview",avatarSetComparison:"api/v1/avatar_comparison/standard_size_set/management",avatarSingleComparison:"api/v1/avatar_comparison/single_avatar/management",comparisonOptions:"api/v1/avatar_comparison/options",comparisonCharts:"api/v1/avatar_comparison/standard_size_set/sp_charts"}},Ke=async()=>Ye(Qe.AUTH.login),et=async()=>Ze(Qe.AUTH.logout),tt=n.p+"75552c9aa59338309dae.png";var nt=n(85072),at=n.n(nt),it=n(97825),lt=n.n(it),rt=n(77659),ot=n.n(rt),st=n(55056),ct=n.n(st),dt=n(10540),mt=n.n(dt),pt=n(41113),ut=n.n(pt),gt=n(38328),ht={};ht.styleTagTransform=ut(),ht.setAttributes=ct(),ht.insert=ot().bind(null,"head"),ht.domAPI=lt(),ht.insertStyleElement=mt(),at()(gt.A,ht),gt.A&>.A.locals&>.A.locals;const Et=[{key:"myalva_overview",label:"OVERVIEW",path:"/myalva-overview",value:"myalva-overview"},{key:"consultant_projects",label:"CONSULTING",path:"/",value:"consultant"},{key:"myalva_analysis",label:"Analysis",path:"/analysis",value:"myalva-analysis"},{key:"data_query",label:"DATA QUERY",path:"/data-query",value:"query"},{key:"dataset_profile",label:"DATASET PROFILER",path:"/dataset-profiler",value:"dataset-profiler"},{key:"insights_3d_model",label:"3D Insights",path:"/3d-model/new",value:"3d-model"},{key:"avatar_comparison",label:"Avatar Comparison",path:"/avatar-comparison",value:"avatar-comparison"},{key:"manual_sizeset",label:"Manual Sizeset",path:"/manual-sizeset/new",value:"manual-sizeset"}],yt=e=>Et.find(t=>e.includes(t.key))?.path||"/login",xt=()=>{const[e,t]=(0,a.useState)(""),[n,i]=(0,a.useState)(""),[r,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)([]),[d,b]=(0,a.useState)(!1),[v]=(0,m.ok)(),w=(0,l.useSelector)(C),S=(0,l.useDispatch)();(0,a.useEffect)(()=>{w&&0!==Object.keys(w).length&&(c(w.permissions||[]),o(!0))},[w]);const k=(0,a.useCallback)(()=>{"visible"===document.visibilityState&&Ke().then(e=>{e&&(c(e?.permissions||[]),S(A(e)),o(!0))})},[S]);(0,a.useEffect)(()=>(k(),document.addEventListener("visibilitychange",k),()=>{document.removeEventListener("visibilitychange",k)}),[k]);const _=yt(s),z=v.get("from")||_,R=(e,n)=>{"username"===e?t(n):i(n)};return a.createElement("div",{className:"login-container"},r&&a.createElement(p.C5,{to:z,replace:!0}),a.createElement("img",{alt:"logo",src:tt}),a.createElement("form",{onSubmit:async t=>{t.preventDefault(),(async e=>Ze(Qe.AUTH.login,e))({username:e,password:n}).then(e=>{e&&(c(e?.permissions||[]),S(A(e)),o(!0))})}},a.createElement(u.A,{className:"user-input",id:"email-input",label:"Email",variant:"outlined",required:!0,onChange:e=>R("username",e.target.value)}),a.createElement(u.A,{className:"user-input",id:"password-input",type:d?"text":"password",label:"Password",variant:"outlined",autoComplete:"aap-password",required:!0,onChange:e=>R("password",e.target.value),sx:{"& .MuiOutlinedInput-root":{"&:has(> input:-webkit-autofill)":{backgroundColor:"rgb(232, 240, 254)"}}},InputProps:{endAdornment:a.createElement(g.A,{position:"end"},a.createElement(h.A,{"aria-label":"toggle password visibility",onClick:()=>b(e=>!e),onMouseDown:e=>{e.preventDefault()},onMouseUp:e=>{e.preventDefault()}},d?a.createElement(f.A,null):a.createElement(x.A,null)))}}),a.createElement(E.A,{theme:I},a.createElement(y.A,{type:"submit",variant:"contained",color:"primary",sx:{height:"32px",borderRadius:"32px",fontWeight:"100",boxShadow:"none",color:"#FFFFFF",textTransform:"none"}},"Login"))))},ft=()=>a.createElement(xt,null),bt=n.p+"31fa6b1654379c025876.png",vt=()=>{const e=(0,p.r5)();return a.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"100vw",height:"100vh"}},a.createElement("img",{className:"logo-container",alt:"logo",src:bt,style:{height:"80px",width:"auto"}}),a.createElement("h1",{style:{color:"#EC7700"}},"Sorry!"),a.createElement("p",null,"The page you are looking for is not available at the moment."),a.createElement("p",null,"Please go back to the previous page or refer to the error message down below:"),a.createElement("p",null,a.createElement("i",null,e.statusText||e.message)))};var At=n(5744),wt=n(96224),Ct=n(53830),St=n(41975),kt=n(64951),_t=n(34477),zt=n(8861),Rt=n(60440),Dt=n(10848);const Ot=n.p+"2b9bbbe4f8f81b5a1cb0.png";var Ft=n(8344),Mt=n(51475),jt=n(37603),It=n(73053),Tt=n(30073),Bt=n(95884),$t=n(16738);const Nt=[{id:"user_management",text:"User Management",path:"user-management"},{id:"client_management",text:"Client Management",path:"client-management"},{id:"role_management",text:"Role & Permission",path:"role-management"}],qt=()=>{const e=(0,l.useSelector)(C),t=(0,p.zy)(),n=e?.permissions||[];return a.createElement(E.A,{theme:I},a.createElement(It.Ay,{sx:{".MuiDrawer-paper":{position:"absolute",top:"auto",left:"auto",zIndex:"auto",width:"180px"},a:{color:"inherit"}},variant:"permanent",anchor:"left"},a.createElement(Tt.A,null,Nt.map(e=>n.includes(e.id)&&a.createElement(Bt.A,{selected:t.pathname.includes(e.path),key:e.text},a.createElement(m.N_,{className:"sidebar-tabs",to:e.path},a.createElement($t.A,{primary:e.text})))))),a.createElement(_t.A,{sx:{width:"calc(100% - 212px)",marginLeft:"180px",p:2},component:"main"},a.createElement("div",{id:"detail"},a.createElement(p.sv,null))))},Lt=({permissions:e})=>{const t=(0,l.useSelector)(C),[n,i]=a.useState(null),r=Boolean(n),o=(0,l.useDispatch)(),s=(0,p.Zp)(),c=Nt.filter(t=>e.includes(t.id)),d=()=>{i(null)},m=e=>{i(null),s(e)};return a.createElement(a.Fragment,null,a.createElement(Ft.A,{sx:{width:32,height:32,fontSize:"16px",marginLeft:"50px",":hover":{cursor:"pointer"}},onClick:e=>{i(e.currentTarget)}},t?.username?.charAt(0).toUpperCase()||""),r&&a.createElement(Mt.A,{id:"basic-menu",anchorEl:n,open:r,onClose:d,MenuListProps:{"aria-labelledby":"basic-button"}},a.createElement(jt.A,{onClick:()=>m("/user-settings/my")},"My Account"),e.includes("system_admin")&&a.createElement(jt.A,{onClick:()=>m("/sys-admin/organization")},"System Admin"),e.includes("admin_console")&&a.createElement(jt.A,{onClick:()=>m(`/admin/${c[0].path}`)},"Admin Console"),a.createElement(jt.A,{onClick:()=>{d(),et().then(e=>{e&&o(w())}).then(()=>{s("/login",{replace:!0})})}},"Logout")))};Lt.propTypes={permissions:O().instanceOf(Array).isRequired};const Pt=Lt,Wt=async e=>Ye(Qe.PROJECT_VIEW.getProjectList,e),Vt=async()=>Ye(Qe.PROJECT_VIEW.getOptions,{domain:"ProjectClient"}),Ht=async(e,t)=>Ye(`${Qe.PROJECT_VIEW.ppt}/${e}/`,t),Gt=async e=>Ye(`${Qe.PROJECT_VIEW.downloadSDAFile}/${e}/`),Ut=async e=>Ye(Qe.PROJECT_VIEW.marketCoverage,e),Yt=async(e,t)=>Ye(`${Qe.PROJECT_VIEW.marketCoverage}/download/${e}/`,t),Zt=async(e,t)=>Je(`${Qe.PROJECT_VIEW.population}/${e}/`,t),Jt=async e=>Ye(Qe.PROJECT_VIEW.populationMap,{...e,return_tree:!0}),Xt=async e=>Ye(`${Qe.COMPETITOR_VIEW.downloadOverviewFiles}/${e}/`),Qt=async e=>Ye(Qe.SIZE_CHART.getFilterOptions,{...e,main_option:"country"}),Kt=async e=>Ye(Qe.SIZE_CHART.getFilterOptions,{...e,main_option:"garment_size"}),en=async e=>Ye(Qe.SIZE_CHART.getFilterOptions,{...e,main_option:"inseam_type"}),tn=async e=>Ye(Qe.PROJECT_VIEW.sbsDeliverables,e),nn=async(e,t)=>Xe(`${Qe.PROJECT_VIEW.sbsList}/${e}/`,t);var an=n(43952),ln=n(82647),rn=n(66277),on=n(42116),sn=n(7527),cn=n(12070),dn=n(15548),mn=n(80328);const pn=async e=>Ye(Qe.SIZE_CHART.getAllSizes,e),un=async()=>Ye(Qe.SIZE_CHART.getAllBrands),gn=async e=>Ze(Qe.USER.star,e),hn=async e=>Ye(Qe.USER.releaseNote,e),En=async e=>Ze(Qe.USER.readReleaseNote,{release_note_ids:e}),yn=({href:e,children:t})=>a.createElement(R.A,{href:e,target:"_blank",rel:"noopener",sx:{color:"primary.main"}},t),xn=()=>{const[e,t]=(0,a.useState)(!1),[n,i]=(0,a.useState)([]),[l,r]=(0,a.useState)({}),[o,s]=(0,a.useState)(null),c=(0,a.useRef)(null),d=Boolean(o),p=()=>{"visible"===document.visibilityState&&(async()=>Ye(Qe.USER.releaseNoteCount))().then(e=>{e?.status&&0!==e.count&&t(!0)})};return(0,a.useEffect)(()=>{e&&hn({view_by:"latest"}).then(e=>{if(e?.status){const n=document.getElementById("whats-new-icon");i(e?.data||[]),s(n),t(!1)}})},[e]),(0,a.useEffect)(()=>(p(),document.addEventListener("visibilitychange",p),()=>{document.removeEventListener("visibilitychange",p)}),[]),a.createElement(a.Fragment,null,a.createElement(h.A,{id:"whats-new-icon",onClick:e=>{s(d?null:e.currentTarget),t(!0)},sx:{width:"20px",height:"20px",marginRight:"6px",alignSelf:"center"}},a.createElement(Rt.A,null,a.createElement(ln.A,{sx:{width:"20px",height:"20px"}}))),d&&a.createElement(on.Ay,{open:d,anchorEl:o,onClose:()=>{s(null),r({});const e=n.filter(e=>!1===e?.is_read).map(e=>e.id);0!==e.length&&En(e)},anchorOrigin:{vertical:"bottom",horizontal:"left"}},a.createElement(Tt.A,{sx:{width:"300px",color:"#5F504D"}},a.createElement(sn.Ay,null,0!==Object.keys(l).length&&a.createElement(cn.A,{sx:{minWidth:"20px"},onClick:()=>r({})},a.createElement(rn.A,{fontSize:"small"})),a.createElement($t.A,{sx:{textAlign:"center"}},a.createElement("b",null,0!==Object.keys(l).length?l?.title||"":"Latest changes"))),a.createElement(dn.A,null),a.createElement(Ct.A,{direction:"column",ref:c,sx:{position:"relative",overflow:"hidden",height:0!==Object.keys(l).length?"300px":"auto"}},n.map(e=>a.createElement(Bt.A,{key:`note-${e?.id}`,onClick:()=>{return En([(n=e).id]).then(e=>{e?.status&&t(!0)}),void r(n);var n},sx:{height:"100px",display:"block","&:hover":{b:{textDecoration:"underline"}},"&:before":{content:'""',height:"100px",position:"absolute",left:0,top:0,width:"3px",backgroundColor:e?.is_read?"#FFFFFF":"#EC7700"}}},a.createElement(E.A,{theme:I},a.createElement(z.A,{color:"primary",size:"small",label:new Date(e?.date||void 0).toLocaleDateString(void 0,{month:"short"}),sx:{color:"#FFFFFF",height:"18px"}})),a.createElement("b",{style:{marginLeft:"5px"}},e?.title||""),a.createElement("span",{style:{marginLeft:"5px"}},e?.content?`${e.content.length+(e?.title?.length||0)>120?`${e.content.substring(0,120-(e?.title?.length||0))}...`:e.content}`:""))),a.createElement(mn.A,{direction:"left",in:0!==Object.keys(l).length,container:c.current},a.createElement(Ct.A,{direction:"column",spacing:0,sx:{position:"absolute",top:"0",backgroundColor:"#FFFFFF",height:"300px",width:"300px",padding:"8px",boxSizing:"border-box",overflowY:"scroll"}},a.createElement(_t.A,{className:"markdown-preview",sx:{display:"inline-block",marginLeft:"5px","& h1":{fontSize:"2rem",fontWeight:"bold"},"& h2":{fontSize:"1.5rem",fontWeight:"bold"},"& h3":{fontSize:"1.25rem",fontWeight:"bold"},"& pre":{backgroundColor:"grey.100",p:2,borderRadius:1,overflow:"auto"},"& blockquote":{borderLeft:"4px solid",borderColor:"primary.main",pl:2,ml:0,fontStyle:"italic",color:"text.secondary"}}},a.createElement(an.oz,{components:{a:yn}},l?.content||"")),l?.attachments&&0!==l.attachments.length&&a.createElement("img",{src:l.attachments,alt:"New feature sample",style:{width:"100%",height:"auto"}})))),a.createElement(dn.A,null),a.createElement(Bt.A,{component:m.N_,to:"./release-notes",target:"_blank",sx:{textAlign:"center",textDecoration:"underline !important"}},a.createElement("span",{style:{display:"block",width:"100%"}},"Alvanon changelog")))))},fn={minWidth:"80px",backgroundColor:"#FFFFFF",borderBottom:"none",minHeight:"32px",zIndex:"inherit",marginRight:"10px",marginTop:"8px",fontSize:"12px",p:"5px 20px",fontWeight:800,borderTop:"3px solid transparent","&.Mui-selected":{backgroundColor:"#FFFFFF",borderTop:"3px solid #EC7700"},"&:hover":{color:"#EC7700"}},bn=()=>{const e=(0,l.useSelector)(C),t=(0,p.zy)(),[n,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(),c=(0,l.useDispatch)(),u=(0,l.useSelector)(pe),g=(0,l.useSelector)(ue),h="normal"!==u,y=e?.permissions||[],x="demo",f=Et.filter(e=>y?.includes(e.key)),b=yt(y),v=e=>{for(let n=0;n{"clickaway"!==t&&c(me({analysisToDownload:""}))};return(0,a.useEffect)(()=>{i(w?"admin":A?"query":R?"myalva-overview":S?"myalva-analysis":O?"dataset-profiler":F?"3d-model":j?"avatar-comparison":M?"manual-sizeset":"/user-settings"!==D?.pathnameBase&&"consultant")},[A,w,R,S,D,O,F,j,M]),(0,a.useEffect)(()=>{let e;return 0!==u.length&&r.ih.removeByType("error"),h&&0!==u.length&&(e=setInterval(()=>{(async(e,t)=>Ye(Qe.PROJECT_VIEW.checkDownloadStatus,{pk:e,domain:t}))(u,g).then(e=>{"done"===e?.data?.status&&(c(me({analysisToDownload:""})),s(!0))})},1e3)),()=>clearInterval(e)},[u,c,h]),window.onbeforeunload=()=>0!==u.length&&"normal"!==u?"Download is still in process, are you sure to close?":null,a.createElement(a.Fragment,null,a.createElement(At.A,{sx:{justifyContent:"center",backgroundColor:"#FFFFFF",height:"40px",padding:"0 10px",boxShadow:"none",borderBottom:"1px #ccc solid"}},a.createElement(wt.A,{disableGutters:!0,sx:{justifyContent:"space-between",minHeight:"40px !important"}},a.createElement(Ct.A,{direction:"row",spacing:9,alignItems:"center"},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(m.N_,{to:b,style:{height:"40px"}},a.createElement("img",{className:"logo-container",alt:"logo",src:bt,style:{height:"40px",width:"125.71px"}})),a.createElement(z.A,{size:"small",label:x.toUpperCase(),sx:{height:"20px",backgroundColor:"rgba(236, 119, 0, 0.1)",color:"#EC7700",fontWeight:700,borderRadius:"4px",".MuiChip-label":{padding:"0 8px",marginTop:"1px",letterSpacing:"1px",fontSize:"12px"}}})),a.createElement(E.A,{theme:I},a.createElement(St.A,{color:"primary",value:n,"aria-label":"basic tabs",sx:{".MuiTabs-indicator":{display:"none"}}},0!==f.length&&f.map(e=>a.createElement(kt.A,{key:e.key,label:e.label,value:e.value,component:m.N_,to:e.path,sx:fn})),"Admin"===e.group&&w&&a.createElement(kt.A,{label:"ADMIN PANEL",value:"admin",component:m.N_,to:"./admin/user-management",sx:fn})))),a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(xn,null),a.createElement(Pt,{permissions:y})))),a.createElement(_t.A,{sx:{paddingTop:"40px",width:"100%",height:"calc(100% - 40px)",backgroundImage:`url(${Ot})`,position:"relative",display:"flex",justifyContent:"center",alignItems:"start",minHeight:"calc(100vh - 40px)"},component:"main"},a.createElement("div",{id:"detail",style:{width:"95%",borderRadius:"12.5px",margin:"10px 0",minHeight:"calc(100vh - 80px)",position:"relative",display:R?"grid":"block"}},a.createElement(p.sv,null)),a.createElement(k.A,{open:!h&&0!==u.length,autoHideDuration:2e3,anchorOrigin:{vertical:"bottom",horizontal:"right"},onClose:T,sx:{bottom:"52px !important",right:"68px !important",".MuiPaper-root":{backgroundColor:"#EC7700",color:"#FFFFFF",minWidth:"200px"}}},a.createElement(_.A,{icon:!1,variant:"filled",sx:{".MuiAlert-message":{display:"flex",flexDirection:"row",height:"30px",width:"250px",justifyContent:"space-between",alignItems:"center",overflow:"hidden"}}},a.createElement("p",null,"Downloaded"))),a.createElement(k.A,{open:h&&0!==u.length,anchorOrigin:{vertical:"bottom",horizontal:"right"},onClose:T,sx:{bottom:"52px !important",right:"68px !important",".MuiPaper-root":{backgroundColor:"#EC7700",color:"#FFFFFF"}}},a.createElement(_.A,{icon:!1,variant:"filled",sx:{".MuiAlert-message":{display:"flex",flexDirection:"row",height:"30px",width:"200px",justifyContent:"space-between",alignItems:"center",overflow:"hidden"}}},a.createElement(zt.A,{size:30,color:"inherit"}),a.createElement("p",null,"Preparing your files"))),a.createElement(k.A,{open:o,anchorOrigin:{vertical:"bottom",horizontal:"right"},onClose:(e,t)=>{"clickaway"!==t&&s(!1)},autoHideDuration:2e3,sx:{bottom:"52px !important",right:"68px !important",".MuiPaper-root":{backgroundColor:"#1AA464",color:"#FFFFFF"}}},a.createElement(_.A,{icon:!1,variant:"filled",sx:{".MuiAlert-message":{display:"flex",flexDirection:"row",height:"30px",width:"250px",justifyContent:"space-between",alignItems:"center",overflow:"hidden"}}},a.createElement(Rt.A,{size:30,color:"inherit"},a.createElement(Dt.A,null)),a.createElement("p",null,"Your files were all prepared!")))))};var vn=n(35124),An=n(98014),wn=n(82077),Cn=n(52764),Sn=n(57599),kn=n(58168);const _n=({text:e,color:t="default",onClick:n=M(),style:i=qe,variant:l="contained",hoverStyle:r=qe,...o})=>a.createElement(E.A,{theme:I},a.createElement(y.A,(0,kn.A)({variant:l,color:t,onClick:n,sx:{height:"32px",borderRadius:"32px",fontWeight:"contained"===l?"100":"500",boxShadow:"none",color:"contained"===l?"#FFFFFF":I.palette[t].main,textTransform:"none","&:hover":{color:"contained"===l?"#FFFFFF":I.palette[t].main,backgroundColor:"contained"===l?"#E07000":"transparent",...r},...i}},o),e));_n.propTypes={text:O().string.isRequired,color:O().string,onClick:O().func,style:O().instanceOf(Object),variant:O().string,hoverStyle:O().instanceOf(Object)};const zn=_n;var Rn=n(91799),Dn=n(78164);const On=({label:e,placeholder:t="",onChange:n,endAdornment:i=null,startAdornment:l=null,value:r="",style:o=qe,disabled:s=!1})=>a.createElement(Rn.A,{variant:"outlined",sx:{padding:"0 15px",height:"30px",borderRadius:"30px",marginRight:"10px",backgroundColor:"#FFFFFF",border:"1px solid #BCBCBC",...o}},a.createElement(Dn.A,{id:`outlined-${e}`,placeholder:t,endAdornment:i,startAdornment:l,"aria-describedby":e,value:r,disabled:s,inputProps:{"aria-label":e},sx:{"&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},"&.Mui-disabled":{color:"transparent"}},onChange:n}));On.propTypes={label:O().string.isRequired,placeholder:O().string,onChange:O().func.isRequired,endAdornment:O().element,startAdornment:O().element,value:O().string,style:O().instanceOf(Object),disabled:O().bool};const Fn=On,Mn=async(e,t)=>Ye(Qe[t].analysisList,e),jn=async(e,t)=>Ye(`${Qe[t].analysisList}/${e}/`),In=async(e,t)=>Ze(Qe[t].analysisList,e),Tn=async(e,t,n)=>Xe(`${Qe[t].analysisList}/${e}/`,n),Bn=async(e,t,n)=>Je(`${Qe[n].analysisList}/${e}/`,t),$n=async(e,t)=>Ye(Qe[t].deliverables,e),Nn=async(e,t)=>Ye(`${Qe[t].deliverables}/${e}/`),qn=async(e,t)=>Ze(Qe[t].deliverables,e),Ln=async(e,t,n)=>Je(`${Qe[n].deliverables}/${e}/`,t),Pn=async(e,t)=>Xe(`${Qe[t].deliverables}/${e}/`),Wn=async e=>Ye(Qe.PROJECT_VIEW.getPomMapping,{type:e});var Vn=n(88564),Hn=n(1812),Gn=n(73708);const Un=({field:e,label:t,selected:n,options:i,onChange:l,hasSecondLevel:r=!1,disabled:o=!1,isColoredOption:s=!1,color:c="primary"})=>{const[d,m]=(0,a.useState)(null),p=Boolean(d),u=e=>{e&&l(e),m(null)};return a.createElement(E.A,{theme:I},a.createElement(y.A,{id:`${e}-select-toggle`,"aria-controls":p?`${e}-menu`:void 0,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:e=>m(e.currentTarget),endIcon:a.createElement(Hn.A,null),color:c,size:"small",disabled:o,sx:{textTransform:"none",".MuiButton-icon":{marginLeft:"0"}}},`${0!==t.length?`${t}:`:""} ${r?(()=>{const e=i.find(e=>n.includes(e.key)),t=(e?.children||[]).find(e=>e.key===n);return`${e?.value||"None"} ${t?.value||""}`})():i.find(e=>e.key===n)?.value||n}`),a.createElement(Mt.A,{id:`${e}-menu`,anchorEl:d,open:p,dense:"true",transitionDuration:0,onClose:()=>u(),color:c},0!==i.length&&i.map(e=>a.createElement(jt.A,{id:`option-${e?.key||e}`,key:`option-${e?.key||e}`,onClick:()=>r?{}:u(e?.key||e?.value||e),selected:r?n.includes(e?.key||e):n===(e?.key||e?.value||e),sx:r?{"&:hover":{".MuiList-root":{visibility:"visible"}}}:{}},r&&0!==e?.children?.length&&a.createElement(cn.A,{sx:{minWidth:"24px !important"}},a.createElement(Gn.A,{fontSize:"small"})),s&&a.createElement("div",{style:{width:"12px",height:"12px",backgroundColor:I.palette[e?.color]?.main||"#ffffff",borderRadius:"12px",marginRight:"8px"}}," "),a.createElement($t.A,null,e?.value||e),r&&0!==e?.children?.length&&a.createElement(Vn.A,{sx:{visibility:"hidden",marginLeft:"-135px",width:"120px",position:"fixed",backgroundColor:"#ffffff",boxShadow:"-1px 0px 2px #00000038"},open:!0},e.children.map(e=>a.createElement(jt.A,{key:`suboption-${e.key}`,onClick:t=>{t.preventDefault(),u(e?.key||e)},selected:n===(e?.key||e)},e?.value||e)))))))};Un.propTypes={field:O().string.isRequired,label:O().string.isRequired,selected:O().string.isRequired,options:O().instanceOf(Array).isRequired,onChange:O().func.isRequired,hasSecondLevel:O().bool,disabled:O().bool,isColoredOption:O().bool,color:O().string};const Yn=Un;var Zn=n(74353),Jn=n.n(Zn),Xn=n(22687),Qn=n(76647),Kn=n(88569),ea=n.n(Kn),ta=n(83826),na=n.n(ta),aa=n(49068),ia=n(93951);const la=({text:e,color:t="default",onClick:n=M(),disabled:i=!1,style:l=qe,variant:r="contained",size:o="medium",hoverStyle:s=qe,...c})=>a.createElement(E.A,{theme:I},a.createElement(y.A,(0,kn.A)({variant:r,color:t,onClick:n,disabled:i,size:o,sx:{height:"small"===o?"28px":"32px",borderRadius:"32px",fontWeight:"100",boxShadow:"none",color:"outlined"!==r&&"#FFFFFF",textTransform:"none","&:hover":{color:"outlined"===r?"#EC7700":"#FFFFFF",backgroundColor:"outlined"===r?"rgba(236, 119, 0, 0.04)":"#E07000",border:"outlined"===r?"1px solid #EC7700":"none",...s},...l}},c),e));la.propTypes={text:O().string.isRequired,color:O().string,onClick:O().func,style:O().instanceOf(Object),disabled:O().bool,variant:O().string,size:O().string,hoverStyle:O().instanceOf(Object)};const ra=la;Jn().extend(na()),Jn().extend(ea());const oa=(0,j.A)({...I,components:{MuiPickersDay:{styleOverrides:{root:{color:"#5F504D",borderRadius:"20px",backgroundColor:"transparent","&:hover":{backgroundColor:"rgba(236, 119, 0, 0.1)"},"&.Mui-selected":{backgroundColor:"#EC7700",color:"#FFFFFF","&:hover, &:focus":{backgroundColor:"#EC7700"}}}}}}}),sa=({value:e,onChange:t,type:n="input",page:i="consultant",disabled:l=!1})=>{const[r,o]=(0,a.useState)(null),s=Boolean(r),[c,d]=(0,a.useState)({}),m=e?.title||"All",p=ve.getState().auth.currentUser.timezone||Jn().tz.guess();Jn().tz.setDefault(p);const h=(e=>({all:{title:"All",datetime_gte:"",datetime_lte:""},today:{title:"Today",datetime_gte:Jn()().tz(e).startOf("day").toISOString(),datetime_lte:""},last7:{title:"Last 7 days",datetime_gte:Jn()().tz(e).startOf("day").subtract(7,"days").toISOString(),datetime_lte:""},last30:{title:"Last 30 days",datetime_gte:Jn()().tz(e).startOf("day").subtract(30,"days").toISOString(),datetime_lte:""},thisYear:{title:"This Year",datetime_gte:Jn()().tz(e).startOf("year").toISOString(),datetime_lte:""},lastYear:{title:"Last Year",datetime_gte:Jn()().tz(e).subtract(1,"year").startOf("year").toISOString(),datetime_lte:Jn()().tz(e).subtract(1,"year").endOf("year").toISOString()}}))(p),x=(e=>({title:"Custom Range",datetime_gte:Jn()().tz(e).startOf("day"),datetime_lte:Jn()().tz(e).endOf("day")}))(p);return(0,a.useEffect)(()=>{d(e)},[e]),a.createElement(E.A,{theme:oa},"button"===n?a.createElement(y.A,{id:"time-range-picker-toggle","aria-controls":s?"time-range-picker":void 0,"aria-haspopup":"true","aria-expanded":s?"true":void 0,onClick:e=>o(e.currentTarget),endIcon:a.createElement(Hn.A,null),color:"primary",size:"small",disabled:l,sx:{textTransform:"none",".MuiButton-icon":{marginLeft:"0"}}},`${"consultant"===i?"Open":"Creation"} Date: ${m}`):a.createElement("div",null,a.createElement(aa.A,{style:{boxSizing:"border-box",marginBottom:"4px"}},"Time"),a.createElement(u.A,{label:"",name:"rangePicker",variant:"outlined",placeholder:"Select Range",onClick:e=>{o(e.currentTarget)},sx:{borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"249px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}},inputProps:{autoComplete:"off"},value:m,InputProps:{endAdornment:a.createElement(g.A,{position:"end"},a.createElement(Rt.A,null,a.createElement(Xn.A,null)))}})),s&&a.createElement(on.Ay,{id:"time-range-picker",open:s,anchorEl:r,onClose:()=>o(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{"aria-labelledby":"time-range-picker-toggle"}}},a.createElement(_t.A,{sx:{display:"flex",width:"Custom Range"===c?.title?"530px":"249px"}},a.createElement(_t.A,{sx:{minWidth:"249px",mr:1,pr:1,borderRight:"Custom Range"===c?.title?"1px solid rgba(0,0,0,0.1)":"none"}},a.createElement(Tt.A,{sx:{p:"8px 0"}},Object.keys(h).map(e=>a.createElement(sn.Ay,{key:e,disablePadding:!0,onClick:()=>{return n=h[e],o(null),void t(n);var n}},a.createElement(Bt.A,{sx:{paddingTop:"4px",paddingBottom:"4px"}},a.createElement($t.A,{primary:h[e].title})))),a.createElement(sn.Ay,{disablePadding:!0,onClick:()=>d(x)},a.createElement(Bt.A,{sx:{paddingTop:"4px",paddingBottom:"4px"}},a.createElement($t.A,{primary:"Custom Range"}),a.createElement(Qn.A,null))))),"Custom Range"===c?.title&&a.createElement(Ct.A,{direction:"column",spacing:2,p:2},a.createElement("div",null,a.createElement(aa.A,{style:{display:"inline-block",boxSizing:"border-box",marginRight:"5px"}},"Start Time"),a.createElement(ia.l,{timezone:p,value:Jn().utc(c.datetime_gte||void 0),onChange:e=>d(t=>({...t,datetime_gte:e})),slotProps:{textField:{size:"small",sx:{padding:"0 15px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"200px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}}}})),a.createElement("div",null,a.createElement(aa.A,{style:{display:"inline-block",boxSizing:"border-box",marginRight:"5px"}},"End Time"),a.createElement(ia.l,{timezone:p,value:Jn().utc(c.datetime_lte||void 0),onChange:e=>d(t=>({...t,datetime_lte:e})),slotProps:{textField:{size:"small",sx:{padding:"0 15px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"200px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}}}})))),"Custom Range"===c?.title&&a.createElement(_t.A,{sx:{borderTop:"1px solid rgba(0,0,0,0.1)",textAlign:"right",p:2}},a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>{o(null)}}),a.createElement(ra,{text:"OK",color:"primary",onClick:()=>{o(null),t(c)},style:{marginLeft:"8px"}}))))};sa.propTypes={value:O().instanceOf(Object).isRequired,onChange:O().func.isRequired,type:O().string,page:O().string,disabled:O().bool};const ca=sa,da=async e=>Ye(Qe.ADMIN.userList,e),ma=async e=>Ze(`${Qe.ADMIN.userList}/`,e),pa=async(e,t)=>Je(`${Qe.ADMIN.userList}/${e}/`,t),ua=async(e,t)=>Je(`${Qe.ADMIN.userList}/${e}/`,t),ga=async(e,t)=>Je(`${Qe.PROJECT_VIEW.getOptions}/${e}/`,t),ha=async e=>Ze(Qe.ADMIN.resetPassword,e),Ea=async e=>Ye(Qe.ADMIN.groups,e);var ya=n(27629);const xa=({field:e,label:t,selected:n,options:i,onChange:l,color:r="primary"})=>{const[o,s]=(0,a.useState)(null),c=Boolean(o),[d,m]=(0,a.useState)([]);return(0,a.useEffect)(()=>{m(n)},[n]),a.createElement(E.A,{theme:I},a.createElement(y.A,{id:`${e}-select-toggle`,"aria-controls":c?`${e}-menu`:void 0,"aria-haspopup":"true","aria-expanded":c?"true":void 0,onClick:e=>s(e.currentTarget),endIcon:a.createElement(Hn.A,null),color:r,size:"small",sx:{textTransform:"none",".MuiButton-icon":{marginLeft:"0"}}},`${0!==t.length?`${t}:`:""} ${0===n.length?"All":`${n.length} User(s)`}`),a.createElement(Mt.A,{id:`${e}-menu`,anchorEl:o,open:c,dense:"true",transitionDuration:0,onClose:()=>(l(d),void s(null)),color:r,MenuListProps:{"aria-labelledby":`${e}-select-toggle`}},0!==i.length&&i.map(e=>a.createElement(jt.A,{id:`option-${e?.id||e}`,key:`option-${e?.id||e}`,onClick:()=>{return t=e?.id||e,void(d.includes(t)?m(e=>e.filter(e=>e!==t)):m(e=>[...e,t]));var t},selected:d.includes(e?.id||e)},a.createElement(ya.A,{checked:d.includes(e?.id||e),tabIndex:-1,disableRipple:!0,size:"small",sx:{padding:0,marginRight:"4px"}}),a.createElement($t.A,null,`${e?.first_name||""} ${e?.last_name||""}${e?.email?`<${e.email}>`:e||""}`)))))};xa.propTypes={field:O().string.isRequired,label:O().string.isRequired,selected:O().instanceOf(Array).isRequired,options:O().instanceOf(Array).isRequired,onChange:O().func.isRequired,color:O().string};const fa=xa,ba=({onSearch:e,type:t="consultant",styles:n,params:i=qe,disabled:l=!1,onParamsChange:r=M(),isClientView:o=!1,setIsClientView:s=M(),client:c="",onBackClicked:d=M()})=>{const u=(0,p.Zp)(),[x,f]=(0,a.useState)(""),[b,v]=(0,a.useState)({}),A=("consultant"===t?P:W).filter(e=>e.sortable),[w,C]=(0,a.useState)([]),S=A.map(e=>"creation_date"===e.id||"created_at"===e.id?{key:e.id,value:e.label,children:[{key:`-${e.id}`,value:"Newest first"},{key:e.id,value:"Oldest first"}]}:{key:e.id,value:e.label,children:[{key:e.id,value:"A-Z"},{key:`-${e.id}`,value:"Z-A"}]});return(0,a.useEffect)(()=>{const t=setTimeout(()=>{e(x)},1e3);return()=>clearTimeout(t)},[x]),(0,a.useEffect)(()=>{"myAlva"===t&&da().then(e=>{e?.results&&C(e.results)})},[t]),a.createElement(Ct.A,{spacing:1,direction:"column",sx:n},a.createElement(_t.A,{sx:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}},a.createElement("div",{style:{padding:"0 10px"}},a.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},a.createElement(vn.A,{variant:"h4",component:"h4",style:{paddingRight:"15px"}},("consultant"===t?"Consulting":"Analysis")+" Projects"),"myAlva"!==t?a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New Project",color:"primary",component:m.N_,to:("consultant"!==t?".":"")+"/new"}):a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New Project",color:"primary",onClick:()=>{const e={title:`New Analysis - ${_e(new Date)}`,description:"New Analysis",unit:"cm",unit_weight:"kg"};In(e,"MYALVA").then(e=>{e?.id&&u(`./${e.id}`)})}}))),a.createElement("div",null,a.createElement(Fn,{label:"Search",disabled:l,placeholder:`Search ${"consultant"===t?"ACID/Client/":""}Project Name`,onChange:e=>f(e.target.value),startAdornment:a.createElement(g.A,{position:"start"},a.createElement(Cn.A,null)),endAdornment:a.createElement(g.A,{position:"end"},a.createElement(h.A,{disabled:l,onClick:()=>f(""),sx:{visibility:0===x.length?"hidden":"visible"}},a.createElement(Sn.A,{fontSize:"small"}))),style:{width:"320px"},value:x}))),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{paddingLeft:"10px"}},a.createElement(Ct.A,{spacing:1,direction:"row",sx:{marginRight:"34px"},alignItems:"center"},a.createElement(z.A,{size:"small",label:"All",disabled:l,onClick:()=>r("view_by","all"),sx:{backgroundColor:"all"===i?.view_by?"rgba(255, 141, 26, 0.4)":"rgba(229, 229, 229, 0.42)",color:"all"===i?.view_by?"#000000":"#808080",borderRadius:"8px"}}),a.createElement(z.A,{size:"small",label:"Starred",disabled:l,onClick:()=>r("view_by","is_favorites"),sx:{backgroundColor:"is_favorites"===i?.view_by?"rgba(255, 141, 26, 0.4)":"rgba(229, 229, 229, 0.42)",color:"is_favorites"===i?.view_by?"#000000":"#808080",borderRadius:"8px"}}),a.createElement(z.A,{size:"small",label:"My",disabled:l,onClick:()=>r("view_by","is_my"),sx:{backgroundColor:"is_my"===i?.view_by?"rgba(255, 141, 26, 0.4)":"rgba(229, 229, 229, 0.42)",color:"is_my"===i?.view_by?"#000000":"#808080",borderRadius:"8px"}})),a.createElement(Ct.A,{spacing:1,direction:"row"},"consultant"===t?a.createElement(a.Fragment,null,a.createElement(Yn,{label:"Visibility",field:"visibility",selected:i?.visibility||"All",disabled:l,options:["All","Private","Public"],onChange:e=>r("visibility",e)}),a.createElement(Yn,{label:"Status",field:"status",selected:i?.status||"All",disabled:l,isColoredOption:!0,options:[{value:"All",color:"transparent"},...$],onChange:e=>r("status",e)}),a.createElement(Yn,{label:"Gender",field:"gender",disabled:l,selected:i?.gender||"All",options:["All","Male","Female","Male & Female"],onChange:e=>r("gender",e)})):a.createElement(fa,{label:"Created by",field:"created_by__in",onChange:e=>r("created_by__in",e),options:w,selected:i?.created_by__in||[]}),a.createElement(ca,{value:b,onChange:e=>{v(e),r("created_at__gte",e.datetime_gte),r("created_at__lte",e.datetime_lte)},type:"button",disabled:l,page:t}),a.createElement(Yn,{label:"Sort by",field:"ordering",selected:i?.ordering||("consultant"===t?"-creation_date":"-created_at"),options:S,disabled:l,onChange:e=>r("ordering",e),hasSecondLevel:!0}),"consultant"===t&&!l&&a.createElement(E.A,{theme:I},a.createElement(y.A,{id:"time-range-picker-toggle",onClick:()=>s(!o),color:"primary",variant:"outlined",size:"small",sx:{textTransform:"none",".MuiButton-icon":{marginLeft:"0"}}},`Switch to ${o?"List":"Grid"} View`)))),0!==c.length&&a.createElement(h.A,{"aria-label":"back",onClick:d,sx:{mt:1,alignSelf:"start",padding:0,"&:hover":{color:"#EC7700",backgroundColor:"transparent"}}},a.createElement(An.A,{fontSize:"small"}),a.createElement(vn.A,{variant:"body1",style:{padding:"0 2px",fontSize:"14px",fontWeight:700}},c)))};ba.propTypes={onSearch:O().func.isRequired,type:O().string,styles:O().instanceOf(Object).isRequired,params:O().instanceOf(Object),disabled:O().bool,onParamsChange:O().func,isClientView:O().bool,setIsClientView:O().func,client:O().string,onBackClicked:O().func};const va=ba;var Aa=n(78828),wa=n(96120),Ca=n(54026),Sa=n(86700),ka=n(51361),_a=n(95243),za=n(57360),Ra=n(75911),Da=n(39818),Oa=n(83272),Fa=n(12250),Ma=n(26739);const ja=(0,Ma.Ay)(Oa.A)(()=>({[`&.${Fa.A.root}`]:{color:"#544744"},[`&.${Fa.A.head}`]:{fontSize:"16px",backgroundColor:"#FFFFFF"}})),Ia=(0,Ma.Ay)(Aa.A)(()=>({height:"100px",width:"100%",borderRadius:"10px",position:"relative","&:hover":{"&::after":{content:'""',display:"block",position:"absolute",boxShadow:"0px 0px 3px 3px rgba(236, 119, 0, 0.66)",height:"calc(100% - 6px)",width:"calc(100% - 8px)",borderRadius:"10px",left:"3px",top:"3px"}},"&:nth-of-type(even)":{backgroundColor:"rgba(236, 119, 0, 0.05)"}})),Ta=({data:e,onViewMoreClicked:t,totalCount:n,listHeight:i,onProjectStarred:l,viewBy:r,hasFilterOptions:o,onProjectDelete:s})=>a.createElement(wa.A,{key:"project-list-table",id:"project-list-table",style:{backgroundColor:"#FFFFFF",color:"#544744",position:"relative",width:"auto",...i},component:"div"},a.createElement(Ca.A,{stickyHeader:!0,"aria-label":"project-list-table",component:"div"},a.createElement(Sa.A,{component:"div"},a.createElement(Aa.A,{component:"div"},a.createElement(ja,{component:"div"}," "),P.map(e=>e.display&&a.createElement(ja,{key:e.label,component:"div"},e.label)),a.createElement(ja,{component:"div"}," "))),a.createElement(ka.A,{component:"div"},0!==e.length&&e.map(e=>a.createElement(Ia,{key:e.id,component:m.N_,to:e.id,sx:{"#del-btn":{visibility:"hidden"},"&:hover":{"#del-btn":{visibility:"visible"}}}},a.createElement(ja,{align:"left",component:"div"},a.createElement(h.A,{size:"small",sx:{color:"#5F504D",zIndex:1},onClick:t=>{t.preventDefault(),l(e,!e?.is_favorites)}},e?.is_favorites?a.createElement(Da.A,{fontSize:"small"}):a.createElement(za.A,{fontSize:"small"}))),P.map(t=>t.display&&a.createElement(ja,{align:"left",key:`${t.name}-${e.acid}-${t.id}`,style:{fontWeight:"acid"===t.id||"client"===t.id?"600":"400"},component:"div"},"personnel"===t.id?((e,t)=>a.createElement("div",{style:{display:"flex",flexDirection:"column"}},G.map(n=>a.createElement("div",{key:`personel-${n.id}`,style:{display:"flex",flexDirection:"row",paddingBottom:"10px",marginRight:0}},a.createElement("div",{style:{width:"40%",minWidth:"40%",maxWidth:"40%",display:"inline-block",fontWeight:500,marginRight:"10px"}},`${n.label}:`),Y(n.id,e[n.id],"",t)))))(e,!0===e?.is_private?e?.created_by:{}):Y(t.id,e[t.id])||"N/A")),a.createElement(ja,{align:"left",component:"div"},a.createElement(h.A,{id:"del-btn",size:"small",sx:{color:"#5F504D",zIndex:588},onClick:t=>{t.preventDefault(),s(e.id,e.name)}},a.createElement(Ra.A,null)))))),0===n&&o&&a.createElement(Oa.A,{colSpan:8,rowSpan:8,sx:{padding:0}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 250px)",justifyContent:"center"}},a.createElement(vn.A,{variant:"h5"},"No Results"))),0===n&&!o&&a.createElement(Oa.A,{colSpan:8,rowSpan:8,sx:{padding:0}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 250px)",justifyContent:"center"}},a.createElement(vn.A,{variant:"h5"},`No${"is_favorites"===r?" starred":""} projects${"is_my"===r?" created by you":""}`),"is_favorites"===r?a.createElement("p",null,"Add stars to projects that you want to easily find later"):a.createElement("p",null,`Start adding${"is_my"===r?" your":""} projects by clicking the Add New Project button above`))),e.lengtha.createElement(Ct.A,{direction:"row",spacing:2,justifyContent:0!==t.length?"start":"center",alignContent:"flex-start",useFlexGap:!0,flexWrap:"wrap",sx:{m:2,overflowY:"scroll",height:"calc(100% - 92px)"}},0!==t.length&&t.map(e=>a.createElement(Ct.A,{direction:"column",sx:{p:"16px",width:"254px",height:"123px",border:"1px solid #E5E5E5",borderRadius:"8px",boxSizing:"border-box",justifyContent:"center","&:hover":{backgroundColor:"rgba(236, 119, 0, 0.04)",cursor:"pointer"}},spacing:1,key:`client-card-${e.client}`,onClick:()=>n(e.client)},a.createElement(vn.A,{variant:"h6",sx:{color:"#383838",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontSize:"14px",fontWeight:700},title:e?.client||""},e?.client||""),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(vn.A,{variant:"caption",sx:{color:"#4e5969",fontSize:"12px"}},"All Projects"),a.createElement(vn.A,{variant:"h5",sx:{fontSize:"16px"}},e?.total||0)),a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(vn.A,{variant:"caption",sx:{color:"#4e5969",fontSize:"12px"}},"Completed Projects"),a.createElement(vn.A,{variant:"h5",sx:{fontSize:"16px"}},e?.completed||0))))),0===t.length&&a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 250px)",justifyContent:"center"}},a.createElement(vn.A,{variant:"h5"},"No Results")));$a.propTypes={clientList:O().instanceOf(Array).isRequired,onClientSelect:O().func.isRequired,listHeight:O().instanceOf(Object).isRequired};const Na=$a;var qa=n(55370),La=n(85916),Pa=n(25418),Wa=n(49530),Va=n(57862);const Ha=[{key:"PROJECT_VIEW",value:"Scan Data Analysis"},{key:"MYALVA",value:"MyAlva Analysis"},{key:"COMPETITOR_VIEW",value:"Competitor Overview Analysis"}],Ga=({id:e,source:t,title:n,onClose:i})=>{const[l,r]=(0,a.useState)(!1),[o,s]=(0,a.useState)(""),c="project"===t?t:"analysis",d=e=>{s(""),r(!1),i(e)},m=(e,t,n)=>{"project"===t?(async(e,t)=>Xe(`${Qe.PROJECT_VIEW.getProjectList}/${e}`,t))(e,n).then(e=>{n?.confirmed?d(!0):e?.status?r(!0):e?.username&&s(e.username)}):Tn(e,t,n).then(e=>{n?.confirmed?d(!0):e?.status?r(!0):e?.username&&s(e.username)})};return(0,a.useEffect)(()=>{m(e,t,{})},[e,t]),a.createElement(qa.A,{onClose:()=>d(!1),open:l||0!==o.length,transitionDuration:0},a.createElement(La.A,null,`Delete ${"project"===t?Fe(t):Ha.find(e=>e.key===t).value}`),a.createElement(Pa.A,null,0!==o.length?a.createElement(Wa.A,{id:"alert-dialog-description"},"You are not authorized to delete this",` ${c}`,". To proceed, please contact the",` ${c} `,"creator at",a.createElement("b",null,` ${o}`)):a.createElement(a.Fragment,null,a.createElement(Wa.A,{id:"alert-dialog-description1"},"Are you sure to delete the",a.createElement("b",null,` "${n||""}" `),c,"?"),a.createElement(Wa.A,{id:"alert-dialog-description2"},"After deleting, you will not be able to restore the",` ${c} `,"and others won't be able to see the",` ${c} `,"in the system."))),a.createElement(Va.A,null,0!==o.length?a.createElement(ra,{text:"Ok",color:"primary",onClick:()=>d(!1)}):a.createElement(a.Fragment,null,a.createElement(ra,{text:"Cancel",color:"default",variant:"outlined",onClick:()=>d(!1)}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>m(e,t,{confirmed:!0})}))))};Ga.propTypes={id:O().string.isRequired,source:O().string.isRequired,title:O().string.isRequired,onClose:O().func.isRequired};const Ua=Ga,Ya=()=>{const[e,t]=(0,a.useState)([]),[n,i]=(0,a.useState)({view_by:"all",page:1}),[l,r]=(0,a.useState)(-1),[o,s]=(0,a.useState)(1),[c,d]=(0,a.useState)(window.scrollY),[m,p]=(0,a.useState)(!0),[u,g]=(0,a.useState)(!1),[h,E]=(0,a.useState)([]),[y,x]=(0,a.useState)(""),[f,b]=(0,a.useState)(null),v=Boolean(f),{view_by:A,page:w,search:C,ordering:S,...k}=n,_=0!==Object.keys(k).length&&!Object.values(k).includes("All"),z=()=>{Wt({...n,client_view:!0}).then(e=>{e?.data&&E(e.data)})};(0,a.useEffect)(()=>{u||x("")},[u]),(0,a.useEffect)(()=>{0!==Object.keys(n).length&&(Wt({...n,client:y}).then(a=>{if(a){if(n?.page&&n.page!==o&&1!==n.page){const i=a?.data||[];t([...e,...i]),s(n.page)}else t(a?.data||[]);r(a?.count||0)}}),z())},[n,y]);const R=()=>{const e=document.getElementById("project-list-table"),t=e.getElementsByClassName("MuiTable-root")[0].offsetHeight,n=e.offsetHeight;if(m&&t>n+500){const t=e.scrollTop;p(c>t),d(t)}else if(!m&&t>n){const t=e.scrollTop;p(c>t),d(t)}};(0,a.useEffect)(()=>{const e=document.getElementById("project-list-table");return e.addEventListener("scroll",R),()=>{e.removeEventListener("scroll",R)}});const D=m?{top:0,transition:"top 0.3s ease-out",position:"relative"}:{top:0===y.length?"-103px":"-132px",transition:"top 0.3s ease-out",position:"relative"},O=m?{top:0,transition:"top 0.3s ease-out",height:"calc(100vh - 180px)"}:{top:0===y.length?"-93px":"-122px",transition:"top 0.3s ease-out",height:"calc(100vh - 93px)"};return a.createElement(_t.A,{sx:{p:"20px",height:"calc(100vh - 100px)",position:"relative",overflowY:"hidden"}},a.createElement(va,{onSearch:e=>{i({...n,search:e,page:1}),s(1)},styles:D,params:n,disabled:0!==y.length,onParamsChange:(e,t)=>{if(n?.[e]!==t)if("All"===t){const{...t}=n;delete t[e],i({...t,page:1}),s(1)}else i(n=>({...n,[e]:t,page:1})),s(1)},isClientView:u,setIsClientView:g,client:y,onBackClicked:()=>x("")}),u&&0===y.length&&a.createElement(Na,{clientList:h,listHeight:O,onClientSelect:e=>x(e)}),a.createElement(Ba,{data:e,onViewMoreClicked:()=>{return e=o,void i({...n,page:e+1});var e},totalCount:l,listHeight:O,viewBy:A||"all",onProjectDelete:(e,t)=>b({id:e,title:t}),hasFilterOptions:_,onProjectStarred:(n,a)=>{const i={id:n.id,model_type:"ConsultantFavorites",option_type:a?"Add":"Cancel"};gn(i).then(i=>{if(!0===i?.status){const i=e.findIndex(e=>e.id===n.id);t(e=>e.toSpliced(i,1,{...n,is_favorites:a}))}})}}),v&&a.createElement(Ua,{title:f.title,id:f.id,source:"project",onClose:e=>{e&&(t(e=>e.filter(e=>e.id!==f.id)),z()),b(null)}}))};var Za=n(87788),Ja=n(46293);const Xa=({projectDetail:e})=>{const{client:t,name:n,acid:i,status:r,id:o}=e,s=(0,l.useDispatch)(),c=(0,p.Zp)(),d=(0,l.useSelector)(pe),[u,g]=(0,a.useState)({}),[h,y]=(0,a.useState)(!1),[x,f]=(0,a.useState)({});return a.createElement(_t.A,{sx:{width:"100%",padding:"0 20px",boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}},a.createElement("div",{style:{padding:"0 10px"}},a.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},a.createElement("span",{style:{width:"7px",height:"35px",backgroundColor:"#EC7700",borderRadius:"32px"}}," "),a.createElement(vn.A,{variant:"h4",component:"h4",style:{padding:" 0 15px"}},t||"Create New Consultancy Project"),r&&Y("status",r)),n&&a.createElement("span",{style:{display:"flex",paddingTop:"5px"}},a.createElement("b",{style:{marginRight:"4px"}},"Project Name:"),n)),a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"end"}},a.createElement(vn.A,{variant:"h6",component:"h6",style:{paddingRight:"15px"}},i&&`ACID: ${i}`),i?a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(zn,{startIcon:a.createElement(Ja.A,{fontSize:"small"}),text:"Report",onClick:()=>{(async e=>Ye(`${Qe.PROJECT_VIEW.pptSource}/${e}/`))(o).then(e=>{if(e?.data){const t=e.data||{};g(t),0!==Object.keys(t)?.length&&0!==Object.values(t).flat().length?y(!0):Ht(o).then(e=>{e&&c("/user-settings/downloads")})}})},color:"primary",variant:"outlined",style:{border:"none"},hoverStyle:{border:"none"}}),a.createElement(zn,{startIcon:a.createElement(Ja.A,{fontSize:"small"}),text:"Abstract",component:m.N_,target:"_blank",rel:"noreferrer",to:`${We}api/v1/project/download/${o}/`,onClick:e=>{"normal"===d&&e.preventDefault(),s(me({analysisToDownload:"normal"}))},color:"primary",variant:"outlined",style:{border:"none"},hoverStyle:{border:"none"}})):null,h&&a.createElement(qa.A,{onClose:()=>y(!1),open:h,maxWidth:"sm",fullWidth:!0},a.createElement(La.A,null,"Select Analysis for Report"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"column",spacing:2,sx:{minHeight:"300px",padding:"20px",borderRadius:"10px",border:"1px solid #E5E5E5"}},Object.keys(u).map(e=>a.createElement(Ct.A,{direction:"column",key:`${e}-analysis-select-list-container`},a.createElement(vn.A,{variant:"subtitle2",sx:{fontSize:"16px"}},Fe(e)),u[e].map(t=>a.createElement(E.A,{theme:I,key:`option-${t.id}`},a.createElement(Za.A,{control:a.createElement(ya.A,{color:"primary",checked:x[e]?.includes(t.id),onChange:()=>((e,t)=>{const n=x[e]?.includes(t);f(n?n=>({...n,[e]:n[e].filter(e=>e!==t)}):n=>({...n,[e]:[...n[e]||[],t]}))})(e,t.id),size:"small"}),label:t?.title||t?.client||t?.type,sx:{marginRight:0,span:{fontSize:"14px",padding:"5px 0 5px 10px"}}}))))))),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>y(!1)}),a.createElement(ra,{text:"Generate",color:"primary",onClick:()=>{Ht(o,x).then(e=>{e&&(y(!1),c("/user-settings/downloads"))})}})))))};Xa.propTypes={projectDetail:O().instanceOf(Object).isRequired};const Qa=Xa;var Ka=n(83992),ei=n(73514),ti=n(87714),ni=n(66704),ai=n(42162),ii=n(55415),li=n(47195),ri=n(98786);const oi=({label:e,placeholder:t="",onChange:n=M(),endAdornment:i=null,startAdornment:l=null,value:r="",style:o=qe,width:s=500,multiline:c=!1,inputProps:d=qe,onBlur:m=M(),onFocus:p=M(),disabled:u=!1,err:g=!1,rows:h=1,...E})=>a.createElement(Rn.A,{variant:"outlined",sx:{padding:"5px 15px",height:"30px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(g?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(g?"#FB4E3B":"#00000038"),width:`${s}px`,...o}},a.createElement(Dn.A,(0,kn.A)({id:`outlined-${e}`,placeholder:t,endAdornment:i,startAdornment:l,"aria-describedby":e,value:r,multiline:c,rows:h,inputProps:{"aria-label":e,...d},sx:{color:"#5F504D",fontSize:"14px","&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},"&.Mui-disabled:before":{borderBottomStyle:"hidden"}},onChange:n,onBlur:m,onFocus:p,disabled:u},E)));oi.propTypes={label:O().string.isRequired,placeholder:O().string,onChange:O().func,endAdornment:O().element,startAdornment:O().element,value:O().oneOfType([O().string,O().number]),style:O().instanceOf(Object),width:O().number,multiline:O().bool,inputProps:O().instanceOf(Object),onBlur:O().func,onFocus:O().func,disabled:O().bool,err:O().bool,rows:O().number};const si=oi;var ci=n(45549),di=n(44166);const mi=({error:e=!1,field:t="",options:n,onChange:i,value:l,required:r=!1,multiple:o=!1,onClose:s=M(),onOpen:c=M(),disabled:d=!1,placeholder:m="",width:p=300,style:g=qe,showClearIcon:y=!1,onClear:x=M()})=>a.createElement(E.A,{theme:I},a.createElement(Rn.A,{color:"primary",disabled:d,sx:y?{"#size-set-clear-btn":{visibility:"hidden"},"&:hover":{"#size-set-clear-btn":{visibility:0===l.length?"hidden":"visible"}}}:{}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},0!==t.length&&a.createElement(aa.A,{id:`${t}-select-label`,sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},`${Fe(t)}${r?"*":""}`),y&&a.createElement(h.A,{id:"size-set-clear-btn",onClick:x,sx:{width:"20px",height:"20px",marginRight:"6px"}},a.createElement(Rt.A,null,a.createElement(ci.A,{sx:{width:"20px",height:"20px"}})))),a.createElement(di.A,{value:0!==l.length||o?l:null,onChange:i,multiple:o,onClose:s,onOpen:c,options:n,disabled:d,getOptionLabel:e=>e?.value||e?.label||e||Fe(e),disableClearable:!o,size:"small",disableCloseOnSelect:o,isOptionEqualToValue:(e,t)=>t===e?.key||t===e||t?.key&&t.key===e.key,renderInput:t=>a.createElement(u.A,(0,kn.A)({},t,{autoComplete:"off",placeholder:m,label:"",sx:{padding:"0",minHeight:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(e?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(e?"#FB4E3B":"#00000038"),width:`${p}px`,boxSizing:"content-box",color:"#5F504D","&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},...g}}))}),e&&a.createElement(ti.A,null,"Please select a value in this field!")));mi.propTypes={required:O().bool,error:O().bool,field:O().string,options:O().instanceOf(Array).isRequired,onChange:O().func.isRequired,value:O().oneOfType([O().string,O().number,O().instanceOf(Array),O().instanceOf(Object)]).isRequired,multiple:O().bool,onClose:O().func,onOpen:O().func,disabled:O().bool,style:O().instanceOf(Object),width:O().number,placeholder:O().string,showClearIcon:O().bool,onClear:O().func};const pi=mi,ui=(0,n(39516).Z)(),gi=({options:e,error:t=!1,value:n,onValueChange:i,width:l=530,style:r=qe,placeholder:o=""})=>a.createElement(di.A,{value:n,onChange:(e,t)=>{"string"==typeof t?i({value:t}):t&&t.inputValue?i({value:t.inputValue}):i(t||"")},filterOptions:(t,n)=>{const a=ui(t,n),{inputValue:i}=n,l=e.some(e=>i===e.value);return""===i||l||a.push({inputValue:i,value:`Add "${i}"`}),a},selectOnFocus:!0,clearOnBlur:!0,options:e,getOptionLabel:e=>"string"==typeof e?e:e.inputValue?e.inputValue:e.value,renderOption:(e,t)=>a.createElement("li",e,t?.value||t),sx:{width:l,".MuiOutlinedInput-root":{fontSize:"14px",padding:"3px 10px"}},freeSolo:!0,renderInput:e=>a.createElement(u.A,(0,kn.A)({},e,{label:"",placeholder:o,sx:{padding:"0",height:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(t?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(t?"#FB4E3B":"#00000038"),boxSizing:"content-box",color:"#5F504D",...r,"&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"},".MuiInputBase-root":{fontSize:"14px",padding:"3px 10px"}}}))});gi.propTypes={options:O().instanceOf(Array).isRequired,error:O().bool,value:O().string.isRequired,onValueChange:O().func.isRequired,width:O().number,style:O().instanceOf(Object),placeholder:O().string};const hi=gi;Jn().extend(na()),Jn().extend(ea());const Ei=({row:e,data:t="",editMode:n,userList:i=Le,onFieldChange:l,clientOptions:r=Le,err:o=!1,projectStatus:s="Initialized",isCreator:c,privateUser:d})=>{const[m,p]=(0,a.useState)(!1),u=ve.getState().auth.currentUser.timezone||Jn().tz.guess();Jn().tz.setDefault(u);const g=()=>{p(!1)};return!("file_link"===e.id&&!e.display.includes(s))&&a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row",width:"100%",alignItems:"center",borderBottom:"description"===e.id?"none":"1px solid #ccc"}},a.createElement("span",{style:{width:"20%",padding:"15px 15px 15px 40px",fontSize:"18px",fontWeight:"500",boxSizing:"border-box",minWidth:"222px"}},"types"===e.id?a.createElement(Ct.A,{direction:"row"},e.label,a.createElement(Ka.x,{onClickAway:g},a.createElement("div",null,a.createElement(ei.A,{PopperProps:{disablePortal:!0},onClose:g,open:m,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:"If multiple types are selected, the project will only analyze measurements for the selected types and only for data that contain all the required measurements. For example, if head and hand types are selected, only data with both head and hand measurements will be analyzed. If a data only includes head measurements, it will not be analyzed."},a.createElement(h.A,{"aria-label":"info",onClick:()=>{p(!0)},size:"small",sx:{borderRadius:"30px",height:"25px",width:"25px",padding:"0"}},a.createElement(ri.A,{fontSize:"small"})))))):e.label),n?a.createElement("div",{style:{padding:"10px 0 10px 60px",borderLeft:"1px solid #ccc",minHeight:"50px",display:"flex",alignItems:"center"}},"text"===e.type&&a.createElement(Ct.A,{direction:"column",spacing:0},a.createElement(si,{label:e.id,value:t||"",onChange:t=>l(e.id,t.target.value),err:o}),"file_link"===e.id&&a.createElement(a.Fragment,null,a.createElement(ti.A,{error:o},"Required — add a Google Drive link to the final deliverables and original data used, for team reference."),o&&a.createElement(ti.A,{error:!0,sx:{lineHeight:"1"}},"Please enter a valid link"))),"autocomplete"===e.type&&a.createElement(hi,{options:r,value:t,onValueChange:t=>l(e.id,t.value),error:o,placeholder:"Select or add a new client"}),"radio-group"===e.type&&a.createElement(E.A,{theme:I},a.createElement(Rn.A,{disabled:"is_private"===e.id&&!c},a.createElement(ni.A,{row:!0,"aria-labelledby":"row-radio-buttons-group-label",name:"row-radio-buttons-group",value:t||e.options[0]?.key||e.options[0]},e.options.map(t=>a.createElement(Za.A,{key:`${e.id}-option-${t?.value||t}`,value:t?.key||t,control:a.createElement(ai.A,{onClick:()=>l(e.id,t?.key||t),color:"default"}),label:t?.value||t}))))),"radio-group-multi-select"===e.type&&a.createElement(Ct.A,{direction:"column"},a.createElement(E.A,{theme:I},a.createElement(Rn.A,{sx:{flexDirection:"row"}},q.map(n=>a.createElement(Za.A,{key:`project-type-option-${n.key}`,value:n.key,control:a.createElement(ya.A,{checked:t?.includes(n.key),onChange:()=>l(e.id,n.key),color:"default"}),label:n.value})))),a.createElement(vn.A,{variant:"caption"},"Once populations are created, project type cannot be changed.")),"datetime"===e.type&&a.createElement(Ct.A,{direction:"column",spacing:.5},a.createElement(ia.l,{value:Jn()(t||void 0).tz(u),onChange:t=>l(e.id,t?.tz(u,!0)||Jn()()),slotProps:{textField:{size:"small",sx:{padding:"0 15px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(o?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(o?"#FB4E3B":"#00000038"),width:"300px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}}}}),o&&a.createElement(ti.A,{error:!0,sx:{lineHeight:"1"}},"Close Date cannot be greater than Open Date")),"select"===e.type&&a.createElement(pi,{style:{minWidth:400},field:"",error:o,disabled:0!==Object.keys(d).length,value:0!==Object.keys(d).length?d:i.find(e=>e.key===t?.id||e.key===t?.key)||"",onChange:(t,n)=>l(e.id,n),options:"coordinator"===e.id?i.filter(e=>"Coordinator"===e.group):i}),"multi-select"===e.type&&a.createElement(pi,{style:{width:"auto",minWidth:400,maxWidth:750},field:"",multiple:!0,error:o,disabled:0!==Object.keys(d).length,value:0!==Object.keys(d).length?[d]:0!==t.length?i.filter(e=>t.map(e=>e?.id||e?.key).includes(e.key)):[],onChange:(t,n)=>l(e.id,n),options:i}),"colored-select"===e.type&&a.createElement(ii.A,{value:t,onChange:t=>l(e.id,t.target.value),renderValue:e=>e,input:a.createElement(li.A,{label:"",sx:{padding:"0",minHeight:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"400px",boxSizing:"content-box",color:"#5F504D","&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},".MuiOutlinedInput-input":{padding:"9px 14px"}}})},$.map(e=>a.createElement(jt.A,{key:e.value,value:e.value},e?.color&&a.createElement("div",{style:{width:"12px",height:"12px",backgroundColor:I.palette[e.color]?.main||"#ffffff",borderRadius:"12px",marginRight:"8px"}}," "),e.value)))):a.createElement("span",{style:{width:"80%",padding:"20px 60px",boxSizing:"border-box",borderLeft:"1px solid #ccc",minHeight:"50px",display:"flex",alignItems:"center"}},Y(e.id,t,"detail",d)))};Ei.propTypes={row:O().instanceOf(Object).isRequired,data:O().oneOfType([O().string,O().instanceOf(Array),O().instanceOf(Object)]),editMode:O().bool.isRequired,userList:O().instanceOf(Array),onFieldChange:O().func.isRequired,clientOptions:O().instanceOf(Array),err:O().bool,projectStatus:O().string,isCreator:O().bool.isRequired,privateUser:O().instanceOf(Object).isRequired};const yi=Ei;var xi=n(30016);const fi=({isLoading:e,isSingleChart:t=!1,isDQ:n=!1})=>a.createElement(xi.A,{sx:{backgroundColor:"rgba(255, 255, 255, 0.5)",color:"#EC7700",zIndex:n?1301:899,position:t?"absolute":"fixed",borderRadius:t?"10px":0},open:e},a.createElement(zt.A,{color:"inherit"}));fi.propTypes={isLoading:O().bool.isRequired,isSingleChart:O().bool,isDQ:O().bool};const bi=fi;Jn().extend(ea()),Jn().extend(na());const vi={gender:"Male",types:["BODY"],status:"Initialized",is_private:"false"},Ai=({isNew:e,projectDetail:t,toggleNew:n,userInfo:i})=>{const[r,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)([]),d=(0,l.useDispatch)(),m=(0,p.Zp)(),[u,g]=(0,a.useState)([]),[h,E]=(0,a.useState)({}),[y,x]=(0,a.useState)(!1),[f,b]=(0,a.useState)([]),v=r||e,A=t?.created_by?.id===i?.id||e,w=e?i:t.created_by,C=(v?"true"===h?.is_private:!0===t?.is_private)?{value:`${w?.first_name||""}<${w?.email||""}>`,key:w.id,...w}:{},S=ve.getState().auth.currentUser.timezone||Jn().tz.guess();Jn().tz.setDefault(S);const k=L.filter(n=>n.display.includes(v?h?.status:t?.status)||e&&"close_date"!==n.id);(0,a.useEffect)(()=>{v&&(x(!0),da({page_size:500}).then(e=>{const t=0!==e?.results?.length?e.results.map(e=>({value:`${e?.first_name||""}<${e?.email||""}>`,key:e.id,group:e.group})):[];c(t),x(!1)}),Vt().then(e=>{const t=0!==e?.data?.length?e.data.map(e=>({value:e.value,key:e.id})):[];g(t)}))},[v]),(0,a.useEffect)(()=>{E(e?vi:{...t,is_private:`${t.is_private}`})},[t,e]);const _=(e,t)=>{if(f.includes(e))if("creation_date"===e||"close_date"===e){const e=f.filter(e=>!("creation_date"===e||"close_date"===e));b(e)}else{const t=f.filter(t=>!(t===e));b(t)}else if("status"===e&&"Cancelled"!==t&&"Completed"!==t){const e=f.filter(e=>!("creation_date"===e||"close_date"===e));b(e)}if("status"===e&&"Result Submitted"!==t&&"Completed"!==t){b(e=>e.filter(e=>"file_link"!==e));const n={...h,[e]:t,file_link:""};E(n)}else if("types"===e){const n=h?.[e]||[],a=n.includes(t)?n.filter(e=>e!==t):[...n,t];E(e=>({...e,types:a}))}else{const n={...h,[e]:t};E(n)}};return a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column",padding:"0 20px 10px",alignItems:"end",boxSizing:"content-box"}},k.map(e=>a.createElement(yi,{key:`detail-${e.id}`,row:e,err:f.includes(e.id),data:v?h?.[e.id]:t?.[e.id],editMode:v,userList:s,onFieldChange:_,clientOptions:u,isCreator:A,privateUser:C,projectStatus:v?h?.status:t?.status||"Initialized"})),0!==f.length&&a.createElement(vn.A,{component:"span",variant:"body1",sx:{color:"#FB4E3B"}},"* Please input all the required fields!"),v?a.createElement(Ct.A,{spacing:1,flexDirection:"row",useFlexGap:!0},a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>{e&&m("../"),E(t),o(!1)},style:{width:"80px",float:"right"}}),a.createElement(ra,{text:"Save",color:"primary",disabled:0!==f.length,onClick:()=>{const a=(()=>{let e=[];if(h?.acid&&""!==h.acid||(e=[...e,"acid"]),h?.client&&""!==h.client||(e=[...e,"client"]),h?.name&&""!==h.name||(e=[...e,"name"]),"false"!==h.is_private||h?.coordinator||(e=[...e,"coordinator"]),"false"!==h.is_private||h?.consulting_coordinator||(e=[...e,"consulting_coordinator"]),"false"!==h.is_private||h?.consulting_support||(e=[...e,"consulting_support"]),"false"!==h.is_private||h?.consultants&&0!==h.consultants.length||(e=[...e,"consultants"]),"Result Submitted"!==h?.status&&"Completed"!==h?.status||/^(https?:\/\/)?(www\.)?(drive|docs)\.google\.com\/([a-zA-Z0-9_-]+)/.test(h?.file_link||"")||(e=[...e,"file_link"]),"Cancelled"===h?.status||"Completed"===h?.status){const n=h?.close_date||t?.close_date||Jn().utc(new Date);Jn()(h.creation_date).isAfter(Jn()(n))&&(e=[...e,"creation_date","close_date"])}return e})();0===a.length?(a=>{const i={...a,coordinator:e&&"true"===a.is_private?C.id:a.coordinator.id||a.coordinator.key,consulting_coordinator:e&&"true"===a.is_private?C.id:a.consulting_coordinator.id||a.consulting_coordinator.key,consulting_support:e&&"true"===a.is_private?C.id:a.consulting_support.id||a.consulting_support.key,consultants:e&&"true"===a.is_private?[C.id]:a.consultants.map(e=>e.id||e.key)};"Cancelled"!==h?.status&&"Completed"!==h?.status||void 0!==h?.close_date||(i.close_date=t?.close_date||Jn().utc(new Date)),void 0===h?.creation_date&&(i.creation_date=t?.creation_date||Jn().utc(new Date)),e?(async e=>Ze(Qe.PROJECT_VIEW.getProjectList,e))(i).then(e=>{if(e?.id){const{id:t}=e;return o(!1),n(!1),m(`../${t}`)}return null}):(async(e,t)=>Je(`${Qe.PROJECT_VIEW.getProjectList}/${e}/`,t))(t.id,i).then(e=>{e&&(E(e||{}),o(!1),d(oe(e)))})})(h):b(a)},style:{width:"80px",marginRight:"15px",float:"right"}})):a.createElement(ra,{text:"Edit",color:"primary",onClick:()=>{o(!0)},style:{width:"80px",marginRight:"15px",float:"right"}}),a.createElement(bi,{isLoading:y}))};Ai.propTypes={projectDetail:O().instanceOf(Object).isRequired,isNew:O().bool.isRequired,toggleNew:O().func.isRequired,userInfo:O().instanceOf(Object).isRequired};const wi=Ai;var Ci=n(56584),Si=n(63518);const ki=({data:e,actionType:t,onDetailClosed:n})=>a.createElement(_t.A,{sx:{width:"550px",border:"1px solid",borderColor:"divider",boxSizing:"border-box",position:"fixed",minHeight:"200px",maxHeight:"350px",overflowY:"auto"}},a.createElement("div",{style:{height:"21px",padding:"10px",backgroundColor:"#F2F2F2",color:"#A0A0A0",display:"flex",justifyContent:"space-between"}},a.createElement("span",null,"Difference Detail"),a.createElement(h.A,{size:"small",onClick:n,sx:{"&:hover":{backgroundColor:"transparent"}}},a.createElement(Si.A,null))),0!==Object.keys(e).length?Object.keys(e).map(n=>a.createElement(Ct.A,{spacing:2,direction:"row",justifyContent:"space-between",key:`diff-${n}`,sx:{margin:"5px"}},a.createElement(vn.A,{variant:"body2",component:"p",sx:{width:"20%",overflowWrap:"break-word"}},`${Fe(n)}:`),"Update"===t&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"body2",component:"p",sx:{width:"40%",overflowWrap:"break-word"}},null===e[n].before?"None":Be(e[n].before)),a.createElement(vn.A,{variant:"body2",component:"p"},"=>")),a.createElement(vn.A,{variant:"body2",component:"p",sx:{color:null===e[n].new?"#FB4E3B":"#5F504D",textAlign:"left",width:"Update"===t?"40%":"75%",overflowWrap:"break-word"}},null===e[n].new?"Removed":Be(e[n].new)))):a.createElement("div",{style:{margin:"20px"}},"No Detail Avaliable"));ki.propTypes={data:O().instanceOf(Object).isRequired,actionType:O().string.isRequired,onDetailClosed:O().func.isRequired};const _i=ki,zi=()=>a.createElement(E.A,{theme:I},a.createElement(zt.A,{color:"primary",sz:{zIndex:1199}})),Ri=()=>a.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"100px"}},a.createElement(zi,null),a.createElement(_t.A,{sx:{mt:"10px"}},"Loading")),Di=({data:e})=>{const[t,n]=(0,a.useState)({}),[i,l]=(0,a.useState)(""),r="Update"===i||"Create"===i,o=[{field:"created_at",headerName:"Time",width:150,display:"flex",valueGetter:e=>new Date(e).toLocaleString("zh-cn",{...Se,timeZone:ve.getState().auth.currentUser.timezone||void 0}).replaceAll("/","-")},{field:"action_user",headerName:"Username",display:"flex",width:100},{field:"action_type",headerName:"Action",width:100,display:"flex",valueGetter:e=>"Download"===e?`${e}ed`:`${e}d`},{field:"path",headerName:"Location",display:"flex",width:800,valueGetter:e=>e.filter(e=>"Project"!==e.module).map(e=>Object.values(e).join(" -> ")).join(" -> ")}];return a.createElement(Ct.A,{spacing:2,direction:"row"},a.createElement(_t.A,{sx:{width:r?"calc(100% - 566px)":"100%"}},a.createElement(Ci.z,{autoHeight:!0,columns:o,rows:e,slots:{noRowsOverlay:Ri},onRowClick:e=>{const{row:t}=e;l(t.action_type),n(t.diff||{})},sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},".MuiDataGrid-cell:focus-within":{outline:"none"},".MuiDataGrid-row":{cursor:"pointer"},".MuiDataGrid-row.Mui-selected, .MuiDataGrid-row.Mui-selected:hover":{backgroundColor:"rgba(236, 119, 0, 0.2)"}}})),a.createElement(_t.A,{sx:{width:"550px"}},r&&a.createElement(_i,{data:t,actionType:i,onDetailClosed:()=>{l(""),n({})}})))};Di.propTypes={data:O().instanceOf(Array).isRequired};const Oi=Di,Fi=()=>{const e=(0,p.zy)().pathname.split("/")[1],[t,n]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async e=>Ye(Qe.PROJECT_VIEW.getProjectHistory,e))({own_obj_id:e,page_size:999}).then(e=>{n(e?.data||[])})},[e]),a.createElement(_t.A,{sx:{padding:"0 40px 20px"}},a.createElement(Oi,{data:t}))},Mi=e=>{const{children:t,tabNum:n,index:i,...l}=e;return a.createElement("div",(0,kn.A)({role:"tabpanel",hidden:n!==i,id:`simple-tabpanel-${i}`,"aria-labelledby":`simple-tab-${i}`,style:{height:"calc(100% - 158px)",padding:"10px"}},l),n===i&&a.createElement(_t.A,{sx:{height:"100%",width:"100%"}},t))};Mi.propTypes={children:O().node.isRequired,index:O().number.isRequired,tabNum:O().number.isRequired};const ji=Mi,Ii={width:"20%",borderRadius:"10px 10px 0 0",textTransform:"none",padding:"8px 16px",minHeight:"40px","&.Mui-selected":{backgroundColor:"#EEEEEE"},"&:hover":{color:"#EC7700"}},Ti={width:"100%",justifyContent:"center",fontSize:"14px"},Bi=()=>{const e=(0,l.useSelector)(C),[t,n]=(0,a.useState)({}),i=(0,l.useDispatch)(),[r,o]=(0,a.useState)(null),[s,c]=(0,a.useState)(!1),[u,g]=(0,a.useState)(0),h=Boolean(r),y=(0,p.zy)(),x=y.pathname.split("/")[1],f=.2*(.95*document.body.clientWidth-40),b=(0,l.useSelector)(se),v=e?.permissions||[],A=e=>{for(let t=0;t{"new"===x?c(!0):b?.id===x?n(b||{}):(async e=>Ye(`${Qe.PROJECT_VIEW.getProjectList}/${e}/`))(x).then(e=>{n(e||{}),i(oe(e||{})),S&&g(0),w&&g(1),k&&g(2)})},[x,b]);const _=e=>{o(e.currentTarget)},z=e=>{o(null),g(e)};return a.createElement(_t.A,{sx:{padding:"16px 0",height:"calc(100% - 64px)",display:"flex",flexDirection:"column",overflow:"hidden"}},0!==Object.keys(t).length||s?a.createElement(a.Fragment,null,a.createElement(Qa,{projectDetail:t}),a.createElement(E.A,{theme:I},a.createElement(St.A,{color:"primary",value:u,onChange:(e,t)=>{1===t?_(e):g(t)},"aria-label":"basic tabs",sx:{margin:"16px 20px 0",borderBottom:"1px solid #CBCBCB",minHeight:"40px"}},v.includes("project_details")&&a.createElement(kt.A,{label:"Project Details",component:m.N_,to:"./",sx:Ii}),v.includes("analysis_details")&&a.createElement(kt.A,{label:"Analysis Details",disabled:s,onClick:e=>_(e),sx:Ii}),v.includes("project_history")&&a.createElement(kt.A,{label:"Project History",disabled:s,component:m.N_,to:"./history",sx:Ii}))),a.createElement(Mt.A,{id:"basic-menu",anchorEl:r,open:h,onClose:()=>z(u),sx:{".MuiMenu-paper":{width:f},".MuiMenu-list":{width:"100%"}}},v.includes("scan_data_analysis")&&a.createElement(jt.A,{component:m.N_,to:"./scans",onClick:()=>z(1),sx:Ti},"Scan Data Analysis"),v.includes("competitor_overview_analysis")&&a.createElement(jt.A,{component:m.N_,to:"./overview",onClick:()=>z(1),sx:Ti},"Competitor Overview Analysis"),v.includes("sales_by_size_analysis")&&a.createElement(jt.A,{component:m.N_,to:"./sbs",onClick:()=>z(1),sx:Ti},"Sales By Size Analysis")),a.createElement(ji,{tabNum:u,index:0},a.createElement(wi,{isNew:s,projectDetail:t,toggleNew:e=>c(e),userInfo:e})),a.createElement(ji,{tabNum:u,index:1},a.createElement(p.sv,null)),a.createElement(ji,{tabNum:u,index:2},a.createElement(Fi,null))):a.createElement(bi,{isLoading:!0}))},$i=()=>a.createElement(p.sv,null),Ni=()=>a.createElement(p.sv,null);var qi=n(49565),Li=n(82139),Pi=n(29608),Wi=n(28964);const Vi=({type:e,data:t,onChartDel:n,onChartEdit:i,isEditMode:l})=>{const[r,o]=(0,a.useState)({}),[s,c]=(0,a.useState)(!1),d=t?.config?.title||"",[m,p]=(0,a.useState)(!1),u=r?.id?`${We}api/v1/deliverables/preview/${r.id}/${Oe({type:"sbs",is_thumbnail:"T"})}`:"",g=r?.id?`${We}api/v1/deliverables/preview/${r.id}/${Oe({type:"sbs",is_thumbnail:"F"})}`:"",E=r?.result_thumbnail?r.result_thumbnail.split("/").at(-1):"";return(0,a.useEffect)(()=>{o(t)},[t]),a.createElement(_t.A,{sx:{padding:"20px",margin:"10px 5px 0",borderRadius:"10px",backgroundColor:"#FFFFFF",boxShadow:"0px 0px 6px #00000029",display:"flex",flexDirection:"column",alignItems:"start",boxSizing:"content-box",justifyContent:"space-between"},onClick:l?i:M()},a.createElement(Ct.A,{spacing:1,direction:"row-reverse",sx:{width:"100%"}},a.createElement(ei.A,{title:"Delete",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{onClick:()=>p(!0)},a.createElement(Li.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Edit",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{onClick:i},a.createElement(Pi.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Zoom In",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{onClick:()=>c(!0)},a.createElement(Wi.A,{fontSize:"small"})))),a.createElement(Ct.A,{spacing:1,direction:"row"},0===u.length?a.createElement("div",{style:{height:"300px",width:"500px",backgroundColor:"#FFFFFF",display:"flex",justifyContent:"center",alignItems:"center"}},a.createElement(zi,null)):a.createElement("img",{alt:`sbs-${e}-${d}`,src:`${u}?${E}`,loading:"lazy",style:{height:"300px",width:"500px"}})),s&&a.createElement(qa.A,{open:s,onClose:()=>c(!1),fullScreen:!0,sx:{display:"flex",justifyContent:"center",height:"auto",".MuiPaper-root":{height:"auto"}}},a.createElement("img",{alt:`sbs-${e}-${d}-large`,src:g,style:{maxWidth:"90vw"}})),a.createElement(qa.A,{onClose:()=>p(!1),open:m},a.createElement(La.A,null,"Please Confirm"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},`Are you sure to delete this ${e} chart?`)),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>p(!1)}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{(async e=>Xe(`${Qe.PROJECT_VIEW.sbsDeliverables}/${e}/`))(t.id).then(e=>{e?.status&&n()}),p(!1)}}))),a.createElement(bi,{isSingleChart:!0}))};Vi.propTypes={type:O().string.isRequired,data:O().instanceOf(Object).isRequired,onChartDel:O().func.isRequired,onChartEdit:O().func.isRequired,isEditMode:O().bool.isRequired};const Hi=Vi,Gi=e=>{const t=e.map(e=>e.level_order.split(",")).flat();return Array.from(new Set(t))},Ui=(e,t)=>t.reduce((t,n)=>{const a=Array.from(new Set(e.map(e=>e?.[n]?e[n]:"").filter(e=>""!==e)));return a.length>1&&(t[n]=a),t},{}),Yi=new Array(26).fill(1).map((e,t)=>String.fromCharCode("A".charCodeAt(0)+t)),Zi=e=>e.map(e=>Object.fromEntries(Yi.map((t,n)=>[` ${t}`,e[n]]))),Ji=e=>e.toLowerCase().split(" ").join("_").split("-").join("_"),Xi=[{id:"sub_brand",label:"Sub-Brand",type:"autocomplete",required:!1},{id:"gender",label:"Gender*",type:"autocomplete",options:["Female","Male","Youth"],required:!0},{id:"data_type",label:"Data Type*",type:"select",options:["Percentage","Exact Value"],required:!0},{id:"size_type",label:"Size Type*",type:"select",options:["Alpha","Numeric"],required:!0},{id:"last_modified",label:"Last Modified*",type:"datetime",required:!0},{id:"tags",label:"Tags",type:"text",required:!1},{id:"size_order",label:"Size Order*",type:"text",placeholder:"e.g. XS, S, M, L, XL, or 0, 2, 4, 6, 8, 10",required:!0},{id:"additional_remarks",label:"Additional Remarks",type:"text",required:!1}];var Qi=n(87331),Ki=n(84013),el=n(63410),tl=n(6196);const nl=({isActive:e})=>a.createElement(tl.A,null,a.createElement("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},a.createElement("g",{id:"Group_1823"},a.createElement("g",{id:"Rectangle_183-8"},a.createElement("rect",{fill:e?"#fae3cc":"#fff",width:"28",height:"28"}),a.createElement("rect",{fill:"none",stroke:e?"#ea7824":"#dcdbdb",x:".5",y:".5",width:"26",height:"26"}))),a.createElement("g",{id:"F-2"},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M16.84,9.6v1.47h-3.78v2.33h2.9v1.44h-2.9v3.83h-1.82v-9.07h5.6Z"})))));nl.propTypes={isActive:O().bool.isRequired};const al=nl,il=({isActive:e})=>a.createElement(tl.A,null,a.createElement("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},a.createElement("g",{id:"Group_1822"},a.createElement("g",{id:"Rectangle_183-2"},a.createElement("rect",{fill:e?"#fae3cc":"#fff",width:"28",height:"28"}),a.createElement("rect",{fill:"none",stroke:e?"#ea7824":"#dcdbdb",x:".5",y:".5",width:"26",height:"26"}))),a.createElement("g",null,a.createElement("g",{id:"S",style:{isolation:"isolate"}},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("rect",{fill:"none",x:"2.18",y:"1.52",width:"7.09",height:"9.99"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M4.14,10.68c-.43-.18-.77-.45-1.02-.79-.25-.34-.38-.75-.38-1.22h1.65c.02.32.13.56.34.75s.48.27.83.27.64-.09.85-.26c.21-.17.31-.4.31-.68,0-.23-.07-.41-.21-.56-.14-.15-.31-.26-.52-.35s-.5-.18-.86-.28c-.5-.15-.9-.29-1.22-.43-.31-.14-.58-.36-.8-.65s-.34-.68-.34-1.16c0-.46.11-.85.34-1.19.23-.34.55-.6.96-.78s.88-.27,1.41-.27c.79,0,1.44.19,1.93.58.49.39.77.92.82,1.61h-1.69c-.02-.26-.13-.48-.34-.66-.21-.17-.49-.26-.83-.26-.3,0-.54.08-.72.23-.18.15-.27.38-.27.67,0,.21.07.38.2.51s.3.25.51.33.49.18.85.29c.5.15.91.29,1.22.44.31.15.59.37.81.66.23.29.34.68.34,1.16,0,.41-.11.79-.32,1.14-.21.35-.52.63-.94.84s-.9.31-1.46.31-1.02-.09-1.45-.28Z"}))),a.createElement("g",{id:"M-3",style:{isolation:"isolate"}},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("rect",{fill:"none",x:"8.99",y:"9.23",width:"10.15",height:"10.22"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M18.12,10.91v7.68h-1.54v-4.99l-2.06,4.99h-1.17l-2.07-4.99v4.99h-1.54v-7.68h1.75l2.44,5.71,2.44-5.71h1.74Z"}))),a.createElement("g",{id:"L",style:{isolation:"isolate"}},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("rect",{fill:"none",x:"20.38",y:"16.06",width:"5.77",height:"10.42"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M22.68,24.19h2.53v1.22h-4.07v-7.68h1.54v6.46Z"}))))));il.propTypes={isActive:O().bool.isRequired};const ll=il,rl=({isActive:e})=>a.createElement(tl.A,null,a.createElement("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},a.createElement("g",{id:"Group_1822"},a.createElement("g",{id:"Rectangle_183-2"},a.createElement("rect",{fill:e?"#fae3cc":"#fff",width:"28",height:"28"}),a.createElement("rect",{fill:"none",stroke:e?"#ea7824":"#dcdbdb",x:".5",y:".5",width:"26",height:"26"}))),a.createElement("g",{id:"_2",style:{isolation:"isolate"}},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("rect",{fill:"none",x:"8.41",y:"7.78",width:"11.17",height:"12.44"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M9.47,10.14c.39-.37.88-.56,1.49-.56s1.1.19,1.49.56c.39.37.58.89.58,1.55s-.19,1.19-.58,1.56c-.39.37-.88.56-1.49.56s-1.1-.19-1.49-.56c-.39-.37-.58-.89-.58-1.56s.19-1.17.58-1.55ZM10.23,11.69c0,.69.24,1.03.72,1.03.23,0,.42-.08.55-.25.13-.17.19-.43.19-.77,0-.68-.25-1.01-.74-1.01s-.72.34-.72,1.01ZM17.24,9.74l-5.11,9.1h-1.77l5.1-9.1h1.78ZM15.18,15.32c.39-.37.88-.55,1.49-.55s1.1.18,1.48.55.57.89.57,1.55-.19,1.19-.57,1.56c-.38.37-.87.56-1.48.56s-1.11-.19-1.5-.56c-.38-.37-.57-.89-.57-1.56s.19-1.19.58-1.55ZM15.92,16.87c0,.68.25,1.03.74,1.03s.73-.34.73-1.03-.24-1.01-.73-1.01-.74.34-.74,1.01Z"})))));rl.propTypes={isActive:O().bool.isRequired};const ol=rl,sl=({isActive:e})=>a.createElement(tl.A,null,a.createElement("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},a.createElement("g",{id:"Group_1823"},a.createElement("g",{id:"Rectangle_183-8"},a.createElement("rect",{fill:e?"#fae3cc":"#fff",width:"28",height:"28"}),a.createElement("rect",{fill:"none",stroke:e?"#ea7824":"#dcdbdb",x:".5",y:".5",width:"26",height:"26"}))),a.createElement("g",{id:"F-2"},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M18.82,9.37v9.07h-1.82v-5.9l-2.43,5.9h-1.38l-2.44-5.9v5.9h-1.82v-9.07h2.07l2.89,6.75,2.89-6.75h2.05Z"})))));sl.propTypes={isActive:O().bool.isRequired};const cl=sl,dl=({isActive:e})=>a.createElement(tl.A,null,a.createElement("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},a.createElement("g",{id:"Group_1822"},a.createElement("g",{id:"Rectangle_183-2"},a.createElement("rect",{fill:e?"#fae3cc":"#fff",width:"28",height:"28"}),a.createElement("rect",{fill:"none",stroke:e?"#ea7824":"#dcdbdb",x:".5",y:".5",width:"26",height:"26"}))),a.createElement("g",null,a.createElement("g",{id:"S",style:{isolation:"isolate"}},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("rect",{fill:"none",x:"2.8",y:"2.14",width:"7.32",height:"9.99"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M4.07,4.4c.46-.72,1.22-1.08,2.28-1.08s1.82.36,2.28,1.08.69,1.71.69,2.98-.23,2.28-.69,3c-.46.73-1.22,1.09-2.28,1.09s-1.82-.36-2.28-1.09c-.46-.73-.69-1.73-.69-3s.23-2.26.69-2.98ZM7.7,6.01c-.07-.37-.21-.67-.42-.91-.21-.24-.52-.35-.93-.35s-.72.12-.93.35c-.21.23-.35.54-.42.91-.07.37-.1.83-.1,1.37s.03,1.03.1,1.4c.07.38.21.68.42.91.21.23.52.35.94.35s.72-.12.93-.35c.21-.23.35-.54.42-.91.07-.38.1-.84.1-1.4s-.03-1-.1-1.37Z"}))),a.createElement("g",{id:"M-3",style:{isolation:"isolate"}},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("rect",{fill:"none",x:"11.34",y:"8.51",width:"6.33",height:"10.22"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M12.41,16.13c.7-.59,1.27-1.08,1.68-1.47.42-.39.77-.8,1.04-1.23.28-.43.42-.84.42-1.25,0-.37-.09-.67-.26-.88-.18-.21-.45-.32-.81-.32s-.65.12-.85.37c-.2.25-.3.58-.31,1.01h-1.5c.03-.88.29-1.55.79-2,.5-.46,1.12-.68,1.89-.68.84,0,1.48.22,1.92.67s.67,1.03.67,1.75c0,.57-.15,1.12-.46,1.64s-.66.97-1.06,1.36-.91.85-1.55,1.39h3.25v1.28h-5.43v-1.14l.57-.48Z"}))),a.createElement("g",{id:"L",style:{isolation:"isolate"}},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("rect",{fill:"none",x:"18.12",y:"16",width:"7.53",height:"9.86"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M18.63,23.8v-1.21l3.6-5.15h1.79v5.02h.97v1.34h-.97v1.56h-1.54v-1.56h-3.85ZM22.58,19.09l-2.25,3.37h2.25v-3.37Z"}))))));dl.propTypes={isActive:O().bool.isRequired};const ml=dl,pl=({isActive:e})=>a.createElement(tl.A,null,a.createElement("svg",{id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},a.createElement("g",{id:"Group_1822"},a.createElement("g",{id:"Rectangle_183-2"},a.createElement("rect",{fill:e?"#fae3cc":"#fff",width:"28",height:"28"}),a.createElement("rect",{fill:"none",stroke:e?"#ea7824":"#dcdbdb",x:".5",y:".5",width:"26",height:"26"}))),a.createElement("g",{id:"_123-2",style:{isolation:"isolate"}},a.createElement("g",{style:{isolation:"isolate"}},a.createElement("rect",{fill:"none",x:"4.31",y:"7.87",width:"21.35",height:"12.25"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M4.77,11.13v-1.68h3.13v9.48h-1.87v-7.8h-1.26Z"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M10.27,16.88c.83-.69,1.49-1.27,1.99-1.74.49-.46.91-.95,1.23-1.45.33-.5.49-1,.49-1.48,0-.44-.1-.79-.31-1.04-.21-.25-.53-.38-.96-.38s-.77.14-1,.44c-.23.29-.36.69-.36,1.19h-1.77c.03-1.04.34-1.83.93-2.37s1.33-.81,2.23-.81c.99,0,1.75.26,2.27.79s.79,1.22.79,2.07c0,.68-.18,1.32-.55,1.94-.36.62-.78,1.15-1.25,1.61-.47.46-1.08,1-1.83,1.64h3.83v1.51h-6.42v-1.35l.68-.57Z"}),a.createElement("path",{fill:e?"#ea7824":"#a09f9f",d:"M18.1,9.94c.57-.47,1.31-.71,2.24-.71.63,0,1.17.11,1.62.33.45.22.79.52,1.02.9.23.38.34.8.34,1.28,0,.55-.14,1.01-.42,1.38s-.62.63-1.01.76v.05c.5.16.89.43,1.18.83s.42.91.42,1.53c0,.52-.12.98-.36,1.39-.24.41-.59.73-1.05.96-.46.23-1.02.34-1.67.34-.98,0-1.78-.25-2.39-.74-.62-.49-.94-1.22-.98-2.18h1.77c.02.42.16.77.44,1.02.27.26.65.38,1.12.38.44,0,.78-.12,1.02-.37.24-.25.36-.57.36-.96,0-.52-.16-.89-.49-1.12-.33-.22-.84-.34-1.53-.34h-.38v-1.5h.38c1.23,0,1.85-.41,1.85-1.23,0-.37-.11-.66-.33-.87-.22-.21-.54-.31-.96-.31s-.72.11-.94.33c-.22.22-.35.5-.38.84h-1.78c.04-.87.35-1.54.92-2.01Z"})))));pl.propTypes={isActive:O().bool.isRequired};const ul=pl,gl=({data:e,onSelectionModelChange:t=M(),selectionModel:n=Le,columns:i,type:r,selectedBasicsOptions:o=Le,selectedComparisonOptions:s=Le})=>{const[c,d]=(0,a.useState)({}),[m,u]=(0,a.useState)(""),g=(0,p.Zp)(),h=(0,l.useDispatch)(),E=Array.from(new Set([...o,...s]));(0,a.useEffect)(()=>{d(e?.[0]||{})},[e]);const y=t=>e.find(e=>e.id===t)?.group?.group_id,x={field:"status",headerName:"In Use",width:70,display:"flex",align:"center",disableColumnMenu:!0,sortable:!1,renderCell:e=>a.createElement("div",null,E.includes(e.id)?a.createElement(el.A,{sx:{color:"#1AA464"}}):null)},f={field:"types",headerName:"Types",width:100,display:"flex",align:"center",disableColumnMenu:!0,sortable:!1,renderCell:e=>a.createElement(Ct.A,{spacing:0,direction:"column",m:.5},a.createElement(Ct.A,{spacing:1,direction:"row"},a.createElement(ei.A,{title:"Female",disableFocusListener:!0,disableTouchListener:!0},a.createElement(Rt.A,null,a.createElement(al,{isActive:"Female"===e.row.gender}))),a.createElement(ei.A,{title:"Alpha",disableFocusListener:!0,disableTouchListener:!0},a.createElement(Rt.A,null,a.createElement(ll,{isActive:"Alpha"===e.row.size_type}))),a.createElement(ei.A,{title:"Percentage",disableFocusListener:!0,disableTouchListener:!0},a.createElement(Rt.A,null,a.createElement(ol,{isActive:"Percentage"===e.row.type})))),a.createElement(Ct.A,{spacing:1,direction:"row"},a.createElement(ei.A,{title:"Male",disableFocusListener:!0,disableTouchListener:!0},a.createElement(Rt.A,null,a.createElement(cl,{isActive:"Male"===e.row.gender}))),a.createElement(ei.A,{title:"Numeric",disableFocusListener:!0,disableTouchListener:!0},a.createElement(Rt.A,null,a.createElement(ml,{isActive:"Numeric"===e.row.size_type}))),a.createElement(ei.A,{title:"Exact Value",disableFocusListener:!0,disableTouchListener:!0},a.createElement(Rt.A,null,a.createElement(ul,{isActive:"Exact Value"===e.row.type})))))},b=[{field:"group",headerName:"Sheet Name",flex:1,display:"flex",disableColumnMenu:!0,valueGetter:t=>t?.sheet_name?`${t.sheet_name}-${((t,n)=>{const a=e.filter(e=>e?.group?.sheet_name===t).map(e=>e?.group);return Array.from(new Set(a.map(e=>e.timestamp))).sort().findIndex(e=>e===n)+1})(t.sheet_name,t.timestamp)}`:"/"},{field:"actions",type:"actions",headerName:"Actions",width:100,display:"flex",cellClassName:"actions",headerAlign:"left",align:"center",sortable:!1,disableColumnMenu:!0,getActions:({id:e,row:t})=>[a.createElement(Qi.Z,{icon:a.createElement(Pi.A,null),label:"Edit",key:"edit-icon",onClick:()=>(e=>{const t=y(e);g(`./edit/${t}`)})(e),color:"inherit"}),a.createElement(Qi.Z,{icon:a.createElement(Ki.A,null),label:"Delete",key:"del-icon",onClick:()=>(e=>{u(e)})(e),color:"inherit"})]}];return a.createElement(a.Fragment,null,"edit"===r&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"caption",sx:{fontSize:"1rem",display:"block"}},"* Edit button will brings you to sheet edit page when no data from the same sheet is used to create chart. Otherwise, only data size value edit is available."),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"1rem",display:"block"}},"* If no data in the same sheet is used to create chart, delete sheet option is available to choose when delete comfirmation pops up."),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"1rem",display:"block"}},"* If data is used to create chart, both Edit and Delete button will be disabled.")),a.createElement(Ct.A,{spacing:2,direction:"row",sx:{marginTop:"edit"===r?0:2}},a.createElement(Ci.z,{autoHeight:!0,columns:"edit"===r?[x,f,...i,...b]:[f,...i],rows:e,checkboxSelection:"edit"!==r,disableColumnFilter:!0,onRowSelectionModelChange:t,rowSelectionModel:n,isRowSelectable:e=>n.includes(e.id)||"basic"===r&&!o.includes(e.id)||"comparison"===r&&n.length<5,disableRowSelectionOnClick:!0,onRowClick:e=>{d(e.row)},getRowHeight:()=>"auto",getRowClassName:e=>e.id===c.id?"highlightedRow":n.includes(e.id)?"selectedRow":"",sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},".MuiDataGrid-cell:focus-within":{outline:"none"},".MuiButtonBase-root":{"&.Mui-checked":{color:"#EC7700"},"&:hover":{backgroundColor:"transparent"}},".selectedRow":{backgroundColor:"rgba(236, 119, 0, 0.2) !important"},".highlightedRow":{backgroundColor:"rgba(236, 119, 0, 0.08) !important"},"& .MuiDataGrid-columnHeaderCheckbox .MuiDataGrid-columnHeaderTitleContainer":{display:"basic"===r?"inline-flex":"none"}}}),a.createElement(_t.A,{sx:{width:"200px"}},a.createElement(wa.A,{key:`table-${c.id}`},a.createElement(Ca.A,{"aria-label":"simple table",sx:{border:"1px solid #E0E0E0"}},a.createElement(Sa.A,null,a.createElement(Aa.A,null,a.createElement(Oa.A,{align:"center",key:"Size"},"Size"),a.createElement(Oa.A,{align:"center",key:"Value"},"Value"))),a.createElement(ka.A,null,Object.entries(c?.size_value||{}).map(e=>{return a.createElement(Aa.A,{key:e[0]},a.createElement(Oa.A,{align:"center",key:`cell-${e[0]}`},e[0]),a.createElement(Oa.A,{align:"center",key:`cell-${e[1]}`},("Percentage"===c.type?(t=e[1])?100*t+"%":void 0:e[1])||"/"));var t})))))),a.createElement(qa.A,{onClose:()=>u(""),open:m.length>0},a.createElement(La.A,null,"Please Confirm"),a.createElement(Pa.A,null,a.createElement("p",null,"Are you sure to delete this SBS data?"),E.includes(m)&&a.createElement("p",null,"This record is used to create chart!"),!(t=>{const n=y(t);return!e.filter(e=>e?.group?.group_id===n&&void 0!==n).map(e=>e.id).some(e=>E.includes(e))&&void 0!==n})(m)&&!E.includes(m)&&a.createElement("p",null,"There are other records from the this sheet used to create chart!")),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>u("")}),a.createElement(ra,{text:"Delete Sheet",color:"primary",onClick:()=>(t=>{const n=y(t);nn(n,{is_group:!0}).then(t=>{if(t?.status){const t=e.filter(e=>void 0===e?.group?.group_id||e?.group?.group_id!==n);h(Ee(t)),u("")}})})(m)}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{var t;nn(t=m).then(n=>{if(n?.status){const n=e.filter(e=>e.id!==t);h(Ee(n)),u("")}})}}))))};gl.propTypes={data:O().instanceOf(Array).isRequired,onSelectionModelChange:O().func,selectionModel:O().instanceOf(Array),columns:O().instanceOf(Array).isRequired,type:O().string.isRequired,selectedBasicsOptions:O().instanceOf(Array),selectedComparisonOptions:O().instanceOf(Array)};const hl=gl,El=({open:e,onClose:t,options:n,type:i,project:l,selectedBasicsOptions:r=Le,selectedComparisonOptions:o=Le})=>{const s=Gi(n).filter(e=>"brand"!==e),[c,d]=(0,a.useState)({}),[m,p]=(0,a.useState)(""),[u,g]=(0,a.useState)([]),[h,E]=(0,a.useState)([]),[y,x]=(0,a.useState)(!1),f=0!==Object.keys(c).length?n.filter(e=>Object.keys(c).every(t=>!(c?.[t]&&c[t].length>0)||je(c[t],e[t]))):n,b=Ui(n,s),v=Object.keys(b),A=f.reduce((e,t)=>(Object.keys(t).forEach(n=>{v.includes(n)&&(e[n]=e?.[n]?Array.from(new Set([e[n],t[n]].flat())):[t[n]].flat())}),e),{}),w=s.filter(e=>!["type","size_type","gender"].includes(e)).map(e=>({field:e,headerName:Fe(e),display:"flex",flex:"Year"===e?.5:1,valueGetter:e=>e||"/"})),C=(e,t,n)=>{if(!n?.relatedTarget||!n?.relatedTarget?.type){const n={...c};if(0===t.length){const t=Object.fromEntries(Object.entries(n).filter(t=>t[0]!==e));d(t)}else d({...n,[e]:t});g([]),p("")}};return a.createElement(qa.A,{open:e,fullWidth:!0,maxWidth:"xl"},a.createElement(La.A,null,`Add New ${Fe(i)} Chart(s)`),a.createElement(Pa.A,null,n.length>0&&a.createElement(a.Fragment,null,a.createElement(_t.A,{sx:{display:"flex",flexGrow:1,flexDirection:"column"}},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1rem",fontWeight:500}},"Optional Filters")),a.createElement(Ct.A,{direction:"row",sx:{m:1},useFlexGap:!0,flexWrap:"wrap"},v.map(e=>{return a.createElement(pi,{key:e,options:A?.[e]||[],sx:{m:1,minWidth:300},field:e,value:(t=e,0!==u.length&&t===m?u:c?.[t]?c[t]:[]),multiple:!0,onClose:t=>C(e,u,t),onOpen:()=>(e=>{""!==m&&C(m,u),p(e);const t=c[e];g(t||[])})(e),onChange:(t,n)=>((e,t)=>{if(m!==e){const n={...c};if(0===t.length){const t=Object.fromEntries(Object.entries(n).filter(t=>t[0]!==e));d(t)}else d({...n,[e]:t})}else g(t)})(e,n)});var t})),a.createElement(_t.A,{sx:{display:"flex",flexGrow:1,flexDirection:"column"}},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1rem",fontWeight:500}},"Selecting Data")),a.createElement(hl,{columns:w,data:f,onSelectionModelChange:e=>E(e),selectionModel:h,type:i,selectedBasicsOptions:r,selectedComparisonOptions:o})),0===n.length&&a.createElement(vn.A,{variant:"body2"},"basic"===i?"Sorry, available data were all included in basic charts. Please add more data in Manage Data if you did not see what you were looking for.":"There are no available data to create Comparison Charts. Please generate Basic Charts first or add more data in Manage Data.")),a.createElement(Va.A,null,a.createElement(ra,{color:n.length>0?"default":"primary",variant:n.length>0?"outlined":"contained",text:n.length>0?"Cancel":"OK",onClick:()=>(d({}),void t())}),n.length>0&&a.createElement(ra,{color:"primary",text:"Save",disabled:0===h.length,onClick:()=>{const e={records:"basic"===i?h:[h],project:l};x(!0),(async e=>Ze(Qe.PROJECT_VIEW.sbsDeliverables,e))(e).then(e=>{e?.results&&(d({}),t(e.results,i),x(!1))})}})),y&&a.createElement(bi,{isLoading:y}))};El.propTypes={open:O().bool.isRequired,onClose:O().func.isRequired,options:O().instanceOf(Array).isRequired,type:O().string.isRequired,project:O().string.isRequired,selectedBasicsOptions:O().instanceOf(Array),selectedComparisonOptions:O().instanceOf(Array)};const yl=El;var xl=n(30679);const fl=["#E7AF53","#5D70B5","#E9D23D","#4EB79B","#EF4873","#5ACAEE","#9754A1","#99CB4A","#EF4643","#4B4B93","#C587B8","#2DB2C9","#58BB61","#858AC0","#E89184","#DE6643","#9C4847","#9B8B87"],bl=["#EC7700","#5F504D","#000000","#AE7814","#666779","#934A36","#1C5566","#1A5023","#660A29","#4F2C55"],vl=({color:e,onColorChange:t,required:n,label:i="Color",isABPSource:l=!1})=>{const[r,o]=(0,a.useState)(null),s=Boolean(r),c=s?"simple-popover":void 0;return a.createElement("div",null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},`${i}${n?"*":""}`),a.createElement(y.A,{"aria-describedby":c,variant:"contained",onClick:e=>{o(e.currentTarget)},sx:{backgroundColor:e,height:"38px",width:"60px",borderRadius:"10px",":hover":{backgroundColor:e}}}),a.createElement(on.Ay,{id:c,open:s,anchorEl:r,onClose:()=>{o(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},sx:{padding:"10px"}},a.createElement("div",{style:{padding:"14px",margin:0}},a.createElement(xl.z0,{color:e||fl[0],colors:l?bl:fl,onChange:e=>t(e)}))))};vl.propTypes={color:O().string.isRequired,onColorChange:O().func.isRequired,required:O().bool.isRequired,label:O().string,isABPSource:O().bool};const Al=vl,wl=({data:e,onChartUpdate:t,onSBSEditClose:n})=>{const[i,l]=(0,a.useState)([]),[r,o]=(0,a.useState)(""),[s,c]=(0,a.useState)(""),d=0!==Object.keys(e).length,m=(e,n,a)=>{(async(e,t)=>Je(`${Qe.PROJECT_VIEW.sbsDeliverables}/${e}/`,t))(e,{title:a,color:n}).then(e=>{e?.status&&t(e)})};return(0,a.useEffect)(()=>{0!==s.length&&m(s,i,r),l(e?.config?.color||[]),o(e?.config?.title||""),c(e?.id||"")},[e]),a.createElement(It.Ay,{anchor:"right",open:d,variant:"persistent",sx:{zIndex:990,"& .MuiDrawer-paper":{padding:"50px 10px"}}},a.createElement(Ct.A,{spacing:1,direction:"column"},a.createElement(vn.A,{variant:"h6",component:"h6"},"Edit Chart"),a.createElement("div",null,a.createElement(aa.A,{style:{display:"block",minWidth:"120px",boxSizing:"border-box",marginBottom:"5px"}},"Title"),a.createElement(si,{required:!0,label:"Title",value:r||"",rows:1,onChange:e=>o(e.target.value),style:{padding:"5px 15px",width:200}})),i.map((t,n)=>a.createElement(Al,{key:`${r}-color-${t?.key||n}`,color:t?.color||t||"#EC7700",onColorChange:a=>((t,n)=>{"Basic"===e.type?l(e=>e.toSpliced(n,1,t)):l(e=>{const a=e.findIndex(e=>e.key===n);return e.toSpliced(a,1,{key:n,color:t})})})(a.hex,t?.key||n),label:t?.key||"Color",required:!1})),a.createElement(Ct.A,{spacing:1,direction:"row-reverse"},a.createElement(ra,{color:"primary",text:"Save",onClick:()=>{m(s,i,r),n()}}),a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:n}))))};wl.propTypes={data:O().instanceOf(Object).isRequired,onChartUpdate:O().func.isRequired,onSBSEditClose:O().func.isRequired};const Cl=wl,Sl=()=>{const e=(0,p.zy)().pathname.split("/")[1],[t,n]=(0,a.useState)([]),i=(0,l.useSelector)(ye),[r,o]=(0,a.useState)([]),[s,c]=(0,a.useState)(""),[d,u]=(0,a.useState)(!1),[g,E]=(0,a.useState)({}),y=t.map(e=>e.records||[]).flat(),x=r.map(e=>e.records||[]).flat();(0,a.useEffect)(()=>{tn({project:e}).then(e=>{if(e?.results){const{results:t}=e,a=t.filter(e=>"Comparison"!==e.type),i=t.filter(e=>"Comparison"===e.type);n(a),o(i)}})},[e]);const f=(e,t)=>{"basic"!==t?o(t=>t.toSpliced(e,1)):n(t=>t.toSpliced(e,1))},b=e=>{c(e),u(!0)};return a.createElement(Ct.A,{spacing:2,direction:"column",sx:{m:1}},a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",padding:"0 16px"}},a.createElement("svg",{id:"Group_1052","data-name":"Group 1052",xmlns:"http://www.w3.org/2000/svg",width:"31",height:"19",viewBox:"0 0 31 19"},a.createElement("circle",{id:"Ellipse_7","data-name":"Ellipse 7",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(0 14)"}),a.createElement("circle",{id:"Ellipse_8","data-name":"Ellipse 8",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(8 6)"}),a.createElement("circle",{id:"Ellipse_9","data-name":"Ellipse 9",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(17 12)"}),a.createElement("circle",{id:"Ellipse_10","data-name":"Ellipse 10",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(26)"}),a.createElement("path",{id:"Path_990","data-name":"Path 990",d:"M6410.5,1604.5l8.038-7.956,8.987,6.015,9-12.058",transform:"translate(-6408 -1588)",fill:"none",stroke:"#000",strokeWidth:"2"})),a.createElement(vn.A,{variant:"h5",component:"h5",style:{padding:"0 15px"}},"SALES BY SIZE ANALYSIS"),a.createElement(zn,{text:"Manage Data",color:"primary",component:m.N_,to:"data-management"})),a.createElement(qi.A,{sx:{p:"10px",bgcolor:"#EEEEEE"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{variant:"h5",component:"h5"},"Basic Charts"),a.createElement(h.A,{onClick:()=>b("basic"),sx:{alignSelf:"flex-end",paddingTop:0}},a.createElement(wn.A,null))),0!==t.length?a.createElement(Ct.A,{spacing:2,direction:"row",sx:{m:1},useFlexGap:!0,flexWrap:"wrap"},t.map((e,t)=>a.createElement(Hi,{key:e.id,type:"basic",data:e,onChartDel:()=>f(t,"basic"),onChartEdit:()=>E(e),isEditMode:0!==Object.keys(g).length}))):a.createElement(vn.A,{variant:"body2"},"No Basic Chart created at the moment. Please start adding your charts by clicking the corresponding + button above.")),a.createElement(qi.A,{sx:{p:"10px",bgcolor:"#EEEEEE"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{variant:"h5",component:"h5"},"Comparison Charts"),a.createElement(h.A,{onClick:()=>b("comparison"),sx:{alignSelf:"flex-end",paddingTop:0}},a.createElement(wn.A,null))),0!==r.length?a.createElement(Ct.A,{spacing:2,direction:"row",sx:{m:1},useFlexGap:!0,flexWrap:"wrap"},r.map((e,t)=>a.createElement(Hi,{key:e.id,type:"comparison",data:e,onChartDel:()=>f(t,"comparison"),onChartEdit:()=>E(e),isEditMode:0!==Object.keys(g).length}))):a.createElement(vn.A,{variant:"body2"},"No Comparison Chart created at the moment. Please start adding your charts by clicking the corresponding + button above.")),d&&a.createElement(yl,{open:d,type:s,options:i,onClose:(e,t)=>{u(!1),c(""),e&&0!==e.length&&("basic"===t?n(t=>[...e,...t]):o(t=>[...e,...t]))},project:e,selectedBasicsOptions:y,selectedComparisonOptions:x}),0!==Object.keys(g).length&&a.createElement(Cl,{data:g,onChartUpdate:e=>(e=>{const a="Basic"===e.type?t.findIndex(t=>t.id===e.id):r.findIndex(t=>t.id===e.id);"Basic"!==e.type?o(t=>t.toSpliced(a,1,e)):n(t=>t.toSpliced(a,1,e))})(e),onSBSEditClose:()=>E({})}))};var kl=n(43504),_l=n(63083),zl=n(24490),Rl=n(51275),Dl=n(15279);const Ol=({label:e,options:t,value:n,onChange:i,disabled:l=!1,style:r=qe})=>a.createElement(E.A,{theme:I},a.createElement(Ct.A,{direction:"row",spacing:1,sx:r},a.createElement(aa.A,{sx:{color:"#000000"}},e),a.createElement(Rl.A,{value:n,exclusive:!0,onChange:(e,t)=>null!==t?i(t):M(),disabled:l,size:"small",sx:{height:"22px",padding:"2px",backgroundColor:"#f3f3f3",borderRadius:"24px"}},t.map(e=>a.createElement(Dl.A,{value:e,key:`toggle-btn-${e}`,sx:{p:"0 10px",height:"22px",lineHeight:"22px",borderRadius:"24px !important",border:"none",color:"#000000",fontWeight:400,"&.Mui-selected":{borderRadius:"24px",backgroundColor:"#ffd1a3"}}},Fe(e))))));Ol.propTypes={label:O().string.isRequired,options:O().instanceOf(Array).isRequired,value:O().string.isRequired,onChange:O().func.isRequired,style:O().instanceOf(Object),disabled:O().bool};const Fl=Ol,Ml=async(e,t,n)=>Ze(Qe.MYALVA.overviewData,{key:"avatars",common_config:e,config:t,type:n}),jl=async e=>Ye(Qe.MYALVA.populationOptions,e),Il=async e=>Ze(Qe.MYALVA.populationCount,e);var Tl=n(43375),Bl=n(43627),$l=n(56775);const Nl=e=>[...e].sort().reduce((e,t)=>{const n=t.includes("-")?t.split("-"):t.split(">"),a=e.length;if(0===a)return[n];if(""===n[0]){if(parseInt(e[a-1][1])===parseInt(n[1])){const t=e.pop();return[...e,[t[0]]]}return[...e,[n[1]]]}if(parseInt(e[a-1][1],10)===parseInt(n[0])-1){const t=e.pop();return[...e,[t[0],n[1]]]}return[...e,n]},[]).map(e=>1!==e.length?e.join("-"):`≥${64===parseInt(e[0])?"65":e[0]}`).join(", "),ql=(0,a.forwardRef)(({id:e,item:t,disabled:n=!0,withOpacity:i=!1,isDragging:l,style:r=qe,index:o=0,onMoveClick:s,onEditClick:c=M(),onDelete:d=M(),...m},p)=>{const u={opacity:i?"0.5":"1",padding:"16px",border:"1px solid #DBDBDB",background:"#FDFDFD",borderRadius:"10px",width:"190px",height:"230px",display:"flex",flexDirection:"column",color:"#8c8c8c",cursor:n&&!l?"poniter":"move",boxShadow:l?"rgb(63 63 68 / 5%) 0px 2px 0px 2px, rgb(34 33 81 / 15%) 0px 2px 3px 2px":"rgb(63 63 68 / 5%) 0px 0px 0px 1px, rgb(34 33 81 / 15%) 0px 1px 3px 0px",transform:l?"scale(1.05)":"scale(1)",...r};return a.createElement("div",(0,kn.A)({ref:p,style:u},m),a.createElement(Ct.A,{direction:"row",alignItems:"center",spacing:1},a.createElement("div",{style:{width:"5px",height:"16px",backgroundColor:t.color,borderRadius:"0 3px 3px 0",display:"inline-block",margin:"3px 5px 3px -16px",verticalAlign:"baseline"}}," "),a.createElement("div",{style:{display:"inline-block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"180px",fontWeight:700,lineHeight:"24px",color:"#5F504D"},title:t.label},t.label),!n&&a.createElement(a.Fragment,null,a.createElement(h.A,{sx:{color:"#5F504D",padding:0},size:"small",onClick:()=>c(o)},a.createElement(zl.A,{size:"small"})),a.createElement(h.A,{sx:{color:"#FB4E3B",padding:0},size:"small",onClick:()=>d(o)},a.createElement(Ra.A,{size:"small"})))),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"16px"}},"Total Body Data"),a.createElement(vn.A,{variant:"h5",sx:{color:"#5F504D"}},t?.statistics?.total||0),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"14px"}}," "),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"16px"}},"Conditions"),"ABP"===t?.type&&a.createElement(a.Fragment,null,a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Name: ${t?.name||"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Name: ${t?.name||"N/A"}`),a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Body Type: ${t?.body_type||"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Body Type: ${t?.body_type||"N/A"}`),a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Size Range: ${t?.size_range&&0!==t.size_range.length?t.size_range.join("-"):"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Size Range: ${t?.size_range&&0!==t.size_range.length?t.size_range.join("-"):"N/A"}`),a.createElement(vn.A,{noWrap:!0,title:`Country/Region: ${t?.country&&0!==t.country.length?t.country.join(", "):"All"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Country/Region: ${t?.country&&0!==t.country.length?t.country.join(", "):"All"}`)),"MyAlva"===t?.type&&a.createElement(a.Fragment,null,a.createElement(vn.A,{noWrap:!0,title:`Ethnicity: ${t?.ethnicity&&0!==t.ethnicity.length?t.ethnicity.join(", "):"All"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Ethnicity: ${t?.ethnicity&&0!==t.ethnicity.length?t.ethnicity.join(", "):"All"}`),a.createElement(vn.A,{noWrap:!0,title:`Gender: ${t?.gender&&0!==t.gender.length?t.gender:"Male & Female"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Gender: ${t?.gender&&0!==t.gender.length?t.gender.join("&"):"Male & Female"}`),a.createElement(vn.A,{noWrap:!0,title:`Age: ${t?.age_bucket&&0!==t.age_bucket.length?Nl(t.age_bucket):"All"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Age: ${t?.age_bucket&&0!==t.age_bucket.length?Nl(t.age_bucket):"All"}`),a.createElement(vn.A,{noWrap:!0,title:`Country/Region: ${t?.country&&0!==t.country.length?t.country.join(", "):"All"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Country/Region: ${t?.country&&0!==t.country.length?t.country.join(", "):"All"}`)),"BodyScan"===t?.type&&a.createElement(a.Fragment,null,a.createElement(vn.A,{noWrap:!0,title:`Ethnicity: ${t?.ethnicity&&0!==t.ethnicity.length?t.ethnicity.join(", "):"All"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Ethnicity: ${t?.ethnicity&&0!==t.ethnicity.length?t.ethnicity.join(", "):"All"}`),a.createElement(vn.A,{noWrap:!0,title:`Gender: ${t?.gender?.join("&")||"Male & Female"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Gender: ${1!==t?.gender?.length?"Male & Female":t.gender[0]}`),a.createElement(vn.A,{noWrap:!0,title:`Age: ${t?.age_range&&0!==t.age_range.length?Te("age",t.age_range[0],t.age_range[1]):"N/A"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Age: ${t?.age_range&&0!==t.age_range.length?Te("age",t.age_range[0],t.age_range[1]):"N/A"}`),a.createElement(vn.A,{noWrap:!0,title:`Country/Region: ${t?.country&&0!==t.country.length?t.country.join(", "):"All"}`,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Country/Region: ${t?.country&&0!==t.country.length?t.country.join(", "):"All"}`)),"Sizeset"===t?.type&&a.createElement(a.Fragment,null,a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Name: ${t?.name||"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Name: ${t?.name||"N/A"}`),a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Body Type: ${t?.body_type&&0!==t.body_type.length?t.body_type.join(", "):"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Body Type: ${t?.body_type&&0!==t.body_type.length?t.body_type.join(", "):"N/A"}`),a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Size Range: ${t?.size_range&&0!==t.size_range.length?t.size_range.join("-"):"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Size Range: ${t?.size_range&&0!==t.size_range.length?t.size_range.join("-"):"N/A"}`),a.createElement(vn.A,{noWrap:!0,variant:"caption",sx:{width:"190px",display:"inline-block",fontSize:"14px",color:"#ffffff",minHeight:"23.34px"}}," ")),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},a.createElement(z.A,{size:"small",label:"ABP"===t.type?"Standard":t.type,sx:{backgroundColor:"rgba(229, 229, 229, 1)",color:"#000000",width:"40%",fontSize:"14px",borderRadius:"5px",marginTop:"5px",span:{padding:0}}}),void 0!==s&&a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:"Move to Analyze"},a.createElement(h.A,{sx:{color:"#8C8C8C",padding:0},size:"small",onClick:()=>s()},a.createElement($l.A,{size:"small"})))))});ql.propTypes={id:O().string.isRequired,withOpacity:O().bool,isDragging:O().bool.isRequired,item:O().instanceOf(Object).isRequired,disabled:O().bool,index:O().number,onEditClick:O().func,onDelete:O().func,style:O().instanceOf(Object)};const Ll=ql;var Pl=n(74979);const Wl=({item:e,disabled:t,id:n,index:i,onEditClick:l,onDelete:r,onMoveClick:o})=>{const{isDragging:s,attributes:c,listeners:d,setNodeRef:m,transform:p,transition:u}=(0,Bl.gl)({id:n}),g={transform:Pl.Ks.Transform.toString(p),transition:u||void 0};return a.createElement(Ll,(0,kn.A)({ref:m,style:g,id:n,withOpacity:s,item:e,index:i,onEditClick:l,onDelete:r,disabled:t,isDragging:s,onMoveClick:o},c,d))},Vl=({populations:e,disabled:t,onEditClick:n,onDelete:i,onOrderChange:l,onAddClicked:r,isNew:o})=>{const[s,c]=(0,a.useState)([]),[d,m]=(0,a.useState)(null),[p,u]=(0,a.useState)({}),g=(0,Tl.FR)((0,Tl.MS)(Tl.cA,{activationConstraint:{distance:5}}),(0,Tl.MS)(Tl.IG),(0,Tl.MS)(Tl.AN,{activationConstraint:{distance:5}}));return(0,a.useEffect)(()=>{c(e)},[e]),a.createElement(Tl.Mp,{sensors:g,collisionDetection:Tl.fp,onDragEnd:e=>{const{active:t,over:n}=e;if(t.id!==n.id){const e=s.map(e=>e.label),a=e.indexOf(t.id),i=e.indexOf(n.id),r=(0,Bl.be)(s,a,i);c(r),l(r)}},onDragStart:e=>{m(e.active.id),u(s.find(t=>t.label===e.active.id))},onDragCancel:()=>{m(null),u({})}},a.createElement(Bl.gB,{items:s,strategy:Bl.kL,disabled:t},a.createElement(Ct.A,{direction:"row",useFlexGap:!0,flexWrap:"wrap",spacing:1,mt:.5},s.map((e,l)=>a.createElement(Wl,{key:e.label,id:e.label,index:l,onEditClick:n,onDelete:i,item:e,disabled:t})),!t&&e.length<10&&a.createElement(E.A,{theme:I},a.createElement(y.A,{size:"small",onClick:r,color:"primary",sx:{width:"223px",height:"264px",border:"1px solid #DBDBDB",borderRadius:"10px",padding:"16px",alignItems:"start",justifyContent:"start"}},"+ Add "+(o?"Object":"Comparison"))))),a.createElement(Tl.Hd,{adjustScale:!0,style:{transformOrigin:"0 0 "}},d?a.createElement(Ll,{item:p,id:d,isDragging:!0}):null))};Vl.propTypes={onOrderChange:O().func.isRequired,populations:O().instanceOf(Array).isRequired,disabled:O().bool.isRequired,onEditClick:O().func.isRequired,onDelete:O().func.isRequired,onAddClicked:O().func.isRequired,isNew:O().bool.isRequired};const Hl=Vl,Gl=({label:e,onValueChange:t,inputValue:n,width:i=50,style:l=qe,showErr:r=!1,placeholder:o=""})=>{const[s,c]=(0,a.useState)(!1),[d,m]=(0,a.useState)("");return(0,a.useEffect)(()=>{m(n)},[n]),a.createElement(Rn.A,{variant:"outlined",sx:{padding:"0 15px",height:"30px",borderRadius:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(r||s?"#EC7700":"#D9D9D9"),boxShadow:"inset 0px 0px 5px #00000038",width:`${i}px`,marginTop:"10px",...l}},a.createElement(Dn.A,{label:e,error:r&&s,required:!0,onBlur:()=>{t(d),s&&c(!1)},value:d,inputProps:{inputMode:"number",pattern:"[0-9]*"},placeholder:o,onChange:e=>{return t=e.target.value,m(t),void(0===t.length||t.includes(" ")||Number.isNaN(+t)?c(!0):s&&c(!1));var t},sx:{color:"#5F504D",fontSize:"14px","&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"}}}))};Gl.propTypes={label:O().string.isRequired,onValueChange:O().func.isRequired,inputValue:O().string.isRequired,width:O().number,style:O().instanceOf(Object),showErr:O().bool,placeholder:O().string};const Ul=Gl,Yl=["BODY"],Zl=({filters:e,onFilterPomSelect:t,onExtraFilterAdd:n,onExtraFilterDel:i,error:l=!1,source:r,projectTypes:o=Yl})=>{const[s,c]=(0,a.useState)([]);return(0,a.useEffect)(()=>{r&&o&&Wn(Ne(r,o||["BODY"])).then(e=>c(e?.results||[]))},[r,o]),a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"321px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px",width:"100%",color:l&&"#FB4E3B"}},"Extra Filters(optional)"),e?.length>0&&e.map((e,n)=>a.createElement("div",{key:`extra-select-pom-${n}`,style:{display:"flex",flexDirection:"row",alignItems:"center"}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},a.createElement(pi,{field:"",value:s.find(t=>t.key===e.pom)||"",options:s,onChange:(e,a)=>t(a.key,n,"pom"),placeholder:"Measurement",style:{width:"280px",marginRight:0}}),a.createElement(Ul,{label:"min",inputValue:`${e.min||""}`,width:250,onValueChange:e=>t(e,n,"min"),placeholder:"Min",showErr:!1,style:{padding:"5px 15px"}}),a.createElement(Ul,{label:"max",inputValue:`${e.max||""}`,width:250,placeholder:"Max",onValueChange:e=>t(e,n,"max"),showErr:!1,style:{padding:"5px 15px"}}),"weight"===e?.pom?a.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",margin:"10px 0"}},a.createElement(B,{text:"kg",color:"primary",selected:e?.unit&&"kg"===e.unit,onClick:()=>t("kg",n,"unit")}),a.createElement(vn.A,{variant:"body1",component:"div",sx:{color:"#A0A0A0",margin:"0 20px"}},"/"),a.createElement(B,{text:"lbs",color:"primary",selected:e?.unit&&"lbs"===e.unit,onClick:()=>t("lbs",n,"unit")})):a.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",margin:"10px 0"}},a.createElement(B,{text:"cm",color:"primary",selected:e?.unit&&"cm"===e.unit,onClick:()=>t("cm",n,"unit")}),a.createElement(vn.A,{variant:"body1",component:"div",sx:{color:"#A0A0A0",margin:"0 20px"}},"/"),a.createElement(B,{text:"inch",color:"primary",selected:e?.unit&&"inch"===e.unit,onClick:()=>t("inch",n,"unit")}))),a.createElement(h.A,{sx:{color:"#5F504D"},onClick:()=>i(n)},a.createElement(Si.A,null)))),a.createElement(zn,{color:"primary",startIcon:a.createElement(wn.A,null),onClick:n,text:"Add more filter",style:{alignSelf:"flex-start"}}))};Zl.propTypes={filters:O().instanceOf(Array).isRequired,onFilterPomSelect:O().func.isRequired,onExtraFilterAdd:O().func.isRequired,onExtraFilterDel:O().func.isRequired,error:O().bool,source:O().string.isRequired,projectTypes:O().instanceOf(Array)};const Jl=Zl,Xl=({data:e,analysisUnit:t})=>{const{avatars:n,display_poms:i}=e,[l,r]=(0,a.useState)("cm"),o=0!==n.length?n.map(e=>e.size):[],s=n.length||1;return(0,a.useEffect)(()=>{r(t)},[t]),a.createElement(Ct.A,{direction:"row",spacing:1,sx:{width:"100%"},justifyContent:"center",flexWrap:"wrap",useFlexGap:!0},a.createElement(Ct.A,{direction:"row",spacing:0,justifyContent:"center"},n.map(e=>a.createElement("img",{key:`avatar-standard-${e.size}`,alt:`avatar-standard-${e.size}`,src:e.preview_img,style:{width:`calc(100% / ${s})`,height:"auto"}}))),a.createElement(Ct.A,{direction:"column",p:.5,spacing:.5,sx:{borderRadius:"8px",border:"1px solid #E0E0E0",maxWidth:"100%"}},a.createElement(Ct.A,{direction:"row",justifyContent:"end"},a.createElement(Fl,{label:"Unit",options:["cm","inch"],value:l,color:"primary",onChange:e=>r(e)})),a.createElement(wa.A,{key:`table-${e.id}`,sx:{width:"100%",overflowX:"auto"}},a.createElement(Ca.A,{size:"small","aria-label":"collection detail table"},a.createElement(Sa.A,null,a.createElement(Aa.A,null,a.createElement(Oa.A,{align:"left",sx:{p:"0 8px",fontSize:"12px"}},a.createElement("span",null,"Size")),o.map(e=>a.createElement(Oa.A,{align:"right",key:e,sx:{p:"0 8px",borderLeft:"1px solid #f4f4f4",fontSize:"12px"}},e)))),a.createElement(ka.A,null,i.map(t=>a.createElement(Aa.A,{key:t,sx:{"&:last-child td, &:last-child th":{border:0}}},a.createElement(Oa.A,{align:"left",key:"cell-pom",sx:{p:"0 8px",fontSize:"12px"}},t),o.map(n=>a.createElement(Oa.A,{align:"right",key:`cell-${t}-${n}`,sx:{p:"0 8px",borderLeft:"1px solid #f4f4f4",fontSize:"12px",whiteSpace:"nowrap"}},e[l].find(e=>e.size===n)?.[t]||"/")))))))))};Xl.propTypes={data:O().instanceOf(Object).isRequired,analysisUnit:O().string.isRequired};const Ql=Xl;var Kl=n(16638),er=n(68635),tr=n(88629);const nr=(e,t)=>{const n=[...e];for(;n.length>0;){const e=n.shift();if(e.name===t)return e;e.children&&n.push(...e.children)}return[]},ar=({data:e,selected:t,onNodeSelect:n,error:i=!1,onNodeExpand:l=M(),type:r,isPopUp:o=!1,projectType:s=""})=>{const c=(e,t=[])=>(t.push(e.name),e.children&&e.children.forEach(e=>c(e,t)),t),d=t=>c(nr(e,t)),m=(t,n=[])=>{const a=nr(e,t);return a.parent?(n.push(a.parent),m(a.parent,n)):n},p=(e,n)=>{const a=d(e.name),i=a.indexOf(e.name);return a.splice(i,1),0!==a.length&&a.every(e=>t.concat(n).includes(e))},u=e=>{e.stopPropagation()},g=(e,n)=>{const a=d(e.name),i=a.indexOf(e.name);a.splice(i,1);const l=a.filter(e=>t.concat(n).includes(e));return 0!==l.length&&l.length!==a.length},h=i=>a.createElement(er.y,{key:i.name,itemId:i.name,onClick:Array.isArray(i.children)?u:()=>l(i.name),sx:{".MuiTreeItem-content":{padding:"0 8px"}},label:a.createElement(a.Fragment,null,a.createElement(ya.A,{checked:p(i,[])||t.includes(i.name),indeterminate:g(i,[]),tabIndex:-1,disableRipple:!0,onClick:a=>((a,i)=>{a.stopPropagation();const l=d(i),r=m(i);if(t.includes(i)){const e=t.filter(e=>!l.concat(r).includes(e));n(e)}else{const a=l;for(let t=0;th(e)):null);return a.createElement(_t.A,{sx:{flexGrow:1,maxWidth:500}},!o&&a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px",color:i&&"#FB4E3B"}},"Dataset*"),0!==s.length&&a.createElement(vn.A,{variant:"caption",sx:{marginLeft:"5px",color:"#A0A0A0"}},s)),a.createElement(E.A,{theme:I},a.createElement(Kl.G,{"aria-label":"rich object",defaultExpandedItems:["root"],slots:{expandIcon:Qn.A,collapseIcon:tr.A},multiSelect:!0,selectedItems:t},e.map(e=>h(e)))))};ar.propTypes={data:O().instanceOf(Array).isRequired,selected:O().instanceOf(Array).isRequired,onNodeSelect:O().func.isRequired,error:O().bool,onNodeExpand:O().func,type:O().string.isRequired,isPopUp:O().bool,projectType:O().string};const ir=ar,lr=({value:e,onRangeChange:t,err:n=!1,errMsg:i="",isDQ:l=!1})=>a.createElement("div",null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Age Range"+(l?"":"*")),a.createElement("div",{style:{display:"flex"}},a.createElement(Ul,{label:"min",inputValue:`${e[0]}`,showErr:n,onValueChange:n=>t([n,e[1]]),style:{margin:0},width:30}),a.createElement("div",{style:{padding:"5px"}},"-"),a.createElement(Ul,{label:"max",inputValue:`${e[1]}`,showErr:n,onValueChange:n=>t([e[0],n]),style:{margin:0},width:30})),0!==i.length&&a.createElement(vn.A,{component:"div",variant:"body1",sx:{fontSize:"12px",color:"#FB4E3B",maxWidth:120}},i));lr.propTypes={value:O().instanceOf(Array).isRequired,onRangeChange:O().func.isRequired,err:O().bool,errMsg:O().string,isDQ:O().bool};const rr=lr;var or=n(52412),sr=n(18516);const cr=({datasetDetail:e,setDatasetDetail:t,isDQ:n=!1})=>a.createElement(or.A,{variant:"outlined",sx:n?{}:{position:"fixed",width:"calc(50% - 460px)",top:"30%",right:"calc(50% + 455px)"}},a.createElement(sr.A,null,a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{variant:"h5",component:"div"},e.name),a.createElement(h.A,{onClick:()=>t({}),sx:{"&:hover":{color:"#ec7700",backgroundColor:"transparent"}}},a.createElement(Si.A,null))),a.createElement(vn.A,{sx:{mb:1.5},color:"text.secondary"},a.createElement("b",null,"Title: "),e?.title||"N/A"),a.createElement(vn.A,{sx:{mb:1.5},color:"text.secondary"},a.createElement("b",null,"Start Date: "),e?.start_date||"N/A"),a.createElement(vn.A,{sx:{mb:1.5},color:"text.secondary"},a.createElement("b",null,"End Date: "),e?.end_date||"N/A"),a.createElement(vn.A,{sx:{mb:1.5},color:"text.secondary"},a.createElement("b",null,"Scanner: "),e?.scanner||"N/A"),a.createElement(vn.A,{sx:{mb:1.5},color:"text.secondary"},a.createElement("b",null,"Count: "),e?.count?Object.keys(e?.count).map(t=>a.createElement("p",{key:`count-${t}`},`${Fe(t)}: ${e?.count?.[t]||0}`)):"N/A"),e?.description&&a.createElement(vn.A,{sx:{mb:1.5},color:"text.secondary"},a.createElement("b",null,"Remarks: "),e.description)));cr.propTypes={datasetDetail:O().instanceOf(Object).isRequired,setDatasetDetail:O().func.isRequired,isDQ:O().bool};const dr=cr;var mr=n(43760);const pr=({error:e=!1,field:t="",options:n,onChange:i,value:l,required:r=!1,multiple:o=!1,onClose:s=M(),onOpen:c=M(),disabled:d=!1,placeholder:m="",group:p,style:g=qe})=>a.createElement(E.A,{theme:I},a.createElement(Rn.A,{color:"primary",disabled:d},0!==t.length&&a.createElement(aa.A,{id:`${t}-select-label`,sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},`${Fe(t)}${r?"*":""}`),a.createElement(di.A,{value:0!==l.length||o?l:"",onChange:(e,t)=>i(o?t.map(e=>e?.value||e):t?.value||t),multiple:o,onClose:s,onOpen:c,options:n,getOptionLabel:e=>Fe(e?.value||e),disableClearable:!o,groupBy:e=>e[p],size:"small",disableCloseOnSelect:o,isOptionEqualToValue:(e,t)=>(e?.value||e)===t,renderGroup:e=>{return a.createElement("li",{key:e.key},a.createElement($t.A,{onClick:()=>(e=>{const t=n.filter(t=>t.group===e).map(e=>e?.value||e);if(t.every(e=>l.includes(e))){const e=l.filter(e=>!t.includes(e));i(e)}else{const e=t.filter(e=>!l.includes(e));i([...l,...e])}})(e.group),style:{color:"#9B9B9B",padding:0!==p.length?"10px":0,margin:0,cursor:"pointer",backgroundColor:(t=e.group,n.filter(e=>e.group===t).map(e=>e?.value||e).every(e=>l.includes(e))?"rgba(236, 119, 0, 0.12)":"transparent")}},e.group),a.createElement("ul",{style:{padding:0}},e.children));var t},renderInput:t=>a.createElement(u.A,(0,kn.A)({},t,{autoComplete:"off",placeholder:m,label:"",sx:{padding:"0",minHeight:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(e?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(e?"#FB4E3B":"#00000038"),width:"300px",boxSizing:"content-box",color:"#5F504D","&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},...g}}))}),e&&a.createElement(ti.A,null,"Please select a value in this field!")));pr.propTypes={required:O().bool,error:O().bool,field:O().string,options:O().instanceOf(Array).isRequired,onChange:O().func.isRequired,value:O().oneOfType([O().string,O().instanceOf(Array),O().instanceOf(Object)]).isRequired,multiple:O().bool,onClose:O().func,onOpen:O().func,disabled:O().bool,style:O().instanceOf(Object),placeholder:O().string,group:O().string.isRequired};const ur=pr,gr=({error:e=!1,value:t,onValueChange:n,style:i=qe,isPopulation:l=!1,disabled:r=!1,isSingleAvatar:o=!1,isComparison:s=!1})=>{const[c,d]=(0,a.useState)(!1),[m,p]=(0,a.useState)({}),[u,g]=(0,a.useState)([]),[E,x]=(0,a.useState)([]),[f,b]=(0,a.useState)([]),[v,A]=(0,a.useState)(""),w=f.sort((e,t)=>e.body_type.localeCompare(t.body_type))||[],C=(e,t)=>{(async e=>Ye(Qe.MYALVA.listSizeset,e))(e).then(e=>{if(e?.data){const n=e.data.map(e=>({...e,key:e?.id||e.vbid,value:e?.name||`${e.vbid} (${e.size})${e?.is_active?"":" - Inactive"}`,group:e?.body_type||""}))||[];"size_set"===t?x(n):"vbids"===t?b(n):g(n)}})};(0,a.useEffect)(()=>{C({},"brand"),p(t),t?.brand&&l&&t.brand!==m?.brand&&C({brand:t.brand?.id||t.brand},"size_set"),t?.size_set&&l&&t?.size_set!==m?.size_set&&C({brand:t.brand?.id||t.brand,size_set:t.size_set?.id||t.size_set,show_inactive:s},"vbids")},[t,l,s]);const S=(e,t)=>{const a={...m};if("brand"===e)p({[e]:t}),x([]),b([]),C({brand:t.id},"size_set"),l&&n({[e]:t});else if("size_set"===e)p({brand:a.brand,size_set:t}),b([]),C({brand:a.brand.id,size_set:t.id,show_inactive:s},"vbids"),l&&n({brand:a.brand,size_set:t});else{const i=w.filter(e=>t.includes(e.value));p(t=>({...t,[e]:i})),l&&n({brand:a.brand,size_set:a.size_set,[e]:i})}};return l?a.createElement(Ct.A,{direction:"column",spacing:2},a.createElement(pi,{sx:{m:1,minWidth:200},field:"Brand*",value:u.find(e=>e.id===m?.brand||e.id===m?.brand?.id)||"",onChange:(e,t)=>S("brand",t),options:u}),a.createElement(pi,{sx:{m:1,minWidth:200},field:"Sizeset*",value:E.find(e=>e.id===m?.size_set||e.id===m?.size_set?.id)||"",onChange:(e,t)=>S("size_set",t),options:E}),o?a.createElement(ur,{sx:{m:1,minWidth:200},field:"Size",value:m?.vbid?.value?m.vbid.value:w.find(e=>m?.vbid===e.key)?.value||[],onChange:e=>S("vbid",e),group:"group",options:w}):a.createElement(ur,{sx:{m:1,minWidth:200},field:"Size",value:m?.vbids?.[0]?.vbid?m?.vbids.map(e=>e.value):w.filter(e=>m?.vbids?.includes(e.key)).map(e=>e.value)||[],onChange:e=>S("vbids",e),multiple:!0,group:"group",options:w}),0!==v.length&&a.createElement(vn.A,{variant:"caption",sx:{color:"#FB4E3B"}},v)):a.createElement(Ct.A,{direction:"column",sx:{width:250,"#size-set-clear-btn":{visibility:"hidden"},"&:hover":{"#size-set-clear-btn":{visibility:0===Object.keys(m).length?"hidden":"visible"}}}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(mr.A,{disabled:r},"Sizeset"),a.createElement(h.A,{disabled:r,id:"size-set-clear-btn",onClick:()=>n({}),sx:{width:"20px",height:"20px"}},a.createElement(Rt.A,null,a.createElement(ci.A,{sx:{width:"20px",height:"20px",color:"#5F504D"}})))),a.createElement(y.A,{onClick:()=>d(!0),disabled:r,sx:{marginTop:"4.5px",padding:"0 12px",textTransform:"none",minHeight:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(e?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(e?"#FB4E3B":"#00000038"),width:225,fontWeight:"400",fontSize:"14px",boxSizing:"content-box",color:"#000000",justifyContent:"start",...i}},`${m?.brand?.name||""} ${m?.brand?.name&&m?.size_set?.name?"-":""} ${m?.size_set?.name||""}`),a.createElement(qa.A,{open:c,maxWidth:"md",transitionDuration:0},a.createElement(La.A,null,"Add New Sizeset"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"column",spacing:2},a.createElement(pi,{sx:{m:1,minWidth:200},field:"Brand*",value:m?.brand||"",onChange:(e,t)=>S("brand",t),options:u}),a.createElement(pi,{sx:{m:1,minWidth:200},field:"Sizeset*",value:m?.size_set||"",onChange:(e,t)=>S("size_set",t),options:E}),a.createElement(ur,{sx:{m:1,minWidth:200},field:"Size",value:m?.vbids?.map(e=>e?.value)||[],onChange:e=>S("vbids",e),multiple:!0,group:"group",options:w}),0!==v.length&&a.createElement(vn.A,{variant:"caption",sx:{color:"#FB4E3B"}},v))),a.createElement(Va.A,null,a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>{A(""),p(t),d(!1)}}),a.createElement(ra,{color:"primary",text:"Save",onClick:()=>{Object.keys(m).length>1?(A(""),n(m),d(!1)):A("Please select a sizeset to continue")}}))))};gr.propTypes={error:O().bool,value:O().oneOfType([O().string,O().instanceOf(Object)]).isRequired,onValueChange:O().func.isRequired,style:O().instanceOf(Object),isPopulation:O().bool,disabled:O().bool,isSingleAvatar:O().bool,isComparison:O().bool};const hr=gr;Jn().extend(na()),Jn().extend(ea());const Er={pom:"",max:null,min:null,unit:"cm"},yr=(0,j.A)({...I,components:{MuiPickersDay:{styleOverrides:{root:{color:"#5F504D",borderRadius:"20px",backgroundColor:"transparent","&:hover":{backgroundColor:"rgba(236, 119, 0, 0.1)"},"&.Mui-selected":{backgroundColor:"#EC7700",color:"#FFFFFF","&:hover, &:focus":{backgroundColor:"#EC7700"}}}}}}}),xr=e=>e?.children?e.children?.flatMap(e=>xr(e)):e,fr=["Body"],br=({open:e,onClose:t,rowDetail:n,populationOptions:i,populationMap:l,existingName:r=Le,unit:o="cm",prefilledGender:s="",projectTypes:c=fr,dbVersion:d=""})=>{const[m,p]=(0,a.useState)([]),[u,g]=(0,a.useState)({}),[y,x]=(0,a.useState)(""),[f,b]=(0,a.useState)({}),[v,A]=(0,a.useState)(""),[w,C]=(0,a.useState)(!1),[S,k]=(0,a.useState)({}),_=ve.getState().auth.currentUser.timezone||Jn().tz.guess(),z=l?.ABP?.map(e=>({key:e.id,value:e.name,...e}))||[],R=u?.type&&"ABP"!==u.type&&"Sizeset"!==u.type?l[u.type]:[],D="MyAlva"===u?.type&&"Cloth Fitting Size Data"===u?.my_alva_type?i?.dataset_size_recommend||[]:R;(0,a.useEffect)(()=>{const e={...n};return g(e),A(n?.collection||""),()=>{A(""),C(!1)}},[n]),(0,a.useEffect)(()=>{0!==v.length&&(async e=>Ye(`${Qe.MYALVA.standardCollectionDetail}/${e}/`))(v).then(e=>{e?.data&&k(e.data)})},[v]);const O=e=>{if(0===e.length)return!1;const t=e.map(e=>!(0===e.pom.length||null===e.max&&null===e.min||null!==e.max&&+e.max<+e.min||"weight"===e.pom&&("cm"===e.unit||"inch"===e.unit)||"weight"!==e.pom&&("kg"===e.unit||"lbs"===e.unit)));return t.includes(!1)},F=(e,t)=>{if(m.includes(e)){const t=m.filter(t=>!(t===e));p(t)}const n={...u,[e]:t};g(n)};return a.createElement(qa.A,{open:e,maxWidth:"md",fullWidth:!0,transitionDuration:0},a.createElement(La.A,null,(u.isNew?"Add New":"Edit")+" Analysis Object"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",spacing:"10px",sx:{m:1}},a.createElement(Ct.A,{direction:"column",spacing:"10px",sx:{m:1}},a.createElement(Ct.A,{direction:"row",spacing:"10px",sx:{m:1}},a.createElement("div",{style:{width:"400px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Label*"),a.createElement(si,{label:"",value:u?.label,onChange:e=>(e=>{if(m.includes("label")){const e=m.filter(e=>!("label"===e));p(e)}const t={...u,label:e};g(t)})(e.target.value),width:300,err:m.includes("label")})),a.createElement("div",{style:{width:"30%"}},a.createElement(Al,{color:u?.color||"#E7AF53",onColorChange:e=>{const t={...u,color:e.hex};g(t)},required:!0,isABPSource:"ABP"===u.type||"Sizeset"===u.type}))),a.createElement(Ct.A,{direction:"row",spacing:"10px",sx:{m:1}},a.createElement("div",{style:{width:"30%"}},a.createElement(pi,{field:"Data Source*",value:{key:u?.type,value:"ABP"===u?.type?"Standard":u?.type},options:void 0!==i?.type?i.type.map(e=>({key:e,value:"ABP"===e?"Standard":e})):[],onChange:(e,t)=>(e=>{p([]);const t={...u,type:e,gender:0!==s.length?[s]:[],age_range:"BodyScan"===e?[0,80]:[18,80],include_dataset:[],ethnicity:[],color:"ABP"===e||"Sizeset"===e?"#EC7700":"#E7AF53"};g(t),b({})})(t.key),error:m.includes("type"),style:{width:"140px"}})),"MyAlva"===u.type&&a.createElement("div",{style:{width:"70%"}},a.createElement(pi,{field:"Type*",value:"Cloth Fitting Size Data"===u?.my_alva_type?{key:"Cloth Fitting Size Data",value:"Size Recommended Body Data"}:{key:"Customer Body Data",value:"All Body Data"},options:[{key:"Customer Body Data",value:"All Body Data"},{key:"Cloth Fitting Size Data",value:"Size Recommended Body Data"}],onChange:(e,t)=>(e=>{if(m.includes("my_alva_type")){const e=m.filter(e=>!("my_alva_type"===e));p(e)}const t={...u,my_alva_type:e,include_dataset:[]};g(t)})(t.key),error:m.includes("my_alva_type"),style:{width:"250px"}})),"BodyScan"===u.type&&0!==d.length&&a.createElement("div",null,a.createElement(Ct.A,{direction:"row",spacing:.5,alignItems:"center",sx:{marginBottom:"5px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none"}},"Version*"),a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:"We started recording data versions on 2025-02-06. If your project was created before this date, editing project may lead to updated results. To use the latest data, it’s best to create a new project."},a.createElement(h.A,{"aria-label":"info",size:"small",sx:{borderRadius:"16px",height:"16px",width:"16px"}},a.createElement(ri.A,{fontSize:"small"})))),a.createElement(si,{label:"Version*",value:d,disabled:!0,style:{width:"233px"}}))),0!==D.length&&a.createElement(ir,{data:D,selected:u?.include_dataset||[],onNodeSelect:e=>F("include_dataset",e),error:m?.includes("include_dataset")||!1,onNodeExpand:e=>{if("BodyScan"===u.type){const t=l.BodyScan?.flatMap(e=>xr(e)),n=t.find(t=>t.name===e)||{};b(n)}},projectType:0===c.length||"BodyScan"!==u.type?"":`(Type: ${c.map(e=>q.find(t=>t.key===e)?.value||"").join(" & ")})`,type:u.type})),a.createElement(E.A,{theme:yr},a.createElement(Ct.A,{direction:"column",spacing:"10px",sx:{m:1}},"MyAlva"===u.type&&a.createElement(a.Fragment,null,a.createElement("div",null,a.createElement(aa.A,{style:{boxSizing:"border-box",marginRight:"5px"}},"Start Time"),a.createElement(ia.l,{value:u?.datetime_gte?Jn()(u.datetime_gte):null,onChange:e=>F("datetime_gte",e.tz(_,!0).startOf("day").toISOString()),slotProps:{textField:{size:"small",sx:{padding:"0 15px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"200px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}}}})),a.createElement("div",null,a.createElement(aa.A,{style:{boxSizing:"border-box",marginRight:"5px"}},"End Time"),a.createElement(ia.l,{value:u?.datetime_lte?Jn()(u.datetime_lte):null,onChange:e=>F("datetime_lte",e.tz(_,!0).endOf("day").toISOString()),slotProps:{textField:{size:"small",sx:{padding:"0 15px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"200px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}}}})),a.createElement(pi,{field:"Ethnicity",value:u?.ethnicity||[],options:i?.ethnicity||[],onChange:(e,t)=>F("ethnicity",t),multiple:!0,placeholder:u?.ethnicity&&0!==u.ethnicity.length?"":"All",error:m.includes("ethnicity"),width:350}),a.createElement(pi,{field:"Gender",value:u?.gender||[],options:i?.gender||[],onChange:(e,t)=>F("gender",t),multiple:!0,placeholder:u?.gender&&0!==u.gender.length?"":"All",error:m.includes("gender"),width:350}),a.createElement(pi,{field:"Age Range",value:u?.age_bucket||[],options:i?.age_bucket||[],onChange:(e,t)=>F("age_bucket",t),multiple:!0,placeholder:u?.age_bucket&&0!==u.age_bucket.length?"":"All",error:m.includes("age_bucket"),width:350}),a.createElement(pi,{field:"Country/Region",value:u?.country||[],options:i?.country||[],onChange:(e,t)=>F("country",t),multiple:!0,placeholder:u?.country&&0!==u.country.length?"":"All",error:m.includes("country"),width:350}),"Cloth Fitting Size Data"===u?.my_alva_type&&a.createElement(a.Fragment,null,a.createElement(pi,{field:"Category",value:u?.category||[],options:i?.category||[],onChange:(e,t)=>F("category",t),multiple:!0,placeholder:u?.category&&0!==u.category.length?"":"All",error:m.includes("category"),width:350}),a.createElement(pi,{field:"Clothing Sizes",value:u?.size||[],options:i?.size||[],onChange:(e,t)=>F("size",t),multiple:!0,placeholder:u?.size&&0!==u.size.length?"":"All",error:m.includes("size"),width:350}))),"BodyScan"===u.type&&a.createElement(a.Fragment,null,a.createElement(pi,{field:"Gender*",value:u?.gender||[],options:i?.gender||[],onChange:(e,t)=>F("gender",t),multiple:!0,error:m.includes("gender"),placeholder:u?.gender&&0!==u.gender.length?"":"Please Select",width:350}),a.createElement(rr,{value:u?.age_range||[0,80],onRangeChange:e=>F("age_range",e),err:m.includes("age_range"),errMsg:y})),"ABP"===u.type&&a.createElement(pi,{field:"Standard*",value:z.find(e=>e.key===u.collection)||"",onChange:(e,t)=>(e=>{if(m.includes("collection")){const e=m.filter(e=>!("collection"===e));p(e)}A(e.key);const t={...u,collection:e.key,name:e.name,body_type:e.body_type,size_range:e.size_range,country:e.country};g(t)})(t),options:z,style:{width:"300px"}}),"Sizeset"===u.type&&a.createElement(hr,{value:u,onValueChange:e=>(e=>{const{brand:t,size_set:n,vbids:a,...i}=u;g({...i,...e})})(e),isPopulation:!0}),("MyAlva"===u.type||"BodyScan"===u.type)&&a.createElement(Jl,{filters:u?.extra_filter&&0!==u.extra_filter.length?u.extra_filter:[],onFilterPomSelect:(e,t,n)=>{if(m.includes("extra_filter")){const e=m.filter(e=>!("extra_filter"===e));p(e)}const a=u,i=u?.extra_filter?u.extra_filter:[Er],l=i.at(t)||Er,r={...a,extra_filter:i.toSpliced(t,1,{...l,[n]:""===e?null:e})};g(r)},onExtraFilterAdd:()=>{const e={...u,extra_filter:[...u.extra_filter,Er]};g(e)},onExtraFilterDel:e=>{const t={...u,extra_filter:(u?.extra_filter?u.extra_filter:[Er]).toSpliced(e,1)};g(t)},error:m.includes("extra_filter"),source:u?.type||"BodyScan",projectTypes:c})))),"ABP"===u.type&&0!==v.length&&0!==Object.keys(S).length&&a.createElement(Ql,{data:S,analysisUnit:o}),m.includes("label")&&!(0===u.label.length)&&a.createElement(vn.A,{component:"div",variant:"body1",sx:{color:"#FB4E3B"}},"Label already exists!"),0!==m.length&&!(m.includes("label")&&0!==u.label.length)&&a.createElement(vn.A,{component:"div",variant:"body1",sx:{color:"#FB4E3B"}},"Please input all required fields!"),0!==Object.keys(f).length&&a.createElement(dr,{datasetDetail:f,setDatasetDetail:b})),a.createElement(Va.A,null,a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>{t(u,"cancel"),p([]),x(""),b({})}}),a.createElement(ra,{color:"primary",text:"Save",disabled:w,onClick:()=>{let e;if("BodyScan"===u.type?e=(()=>{let e=[];const t=O(u.extra_filter);return""===u.label&&(e=[...e,"label"]),0===u.include_dataset.length&&(e=[...e,"include_dataset"]),+u.age_range[0]>=+u.age_range[1]&&(e=[...e,"age_range"],x("Min age cannot be bigger than max age.")),+u.age_range[1]>80&&(e=[...e,"age_range"],x("Sorry, we only support ages under 80 at the moment.")),t&&(e=[...e,"extra_filter"]),e})():"ABP"===u.type?e=(()=>{let e=[];return(""===u.label||r.includes(u.label)&&u.label!==n.label)&&(e=[...e,"label"]),void 0!==u?.collection&&""!==u?.collection||(e=[...e,"collection"]),e})():"MyAlva"===u.type?e=(()=>{let e=[];const t=O(u.extra_filter);return(""===u.label||r.includes(u.label)&&u.label!==n.label)&&(e=[...e,"label"]),0===u.include_dataset.length&&(e=[...e,"include_dataset"]),t&&(e=[...e,"extra_filter"]),e})():"Sizeset"===u.type&&(e=(()=>{let e=[];return(""===u.label||r.includes(u.label)&&u.label!==n.label)&&(e=[...e,"label"]),void 0!==u?.size_set&&""!==u?.size_set||(e=[...e,"size_set"]),e})()),0!==e.length)return void p(e);const a={...u};"Sizeset"===u.type&&(a.brand=u.brand?.id||u.brand,a.size_set=u.size_set?.id||u.size_set,a.vbids=u?.vbids?.map(e=>e?.vbid||e)||[]),C(!0),t(a,"save"),p([]),x(""),b({})}})),w&&a.createElement(bi,{isLoading:w,isSingleChart:!0}))};br.propTypes={open:O().bool.isRequired,onClose:O().func.isRequired,rowDetail:O().instanceOf(Object).isRequired,populationMap:O().instanceOf(Object).isRequired,populationOptions:O().instanceOf(Object).isRequired,existingName:O().instanceOf(Array),unit:O().string,prefilledGender:O().string,projectTypes:O().instanceOf(Array),dbVersion:O().string};const vr=br,Ar=({open:e,project:t,selectedPopulation:n,isNew:i,onPopulationEditClose:r,myAlvaOptions:o,populationMap:s,dbVersion:c})=>{const d=(0,l.useSelector)(se),[m,p]=(0,a.useState)(!1),[u,g]=(0,a.useState)({}),[h,x]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),[v,A]=(0,a.useState)(!1),[w,C]=(0,a.useState)(""),[S,k]=(0,a.useState)([]),[_,z]=(0,a.useState)([]),[R,D]=(0,a.useState)([]),O=_.map(e=>e.id),F=R.filter(e=>!O.includes(e.id)),M=F.map(e=>e.id),[j,T]=(0,a.useState)(null),[B,$]=(0,a.useState)({}),N=d?.gender||"Male",q=d?.types||["BODY"],L="Female"===N?"Female":"Male",P=(0,Tl.FR)((0,Tl.MS)(Tl.cA,{activationConstraint:{distance:5}}),(0,Tl.MS)(Tl.IG),(0,Tl.MS)(Tl.AN,{activationConstraint:{distance:5}}));(0,a.useEffect)(()=>{p(!0),(async e=>Ye(Qe.PROJECT_VIEW.population,e))({project:t,page_size:999}).then(e=>{D(e?.data||[]),p(!1)})},[t]),(0,a.useEffect)(()=>{z(n)},[n]);const W=e=>{b(!0),C(e)},V=e=>{"del"===e?b(!1):A(!1),C("")},H=()=>{x(!1)},G=e=>{const t=R.find(t=>t.id===e)||{};g(t)},U=e=>O.includes(e)?_:M.includes(e)?F:[];return a.createElement(qa.A,{open:e,sx:{".MuiPaper-root":{maxWidth:"98vw",width:"98vw",zIndex:2e3}},transitionDuration:0},a.createElement(La.A,null,"Edit Populations"),a.createElement(Pa.A,null,a.createElement(Tl.Mp,{sensors:P,collisionDetection:Tl.y$,onDragEnd:e=>{const{active:t,over:n}=e,a=O.includes(n.id),i=O.includes(t.id);if(0===_.length&&t.rect.current.translated.top+160t.rect.current.initial.top){const e=O.indexOf(t.id),n=_.toSpliced(e,1);z(n)}if(t.id!==n.id)if(a){const e=O.indexOf(n.id);if(i){const n=O.indexOf(t.id),a=(0,Bl.be)(U(t.id),n,e);z(a)}else{const t=_.toSpliced(e,0,B);z(t)}}else if(!a&&i){const e=O.indexOf(t.id),n=_.toSpliced(e,1);z(n)}},onDragStart:e=>{T(e.active.id);const t=U(e.active.id).find(t=>t.id===e.active.id);$(t)},onDragCancel:()=>{T(null),$({})}},a.createElement(vn.A,{variant:"h6"},"Populations to Analyze"),a.createElement(vn.A,{variant:"caption",sx:{color:"#808080"}},"At leaset one population is required to generate valid results. "),a.createElement(vn.A,{variant:"caption",sx:{color:"#808080"}},"Drag the population cards to reorder the legends for all charts."+(i?"":" Once saved, the charts will update based on this new order.")),a.createElement(Bl.gB,{items:_,strategy:Bl.kL},a.createElement(Ct.A,{direction:"row",useFlexGap:!0,flexWrap:"wrap",spacing:1,mt:.5,sx:{minHeight:"244px"}},_.map((e,t)=>a.createElement(Wl,{key:e.id,id:e.id,index:t,onEditClick:()=>G(e.id),onDelete:()=>W(e.id),item:e,disabled:!1})),a.createElement(E.A,{theme:I},a.createElement(y.A,{size:"small",onClick:()=>{g({id:"newpopulationid",label:"",color:"#E7AF53",include_dataset:[],gender:[L],isNew:!0,age_range:[0,80],extra_filter:[],type:"BodyScan"})},color:"primary",sx:{width:"223px",height:"264px",border:"1px solid #DBDBDB",borderRadius:"10px",padding:"16px",alignItems:"start",justifyContent:"start"}},"+ Add Comparison")))),a.createElement(vn.A,{variant:"h6"},"Available Populations"),a.createElement(vn.A,{variant:"caption",sx:{color:"#808080"}},'Drag a population card from "Available Populations" to "Populations to Analyze" to set it as the data set for this analysis.'),a.createElement(Bl.gB,{items:F,strategy:Bl.kL},a.createElement(Ct.A,{direction:"row",useFlexGap:!0,flexWrap:"wrap",spacing:1,mt:.5,sx:{minHeight:"150px"}},F.map((e,t)=>a.createElement(Wl,{key:e.id,id:e.id,index:t,onEditClick:()=>G(e.id),onDelete:()=>W(e.id),item:e,disabled:!1,onMoveClick:()=>z(t=>[...t,e])})))),a.createElement(Tl.Hd,{adjustScale:!0,style:{transformOrigin:"0 0 "}},j?a.createElement(Ll,{item:B,id:j,isDragging:!0}):null))),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>r()}),a.createElement(ra,{text:"Save",color:"primary",disabled:_.length<1,onClick:()=>r(O)})),a.createElement(vr,{open:0!==Object.keys(u).length,onClose:(e,n)=>((e,n)=>{const{id:a}=e;"save"===n?"newpopulationid"===a?(async e=>Ze(Qe.PROJECT_VIEW.population,e))({project:t,...e}).then(e=>{e&&(D([...R,e]),z([..._,e]),g({}))}):Zt(a,e).then(t=>{if(t?.data)A(!0),k(t.data),C(a),g(e);else if(t?.id){const e=R.filter(e=>e.id!==t.id);if(D([t,...e]),O.includes(t.id||"")){const e=O.findIndex(e=>e===t.id);z(n=>n.toSpliced(e,1,t))}g({})}}):g({})})(e,n),rowDetail:u,prefilledGender:L,populationMap:{BodyScan:s,MyAlva:o?.dataset||[]},populationOptions:o,projectTypes:q,dbVersion:c}),m&&a.createElement(bi,{isLoading:m,isSingleChart:!0}),a.createElement(qa.A,{onClose:()=>V("del"),open:f},a.createElement(La.A,null,"Please Confirm"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},"Are you sure that you want to delete this population?")),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>V("del")}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{return e=w,b(!1),void(async e=>Xe(`${Qe.PROJECT_VIEW.population}/${e}/`))(e).then(t=>{t?.data?(x(!0),k(t.data)):(D(R.filter(t=>t.id!==e)),O.includes(e)&&z(t=>t.filter(t=>t.id!==e)))});var e}}))),a.createElement(qa.A,{onClose:H,open:h},a.createElement(La.A,null,"Warning"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},`This population is currently in use in analysis ${S.map(e=>e.title).join(" & ")}, please remove this population from the analysis mentioned above in order to delete it.`)),a.createElement(Va.A,null,a.createElement(ra,{text:"Ok",color:"primary",onClick:H}))),a.createElement(qa.A,{onClose:()=>V("edit"),open:v},a.createElement(La.A,null,"Please Confirm"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},`This population is currently in use in analysis ${S.map(e=>e.title).join(" & ")}. Are you sure that you want to save these changes?`),m&&a.createElement(bi,{isLoading:m,isSingleChart:!0})),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>V("edit")}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{return e=w,p(!0),void Zt(e,{...u,force:!0}).then(e=>{if(e?.id){const t=R.filter(t=>t.id!==e.id);if(O.includes(e?.id)){const t=O.findIndex(t=>t===e.id);z(n=>n.toSpliced(t,1,e))}D([e,...t]),C(""),A(!1),g({})}p(!1)});var e}}))))};Ar.propTypes={open:O().bool.isRequired,project:O().string.isRequired,selectedPopulation:O().instanceOf(Array).isRequired,onPopulationEditClose:O().func.isRequired,isNew:O().bool.isRequired,populationMap:O().instanceOf(Array).isRequired,myAlvaOptions:O().instanceOf(Object).isRequired,dbVersion:O().string.isRequired};const wr=Ar,Cr={label:"",color:"#E7AF53",include_dataset:[],ethnicity:[],gender:[],isNew:!0,age_bucket:[],extra_filter:[],type:"MyAlva"},Sr=({id:e,data:t,source:n})=>{const i=(0,l.useSelector)(se),[r,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)(!1),d=(0,l.useDispatch)(),m=(0,p.Zp)(),[u,g]=(0,a.useState)(""),[E,y]=(0,a.useState)(""),[x,f]=(0,a.useState)([]),[b,v]=(0,a.useState)(null),[A,w]=(0,a.useState)([]),[C,S]=(0,a.useState)([]),[k,_]=(0,a.useState)({}),[R,D]=(0,a.useState)(""),O=x.map(e=>e.label),F=void 0===t?.populations||0===t.populations.length,M=x.map(e=>e.label),j=(0,l.useSelector)(pe),[I,T]=(0,a.useState)(null),B=Boolean(I),[$,N]=(0,a.useState)(!1),q="PROJECT_VIEW"===n&&i?.types||["BODY"],L="PROJECT_VIEW"===n?0!==j.length&&"normal"!==j:"normal"===j;(0,a.useEffect)(()=>{n&&jl({type:n,return_tree:!0}).then(e=>{e?.data&&w(e.data)})},[n]),(0,a.useEffect)(()=>{g(t?.title||""),y(t?.description||""),_({unit:t?.unit||"cm",unit_weight:t?.unit_weight||"kg"}),f(t?.populations||[]),Jt({project_types:q,project_id:"PROJECT_VIEW"===n&&i?.id||""}).then(e=>{S(e?.data||[]),"PROJECT_VIEW"===n&&D(e?.db_version||"latest")}),void 0!==t?.populations&&0!==t.populations.length||"MYALVA"!==n||c(!0)},[t]),(0,a.useEffect)(()=>{const e=x.filter(e=>void 0===e?.statistics&&!e.isNew);0!==e.length&&e.forEach(e=>{Il(e).then(n=>{if(n){const a=0!==x.length?x:t.populations,i=a.findIndex(t=>t.label===e.label),l="Sizeset"===e.type?{...e,...n}:{...e,statistics:n?.statistics,country:n?.country||e.country},r=a.toSpliced(i,1,l);f(r)}})})},[x]),(0,a.useEffect)(()=>{(0===Object.keys(k).length||k.unit===t?.unit&&k.unit_weight===t?.unit_weight)&&(r||0===u.length||u===t.title&&E===t.description)||Bn(e,{title:u,description:E,...k},n).then(e=>{e&&(d(ae(e)),o(!1))})},[k,r]);const P=t=>{Bn(e,{populations:t||x},n).then(e=>{e&&(d(ae(e)),c(!1))})};return a.createElement(Ct.A,{direction:"column",spacing:.5,mt:-1},a.createElement(Ct.A,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{height:"28px"}},a.createElement(h.A,{"aria-label":"back",onClick:()=>m("../"),sx:{color:"#808080",padding:0,"&:hover":{color:"#EC7700",backgroundColor:"transparent"}}},a.createElement(kl.A,{fontSize:"small"}),a.createElement(vn.A,{variant:"body1",style:{padding:"0 2px",fontSize:"14px"}},"Back to all "+("PROJECT_VIEW"===n?"scan data analysis":"projects"))),"MYALVA"!==n&&a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"baseline"},0!==x.length&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"caption",component:"i"},`Last Modified: ${_e(t?.last_modified)}`),a.createElement(ra,{text:"Download All",color:"primary",disabled:L,onClick:t=>{0!==j.length&&t.preventDefault(),d(me({analysisToDownload:e,source:"analysis_scan_data"})),Gt(e).then(e=>{null!==e?Pe(e):d(me({analysisToDownload:""}))})}})),a.createElement(h.A,{onClick:e=>T(e.currentTarget)},a.createElement(_l.A,{fontSize:"small"})),a.createElement(Mt.A,{id:`${n}-action-menu`,anchorEl:I,open:B,dense:"true",transitionDuration:0,onClose:()=>T(null)},a.createElement(jt.A,{onClick:()=>{T(null),N(!0)}},a.createElement(Ra.A,{fontSize:"small"}),"Delete")))),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",sx:{".MuiStack-root #edit-btn":{display:"none"},"&:hover":{".MuiStack-root #edit-btn":{display:"inline-flex"}}}},a.createElement("div",null,a.createElement(Ct.A,{direction:"row"},a.createElement(vn.A,{variant:"h4",sx:{fontSize:"30px"}},t?.title||""),a.createElement(h.A,{id:"edit-btn",size:"small",sx:{color:"#5F504D",width:"37px",height:"37px",marginLeft:"5px"},onClick:()=>o(!0)},a.createElement(zl.A,null))),t?.description&&0!==t.description.length&&a.createElement(vn.A,{variant:"body1",sx:{color:"#808080",fontSize:"14px"}},`Description: ${t?.description}`)),a.createElement(Ct.A,{direction:"column",alignItems:"end",spacing:1,mt:1},a.createElement(Fl,{label:"Measurement",options:["cm","inch"],value:k?.unit||"cm",color:"primary",onChange:e=>_(t=>({...t,unit:e}))}),"PROJECT_VIEW"!==n&&a.createElement(Fl,{label:"Weight",options:["kg","lbs"],value:k?.unit_weight||"kg",color:"primary",onChange:e=>_(t=>({...t,unit_weight:e}))}))),a.createElement(Ct.A,{direction:"column",spacing:0},"PROJECT_VIEW"===n?a.createElement(a.Fragment,null,a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"h6"},"Populations"),a.createElement(ra,{size:"small",text:"Edit",color:"default",variant:"outlined",onClick:()=>c(!0)})),a.createElement(Ct.A,{direction:"row",spacing:.5,mt:.5,useFlexGap:!0,flexWrap:"wrap"},x.map(e=>a.createElement("div",{key:`display-card-${e.id}`,style:{padding:"16px",border:"1px solid #DBDBDB",background:"#FDFDFD",borderRadius:"10px",width:"190px",height:"115px",display:"flex",flexDirection:"column",color:"#8c8c8c",boxShadow:"rgb(63 63 68 / 5%) 0px 0px 0px 1px, rgb(34 33 81 / 15%) 0px 1px 3px 0px"}},a.createElement(Ct.A,{direction:"row",alignItems:"center",spacing:1},a.createElement("div",{style:{width:"5px",height:"16px",backgroundColor:e.color,borderRadius:"0 3px 3px 0",display:"inline-block",margin:"3px 5px 3px -16px",verticalAlign:"baseline"}}," "),a.createElement("div",{style:{display:"inline-block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"180px",fontWeight:700,lineHeight:"24px",color:"#5F504D"},title:e.label},e.label)),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"16px"}},"Total Body Data"),a.createElement(vn.A,{variant:"h5",sx:{color:"#5F504D"}},e?.statistics?.total||0),a.createElement(z.A,{size:"small",label:"ABP"===e.type?"Standard":e.type,sx:{backgroundColor:"rgba(229, 229, 229, 1)",color:"#000000",width:"40%",fontSize:"14px",borderRadius:"5px",marginTop:"5px",span:{padding:0}}}))))):a.createElement(a.Fragment,null,a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"h6"},"Analysis Objects"),s?a.createElement(a.Fragment,null,a.createElement(ra,{disabled:0===x.length,size:"small",text:"Save",color:"primary",onClick:()=>P()}),!F&&a.createElement(ra,{size:"small",variant:"outlined",text:"Cancel",color:"default",onClick:()=>{c(!1),f(t?.populations||[])}})):a.createElement(ra,{size:"small",text:"Edit",color:"default",variant:"outlined",onClick:()=>c(!0)})),s&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"caption",sx:{color:"#808080"}},"At leaset one object is required to generate valid results. "),a.createElement(vn.A,{variant:"caption",sx:{color:"#808080"}},"Drag the object cards to reorder the legends for all charts."+(F?"":" Once saved, the charts will update based on this new order."))),a.createElement(Ct.A,{direction:"row",spacing:0,alignItems:"center"},a.createElement(Hl,{order:O,onOrderChange:e=>{f(e)},populations:x,disabled:!s,onEditClick:e=>{v(e)},onDelete:e=>{const t=x.toSpliced(e,1);f(t)},onAddClicked:()=>{const e=[...x,Cr];f(e),v(e.length-1)},isNew:F})))),a.createElement(qa.A,{open:r,maxWidth:"md",transitionDuration:0},a.createElement(La.A,null,"Edit Analysis Info"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(Ct.A,{direction:"column",spacing:2},a.createElement("div",{style:{width:"510px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Title"),a.createElement(si,{label:"title",placeholder:"Title",value:u,width:500,style:{marginRight:0},onChange:e=>g(e.target.value)})),a.createElement("div",null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Description"),a.createElement(si,{label:"description",value:E,multiline:!0,rows:10,width:500,onChange:e=>y(e.target.value),style:{minHeight:"200px",marginRight:0}}))))),a.createElement(Va.A,null,a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>{g(t?.title||""),y(t?.description||""),o(!1)}}),a.createElement(ra,{color:"primary",text:"Save",onClick:()=>{o(!1)}}))),"PROJECT_VIEW"===n&&s&&a.createElement(wr,{open:"PROJECT_VIEW"===n&&s,selectedPopulation:x,project:t.project,isNew:F,onPopulationEditClose:e=>{e&&P(e),c(!1)},myAlvaOptions:A,populationMap:C,dbVersion:R}),null!==b&&a.createElement(vr,{open:null!==b,onClose:(e,t)=>((e,t)=>{if("save"===t){const t="ABP"===e.type?{label:e.label,collection:e.collection,color:e.color,type:e.type,name:e.name,body_type:e.body_type,size_range:e.size_range,country:e.country}:e;Il(t).then(e=>{if(e){const n="Sizeset"===t.type?{...t,...e,isNew:!1}:{...t,statistics:e?.statistics,country:e?.country||t.country,isNew:!1},a=x.toSpliced(b,1,n);f(a),v(null)}})}else{if(e.isNew){const e=x.toSpliced(b,1);f(e)}v(null)}})(e,t),rowDetail:x.at(b),populationMap:{BodyScan:C,MyAlva:A?.dataset||[],ABP:A?.standard||[]},populationOptions:A,existingName:M,unit:k?.unit||"cm",projectTypes:[]}),$&&a.createElement(Ua,{title:u,id:e,source:n,onClose:e=>{e?m("../"):N(!1)}}))};Sr.propTypes={id:O().string.isRequired,data:O().instanceOf(Object).isRequired,source:O().string.isRequired};const kr=Sr,_r=[{value:"Body Data Distribution",key:"dc"},{key:"sp",value:"Market Analysis"},{key:"dt",value:"DT"},{key:"m4m",value:"M4M"},{key:"mc",value:"MC"}],zr={minWidth:"80px",borderRadius:"10px 10px 0 0",backgroundColor:"#FFFFFF",borderBottom:"1px solid #CBCBCB",minHeight:"30px",zIndex:"inherit",p:"0 20px","&.Mui-selected":{backgroundColor:"#FFFFFF",borderBottom:"2px solid #EC7700"},"&:hover":{color:"#EC7700"}},Rr=()=>{const e=(0,p.zy)(),t=(0,l.useDispatch)(),n=e.pathname.split("/")[3],[i,r]=(0,a.useState)({}),o=(0,l.useSelector)(ie),s=(0,l.useSelector)(se),c=s.types?.includes("BODY"),u=(t=>{for(let n=0;n{o?.id===n?r(o||{}):jn(n,"PROJECT_VIEW").then(e=>{e&&(r(e||{}),t(ae(e)))})},[n,o]),a.createElement(_t.A,{sx:{padding:"10px 20px"}},0!==Object.keys(i).length&&a.createElement(kr,{id:n,data:i,source:"PROJECT_VIEW"}),i?.populations&&0!==i.populations.length&&a.createElement(a.Fragment,null,a.createElement(E.A,{theme:I},a.createElement(St.A,{color:"primary",value:g,"aria-label":"basic tabs",sx:{marginTop:"16px",minHeight:"30px",".MuiTabs-indicator":{display:"none"}}},a.createElement(kt.A,{label:"Summary",value:":id/scans/:scanid",component:m.N_,to:"./",sx:zr}),(c?_r:_r.filter(e=>"mc"!==e.key)).map(e=>a.createElement(kt.A,{key:e.key,label:e.value,value:`:id/scans/:scanid/${e.key}`,component:m.N_,to:`./${e.key}`,sx:zr})))),a.createElement(_t.A,{sx:{padding:"0 10px 20px",height:"calc(100% - 97px)",minHeight:"500px"}},a.createElement(p.sv,null))))};var Dr=n(30090);const Or=(0,Ma.Ay)(Oa.A)(()=>({[`&.${Fa.A.root}`]:{backgroundColor:"transparent",color:"#544744",borderBottom:"none",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"inline-block",height:"100%",width:"100%",padding:0},[`&.${Fa.A.head}`]:{fontSize:"16px",border:"none",display:"table-cell",padding:"16px"}})),Fr=(0,Ma.Ay)(Aa.A)(()=>({height:"60px",borderBottom:"1px solid #E0E0E0","&:hover":{backgroundColor:"rgba(236, 119, 0, 0.05)"}})),Mr=[{id:"title",label:"Title",width:"50%"},{id:"creator",label:"Creator",width:"20%"},{id:"last_modified",label:"Last Updated",width:"20%"}],jr=({item:e,openSnackBar:t,onDownloadClicked:n,onAnalysisDelete:i})=>a.createElement(Fr,{key:e.id,sx:{"#del-btn":{visibility:"hidden",marginRight:"10px"},"&:hover":{"#del-btn":{visibility:"visible"}}}},Mr.map(t=>{return a.createElement(Oa.A,{key:`${e.client}-${t.id}`,style:{padding:0}},a.createElement(Or,{align:"left",component:m.N_,to:e.id},a.createElement("div",{style:{margin:0,display:"flex",alignItems:"center",height:"60px",padding:"0 20px"}},a.createElement("span",null,(n=e[t.id],i=t.id,(Array.isArray(n)?n.join(", "):"last_modified"===i?ke(n):n)||"N/A")))));var n,i}),a.createElement(Or,null,a.createElement(E.A,{theme:I},a.createElement(h.A,{edge:"end","aria-label":"download",color:"primary",disabled:t,onClick:n,sx:{margin:"12px 8px 12px 16px"}},a.createElement(Dr.A,{fontSize:"large"})))),a.createElement(Oa.A,null,a.createElement(h.A,{id:"del-btn",size:"small",sx:{color:"#5F504D",zIndex:588},onClick:t=>{t.preventDefault(),i(e.id,e.title)}},a.createElement(Ra.A,null))));jr.propTypes={item:O().instanceOf(Object).isRequired,openSnackBar:O().bool.isRequired,onDownloadClicked:O().func.isRequired,onAnalysisDelete:O().func.isRequired};const Ir=jr,Tr=()=>{const e=(0,p.Zp)(),[t,n]=(0,a.useState)([]),[i,r]=(0,a.useState)(!1),o=(0,p.zy)(),s=(0,l.useDispatch)(),c=o.pathname.split("/")[1],d=(0,l.useSelector)(pe),[m,u]=(0,a.useState)(null),g=Boolean(m),h=()=>{r(!0),Mn({page_size:50,project:c},"PROJECT_VIEW").then(e=>{n(e?.data||[]),r(!1)})};return(0,a.useEffect)(()=>{h()},[c]),a.createElement(_t.A,{sx:{height:"calc(100% - 50px)",overflowY:"auto"}},a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",padding:"0 16px"}},a.createElement("svg",{id:"Group_1052","data-name":"Group 1052",xmlns:"http://www.w3.org/2000/svg",width:"31",height:"19",viewBox:"0 0 31 19"},a.createElement("circle",{id:"Ellipse_7","data-name":"Ellipse 7",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(0 14)"}),a.createElement("circle",{id:"Ellipse_8","data-name":"Ellipse 8",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(8 6)"}),a.createElement("circle",{id:"Ellipse_9","data-name":"Ellipse 9",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(17 12)"}),a.createElement("circle",{id:"Ellipse_10","data-name":"Ellipse 10",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(26)"}),a.createElement("path",{id:"Path_990","data-name":"Path 990",d:"M6410.5,1604.5l8.038-7.956,8.987,6.015,9-12.058",transform:"translate(-6408 -1588)",fill:"none",stroke:"#000",strokeWidth:"2"})),a.createElement(vn.A,{variant:"h5",component:"h5",style:{padding:"0 15px"}},"Scan Data Analysis"),a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New Analysis",color:"primary",onClick:()=>{const t={title:`New Analysis - ${_e(new Date)}`,description:"New Analysis",unit:"cm",unit_weight:"kg",project:c};In(t,"PROJECT_VIEW").then(t=>{t?.id&&e(`./${t.id}`)})}})),0!==t.length?a.createElement(wa.A,{key:"project-list-table",style:{backgroundColor:"#FFFFFF",color:"#544744",height:"calc(100% - 145px)",padding:"0 16px",width:"auto"},component:"div"},a.createElement(Ca.A,{stickyHeader:!0,"aria-label":"project-list-table",style:{borderCollapse:"collapse"}},a.createElement(Sa.A,null,a.createElement(Aa.A,{style:{borderBottom:"1px solid #E0E0E0"}},Mr.map(e=>a.createElement(Or,{key:`scan-list-${e.id}`,sx:{width:e.width}},e.label)))),a.createElement(ka.A,null,t.map(e=>a.createElement(Ir,{key:e.id,item:e,openSnackBar:0!==d.length&&"normal"!==d,onDownloadClicked:t=>((e,t)=>{0!==d.length&&t.preventDefault(),s(me({analysisToDownload:e.id,source:"analysis_scan_data"})),Gt(e.id).then(e=>{null!==e?Pe(e):s(me({analysisToDownload:""}))})})(e,t),onAnalysisDelete:(e,t)=>u({id:e,title:t})}))))):a.createElement(_t.A,{sx:{display:"flex",justifyContent:"center",alignItems:"center"}},a.createElement(vn.A,{variant:"body2",style:{position:"fixed",top:"50%",color:"#A0A0A0"}},i?"Loading...":"There is no Analysis created at the moment. Please start adding your Scan Data Analysis by clicking the Add New Analysis button above.")),g&&a.createElement(Ua,{title:m.title,id:m.id,source:"PROJECT_VIEW",onClose:e=>{u(null),e&&h()}}))};var Br=n(84610),$r=n(72151),Nr=n.n($r),qr=n(76968),Lr=n.n(qr),Pr=n(87100),Wr=n.n(Pr),Vr=n(7054),Hr=n.n(Vr),Gr=n(24671),Ur=n.n(Gr),Yr=n(82747),Zr=n.n(Yr),Jr=n(68818),Xr=n.n(Jr);Nr().register([Lr(),Wr(),Hr(),Zr(),Xr(),Ur()]);const Qr=Nr(),Kr=(0,Br.A)(Qr),eo=({id:e,shouldRefresh:t,source:n,onClick:i=M()})=>{const[l,r]=(0,a.useState)([]),[o,s]=(0,a.useState)({}),[c,d]=(0,a.useState)(!0),[m,p]=(0,a.useState)(!0),[u,g]=(0,a.useState)(1280),h=.49*(u-60),E=7*h/10.7,y={...o,width:h,height:E},x=()=>{const e=document.getElementById("detail");g(e.offsetWidth)};return(0,a.useEffect)(()=>(x(),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)}),[]),(0,a.useEffect)(()=>{t&&(d(!0),p(!0))},[t]),(0,a.useEffect)(()=>{var t;c&&m&&(t=e,p(!1),Nn(t,n).then(e=>{if("done"===e?.task?.status||"failed"===e?.task?.status){const t=e?.result_data?JSON.parse(e.result_data):{},{layout:n,data:a}=t;r(a||[]),s(n||{}),d(!1)}else"pending"!==e?.task?.status&&"processing"!==e?.task?.status||p(!0)}))},[e,c,m]),a.createElement(Ct.A,{spacing:1,direction:"column",justifyContent:"space-between",sx:{width:"49%",position:"relative",height:`${E}px`}},(0!==l.length||0!==Object.keys(o).length)&&a.createElement(Kr,{data:l,onClick:i,layout:y,config:{modeBarButtonsToRemove:["select2d","lasso2d"],displaylogo:!1}}),c&&a.createElement(bi,{isLoading:c,isSingleChart:!0}))};eo.propTypes={id:O().string.isRequired,shouldRefresh:O().bool.isRequired,source:O().string.isRequired,onClick:O().func};const to=eo,no=({id:e,type:t})=>{const n=(0,p.Zp)(),[i,r]=(0,a.useState)([]),[o,s]=(0,a.useState)(!1),c=(0,l.useSelector)(ie);return(0,a.useEffect)(()=>{var n;n={analysis:c?.id||e,delivery_type:"SP",is_summary:!0},s(!0),$n(n,t).then(e=>{e?.data&&(r(e.data.map(e=>e.id)),s(!1))})},[e,c]),a.createElement(Ct.A,{direction:"column"},a.createElement(vn.A,{variant:"h6"},"Market Analysis"),a.createElement(Ct.A,{direction:"row",justifyContent:"end"},a.createElement(E.A,{theme:I},a.createElement(y.A,{color:"primary",onClick:()=>n("./"+("PROJECT_VIEW"===t?"sp":"mc"))},"More Details >>"))),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",useFlexGap:!0,flexWrap:"wrap"},i.map(e=>a.createElement(to,{id:e,key:e,shouldRefresh:o,source:t}))))};no.propTypes={id:O().string.isRequired,type:O().string.isRequired};const ao=no,io=(0,Br.A)(Qr),lo=({id:e,shouldContentUpdate:t,source:n})=>{const[i,l]=(0,a.useState)({}),[r,o]=(0,a.useState)(!0),[s,c]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{t&&(o(!0),c(!0))},[t]),(0,a.useEffect)(()=>{var t;0!==e.length&&r&&s&&(t=e,c(!1),Nn(t,n).then(e=>{"done"===e?.task?.status||"failed"===e?.task?.status?(l(e||{}),o(!1)):"pending"!==e?.task?.status&&"processing"!==e?.task?.status||c(!0)}))},[e,r,s]),a.createElement(Ct.A,{spacing:1,direction:"column",justifyContent:"space-between",sx:{position:"relative"}},i?.result_data&&a.createElement(io,(0,kn.A)({},JSON.parse(i.result_data),{config:{modeBarButtonsToRemove:["select2d","lasso2d"],displaylogo:!1}})),r&&a.createElement(bi,{isLoading:r,isSingleChart:!0}))};lo.propTypes={id:O().string.isRequired,shouldContentUpdate:O().bool.isRequired,source:O().string.isRequired};const ro=lo,oo=(0,Br.A)(Qr),so=({id:e,shouldContentUpdate:t,source:n})=>{const[i,l]=(0,a.useState)({}),[r,o]=(0,a.useState)(!0),[s,c]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{t&&(o(!0),c(!0))},[t]),(0,a.useEffect)(()=>{var t;0!==e.length&&r&&s&&(t=e,c(!1),Nn(t,n).then(e=>{"done"===e?.task?.status||"failed"===e?.task?.status?(l(e||{}),o(!1)):"pending"!==e?.task?.status&&"processing"!==e?.task?.status||c(!0)}))},[e,r,s]),a.createElement(Ct.A,{spacing:1,direction:"column",justifyContent:"space-between",sx:{position:"relative"}},i?.result_data&&a.createElement(oo,(0,kn.A)({},JSON.parse(i.result_data),{config:{modeBarButtonsToRemove:["zoom","select2d","lasso2d"],displaylogo:!1}})),r&&a.createElement(bi,{isLoading:r,isSingleChart:!0}))};so.propTypes={id:O().string.isRequired,shouldContentUpdate:O().bool.isRequired,source:O().string.isRequired};const co=so,mo=({id:e,shouldContentUpdate:t,pomList:n,source:i})=>{const[l,r]=(0,a.useState)({}),[o,s]=(0,a.useState)(!0),[c,d]=(0,a.useState)(!0),[m,p]=(0,a.useState)(!1),u=l?.result_data?Array.from(new Set(l.result_data.map(e=>Object.keys(e)).flat())).filter(e=>"pom"!==e&&"id"!==e&&"result_thumbnail"!==e):[],[g,E]=(0,a.useState)(1280),y=(g-350)/u.length,x=()=>{const e=document.getElementById("detail");E(e.offsetWidth)};(0,a.useEffect)(()=>(x(),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)}),[]),(0,a.useEffect)(()=>{t&&(s(!0),d(!0))},[t]);const f=()=>{p(!1)};return(0,a.useEffect)(()=>{var t;0!==e.length&&o&&c&&(t=e,d(!1),Nn(t,i).then(e=>{"done"===e?.task?.status||"failed"===e?.task?.status?(r(e||{}),s(!1)):"pending"!==e?.task?.status&&"processing"!==e?.task?.status||d(!0)}))},[e,o,c]),a.createElement(Ct.A,{spacing:1,id:"dc-stats-table",direction:"column",justifyContent:"space-between",sx:{position:"relative",width:"100%"}},l?.result_data&&a.createElement(wa.A,{component:qi.A,key:`table-${l.id}`,sx:{borderRadius:"8px",border:"1px solid #E0E0E0",boxShadow:"none"}},a.createElement(Ca.A,{"aria-label":"simple table"},a.createElement(Sa.A,null,a.createElement(Aa.A,null,a.createElement(Oa.A,{align:"left",sx:{width:"200px",p:"4px 16px"}},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement("span",null,"Measurement"),"PROJECT_VIEW"!==i&&a.createElement(Ka.x,{onClickAway:f},a.createElement("div",{style:{lineHeight:"normal"}},a.createElement(ei.A,{PopperProps:{disablePortal:!0},onClose:f,open:m,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:"The standard mode takes the value corresponding to the middle size in the size range. If the total number of sizes is an odd number, the mode takes the value of the middle size. If the total number of sizes is an even number, the mode takes the value of the smaller size of the two middle sizes."},a.createElement(h.A,{"aria-label":"info",onClick:()=>{p(!0)},size:"small",sx:{borderRadius:"20px",height:"20px",width:"20px"}},a.createElement(ri.A,{sx:{fontSize:"20px"}}))))))),u.map(e=>a.createElement(Oa.A,{align:"left",key:e,sx:{width:`calc(${y}px - 32px)`,maxWidth:`calc(${y}px - 32px)`,textOverflow:"ellipsis",overflow:"hidden",p:"4px 16px"}},e)))),a.createElement(ka.A,null,l.result_data.map(e=>a.createElement(Aa.A,{key:e.pom,sx:{"&:last-child td, &:last-child th":{border:0}}},a.createElement(Oa.A,{align:"left",key:"cell-pom",sx:{width:"200px",p:"4px 16px"}},(e=>{if(0!==n.length){const t=n.find(t=>t.key===e);return t?.value||"N/A"}})(e.pom)),u.map(t=>a.createElement(Oa.A,{align:"left",key:`cell-${t}`,sx:{width:"100px",p:"4px 16px"}},e?.[t]?e[t].toFixed(2):"/"))))))),o&&a.createElement(bi,{isLoading:o,isSingleChart:!0}))};mo.propTypes={id:O().string.isRequired,shouldContentUpdate:O().bool.isRequired,pomList:O().instanceOf(Array).isRequired,source:O().string.isRequired};const po=mo,uo=({id:e,type:t})=>{const n=(0,p.Zp)(),[i,r]=(0,a.useState)({}),[o,s]=(0,a.useState)(null),[c,d]=(0,a.useState)(null),m=Boolean(o),u=Boolean(c),[g,h]=(0,a.useState)(!1),[x,f]=(0,a.useState)(!0),[b,v]=(0,a.useState)([]),[A,w]=(0,a.useState)([]),[C,S]=(0,a.useState)([]),k=(0,l.useSelector)(ie),_=(0,l.useSelector)(se).types;(0,a.useEffect)(()=>{t&&Wn(Ne(t,_||["BODY"])).then(e=>{e&&v(e?.results||[])})},[t,_]),(0,a.useEffect)(()=>{f(!0)},[k]),(0,a.useEffect)(()=>{x&&(async(e,t)=>Ye(Qe[t].summaryBM,e))({analysis:e},t).then(e=>{e?.config&&(r(e.config||{}),S(e.items),f(!1),w(e.config?.pom||[]))})},[e,x]),(0,a.useEffect)(()=>{g&&(async(e,t)=>Je(`${Qe[t].summaryBM}`,e))({config:{...i,pom:A},analysis:e},t).then(e=>{e?.status?(f(!0),h(!1),r(e=>({...e,pom:A}))):(h(!1),w(i?.pom||[]))})},[g]);const z=e=>{e&&(r(t=>({...t,method:e})),h(!0)),s(null)};return a.createElement(Ct.A,{direction:"column",spacing:1,alignItems:"center"},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",sx:{width:"100%"}},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"h6"},"Body Measurements"),a.createElement(ra,{id:"pom-select-toggle","aria-controls":u?"chart-menu":void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:e=>{d(e.currentTarget)},color:"default",variant:"outlined",text:"Settings"}),a.createElement(E.A,{theme:I},0!==b.length&&a.createElement(Mt.A,{id:"chart-menu",anchorEl:c,open:u,onClose:()=>((A.length!==i.pom.length||-1!==A.findIndex(e=>!i.pom.includes(e)))&&h(!0),void d(null)),color:"primary",transitionDuration:0,MenuListProps:{"aria-labelledby":"pom-select-toggle"}},b.map(e=>a.createElement(jt.A,{key:`pom-${e.key}`,onClick:()=>{return t=e.key,void(A.includes(t)?w(A.filter(e=>e!==t)):w([...A,t]));var t}},a.createElement(ya.A,{checked:A.includes(e.key),tabIndex:-1,disableRipple:!0,size:"small",sx:{padding:0,marginRight:"4px"}}),e.value))))),a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(E.A,{theme:I},a.createElement(y.A,{id:"calculate-method-toggle","aria-controls":m?"calculate-menu":void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:e=>s(e.currentTarget),endIcon:a.createElement(Hn.A,null),color:"primary",size:"small"},"Calculate: "+("Mean"===i?.method?"Avg.":"Mode")),a.createElement(Mt.A,{id:"calculate-menu",anchorEl:o,open:m,onClose:()=>z(),color:"primary",MenuListProps:{"aria-labelledby":"calculate-method-toggle"}},a.createElement(jt.A,{onClick:()=>z("Mean"),selected:"Mode"!==i?.method},"Avg."),a.createElement(jt.A,{onClick:()=>z("Mode"),selected:"Mode"===i?.method},"Mode"))))),a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(co,{shouldContentUpdate:x,id:C.find(e=>"POM_RADAR"===e.delivery_type)?.id||"",source:t}),a.createElement(ro,{shouldContentUpdate:x,id:C.find(e=>"POM_BAR"===e.delivery_type)?.id||"",source:t})),a.createElement(Ct.A,{direction:"row",justifyContent:"end",sx:{width:"100%"}},a.createElement(E.A,{theme:I},a.createElement(y.A,{color:"primary",onClick:()=>n("./dc")},"More Details >>"))),a.createElement(po,{shouldContentUpdate:x,pomList:b,id:C.find(e=>"DC_STATS"===e.delivery_type)?.id||"",source:t}))};uo.propTypes={id:O().string.isRequired,type:O().string.isRequired};const go=uo;var ho=n(28614),Eo=n(48300),yo=n(41806),xo=n(12642);const fo=["Measurement/Size",...new Array(25).fill(1).map((e,t)=>`Size ${t+1}`)],bo=["","bust_or_chest_circumference","waist_circumference","low_hip_circumference"],vo=()=>bo.map((e,t)=>fo.map((n,a)=>0===a?e:0===t?a<3?"e.g. S/M/L":"":a<3?"e.g. 100":"")),Ao=[{key:"bust_or_chest_circumference",value:"Bust/Chest"},{key:"waist_circumference",value:"Waist Circumference"},{key:"low_hip_circumference",value:"Low Hip Circumference"},{key:"bwd_or_cwd",value:"BWD/CWD"},{key:"lhwd",value:"LHWD"}],wo=e=>Ao.find(t=>t.key===e)?.value||"",Co=({data:e,type:t})=>{const n=e?.[0]||[];return a.createElement(wa.A,{key:`table-${t}`},a.createElement(Ca.A,{"aria-label":"simple table",sx:{border:"1px solid #E0E0E0"}},a.createElement(Sa.A,{sx:{display:"none"}},a.createElement(Aa.A,null,n.map((e,t)=>a.createElement(Oa.A,{align:"center",key:e},0===t?"Measurement/Size":e)))),a.createElement(ka.A,null,e.map((e,i)=>a.createElement(Aa.A,{key:`${t}-row-${e?.[0]||i}`},n.map((n,l)=>a.createElement(Oa.A,{align:"center",key:`${t}-${e[l]}-${n}`,sx:{maxWidth:"200px",borderLeft:0===l?"none":"1px solid #E0E0E0"}},0===l?0===i?"Measurement/Size":wo(e[l]):e[l])))),"standard"!==t&&a.createElement(a.Fragment,null,a.createElement(Aa.A,{key:`${t}-row-bwd`},n.map((t,n)=>a.createElement(Oa.A,{align:"center",key:`bwd-size${t}`,sx:{maxWidth:"200px",borderLeft:0===n?"none":"1px solid #E0E0E0"}},0===n?"BWD/CWD":+((+e[1][n]||0)-+e[2][n]||0).toFixed(2)))),a.createElement(Aa.A,{key:`${t}-row-lhwd`},n.map((t,n)=>a.createElement(Oa.A,{align:"center",key:`lhwd-size${t}`,sx:{maxWidth:"200px",borderLeft:0===n?"none":"1px solid #E0E0E0"}},0===n?"LHWD":+((+e[3][n]||0)-+e[2][n]||0).toFixed(2))))))))};Co.propTypes={data:O().instanceOf(Array).isRequired,type:O().string.isRequired};const So=Co,ko=({data:e,type:t})=>{const{Measurement:n,...i}=e,l=n?.[0]||[];return a.createElement(wa.A,{key:`table-${t}`},a.createElement(Ca.A,{"aria-label":"simple table",sx:{border:"1px solid #E0E0E0"}},a.createElement(Sa.A,{sx:{display:"none"}},a.createElement(Aa.A,null,l.map(e=>a.createElement(Oa.A,{align:"center",rowSpan:1,colSpan:0===e.length?2:1,key:`table-${t}-${e}`},e)))),a.createElement(ka.A,null,n.map((e,i)=>a.createElement(Aa.A,{key:`table-${t}-measurement-${e}`},0===i&&a.createElement(Oa.A,{rowSpan:n.length},"Measurement"),e.map((e,n)=>a.createElement(Oa.A,{key:`table-${t}-measurement-cell-${e}-${n}`},Array.isArray(e)?`${e[0]} (${+(100*e[1]).toFixed(1)}%)`:e)))),Object.keys(i).map(n=>a.createElement(a.Fragment,null,e[n].map((i,l)=>a.createElement(Aa.A,{key:`table-${t}-${n}-${i?.[0]||l}`},0===l&&a.createElement(Oa.A,{rowSpan:e[n].length},n),i.map((e,r)=>a.createElement(Oa.A,{key:`table-${t}-${n}-${i?.[0]||l}-cell-${e}-${r}`},Array.isArray(e)?`${e[0]} (${+(100*e[1]).toFixed(1)}%)`:e)))))))))};ko.propTypes={data:O().instanceOf(Object).isRequired,type:O().string.isRequired};const _o=ko,zo=(0,Br.A)(Qr),Ro=({id:e,type:t})=>{const[n,i]=(0,a.useState)(!0),[l,r]=(0,a.useState)([]),[o,s]=(0,a.useState)({}),[c,d]=(0,a.useState)(1280),m=.49*(c-60),p=7*m/10.7,u={...o,width:m,height:p},g=()=>{const e=document.getElementById("detail");d(e.offsetWidth)};return(0,a.useEffect)(()=>(g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}),[]),(0,a.useEffect)(()=>{i(!0),0!==e.length&&0!==t.length&&(async(e,t)=>Ye(`${Qe.PROJECT_VIEW.marketCoverageCharts}/${e}/`,{type:t}))(e,t).then(e=>{if(e?.chart_data){const t=JSON.parse(e.chart_data),{layout:n,data:a}=t;r(a||[]),s(n||{}),i(!1)}})},[e,t]),a.createElement(Ct.A,{spacing:1,direction:"column",justifyContent:"space-between",sx:{width:"49%",position:"relative",height:`${p}px`}},0!==Object.keys(o).length&&a.createElement(zo,{data:l,layout:u,config:{modeBarButtonsToRemove:["select2d","lasso2d"],displaylogo:!1,webgl:{preserveDrawingBuffer:!1,alpha:!1,antialias:!1,powerPreference:"high-performance"}}}),n&&a.createElement(bi,{isLoading:n,isSingleChart:!0}))};Ro.propTypes={id:O().string.isRequired,type:O().string.isRequired};const Do=Ro,Oo=({data:e,tableType:t,selectedCoreSize:n,onCoreSizeChange:i=M(),options:l=Le,isDisplay:r=!1})=>a.createElement(Ct.A,{direction:"column",spacing:1,p:1,sx:{width:220},alignItems:"center"},e.map((e,o)=>0===o?a.createElement(Ct.A,{direction:"column",alignItems:"center",key:`${t}-column-header-size`,sx:{width:"calc(100% - 16px)",backgroundColor:"rgba(229, 229, 229, 0.42)"}},a.createElement(vn.A,null,`${Fe(t)} Fit Form`),r?a.createElement(vn.A,null,n):a.createElement(pi,{field:"",value:n,options:l,onChange:i,width:80})):a.createElement(z.A,{size:"medium",key:`${t}-col-cell-${e}-${o}`,label:e,sx:{backgroundColor:"rgba(229, 229, 229, 0.42)",color:"#000000",width:"calc(100% - 16px)",fontSize:"14px",borderRadius:"8px",".MuiChip-label":{padding:0}}})));Oo.propTypes={data:O().instanceOf(Array).isRequired,tableType:O().string.isRequired,selectedCoreSize:O().string.isRequired,onCoreSizeChange:O().func,options:O().instanceOf(Array),isDisplay:O().bool};const Fo=Oo,Mo=({data:e,onEditClick:t=M(),onDel:n=M(),unit:i,onCloneClicked:r=M(),isSummary:o=!1})=>{const[s,c]=(0,a.useState)("results"),d=(0,l.useDispatch)(),[m,p]=(0,a.useState)(!1),u=(0,l.useSelector)(pe),g=t=>"standard"===t?e?.config?.standard||[]:e?.config?.[t]?.slice(0,4)||[],y=g("current"),x=g("standard"),f=g("recommended"),b="settings"===s?y:e?.result_data?.current,v="settings"===s?x:e?.result_data?.standard,A="settings"===s?f:e?.result_data?.recommended,w=(e,t)=>{const n=g(e);if(0===n.length)return n;const a=n[0].findIndex(e=>e===t),i=n.map(e=>e[a]),l=[...i,""+ +((+i[1]||0)-(+i[2]||0)).toFixed(2),""+ +((+i[3]||0)-(+i[2]||0)).toFixed(2)];return"standard"===e?i:l},C=e?.config?.core_size?.current?w("current",e?.config.core_size.current):[],S=e?.config?.core_size?.recommended?w("recommended",e?.config.core_size.recommended):[],k=e?.config?.core_size?.standard?w("standard",e?.config.core_size.standard):[];return(0,a.useEffect)(()=>{c(o?"settings":"results")},[o]),a.createElement(Ct.A,{spacing:2,direction:"column",sx:{m:1,clear:"both"}},!o&&a.createElement(Ct.A,{spacing:1,direction:"row-reverse"},a.createElement(ei.A,{title:"Delete",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{onClick:()=>{p(!0)}},a.createElement(Li.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Clone",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{onClick:()=>r(e)},a.createElement(yo.A,{fontSize:"small"}))),a.createElement(E.A,{theme:I},a.createElement(ei.A,{title:"Results",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{color:"results"===s?"primary":"default",onClick:()=>c("results")},a.createElement(ho.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Settings",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{color:"settings"===s?"primary":"default",onClick:()=>c("settings")},a.createElement(Eo.A,{fontSize:"small"})))),a.createElement(ei.A,{title:"Download",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{disabled:"normal"===u,onClick:()=>{d(me({analysisToDownload:"normal"})),Yt(e.analysis,{ids:e.id}).then(e=>{null!==e&&Pe(e)})}},a.createElement(xo.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Edit",disableFocusListener:!0,disableTouchListener:!0},a.createElement(h.A,{onClick:t},a.createElement(Pi.A,{fontSize:"small"})))),e?.id&&a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(Do,{id:e.id,type:"bust"}),a.createElement(Do,{id:e.id,type:"low_hip"})),0!==Object.keys(e).length&&a.createElement(Ct.A,{direction:"column"},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",paddingBottom:"5px",fontSize:"1rem",fontWeight:500}},"Core Size"),a.createElement(Ct.A,{direction:"row",spacing:2,justifyContent:"center"},a.createElement(Ct.A,{direction:"column",spacing:2,sx:{marginTop:"30px !important"},alignItems:"flex-end"},[...bo,"BWD/CWD","LHWD"].map(e=>a.createElement(vn.A,{key:`table-row-header-${e}`},""===e?"Measurement":e.includes("_")?wo(e):e))),0!==C.length&&a.createElement(Fo,{data:C,tableType:"current",selectedCoreSize:e.config.core_size.current,isDisplay:!0}),0!==S.length&&a.createElement(Fo,{data:S,tableType:"recommended",selectedCoreSize:e.config.core_size.recommended,isDisplay:!0}),0!==k.length&&a.createElement(Fo,{data:k,tableType:"standard",selectedCoreSize:e.config.core_size.standard,isDisplay:!0}))),a.createElement(Ct.A,{spacing:2,direction:"row",useFlexGap:!0,flexWrap:"wrap"},b&&0!==b.length&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",fontSize:"1rem",fontWeight:500}},`Current Size Chart (${i})`),"settings"===s?a.createElement(So,{data:b||[],type:"current"}):a.createElement(_o,{data:b||[],type:"current"})),A&&0!==A.length&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",fontSize:"1rem",fontWeight:500}},`Recommended Size Chart (${i})`),"settings"===s?a.createElement(So,{data:A||[],type:"recommended"}):a.createElement(_o,{data:A||[],type:"recommended"})),v&&0!==v.length&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",fontSize:"1rem",fontWeight:500}},`Referenced Alvanon Standard Series (${i})`),"settings"===s?a.createElement(So,{data:v||[],type:"standard"}):a.createElement(_o,{data:v||[],type:"standard"}))),a.createElement(qa.A,{onClose:()=>p(!1),open:m},a.createElement(La.A,null,"Delete MC Analysis"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},"Are you sure to delete this MC Analysis?")),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>p(!1)}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{n(),p(!1)}}))))};Mo.propTypes={data:O().instanceOf(Object).isRequired,onEditClick:O().func,onDel:O().func,unit:O().string.isRequired,onCloneClicked:O().func,isSummary:O().bool};const jo=Mo,Io=({id:e})=>{const t=(0,p.Zp)(),[n,i]=(0,a.useState)({}),r=(0,l.useSelector)(ie);return(0,a.useEffect)(()=>{Ut({analysis:r?.id||e}).then(e=>{e&&i(e?.data?.[0]||{})})},[e,r]),0!==Object.keys(n).length&&a.createElement(Ct.A,{direction:"column"},a.createElement(vn.A,{variant:"h6"},"MC"),a.createElement(Ct.A,{direction:"row",justifyContent:"end"},a.createElement(E.A,{theme:I},a.createElement(y.A,{color:"primary",onClick:()=>t("./mc")},"More Details >>"))),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(jo,{unit:r.unit||"",data:n,isSummary:!0})))};Io.propTypes={id:O().string.isRequired};const To=Io,Bo=()=>{const e=(0,p.zy)().pathname.split("/")[3];return a.createElement(Ct.A,{direction:"column",spacing:2,sx:{marginTop:"10px"}},a.createElement(go,{id:e,type:"PROJECT_VIEW"}),a.createElement(ao,{id:e,type:"PROJECT_VIEW"}),a.createElement(To,{id:e}))};var $o=n(62561),No=n.n($o);const qo=({text:e,checked:t=!1,onChange:n,style:i=qe})=>a.createElement(E.A,{theme:I},a.createElement(Za.A,{value:e,control:a.createElement(ya.A,{checked:t,onChange:n,color:"primary"}),label:e,labelPlacement:"end",sx:{border:"1px solid "+(t?"#EC7700":"#DBDBDB"),borderRadius:"4px",backgroundColor:t?"#FBE4CC":"#FFFFFF",padding:"2px 10px",color:t?"#EC7700":"#A0A0A0",".MuiButtonBase-root":{display:"none"},...i}}));qo.propTypes={text:O().string.isRequired,checked:O().bool,onChange:O().func.isRequired,style:O().instanceOf(Object)};const Lo=qo,Po=()=>{const e=(0,a.useRef)(null),t=(0,l.useSelector)(se),n=(0,l.useSelector)(ie),[i,r]=(0,a.useState)([]),[o,s]=(0,a.useState)([]),[c,d]=(0,a.useState)([]),[p,u]=(0,a.useState)([]),[g,E]=(0,a.useState)(!1),[y,x]=(0,a.useState)(!1),f=c.every(e=>i.includes(e.key)),[b,v]=(0,a.useState)(""),A=`${We}api/v1/scan_data_analysis/deliverables/download/${b}/`,[w,C]=(0,a.useState)(!0),[S,k]=(0,a.useState)(""),z=(0,l.useDispatch)(),R=t.types,D=(0,l.useSelector)(pe),O=e=>{Nn(e,"PROJECT_VIEW").then(e=>{"done"===e?.task?.status?(C(!1),s(e?.config?.pom||[]),u(e?.result_data||[]),k("")):"failed"===e?.task?.status&&(k(e?.task?.errors||"error"),C(!1))})};(0,a.useEffect)(()=>{let e;return 0!==b.length&&(O(b),w&&(e=setInterval(()=>{O(b)},5e3))),()=>clearInterval(e)},[b,w]),(0,a.useEffect)(()=>{var e;Wn(Ne("PROJECT_VIEW",R||["BODY"])).then(e=>{if(d(e?.results||[]),0===i.length&&e?.results){const t=e.results.filter(e=>e.default_selected).map(e=>e.key);r(t)}}),n?.id&&(e={analysis:n.id,delivery_type:"DT"},$n(e,"PROJECT_VIEW").then(e=>{if(0===e?.count)C(!1);else if(e?.data?.[0]){const t=e.data[0];v(t.id),t?.config?.pom&&r(t.config.pom)}}))},[n,R]),(0,a.useEffect)(()=>{0!==p.length&&(e?.current?.jspreadsheet?e.current.jspreadsheet.setData(p):No()(e.current,{data:p,minDimensions:[12,10],defaultColWidth:100,updateTable:(e,t)=>{t.classList.add("readonly")}}))},[p]);const F=()=>{x(!1)};return a.createElement(_t.A,{sx:{marginTop:"10px"}},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"h6",component:"h6"},"DT Config"),a.createElement(Ka.x,{onClickAway:F},a.createElement("div",null,a.createElement(ei.A,{PopperProps:{disablePortal:!0},onClose:F,open:y,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:"Export the population count within specific body measurement intervals and their proportion of the total population."},a.createElement(h.A,{"aria-label":"info",onClick:()=>{x(!0)},size:"small",sx:{borderRadius:"30px",height:"30px",width:"30px"}},a.createElement(ri.A,{size:"small"})))))),a.createElement(Ct.A,{spacing:1,direction:"column",sx:{backgroundColor:"#F7F7F7",borderRadius:"10px",minHeight:"200px",padding:"20px"}},w&&0!==i.length&&a.createElement(_.A,{severity:"info",sx:{borderRadius:"6px",".MuiAlert-message p":{margin:0}}},a.createElement("p",null,"We are processing your request to generate DT analysis with the following configs:"),a.createElement("p",null,i.map(e=>c.find(t=>t.key===e)?.value).join(", "))),!w&&0!==b.length&&a.createElement(_.A,{severity:"success",action:a.createElement(a.Fragment,null,0!==p.length&&a.createElement(ra,{text:"Preview",variant:"outlined",color:g?"primary":"default",onClick:()=>E(e=>!e),style:{backgroundColor:"#FFFFFF !important",marginRight:"8px"}}),a.createElement(m.N_,{to:A,download:b,target:"_blank",rel:"noreferrer",onClick:e=>{"normal"===D&&e.preventDefault(),z(me({analysisToDownload:"normal"}))}},a.createElement(ra,{text:"Download",color:"primary",disabled:w||"normal"===D}))),sx:{borderRadius:"6px",".MuiAlert-message p":{margin:0}}},a.createElement("p",null,"Your DT analysis with the following measurements is ready, you can download now."),a.createElement("p",null,o.map(e=>c.find(t=>t.key===e)?.value).join(", ")),a.createElement("p",null,"**If this is not what you wanted, feel free to re-generate by selecting different measurement options below.**")),!w&&0===b.length&&a.createElement(_.A,{severity:"warning",sx:{borderRadius:"6px"}},"There's currently no DT analysis created, please select your measurements and then click Generate button in-order to generate a file containing the calculated results."),0!==S.length&&a.createElement(_.A,{severity:"error",sx:{borderRadius:"6px"}},`Error: ${S}, please re-generate.`),a.createElement("div",{style:{marginBottom:"10px",display:"flex",justifyContent:"space-between",alignItems:"center"}},a.createElement(vn.A,{variant:"subtitle2",component:"span"},"Select Measurements:"),a.createElement(Lo,{text:"Select All",checked:f,onChange:()=>{r(f?[]:c.map(e=>e.key))}})),a.createElement(Ct.A,{spacing:2,direction:"row",useFlexGap:!0,flexWrap:"wrap",sx:{width:"100%",padding:"0 10px"}},c&&c.map(e=>a.createElement(Lo,{text:e.value,key:`dt-option-${e.key}`,checked:i.includes(e.key),onChange:()=>(e=>{i.includes(e)?r(i.filter(t=>t!==e)):r([...i,e])})(e.key)}))),a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row-reverse",paddingTop:"10px"}},a.createElement(ra,{text:"Generate",color:"primary",onClick:()=>{const e={analysis:n.id,config:{pom:i},delivery_type:"DT"};k(""),0!==b.length?Ln(b,{pom:i},"PROJECT_VIEW").then(()=>{C(!0)}):qn(e,"PROJECT_VIEW").then(e=>{e?.id&&(v(e.id),C(!0))})},disabled:0===i.length||w,style:{marginLeft:"10px"}})),a.createElement("div",{ref:e,style:{visibility:g?"visible":"hidden",overflow:"auto",width:"100%",position:"relative",height:g?500:0,borderRight:"1px solid #E0E0E0",marginTop:g?"8px":0,borderBottom:"1px solid #E0E0E0"}})))},Wo=({data:e,onDataChanged:t})=>{const n=(0,a.useRef)(null),[i,l]=(0,a.useState)(!1),[r,o]=(0,a.useState)(vo),s=(e,t,n)=>{const a=r?.[e]?.[n]||"",i=r?.[t]?.[n]||"";return 0!==a.length&&0!==i.length?+((+r?.[e]?.[n]||0)-(+r?.[t]?.[n]||0)).toFixed(2):""},c=[fo.map((e,t)=>0===t?"BWD/CWD":s(1,2,t)),fo.map((e,t)=>0===t?"LHWD":s(3,2,t))],d=fo.map(e=>({title:e,type:"text",width:"Measurement/Size"===e?200:80,readOnly:"Measurement/Size"===e}));return(0,a.useEffect)(()=>{if(0!==e.length){const t=e.map(e=>e.map(e=>e));o(t)}},[e]),(0,a.useEffect)(()=>{l(!0),n.current.jspreadsheet?(n.current.jspreadsheet.setData([...r,...c]),l(!1)):(No()(n.current,{data:[...r,...c],minDimensions:[12,6],columns:d,allowInsertColumn:!1,allowInsertRow:!1,allowDeleteColumn:!1,allowDeleteRow:!1,allowRenameColumn:!1,allowDeletingAllRows:!1,columnSorting:!1,updateTable:(e,t,n,a)=>{if(0===n)if(0===a)t.innerHTML="Size Name";else{const e=t.innerText.includes("_")?wo(t.innerText):t.innerText;t.innerHTML=e}4===a&&0!==n&&t.classList.add("readonly"),5===a&&0!==n&&t.classList.add("readonly")},oneditionend:()=>{const e=n?.current?.jexcel?.getData(),t=e.slice(0,4);o(t)},onblur:()=>{const e=n?.current?.jexcel?.getData(),a=e.slice(0,4);t(a)}}),l(!1))},[r]),a.createElement("div",{ref:n,style:{overflow:"auto",width:"100%",position:"relative",maxHeight:500,borderRight:"1px solid #E0E0E0",borderBottom:"1px solid #E0E0E0"}})};Wo.propTypes={data:O().instanceOf(Array).isRequired,onDataChanged:O().func.isRequired};const Vo=Wo,Ho=({isCancelBtnDisabled:e,data:t,population:n,currentAnalysis:i,onSave:l,unit:r,id:o})=>{const[s,c]=(0,a.useState)({}),[d,m]=(0,a.useState)(!1),[p,u]=(0,a.useState)(!1),[g,h]=(0,a.useState)(!1),[E,y]=(0,a.useState)([]),[x,f]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!1),A=n.map(e=>({key:e.id,value:e.label})),w=void 0===s?.current&&void 0===s?.recommended||(s?.current?.[0]||[]).length<=2&&(s?.recommended?.[0]||[]).length<=2||void 0===s?.title||s?.title?.length>31||void 0===s?.populations,C=s?.standard_id&&0!==E.length?E.find(e=>e.key===s.standard_id)?.sizes:[],S=s?.populations?s.populations.map(e=>A.find(t=>t.key===e)):[],k=(e,t)=>{const n="standard"===e?C:s?.[e]||[];if(0===n.length)return n;const a=n[0].findIndex(e=>e===t),i=n.map(e=>e[a]),l=[...i,""+ +(+i[1]-+i[2]).toFixed(2),""+ +(+i[3]-+i[2]).toFixed(2)];return"standard"===e?i:l},_=s?.core_size?.current?k("current",s.core_size.current):[],z=s?.core_size?.recommended?k("recommended",s.core_size.recommended):[],R=s?.core_size?.standard?k("standard",s.core_size.standard):[];(0,a.useEffect)(()=>{const e={...t};t?.current&&(e.current=t.current.slice(0,4)),t?.recommended&&(e.recommended=t.recommended.slice(0,4)),c(e),(async e=>Ye(Qe.PROJECT_VIEW.standardSizeChartList,e))({unit:r}).then(e=>{if(e?.data){const t=e.data.map(e=>({key:e.id,value:e.name,sizes:e.size_chart}));y(t)}})},[t]);const D=(e,t)=>{if(h("title"===e&&t.length>30),"standard_id"===e){const n=E.find(e=>e.key===t)?.sizes?.[0]||[],a=n[Number.isInteger(n.length/2)?n.length/2:(n.length+1)/2],i=s?.core_size||{};c(n=>({...n,[e]:t,core_size:{...i,standard:a}}))}else c(n=>({...n,[e]:Array.isArray(t)?t.map(e=>e.key):t}))},O=(e,t)=>{const n=t[0].join(" ").trim().split(" ").length+1,a=t.slice(0,4).map(e=>e.slice(0,n)),i=a[0][Number.isInteger(n/2)?n/2:(n+1)/2];c(t=>({...t,[e]:a,core_size:{...t?.core_size||{},[e]:i}})),f(!1)},F=(e,t)=>{const n=s?.core_size||{};c(a=>({...a,core_size:{...n,[e]:t}}))};return a.createElement(Ct.A,{spacing:2,direction:"column",sx:{m:1,clear:"right",position:"relative"}},a.createElement(Ct.A,{spacing:0,direction:"row",useFlexGap:!0,flexWrap:"wrap",sx:{width:"100%"}},a.createElement("div",null,a.createElement(aa.A,{style:{display:"block",minWidth:"120px",boxSizing:"border-box",marginBottom:"5px"}},"Title*"),a.createElement(si,{required:!0,label:"Title",value:s?.title||"",err:g,rows:1,onChange:e=>D("title",e.target.value),style:{padding:"5px 15px",width:400}}),g&&a.createElement(vn.A,{component:"div",variant:"body1",sx:{fontSize:"12px",color:"#FB4E3B",maxWidth:400}},"Title will be used as Excel spreadsheet tab name so it must not be duplicate nor exceed the max lengh of 30.")),a.createElement(pi,{required:!0,field:"Population",multiple:!0,value:S||[],options:A,onChange:(e,t)=>D("populations",t),width:500})),a.createElement(Ct.A,{spacing:0,direction:"column"},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",sx:{margin:"10px 0"}},a.createElement(Ct.A,{direction:"column"},a.createElement(vn.A,{variant:"body2",component:"span",style:{fontSize:"1rem",fontWeight:500}},`Current Size Chart (${r})`),a.createElement(vn.A,{variant:"caption",component:"i",style:{color:"#A0A0A0",fontWeight:100}},"**Please input at least 2 sizes in one of the charts in-order to get valid results**")),a.createElement(pi,{value:"",onChange:(e,t)=>O("current",t.sizes),options:E})),a.createElement(Vo,{data:s.current||[],onDataChanged:e=>O("current",e)}),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",sx:{margin:"10px 0"}},a.createElement(Ct.A,{direction:"column"},a.createElement(vn.A,{variant:"body2",component:"span",style:{fontSize:"1rem",fontWeight:500}},`Recommended Size Chart (${r})`),a.createElement(vn.A,{variant:"caption",component:"i",style:{color:"#A0A0A0",fontWeight:100}},"**Please input at least 2 sizes in one of the charts in-order to get valid results**")),a.createElement(pi,{value:"",onChange:(e,t)=>O("recommended",t.sizes),options:E})),a.createElement(Vo,{data:s.recommended||[],onDataChanged:e=>O("recommended",e)}),a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",fontSize:"1rem",fontWeight:500,marginTop:"16px"}},`Referenced Alvanon Standard Series (${r})`),a.createElement(pi,{value:E.find(e=>e.key===s.standard_id)||"",onChange:(e,t)=>D("standard_id",t.key),options:E,style:{margin:"10px 0"}}),0!==C.length&&a.createElement(So,{data:C||[],type:"standard"})),a.createElement(Ct.A,{direction:"column"},b&&a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(Ct.A,{direction:"column",spacing:2,sx:{marginTop:"45px !important"},alignItems:"flex-end"},[...bo,"BWD/CWD","LHWD"].map(e=>a.createElement(vn.A,{key:`table-row-header-${e}`},""===e?"Measurement":Fe(e)))),0!==_.length&&a.createElement(Fo,{data:_,tableType:"current",selectedCoreSize:s.core_size.current,onCoreSizeChange:(e,t)=>F("current",t),options:s.current[0].slice(1)}),0!==z.length&&a.createElement(Fo,{data:z,tableType:"recommended",selectedCoreSize:s.core_size.recommended,onCoreSizeChange:(e,t)=>F("recommended",t),options:s.recommended[0].slice(1)}),0!==R.length&&a.createElement(Fo,{data:R,tableType:"standard",selectedCoreSize:s.core_size.standard,onCoreSizeChange:(e,t)=>F("standard",t),options:C[0].slice(1)}))),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",sx:{m:1}},a.createElement(ra,{disabled:w,color:"primary",text:"Choose Core Size",onClick:()=>v(!0),style:{width:"150px"}}),a.createElement(Ct.A,{spacing:1,direction:"row"},a.createElement(ra,{disabled:e,variant:"outlined",color:"default",text:"Cancel",onClick:()=>m(!0),style:{width:"80px"}}),a.createElement(Ct.A,{spacing:2,direction:"column",alignItems:"end"},x&&a.createElement(vn.A,{component:"div",variant:"body1",sx:{color:"#FB4E3B"}},"*Please make sure you inputed all sizes correctly!"),a.createElement(ra,{color:"primary",disabled:w,text:"Generate",onClick:()=>{const e=(()=>{const{current:e,recommended:t}=s;return[...void 0===e?[!1]:e.slice(1).map(e=>Object.values(e).slice(1).map(e=>Number.isNaN(+e))).flat(),...void 0===t?[!1]:t.slice(1).map(e=>Object.values(e).slice(1).map(e=>Number.isNaN(+e))).flat()].includes(!0)})();if(e)return void f(e);u(!0);const{current:t,recommended:n,standard_id:a,...r}={...s};t&&0!==t.length&&(r.current=s.current),n&&0!==n.length&&(r.recommended=s.recommended),a&&0!==a.length&&(r.standard=C,r.standard_id=a);const c={analysis:i,delivery_type:"MC",config:r};0!==o.length&&(c.id=o),(async e=>Ze(Qe.PROJECT_VIEW.marketCoverage,e))(c).then(e=>{e&&l(e),u(!1)})},style:{width:"100px"}})))),a.createElement(qa.A,{onClose:()=>m(!1),open:d},a.createElement(La.A,null,"Warning"),a.createElement(Pa.A,null,"You will loose all your progress on this page, are you sure to continue?"),a.createElement(Va.A,null,a.createElement(ra,{text:"Leave",color:"default",variant:"outlined",onClick:()=>l()}),a.createElement(ra,{text:"Stay",color:"primary",onClick:()=>m(!1)}))),a.createElement(bi,{isLoading:p}))};Ho.propTypes={isCancelBtnDisabled:O().bool.isRequired,data:O().instanceOf(Object).isRequired,population:O().instanceOf(Array).isRequired,currentAnalysis:O().string.isRequired,onSave:O().func.isRequired,unit:O().string.isRequired,id:O().string.isRequired};const Go=Ho,Uo=()=>{const e=(0,l.useSelector)(ie),t=e?.id||"",[n,i]=(0,a.useState)([]),[r,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)(0),[d,m]=(0,a.useState)(0),p=(0,l.useDispatch)(),u=(0,l.useSelector)(pe),[g,h]=(0,a.useState)(!1),[y,x]=(0,a.useState)(!1),f=n[s]||{},b=r&&0===n.length,v=e=>{Ut(e).then(e=>{const t=e?.data||[],n=e?.count||0,a=t.filter(e=>"done"===e?.status||"failed"===e?.status).length,l=t.filter(e=>"failed"===e?.status).length;0===n||l===n?(o(!0),h(!0)):a!==n?h(!1):(h(!0),i(t.filter(e=>"done"===e?.status)))})};return(0,a.useEffect)(()=>{if(0!==t.length){const e={analysis:t};let n;return v(e),g||(n=setInterval(()=>{v(e)},5e3)),()=>clearInterval(n)}},[t,g]),a.createElement(_t.A,null,a.createElement(E.A,{theme:I},a.createElement(_t.A,null,a.createElement(St.A,{color:"primary",value:s,onChange:(e,t)=>{t===n.length?(o(!0),m(s)):!0===r&&o(!1),c(t)},variant:"scrollable",scrollButtons:"auto","aria-label":"Market Coverage Label",sx:{marginTop:"10px",minHeight:0,padding:"4px 8px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.08)",width:"calc(100% - 180px)",display:"flex",".MuiTabs-indicator":{display:"none"}}},0!==n.length?n.map((e,t)=>a.createElement(kt.A,{disabled:r,label:`${e?.config?.title||""}`,sx:{borderRadius:"8px",backgroundColor:s===t?"#FFFFFF":"transparent",padding:"15px",height:"36px",minHeight:"36px"},key:`simple-tab-${e?.id||e?.config?.title||""}`,"aria-controls":`simple-tabpanel-${t}`})):null,a.createElement(kt.A,{disabled:r,label:"+ Add New",key:"add-new","aria-controls":"simple-tabpanel-add-new",sx:{borderRadius:"8px",backgroundColor:r&&void 0===f.id?"#FFFFFF":"transparent",padding:"15px",height:"36px",minHeight:"36px"}})),0!==n.length&&a.createElement(ra,{text:"Download all MCs",color:"primary",onClick:()=>{p(me({analysisToDownload:"normal"})),Yt(t).then(e=>{const{fileName:t}=e;t&&null!==t&&Pe(e)})},disabled:"normal"===u,style:{float:"right",position:"relative",bottom:"36px",marginBottom:"-40px"}}))),r?a.createElement(Go,{isCancelBtnDisabled:b,data:f?.config||{},population:e.populations,unit:e.unit||"",currentAnalysis:t,onSave:e=>{s===n.length&&void 0!==e?i(t=>[...t,e]):s===n.length&&void 0===e?c(d):y&&void 0===e?(i(e=>e.toSpliced(s,1)),c(d),x(!1)):e&&i(t=>t.toSpliced(s,1,e)),o(!1)},id:f?.id||""}):a.createElement(jo,{onEditClick:()=>{o(!0)},onDel:()=>{1===n.length&&o(!0),(async e=>Xe(`${Qe.PROJECT_VIEW.marketCoverage}/${e}/`))(f.id).then(e=>{if(e){const e=n.filter(e=>e.id!==f.id);c(e.length>0?e.length-1:0),i(e)}})},unit:e.unit||"",data:f,onCloneClicked:e=>{m(s);const{id:t,config:a,...l}=e,{title:r,...d}=a,p=n.length;i(e=>[...e,{...l,config:{...d,title:`${r}-copy`}}]),c(p),x(!0),o(!0)}}),a.createElement(bi,{isLoading:!g}))};var Yo=n(16472),Zo=n(37272);const Jo=({text:e})=>a.createElement("div",{style:{display:"inline-flex",marginTop:"10px",marginLeft:"10px",height:"31px",verticalAlign:"middle"}},a.createElement(zt.A,{size:20,color:"inherit",sx:{color:"#EC7700"}}),a.createElement("span",null,e));Jo.propTypes={text:O().string.isRequired};const Xo=Jo,Qo={pom:"",min:null,max:null,core:null},Ko=[{pom:"bust_or_chest_circumference",min:null,max:null,core:null},{pom:"low_hip_circumference",min:null,max:null,core:null}],es=({pomList:e,id:t,analysisId:n,index:i,onNewM4MAdd:r})=>{const o=(0,a.useRef)(null),[s,c]=(0,a.useState)([]),[d,p]=(0,a.useState)([]),[u,g]=(0,a.useState)([]),[h,y]=(0,a.useState)([]),x=(0,l.useSelector)(ie),f=(0,l.useSelector)(se),[b,v]=(0,a.useState)(!0),[A,w]=(0,a.useState)(""),[C,S]=(0,a.useState)(!1),k=`${We}api/v1/scan_data_analysis/deliverables/download/${t}/`,z=d.map(e=>e.pom),R=s.map(e=>e.pom),D=z.every(e=>R.includes(e)),[O,F]=(0,a.useState)(""),[M,j]=(0,a.useState)([]),[T,B]=(0,a.useState)({}),$=(0,l.useDispatch)(),N=f.types?.includes("BODY"),q=(0,l.useSelector)(pe),L=0===R.length||b,P=t=>Object.entries(t).map(t=>"pom"===t[0]?`Measuerment: ${e.find(e=>e.key===t[1])?.value||""}`:t.join(": ")).join(" "),W=e=>{Nn(e,"PROJECT_VIEW").then(e=>{e&&(w(e?.config?.title||""),p(e?.config?.pom||[]),"done"===e?.task?.status?(v(!1),g(e?.config?.pom||[]),y(e?.result_data||[])):"failed"===e?.task?.status&&(F(e?.task?.errors||"error"),v(!1)))})};(0,a.useEffect)(()=>{let e;return 0!==t.length?(W(t),b&&(e=setInterval(()=>{W(t)},5e3))):(p(N?Ko:[Qo]),w(`Group ${i+1}`),v(!1)),()=>clearInterval(e)},[t,b,i]);(0,a.useEffect)(()=>{o?.current?.jspreadsheet?o.current.jspreadsheet.setData(h):No()(o.current,{data:h,minDimensions:[12,10],defaultColWidth:100,updateTable:(e,t)=>{t.classList.add("readonly")}})},[h]),(0,a.useEffect)(()=>{d.forEach(e=>{!R.includes(e.pom)||Object.keys(T).includes(e.pom)||M.includes(e.pom)||(e=>{j(t=>[...t,e.pom]),(async e=>Ye(Qe.PROJECT_VIEW.checkM4MData,e))({analysis:x.id,pom:e.pom}).then(t=>{t&&(B(n=>({...n,[e.pom]:t})),j(t=>t.filter(t=>t!==e.pom)))})})(e)})},[d,R]);const V=(e,t,n)=>{if(R.includes(e.pom)&&"update"!==n){const t=s.filter(t=>t.pom!==e.pom);c(t)}else{const n=s.findIndex(e=>e.pom===t);c(t=>-1===n?[...t,e]:t.toSpliced(n,1,e))}},H=(e,t,n)=>{const a=d.at(t),i={...a,[n]:""===e?null:e},l=d.toSpliced(t,1,i);p(l),V(i,a.pom,"update")};return a.createElement(_t.A,{sx:{backgroundColor:"#F7F7F7",borderRadius:"10px",minHeight:"200px",padding:"20px"}},a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(vn.A,{variant:"h6",component:"h6"},A)),b&&a.createElement(_.A,{severity:"info",sx:{".MuiAlert-message p":{margin:0}}},a.createElement("p",null,"We are processing your request to generate M4M analysis with the following configs:"),d.map((e,t)=>a.createElement("p",{key:e?.pom||t},e?.pom?P(e):"")),a.createElement("p",null,"This might take a while. Please feel free to come back later for the download link.")),!b&&0!==t.length&&a.createElement(_.A,{severity:"success",action:a.createElement(a.Fragment,null,0!==h.length&&a.createElement(ra,{text:"Preview",variant:"outlined",color:C?"primary":"default",onClick:()=>S(e=>!e),style:{backgroundColor:"#FFFFFF !important",marginRight:"8px"}}),a.createElement(m.N_,{to:k,download:`${f?.acid||""} _M4M_${x?.title||"untitled"}`,target:"_blank",rel:"noreferrer",onClick:e=>{"normal"===q&&e.preventDefault(),$(me({analysisToDownload:"normal"}))}},a.createElement(ra,{text:"Download",color:"primary",disabled:b||"normal"===q}))),sx:{".MuiAlert-message p":{margin:0}}},a.createElement("p",null,"Your M4M analysis with the following configs is ready, you can download now."),u.map(e=>a.createElement("p",{key:e.pom},P(e))),a.createElement("p",null,"**If this is not what you wanted, fell free to re-generate by editing the measurement options below.**")),!b&&0===t.length&&a.createElement(_.A,{severity:"warning"},"There's currently no M4M analysis created, please input your measurement filters and then click Generate button in-order to generate a file containing the calculated results."),0!==O.length&&a.createElement(_.A,{severity:"error"},`Error: ${O}, please re-generate.`),a.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px"}},a.createElement("div",null,a.createElement(vn.A,{variant:"subtitle2",component:"span",sx:{width:"262px",marginLeft:"43px",display:"inline-block"}},"Select Measurements"),a.createElement(vn.A,{variant:"subtitle2",component:"span",sx:{width:"122px",display:"inline-block"}},`Min(${x.unit})`),a.createElement(vn.A,{variant:"subtitle2",component:"span",sx:{width:"122px",display:"inline-block"}},`Max(${x.unit})`),a.createElement(vn.A,{variant:"subtitle2",component:"span",sx:{width:"122px",display:"inline-block"}},`Core Value(${x.unit})`),a.createElement(vn.A,{variant:"subtitle2",component:"span",sx:{width:"180px",display:"inline-block"}},"Measurement exists")),a.createElement(Lo,{text:"Select All",checked:D,onChange:()=>{c(D?[]:d)}})),d&&d.map((t,n)=>a.createElement("div",{key:`pom-selection-${t?.pom||n}`,style:{marginTop:"8px"}},a.createElement(E.A,{theme:I},a.createElement(ya.A,{disabled:0===t.pom.length,checked:R.includes(t.pom),onChange:()=>V(t,t.pom),inputProps:{"aria-label":"controlled"},color:"primary"})),a.createElement(pi,{style:{width:250},field:"",value:e.find(e=>e.key===t.pom)?.value||"",onChange:(e,t)=>H(t.key,n,"pom"),options:e.filter(e=>!(z.includes(e.key)&&e.key!==t.pom))}),a.createElement(Ul,{label:"min",inputValue:`${t.min||""}`,width:80,onValueChange:e=>H(e,n,"min"),style:{marginRight:"10px",marginTop:0,paddingTop:"5px",paddingBottom:"5px"}}),a.createElement(Ul,{label:"max",inputValue:`${t.max||""}`,width:80,onValueChange:e=>H(e,n,"max"),style:{marginRight:"10px",marginTop:0,paddingTop:"5px",paddingBottom:"5px"}}),a.createElement(Ul,{label:"core",inputValue:`${t.core||""}`,width:80,onValueChange:e=>H(e,n,"core"),style:{marginTop:0,paddingTop:"5px",paddingBottom:"5px"}}),M.includes(t?.pom||"")&&a.createElement(Xo,{text:"Validating"}),Object.keys(T).includes(t?.pom||"")&&a.createElement("div",{style:{display:"inline-flex",marginTop:"10px",marginLeft:"10px",height:"31px",verticalAlign:"middle",width:"35%"}},T[t.pom]?.pom_data_exists?a.createElement(Yo.A,{sx:{color:"#1AA464"}}):a.createElement(Zo.A,{sx:{color:"#e19a26"}}),a.createElement("span",null,T[t.pom].message)))),!b&&a.createElement(zn,{text:"Add Measurement",color:"primary",variant:"",startIcon:a.createElement(wn.A,null),onClick:()=>{p([...d,Qo])},style:{margin:"10px 0"}}),a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row-reverse",paddingTop:"10px"}},a.createElement(ra,{text:"Generate",color:"primary",onClick:()=>{const e={analysis:n,config:{title:A,pom:s},delivery_type:"M4M"};F(""),0!==t.length?Ln(t,{pom:s},"PROJECT_VIEW").then(()=>{v(!0)}):qn(e,"PROJECT_VIEW").then(e=>{e?.id&&(r(e.id),v(!0))})},disabled:L,style:{marginLeft:"10px"}})),a.createElement("div",{ref:o,style:{visibility:C?"visible":"hidden",overflow:"auto",width:"100%",position:"relative",height:C?500:0,borderRight:"1px solid #E0E0E0",marginTop:C?"8px":0,borderBottom:"1px solid #E0E0E0"}}))};es.propTypes={pomList:O().instanceOf(Array).isRequired,id:O().string.isRequired,analysisId:O().string.isRequired,index:O().number.isRequired,onNewM4MAdd:O().func.isRequired};const ts=es,ns=()=>{const[e,t]=(0,a.useState)([]),n=(0,l.useSelector)(se),i=(0,l.useSelector)(ie),[r,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)([""]),d=n.types;(0,a.useEffect)(()=>{var e;o(!0),i?.id&&(e={analysis:i.id,delivery_type:"M4M"},$n(e,"PROJECT_VIEW").then(e=>{if(o(!1),e?.data&&0!==e?.count){const t=e.data.map(e=>e.id)||[""];c(t)}}))},[i]),(0,a.useEffect)(()=>{Wn(Ne("PROJECT_VIEW",d||["BODY"])).then(e=>t(e?.results||[]))},[d]);const m=e=>{c(t=>[...t.filter(e=>0!==e.length),e])};return a.createElement(_t.A,{sx:{marginTop:"10px"}},a.createElement(vn.A,{variant:"h6",component:"h6"},"M4M Config"),a.createElement(Ct.A,{direction:"column",spacing:1},s.map((t,n)=>a.createElement(ts,{key:`m4m-${t}`,pomList:e,id:t,index:n,analysisId:i.id,onNewM4MAdd:m})),a.createElement(_t.A,{sx:{backgroundColor:"#F7F7F7",borderRadius:"10px",padding:"20px"}},a.createElement(zn,{text:"Add Group",color:"primary",variant:"",startIcon:a.createElement(wn.A,null),disabled:0!==s.filter(e=>0===e.length).length,onClick:()=>{c(e=>[...e,""])},style:{margin:"10px 0"}}))),a.createElement(bi,{isLoading:r,isSingleChart:!0}))};var as=n(75811);const is=({data:e,brand:t,onDetailClosed:n})=>{const[i,l]=(0,a.useState)(0),r=e[i];return(0,a.useEffect)(()=>{l(e.findIndex(e=>e.headers.length>1))},[e]),a.createElement(_t.A,{sx:{width:"100%",border:"1px solid",borderColor:"divider"}},a.createElement(E.A,{theme:I},a.createElement("div",{style:{height:"21px",padding:"10px",backgroundColor:"#F2F2F2",color:"#A0A0A0",display:"flex",justifyContent:"space-between"}},a.createElement("span",null,`${t} - Size Chart`),a.createElement(h.A,{size:"small",onClick:n,sx:{"&:hover":{backgroundColor:"transparent"}}},a.createElement(Si.A,null))),a.createElement(_t.A,{sx:{borderBottom:1,borderColor:"divider"}},a.createElement(St.A,{color:"primary",value:i,onChange:(e,t)=>{l(t)},"aria-label":"size chart detail tabs",centered:!0},e.map((e,t)=>a.createElement(kt.A,{disabled:e.headers.length<=1,label:e.name,key:`simple-tab-${e.name}`,"aria-controls":`simple-tabpanel-${t}`})))),a.createElement(wa.A,{key:`table-${r.name}`},a.createElement(Ca.A,{"aria-label":"simple table"},a.createElement(Sa.A,null,a.createElement(Aa.A,null,r.headers.map(e=>a.createElement(Oa.A,{align:"center",key:e},e.replaceAll("_"," ").toUpperCase())))),a.createElement(ka.A,null,r.data.map(e=>a.createElement(Aa.A,{key:e.size},r.headers.map(t=>a.createElement(Oa.A,{align:"center",key:`${r.name}-${e.size}-${t}`},e[t]||"N/A")))))))))};is.propTypes={data:O().instanceOf(Array).isRequired,brand:O().string.isRequired,onDetailClosed:O().func.isRequired};const ls=is,rs=({data:e,checkboxSelection:t=!1,disableColumnFilter:n=!1,onSelectionModelChange:i=M(),selectionModel:l=Le,availableDataForSelection:r=Le,...o})=>{const[s,c]=(0,a.useState)({}),d=e.filter(e=>r.includes(e.id)),m=e.filter(e=>!r.includes(e.id)),p=0!==Object.keys(s).length;(0,a.useEffect)(()=>{c({})},[e]);const u=[{field:"status",headerName:"Status",flex:.6,display:"flex",align:"center",renderCell:e=>a.createElement(E.A,{theme:I},a.createElement(as.A,{color:"ready"===e.value?"success":"error",sx:{fontSize:"16px"}}))},{field:"brand",headerName:"Brand",display:"flex",flex:1.5},{field:"country",headerName:"Country/Region",flex:1.5,display:"flex",valueFormatter:e=>e.join(", ")},{field:"gender",headerName:"Gender",display:"flex",flex:1},{field:"measurement_method",headerName:"Measurement Method",display:"flex",flex:1},{field:"category",headerName:"Category",display:"flex",flex:1},{field:"garment_size",headerName:"Garment Size",display:"flex",flex:1.2,valueFormatter:e=>e.join(", ")},{field:"inseam_type",headerName:"Inseam Type",display:"flex",flex:1.3},{field:"product_item",headerName:"Product Items",display:"flex",flex:1.5,valueFormatter:e=>e.join(", ")},{field:"type",headerName:"Size Type",display:"flex",flex:1},{field:"last_modified",headerName:"Last Updated",display:"flex",width:150,valueGetter:e=>ke(e)}];return a.createElement(Ct.A,{spacing:2,direction:"row",sx:{marginTop:2}},a.createElement(_t.A,{sx:{width:p?"calc(100% - 566px)":"100%"}},a.createElement(Ci.z,(0,kn.A)({columns:u,rows:[...d,...m],checkboxSelection:t,disableColumnFilter:n,onRowSelectionModelChange:i,rowSelectionModel:l,disableRowSelectionOnClick:!0,isRowSelectable:e=>r.includes(e.id),onRowClick:e=>{c(e.row)},getRowClassName:e=>e.id===s.id?"highlightedRow":l.includes(e.id)?"selectedRow":"",getRowHeight:()=>"auto"},o))),p&&a.createElement(_t.A,{sx:{width:"550px"}},a.createElement(ls,{brand:s?.brand,data:Me(s?.size_chart),onDetailClosed:()=>{c({})}})))};rs.propTypes={data:O().instanceOf(Array).isRequired,checkboxSelection:O().bool,disableColumnFilter:O().bool,onSelectionModelChange:O().func,selectionModel:O().instanceOf(Array),availableDataForSelection:O().instanceOf(Array)};const os=rs,ss=[{label:"country",type:"group-select"},{label:"garment_size",type:"group-select"},{label:"inseam_type",type:"group-select"},{label:"product_item",type:"select"},{label:"gender",type:"radio",defaultOptions:["Men","Women"]},{label:"type",type:"radio",defaultOptions:["Alpha","Numeric"]}],cs=["core_size","pom","unit"],ds=()=>{const[e,t]=(0,a.useState)(!1),[n,i]=(0,a.useState)(""),r=(0,p.zy)(),o=r.pathname.split("/")[1],s=r.pathname.split("/")[3],c=(0,p.Zp)(),d=(0,l.useSelector)(ie),[m,u]=(0,a.useState)(!1),[g,h]=(0,a.useState)([]),[y,x]=(0,a.useState)(""),[f,b]=(0,a.useState)([]),v=[y,...f],[A,w]=(0,a.useState)([]),[C,S]=(0,a.useState)([]),[k,_]=(0,a.useState)([]),[z,R]=(0,a.useState)({}),[D,O]=(0,a.useState)({}),[F,M]=(0,a.useState)(""),[j,T]=(0,a.useState)([]),[B,$]=(0,a.useState)([]),N=k.filter(e=>e.brand===y),q=k.filter(e=>e.brand!==y),L=N.filter(e=>B.includes(e.id))||[],P=Object.fromEntries(cs.map(e=>L?.[0]?.size_chart?[e,Ie(L[0].size_chart,e)]:[])),[W,V]=(0,a.useState)({}),[H,G]=(0,a.useState)([]),[U,Y]=(0,a.useState)(""),Z=[...N,...q].filter(e=>Object.keys(D).every(t=>!(D?.[t]&&D[t].length>0)||je(D[t],e[t]))),J=k.filter(e=>B.includes(e.id)).map(e=>e.brand),X=[...k.filter(e=>!J.includes(e.brand)).map(e=>e.id),...B],Q=Z.reduce((e,t)=>{const n=Object.keys(t),a=[...ss.map(e=>e.label),"category","measurement_method"];return n.forEach(n=>{if(a.includes(n))if("country"===n&&"Global"===t?.[n]?.[0]){const t=e[n];e[n]=t}else e[n]=e?.[n]?Array.from(new Set([e[n],t[n]].flat())):[t[n]].flat()}),e},{});(0,a.useEffect)(()=>{"new"===s?t(!0):jn(s,"COMPETITOR_VIEW").then(e=>{u(!0);const{category:t,country:n,garment_size:a,gender:l,inseam_type:r,product_item:o,measurement_method:s,type:c,pom:d,core_size:m,unit:p}=e;x(e?.client||""),b(e?.competitors||[]),$(e?.size_charts||[]),O({category:t,country:n,garment_size:a,gender:l,inseam_type:r,measurement_method:s,type:c,product_item:o}),V({pom:d,core_size:m,unit:p}),i(e?.title||""),Y(e?.description||"")})},[s,o,d]),(0,a.useEffect)(()=>{un().then(e=>h(e?.results||[]))},[]);(0,a.useEffect)(()=>{0!==y.length&&0!==f.length&&(u(!0),(()=>{const e={brand:v,page:1,page_size:500},t={client:y,competitors:f};(async e=>Ye(Qe.SIZE_CHART.getFilterOptions,{...e,main_option:"category"}))(t).then(e=>{w(e?.data||[])}),(async e=>Ye(Qe.SIZE_CHART.getFilterOptions,{...e,main_option:"measurement_method"}))(t).then(e=>{S(e?.data||[])}),Qt(t).then(e=>{const t=$e(e?.data||{})||[];R(e=>({...e,country:t}))}),Kt(t).then(e=>{const t=$e(e?.data||{})||[];R(e=>({...e,garment_size:t}))}),en(t).then(e=>{const t=$e(e?.data||{})||[];R(e=>({...e,inseam_type:t}))}),pn(e).then(e=>{_(e?.results||[]),u(!1)})})())},[y,f]);const K=(e,t,n)=>{if("competitors"===e)b(t),T([]),M(""),O({});else if(!n?.relatedTarget){const n={...D};O({...n,[e]:t}),T([]),M("")}},ee=e=>{""!==F&&K(F,j),M(e);const t="competitors"===e?f:D[e];T(t||[])},te=(e,t)=>{if(F!==e)if("competitors"===e)b(t),O({});else{const n={...D};O({...n,[e]:t})}else T(t)},ne=(e,t)=>{if(H.includes(e)){const t=H.filter(t=>!(t===e));G(t)}O("measurement_method"===e?{[e]:t}:"category"===e?n=>({[e]:t,measurement_method:n.measurement_method}):{...D,[e]:t})},ae=e=>0!==F.length&&e===F?j:D?.[e]?D[e]:"competitors"===e&&e!==F?f:[];return a.createElement(_t.A,{sx:{display:"flex",padding:"0 20px",flexDirection:"column",width:"calc(100% - 40px)",height:"100%",overflowY:"auto"}},a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row",justifyContent:"start",padding:"0 0 10px"}},a.createElement("svg",{id:"Group_1052","data-name":"Group 1052",xmlns:"http://www.w3.org/2000/svg",width:"31",height:"19",viewBox:"0 0 31 19"},a.createElement("circle",{id:"Ellipse_7","data-name":"Ellipse 7",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(0 14)"}),a.createElement("circle",{id:"Ellipse_8","data-name":"Ellipse 8",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(8 6)"}),a.createElement("circle",{id:"Ellipse_9","data-name":"Ellipse 9",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(17 12)"}),a.createElement("circle",{id:"Ellipse_10","data-name":"Ellipse 10",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(26)"}),a.createElement("path",{id:"Path_990","data-name":"Path 990",d:"M6410.5,1604.5l8.038-7.956,8.987,6.015,9-12.058",transform:"translate(-6408 -1588)",fill:"none",stroke:"#000",strokeWidth:"2"})),a.createElement(vn.A,{variant:"h6",component:"h6",style:{textTransform:"uppercase"}},e?"Generate New Competitor Overview Analysis":n)),a.createElement(_t.A,{sx:{display:"flex",flexGrow:1,flexDirection:"column"}},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1rem",fontWeight:500}},"Filter Settings")),a.createElement(_t.A,null,a.createElement(Ct.A,{spacing:2,direction:"row",sx:{m:2},useFlexGap:!0,flexWrap:"wrap"},a.createElement(pi,{required:!0,field:"Client",value:y,onChange:(e,t)=>{if(x(t),V({}),G([]),O({}),f.includes(t)){const e=f.filter(e=>e!==t);b(e)}},options:g}),a.createElement(pi,{required:!0,field:"Competitors",value:ae("competitors"),multiple:!0,onClose:()=>K("competitors",j),onOpen:()=>ee("competitors"),onChange:(e,t)=>te("competitors",t),options:g?.length>1?g.filter(e=>e!==y):[]}),a.createElement(pi,{required:!0,field:"Measurement Method",value:ae("measurement_method"),onChange:(e,t)=>ne("measurement_method",t),disabled:0===C.length,error:H.includes("measurement_method"),options:C.length>0?C:[]}),a.createElement(pi,{required:!0,field:"Category",value:ae("category"),onChange:(e,t)=>ne("category",t),disabled:0===A.length,error:H.includes("category"),options:A.length>0?A:[]})),a.createElement(Ct.A,{spacing:2,direction:"row",sx:{m:2},useFlexGap:!0,flexWrap:"wrap"},ss.map(e=>"radio"===e.type?a.createElement(E.A,{key:e.label,theme:I},a.createElement(Rn.A,null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none"}},`${Fe(e.label)}${"type"===e.label?"*":""}`),a.createElement(ni.A,{row:!0,"aria-labelledby":"row-radio-buttons-group-label",name:"row-radio-buttons-group",value:ae(e.label)},e.defaultOptions.map(t=>a.createElement(Za.A,{key:`${e.label}-${t}`,value:t,control:a.createElement(ai.A,{onClick:()=>ne(e.label,t),color:"default"}),label:t}))))):"group-select"===e.type?a.createElement(ur,{key:e.label,sx:{m:1,minWidth:300},field:e.label,value:ae(e.label),multiple:!0,group:"group",disabled:void 0===Q?.[e.label]||0===Q[e.label].length,onClose:t=>K(e.label,j,t),onOpen:()=>ee(e.label),onChange:t=>te(e.label,t),options:z?.[e.label]?.filter(t=>Q?.[e.label]?.includes(t.value)||!1)||[]}):a.createElement(pi,{key:e.label,sx:{m:1,minWidth:300},field:e.label,value:ae(e.label),multiple:!0,disabled:void 0===Q?.[e.label]||0===Q[e.label].length,onClose:t=>K(e.label,j,t),onOpen:()=>ee(e.label),onChange:(t,n)=>te(e.label,n),options:Q?.[e.label]?.length>0?Q[e.label].filter(e=>e!==y):[]})))),a.createElement(_t.A,{sx:{display:"flex",flexGrow:1,flexDirection:"column"}},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1rem",fontWeight:500}},"Analysis Settings")),a.createElement(_t.A,null,a.createElement(Ct.A,{spacing:2,direction:"row",sx:{m:2},useFlexGap:!0,flexWrap:"wrap"},cs.map(e=>a.createElement(pi,{key:e,required:!0,error:H.includes(e),sx:{m:1,minWidth:300},field:e,multiple:"pom"===e,value:W?.[e]||[],onChange:(t,n)=>((e,t)=>{const n=W;if(H.includes(t)){const e=H.filter(e=>!(e===t));G(e)}V({...n,[t]:e})})(n,e),options:P?.[e]||[],disabled:1!==L.length})),a.createElement("div",null,a.createElement(aa.A,{style:{display:"block",minWidth:"120px",boxSizing:"border-box",marginBottom:"5px"}},"Description"),a.createElement(si,{label:"description",value:U,multiline:!0,rows:3,onChange:e=>Y(e.target.value),style:{minHeight:"70px"}})))),0!==k.length&&a.createElement(a.Fragment,null,a.createElement(_t.A,{sx:{display:"flex",flexGrow:1,flexDirection:"column"}},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1rem",fontWeight:500}},"Selecting Size Chart"),a.createElement(vn.A,{variant:"caption",component:"i",style:{color:"#A0A0A0",marginTop:"5px",fontWeight:100}},"**You may click on the data row in-order to see detailed size chart**")),a.createElement(os,{autoHeight:!0,data:Z,checkboxSelection:!0,disableColumnFilter:!0,onSelectionModelChange:e=>{$(e),void 0===e.find(e=>N.find(t=>t.id===e))&&V({})},selectionModel:B,availableDataForSelection:X,sx:{"& .MuiDataGrid-columnHeaderCheckbox .MuiDataGrid-columnHeaderTitleContainer":{display:"none"},".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},".MuiDataGrid-cell:focus-within":{outline:"none"},".MuiButtonBase-root":{"&.Mui-checked":{color:"#EC7700"},"&:hover":{backgroundColor:"transparent"}},".selectedRow":{backgroundColor:"rgba(236, 119, 0, 0.2) !important"},".highlightedRow":{backgroundColor:"rgba(236, 119, 0, 0.08) !important"},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"15px 10px"}}})),a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column",alignItems:"end"}},0!==H.length&&a.createElement(vn.A,{component:"div",variant:"body1",sx:{color:"#FB4E3B"}},"* Please input all the required fields!"),a.createElement(Ct.A,{spacing:1,direction:"row",sx:{m:1,pb:2}},a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>{c("new"===s?"../":`../${s}`)}}),a.createElement(ra,{color:"primary",disabled:1!==L.length||B.length<2,text:e?"Generate":"Save",onClick:()=>{const t=cs.filter(e=>"pom"!==e?!P?.[e].includes(W?.[e]):0===(W?.[e]||[])?.length||W?.[e].some(t=>!P?.[e].includes(t))),n=["category","measurement_method"].filter(e=>void 0===D[e]);if(0!==t.length||0!==n.length)return void G([...t,...n]);u(!0);const a={project:o,client:y,competitors:f,...D,...W,size_charts:B};0!==U.length&&(a.description=U),e?In(a,"COMPETITOR_VIEW").then(e=>{e?.id&&c(`../${e.id}`)}):Bn(s,a,"COMPETITOR_VIEW").then(e=>{e?.id&&c(`../${e.id}`)})}}))),a.createElement(bi,{isLoading:m}))},ms=(0,Ma.Ay)(Oa.A)(()=>({[`&.${Fa.A.root}`]:{backgroundColor:"transparent",color:"#544744",borderBottom:"none",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"inline-block",height:"100%",width:"100%",padding:0},[`&.${Fa.A.head}`]:{fontSize:"16px",border:"none",display:"table-cell",padding:"16px"}})),ps=(0,Ma.Ay)(Aa.A)(()=>({height:"60px",borderBottom:"1px solid #E0E0E0","&:hover":{backgroundColor:"rgba(236, 119, 0, 0.05)"}})),us=[{id:"client",label:"Client"},{id:"competitors",label:"Competitor(s)"},{id:"measurement_method",label:"Measurement Method"},{id:"gender",label:"Gender"},{id:"creator",label:"Creator"},{id:"last_modified",label:"Last Updated"}],gs=()=>{const[e,t]=(0,a.useState)([]),[n,i]=(0,a.useState)(!1),r=(0,p.zy)().pathname.split("/")[1],[o,s]=(0,a.useState)(""),c=(0,l.useDispatch)(),d=(0,l.useSelector)(pe),[u,g]=(0,a.useState)(null),y=Boolean(u),x=()=>{i(!0),Mn({page_size:50,project:r},"COMPETITOR_VIEW").then(e=>{t(e?.data||[]),i(!1)})};return(0,a.useEffect)(()=>{x()},[r]),a.createElement(_t.A,{sx:{height:"calc(100% - 50px)",overflowY:"auto"}},a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",padding:"0 16px"}},a.createElement("svg",{id:"Group_1052","data-name":"Group 1052",xmlns:"http://www.w3.org/2000/svg",width:"31",height:"19",viewBox:"0 0 31 19"},a.createElement("circle",{id:"Ellipse_7","data-name":"Ellipse 7",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(0 14)"}),a.createElement("circle",{id:"Ellipse_8","data-name":"Ellipse 8",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(8 6)"}),a.createElement("circle",{id:"Ellipse_9","data-name":"Ellipse 9",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(17 12)"}),a.createElement("circle",{id:"Ellipse_10","data-name":"Ellipse 10",cx:"2.5",cy:"2.5",r:"2.5",transform:"translate(26)"}),a.createElement("path",{id:"Path_990","data-name":"Path 990",d:"M6410.5,1604.5l8.038-7.956,8.987,6.015,9-12.058",transform:"translate(-6408 -1588)",fill:"none",stroke:"#000",strokeWidth:"2"})),a.createElement(vn.A,{variant:"h5",component:"h5",style:{padding:"0 15px"}},"COMPETITOR OVERVIEW ANALYSIS"),a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New Analysis",color:"primary",component:m.N_,to:"./new"})),0!==e.length?a.createElement(wa.A,{key:"project-list-table",style:{backgroundColor:"#FFFFFF",color:"#544744",height:"calc(100% - 145px)",padding:"0 16px",width:"calc(100% - 32px)"},component:"div"},a.createElement(Ca.A,{stickyHeader:!0,"aria-label":"project-list-table",style:{borderCollapse:"collapse"}},a.createElement(Sa.A,null,a.createElement(Aa.A,{style:{borderBottom:"1px solid #E0E0E0"}},us.map(e=>a.createElement(ms,{key:e.label},e.label)))),a.createElement(ka.A,null,e.map(e=>a.createElement(ps,{key:e.id,sx:{"#del-btn":{visibility:"hidden",marginRight:"10px"},"&:hover":{"#del-btn":{visibility:"visible"}}}},us.map(t=>{return a.createElement(Oa.A,{key:`${t.client}-${t.id}`,style:{padding:0}},a.createElement(ms,{align:"left",component:m.N_,to:e.id},a.createElement("div",{style:{margin:0,display:"flex",alignItems:"center",height:"60px",padding:"0 20px"}},a.createElement("span",null,(n=e[t.id],i=t.id,(Array.isArray(n)?n.join(", "):"last_modified"===i?_e(n):n)||"N/A")))));var n,i}),a.createElement(ms,{align:"center",download:e.id,target:"_blank",onClick:t=>((e,t)=>{0!==o.length&&e.preventDefault(),s(t),c(me({analysisToDownload:t,source:"analysis_competitor_overview"})),Xt(t).then(e=>{null!==e?Pe(e):c(me({analysisToDownload:""}))})})(t,e.id),rel:"noreferrer"},a.createElement(E.A,{theme:I},a.createElement(h.A,{edge:"end","aria-label":"download",color:"primary",disabled:o===e.id&&""!==d,sx:{margin:"12px 8px 12px 16px"}},a.createElement(Dr.A,{fontSize:"large"})))),a.createElement(Oa.A,null,a.createElement(h.A,{id:"del-btn",size:"small",sx:{color:"#5F504D",zIndex:588},onClick:t=>{t.preventDefault(),g({id:e.id,title:e.title})}},a.createElement(Ra.A,null)))))))):a.createElement(_t.A,{sx:{display:"flex",justifyContent:"center",alignItems:"center"}},a.createElement(vn.A,{variant:"body2",style:{position:"fixed",top:"50%",color:"#A0A0A0"}},n?"Loading...":"There is no Analysis created at the moment. Please start adding your Competitor Overview Analysis by clicking the Add New Analysis button above.")),y&&a.createElement(Ua,{title:u.title,id:u.id,source:"COMPETITOR_VIEW",onClose:e=>{g(null),e&&x()}}))},hs=[{path:"scans",api:"analysis_scan_data",title:"SCAN DATA ANALYSIS"},{path:"overview",api:"analysis_competitor_overview",title:"COMPETITOR OVERVIEW ANALYSIS"}],Es=({data:e})=>{const{title:t,description:n,last_modified:i,id:r,measurement_method:o}=e,s=(0,p.Zp)(),c=(0,p.zy)(),d=c.pathname.split("/")[2].length>10?c.pathname.split("/")[1]:c.pathname.split("/")[2],m=(0,l.useDispatch)(),u=hs.find(e=>e.path===d),g=(0,l.useSelector)(pe),E="scans"===d?0!==g.length&&"normal"!==g:"normal"===g,[y,x]=(0,a.useState)(null),[f,b]=(0,a.useState)(!1),v=Boolean(y);return a.createElement(_t.A,{sx:{display:"flex",justifyContent:"space-between",padding:"0 10px"}},a.createElement(Ct.A,{direction:"row",alignItems:"baseline"},a.createElement(h.A,{"aria-label":"back",onClick:()=>s("../"),sx:{padding:0,"&:hover":{color:"#EC7700",backgroundColor:"transparent"}}},a.createElement(kl.A,null),a.createElement(vn.A,{variant:"h6",component:"h6",style:{padding:"0 10px"}},u.title))),a.createElement(Ct.A,{direction:"column",alignItems:"center",sx:{maxWidth:"calc(100% - 490px)"}},a.createElement(Ct.A,{direction:"row"},a.createElement(vn.A,{variant:"h6",component:"h6",sx:{color:"#000000"}},"overview"===d?`Competitor Overview - ${o} Measurement`:t),a.createElement(h.A,{size:"small",onClick:()=>s("./edit")},a.createElement(Pi.A,null))),n&&a.createElement(vn.A,{variant:"caption",component:"span"},`Description: ${n}`)),a.createElement(Ct.A,{spacing:2,direction:"row"},a.createElement(Ct.A,{direction:"column",alignItems:"end"},a.createElement(ra,{text:"Download All",color:"primary",disabled:E,onClick:e=>{0!==g.length&&e.preventDefault(),m(me({analysisToDownload:r,source:u.api})),"overview"===d?Xt(r).then(e=>{null!==e?Pe(e):m(me({analysisToDownload:""}))}):Gt(r).then(e=>{null!==e?Pe(e):m(me({analysisToDownload:""}))})}}),a.createElement(vn.A,{variant:"caption",component:"i"},`Last Modified on: ${_e(i)}`)),a.createElement(h.A,{onClick:e=>x(e.currentTarget),sx:{height:"36px",width:"36px"}},a.createElement(_l.A,{fontSize:"small"})),a.createElement(Mt.A,{id:"overview-action-menu",anchorEl:y,open:v,dense:"true",transitionDuration:0,onClose:()=>x(null)},a.createElement(jt.A,{onClick:()=>{x(null),b(!0)}},a.createElement(Ra.A,{fontSize:"small"}),"Delete"))),f&&a.createElement(Ua,{title:t,id:r,source:"COMPETITOR_VIEW",onClose:e=>{e?s("../"):b(!1)}}))};Es.propTypes={data:O().instanceOf(Object).isRequired};const ys=Es;var xs=n(13271);const fs=(0,Br.A)(Qr),bs=[2,4,6,8].map(e=>({value:e,label:`${e}`})),vs=({data:e,unit:t,onChartUpdate:n})=>{const[i,l]=(0,a.useState)(!1),[r,o]=(0,a.useState)(""),[s,c]=(0,a.useState)(2);return(0,a.useEffect)(()=>{o(e.title||""),c(e.x_interval||2)},[e]),a.createElement(a.Fragment,null,a.createElement(Ct.A,{spacing:2,direction:"row",alignItems:"center",sx:{mb:2}},a.createElement(h.A,{size:"small",onClick:()=>l(!i)},a.createElement(Pi.A,null)),a.createElement(Ct.A,{direction:"row",sx:{minWidth:300},alignItems:"center"},a.createElement(aa.A,{style:{display:"inline-block",boxSizing:"border-box",marginRight:"5px"}},"Title"),a.createElement(si,{label:"description",value:r,disabled:!i,onChange:e=>o(e.target.value),style:{width:"200px"}})),a.createElement(Ct.A,{direction:"row",sx:{minWidth:300},alignItems:"center"},a.createElement(aa.A,{style:{display:"inline-block",boxSizing:"border-box",marginRight:"20px",width:320,textAlign:"right"}},`X-Axis Interval/${t}`),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{color:"primary","aria-label":`X-Axis Interval/${t}`,value:s,onChange:(e,t)=>c(t),step:2,valueLabelDisplay:"off",marks:bs,min:2,max:8,size:"small",disabled:!i,sx:{mr:4}}))),a.createElement(ra,{color:"primary",disabled:!i,text:"Save",onClick:()=>{const t={title:r,x_interval:s};Ln(e.id,t,"COMPETITOR_VIEW").then(e=>{null!==e&&(o(e?.title||""),c(e?.x_interval||2),l(!1),n())})}})),e?.result_data&&a.createElement(fs,JSON.parse(e.result_data)))};vs.propTypes={data:O().instanceOf(Object).isRequired,unit:O().string.isRequired,onChartUpdate:O().func.isRequired};const As=vs,ws=()=>{const e=(0,p.zy)().pathname.split("/")[3],[t,n]=(0,a.useState)({}),[i,l]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{i&&jn(e,"COMPETITOR_VIEW").then(e=>{n(e||{}),l(!1)})},[e,i]),a.createElement(a.Fragment,null,a.createElement(ys,{data:t}),a.createElement(_t.A,{sx:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center"}},t?.deliverables&&a.createElement(a.Fragment,null,t.deliverables.map(e=>a.createElement(As,{data:e,key:e.title,unit:t.unit,onChartUpdate:()=>l(!0)})))))},Cs=[{label:"measurement_method",type:"select"},{label:"category",type:"select"},{label:"country",type:"group-select"},{label:"garment_size",type:"group-select"},{label:"inseam_type",type:"group-select"},{label:"product_item",type:"select"},{label:"gender",type:"radio",defaultOptions:["Men","Women"]},{label:"type",type:"radio",defaultOptions:["Alpha","Numeric"]}],Ss=()=>{const[e,t]=(0,a.useState)(!1),[n,i]=(0,a.useState)([]),[l,r]=(0,a.useState)([]),[o,s]=(0,a.useState)([]),[c,d]=(0,a.useState)([]),[m,p]=(0,a.useState)({}),[u,g]=(0,a.useState)(""),[h,x]=(0,a.useState)([]),[f,b]=(0,a.useState)({}),[v,A]=(0,a.useState)(!1),w=o.filter(e=>Object.keys(m).every(t=>!(m?.[t]&&m[t].length>0)||je(m[t],e[t]))),C=w.reduce((e,t)=>{const n=Object.keys(t),a=[...Cs.map(e=>e.label)];return n.forEach(n=>{if(a.includes(n))if("country"===n&&"Global"===t?.[n]?.[0]){const t=e[n];e[n]=t}else e[n]=e?.[n]?Array.from(new Set([e[n],t[n]].flat())):[t[n]].flat()}),e},{});(0,a.useEffect)(()=>{t(!0),un().then(e=>i(e?.results||[])),pn({sort_by:"last_modified",page:1,page_size:10}).then(e=>{d(e?.results||[]),t(!1)})},[]);const S=(e,t,n)=>{if("brands"===e)r(t),x([]),g("");else if(!n?.relatedTarget){const n={...m};p({...n,[e]:t}),x([]),g("")}},k=e=>{""!==u&&S(u,h),g(e);const t="brands"===e?l:m[e];x(t||[])},_=(e,t)=>{if(u!==e)if("brands"===e)r(t);else{const n={...m};p({...n,[e]:t})}else x(t)},z=e=>0!==u.length&&e===u?h:m?.[e]?m[e]:"brands"===e?l:[];return a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflowY:"auto"}},a.createElement(or.A,{sx:{p:2,display:"flex",flexDirection:"column",margin:"5px 1px 16px",height:"auto"}},a.createElement(vn.A,{variant:"subtitle",mb:2},"Filter Settings"),a.createElement(Ct.A,{spacing:1,direction:"row",useFlexGap:!0,flexWrap:"wrap"},a.createElement(pi,{required:!0,field:"Brands",value:z("brands"),multiple:!0,onClose:()=>S("brands",h),onOpen:()=>k("brands"),onChange:(e,t)=>_("brands",t),options:n?.length>1?n:[]})),v&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"subtitle",mb:2,mt:2},"Optional Filters"),a.createElement(Ct.A,{spacing:2,direction:"row",useFlexGap:!0,flexWrap:"wrap"},Cs.map(e=>"radio"===e.type?a.createElement(E.A,{key:e.label,theme:I},a.createElement(Rn.A,null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none"}},Fe(e.label)),a.createElement(ni.A,{row:!0,"aria-labelledby":"row-radio-buttons-group-label",name:"row-radio-buttons-group",value:z(e.label)},e.defaultOptions.map(t=>a.createElement(Za.A,{key:`${e.label}-${t}`,value:t,control:a.createElement(ai.A,{onClick:()=>{return n=e.label,a=t,void p({...m,[n]:a});var n,a},color:"default"}),label:t}))))):"group-select"===e.type?a.createElement(ur,{key:e.label,sx:{m:1,minWidth:300},field:e.label,value:z(e.label),multiple:!0,group:"group",disabled:void 0===C?.[e.label]||0===C[e.label].length,onClose:t=>S(e.label,h,t),onOpen:()=>k(e.label),onChange:t=>_(e.label,t),options:f?.[e.label]?.filter(t=>C?.[e.label]?.includes(t.value)||!1)||[]}):a.createElement(pi,{key:e.label,sx:{m:1,minWidth:300},field:e.label,value:z(e.label),multiple:!0,onClose:t=>S(e.label,h,t),onOpen:()=>k(e.label),onChange:(t,n)=>_(e.label,n),options:C?.[e.label]?.length>0?C[e.label]:[]})))),a.createElement(Ct.A,{spacing:1,direction:"row",justifyContent:"space-between",sx:{mt:1}},a.createElement(E.A,{theme:I},a.createElement(y.A,{color:"primary",onClick:()=>{r([]),s([]),p({}),A(!1)}},"Clear filters")),a.createElement(ra,{color:"primary",disabled:0===l.length,text:"Apply",onClick:()=>{0!==l.length&&(t(!0),(()=>{const e={brand:l,page:1,page_size:500},n={client:l[0]};l.length>1&&(n.competitors=l.toSpliced(0,1)),pn(e).then(e=>{s(e?.results||[]),A(!0),t(!1)}),Qt(n).then(e=>{const t=$e(e?.data||{})||[];b(e=>({...e,country:t}))}),Kt(n).then(e=>{const t=$e(e?.data||{})||[];b(e=>({...e,garment_size:t}))}),en(n).then(e=>{const t=$e(e?.data||{})||[];b(e=>({...e,inseam_type:t}))})})())}}))),(0!==c.length||0!==o.length)&&a.createElement(a.Fragment,null,a.createElement(_t.A,{sx:{display:"flex",flexGrow:1,flexDirection:"column"}},a.createElement(vn.A,{variant:"h6"},"Size Chart Data"),!v&&a.createElement(vn.A,{variant:"caption",component:"i",style:{color:"#A0A0A0",marginTop:"5px",fontWeight:100}},"**Currently showing the latest 10 data. For more specific data, please start from selecting desired brand.**"),a.createElement(vn.A,{variant:"caption",component:"i",style:{color:"#A0A0A0",fontWeight:100}},"**You may click on the data row in-order to see detailed size chart**")),a.createElement(os,{data:v?w:c,disableColumnFilter:!0,initialState:{...w.initialState,pagination:{paginationModel:{pageSize:10}}},pageSizeOptions:0!==o.length?[5,10,25]:[5,10],sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},".MuiDataGrid-cell:focus-within":{outline:"none"},".MuiDataGrid-row":{cursor:"pointer"},".highlightedRow":{backgroundColor:"rgba(236, 119, 0, 0.2) !important"},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"15px 10px"}}})),a.createElement(bi,{isLoading:e}))},ks=({field:e="",options:t,onChange:n,value:i,placeholder:l="",width:r=250,style:o=qe})=>{const[s,c]=(0,a.useState)(null),d=Boolean(s),[m,p]=(0,a.useState)([]),g=m.join(", ");return(0,a.useEffect)(()=>{p(i)},[i]),a.createElement(E.A,{theme:I},a.createElement(Rn.A,{color:"default"},0!==e.length&&a.createElement(aa.A,{id:`${e}-select-label`,sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},`${Fe(e)}`),a.createElement(u.A,{size:"small",value:g,autoComplete:"off",placeholder:l,onClick:e=>c(e.currentTarget),label:"",sx:{padding:"0",minHeight:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:`${r}px`,boxSizing:"content-box",color:"#5F504D","&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},...o}}),d&&a.createElement(on.Ay,{open:d,onClose:()=>{n(m),c(null)},anchorEl:s,anchorOrigin:{vertical:"bottom",horizontal:"left"}},a.createElement(Ct.A,{p:1,sx:{width:r-16}},a.createElement(ir,{data:t,selected:m,onNodeSelect:e=>p(e),type:"BodyScan",isPopUp:!0})))))};ks.propTypes={field:O().string,options:O().instanceOf(Array).isRequired,onChange:O().func.isRequired,value:O().oneOfType([O().string,O().number,O().instanceOf(Array),O().instanceOf(Object)]).isRequired,style:O().instanceOf(Object),width:O().number,placeholder:O().string};const _s=ks;Jn().extend(na()),Jn().extend(ea());const zs=({value:e,onChange:t,isDP:n=!1})=>{const i=ve.getState().auth.currentUser.timezone||Jn().tz.guess();Jn().tz.setDefault(i);const l=(0,a.useCallback)(e=>n?Jn()(e):Jn()(e).tz(i),[n,i]),[r,o]=(0,a.useState)(null),[s,c]=(0,a.useState)(null);return(0,a.useEffect)(()=>{0!==Object.keys(e).length&&(o(e?.datetime_gte?l(e.datetime_gte):null),c(e?.datetime_lte?l(e.datetime_lte):null))},[e,l]),a.createElement(E.A,{theme:I},a.createElement("div",null,a.createElement(aa.A,{style:{display:"block",boxSizing:"border-box",marginBottom:"4px"}},"Scan Year"),a.createElement(Ct.A,{direction:"row",spacing:1,p:0,alignItems:"center"},a.createElement(ia.l,{views:["year"],value:Jn()(r),onChange:e=>{if(o(e),e?.isValid()&&e.year()>999){const a=n?`${e.year()}-01`:e.tz(i,!0).startOf("year").toISOString();t("datetime_gte",a)}},slotProps:{textField:{size:"small",sx:{padding:"0 10px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"110px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}},yearButton:{sx:{color:"#5F504D",borderRadius:"20px",backgroundColor:"transparent","&:hover":{backgroundColor:"rgba(236, 119, 0, 0.1)"},"&.Mui-selected":{backgroundColor:"#EC7700",color:"#FFFFFF","&:hover, &:focus":{backgroundColor:"#EC7700"}}}}}}),a.createElement("div",null," - "),a.createElement(ia.l,{views:["year"],value:Jn()(s),onChange:e=>{if(c(e),e?.isValid()&&e.year()>999){const a=n?`${e.year()}-12`:e.tz(i,!0).endOf("year").toISOString();t("datetime_lte",a)}},slotProps:{textField:{size:"small",sx:{padding:"0 10px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"110px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}},yearButton:{sx:{color:"#5F504D",borderRadius:"20px",backgroundColor:"transparent","&:hover":{backgroundColor:"rgba(236, 119, 0, 0.1)"},"&.Mui-selected":{backgroundColor:"#EC7700",color:"#FFFFFF","&:hover, &:focus":{backgroundColor:"#EC7700"}}}}}}))))};zs.propTypes={value:O().instanceOf(Object).isRequired,onChange:O().func.isRequired,isDP:O().bool};const Rs=zs;var Ds=n(64155),Os=n(53415);const Fs=({filters:e,onFilterPomSelect:t,onExtraFilterAdd:n,onExtraFilterDel:i,error:l=!1,source:r})=>{const[o,s]=(0,a.useState)([]);return(0,a.useEffect)(()=>{r&&Wn(Ne(r,["BODY","HEAD","HAND"])).then(e=>s(e?.results||[]))},[r]),a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",padding:"8px 0 4px",width:"100%"}},"Measurement Range"),e?.length>0&&e.map((e,r)=>a.createElement(Ct.A,{key:`extra-select-pom-${r}`,direction:"row",alignItems:"center",spacing:2},a.createElement(pi,{field:"",value:o.find(t=>t.key===e.pom)||"",options:o,onChange:(e,n)=>t(n.key,r,"pom"),placeholder:"Measurement",style:{width:"280px",marginRight:0}}),a.createElement(Ul,{label:"min",inputValue:`${e.min||""}`,width:100,onValueChange:e=>t(e,r,"min"),placeholder:"Min",showErr:!1,style:{padding:"5px 15px"}}),a.createElement(Ul,{label:"max",inputValue:`${e.max||""}`,width:100,placeholder:"Max",onValueChange:e=>t(e,r,"max"),showErr:!1,style:{padding:"5px 15px"}}),a.createElement(Fl,{label:"",options:"weight"===e?.pom?["kg","lbs"]:["cm","inch"],value:e?.unit||("weight"===e?.pom?"kg":"cm"),color:"primary",onChange:e=>t(e,r,"unit")}),a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(h.A,{sx:{color:"#5F504D"},onClick:()=>i(r)},a.createElement(Os.A,null)),a.createElement(h.A,{sx:{color:"#5F504D"},onClick:n},a.createElement(Ds.A,null))),l?.[r]&&a.createElement(vn.A,{variant:"body1",sx:{color:"#FB4E3B"}},"isNaN"===l[r]?"Enter a valid number":"Max cannot be less than min"))))};Fs.propTypes={filters:O().instanceOf(Array).isRequired,onFilterPomSelect:O().func.isRequired,onExtraFilterAdd:O().func.isRequired,onExtraFilterDel:O().func.isRequired,error:O().instanceOf(Array),source:O().string.isRequired};const Ms=Fs,js=({error:e=!1,field:t="",options:n,onChange:i,value:l,required:r=!1,disabled:o=!1,tooltipText:s="",width:c=300,style:d=qe})=>{const[m,p]=(0,a.useState)([]),[u,g]=(0,a.useState)(!1);(0,a.useEffect)(()=>{p(l)},[l]);const y=()=>{g(!1)};return a.createElement(E.A,{theme:I},a.createElement(Rn.A,{color:"primary",disabled:o},a.createElement(Ct.A,{direction:"row"},0!==t.length&&a.createElement(aa.A,{id:`${t}-select-label`,sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px","&.Mui-focused":{color:"rgba(0, 0, 0, 0.6)"}}},`${Fe(t)}${r?"*":""}`),0!==s.length&&a.createElement(Ka.x,{onClickAway:y},a.createElement(ei.A,{onClose:y,open:u,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:s},a.createElement(h.A,{"aria-label":"info",onClick:()=>{g(!0)},size:"small",sx:{borderRadius:"30px",height:"20px",width:"20px",marginTop:"2px",marginLeft:"2px"}},a.createElement(ri.A,{fontSize:"inherit"}))))),a.createElement(ii.A,{labelId:"demo-multiple-name-label",id:"demo-multiple-name",multiple:!0,value:m,onChange:e=>{return t=e.target.value,void p(t);var t},onClose:()=>i(m),renderValue:e=>e.join(" & "),input:a.createElement(li.A,{label:"Name",sx:{padding:"0",minHeight:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(e?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(e?"#FB4E3B":"#00000038"),width:`${c}px`,boxSizing:"content-box",color:"#5F504D","&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},".MuiOutlinedInput-input":{padding:"9px 14px"},...d}})},n.map(e=>a.createElement(jt.A,{key:e,value:e},e))),e&&a.createElement(ti.A,null,"Please select a value in this field!")))};js.propTypes={required:O().bool,error:O().bool,field:O().string,options:O().instanceOf(Array).isRequired,onChange:O().func.isRequired,value:O().oneOfType([O().string,O().number,O().instanceOf(Array),O().instanceOf(Object)]).isRequired,disabled:O().bool,style:O().instanceOf(Object),width:O().number,tooltipText:O().string};const Is=js,Ts=[{field:"Ethnicity",key:"ethnicity",type:"select"},{field:"Gender",key:"gender",type:"select"},{field:"Age Range",key:"age_bucket",type:"select"},{field:"Country/Region",key:"country",type:"group-select"}],Bs=[{field:"Ethnicity",key:"ethnicity",type:"select"},{field:"Gender",key:"gender",type:"select"},{field:"Age Range",key:"age_bucket",type:"select"},{field:"Country/Region",key:"country",type:"group-select"},{field:"Category",key:"category",type:"select"},{field:"Size",key:"size",type:"select"}],$s={pom:"",max:null,min:null,unit:"cm"},Ns=["BODY"],qs=({filters:e,onClose:t,type:n,showFilterPanel:i,isDQ:l=!1,source:r="MyAlva",projectTypes:o=Ns})=>{const[s,c]=(0,a.useState)({}),[d,m]=(0,a.useState)([]),[p,u]=(0,a.useState)({}),g="avatar"===n?Ts:Bs,[h,x]=(0,a.useState)([]),[f,b]=(0,a.useState)(["Body"]),[v,A]=(0,a.useState)([$s]),[w,C]=(0,a.useState)([]),[S,k]=(0,a.useState)(""),_=0!==w.filter(e=>e).length||0!==S.length;(0,a.useEffect)(()=>{c(e),0===Object.keys(e).length&&(A([$s]),u({}))},[e]),(0,a.useEffect)(()=>{"MyAlva"===r?(async e=>Ye(Qe.MYALVA.overviewOptions,e))({type:n}).then(e=>{e?.data&&m(e.data)}):Jt({project_types:l?f.map(e=>e.toUpperCase()):o}).then(e=>x(e?.data||[]))},[n,r,o,f,l]);const z=(e,t)=>{c(n=>({...n,[e]:t}))};(0,a.useEffect)(()=>{if(l&&"BodyScan"===r&&s?.age_range){const e=s.age_range;e[1]80?k("Sorry, we only support ages under 80 at the moment."):k("")}else k("")},[s,l,r]);const R=e=>s?.[e]?s[e]:[];return(0,a.useEffect)(()=>{const e=(e=>{if(0===e.length)return!1;const t=e.map(e=>null!==e.min&&Number.isNaN(+e.min)||null!==e.max&&Number.isNaN(+e.max)?"isNaN":null!==e.max&&+e.max<+e.min&&"invalidRange");return t})(v);C(e)},[v]),a.createElement(or.A,{sx:{p:i?2:0,display:"flex",visibility:i?"visible":"hidden",flexDirection:"column",marginBottom:i?2:0,height:i?"auto":0}},l&&a.createElement(vn.A,{variant:"subtitle",mb:2},"Filter Settings"),a.createElement(Ct.A,{direction:"row",spacing:1,justifyContent:"start"},"MyAlva"===r?a.createElement(a.Fragment,null,a.createElement(ur,{field:"Dataset",multiple:!0,value:R("dataset"),onChange:e=>z("dataset",e),options:$e(d?.dataset||{}),group:Object.keys(d?.dataset||{}).length>1?"group":"",style:{width:"250px"}}),a.createElement(ca,{value:p,onChange:e=>{u(e),c(t=>({...t,datetime_gte:e.datetime_gte,datetime_lte:e.datetime_lte}))}})):a.createElement(Ct.A,{direction:"row",spacing:2},l&&a.createElement(Is,{field:"Body Type",value:f,options:["Body","Head","Hand"],onChange:e=>(e=>{c(e=>{const{include_dataset:t,...n}=e;return n}),b(0===e.length?["Body"]:e)})(e),multiple:!0,tooltipText:"If multiple body types are selected, only datasets that contain all the selected types will be queried. For example, if both head and hand types are selected, only datasets that include both head and hand data will be shown.",width:200}),a.createElement(_s,{field:"Dataset",value:s?.include_dataset||[],onChange:e=>z("include_dataset",e),options:h}),a.createElement(Rs,{value:{datetime_gte:s?.datetime_gte,datetime_lte:s?.datetime_lte},onChange:z}),a.createElement(pi,{field:"Gender",value:s?.gender||[],options:["Male","Female"],onChange:(e,t)=>z("gender",t),multiple:!0,width:250}),a.createElement(rr,{value:s?.age_range||[0,80],onRangeChange:e=>z("age_range",e),err:0!==S.length,errMsg:S,isDQ:l}))),"MyAlva"===r&&a.createElement(Ct.A,{spacing:1,direction:"row",useFlexGap:!0,flexWrap:"wrap",sx:{mt:1}},g.map(e=>"select"===e.type?a.createElement(pi,{key:e.key,sx:{m:1},field:e.field,value:R(e.key),multiple:!0,width:250,onChange:(t,n)=>z(e.key,n),options:d?.[e.key]?.length>0?d[e.key]:[]}):"group-select"===e.type?a.createElement(ur,{key:e.key,field:e.field,multiple:!0,value:R(e.key),onChange:t=>z(e.key,t),options:d?.[e.key]||[],group:"group",style:{width:"250px"}}):void 0)),l&&a.createElement(Ms,{filters:v,onFilterPomSelect:(e,t,n)=>{const a=v.at(t)||$s,i="pom"===n?{...a,pom:e,unit:"weight"===e?"kg":"cm"}:{...a,[n]:""===e?null:e},l=v.toSpliced(t,1,i);A(l)},onExtraFilterAdd:()=>{const e=[...v,$s];A(e)},onExtraFilterDel:e=>{if(v.length>1){const t=v.toSpliced(e,1);A(t)}else A([$s])},source:r,error:w}),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",sx:{mt:1}},a.createElement(E.A,{theme:I},a.createElement(y.A,{color:"primary",onClick:()=>{u({}),c({}),l&&(A([$s]),b(["Body"]))}},"Clear filters")),a.createElement(Ct.A,{spacing:1,direction:"row",sx:{mr:1}},a.createElement(ra,{color:"default",variant:"outlined",text:"Cancel",onClick:()=>t()}),a.createElement(ra,{color:"primary",disabled:!!l&&_,text:"Apply",onClick:()=>{if(l){const e=(e=>{const t=e.filter(e=>0!==e.pom.length&&(null!==e.max||null!==e.min));return t})(v),n=0!==v.length?{...s,extra_filter:e,project_types:f.map(e=>e.toUpperCase())}:{...s,project_types:f.map(e=>e.toUpperCase())};t(n)}else t(s)}}))))};qs.propTypes={onClose:O().func.isRequired,filters:O().instanceOf(Object).isRequired,type:O().string.isRequired,showFilterPanel:O().bool.isRequired,isDQ:O().bool,source:O().string,projectTypes:O().instanceOf(Array)};const Ls=qs,Ps=e=>e?.children?e.children.flatMap(e=>Ps(e)):e,Ws=[{field:"id",headerName:"No.",filterable:!1,hideable:!1,width:50,renderCell:e=>e.api.getAllRowIds().indexOf(e.id)+1},{field:"timestamp",headerName:"Scan Year",hideable:!1,valueFormatter:e=>new Date(e).getFullYear(),filterable:!1},{field:"country",headerName:"Country/Region",hideable:!1,filterable:!1},{field:"gender",headerName:"Gender",hideable:!1,filterable:!1},{field:"age",headerName:"Age",hideable:!1,filterable:!1}],Vs=[{field:"open_id",headerName:"MyAlva ID",filterable:!1,hideable:!1,width:150,valueFormatter:e=>e?`${e.substring(0,5)}****${e.substring(e.length-5,e.length)}`:""},{field:"timestamp",headerName:"Last Updated",filterable:!1,hideable:!1,valueFormatter:e=>ke(e)},{field:"country",headerName:"Country/Region",hideable:!1,filterable:!1},{field:"ethnicity",headerName:"Ethnicity",filterable:!1,hideable:!1},{field:"gender",headerName:"Gender",filterable:!1,hideable:!1},{field:"age_bucket",headerName:"Age Range",filterable:!1,hideable:!1}],Hs=({dataSource:e})=>{const t=(0,p.Zp)(),[n,i]=(0,a.useState)({}),[l,r]=(0,a.useState)({}),[o,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(-1),[m,u]=(0,a.useState)(!1),[g,E]=(0,a.useState)({}),[y,x]=(0,a.useState)([]),f=y.flatMap(e=>Ps(e)),[b,v]=(0,a.useState)({page:0,pageSize:10}),[A,w]=(0,a.useState)(null),C=0!==Object.keys(g).length,[S,k]=(0,a.useState)({}),_=l?.[e]||[],[z,R]=(0,a.useState)({}),D=_.map(e=>({field:e.key,headerName:e.value,filterable:!1,valueGetter:(t,n)=>n?.["weight"===e.key?S.unit_weight||"kg":S.unit||"cm"]?.[e.key]?.toFixed(2)||"N/A"})),O="MyAlva"===e?Vs:Ws;(0,a.useEffect)(()=>{(async()=>Ye(Qe.USER.settings,void 0))().then(t=>{if(t?.data_query_fields){r(t.data_query_fields);const n=t.data_query_fields[e]||[],a=Object.fromEntries(n.filter(e=>!e.selected).map(e=>[e.key,!1]));R(a)}}),Jt().then(e=>x(e?.data||[]))},[]);const F=(t,a,i)=>{u(!0),(async e=>Ze(Qe.DATA_QUERY.data,e))({...i||n,page:(t||0)+1,page_size:a||10,type:e}).then(e=>{e?.data&&(s(e.data),d(e?.count||0)),u(!1)})};(0,a.useEffect)(()=>{if(i({project_types:["BODY"]}),0!==e.length){F(0,10,{project_types:["BODY"]}),v({page:0,pageSize:10});const e=Object.fromEntries(_.filter(e=>!e.selected).map(e=>[e.key,!1]));R(e)}},[e]);const M=[...O,...D,{field:"dataset_name",headerName:"Dataset",filterable:!1,hideable:!1,renderCell:t=>"BodyScan"===e?a.createElement(Ct.A,{direction:"row"},a.createElement("span",null,t.value),a.createElement(h.A,{onClick:e=>((e,t)=>{w(e.currentTarget);const n=f.find(e=>e.name===t);E(n)})(e,t.value)},a.createElement(ri.A,{fontSize:"small",sx:{color:"#1AA464",verticalAlign:"text-top"}}))):a.createElement("span",null,t.value)}];return a.createElement(Ct.A,{direction:"column",spacing:2},a.createElement(Ls,{filters:n,onClose:e=>{if(e){const t=Object.fromEntries(Object.entries(e).filter(e=>0!==e[1].length));i(t),F(0,b.pageSize,t),v(e=>({...e,page:0}))}},type:"avatar",showFilterPanel:!0,isDQ:!0,source:e}),a.createElement(Ct.A,{direction:"row",alignItems:"center",justifyContent:"space-between"},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"h6"},`${e} Data`),a.createElement(Fl,{label:"",options:["cm","inch"],value:S?.unit||"cm",color:"primary",onChange:e=>k(t=>({...t,unit:e}))}),"MyAlva"===e&&a.createElement(Fl,{label:"",options:["kg","lbs"],value:S?.unit_weight||"kg",color:"primary",onChange:e=>k(t=>({...t,unit_weight:e}))})),"MyAlva"===e&&a.createElement(ra,{variant:"outlined",onClick:()=>{(async e=>Ze(Qe.DATA_QUERY.download,e))({...n,type:e}).then(e=>{e&&t("/user-settings/downloads")})},text:"Download"})),a.createElement(Ct.A,null,a.createElement(Ci.z,{autoHeight:!0,columns:M,rows:o,pageSizeOptions:[10,25,50],paginationMode:"server",getRowHeight:()=>"auto",columnVisibilityModel:z,paginationModel:b,onColumnVisibilityModelChange:t=>(t=>{u(!0);const n=_.map(e=>({...e,selected:!1!==t?.[e.key]}));(async e=>Je(Qe.USER.settings,e))({data_query_fields:{[e]:n}}).then(e=>{e?.data_query_fields&&(r(e.data_query_fields),R(t)),u(!1)})})(t),onPaginationModelChange:e=>{v(e),F(e.page,e.pageSize)},rowCount:"BodyScan"===e&&c>50?50:c,sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"8px"},".MuiDataGrid-cell:focus-within":{outline:"none"},".MuiDataGrid-row.Mui-selected, .MuiDataGrid-row.Mui-selected:hover":{backgroundColor:"rgba(236, 119, 0, 0.2)"}}}),a.createElement(bi,{isLoading:m,isDQ:!0,isSingleChart:!0})),C&&a.createElement(on.Ay,{open:C,anchorEl:A,onClose:()=>{w(null),E({})},anchorOrigin:{vertical:"bottom",horizontal:"left"},sx:{padding:"10px"}},a.createElement(dr,{datasetDetail:g,setDatasetDetail:E,isDQ:!0})))};Hs.propTypes={dataSource:O().string.isRequired};const Gs=Hs,Us=()=>{const[e,t]=(0,a.useState)({}),[n,i]=(0,a.useState)("");return(0,a.useEffect)(()=>{(async()=>Ye(Qe.DATA_QUERY.option))().then(e=>{if(e?.data){t(e.data);const n=e.data?.type;i(n?.[0]||"SizeChart")}})},[]),a.createElement(_t.A,{sx:{padding:"32px",height:"calc(100% - 64px)",display:"flex",flexDirection:"column",overflow:"hidden"}},a.createElement(Ct.A,{direction:"row",spacing:3,alignItems:"end",mb:1,sx:{width:"calc(100% - 40px)",height:"100%"}},a.createElement(vn.A,{variant:"h4",component:"h4",style:{fontWeight:500}},"Data Query"),e?.type?.length>1&&a.createElement(Yn,{field:"source",label:"",selected:n,options:e?.type||[],onChange:e=>i(e),color:"default"})),"SizeChart"===n?a.createElement(Ss,null):a.createElement(Gs,{dataSource:n}))};var Ys=n(5063),Zs=n(4529);const Js=[{type:"number",regex:/[0-9]/},{type:"alphabet",regex:/[A-Za-z]/},{type:"special character",regex:/[^\da-zA-Z]/}],Xs=({open:e,onClose:t,onSubmit:n,user:i=qe})=>{const[l,r]=(0,a.useState)(""),o=Js.map(e=>e.regex.test(l)).includes(!1)||l.length<8;return a.createElement(qa.A,{onClose:t,open:e},a.createElement(La.A,null,i?.username?`Change Password for: ${i.username}`:"Change Your Password"),a.createElement(Pa.A,null,a.createElement(si,{label:"New Password",value:l,placeholder:"New Password",onChange:e=>r(e.target.value)}),a.createElement("div",{style:{display:"flex",marginTop:"10px"}},a.createElement(el.A,{fontSize:"small",sx:{color:l.length>=8?"#1AA464":"#9B9B9B"}}),a.createElement("span",{style:{color:l.length>=8?"#1AA464":"#9B9B9B",fontSize:"14px"}},"New password must be longer than 8 characters")),Js.map(e=>{return t=e.regex,n=e.type,a.createElement("div",{key:`regex-requirement-${n}`,style:{display:"flex",marginTop:"10px"}},a.createElement(el.A,{fontSize:"small",sx:{color:l.match(t)?"#1AA464":"#9B9B9B"}}),a.createElement("span",{style:{color:l.match(t)?"#1AA464":"#9B9B9B",fontSize:"14px"}},`New password must contains at least one ${n}`));var t,n})),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:t}),a.createElement(ra,{text:"Ok",disabled:o,color:"primary",onClick:()=>n(l)})))};Xs.propTypes={open:O().bool.isRequired,onClose:O().func.isRequired,onSubmit:O().func.isRequired,user:O().instanceOf(Object)};const Qs=Xs,Ks=()=>a.createElement(tl.A,{fontSize:"small"},a.createElement("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",id:"mx_n_1720429685587",width:"128",height:"128"},a.createElement("path",{fill:"rgba(0, 0, 0, 0.54)",d:"M766.598 75.624c-112.55-65.312-250.07-87.553-385.693-51.212C110.437 96.883-50.07 374.89 22.4 645.357c72.472 270.468 350.479 430.975 620.946 358.504 270.467-72.472 430.975-350.479 358.503-620.946-0.211-0.789-0.424-1.577-0.639-2.363h-62.505a454.786 454.786 0 0 1 5.189 17.892c63.895 238.46-77.618 483.566-316.077 547.461-238.46 63.895-483.566-77.617-547.461-316.077-63.895-238.46 77.617-483.566 316.077-547.46 119.62-32.053 240.912-12.416 340.164 45.217l-42.383 73.409 217.66-6.997L809.104 2l-42.507 73.624z"}),a.createElement("path",{fill:"rgba(0, 0, 0, 0.54)",d:"M442 447h140v-70c0-38.66-31.34-70-70-70s-70 31.34-70 70v70z m44 186.012V716h52v-82.988c25.786-10.321 44-35.54 44-65.012 0-38.66-31.34-70-70-70s-70 31.34-70 70c0 29.472 18.214 54.69 44 65.012zM390 447v-70c0-67.379 54.621-122 122-122 67.379 0 122 54.621 122 122v70h37c18.778 0 34 15.222 34 34v252c0 18.778-15.222 34-34 34H353c-18.778 0-34-15.222-34-34V481c0-18.778 15.222-34 34-34h37z"}))),ec=({userList:e,onUserEdit:t,onUserDel:n,onUserPasswordChange:i,isListEmpty:l,isOrgMgmt:r=!1})=>{const[o,s]=(0,a.useState)({}),[c,d]=(0,a.useState)({}),m=Object.keys(o).length>0,p=e=>{t(e)},u=e=>{d(e)},g=()=>{s({})},E=[{field:"email",headerName:"Email",display:"flex",flex:2.5},{field:"first_name",headerName:"First Name",display:"flex",flex:1.5},{field:"last_name",headerName:"Last Name",display:"flex",flex:1.5},{field:"group",headerName:"Role",display:"flex",flex:1.2},{field:"date_joined",headerName:"Date Joined",display:"flex",flex:1,valueGetter:e=>ke(e)},{field:"last_login",headerName:"Last Login",display:"flex",flex:1,valueGetter:e=>ke(e)}],y={field:"is_active",headerName:"Status",display:"flex",flex:r?1:0,valueGetter:e=>e?"Active":"Inactive"},x={field:"actions",type:"actions",headerName:"Actions",display:"flex",width:120,cellClassName:"actions",headerAlign:"left",align:"center",sortable:!1,disableColumnMenu:!0,getActions:({id:e,row:t})=>r?[a.createElement(ei.A,{title:"Reset Password",key:"password-reset"},a.createElement(h.A,{size:"small",onClick:()=>s(t)},a.createElement(Ks,null))),a.createElement(ei.A,{title:"Edit",key:"edit"},a.createElement(h.A,{size:"small",onClick:()=>p(t)},a.createElement(Pi.A,{fontSize:"small"}))),a.createElement(ei.A,{title:t.is_active?"Delete":"Activate",key:"delete"},a.createElement(h.A,{size:"small",onClick:()=>u(t)},t.is_active?a.createElement(Zs.A,{fontSize:"small",sx:{color:"#EC7700"}}):a.createElement(Ys.A,{fontSize:"small"})))]:[a.createElement(ei.A,{title:"Reset Password",key:"password-reset"},a.createElement(h.A,{size:"small",onClick:()=>s(t)},a.createElement(Ks,null))),a.createElement(ei.A,{title:"Edit",key:"edit"},a.createElement(h.A,{size:"small",onClick:()=>p(t)},a.createElement(Pi.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Delete",key:"delete"},a.createElement(h.A,{size:"small",onClick:()=>u(t)},a.createElement(Li.A,{fontSize:"small"})))]};return a.createElement(_t.A,{sx:{width:"100%",height:r?"calc(100% - 50px)":"auto"}},a.createElement(Ci.z,{autoHeight:!r,columns:r?[...E,y,x]:[...E,x],rows:e,getRowHeight:()=>"auto",loading:0===e.length&&!l,slots:{loadingOverlay:Ri},sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"8px"},".MuiDataGrid-cell:focus-within":{outline:"none"}}}),m&&a.createElement(Qs,{open:m,onClose:g,onSubmit:async e=>{await i(o.id,e)&&g()}}),a.createElement(qa.A,{onClose:()=>d({}),open:Object.keys(c).length>0},a.createElement(La.A,null,(c.is_active?"Delete":"Activate")+" User"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},`Are you sure to ${c.is_active?"delete":"activate"} the user `,a.createElement("b",null,c?.email||""),"?"),c.is_active&&a.createElement(Wa.A,{id:"alert-dialog-description"},"By deleting this user, he or she won't be able to access the system.")),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>d({})}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>(n(c),void d({}))}))))};ec.propTypes={userList:O().instanceOf(Array).isRequired,onUserEdit:O().func.isRequired,onUserDel:O().func.isRequired,onUserPasswordChange:O().func.isRequired,isListEmpty:O().bool.isRequired,isOrgMgmt:O().bool};const tc=ec,nc=["email","first_name","last_name","organization","group_id","password"],ac=[{type:"number",regex:/[0-9]/},{type:"alphabet",regex:/[A-Za-z]/},{type:"special character",regex:/[^\da-zA-Z]/}],ic=({onUserChangesSubmit:e,isAddNew:t,userOnEdit:n,onCancelEdit:i,groupList:l,open:r,organization:o=""})=>{const[s,c]=(0,a.useState)({}),d=t?nc:nc.filter(e=>"password"!==e),m=l.map(e=>({key:e.id,value:e.name})),p=s?.password||"",u=ac.map(e=>e.regex.test(p)).includes(!1)||p.length<8;(0,a.useEffect)(()=>{c(t?{}:n)},[n,t]);const g=(e,t)=>{c({...s,[e]:t})};return a.createElement(qa.A,{open:r,maxWidth:"md",fullWidth:!0},a.createElement(La.A,null,t?"Add New User":"Edit User"),a.createElement(Pa.A,null,a.createElement(Ct.A,{spacing:2,direction:"row",justifyContent:"space-between",useFlexGap:!0,flexWrap:"wrap"},d.map(e=>a.createElement("div",{key:e,style:{width:"email"===e?"100%":"330px",position:"relative"}},"group_id"!==e?a.createElement(a.Fragment,null,a.createElement(aa.A,{style:{display:"block",minWidth:"120px",boxSizing:"border-box",marginBottom:"5px"}},`${Fe(e)}*`),a.createElement(si,{label:Fe(e),value:"organization"===e?s?.organization_name||o:s?.[e]||"",onChange:t=>g(e,t.target.value),disabled:"organization"===e,style:{width:"email"===e?"calc(100% - 32px)":"300px"}})):a.createElement(pi,{required:!0,field:"Role",value:m.find(t=>t.key===s?.[e])||"",onChange:(t,n)=>g(e,n.key),options:m,style:{width:"330px"}})))),t&&a.createElement(a.Fragment,null,a.createElement("div",{style:{display:"flex",margin:"10px 0"}},a.createElement(el.A,{fontSize:"small",sx:{color:p.length>=8?"#1AA464":"#9B9B9B"}}),a.createElement("span",{style:{color:p.length>=8?"#1AA464":"#9B9B9B",fontSize:"14px"}},"Password must be longer than 8 characters")),ac.map(e=>{return t=e.regex,n=e.type,a.createElement("div",{key:`regex-requirement-${n}`,style:{display:"flex",marginBottom:"10px"}},a.createElement(el.A,{fontSize:"small",sx:{color:p.match(t)?"#1AA464":"#9B9B9B"}}),a.createElement("span",{style:{color:p.match(t)?"#1AA464":"#9B9B9B",fontSize:"14px"}},`Password must contains at least one ${n}`));var t,n}))),a.createElement(Va.A,null,a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>{i()}}),a.createElement(ra,{color:"primary",disabled:!!t&&u,text:"Save",onClick:()=>{e(s)}})))};ic.propTypes={onUserChangesSubmit:O().func.isRequired,isAddNew:O().bool.isRequired,userOnEdit:O().instanceOf(Object).isRequired,onCancelEdit:O().func.isRequired,groupList:O().instanceOf(Array).isRequired,open:O().bool.isRequired,organization:O().string};const lc=ic,rc=()=>{const e=(0,l.useSelector)(C),[t,n]=(0,a.useState)(!1),[i,r]=(0,a.useState)(!0),[o,s]=(0,a.useState)(!1),[c,d]=(0,a.useState)([]),[m,p]=(0,a.useState)([]),[u,g]=(0,a.useState)({}),h=()=>{da({page:1,page_size:500}).then(e=>{d(e?.results||[]),0===e?.count&&s(!0)}),Ea().then(e=>p(e?.results||[]))};return(0,a.useEffect)(()=>{h()},[]),a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column"}},a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New User",color:"primary",onClick:()=>{n(!0),r(!0)},style:{width:"150px",marginBottom:"8px"}}),a.createElement(tc,{userList:c,onUserEdit:e=>{n(!0),r(!1),g(e)},onUserDel:e=>{ua(e.id,{is_active:!e.is_active}).then(e=>(e&&(h(),n(!1)),null))},isEditing:t,onUserPasswordChange:(e,t)=>ha({id:e,password:t}).then(e=>e),isListEmpty:o}),t&&a.createElement(lc,{isAddNew:i,open:t,userOnEdit:u,onUserChangesSubmit:e=>{i?ma(e).then(e=>(e&&(h(),n(!1),r(!1)),null)):pa(e.id,e).then(e=>(e&&(h(),n(!1)),null))},onCancelEdit:()=>{n(!1),r(!1)},groupList:m,organization:e.organization_name}))},oc=(e,t)=>{const n=e.value.toUpperCase(),a=t.value.toUpperCase();return na?1:0},sc=()=>{const[e,t]=(0,a.useState)([]),[n,i]=(0,a.useState)({}),l=Object.keys(n).length>0,r=[{field:"value",headerName:"Name",display:"flex",flex:1},{field:"created_at",headerName:"Creation Date",display:"flex",flex:1,valueGetter:e=>ke(e)},{field:"created_by",headerName:"Created By",display:"flex",flex:1},{field:"last_modified",headerName:"Update Date",display:"flex",flex:1,valueGetter:e=>ke(e)},{field:"updated_by",headerName:"Updated By",display:"flex",flex:1},{field:"actions",type:"actions",headerName:"Actions",width:100,cellClassName:"actions",headerAlign:"left",align:"center",display:"flex",getActions:({id:n})=>[a.createElement(Qi.Z,{icon:a.createElement(Pi.A,null),label:"Edit",key:"edit-icon",onClick:()=>(t=>{const n=e.find(e=>e.id===t);i(n)})(n),color:"inherit"}),a.createElement(Qi.Z,{icon:a.createElement(Ki.A,null),label:"Delete",key:"del-icon",onClick:()=>(e=>{(async e=>Xe(`${Qe.PROJECT_VIEW.getOptions}/${e}/`))(e).then(()=>{t(t=>t.filter(t=>t.id!==e))})})(n),color:"inherit"})]}];return(0,a.useEffect)(()=>{Vt().then(e=>{e?.data&&t(e.data)})},[]),a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column"}},a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New Client",color:"primary",onClick:()=>{i({id:"newClient",value:""})},style:{width:"160px",marginBottom:"8px"}}),a.createElement(Ci.z,{autoHeight:!0,rows:e,columns:r,disableRowSelectionOnClick:!0,getRowHeight:()=>"auto",slots:{noRowsOverlay:Ri},sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},".MuiCheckbox-root":{"&.Mui-checked":{color:"#EC7700"},"&:hover":{backgroundColor:"transparent"}},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"8px"},".MuiDataGrid-cell:focus-within":{outline:"none"}}}),a.createElement(qa.A,{onClose:()=>i({}),open:l},a.createElement(La.A,null,("newClient"===n.id?"New":"Edit")+" Client"),a.createElement(Pa.A,null,a.createElement(si,{label:"Client",value:n?.value||"",onChange:e=>i(t=>({...t,value:e.target.value}))})),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>i({})}),a.createElement(ra,{text:"Ok",color:"primary",onClick:()=>(n=>{"newClient"===n.id?(async e=>Ze(Qe.PROJECT_VIEW.getOptions,e,{domain:"ProjectClient"}))({value:n.value}).then(e=>{e?.data&&(t(t=>[...t,e.data].sort((e,t)=>oc(e,t))),i({}))}):ga(n.id,{value:n.value}).then(n=>{if(n?.data){const a=[...e.filter(e=>e.id!==n.data.id),n.data].sort((e,t)=>oc(e,t));t(a),i({})}})})(n)}))))},cc=()=>{const e=(0,p.Zp)(),t=(0,l.useSelector)(ye),n=(0,p.zy)().pathname.split("/")[1],i=Gi(t),[r,o]=(0,a.useState)({}),[s,c]=(0,a.useState)(""),[d,u]=(0,a.useState)([]),[g,E]=(0,a.useState)([]),[y,x]=(0,a.useState)([]),[f,b]=(0,a.useState)([]),v=0!==Object.keys(r).length?t.filter(e=>Object.keys(r).every(t=>!(r?.[t]&&r[t].length>0)||je(r[t],e[t]))):t,A=i.filter(e=>!["type","size_type","gender"].includes(e)).map(e=>({field:e,headerName:Fe(e),display:"flex",flex:"Year"===e||"Country/Region"===e?.5:1,valueGetter:e=>e||"/"})),w=Ui(t,i),C=Object.keys(w),S=v.reduce((e,t)=>(Object.keys(t).forEach(n=>{C.includes(n)&&(e[n]=e?.[n]?Array.from(new Set([e[n],t[n]].flat())):[t[n]].flat())}),e),{});(0,a.useEffect)(()=>{tn({project:n}).then(e=>{if(e?.results){const{results:t}=e,n=t.filter(e=>"Comparison"!==e.type).map(e=>e.records||[]).flat(),a=t.filter(e=>"Comparison"===e.type).map(e=>e.records||[]).flat();x(n),b(a)}})},[n]);const k=(e,t,n)=>{if(!n?.relatedTarget||!n?.relatedTarget?.type){const n={...r};if(0===t.length){const t=Object.fromEntries(Object.entries(n).filter(t=>t[0]!==e));o(t)}else o({...n,[e]:t});u([]),c("")}};return a.createElement(_t.A,{sx:{p:"0 20px 20px"}},a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",padding:"0 16px"}},a.createElement(h.A,{"aria-label":"back",onClick:()=>e("../../"),sx:{padding:0,"&:hover":{color:"#EC7700",backgroundColor:"transparent"}}},a.createElement(kl.A,null)),a.createElement(vn.A,{variant:"h5",component:"h5",style:{padding:"0 15px"}},"SALES BY SIZE DATA MANAGEMENT"),a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add Data",color:"primary",component:m.N_,to:"new"})),t.length>0?a.createElement(a.Fragment,null,a.createElement(_t.A,{sx:{display:"flex",flexGrow:1,flexDirection:"column"}},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1rem",fontWeight:500}},"Optional Filters")),a.createElement(Ct.A,{direction:"row",sx:{m:1},useFlexGap:!0,flexWrap:"wrap"},C.map(e=>{return a.createElement(pi,{key:e,options:S?.[e]||[],sx:{m:1,minWidth:300},field:e,value:(t=e,0!==d.length&&t===s?d:r?.[t]?r[t]:[]),multiple:!0,onClose:t=>k(e,d,t),onOpen:()=>(e=>{""!==s&&k(s,d),c(e);const t=r[e];u(t||[])})(e),onChange:(t,n)=>((e,t)=>{if(s!==e){const n={...r};if(0===t.length){const t=Object.fromEntries(Object.entries(n).filter(t=>t[0]!==e));o(t)}else o({...n,[e]:t})}else u(t)})(e,n)});var t})),a.createElement(_t.A,{sx:{display:"flex",flexGrow:1,flexDirection:"column"}},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1rem",fontWeight:500}},"Data")),a.createElement(hl,{columns:A,data:v,onSelectionModelChange:e=>E(e),selectionModel:g,type:"edit",selectedBasicsOptions:y,selectedComparisonOptions:f})):a.createElement(_t.A,{sx:{display:"flex",justifyContent:"center",alignItems:"center"}},a.createElement(vn.A,{variant:"body2",style:{position:"fixed",top:"50%",color:"#A0A0A0"}},"No Data available at this moment, please start adding new data by clicking the add button above.")))},dc=()=>a.createElement(p.sv,null);var mc=n(80899),pc=n(3959);(0,pc.pv)(mc);const uc=()=>{const e=(0,p.Zp)(),t=(0,p.zy)(),n=(0,l.useDispatch)(),i=(0,a.useRef)(null),r=t.pathname.split("/")[5]||"",[o,s]=(0,a.useState)([]),c=(0,l.useSelector)(se),d=(0,l.useSelector)(ye),[m,u]=(0,a.useState)(!1),[g,x]=(0,a.useState)([]),[f,b]=(0,a.useState)(0),[v,A]=(0,a.useState)([["Year","Country/Region","","","","",""],...new Array(10).fill("")].map(e=>Object.fromEntries(Yi.map((t,n)=>[` ${t}`,e?.[n]||""])))),[w,C]=(0,a.useState)({last_modified:new Date}),[S,k]=(0,a.useState)([]),[z,R]=(0,a.useState)([]),[D,O]=(0,a.useState)(""),F=g.length>1&&f!==g.length-1,M=Xi.map(e=>e.id),[j,T]=(0,a.useState)(!1),B=0!==r.length,$=0!==o.length&&Object.keys(w).length!==Xi.length;(0,a.useEffect)(()=>{if(0!==o.length){const e=pc.Wp.sheet_to_json(o[f],{header:"A"}).map(e=>Object.values(e)),t=e.findIndex(e=>e.includes("")),n=e.findIndex(e=>e.includes("")),a=e.find(e=>e.includes("ACID"))||[];if(a.length<2||a.at(1)!==c.acid)return s([]),x([]),u(!1),void O("The ACID we've got from the sheet is different from the ACID of this project. Please upload a file with correct ACID or manually input data.");O("");const i=Zi(e.slice(t+1,n)),l=Object.fromEntries([...e.slice(0,t).filter(e=>M.includes(Ji(e[0]))).map(e=>[Ji(e[0]),e[1]]),["additional_remarks",...e.slice(n+1).flat()]]);A(i),C(l),R([]),u(!1)}},[o,f]),(0,a.useEffect)(()=>(Vt().then(e=>{const t=0!==e?.data?.length?e.data.map(e=>({value:e.value,key:e.id})):[];k(t)}),i?.current?.jexcel&&No().destroy(i.current.jexcel,!0)),[]),(0,a.useEffect)(()=>{u(!0),i.current.jspreadsheet?(i.current.jspreadsheet.setData(v),u(!1)):(No()(i.current,{data:v,minDimensions:[12,10],defaultColWidth:100}),u(!1))},[v]),(0,a.useEffect)(()=>{if(B&&0!==d.length){const e=d.filter(e=>e?.group?.group_id===r),t=Object.fromEntries([...Xi.map(t=>[t.id,"size_order"===t.id?e[0]?.[t.id].join(","):e[0]?.[t.id]||""]),["data_type",e[0]?.type]]),n=[...e.map(e=>e.level_order).sort().at(-1).split(",").filter(e=>!M.includes(e)&&"brand"!==e&&"type"!==e),...e[0].size_order],a=[n,...e.map(e=>n.map(t=>e?.[t]||e?.size_value?.[t]||"/"))];C(t),A(Zi(a))}},[r,d]);const N=(e,t)=>{C(n=>({...n,[e]:t}))},q=()=>{const t=(()=>{let e=[];return Xi.forEach(t=>{!t.required||w?.[t.id]&&""!==w[t.id]||(e=[...e,t.id])}),e})();if(0!==t.length)return void R(t);const a=i?.current?.jexcel?.getData(),l=a.map(e=>Object.values(e)),o=l.slice(0,1).flat(),s=l.slice(1).map(e=>Object.fromEntries(o.map((t,n)=>[t,e[n]]))).filter(e=>""!==Object.values(e).join("")),m={...w,acid:c.acid,brand:c.client,type:w.data_type,items:s,group:{sheet_name:0!==g.length?g[f]:"Manual Input"}};B&&(m.group.group_id=r),(async e=>Ze(Qe.PROJECT_VIEW.sbsList,e))(m).then(t=>{if(t?.results){const a=d.filter(e=>e?.group?.group_id!==r);n(Ee([...t.results,...a])),F?b(e=>e+1):e("../")}})};return a.createElement(a.Fragment,null,a.createElement(_t.A,{sx:{display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",padding:"0 16px"}},a.createElement(h.A,{"aria-label":"back",onClick:()=>e("../"),sx:{padding:0,"&:hover":{color:"#EC7700",backgroundColor:"transparent"}}},a.createElement(kl.A,null)),a.createElement(vn.A,{variant:"h5",component:"h5",style:{padding:"0 15px"}},(B?"Edit":"Add")+" SBS Data")),!B&&a.createElement(a.Fragment,null,(0===o.length||w.length<1)&&a.createElement(_.A,{severity:"info",sx:{".MuiAlert-message p":{margin:0}},action:a.createElement(E.A,{theme:I},a.createElement(y.A,{component:"label",role:void 0,variant:"contained",color:"primary",tabIndex:-1,sx:{height:"32px",borderRadius:"32px",fontWeight:"100",boxShadow:"none",color:"#FFFFFF",textTransform:"none"}},"Upload file",a.createElement("input",{type:"file",accept:".xlsx",id:"input_dom_element",onChange:async e=>{if(0!==e.target.files.length){u(!0);const t=e.target.files[0],n=await t.arrayBuffer(),a=(0,pc.TA)(n,{cellDates:!0});s(Object.values(a.Sheets)),x(a.SheetNames)}},style:{clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}})))},a.createElement("span",{style:{display:"block",minWidth:"120px",fontSize:"15px",boxSizing:"border-box"}},"Manually input the data / choose a pre-filled SBS Excel file to upload")),$&&a.createElement(_.A,{severity:"warning"},"We cannot get some of the required fields from the file, please double check before clicking the add button."),0!==D.length&&a.createElement(_.A,{severity:"error"},D)),0!==o.length&&a.createElement(E.A,{theme:I},a.createElement(_t.A,{sx:{borderBottom:1,borderColor:"divider"}},a.createElement(St.A,{color:"primary",value:f,variant:"scrollable",scrollButtons:"auto","aria-label":"Sales By Size Data Sheets",sx:{width:"calc(100% - 144px)"}},o.map((e,t)=>a.createElement(kt.A,{disabled:f!==t,key:`sheet-${g[t]}`,label:g[t],sx:f!==t?{}:{backgroundColor:"#EC7700",color:"#FFFFFF !important",borderRadius:"15px 15px 0 0"}}))))),a.createElement(Ct.A,{spacing:2,flexDirection:"row",flexWrap:"wrap",useFlexGap:!0,sx:{margin:"0 16px"}},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1.2rem",fontWeight:500}},"Metadata"),Xi.map(e=>a.createElement(Ct.A,{key:`${e.id}`,direction:"row",sx:{width:"size_order"===e.id||"additional_remarks"===e.id?600:400},alignItems:"center",justifyContent:"space-between"},a.createElement(aa.A,{style:{display:"inline-block",boxSizing:"border-box",marginRight:"5px"}},`${e.label}`),"text"===e.type&&a.createElement(si,{label:e.id,value:w[e.id]||"",onChange:t=>N(e.id,t.target.value),style:{width:"size_order"===e.id||"additional_remarks"===e.id?400:200},err:z.includes(e.id),placeholder:e?.placeholder||""}),"autocomplete"===e.type&&a.createElement(hi,{options:e?.options||S,value:w[e.id]||"",onValueChange:t=>N(e.id,t.value),width:230,error:z.includes(e.id),style:{marginLeft:"-12px"}}),"select"===e.type&&a.createElement(pi,{options:e.options,field:"",value:w[e.id]||"",onChange:(t,n)=>N(e.id,n),error:z.includes(e.id),style:{width:230}}),"datetime"===e.type&&a.createElement(ia.l,{value:Jn()(w[e.id]||null),onChange:t=>N(e.id,t.$d.toISOString()),slotProps:{textField:{size:"small",sx:{padding:"0 15px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"200px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}}}})))),a.createElement(Ct.A,{m:2,flexDirection:"column"},a.createElement(vn.A,{variant:"body2",component:"span",style:{width:"100%",borderBottom:"2px solid #C1C1C1",paddingBottom:"5px",fontSize:"1.2rem",fontWeight:500}},"Data"),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"1rem",display:"block"}},"* You can copy & paste desired into the following grid starting from the first row or edit data imported from Excel."),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"1rem",display:"block"}},"* If you are entering the data manually, start by replaceing the cells containing <> with valid level and sizes. Feel free to add more columns if needed."),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"1rem",display:"block"}},"* If you are entering percentage values, make sure your inputs follow the format of 0.x or x% and the sum of each row is 1 or 100%."),a.createElement(vn.A,{variant:"caption",sx:{fontSize:"1rem",display:"block"}},'* Please input "/" symbol for cells that are empty.'),B&&a.createElement(vn.A,{variant:"caption",sx:{fontSize:"1rem",display:"block"}},"* Please be aware that the corresponding chart will be removed and you will have to re-generate the chart if any field other than the size values changed for a record."),a.createElement("div",{ref:i,style:{overflow:"auto",width:"100%",position:"relative",maxHeight:500,borderRight:"1px solid #E0E0E0",borderBottom:"1px solid #E0E0E0"}})),a.createElement(Ct.A,{flexDirection:"row-reverse",spacing:1,useFlexGap:!0},B?a.createElement(ra,{color:"primary",text:"Save",onClick:()=>T(!0)}):a.createElement(ra,{color:"primary",text:F?"Add and go to next sheet":"Add",onClick:q}),a.createElement(ra,{color:"default",variant:"outlined",text:g.length>1?"Skip this sheet":"Cancel",onClick:()=>{F?b(e=>e+1):e("../")}})),a.createElement(qa.A,{onClose:()=>T(!1),open:j},a.createElement(La.A,null,"Please Confirm"),a.createElement(Pa.A,null,a.createElement("p",null,"The data has been updated and the related charts will change."),a.createElement("p",null,"Are you sure to change the data?")),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>T(!1)}),a.createElement(ra,{text:"Yes",color:"primary",onClick:q}))),a.createElement(bi,{isLoading:m}))},gc=()=>{const e=(0,p.zy)().pathname.split("/")[1],t=(0,l.useDispatch)();return(0,a.useEffect)(()=>{(async e=>Ye(Qe.PROJECT_VIEW.sbsList,e))({project:e}).then(e=>{e?.status&&t(Ee(e?.results||[]))})},[e]),a.createElement(p.sv,null)},hc=[{id:"view_organization",text:"All Organizations",path:"organization"},{id:"release_note",text:"Release Note",path:"release-notes"},{id:"myalva_project_names",text:"MyAlva Project Names",path:"myalva-project"}],Ec=()=>{const e=(0,p.zy)(),t=e.pathname.split("/").length>3;return a.createElement(E.A,{theme:I},!t&&a.createElement(It.Ay,{sx:{".MuiDrawer-paper":{position:"absolute",top:"auto",left:"auto",zIndex:"auto",width:"180px"},a:{color:"inherit"}},variant:"permanent",anchor:"left"},a.createElement(Tt.A,null,hc.map(t=>a.createElement(Bt.A,{selected:e.pathname.includes(t.path),key:t.text},a.createElement(m.N_,{className:"sidebar-tabs",to:t.path,style:{width:"100%"}},a.createElement($t.A,{primary:t.text})))))),a.createElement(_t.A,{sx:t?{width:"100%"}:{width:"calc(100% - 212px)",marginLeft:"180px",p:2},component:"main"},a.createElement("div",{id:"detail"},a.createElement(p.sv,null))))},yc=()=>a.createElement(p.sv,null);var xc=n(22535);const fc=[{text:"Info & Permissions",path:"info"},{text:"User List",path:"user"},{text:"Role",path:"role"}],bc=()=>{const e=(0,p.zy)(),t=(0,p.Ew)("orgs");return a.createElement(Ct.A,{spacing:1,justifyContent:"space-between",direction:"column",sx:{backgroundColor:"#E5E5E5",height:"100%"}},a.createElement(Ct.A,{sx:{height:"42px",padding:"5px 20px",backgroundColor:"#FFFFFF"},spacing:0},a.createElement(vn.A,{variant:"h6",sx:{lineHeight:1}},t.name),a.createElement(xc.A,{separator:">","aria-label":"breadcrumb"},a.createElement(m.N_,{underline:"hover",color:"inherit",to:"/sys-admin/organization"},"System Admin"),a.createElement(m.N_,{underline:"hover",color:"inherit",to:"/sys-admin/organization"},"All Organizations"),a.createElement(vn.A,null,t.name))),a.createElement(_t.A,{sx:{padding:"0 8px",height:"calc(100vh - 140px)"}},a.createElement(It.Ay,{sx:{".MuiDrawer-paper":{position:"absolute",top:"auto",left:"auto",zIndex:"auto",width:"180px",height:"calc(100% - 68px)"},a:{color:"inherit"}},variant:"permanent",anchor:"left"},a.createElement(Tt.A,null,fc.map(t=>a.createElement(Bt.A,{selected:e.pathname.includes(t.path),key:t.text},a.createElement(m.N_,{className:"sidebar-tabs",to:t.path,style:{width:"100%"}},a.createElement($t.A,{primary:t.text})))))),a.createElement(_t.A,{sx:{width:"calc(100% - 220px)",marginLeft:"188px",p:2,backgroundColor:"#FFFFFF",height:"calc(100% - 40px)"},component:"main"},a.createElement(p.sv,null))))},vc=async e=>Ye(Qe.ORGANIZATION.permissionTemplate,e),Ac=(e,t)=>{const n=[...e];for(;n.length>0;){const e=n.shift();if(e.codename===t)return e;e.children&&n.push(...e.children)}return[]},wc=({template:e,selected:t,type:n,onNodeSelect:i,disabled:l=!1,hasSecondLevel:r=!0})=>{const[o,s]=(0,a.useState)([]),c=(e,t=[])=>(t.push(e.codename),e.children&&e.children.forEach(e=>c(e,t)),t),d=t=>c(Ac(e,t));(0,a.useEffect)(()=>{const t=e.map(e=>e.children?c(e):e.codename).flat()||[];s(t)},[e]);const m=(e,n)=>{const a=d(e.codename),i=a.indexOf(e.codename);return a.splice(i,1),0!==a.length&&a.every(e=>t.concat(n).includes(e))},p=(t,n=[])=>{const a=Ac(e,t);return a.parent?(n.push(a.parent),p(a.parent,n)):n},u=(e,n)=>{const a=d(e.codename),i=a.indexOf(e.codename);a.splice(i,1);const l=a.filter(e=>t.concat(n).includes(e));return 0!==l.length&&l.length!==a.length},g=e=>{e.stopPropagation()},h=n=>a.createElement(er.y,{key:n.name,itemId:n.codename,onClick:g,label:a.createElement(a.Fragment,null,a.createElement(ya.A,{checked:t.includes(n.codename),indeterminate:u(n,[]),tabIndex:-1,disableRipple:!0,disabled:l,size:"small",sx:{padding:0},onClick:a=>((n,a)=>{n.stopPropagation();const l=d(a),r=p(a);if(t.includes(a)){const e=t.filter(e=>!l.concat(r).includes(e));i(e)}else{const n=l;for(let t=0;th(e)):null);return a.createElement(_t.A,{sx:{m:"10px 0",flexGrow:1,width:"menu"===n?"30%":"10%",height:"100%",position:"relative",minHeight:"536px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",fontWeight:700,lineHeight:"32px"}},("menu"===n?"Function":"Data")+" Permission"),0!==o.length&&a.createElement(E.A,{theme:I},a.createElement(Kl.G,{defaultExpandedItems:o,disableSelection:l,slots:r?{expandIcon:Qn.A,collapseIcon:tr.A}:null},e.map(e=>h(e)))))};wc.propTypes={template:O().instanceOf(Array).isRequired,selected:O().instanceOf(Array).isRequired,type:O().string.isRequired,onNodeSelect:O().func.isRequired,disabled:O().bool,hasSecondLevel:O().bool};const Cc=wc,Sc=(e,t)=>{const n=[...e];for(;n.length>0;){const e=n.shift();if(e.codename===t)return e;e.children&&n.push(...e.children)}return[]},kc=({template:e,selected:t,label:n,onNodeSelect:i,disabled:l=!1})=>{const[r,o]=(0,a.useState)(""),s=e.map(e=>{if(e?.children){const{children:t,...n}=e;return[{...n},...t]}return e}).flat(),c=s.map(e=>e.codename),d=(e,t=[])=>(t.push(e.codename),e.children&&e.children.forEach(e=>d(e,t)),t),m=t=>d(Sc(e,t)),p=(e,n)=>{const a=m(e.codename),i=a.indexOf(e.codename);return a.splice(i,1),0!==a.length&&a.every(e=>t.concat(n).includes(e))},u=(t,n=[])=>{const a=Sc(e,t);return a.parent?(n.push(a.parent),u(a.parent,n)):n},y=s.filter(e=>{const t=e.name.toLocaleLowerCase(),n=r.toLocaleLowerCase();return t.includes(n)}).map(e=>e.codename)||[],x=y.map(e=>u(e)).flat()||[],f=[...y,...x],b=(e,n)=>{const a=m(e.codename),i=a.indexOf(e.codename);a.splice(i,1);const l=a.filter(e=>t.concat(n).includes(e));return 0!==l.length&&l.length!==a.length},v=e=>{e.stopPropagation()},A=n=>a.createElement(er.y,{key:n.name,itemId:n.codename,onClick:v,label:a.createElement(a.Fragment,null,a.createElement(ya.A,{checked:t.includes(n.codename)||p(n,[]),indeterminate:b(n,[]),tabIndex:-1,disableRipple:!0,disabled:l,size:"small",sx:{padding:0},onClick:a=>((n,a)=>{n.stopPropagation();const l=m(a),r=u(a);if(t.includes(a)){const e=t.filter(e=>!l.concat(r).includes(e));i(e)}else{const n=l;for(let t=0;tf.includes(e.codename)?A(e):null):null);return a.createElement(_t.A,{sx:{m:"10px 0",flexGrow:1,width:"100%",maxHeight:"300px",height:"30%",position:"relative"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",fontWeight:700}},`${n}`)),a.createElement(Fn,{label:`${n}-search`,placeholder:"Search Name",onChange:e=>o(e.target.value),startAdornment:a.createElement(g.A,{position:"start"},a.createElement(Cn.A,null)),endAdornment:a.createElement(g.A,{position:"end"},a.createElement(h.A,{onClick:()=>o(""),sx:{visibility:0===r.length?"hidden":"visible"}},a.createElement(Sn.A,{fontSize:"small"}))),value:r,style:{width:200}})),a.createElement(Ct.A,{sx:{maxHeight:"calc(100% - 32px)",overflowY:"scroll",marginRight:"8px"}},0!==c.length&&a.createElement(E.A,{theme:I},a.createElement(Kl.G,{defaultExpandedItems:c,disableSelection:l,slots:{expandIcon:Qn.A,collapseIcon:tr.A}},e.map(e=>f.includes(e.codename)?A(e):null)))))};kc.propTypes={template:O().instanceOf(Array).isRequired,selected:O().instanceOf(Array).isRequired,label:O().string.isRequired,onNodeSelect:O().func.isRequired,disabled:O().bool};const _c=kc;var zc=n(71163);const Rc=({template:e,selected:t,label:n,onNodeSelect:i,disabled:l=!1})=>{const[r,o]=(0,a.useState)(""),s=e.map(e=>{if(e?.children){const{children:t,...n}=e;return[n,...t]}return e}),c=s.map(e=>e.codename),d=s.filter(e=>{const t=e.name.toLocaleLowerCase(),n=r.toLocaleLowerCase();return t.includes(n)}).map(e=>e.codename)||[],m=e.filter(e=>d.includes(e.codename))||[],p=()=>{t.length===s.length?i([]):i(c)};return a.createElement(_t.A,{sx:{m:"10px 0",flexGrow:1,width:"100%",maxHeight:"300px",height:"30%",position:"relative"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px",fontWeight:700}},`${n}`),a.createElement(Fn,{label:`${n}-search`,placeholder:"Search Name",onChange:e=>o(e.target.value),startAdornment:a.createElement(g.A,{position:"start"},a.createElement(Cn.A,null)),endAdornment:a.createElement(g.A,{position:"end"},a.createElement(h.A,{onClick:()=>o(""),sx:{visibility:0===r.length?"hidden":"visible"}},a.createElement(Sn.A,{fontSize:"small"}))),value:r,style:{width:200}})),a.createElement(Ct.A,{sx:{height:"calc(100% - 32px)",maxHeight:"270px",overflowY:"scroll"}},a.createElement(E.A,{theme:I},a.createElement(zc.aY,{style:{height:"100%"},data:m,components:{Header:()=>a.createElement(sn.Ay,{disablePadding:!0},a.createElement(Bt.A,{role:void 0,onClick:l?M():p,dense:!0,sx:{"&:hover":{backgroundColor:l?"transparent":"rgba(0, 0, 0, 0.04)"}}},a.createElement(cn.A,{sx:{minWidth:"12px"}},a.createElement(ya.A,{edge:"start",checked:t.length===s.length,indeterminate:t.length!==s.length&&0!==t.length,tabIndex:-1,disableRipple:!0,size:"small",disabled:l,color:l?"disabled":"primary",sx:{padding:0}})),a.createElement($t.A,{id:"select-all",primary:"Select All",sx:{margin:0,span:{fontSize:"16px",lineHeight:1}}})))},totalCount:m.length,itemContent:(e,n)=>{return a.createElement(sn.Ay,{key:n.codename,disablePadding:!0},a.createElement(Bt.A,{role:void 0,onClick:l?M():(r=n.codename,()=>{t.includes(r)?i(t.filter(e=>e!==r)):i([...t,r])}),dense:!0,sx:{"&:hover":{backgroundColor:l?"transparent":"rgba(0, 0, 0, 0.04)"}}},a.createElement(cn.A,{sx:{minWidth:"12px"}},a.createElement(ya.A,{edge:"start",checked:t.includes(n.codename),tabIndex:-1,disableRipple:!0,disabled:l,color:l?"disabled":"primary",size:"small",sx:{padding:0}})),a.createElement($t.A,{id:n.codename,primary:`${n.name}`,sx:{margin:0,span:{fontSize:"16px",lineHeight:1}}})));var r}}))))};Rc.propTypes={template:O().instanceOf(Array).isRequired,selected:O().instanceOf(Array).isRequired,label:O().string.isRequired,onNodeSelect:O().func.isRequired,disabled:O().bool};const Dc=Rc,Oc=()=>{const{orgid:e}=(0,p.g)(),t=(0,p.vL)(),n=(0,p.Ew)("orgs"),[i,l]=(0,a.useState)({}),[r,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)("Alvanon"),[d,m]=(0,a.useState)(""),[u,g]=(0,a.useState)(""),[h,E]=(0,a.useState)({}),[y,x]=(0,a.useState)([]),[f,b]=(0,a.useState)([]),[v,A]=(0,a.useState)([]),[w,C]=(0,a.useState)([]),[S,k]=(0,a.useState)([]);return(0,a.useEffect)(()=>{vc({get_all_template:!0}).then(e=>{l(e||{})})},[e]),(0,a.useEffect)(()=>{m(n.name),c(n.type),g(n.description),x(n?.permissions?.data||[]),b(n?.permissions?.menu||[]),C(n?.permissions?.data_standard||[]),k(n?.permissions?.data_sizeset||[]),A(n?.permissions?.data_myalva||[])},[n]),(0,a.useEffect)(()=>{E(i?.[s]||{})},[i,s]),a.createElement(Ct.A,{direction:"column",spacing:2,alignItems:"end",sx:{height:"100%"}},a.createElement(Ct.A,{direction:"row",spacing:2,justifyContent:"space-between",sx:{width:"100%",height:"calc(100% - 40px)",overflowY:"auto"}},a.createElement(Ct.A,{direction:"column",spacing:2,sx:{border:"1px solid #E5E5E5",borderRadius:"20px",p:"10px",width:"330px",height:"calc(100% - 25px)",minHeight:"536px"}},a.createElement("div",{style:{width:"300px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Organization Name*"),a.createElement(si,{label:"",value:d,onChange:e=>m(e.target.value),width:300,disabled:!r})),a.createElement(pi,{field:"Organization Type*",value:s,options:["Alvanon","Brand"],onChange:(e,t)=>c(t),disabled:!0,style:{width:"330px"}}),a.createElement("div",null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Description"),a.createElement(si,{label:"description",value:u,multiline:!0,rows:10,width:300,disabled:!r,onChange:e=>g(e.target.value),style:{minHeight:"200px"}}))),a.createElement(Ct.A,{direction:"row",spacing:2,sx:{border:"1px solid #E5E5E5",borderRadius:"20px",p:"10px",width:"calc(100% - 300px)",height:"calc(100% - 25px)",minHeight:"536px"}},a.createElement(Cc,{template:h?.menu||[],selected:f||[],type:"menu",disabled:!r,onNodeSelect:e=>{b(e)}}),a.createElement(Cc,{template:h?.data||[],selected:y||[],type:"data",disabled:!r,onNodeSelect:e=>{x(e)},hasSecondLevel:!1}),a.createElement(Ct.A,{direction:"column",spacing:1,sx:{height:"100%",width:"45%"}},y.includes("myalva_data")&&a.createElement(_c,{template:h.data_myalva||[],selected:v,label:"MyAlva",disabled:!r,onNodeSelect:e=>A(e)}),y.includes("standard_data")&&a.createElement(Dc,{template:h.data_standard||[],selected:w,label:"Standard",disabled:!r,onNodeSelect:e=>C(e)}),y.includes("size_set_data")&&a.createElement(Dc,{template:h.data_sizeset||[],selected:S,label:"Sizeset",disabled:!r,onNodeSelect:e=>k(e)})))),r?a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>{m(n.name),c(n.type),g(n.description),x(n?.permissions?.data||[]),b(n?.permissions?.menu||[]),C(n?.permissions?.data_standard||[]),k(n?.permissions?.data_sizeset||[]),A(n?.permissions?.data_myalva||[]),o(!1)}}),a.createElement(ra,{color:"primary",text:"Save",onClick:()=>{const n={name:d,type:s,description:u,permissions:{menu:f,data:y,data_myalva:y.includes("myalva_data")?v:[],data_standard:y.includes("standard_data")?w:[],data_sizeset:y.includes("size_set_data")?S:[]}};(async(e,t)=>Je(`${Qe.ORGANIZATION.organizations}/${e}/`,t))(e,n).then(e=>{e&&(t.revalidate(),o(!1))})}})):a.createElement(ra,{color:"primary",text:"Edit",onClick:()=>o(!0)}))},Fc=()=>{const{orgid:e}=(0,p.g)(),t=(0,p.Ew)("orgs"),[n,i]=(0,a.useState)(!1),[l,r]=(0,a.useState)(!1),[o,s]=(0,a.useState)(!0),[c,d]=(0,a.useState)([]),[m,u]=(0,a.useState)([]),[g,h]=(0,a.useState)({}),E=()=>{da({page:1,page_size:500,organization_id:e}).then(e=>{d(e?.results||[]),0===e?.count&&r(!0)}),Ea({organization_id:e}).then(e=>u(e?.results||[]))};return(0,a.useEffect)(()=>{E()},[]),a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column",height:"100%"}},a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New User",color:"primary",onClick:()=>{i(!0),s(!0)},style:{width:"150px",marginBottom:"8px"}}),a.createElement(tc,{userList:c,onUserEdit:e=>{i(!0),s(!1),h(e)},onUserDel:e=>{ua(e.id,{is_active:!e.is_active}).then(e=>(e&&(E(),i(!1)),null))},isEditing:n,onUserPasswordChange:(e,t)=>ha({id:e,password:t}).then(e=>e),isListEmpty:l,isOrgMgmt:!0}),n&&a.createElement(lc,{isAddNew:o,open:n,userOnEdit:g,onUserChangesSubmit:t=>{o?ma({...t,organization_id:e}).then(e=>(e&&(E(),i(!1),s(!1)),null)):pa(t.id,t).then(e=>(e&&(E(),i(!1),h({})),null))},onCancelEdit:()=>{i(!1),s(!1),h({})},groupList:m,organization:t.name}))};var Mc=n(88007);const jc=e=>e?.children?[e.codename,...e.children.flatMap(e=>jc(e))]:e.codename,Ic=({open:e,onClose:t,group:n=qe,isEditing:i=!1,orgId:l})=>{const[r,o]=(0,a.useState)({}),[s,c]=(0,a.useState)(""),[d,m]=(0,a.useState)(""),[p,u]=(0,a.useState)([]),[g,h]=(0,a.useState)([]),[E,y]=(0,a.useState)([]),[x,f]=(0,a.useState)([]),[b,v]=(0,a.useState)([]);(0,a.useEffect)(()=>{vc(0!==l?{organization_id:l}:{}).then(e=>{o(e?.data||{})}),n?.id?(async e=>Ye(`${Qe.ADMIN.groups}/${e}`))(n.id).then(e=>{u(e?.permissions?.data||[]),h(e?.permissions?.menu||[]),f(e?.permissions?.data_standard||[]),v(e?.permissions?.data_sizeset||[]),y(e?.permissions?.data_myalva||[]),c(e?.name||""),m(e?.description||"")}):(h(r?.menu?r.menu.flatMap(e=>jc(e)):[]),u(r?.data?r.data.flatMap(e=>jc(e)):[]),f(r?.data_standard?r.data_standard.flatMap(e=>jc(e)):[]),v(r?.data_sizeset?r.data_sizeset.flatMap(e=>jc(e)):[]),y(r?.data_myalva?r.data_myalva.flatMap(e=>jc(e)):[]),c(""),m(""))},[]);const A=()=>{t("cancel")};return a.createElement(qa.A,{open:e,maxWidth:"xl",fullWidth:!0},a.createElement(La.A,null,n?.id?"Role Details":"Add New Role"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(Ct.A,{direction:"column",spacing:2,sx:{border:"1px solid #E5E5E5",borderRadius:"20px",p:"10px",width:"330px"}},a.createElement("div",{style:{width:"300px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Role Name*"),a.createElement(si,{label:"",value:s,disabled:!i,onChange:e=>c(e.target.value),width:300})),a.createElement("div",null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Description"),a.createElement(si,{label:"description",value:d,multiline:!0,disabled:!i,rows:10,width:300,onChange:e=>m(e.target.value),style:{minHeight:"200px"}}))),a.createElement(Ct.A,{direction:"row",spacing:2,sx:{border:"1px solid #E5E5E5",borderRadius:"20px",p:"10px",width:"calc(100% - 300px)"}},a.createElement(Cc,{template:r?.menu||[],selected:g||[],type:"menu",disabled:!i,onNodeSelect:e=>{h(e)}}),a.createElement(Cc,{template:r?.data||[],selected:p||[],type:"data",disabled:!i,onNodeSelect:e=>{u(e)},hasSecondLevel:!1}),a.createElement(Ct.A,{direction:"column",spacing:1,sx:{height:"100%",width:"45%"}},p.includes("myalva_data")&&a.createElement(_c,{template:r.data_myalva||[],selected:E,label:"MyAlva",disabled:!i,onNodeSelect:e=>y(e)}),p.includes("standard_data")&&a.createElement(Dc,{template:r.data_standard||[],selected:x,label:"Standard",disabled:!i,onNodeSelect:e=>f(e)}),p.includes("size_set_data")&&a.createElement(Dc,{template:r.data_sizeset||[],selected:b,label:"Sizeset",disabled:!i,onNodeSelect:e=>v(e)}))))),a.createElement(Va.A,null,i?a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:A}),a.createElement(ra,{color:"primary",text:"Save",onClick:()=>{const e={name:s,description:d,permissions:{menu:g,data:p,data_myalva:p.includes("myalva_data")?E:[],data_standard:p.includes("standard_data")?x:[],data_sizeset:p.includes("size_set_data")?b:[]}};t("save",e)}})):a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(ra,{variant:"outlined",color:"default",text:"Close",onClick:A}))))};Ic.propTypes={open:O().bool.isRequired,onClose:O().func.isRequired,group:O().instanceOf(Object),isEditing:O().bool,orgId:O().number.isRequired};const Tc=Ic,Bc=()=>{const{orgid:e}=(0,p.g)(),[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)({}),[r,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)(!1),d=()=>{Ea(e?{organization_id:e}:{}).then(e=>n(e?.results||[]))};(0,a.useEffect)(()=>{d()},[]);const m=[{field:"name",headerName:"Role",display:"flex",flex:1},{field:"description",headerName:"Description",display:"flex",flex:3},{field:"actions",type:"actions",headerName:"Actions",display:"flex",width:100,cellClassName:"actions",headerAlign:"left",align:"left",sortable:!1,disableColumnMenu:!0,getActions:({id:e,row:t})=>"Admin"===t.name?[a.createElement(ei.A,{title:"View detail",key:"view"},a.createElement(h.A,{size:"small",onClick:()=>l(t)},a.createElement(Mc.A,{fontSize:"small"})))]:[a.createElement(ei.A,{title:"View detail",key:"view"},a.createElement(h.A,{size:"small",onClick:()=>l(t)},a.createElement(Mc.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Edit",key:"edit"},a.createElement(h.A,{size:"small",onClick:()=>(e=>{l(e),c(!0)})(t)},a.createElement(Pi.A,{fontSize:"small"})))]}];return a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column"}},a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New Role",color:"primary",onClick:()=>o(!0),style:{width:"150px",marginBottom:"8px"}}),a.createElement(Ci.z,{autoHeight:!0,columns:m,rows:t,getRowHeight:()=>"auto",slots:{noRowsOverlay:Ri},sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"8px"},".MuiDataGrid-cell:focus-within":{outline:"none"}}}),(0!==Object.keys(i).length||r)&&a.createElement(Tc,{open:0!==Object.keys(i).length||r,onClose:(t,n)=>{"save"===t?r?(e&&(n.organization_id=e),(async e=>Ze(`${Qe.ADMIN.groups}/`,e))(n).then(e=>{e&&(o(!1),c(!1),d())})):(async(e,t)=>Je(`${Qe.ADMIN.groups}/${e}/`,t))(i.id,n).then(e=>{e&&(l({}),c(!1),d())}):(l({}),o(!1),c(!1))},group:i,isEditing:s||r,orgId:e||0}))},$c=e=>e?.children?[e.codename,...e.children.flatMap(e=>$c(e))]:e.codename,Nc=({open:e,onClose:t})=>{const[n,i]=(0,a.useState)({}),[l,r]=(0,a.useState)("Alvanon"),[o,s]=(0,a.useState)(""),[c,d]=(0,a.useState)(""),[m,p]=(0,a.useState)({}),[u,g]=(0,a.useState)([]),[h,E]=(0,a.useState)([]),[y,x]=(0,a.useState)([]),[f,b]=(0,a.useState)([]),[v,A]=(0,a.useState)([]);return(0,a.useEffect)(()=>{vc({get_all_template:!0}).then(e=>{i(e||{})})},[]),(0,a.useEffect)(()=>{const e=n?.[l]||{};p(e),E(e?.menu?e.menu.flatMap(e=>$c(e)):[]),g(e?.data?e.data.flatMap(e=>$c(e)):[]),b(e?.data_standard?e.data_standard.flatMap(e=>$c(e)):[]),A(e?.data_sizeset&&"Alvanon"===l?e.data_sizeset.flatMap(e=>$c(e)):[]),x(e?.data_myalva&&"Alvanon"===l?e.data_myalva.flatMap(e=>$c(e)):[])},[n,l]),a.createElement(qa.A,{open:e,maxWidth:"xl",fullWidth:!0},a.createElement(La.A,null,"Add New Organization"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(Ct.A,{direction:"column",spacing:2,sx:{border:"1px solid #E5E5E5",borderRadius:"20px",p:"10px",width:"330px"}},a.createElement("div",{style:{width:"300px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Organization Name*"),a.createElement(si,{label:"",value:o,onChange:e=>s(e.target.value),width:300})),a.createElement(pi,{field:"Organization Type*",value:l,options:["Alvanon","Brand"],onChange:(e,t)=>r(t),style:{width:"330px"}}),a.createElement("div",null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Description"),a.createElement(si,{label:"description",value:c,multiline:!0,rows:10,width:300,onChange:e=>d(e.target.value),style:{minHeight:"200px"}}))),a.createElement(Ct.A,{direction:"row",spacing:2,sx:{border:"1px solid #E5E5E5",borderRadius:"20px",p:"10px",width:"calc(100% - 300px)"}},a.createElement(Cc,{template:m.menu||[],selected:h,type:"menu",onNodeSelect:e=>{E(e)}}),a.createElement(Cc,{template:m.data||[],selected:u,type:"data",onNodeSelect:e=>{g(e)},hasSecondLevel:!1}),a.createElement(Ct.A,{direction:"column",spacing:1,sx:{height:"100%",width:"45%",overFlowY:"scroll"}},u.includes("myalva_data")&&a.createElement(_c,{template:m.data_myalva||[],selected:y,label:"MyAlva",onNodeSelect:e=>x(e)}),u.includes("standard_data")&&a.createElement(Dc,{template:m.data_standard||[],selected:f,label:"Standard",onNodeSelect:e=>b(e)}),u.includes("size_set_data")&&a.createElement(Dc,{template:m.data_sizeset||[],selected:v,label:"Sizeset",onNodeSelect:e=>A(e)}))))),a.createElement(Va.A,null,a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>{t("cancel"),r("Alvanon"),s("")}}),a.createElement(ra,{color:"primary",text:"Save",onClick:()=>{const e={name:o,type:l,description:c,permissions:{menu:h,data:u,data_myalva:u.includes("myalva_data")?y:[],data_standard:u.includes("standard_data")?f:[],data_sizeset:u.includes("size_set_data")?v:[]}};t("save",e)}})))};Nc.propTypes={open:O().bool.isRequired,onClose:O().func.isRequired};const qc=Nc,Lc=()=>{const[e,t]=(0,a.useState)([]),[n,i]=(0,a.useState)(!1),l=(0,p.Zp)(),r=()=>{(async()=>Ye(Qe.ORGANIZATION.organizations,{page:1,page_size:500}))().then(e=>t(e?.results||[]))};(0,a.useEffect)(()=>{r()},[]);const o=[{field:"name",headerName:"Organization",display:"flex",flex:3},{field:"type",headerName:"Type",display:"flex",flex:1},{field:"is_active",headerName:"Status",display:"flex",flex:1,valueFormatter:e=>e?"Active":"Inactive"},{field:"actions",type:"actions",headerName:"Actions",display:"flex",width:100,cellClassName:"actions",headerAlign:"left",align:"center",sortable:!1,disableColumnMenu:!0,getActions:({id:e,row:t})=>[a.createElement(ei.A,{title:"Edit",key:"edit"},a.createElement(h.A,{size:"small",onClick:()=>l(`./${t.id}/user`,{replace:!0})},a.createElement(Pi.A,{fontSize:"small"})))]}];return a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column"}},a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New Organization",color:"primary",onClick:()=>{i(!0)},style:{width:"201px",marginBottom:"8px"}}),a.createElement(Ci.z,{autoHeight:!0,columns:o,rows:e,getRowHeight:()=>"auto",slots:{noRowsOverlay:Ri},sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"8px"},".MuiDataGrid-cell:focus-within":{outline:"none"}}}),n&&a.createElement(qc,{open:n,onClose:(e,t)=>{"save"===e?(async e=>Ze(`${Qe.ORGANIZATION.organizations}/`,e))(t).then(e=>{e&&(r(),i())}):i(!1)}}))};Jn().extend(na()),Jn().extend(ea());const Pc=["email","first_name","last_name","password"],Wc=()=>{const e=(0,l.useSelector)(C),t=(0,l.useDispatch)(),n=(0,p.Zp)(),[i,r]=(0,a.useState)({}),[o,s]=(0,a.useState)(!1),[c,d]=(0,a.useState)([]),[m,u]=(0,a.useState)(""),g=Jn().tz.guess();(0,a.useEffect)(()=>{(async()=>Ye(Qe.ADMIN.getTimezoneOptions))().then(e=>{if(e?.data){const t=e.data.map(e=>({key:e.key,value:e.label}));d(t)}})},[]),(0,a.useEffect)(()=>{(async e=>Ye(`${Qe.ADMIN.userList}/${e}`))(e.id).then(e=>{r(e),u(e?.timezone||"")})},[e]);const h=()=>{s(!1)};return(0,a.useEffect)(()=>{m!==i.timezone&&0!==m.length&&pa(e.id,{timezone:m}).then(n=>{n&&t(A({...e,timezone:m}))})},[m]),a.createElement(_t.A,{sx:{padding:8}},a.createElement(vn.A,{variant:"h5"},"My Profile"),a.createElement(Ct.A,{spacing:2,mt:2,mb:2,direction:"row",useFlexGap:!0,flexWrap:"wrap"},Pc.map(e=>a.createElement("div",{key:e,style:{width:"email"===e?"100%":"calc(50% - 16px)",position:"relative"}},a.createElement(aa.A,{style:{display:"block",minWidth:"120px",boxSizing:"border-box",marginBottom:"5px"}},`${Fe(e)}*`),a.createElement(si,{label:Fe(e),value:"password"===e?"123456":i?.[e]||"",inputProps:"password"===e?{type:"password"}:{},disabled:!0,style:{width:"email"===e?"calc(100% - 50px)":"330px"}}))),a.createElement(ra,{variant:"outlined",color:"default",text:"Change Password",onClick:()=>s(!0),style:{alignSelf:"end",marginBottom:"6px"}})),0!==c.length&&a.createElement(pi,{style:{minWidth:360},field:"Timezone",onChange:(e,t)=>u(t.key),value:c.find(e=>e.key===m)||c.find(e=>e.key===g),options:c}),o&&a.createElement(Qs,{open:o,onClose:h,onSubmit:a=>{const i={id:e.id,password:a};ha(i).then(e=>{e&&(h(),et().then(e=>{e&&t(w())}).then(()=>{n("/login",{replace:!0})}))})}}))};var Vc=n(2225);const Hc=({config:e})=>{const[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1),r=t.find(e=>"Total"===e?.name),o=t.filter(e=>"Total"!==e?.name);return(0,a.useEffect)(()=>{l(!0),(async e=>Ze(Qe.MYALVA.overviewData,{key:"ethnicity",common_config:e}))(e).then(e=>{e?.data&&(n(e.data),l(!1))})},[e]),a.createElement(or.A,{sx:{p:"16px 32px",height:"120px",position:"relative",boxShadow:"-2px -1px 9px rgba(13, 10, 44, 0.08)"}},a.createElement(bi,{isLoading:i,isSingleChart:!0}),a.createElement(vn.A,{variant:"h6",sx:{color:"#383838"}},"Ethnicity"),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",mt:1},a.createElement("div",{style:{width:`calc(1000px / ${0!==t.length?t.length:1})`}},a.createElement(vn.A,{variant:"caption",sx:{color:"#4e5969",fontSize:"14px"}},r?.name||""),a.createElement(vn.A,{variant:"h5"},ze(r?.count||0)||"")),o.map(e=>a.createElement("div",{style:{width:`calc(1000px / ${0!==t.length?t.length:1})`},key:`ethnicity-${e?.name||""}`},a.createElement(vn.A,{variant:"caption",sx:{color:"#4e5969",fontSize:"14px"}},e?.name||""),a.createElement(vn.A,{variant:"h5"},ze(e?.count||"")),a.createElement(vn.A,{variant:"caption",sx:{color:"#4e5969"}},e?.percent?`${e.percent}%`:"")))))};Hc.propTypes={config:O().instanceOf(Object).isRequired};const Gc=Hc,Uc=(0,Br.A)(Qr),Yc=({config:e})=>{const[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{l(!0),(async e=>Ze(Qe.MYALVA.overviewData,{key:"gender_age",common_config:e}))(e).then(e=>{e?.data&&(n(e.data),l(!1))})},[e]),a.createElement(or.A,{sx:{p:"16px 32px",minHeight:"300px",position:"relative",boxShadow:"-2px -1px 9px rgba(13, 10, 44, 0.08)"}},a.createElement(bi,{isLoading:i,isSingleChart:!0}),a.createElement(vn.A,{variant:"h6",sx:{color:"#383838"}},"Gender & Age"),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},t?.pie&&a.createElement(Uc,(0,kn.A)({},JSON.parse(t.pie),{config:{displayModeBar:!1}})),t?.bar&&a.createElement(Uc,(0,kn.A)({},JSON.parse(t.bar),{config:{displayModeBar:!1,scrollZoom:!1}}))))};Yc.propTypes={config:O().instanceOf(Object).isRequired};const Zc=Yc,Jc=(0,Br.A)(Qr),Xc=({config:e})=>{const[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1),[r,o]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{l(!0),(async e=>Ze(Qe.MYALVA.overviewData,{key:"locations",common_config:e}))(e).then(e=>{e?.data&&(n(e.data),l(!1))})},[e]),a.createElement(or.A,{sx:{p:"16px 32px",minHeight:"300px",position:"relative",boxShadow:"-2px -1px 9px rgba(13, 10, 44, 0.08)"}},a.createElement(bi,{isLoading:i,isSingleChart:!0}),a.createElement(vn.A,{variant:"h6",sx:{color:"#383838"}},"Locations"),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},t?.country_map&&a.createElement(Jc,(0,kn.A)({},JSON.parse(t.country_map),{config:{modeBarButtonsToRemove:["select2d","lasso2d","toImage"],displaylogo:!1}})),a.createElement(Ct.A,{direction:"column",spacing:1,alignSelf:"center"},t?.bar&&a.createElement(Jc,(0,kn.A)({},JSON.parse(t.bar),{config:{displayModeBar:!1}})),t?.count&&0!==t.count.length&&a.createElement(E.A,{theme:I},a.createElement(y.A,{onClick:()=>o(e=>!e),color:"primary"},"View All")))),a.createElement(qa.A,{onClose:()=>o(!1),open:r,maxWidth:"xs",fullWidth:!0},a.createElement(La.A,null,"Locations"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"column",spacing:1},t?.count&&0!==t.count.length&&t.count.map(e=>a.createElement(Ct.A,{key:e?.code||"",direction:"row",alignItems:"end",justifyContent:"space-between",sx:{width:"100%"}},a.createElement(Ct.A,{direction:"row",sx:{width:"40%"},spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"body1",sx:{fontWeight:700}},e?.name||"")),a.createElement(vn.A,{variant:"body1",sx:{color:"#4e5969",width:"20%",textAlign:"right"}},ze(e?.count||0)),a.createElement(vn.A,{variant:"body1",sx:{width:"20%",textAlign:"right"}},`${e?.percent}%`||""))))),a.createElement(Va.A,null,a.createElement(ra,{text:"OK",color:"primary",onClick:()=>o(!1)}))))};Xc.propTypes={config:O().instanceOf(Object).isRequired};const Qc=Xc,Kc=(0,Br.A)(Qr),ed=({pomList:e,config:t,type:n,chartConfig:i})=>{const[l,r]=(0,a.useState)("bust_or_chest_circumference"),[o,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{d(!0),(async(e,t,n)=>Ze(Qe.MYALVA.overviewData,{key:"dc",common_config:e,config:t,type:n}))(t,{...i,pom:l},n).then(e=>{e?.data&&(s(e.data),d(!1))})},[t,i,n,l]),a.createElement(Ct.A,{direction:"column",spacing:1,sx:{minHeight:"300px",position:"relative"}},a.createElement(bi,{isLoading:c,isSingleChart:!0}),a.createElement(vn.A,{variant:"h6",sx:{color:"#383838",fontSize:"17px"}},"Body Data Distribution"),a.createElement(Ct.A,{direction:"row",spacing:1},0!==e.length&&e.map(e=>a.createElement(z.A,{size:"small",key:`pom-${e.value}`,label:e.value,onClick:()=>r(e.key),sx:{backgroundColor:e.key===l?"rgba(255, 141, 26, 0.4)":"rgba(229, 229, 229, 0.42)",color:e.key===l?"#000000":"#808080",borderRadius:"8px"}}))),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},o?.dc&&a.createElement(Kc,(0,kn.A)({},JSON.parse(o.dc),{config:{modeBarButtonsToRemove:["toImage"],displaylogo:!1}})),o?.stats&&a.createElement(Ct.A,{direction:"column",spacing:1,mt:4,sx:{minWidth:260}},a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between"},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"50%",display:"inline-block"}}," "),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"20%",display:"inline-block",textAlign:"right"}},"Avg."),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"20%",display:"inline-block",textAlign:"right"}},"Mode")),o.stats.map(t=>a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between",key:`stats-${t.pom}`},a.createElement(z.A,{size:"small",label:e.find(e=>e.key===t.pom)?e.find(e=>e.key===t.pom).value:Fe(t.pom),sx:{backgroundColor:"rgba(229, 229, 229, 0.42)",color:"#000000",width:"50%",fontSize:"14px",borderRadius:"8px"}}),a.createElement(vn.A,{variant:"body2",sx:{width:"20%",display:"inline-block",textAlign:"right"}},t?.mean?t.mean.toFixed(2):"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"20%",display:"inline-block",textAlign:"right"}},t?.mode?t.mode.toFixed(2):"N/A"))))))};ed.propTypes={config:O().instanceOf(Object).isRequired,chartConfig:O().instanceOf(Object).isRequired,type:O().string.isRequired,pomList:O().instanceOf(Array).isRequired};const td=ed;var nd=n(52783),ad=n(51510),id=n(10404),ld=n(60539);const rd=[{key:"name",label:"Avatar Name",type:"text"},{key:"obj_type",label:"Data Source",type:"select"},{key:"obj_population_uuid",label:"Analysis Object",type:"conditional-select"},{key:"obj",label:"Calculate",type:"conditional-select",showInReadOnly:!0,options:["avg","mode"]},{key:"ethnicity",label:"Ethnicity",type:"select",showInReadOnly:!0,options:["Asian","White","Black","Hispanic"]},{key:"gender",label:"Gender",type:"select",showInReadOnly:!0,options:["Male","Female"]}],od=[{key:"across_shoulder_distance",label:"Across Shoulder"},{key:"bust_or_chest_circumference",label:"Bust/Chest"},{key:"below_bust_or_chest_circumference",label:"Under Bust/Pecs",isFemaleOnly:!0},{key:"waist_circumference",label:"Waist"},{key:"low_hip_circumference",label:"Low Hip"},{key:"inseam",label:"Inseam"},{key:"thigh_circumference",label:"Thigh"},{key:"calf_circumference",label:"Calf"},{key:"bicep_circumference",label:"Bicep"},{key:"height",label:"Height"}],sd=[{key:"0",value:"Front View"},{key:"-0.25",value:"Front Left Tilt (45°)"},{key:"-0.5",value:"Side View"},{key:"-0.75",value:"Front Left Tilt (135°)"},{key:"1",value:"Back View"}],cd=async e=>Ye(Qe.THREE_D_AVATAR.project,e),dd=async e=>Ze(Qe.THREE_D_AVATAR.project,e),md=async(e,t)=>Je(`${Qe.THREE_D_AVATAR.project}/${e}/`,t),pd=async e=>Ye(`${Qe.THREE_D_AVATAR.avatar}/${e}/`),ud=async e=>Ze(Qe.THREE_D_AVATAR.avatarSingleComparison,e),gd=(0,a.forwardRef)(({id:e,item:t,disabled:n=!0,withOpacity:i=!1,isDragging:l,style:r=qe,index:o=0,onClone:s=M(),onDelete:c=M(),cloningDisabled:d=!0,...m},p)=>{const u={opacity:i?"0.5":"1",padding:"16px 0",border:"1px solid #DBDBDB",background:"#FDFDFD",width:"199px",minWidth:"199px",height:"30px",display:"flex",flexDirection:"column",textAlign:"center",color:"#8c8c8c",cursor:n&&!l?"poniter":"move",transform:l?"scale(1.05)":"scale(1)",...r};return a.createElement("div",(0,kn.A)({ref:p,style:u},m),a.createElement(Ct.A,{direction:"row",alignItems:"center",spacing:.5},a.createElement("div",{style:{display:"inline-block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"180px",fontWeight:700,lineHeight:"24px",color:"#5F504D"},title:t.name},t.name),!n&&a.createElement(a.Fragment,null,!d&&a.createElement(h.A,{sx:{color:"#5F504D",padding:0},size:"small",onClick:()=>s(o)},a.createElement(yo.A,{fontSize:"small"})),a.createElement(h.A,{sx:{color:"#FB4E3B",padding:0},size:"small",onClick:()=>c(o)},a.createElement(Ra.A,{fontSize:"small"})))))});gd.propTypes={id:O().string.isRequired,withOpacity:O().bool,isDragging:O().bool.isRequired,item:O().instanceOf(Object).isRequired,disabled:O().bool,cloningDisabled:O().bool,index:O().number,onClone:O().func,onDelete:O().func,style:O().instanceOf(Object)};const hd=gd,Ed=({item:e,disabled:t,id:n,index:i,onClone:l,onDelete:r,cloningDisabled:o})=>{const{isDragging:s,attributes:c,listeners:d,setNodeRef:m,transform:p,transition:u}=(0,Bl.gl)({id:n}),g={transform:Pl.Ks.Transform.toString(p),transition:u||void 0};return a.createElement(hd,(0,kn.A)({ref:m,style:g,id:n,withOpacity:s,item:e,index:i,onClone:l,onDelete:r,disabled:t,isDragging:s,cloningDisabled:o},c,d))},yd=({list:e,disabled:t,onClone:n,onDelete:i,onOrderChange:l,onAddClicked:r})=>{const[o,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(null),[m,p]=(0,a.useState)({}),u=(0,Tl.FR)((0,Tl.MS)(Tl.cA,{activationConstraint:{distance:5}}),(0,Tl.MS)(Tl.IG),(0,Tl.MS)(Tl.AN,{activationConstraint:{distance:5}}));return(0,a.useEffect)(()=>{s(e)},[e]),a.createElement(Tl.Mp,{sensors:u,collisionDetection:Tl.fp,onDragEnd:e=>{const{active:t,over:n}=e;if(t.id!==n.id){const e=o.map(e=>e.id),a=e.indexOf(t.id),i=e.indexOf(n.id),r=(0,Bl.be)(o,a,i);s(r),l(r)}},onDragStart:e=>{d(e.active.id),p(o.find(t=>t.id===e.active.id))},onDragCancel:()=>{d(null),p({})}},a.createElement(Bl.gB,{items:o,strategy:Bl.kL,disabled:t},a.createElement(Ct.A,{direction:"row",mt:.5,sx:{width:"100%"}},a.createElement("div",{style:{width:"200px",height:"62px",borderRadius:"0",border:"1px solid #DBDBDB"}}," "),a.createElement(Ct.A,{direction:"row",sx:{width:"calc(100% - 200px)",overflowX:"auto"}},o.map((e,l)=>a.createElement(Ed,{key:e.id,id:e.id,index:l,onClone:n,onDelete:i,item:e,disabled:t,cloningDisabled:o.length>19})),!t&&o.length<20&&a.createElement(E.A,{theme:I},a.createElement(y.A,{size:"small",onClick:r,color:"primary",sx:{width:"200px",minWidth:"200px",height:"64px",borderRadius:"0",border:"1px solid #DBDBDB",padding:"16px",alignItems:"center",justifyContent:"center"}},"+ ADD"))))),a.createElement(Tl.Hd,{adjustScale:!0,style:{transformOrigin:"0 0 "}},c?a.createElement(hd,{item:m,id:c,isDragging:!0}):null))};yd.propTypes={onOrderChange:O().func.isRequired,list:O().instanceOf(Array).isRequired,disabled:O().bool.isRequired,onClone:O().func.isRequired,onDelete:O().func.isRequired,onAddClicked:O().func.isRequired};const xd=yd,fd=({onValueChange:e,inputValue:t})=>{const[n,i]=(0,a.useState)("");return(0,a.useEffect)(()=>{i(t)},[t]),a.createElement(li.A,{value:n,onChange:e=>{var t;(e=>/^(?!.*\..*\.)[0-9]*(\.[0-9]{0,2})?$/.test(e))(t=e.target.value)&&i(t)},onBlur:()=>{e(n)},sx:{padding:"0 !important",minHeight:"31px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},".MuiOutlinedInput-input":{padding:"4px 14px"}}})};fd.propTypes={onValueChange:O().func.isRequired,inputValue:O().oneOfType([O().string,O().number]).isRequired};const bd=fd,vd={cm:1,inch:2.54},Ad=({readOnly:e=!1,existingID:t="",populations:n=Le,sizesets:i=Le,standards:l=Le,avatars:r,unit:o,onSave:s=M(),selectedPomVal:c=qe,onPomValSelect:d=M(),errMsg:m=qe,onErrorMsgClear:p=M(),isValidatingAvatars:u=!1})=>{const[g,y]=(0,a.useState)(-1),[x,f]=(0,a.useState)(!1),[b,v]=(0,a.useState)([]),[A,w]=(0,a.useState)({}),[C,S]=(0,a.useState)(void 0),[k,_]=(0,a.useState)(!1),[z,R]=(0,a.useState)(!1),[D,O]=(0,a.useState)(!1),[F,j]=(0,a.useState)({insights_3d_obj_type:["Custom"]});(0,a.useEffect)(()=>{0!==r.length?v(r):0!==r.length||z||u||v([{id:"new-placeholder"}])},[r]),(0,a.useEffect)(()=>{0!==t.length&&0!==[...n,...i,...l].length?(async e=>Ye(Qe.THREE_D_AVATAR.options,{analysis:e}))(t).then(e=>{e?.data&&j(e.data)}):j({insights_3d_obj_type:["Custom"]})},[t,n,l,i]),(0,a.useEffect)(()=>{x&&!z&&Object.values(m).every(e=>0===e.length)&&f(!1)},[m]),(0,a.useEffect)(()=>{0!==Object.keys(c).length&&(b.length<20?(w({obj_type:"Custom"}),(async e=>Ze(Qe.THREE_D_AVATAR.nearestPom,e))({analysis:t,poms:c}).then(e=>{e?.data&&S(e.data)})):(O(!0),d(!1),R(!1)))},[c]),(0,a.useEffect)(()=>{if(void 0!==C&&0!==Object.keys(A).length){let e;e=z?b.findIndex(e=>Object.keys(e).length<4):b.findIndex(e=>e.id===A.id);const t={...A,...C,id:`point-${b.length}-${Date.parse(new Date)}`},n=b.toSpliced(-1===e?b.length:e,1,t);v(n),_(!1),S(void 0),w({})}},[C,A]);const T=(e,n)=>{_(!0);return(async e=>Ze(Qe.THREE_D_AVATAR.pomStats,e))({analysis:t,uuid:e,obj:n}).then(e=>{S(e?.data||{})})},B=(e,t)=>"obj_population_uuid"===t?"Population"===e.obj_type?n.find(n=>n?.uuid===e[t])?.label||"/":"Standard"===e.obj_type?l.find(n=>n?.uuid===e[t])?.label||"/":"Sizeset"===e.obj_type&&i.find(n=>n?.uuid===e[t])?.label||"/":e?.[t]?Fe(e[t]):"/",$=(e,t,n)=>{const a=((e,t,n)=>{const{obj_type:a,obj_population_uuid:i,obj:l}=e;return"obj_type"===t?"Custom"===n?{...e,[t]:n,obj:void 0,obj_population_uuid:void 0}:{name:e?.name||"",[t]:n}:a&&"obj_population_uuid"===t&&l?"Population"===a?(T(n,l),w({...e,obj_population_uuid:n}),{}):{name:e?.name||"",[t]:n,obj_type:a}:a&&i&&"obj"===t?(T(i,n),w({...e,obj:n}),{}):{...e,[t]:n}})(b.at(n),e,t);if(0!==Object.keys(a).length){const e=b.toSpliced(n,1,a);v(e),_(!1)}};return a.createElement(Ct.A,{direction:"column",spacing:1,alignItems:e?"center":"start",sx:{width:"100%"}},!e&&a.createElement(Ct.A,{direction:"column",sx:{width:"100%"}},a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(vn.A,{variant:"h6"},"Avatars"),x?a.createElement(a.Fragment,null,a.createElement(ra,{color:"primary",disabled:0===b.length||b.length>20,text:"Save",onClick:()=>{s(b),d(!1),R(!1)}}),a.createElement(ra,{color:"default",variant:"outlined",text:"Cancel",onClick:()=>{f(!1),v(0===r.length?[{id:"new-placeholder"}]:r),d(!1),p(),R(!1)}})):a.createElement(ra,{color:"primary",text:"Edit",onClick:()=>f(!0)})),x&&a.createElement(a.Fragment,null,a.createElement(vn.A,{variant:"caption",sx:{color:"#808080",mt:"8px"}},"Drag the avatar title to reorder the results. Add up to 20 avatars."),a.createElement(vn.A,{variant:"caption",sx:{color:"#808080"}},'Click "Start Selection", then click any population point on the scatter plot to generate a 3D model.',a.createElement(E.A,{theme:I},a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:"Start Selection"},a.createElement(h.A,{size:"small",color:z?"primary":"default","aria-label":"toggle pom auto-filling",disabled:b.length>19||0===n.length&&0===l.length,onClick:()=>{d(!z),R(e=>!e)},onMouseDown:e=>{e.preventDefault()},onMouseUp:e=>{e.preventDefault()}},a.createElement(ad.A,{fontSize:"small"}))))),a.createElement(xd,{list:b,disabled:!x,onClone:e=>{const t=b.at(e),n=b.findIndex(e=>Object.keys(e).length<2),a={...t,name:"",id:`${t?.id||""}-clone-${b.length}-${Date.parse(new Date)}`};v(e=>e.toSpliced(-1===n?e.length:n,1,a))},onDelete:e=>{v(t=>t.toSpliced(e,1))},onOrderChange:e=>v(e),onAddClicked:()=>v(e=>[...e,{id:`new-${Date.parse(new Date)}`}])}))),a.createElement(Ct.A,{direction:"row",sx:{width:"100%"}},a.createElement(Ct.A,{direction:"column"},!e&&a.createElement(a.Fragment,null,a.createElement(Ct.A,{direction:"row",alignItems:"end"},a.createElement(Rt.A,null,a.createElement(nd.A,{fontSize:"small"})),a.createElement(vn.A,{variant:"subtitle2"},"Basic Info")),a.createElement(Ct.A,{direction:"column",sx:{width:"200px",borderTop:"1px solid #00000042",borderBottom:"1px solid #00000042",borderLeft:"1px solid #00000042"}},rd.map(e=>a.createElement(li.A,{key:`row-header-${e.key}`,value:`${e.label}*`,disabled:!0,onChange:M(),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},"&.Mui-disabled":{color:"#5F504D"},".MuiOutlinedInput-input":{padding:"4px 14px","&.Mui-disabled":{WebkitTextFillColor:"#5F504D"}}}}))),a.createElement(Ct.A,{direction:"row",alignItems:"end"},a.createElement(Rt.A,null,a.createElement(id.A,{fontSize:"small"})),a.createElement(vn.A,{variant:"subtitle2"},"Body Measurements"))),e&&a.createElement("div",{style:{height:"24px"}}," "),a.createElement(Ct.A,{direction:"column",sx:{width:"200px",borderTop:"1px solid #00000042",borderBottom:"1px solid #00000042",borderLeft:"1px solid #00000042"}},e&&a.createElement(a.Fragment,null,a.createElement("div",{key:"row-header-name",style:{border:"1px solid #00000042",height:"50px"}},a.createElement("span",{style:{verticalAlign:"sub",marginLeft:"10px"}}," ")),rd.map(e=>e?.showInReadOnly?a.createElement(li.A,{key:`row-header-${e.key}`,value:`${e.label}`,disabled:!0,onChange:M(),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},"&.Mui-disabled":{color:"#5F504D"},".MuiOutlinedInput-input":{padding:"4px 14px","&.Mui-disabled":{WebkitTextFillColor:"#5F504D"}}}}):null)),od.map(t=>a.createElement(li.A,{key:`row-header-${t.key}`,value:`${t.label}${e?"":"*"}`,disabled:!0,onChange:M(),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},"&.Mui-disabled":{color:"#5F504D"},".MuiOutlinedInput-input":{padding:"4px 14px","&.Mui-disabled":{WebkitTextFillColor:"#5F504D"}}}})))),a.createElement(Ct.A,{direction:"row",sx:{width:"calc(100% - 200px)",overflowX:"auto"}},b.map((t,r)=>a.createElement(Ct.A,{direction:"column",key:`avatar-col-${t?.id}`},!e&&a.createElement(a.Fragment,null,m?.[t?.id]&&0!==m[t?.id].length?a.createElement(Ct.A,{direction:"row",justifyContent:"center"},a.createElement(E.A,{theme:I},a.createElement(ei.A,{open:g===r,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:m[t.id]||"error"},a.createElement(h.A,{size:"small",color:"error","aria-label":`err-msg-${r}`,onClick:()=>y(e=>e===r?-1:r),p:0,sx:{width:"24px",height:"24px"}},a.createElement(ld.A,{fontSize:"small"}))))):a.createElement("div",{style:{height:"24px"}}," "),a.createElement(Ct.A,{direction:"column",sx:{width:"200px",borderTop:"1px solid #00000042",borderBottom:"1px solid #00000042",borderRight:r===b.length-1?"1px solid #00000042":"none"}},rd.map(e=>x?a.createElement("div",{key:`avatar-${t?.id||r}-${e.key}`,style:{height:"31px"}},"text"===e.type&&a.createElement(li.A,{value:t?.[e.key]||"",onChange:t=>$(e.key,t.target.value,r),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},".MuiOutlinedInput-input":{padding:"4px 14px"}}}),"select"===e.type&&("obj_type"===e.key||"Standard"!==t.obj_type&&"Sizeset"!==t.obj_type)&&a.createElement(Rn.A,{size:"small",sx:{minWidth:200,maxWidth:200}},a.createElement(ii.A,{value:t?.[e.key]||"",onChange:t=>$(e.key,t.target.value,r),input:a.createElement(li.A,{label:"",sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},".MuiOutlinedInput-input":{padding:"4px 14px"}}})},("obj_type"===e.key?F?.insights_3d_obj_type||[]:e.options).map(i=>a.createElement(jt.A,{key:i,value:i,disabled:"obj_type"!==e.key&&"Custom"!==t.obj_type&&0!==n.find(e=>e.uuid===t?.obj_population_uuid)?.[e.key].length&&!n.find(e=>e.uuid===t?.obj_population_uuid)?.[e.key]?.includes(i)},i)))),"conditional-select"===e.type&&"Custom"!==t.obj_type&&a.createElement(Rn.A,{size:"small",sx:{minWidth:200,maxWidth:200}},a.createElement(ii.A,{value:t?.[e.key]||"",onChange:t=>$(e.key,t.target.value,r),input:a.createElement(li.A,{label:"",sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},".MuiOutlinedInput-input":{padding:"4px 14px"}}})},((e,t,a)=>{if("obj_population_uuid"===e){if("Population"===t)return n;if("Standard"===t)return l;if("Sizeset"===t)return i}if("obj"===e){if("Population"===t)return["avg","mode"];if("Standard"===t){const e=l.find(e=>e.uuid===a)||{},t=e?.statistics||[];return 0!==t.length?t.map(e=>e.obj):[]}if("Sizeset"===t){const e=i.find(e=>e.uuid===a)||{},t=e?.statistics||[];return 0!==t.length?t.map(e=>({uuid:e.obj,label:`${e.obj} (${e.size})`,bodyType:e?.body_type||""})):[]}}return[]})(e.key,t?.obj_type,t?.obj_population_uuid).map(e=>a.createElement(jt.A,{key:e?.uuid||e,value:e?.uuid||e},e?.label||Fe(e))))),("select"===e.type&&"obj_type"!==e.key&&("Standard"===t.obj_type||"Sizeset"===t.obj_type)||"conditional-select"===e.type&&"Custom"===t.obj_type)&&a.createElement(li.A,{value:"/",disabled:!0,onChange:M(),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},"&.Mui-disabled":{color:"#5F504D"},".MuiOutlinedInput-input":{padding:"4px 14px","&.Mui-disabled":{WebkitTextFillColor:"#5F504D"}}}})):a.createElement(li.A,{key:`avatar-${t?.id||r}-${e.key}`,value:B(t,e.key),disabled:!0,onChange:M(),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},"&.Mui-disabled":{color:"#5F504D"},".MuiOutlinedInput-input":{padding:"4px 14px","&.Mui-disabled":{WebkitTextFillColor:"#5F504D",textAlign:"center"}}}})))),e&&a.createElement(a.Fragment,null,"failed"===t?.task?.status?a.createElement(Ct.A,{direction:"row",justifyContent:"center"},a.createElement(E.A,{theme:I},a.createElement(ei.A,{open:g===r,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:t?.task?.errors||"error"},a.createElement(h.A,{size:"small",color:"error","aria-label":`err-msg-${r}`,onClick:()=>y(e=>e===r?-1:r),p:0,sx:{width:"24px",height:"24px"}},a.createElement(ld.A,{fontSize:"small"}))))):a.createElement("div",{style:{height:"24px"}}," ")),a.createElement(Ct.A,{direction:"column",sx:{width:"200px",borderTop:"1px solid #00000042",borderBottom:"1px solid #00000042",borderRight:r===b.length-1?"1px solid #00000042":"none",marginTop:e?0:"24px"}},e&&a.createElement(a.Fragment,null,a.createElement("div",{key:`avatar-${t?.id||r}-name`,style:{border:"1px solid #00000042",height:"50px",textAlign:"center",fontWeight:700,lineHeight:"40px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},title:t.name},a.createElement("span",{style:{verticalAlign:"sub",marginLeft:"10px"}},t.name)),rd.map(e=>e?.showInReadOnly?a.createElement(li.A,{key:`avatar-${t?.id||r}-${e.key}`,value:B(t,e.key),disabled:!0,onChange:M(),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},"&.Mui-disabled":{color:"#5F504D"},".MuiOutlinedInput-input":{padding:"4px 14px","&.Mui-disabled":{WebkitTextFillColor:"#5F504D",textAlign:"center"}}}}):null)),od.map(e=>{return x&&"Custom"===t?.obj_type?a.createElement("div",{key:`avatar-${t?.id||r}-pom-${e.key}`,style:{height:"31px"}},e.isFemaleOnly&&"Male"===t?.gender?a.createElement(li.A,{value:"/",disabled:!0,onChange:M(),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},"&.Mui-disabled":{color:"#5F504D"},".MuiOutlinedInput-input":{padding:"4px 14px","&.Mui-disabled":{WebkitTextFillColor:"#5F504D"}}}}):a.createElement(bd,{inputValue:+((t?.[e.key]||0)/vd[o]).toFixed(2)||"",onValueChange:t=>{$(e.key,+t*vd[o],r)}})):a.createElement(li.A,{key:`avatar-${t?.id||r}-pom-${e.key}`,value:(n=t,i=e.key,l=e?.isFemaleOnly||!1,l&&"Male"===n?.gender?"/":+((n?.[i]||0)/vd[o]).toFixed(2)||"/"),disabled:!0,onChange:M(),sx:{padding:"0 !important",minHeight:"30px",borderRadius:"0",color:"#5F504D","&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},"&.Mui-disabled":{color:"#5F504D"},".MuiOutlinedInput-input":{padding:"4px 14px","&.Mui-disabled":{WebkitTextFillColor:"#5F504D",textAlign:"center"}}}});var n,i,l})),a.createElement(bi,{isLoading:k,isSingleChart:!0}))))),a.createElement(qa.A,{onClose:()=>O(!1),open:D,transitionDuration:0},a.createElement(La.A,null,"Warning!"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},"Maximum of 20 avatars reached. No more can be added.")),a.createElement(Va.A,null,a.createElement(ra,{text:"Ok",color:"primary",onClick:()=>O(!1)}))))};Ad.propTypes={readOnly:O().bool,existingID:O().string,populations:O().instanceOf(Array),standards:O().instanceOf(Array),sizesets:O().instanceOf(Array),avatars:O().instanceOf(Array).isRequired,onSave:O().func,unit:O().string.isRequired,onPomValSelect:O().func,selectedPomVal:O().instanceOf(Object),errMsg:O().instanceOf(Object),onErrorMsgClear:O().func,isValidatingAvatars:O().bool};const wd=Ad;var Cd=n(35925),Sd=n(23159),kd=n(74327),_d=n(46821),zd=n(87859),Rd=n(2056),Dd=n(82027),Od=n(24922),Fd=n(61922),Md=n(64092),jd=n(49487),Id=n(21396);const Td=n.p+"4051931a191f8a86b85a.exr",Bd=({obj:e,rotate:t,position:n,shouldRefresh:i,source:l,rotateFactor:r,scale:o,getScale:s,onErrorMsgUpdate:c=M(),isEncrypted:d})=>{const m=(0,a.useRef)(),[p,u]=(0,a.useState)(!0),[g,h]=(0,a.useState)(!0),[E,y]=(0,a.useState)(""),[x,f]=(0,a.useState)(void 0),b=void 0!==x?(e=>{const t=new Od.NRn;t.setFromObject(e);const n=new Od.Pq0;return t.getSize(n),{height:n.y/o,width:n.x/o}})(x):{height:160,width:30};(0,a.useEffect)(()=>{if(0!==E.length){const e=new Md.B,t=new jd.H;e.load(E,e=>{t.load(Td,t=>{t.mapping=Od.wfO;const n=e.scene.children[0].children[0];n.geometry.deleteAttribute("normal"),n.geometry=(0,Fd.ec)(n.geometry),n.geometry.computeVertexNormals(),n.traverse(e=>{e instanceof Od.eaF&&(e.material=new Od._4j({envMap:t,color:"#FFFFFF",roughness:1,metalness:0,envMapIntensity:1}))}),f(n)})})}},[E]),(0,a.useEffect)(()=>{b&&s(b.height,b.width)},[b]),(0,Rd.F)((e,t)=>{m.current.rotation.y+=t*r});const v=({url:e,vbid:t})=>{const n=Id.SHA256(t);(async e=>{const t=await fetch(e);if(t.ok){const e=await t.blob(),n=await e.arrayBuffer();return new Uint8Array(n)}return null})(e).then(e=>{if(e){const t=((e,t)=>{const n=(new TextEncoder).encode("iq10zlgCNm2BlIzvww4Z8CuGH66MIB9edPEVnPvePBl0TAURLaRHT8KhcvoDuXFP".split("").filter((e,t)=>t%2==0).join(""),"utf-8"),a=(new TextEncoder).encode("FqDoTYkPBnbGRO70wS6JMqqeIZdurJx4".split("").filter((e,t)=>t%2==0).join(""),"utf-8"),i=new Uint8Array(4*e.words.length);for(let t=0;t>>24&255,i[4*t+1]=n>>>16&255,i[4*t+2]=n>>>8&255,i[4*t+3]=255&n}const l=((e,t)=>{if(e.length!==t.length)throw new Error("Length mismatch");const n=new Uint8Array(e.length);for(let a=0;a>>24&255,m[4*e+1]=t>>>16&255,m[4*e+2]=t>>>8&255,m[4*e+3]=255&t}const p=new Blob([m]);return URL.createObjectURL(p)})(n,e);y(t)}})},A=(e,t)=>{(async(e,t,n)=>Ye(`${Qe[n].encrytedObj}${0!==e.length?`/${e}`:""}`,t))(e,t,"OVERVIEW"===l?"MYALVA":"THREE_D_AVATAR").then(e=>{if(e?.status){const t=e?.url||"",{vbid:n}=e;v({url:t,vbid:n})}})};return(0,a.useEffect)(()=>{i&&(u(!0),h(!0),m.current.rotation.y=0)},[i]),(0,a.useEffect)(()=>{var t;"COMPARISON"===l?e?.url&&v(e):p&&g&&"OVERVIEW"!==l?(t=e,h(!1),Nn(t,l).then(t=>{"done"===t?.task?.status||"failed"===t?.task?.status?["Standard","Sizeset"].includes(t?.obj_type||t?.config?.obj_type)?A(e,{type:"MYALVA"===l?"myalva_analysis":"3d_model_insights",is_thumbnail:"F"}):(v({url:`${We}api/v1/deliverables/preview/${e}/${Oe({type:"MYALVA"===l?"myalva_analysis":"3d_model_insights",is_thumbnail:"F"})}`,vbid:e}),u(!1),c({[e]:"failed"===t?.task?.status?t?.task?.errors||"error":""})):"pending"!==t?.task?.status&&"processing"!==t?.task?.status||h(!0)})):"OVERVIEW"===l&&d?A("",{avatar_key:e}):"OVERVIEW"===l&&y(`${We}api/v1/myalva/overview_3d_file${Oe({avatar_key:e})}`)},[e,p,g,l]),a.createElement(a.Suspense,{fallback:a.createElement(bi,{isSingleChart:!0,isLoading:!0})},a.createElement("mesh",{ref:m,position:n,rotation:[0,t*Math.PI,0],scale:[o,o,o]},void 0!==x&&a.createElement("primitive",{object:x})))};Bd.propTypes={obj:O().oneOfType([O().string,O().instanceOf(Object)]).isRequired,rotateFactor:O().number.isRequired,rotate:O().number.isRequired,position:O().instanceOf(Array).isRequired,shouldRefresh:O().bool.isRequired,source:O().string.isRequired,scale:O().number.isRequired,getScale:O().func.isRequired,onErrorMsgUpdate:O().func,isEncrypted:O().bool.isRequired};const $d=Bd,Nd=({obj:e,rotateFactor:t,offsetFactor:n,rotate:i,shouldRefresh:l=!1,source:r,canvasHeight:o=600,canvasWidth:s,onErrorMsgUpdate:c=M()})=>{const d=(0,a.useRef)(),[m,p]=(0,a.useState)(1),[u,g]=(0,a.useState)(5);(0,Rd.F)((e,t)=>{d.current.position.x+=t*n*100});const h=(e,t)=>{const n=t,a=o/(e+120);am&&0!==t&&p(n)};return a.createElement("group",{ref:d,position:[0,50,100],dispose:null},e.map((e,n)=>a.createElement(a.Fragment,{key:`obj-${e?.id||n}`},a.createElement($d,{rotateFactor:t,rotate:i,obj:"COMPARISON"===r?e?.model_3d:e?.id||e?.vbid,position:[(100*n+m)*u*1.1-s/2,-100*u,-500],shouldRefresh:l,source:r,getScale:h,scale:u,onErrorMsgUpdate:c,isEncrypted:"OVERVIEW"===r&&["Standard","Sizeset"].includes(e?.obj_type)||!1}),a.createElement(Dd.E,{fontSize:14,maxWidth:100,anchorY:"-120",position:[(100*n+m)*u*1.1-s/2,-120*u,0],color:"black"},e?.name||e?.label||e?.size||"Avatar"))))};Nd.propTypes={obj:O().instanceOf(Array).isRequired,rotateFactor:O().number.isRequired,offsetFactor:O().number.isRequired,rotate:O().number.isRequired,shouldRefresh:O().bool,source:O().string.isRequired,canvasHeight:O().number,canvasWidth:O().number.isRequired,onErrorMsgUpdate:O().func};const qd=Nd;var Ld=n(75025);const Pd=({item:e,onItemChecked:t})=>{const{attributes:n,listeners:i,setNodeRef:l,transform:r,transition:o,isDragging:s}=(0,Bl.gl)({id:e.name}),c={transform:Pl.Ks.Transform.toString(r),transition:o,userSelect:"none",padding:4,background:s?"#EEEEEE":"#FFFFFF",display:"flex",alignItems:"center",zIndex:s?999:"auto"};return a.createElement("div",(0,kn.A)({ref:l,style:c},n,i),a.createElement(Rt.A,null,a.createElement(Ld.A,{fontSize:"small",sx:{color:"#9B9B9B"}})),a.createElement(ya.A,{size:"small",checked:e?.is_selected||!1,onPointerDown:e=>e.stopPropagation(),onClick:()=>t(e),sx:{p:0}}),a.createElement("div",{style:{display:"inline-block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",minWidth:"120px",lineHeight:"24px"},title:e.name},e.name))};Pd.propTypes={item:O().instanceOf(Object).isRequired,onItemChecked:O().func.isRequired};const Wd=Pd,Vd=({items:e,anchorEl:t=null,onOrderChange:n})=>{const i=Boolean(t),[l,r]=(0,a.useState)([]),[o,s]=(0,a.useState)(!1),c=(0,Tl.FR)((0,Tl.MS)(Tl.AN),(0,Tl.MS)(Tl.uN,{coordinateGetter:Bl.JR}));(0,a.useEffect)(()=>{r(e)},[e]);const d=e=>{s(!0),r(t=>t.map(t=>t.name===e.name?{...t,is_selected:!t.is_selected}:t))};return a.createElement(E.A,{theme:I},a.createElement(Mt.A,{anchorEl:t,open:i,onClose:()=>{n(o?l:void 0),s(!1)},sx:{".MuiList-root":{padding:0}}},a.createElement(Tl.Mp,{sensors:c,collisionDetection:Tl.fp,onDragEnd:e=>{const{active:t,over:n}=e;n&&t.id!==n.id&&(s(!0),r(e=>{const a=e.findIndex(e=>e.name===t.id),i=e.findIndex(e=>e.name===n.id);return(0,Bl.be)(e,a,i)}))}},a.createElement(Bl.gB,{items:l.map(e=>e.name),strategy:Bl._G},a.createElement("div",{style:{minWidth:210}},l.map(e=>a.createElement(Wd,{key:e.name,item:e,onItemChecked:d})))))))};Vd.propTypes={items:O().instanceOf(Array).isRequired,onOrderChange:O().func.isRequired,anchorEl:O().node};const Hd=Vd,Gd=({obj:e,shouldRefresh:t=!1,source:n,onMoveClicked:i=M(),canvasHeight:l,canvasWidth:r,onErrorMsgUpdate:o=M(),onThreeDSettingsChange:s=M(),avatarSettings:c=Le,viewAngle:d="0"})=>{const[m,p]=(0,a.useState)(0),[u,g]=(0,a.useState)(0),[x,f]=(0,a.useState)("0"),[b,v]=(0,a.useState)(null),[A,w]=(0,a.useState)("demand"),C=e?.filter(e=>"done"===e?.task?.status)?.length===e?.length;(0,a.useEffect)(()=>{f(d)},[d]);const S=e=>{w("always"),"KeyA"===e?p(-1):"KeyD"===e?p(1):"ArrowLeft"===e?g(1):"ArrowRight"===e&&g(-1)},k=e=>{w("demand"),"KeyA"===e||"KeyD"===e?p(0):("ArrowLeft"===e||"ArrowRight"===e)&&g(0)};return a.createElement(Ct.A,{direction:"column",sx:{width:"100%",height:"100%",backgroundColor:"#FFFFFF"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(Yn,{label:"",field:"view",selected:x||"0",options:sd,onChange:e=>f(e)}),a.createElement(dn.A,{orientation:"vertical",variant:"middle",flexItem:!0}),a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:"Rotate Clockwise"},a.createElement(h.A,{size:"small",onMouseDown:()=>S("KeyA"),onMouseUp:()=>k("KeyA"),sx:{transform:"scaleX(-1)"}},a.createElement(Cd.A,{fontSize:"small"}))),a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:"Rotate Counter-clockwise"},a.createElement(h.A,{size:"small",onMouseDown:()=>S("KeyD"),onMouseUp:()=>k("KeyD")},a.createElement(Cd.A,{fontSize:"small"}))),a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:"Scroll Left"},a.createElement(h.A,{size:"small",onMouseDown:()=>S("ArrowLeft"),onMouseUp:()=>k("ArrowLeft")},a.createElement(kd.A,{fontSize:"small"}))),a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:"Scroll Right"},a.createElement(h.A,{size:"small",onMouseDown:()=>S("ArrowRight"),onMouseUp:()=>k("ArrowRight")},a.createElement(Sd.A,{fontSize:"small"}))),0!==c.length&&a.createElement(a.Fragment,null,a.createElement(dn.A,{orientation:"vertical",variant:"middle",flexItem:!0}),a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:"Select avatars to display (up to 20)"},a.createElement(h.A,{size:"small",onClick:e=>{v(e.currentTarget)}},a.createElement(_d.A,{fontSize:"small"})))),a.createElement(Hd,{items:c,anchorEl:b,onOrderChange:e=>{e&&s(e),v(null)}})),a.createElement(Ct.A,{direction:"row",spacing:1},"THREE_D_AVATAR"!==n&&"COMPARISON"!==n&&a.createElement(E.A,{theme:I},a.createElement(ei.A,{disableFocusListener:!0,disableTouchListener:!0,title:C?"Move to 3D Model Insights to customize data and generate new avatars.":"Move blocked: All avatars must be generated first. Uncheck incomplete avatars in Settings, then try Move again."},a.createElement(y.A,{disabled:!C,size:"small",color:"default",onClick:i,startIcon:a.createElement($l.A,{fontSize:"small"})},"Move"))))),a.createElement(zd.Hl,{camera:{position:[0,0,500]},orthographic:!0,onCreated:({camera:e,scene:t,gl:n})=>{t.add(e),n.setClearColor(16777215,1)},gl:{alpha:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1,depth:!0,stencil:!1},frameloop:A,dpr:[1,2],performance:{min:.1,max:1,current:1,debounce:200}},a.createElement(qd,{obj:e,rotateFactor:m,offsetFactor:u,rotate:+x,shouldRefresh:t,source:n,canvasHeight:l,canvasWidth:r,onErrorMsgUpdate:o})))};Gd.propTypes={obj:O().instanceOf(Array).isRequired,avatarSettings:O().instanceOf(Array),shouldRefresh:O().bool,source:O().string.isRequired,onMoveClicked:O().func,canvasHeight:O().number.isRequired,canvasWidth:O().number.isRequired,onErrorMsgUpdate:O().func,onThreeDSettingsChange:O().func,viewAngle:O().string};const Ud=Gd,Yd=({config:e,selectedCollection:t,selectedSizeset:n,type:i,generalConfig:l,onMoveClicked:r,onAvatarSettingsUpdate:o})=>{const[s,c]=(0,a.useState)([]),[d,m]=(0,a.useState)(!0),[p,u]=(0,a.useState)([]),[g,h]=(0,a.useState)(1280),E=9*g/16,[y,x]=(0,a.useState)(!1),f=()=>{const e=document.getElementById("overview-avatar-container");h(e.offsetWidth)};return(0,a.useEffect)(()=>(f(),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}),[]),(0,a.useEffect)(()=>{m(!0),x(!0);const a={standard:t,brand:n?.brand?.id||"",size_set:n?.size_set?.id||"",vbids:n?.vbids?.map(e=>e.vbid)||[]};Ml(e,a,i).then(e=>{if(e?.data){const t=e.data.map(e=>({...e,id:e.avatar_key}));c(t),m(!1),x(!1),u(e?.config?.settings_3d_model||[]),o(e?.config?.settings_3d_model||[])}})},[e,i,t,n]),a.createElement(Ct.A,{id:"overview-avatar-container",direction:"column",sx:{position:"relative",width:"100%",margin:"20px",minHeight:"1080px"}},d?a.createElement(bi,{isLoading:d,isSingleChart:!0}):a.createElement(a.Fragment,null,a.createElement(Ct.A,{sx:{height:E,width:"100%",maxHeight:"600px"}},a.createElement(Ud,{obj:s,avatarSettings:p,source:"OVERVIEW",shouldRefresh:y,onMoveClicked:()=>r(s),canvasHeight:E>600?600:E,canvasWidth:g,onThreeDSettingsChange:a=>{m(!0),x(!0);const l={standard:t,brand:n?.brand?.id||"",size_set:n?.size_set?.id||"",vbids:n?.vbids?.map(e=>e.vbid)||[],settings_3d_model:a};Ml(e,l,i).then(e=>{if(e?.data){const t=e.data.map(e=>({...e,id:e.avatar_key}));c(t),m(!1),x(!1),u(e?.config?.settings_3d_model||[]),o(e?.config?.settings_3d_model||[])}})}})),a.createElement(wd,{readOnly:!0,avatars:0===s.length?[]:s,unit:l?.unit_length||"cm"})))};Yd.propTypes={config:O().instanceOf(Object).isRequired,type:O().string.isRequired,selectedCollection:O().string.isRequired,selectedSizeset:O().instanceOf(Object).isRequired,generalConfig:O().instanceOf(Object).isRequired,onMoveClicked:O().func.isRequired,onAvatarSettingsUpdate:O().func.isRequired};const Zd=Yd,Jd=(0,Br.A)(Qr),Xd=({pomList:e,config:t,type:n,chartConfig:i,standardList:r,selectedCollection:o,setSelectedCollection:s,onMoveClicked:c,selectedSizeset:d,setSelectedSizeset:m,onAvatarSettingsUpdate:p})=>{const u=(0,l.useSelector)(C),g=u?.permissions||[],[h,x]=(0,a.useState)({key:"bust_or_chest_circumference",value:"Bust/Chest"}),[f,b]=(0,a.useState)({key:"waist_circumference",value:"Waist"}),[v,A]=(0,a.useState)([]),[w,S]=(0,a.useState)(!1),k=r.map(e=>({key:e.id,value:e.name})),_=v?.sp?JSON.parse(v.sp):null,[z,R]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{S(!0);const e={...i,pom_x:h.key,pom_y:f.key,standard:o,brand:d?.brand?.id||"",size_set:d?.size_set?.id||"",vbids:d?.vbids?.map(e=>e.vbid)||[]};(async(e,t,n)=>Ze(Qe.MYALVA.overviewData,{key:"sp",common_config:e,config:t,type:n}))(t,e,n).then(e=>{e?.data&&(A(e.data),S(!1))})},[t,i,n,h,f,o,d]),a.createElement(Ct.A,{direction:"column",spacing:1,sx:{minHeight:"400px",position:"relative"}},a.createElement(bi,{isLoading:w,isSingleChart:!0}),a.createElement(vn.A,{variant:"h6",sx:{color:"#383838",fontSize:"17px"}},"Market Coverage"),a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(pi,{field:"X Measurement",value:e.find(e=>e.key===h.key)||"",onChange:(e,t)=>x(t),options:e,width:250}),a.createElement(pi,{field:"Y Measurement",value:e.find(e=>e.key===f.key)||"",onChange:(e,t)=>b(t),options:e,width:250}),g.includes("standard_data")&&a.createElement(pi,{field:"Standard",value:k.find(e=>e.key===o)||"",onChange:(e,t)=>s(t.key),options:k,width:250,showClearIcon:!0,onClear:()=>s("")}),g.includes("size_set_data")&&a.createElement(hr,{value:d,onValueChange:e=>m(e)})),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},_&&a.createElement(Jd,(0,kn.A)({},_,{config:{modeBarButtonsToRemove:["select2d","lasso2d","toImage"],displaylogo:!1,webgl:{preserveDrawingBuffer:!1,alpha:!1,antialias:!1,powerPreference:"high-performance"}}})),v?.stats&&a.createElement(Ct.A,{direction:"column",spacing:2,mt:4,sx:{minWidth:260}},v.stats?.body_scan&&a.createElement(Ct.A,{direction:"column",spacing:1,sx:{minWidth:260}},a.createElement(vn.A,{variant:"subtitle1",sx:{color:"#383838","&:before":{content:'""',backgroundColor:"#5ACAEE",width:"10px",display:"inline-block",height:"10px",borderRadius:"10px",marginRight:"5px"}}},"Customer Body Measurement"),a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between"},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}}," "),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},h.value),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},f.value)),a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between"},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},"Avg."),a.createElement(vn.A,{variant:"body2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},v.stats.body_scan?.mean?.[h.key]?v.stats.body_scan?.mean?.[h.key].toFixed(2):"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},v.stats.body_scan?.mean?.[f.key]?v.stats.body_scan?.mean?.[f.key].toFixed(2):"N/A")),a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between"},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},"Mode"),a.createElement(vn.A,{variant:"body2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},v.stats.body_scan?.mode?.[h.key]?v.stats.body_scan?.mode?.[h.key].toFixed(2):"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},v.stats.body_scan?.mode?.[f.key]?v.stats.body_scan?.mode?.[f.key].toFixed(2):"N/A"))),v.stats?.standard&&0!==v.stats.standard.length&&a.createElement(Ct.A,{direction:"column",spacing:.5,sx:{minWidth:260}},a.createElement(vn.A,{variant:"subtitle1",sx:{color:"#383838","&:before":{content:'""',display:"inline-block",backgroundColor:"#EC7700",width:"8px",height:"8px",transform:"rotate(45deg)",marginRight:"10px",marginBottom:"2px"}}},"Standard"),a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between"},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},"Size"),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},h.value),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},f.value)),v.stats.standard.map(e=>a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between",key:`stats-${e.size}-${e?.[h.key]}-${e?.[f.key]}`},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},e?.size||"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},e?.[h.key]?e[h.key].toFixed(2):"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},e?.[f.key]?e[f.key].toFixed(2):"N/A")))),v.stats?.size_set&&0!==v.stats.size_set.length&&a.createElement(Ct.A,{direction:"column",spacing:.5,sx:{minWidth:260}},a.createElement(vn.A,{variant:"subtitle1",sx:{color:"#383838","&:before":{content:'""',display:"inline-block",backgroundColor:"#4F2C55",width:"8px",height:"8px",transform:"rotate(45deg)",marginRight:"10px",marginBottom:"2px"}}},"Sizeset"),a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between"},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},"Size"),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},h.value),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},f.value)),v.stats.size_set.map(e=>a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between",key:`stats-${e.size}-${e?.[h.key]}-${e?.[f.key]}`},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},e?.size||"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},e?.[h.key]?e[h.key].toFixed(2):"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"30%",display:"inline-block",textAlign:"right"}},e?.[f.key]?e[f.key].toFixed(2):"N/A")))))),g.includes("insights_3d_model")&&a.createElement(E.A,{theme:I},a.createElement(y.A,{onClick:()=>R(e=>!e),color:"primary",sx:{alignSelf:"flex-start"}},"View 3D Models")),z&&a.createElement(Zd,{config:t,selectedCollection:o,selectedSizeset:d,type:n,generalConfig:i,onMoveClicked:c,onAvatarSettingsUpdate:p}))};Xd.propTypes={config:O().instanceOf(Object).isRequired,chartConfig:O().instanceOf(Object).isRequired,type:O().string.isRequired,pomList:O().instanceOf(Array).isRequired,standardList:O().instanceOf(Array).isRequired,selectedCollection:O().string.isRequired,setSelectedCollection:O().func.isRequired,onMoveClicked:O().func.isRequired,selectedSizeset:O().instanceOf(Object).isRequired,setSelectedSizeset:O().func.isRequired,onAvatarSettingsUpdate:O().func.isRequired};const Qd=Xd,Kd={unit_length:"cm",unit_weight:"kg"},em=({config:e,type:t})=>{const n=(0,p.Zp)(),[i,l]=(0,a.useState)(Kd),[r,o]=(0,a.useState)([]),[s,c]=(0,a.useState)(""),[d,m]=(0,a.useState)({}),[u,g]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>Ye(Qe.MYALVA.measurementOptions))().then(e=>{e&&o(e.data||[])})},[]),a.createElement(or.A,{sx:{p:"16px 32px",minHeight:"600px",position:"relative",boxShadow:"-2px -1px 9px rgba(13, 10, 44, 0.08)",width:"calc(100% - 64px)"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(Ct.A,{direction:"row",spacing:2,alignItems:"center"},a.createElement(vn.A,{variant:"h6",sx:{color:"#383838"}},"Body Measurements"),a.createElement(Fl,{label:"Measurement unit",options:["cm","inch"],value:i.unit_length,color:"primary",onChange:e=>l(t=>({...t,unit_length:e}))}),a.createElement(Fl,{label:"Weight unit",options:["kg","lbs"],value:i.unit_weight,color:"primary",onChange:e=>l(t=>({...t,unit_weight:e}))})),a.createElement(E.A,{theme:I},a.createElement(y.A,{onClick:()=>{const a={title:`In-depth Analysis - ${_e(new Date)}`,description:"Created from Overview",unit:i?.unit_length||"cm",unit_weight:i?.unit_weight||"kg",settings_3d_model:u,populations:[{color:"#5ACAEE",label:"MyAlva",type:"MyAlva",my_alva_type:"avatar"===t?"Customer Body Data":"Cloth Fitting Size Data",include_dataset:e?.dataset||[],...e},0!==s.length?{color:"#EC7700",label:"Standard",type:"ABP",collection:s}:[],Object.keys(d).length>1?{color:"#4F2C55",label:"Sizeset",type:"Sizeset",brand:d?.brand?.id||"",size_set:d?.size_set?.id||"",vbids:d?.vbids?.map(e=>e.vbid)||[]}:[]].flat()};In(a,"MYALVA").then(e=>{e?.id&&n(`../analysis/${e.id}`)})},color:"primary"},"In-depth Analysis"))),a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(td,{pomList:r?.pom||[],config:e,chartConfig:i,type:t}),a.createElement(Qd,{pomList:r?.pom||[],config:e,chartConfig:i,type:t,standardList:r?.standard||[],selectedCollection:s,setSelectedCollection:c,onMoveClicked:a=>{const l={title:`In-depth 3D Model Insight - ${_e(new Date)}`,description:"Created from Overview",unit:i?.unit_length||"cm",unit_weight:i?.unit_weight||"kg",source:"overview",avatars:a,settings_3d_model:u,populations:[{color:"#5ACAEE",label:"MyAlva",type:"MyAlva",my_alva_type:"avatar"===t?"Customer Body Data":"Cloth Fitting Size Data",include_dataset:e?.dataset||[],...e},0!==s.length?{color:"#EC7700",label:"Standard",type:"ABP",collection:s}:[],Object.keys(d).length>1?{color:"#4F2C55",label:"Sizeset",type:"Sizeset",brand:d?.brand?.id||"",size_set:d?.size_set?.id||"",vbids:d?.vbids?.map(e=>e.vbid)||[]}:[]].flat()};dd(l).then(e=>{e&&n("../3d-model/new")})},selectedSizeset:d,setSelectedSizeset:m,onAvatarSettingsUpdate:e=>g(e)})))};em.propTypes={config:O().instanceOf(Object).isRequired,type:O().string.isRequired};const tm=em,nm=(0,Br.A)(Qr),am=({config:e})=>{const[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1),[r,o]=(0,a.useState)("Male"),s=e?.gender&&1===e.gender.length;return(0,a.useEffect)(()=>{l(!0),(async(e,t)=>Ze(Qe.MYALVA.overviewData,{key:"category_size",common_config:e,config:t}))(e,{gender:s?e?.gender||"":[r]}).then(e=>{e?.data&&(n(e.data),l(!1))})},[e,r]),a.createElement(or.A,{sx:{p:"16px 32px",minHeight:"200px",position:"relative",boxShadow:"-2px -1px 9px rgba(13, 10, 44, 0.08)"}},a.createElement(bi,{isLoading:i,isSingleChart:!0}),a.createElement(Ct.A,{direction:"row",spacing:2,alignItems:"center"},a.createElement(vn.A,{variant:"h6",sx:{color:"#383838"}},"Category"),!s&&a.createElement(Fl,{label:"",options:["Male","Female"],value:r,color:"primary",onChange:e=>o(e)})),a.createElement(Ct.A,{direction:"row",justifyContent:"center"},t?.category_size&&a.createElement(nm,(0,kn.A)({},JSON.parse(t.category_size),{config:{displayModeBar:!1}}))))};am.propTypes={config:O().instanceOf(Object).isRequired};const im=am,lm={borderRadius:"10px 10px 0 0",textTransform:"none"},rm=()=>{const[e,t]=(0,a.useState)(!1),[n,i]=(0,a.useState)({}),[l,r]=(0,a.useState)(!1),[o,s]=(0,a.useState)(!1),c=o?"size_recommend":"avatar",[d,m]=(0,a.useState)(0),p=d-96-16*Object.keys(n).length,u=Object.entries(n).filter(e=>"datetime_gte"!==e[0]&&"datetime_lte"!==e[0]),g=(h=n?.datetime_gte||"",x=n?.datetime_lte||"",0===h.length&&0===x.length?"":0===h.length&&0!==x.length?`Before ${ke(x)}`:0===x.length&&0!==h.length?`After ${ke(h)}`:`${ke(h)} to ${ke(x)}`);var h,x;const f=u.map(e=>[e[0],e[1].join(", ")].join(": ")).join(" ").length+g.length,b=p/f<8.3,v=()=>{const e=document.getElementById("card-container");m(e.offsetWidth)};(0,a.useEffect)(()=>(v(),window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v)}),[]);const A=e=>{i({}),s("size_recommend"===e)};return a.createElement(_t.A,{id:"card-container",sx:{p:4,width:"1130px",justifySelf:"center"}},a.createElement(vn.A,{variant:"h4",sx:{fontWeight:500}},"Overview"),a.createElement(Ct.A,{direction:"row",alignItems:"center",justifyContent:"space-between"},a.createElement(E.A,{theme:I},a.createElement(St.A,{color:"primary",value:c,"aria-label":"basic tabs"},a.createElement(kt.A,{label:"All Body Data",value:"avatar",onClick:()=>A("avatar"),sx:lm}),a.createElement(kt.A,{label:"Size Recommended Body Data",value:"size_recommend",onClick:()=>A("size_recommend"),sx:lm}))),a.createElement(E.A,{theme:I},a.createElement(y.A,{onClick:()=>t(e=>!e),startIcon:a.createElement(Vc.A,{fontSize:"small"}),color:e?"primary":"default"},"Filter"))),a.createElement(Ls,{onClose:e=>{if(t(!1),e){const t=Object.fromEntries(Object.entries(e).filter(e=>0!==e[1].length));i(t)}},filters:n,type:c,showFilterPanel:e}),a.createElement(Ct.A,{direction:l?"column":"row",mt:0===Object.keys(n).length?0:2,useFlexGap:!0,spacing:l?1:2,sx:{display:l?"flex":"grid",width:"100%",height:e?0:"auto",gridTemplateColumns:l?"none":`repeat(${g.length>5?u.length+1:u.length}, ${b?"auto":"max-content"})${b?" 64px":""}`}},g.length>5&&a.createElement("div",{style:{position:"relative",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",minWidth:"100px"}},a.createElement("span",null,"Time: "),a.createElement("span",{title:g,style:{maxWidth:`calc(100% / ${g.length>5?u.length+1:u.length} - 16px)`}},g)),u.map(([e,t])=>0!==t.length&&a.createElement("div",{key:e,style:{position:"relative",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",minWidth:"100px"}},a.createElement("span",null,`${"age_bucket"===e?"Age Range":Fe(e)}: `),a.createElement("span",{title:`${t.join(", ")}`,style:{maxWidth:`calc(100% / ${g.length>5?u.length+1:u.length} - 16px)`}},`${n[e].join(", ")}`))),b&&a.createElement(E.A,{theme:I},a.createElement(y.A,{size:"small",color:"primary",onClick:()=>r(e=>!e),sx:{p:0,width:"64px"}},l?"Collapse":"Expand"))),a.createElement(Ct.A,{direction:"column",spacing:2,mt:2},o?a.createElement(im,{config:n}):a.createElement(a.Fragment,null,a.createElement(Qc,{config:n}),a.createElement(Zc,{config:n}),a.createElement(Gc,{config:n})),a.createElement(tm,{config:n,type:c})))},om=()=>a.createElement(_t.A,{sx:{padding:"20px"}},a.createElement(p.sv,null)),sm={minWidth:"80px",borderRadius:"10px 10px 0 0",backgroundColor:"#FFFFFF",borderBottom:"1px solid #CBCBCB",minHeight:"30px",zIndex:"inherit",p:"0 20px","&.Mui-selected":{backgroundColor:"#FFFFFF",borderBottom:"2px solid #EC7700"},"&:hover":{color:"#EC7700"}},cm=()=>{const e=(0,p.zy)(),t=(0,l.useSelector)(C),n=t?.permissions||[],i=(0,l.useDispatch)(),r=e.pathname.split("/")[2],[o,s]=(0,a.useState)({}),c=(0,l.useSelector)(ie),u=(t=>{for(let n=0;n{c?.id===r?s(c||{}):jn(r,"MYALVA").then(e=>{s(e||{}),i(ae(e))})},[r,c]),a.createElement(_t.A,null,0!==Object.keys(o).length&&a.createElement(kr,{id:r,data:o,source:"MYALVA"}),o?.populations&&0!==o.populations.length&&a.createElement(a.Fragment,null,a.createElement(E.A,{theme:I},a.createElement(St.A,{color:"primary",value:g,"aria-label":"basic tabs",sx:{zIndex:999,minHeight:"30px",marginTop:"16px",".MuiTabs-indicator":{display:"none"}}},a.createElement(kt.A,{label:"Summary",value:"analysis/:id",component:m.N_,to:"./",sx:sm}),a.createElement(kt.A,{label:"Body Data Distribution",value:"analysis/:id/dc",component:m.N_,to:"./dc",sx:sm}),a.createElement(kt.A,{label:"Market Analysis",value:"analysis/:id/mc",component:m.N_,to:"./mc",sx:sm}),n.includes("insights_3d_model")&&a.createElement(kt.A,{label:"3D Models",value:"analysis/:id/avatars",component:m.N_,to:"./avatars",sx:sm}))),a.createElement(_t.A,{sx:{padding:"0 10px 20px",height:"calc(100% - 97px)",minHeight:"500px"}},a.createElement(p.sv,null))))};var dm=n(77722),mm=n(59636),pm=n(37786),um=n(68670),gm=n(29184);const hm=({id:e,onChartDelete:t,title:n,errMsg:i})=>a.createElement(_t.A,{sx:{height:"140px",padding:"20px",margin:"20px 5px 0",width:"calc(100% - 50px)",borderRadius:"10px",backgroundColor:"#FFFFFF",boxShadow:"0px 0px 6px #00000029",display:"flex",flexDirection:"row",alignItems:"center",boxSizing:"content-box",justifyContent:"space-between",color:"#FB4E3B"}},a.createElement(vn.A,{variant:"h6",component:"h6",sx:{width:"15%",color:"inherit"}},n||""),a.createElement(vn.A,{variant:"h6",component:"h6",sx:{width:"50%",color:"inherit"}},`Failed: ${i||""}`),a.createElement(h.A,{sx:{color:"#FB4E3B"},onClick:()=>t(e)},a.createElement(Ra.A,null)));hm.propTypes={id:O().string.isRequired,onChartDelete:O().func.isRequired,title:O().string.isRequired,errMsg:O().string.isRequired};const Em=hm,ym=["Mean","Min","Max"],xm=["Mean","Median","Mode"],fm=({data:e,populations:t,pom:n,chartType:i})=>{const l=(t,a,i)=>{const l=e.find(e=>e.population===t),r=l?.[a.toLowerCase()]?l[a.toLowerCase()]:void 0;return"x"===i?r?.[n[0]]?r[n[0]].toFixed(2):"N/A":"y"===i?r?.[n[1]]?r[n[1]].toFixed(2):"N/A":r?.toFixed(2)||"N/A"};return a.createElement("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",border:"1px solid #ccc",padding:"20px",marginTop:"20px",width:"calc(100% - 40px)"}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"start",alignSelf:"end",width:"40%"}},t.map(e=>a.createElement("div",{key:`legend-${e?.id||e.label}`,style:{display:"flex",alignItems:"baseline",width:"100%"}},a.createElement("div",{style:{width:"20px",height:"10px",backgroundColor:e.color,borderRadius:"3px",display:"inline-block",marginRight:"5px"}}," "),a.createElement("div",{style:{display:"inline-block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"calc(100% - 15px)"},title:e.label},e.label)))),a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"end",width:"60%"}},a.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"space-evenly"}},"sp"===i&&ym.map(e=>a.createElement("div",{key:`statistics-${e}`,style:{width:"30%",textAlign:"center"}},a.createElement(vn.A,{variant:"subtitle2",component:"span"},"Mean"===e?"Avg.":e),a.createElement("div",null,a.createElement(vn.A,{variant:"subtitle2",component:"span",style:{width:"50%",display:"inline-block"}},"X"),a.createElement(vn.A,{variant:"subtitle2",component:"span",style:{width:"50%",display:"inline-block"}},"Y")),t.map(t=>a.createElement("div",{key:`${t?.id||t.label}-static-data`},a.createElement("span",{style:{width:"50%",display:"inline-block"}},l(t?.id||t.label,e,"x")),a.createElement("span",{style:{width:"50%",display:"inline-block"}},l(t?.id||t.label,e,"y")))))),"dc"===i&&xm.map(e=>a.createElement("div",{key:`statistics-${e}`,style:{width:"30%",textAlign:"center"}},a.createElement(vn.A,{variant:"subtitle2",component:"span"},"Mean"===e?"Avg.":e),a.createElement(vn.A,{variant:"subtitle2",component:"span",style:{height:"1.5em",display:"block"}}," "),t.map(t=>a.createElement("div",{key:`${t?.id||t.label}-static-data`,style:{whiteSpace:"nowrap",textOverflow:"ellipsis"}},l(t?.id||t.label,e))))))))};fm.propTypes={data:O().instanceOf(Array).isRequired,populations:O().instanceOf(Array).isRequired,pom:O().instanceOf(Array).isRequired,chartType:O().string.isRequired};const bm=fm,vm=(0,Br.A)(Qr),Am=({id:e,populations:t,onChartDelete:n,onChartEdit:i,shouldChartRevalidate:r,isEditing:o,pomList:s,onFinishUpdate:c,onChartStatsAdd:d,source:p="PROJECT_VIEW"})=>{const[u,g]=(0,a.useState)({}),[E,y]=(0,a.useState)(!0),[x,f]=(0,a.useState)(!0),[b,v]=(0,a.useState)(!1),A=(0,l.useDispatch)(),w=(0,l.useSelector)(pe),C="failed"===u?.task?.status,S=u?.config?.pom?.[0]||"",k=u?.config?.pom?.[1]||"";return(0,a.useEffect)(()=>{r&&(y(!0),f(!0))},[r]),(0,a.useEffect)(()=>{var t;E&&x&&(t=e,f(!1),Nn(t,p).then(e=>{"done"===e?.task?.status||"failed"===e?.task?.status?(g(e||{}),y(!1),d(e?.config?.pom),r&&c()):"pending"!==e?.task?.status&&"processing"!==e?.task?.status||f(!0)}))},[e,E,x]),C?a.createElement(Em,{key:`failed-${e}`,id:e,onChartDelete:n,title:u?.config?.title||"",errMsg:u?.task?.errors||""}):a.createElement(_t.A,{sx:{alignItems:"start",backgroundColor:"#FFFFFF",borderRadius:"10px",boxShadow:o?"0px 0px 3px 3px rgba(236, 119, 0, 0.66)":"0px 0px 6px #00000029",boxSizing:"content-box",display:"flex",flexDirection:"row",justifyContent:"start",margin:"10px 5px 0",padding:"20px",position:"relative",width:"calc(100% - 50px)",minHeight:"152px"},id:u?.config?.pom?u.config.pom.join("-"):""},a.createElement(bi,{isLoading:E,isSingleChart:!0}),a.createElement(Ct.A,{spacing:1,direction:"column",sx:{width:"800px"}},u?.result_data&&a.createElement(Ct.A,{spacing:1,direction:"column",justifyContent:"space-between"},a.createElement(vm,(0,kn.A)({},JSON.parse(u.result_data),{config:{modeBarButtonsToRemove:["select2d","lasso2d"],displaylogo:!1,webgl:{preserveDrawingBuffer:!1,alpha:!1,antialias:!1,powerPreference:"high-performance"}}})),"PROJECT_VIEW"===p&&a.createElement(vn.A,{sx:{color:"#EC7700"}},u?.warning?`*Warning: ${u?.warning}`:"")),t&&u?.statistics&&u?.config?.pom&&a.createElement(bm,{data:u.statistics,populations:t,pom:u?.config?.pom,chartType:"sp"})),a.createElement("div",{style:{width:"calc(100% - 800px)",padding:"0 5px"}},a.createElement(Ct.A,{direction:"row",justifyContent:"flex-end",alignItems:"center"},"PROJECT_VIEW"===p&&a.createElement(h.A,{sx:{color:"#5F504D"},component:m.N_,to:`${We}api/v1/deliverables/preview/${e}/${Oe({type:"SP",is_thumbnail:"F"})}`,download:e,target:"_blank",rel:"noreferrer",onClick:e=>{"normal"===w&&e.preventDefault(),A(me({analysisToDownload:"normal"}))}},a.createElement(gm.A,null)),a.createElement(h.A,{sx:{color:"#5F504D"},onClick:()=>i(u)},a.createElement(zl.A,null)),a.createElement(h.A,{sx:{color:"#FB4E3B"},onClick:()=>v(!0)},a.createElement(Ra.A,null))),u.abp_stats&&0!==u.abp_stats.length&&a.createElement(Ct.A,{direction:"row",spacing:2,useFlexGap:!0,flexWrap:"wrap"},u.abp_stats.map(e=>a.createElement(dm.A,{disableGutters:!0,defaultExpanded:!0,key:`size-chart${e.name}`,sx:{border:"none",boxShadow:"none","&::before":{height:0}}},a.createElement(mm.A,{expandIcon:a.createElement(um.A,null),"aria-controls":"advanced-settings",id:"advanced-settings",sx:{minHeight:"28px",".MuiAccordionSummary-content":{marginBottom:0}}},a.createElement(vn.A,{variant:"subtitle1",sx:{color:"#383838"}},e.name)),a.createElement(pm.A,null,a.createElement(Ct.A,{direction:"column",spacing:1,sx:{minWidth:240}},a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between"},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},"Size"),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"35%",display:"inline-block",textAlign:"right"}},s.find(e=>e.key===S)?.value||Fe(S)),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"35%",display:"inline-block",textAlign:"right"}},s.find(e=>e.key===k)?.value||Fe(k))),e.data.map(e=>a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between",key:`stats-${e.size}-${e?.[S]}-${e?.[k]}`},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},e?.size||"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"35%",display:"inline-block",textAlign:"right"}},e?.[S]?e[S].toFixed(2):"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"35%",display:"inline-block",textAlign:"right"}},e?.[k]?e[k].toFixed(2):"N/A"))))))))),a.createElement(qa.A,{onClose:()=>v(!1),open:b},a.createElement(La.A,null,"Please Confirm"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},`Are you sure that you want to delete chart: ${u?.config?.title||""}?`)),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",color:"default",variant:"outlined",onClick:()=>v(!1)}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{v(!1),n(e,S,k)}}))))};Am.propTypes={id:O().string.isRequired,populations:O().instanceOf(Array).isRequired,onChartDelete:O().func.isRequired,isEditing:O().bool.isRequired,source:O().string,shouldChartRevalidate:O().bool.isRequired,pomList:O().instanceOf(Array).isRequired,onChartStatsAdd:O().func.isRequired,onFinishUpdate:O().func.isRequired,onChartEdit:O().func.isRequired};const wm=Am,Cm=({color:e,opacity:t,onColorChange:n,disabled:i=!1})=>{const[l,r]=(0,a.useState)(null),[o,s]=(0,a.useState)({r:192,g:192,b:192,a:.9});(0,a.useEffect)(()=>{const n=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(e,t,n,a)=>`#${t}${t}${n}${n}${a}${a}`).substring(1).match(/.{2}/g).map(e=>parseInt(e,16)),a={r:n[0],g:n[1],b:n[2],a:t};s({...a,a:t})},[e,t]);const c=Boolean(l),d=c?"simple-popover":void 0;return a.createElement("div",null,a.createElement(y.A,{"aria-describedby":d,variant:"contained",onClick:e=>{r(e.currentTarget)},disabled:i,sx:{backgroundColor:`rgba(${o.r}, ${o.g}, ${o.b}, ${o.a})`,height:"30px",width:"60px",borderRadius:"10px",":hover":{backgroundColor:`rgba(${o.r}, ${o.g}, ${o.b}, ${o.a})`}}}),a.createElement(on.Ay,{id:d,open:c,anchorEl:l,onClose:()=>{r(null);const{r:e,g:t,b:a,a:i}=o;n(`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`,i)},anchorOrigin:{vertical:"bottom",horizontal:"left"},sx:{padding:"10px"}},a.createElement("div",{style:{padding:"0",margin:0}},a.createElement(xl.xk,{color:o,onChange:e=>{const t=e.rgb;s(t)}}))))};Cm.propTypes={color:O().string.isRequired,onColorChange:O().func.isRequired,opacity:O().number.isRequired,disabled:O().bool};const Sm=Cm,km=[1,2,3,4,5,6,7,8,9],_m=({selected:e,onSelectedChange:t,disabled:n=!1})=>a.createElement(E.A,{theme:I},a.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",width:"72px",height:"72px",justifyContent:"space-between",alignContent:"space-between"}},km.map(i=>a.createElement(y.A,{key:`position-${i}`,variant:"contained",onClick:()=>t(i),color:e===i?"primary":"pale",sx:{width:"22px",height:"22px",minWidth:"22px",opacity:n?.8:1,boxShadow:"none",p:"6px 10px"},disabled:n}))));_m.propTypes={selected:O().number.isRequired,onSelectedChange:O().func.isRequired,disabled:O().bool};const zm=_m,Rm=[2,4,6,8,10],Dm=[4,6,8,10,12,14,16],Om=[1,2,3,4,5],Fm=[0,.2,.4,.6,.8,1],Mm=[1,2,4],jm=e=>e.map(e=>({value:e,label:`${e}`})),Im=({label:e,placeholder:t="",onChange:n=M(),endAdornment:i=null,startAdornment:l=null,value:r="",style:o=qe,width:s=500,multiline:c=!1,inputProps:d=qe,onBlur:m=M(),onFocus:p=M(),disabled:u=!1,err:g=!1,rows:h=1,helperText:E="",isNaN:y=!1,...x})=>a.createElement(Rn.A,{variant:"outlined",sx:{marginRight:"10px",width:`${s}px`,...o}},a.createElement(Dn.A,(0,kn.A)({id:`outlined-${e}`,placeholder:t,endAdornment:i,startAdornment:l,"aria-describedby":e,value:r,multiline:c,rows:h,inputProps:{"aria-label":e,...d},sx:{color:"#5F504D",fontSize:"14px",height:"28px",borderRadius:"10px",padding:"2px 15px",backgroundColor:"#F9F9F9",border:"1px solid "+(g||y?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(g||y?"#FB4E3B":"#00000038"),input:{paddingTop:"4px"},"&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},"&.Mui-disabled:before":{borderBottomStyle:"hidden"}},onChange:n,onBlur:m,onFocus:p,disabled:u},x)),(0!==E.length||y)&&a.createElement(ti.A,{error:g||y,sx:{marginLeft:0,marginRight:0,fontSize:"10px"}},y?"Invalid number":E));Im.propTypes={label:O().string.isRequired,placeholder:O().string,onChange:O().func,endAdornment:O().element,startAdornment:O().element,value:O().oneOfType([O().string,O().number]),style:O().instanceOf(Object),width:O().number,multiline:O().bool,inputProps:O().instanceOf(Object),onBlur:O().func,onFocus:O().func,disabled:O().bool,err:O().bool,rows:O().number,helperText:O().string,isNaN:O().bool};const Tm=Im,Bm=["xaxis_title_size","xaxis_tick_size","yaxis_title_size","yaxis_tick_size"],$m=({data:e,onChartUpdate:t,onEditPanelClose:n,unit:i,type:l,source:r,populations:o=Le})=>{const[s,c]=(0,a.useState)({}),[d,m]=(0,a.useState)(""),[p,u]=(0,a.useState)(""),[g,h]=(0,a.useState)(""),[y,x]=(0,a.useState)([]),[f,b]=(0,a.useState)([]),v=[...y,...f],A=0!==Object.keys(s).length,w="dc"===l&&"object"==typeof s?.smoothness&&1===Array.from(new Set(Object.values(s.smoothness))).length?Object.values(s.smoothness)[0]:"",C=e=>{h(e.target.value||""),u(e.target.id)},S=(e,t)=>{if(t){let t=y.filter(t=>t!==e&&t!==`${e}_NaN`);Number.isNaN(+g)||0===`${g}`.length?t=[...t,`${e}_NaN`]:Bm.includes(e)&&+g<1&&(t=[...t,e]),x(t)}c({...s,[e]:g}),u("")},k=(e,t,n,a)=>{c({...s,[e]:n,[t]:a})},_=(e,t)=>{c({...s,[e]:t})},z=(e,n)=>{Ln(e,n,r).then(e=>{e?.id&&t(e.id,e.config.pom)})};(0,a.useEffect)(()=>{0!==d.length&&z(d,s),c(e?.config||{}),m(e?.id||"")},[e]);const R=()=>{let e=[];if("object"==typeof s?.smoothness){const t={...s.smoothness},n=Object.fromEntries(Object.entries(t).map(([t,n])=>Number.isNaN(+n)?(e=[...e,`smoothness_${t}_NaN`],[t,n]):((+n<.5||+n>5)&&(e=[...e,`smoothness_${t}`]),[t,n])));b(e),_("smoothness",n)}else Number.isNaN(+s.smoothness)?e=[...e,"smoothness_NaN"]:+s.smoothness<.5||+s.smoothness>5?e=["smoothness"]:_("smoothness",s.smoothness),x(e)};return a.createElement(It.Ay,{anchor:"right",open:A,variant:"persistent",sx:{zIndex:990,"& .MuiDrawer-paper":{padding:"50px 10px",height:"calc(100vh - 60px)",width:"300px"}}},a.createElement(Ct.A,{spacing:1,direction:"column",sx:{height:"100%"}},a.createElement(vn.A,{variant:"h6",component:"h6",sx:{paddingLeft:"15px"}},"Edit Chart"),a.createElement(Ct.A,{spacing:0,direction:"column",sx:{height:"calc(100% - 40px)",width:"calc(100% - 15px)",paddingLeft:"15px",paddingRight:"8px",overflowY:"auto",mt:1}},a.createElement(vn.A,{variant:"body1",component:"h5"},"Title"),a.createElement(si,{label:"title",value:"outlined-title"===p?g:s?.title||"",onChange:e=>h(e.target.value),onFocus:C,onBlur:()=>S("title"),style:{width:"auto"}}),a.createElement(Ct.A,{spacing:0,direction:"column",alignItems:"start",sx:{width:"calc(100% - 13px)",paddingRight:"4px"}},a.createElement(vn.A,{mt:1},`X-Axis/${i}`),a.createElement("div",{style:{display:"flex"}},a.createElement(Tm,{label:"min-x",value:"outlined-min-x"===p?g:s.min_x,onChange:e=>h(e.target.value),onFocus:C,isNaN:v.includes("min_x_NaN"),onBlur:()=>S("min_x",!0),width:100,style:{margin:0}}),a.createElement("div",{style:{padding:"5px",lineHeight:"18px"}},"-"),a.createElement(Tm,{label:"max-x",value:"outlined-max-x"===p?g:s.max_x,onChange:e=>h(e.target.value),onFocus:C,isNaN:v.includes("max_x_NaN"),onBlur:()=>S("max_x",!0),width:100,style:{margin:0}})),"dc"===l?a.createElement(a.Fragment,null,a.createElement(vn.A,{mt:1},"Y-Axis/%"),a.createElement("div",{style:{display:"flex"}},a.createElement(Tm,{label:"min-y",value:0,disabled:!0,width:100,style:{margin:0}}),a.createElement("div",{style:{padding:"5px",lineHeight:"18px"}},"-"),a.createElement(Tm,{label:"max-y",value:"outlined-max-y"===p?g:s?.max_y,onChange:e=>h(e.target.value),onFocus:C,isNaN:v.includes("max_y_NaN"),onBlur:()=>S("max_y",!0),width:100,style:{margin:0}}))):a.createElement(a.Fragment,null,a.createElement(vn.A,{mt:1},`Y-Axis/${i}`),a.createElement("div",{style:{display:"flex"}},a.createElement(Tm,{label:"min-y",value:"outlined-min-y"===p?g:s.min_y,onChange:e=>h(e.target.value),onFocus:C,onBlur:()=>S("min_y",!0),isNaN:v.includes("min_y_NaN"),width:100,style:{margin:0}}),a.createElement("div",{style:{padding:"5px",lineHeight:"18px"}},"-"),a.createElement(Tm,{label:"max-y",value:"outlined-max-y"===p?g:s.max_y,onChange:e=>h(e.target.value),onFocus:C,isNaN:v.includes("max_y_NaN"),onBlur:()=>S("max_y",!0),width:100,style:{margin:0}}))),a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},`X-Axis Interval/${i}`),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":`X-Axis Interval/${i}`,value:s?.x_interval||2,onChange:(e,t)=>_("x_interval",t),step:2,valueLabelDisplay:"off",marks:jm(Rm),min:2,max:10,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}})),"dc"===l?a.createElement(a.Fragment,null,a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Y-Axis Interval/%"),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":"Y-Axis Interval/%",value:s?.y_interval||1,onChange:(e,t)=>_("y_interval",t),step:null,valueLabelDisplay:"off",marks:jm(Mm),min:1,max:4,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}}))):a.createElement(a.Fragment,null,a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},`Y-Axis Interval/${i}`),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":`Y-Axis Interval/${i}`,value:s?.y_interval||2,onChange:(e,t)=>_("y_interval",t),step:2,valueLabelDisplay:"off",marks:jm(Rm),min:2,max:10,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}}))),void 0!==s?.smoothness&&!s?.show_original&&a.createElement(Ct.A,{direction:"column",sx:{maxWidth:"250px",width:"100%"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px"}},"Smoothness"),a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px"}},"(Min: 0.5; Max: 5)")),"object"==typeof s.smoothness?a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",title:"Apply to all populations",sx:{lineHeight:"32px",maxWidth:"calc(100% - 65px)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},"Apply to all populations"),a.createElement(Tm,{value:w,width:60,size:"small",onChange:e=>_("smoothness",Object.fromEntries(Object.keys(s.smoothness).map(t=>[t,e.target.value]))),onBlur:R,style:{marginRight:0}})),Object.keys(s.smoothness).map(e=>a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",key:`smoothness-${e}`,alignItems:"center"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px",maxWidth:"calc(100% - 65px)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis","&:before":{content:'""',backgroundColor:o.find(t=>t.id===e)?.color,width:"3px",height:"18px",display:"inline-block",position:"relative",top:"2px",marginRight:"3px",borderRadius:"5px"}},title:`${o.find(t=>t.id===e)?.label||""}`},`${o.find(t=>t.id===e)?.label||""}`),a.createElement(Tm,{value:s.smoothness[e],size:"small",err:v.includes(`smoothness_${e}`),isNaN:v.includes(`smoothness_${e}_NaN`),helperText:v.includes(`smoothness_${e}`)?"Out of range":"",onChange:t=>_("smoothness",{...s.smoothness,[e]:t.target.value}),onBlur:R,style:{marginRight:0},width:60})))):a.createElement(Tm,{value:s.smoothness,size:"small",onChange:e=>_("smoothness",e.target.value),onBlur:R,style:{marginRight:0},err:v.includes("smoothness"),isNaN:v.includes("smoothness_NaN"),helperText:v.includes("smoothness")?"Out of range":"",width:60})),"PROJECT_VIEW"===r&&a.createElement(a.Fragment,null,a.createElement(Ct.A,{direction:"column",mt:1,sx:{maxWidth:"250px",width:"100%"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px"}},"Axis Label Font Size "),a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px"}},"(Min: 1)")),a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px",maxWidth:"calc(100% - 65px)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},title:"Horizontal axis"},"Horizontal axis"),a.createElement(Tm,{label:"xaxis_tick_size",value:"outlined-xaxis_tick_size"===p?g:s?.xaxis_tick_size||1,size:"small",onChange:e=>h(e.target.value),onFocus:C,err:v.includes("xaxis_tick_size"),isNaN:v.includes("xaxis_tick_size_NaN"),onBlur:()=>S("xaxis_tick_size",!0),helperText:v.includes("xaxis_tick_size")?"Out of range":"",style:{marginRight:0},width:60})),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px",maxWidth:"calc(100% - 65px)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},title:"Vertical axis"},"Vertical axis"),a.createElement(Tm,{label:"yaxis_tick_size",value:"outlined-yaxis_tick_size"===p?g:s?.yaxis_tick_size||1,size:"small",onChange:e=>h(e.target.value),onFocus:C,err:v.includes("yaxis_tick_size"),isNaN:v.includes("yaxis_tick_size_NaN"),onBlur:()=>S("yaxis_tick_size",!0),helperText:v.includes("yaxis_tick_size")?"Out of range":"",style:{marginRight:0},width:60})))),a.createElement(Ct.A,{direction:"column",mt:1,sx:{maxWidth:"250px",width:"100%"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px"}},"Axis Title Font Size"),a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px"}},"(Min: 1)")),a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px",maxWidth:"calc(100% - 65px)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},title:"Horizontal axis"},"Horizontal axis"),a.createElement(Tm,{label:"xaxis_title_size",value:"outlined-xaxis_title_size"===p?g:s?.xaxis_title_size||1,size:"small",onChange:e=>h(e.target.value),onFocus:C,err:v.includes("xaxis_title_size"),isNaN:v.includes("xaxis_title_size_NaN"),onBlur:()=>S("xaxis_title_size",!0),helperText:v.includes("xaxis_title_size")?"Out of range":"",style:{marginRight:0},width:60})),"sp"===l&&a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},a.createElement(vn.A,{textAlign:"start",variant:"body1",component:"h5",sx:{lineHeight:"32px",maxWidth:"calc(100% - 65px)",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},title:"Vertical axis:"},"Vertical axis:"),a.createElement(Tm,{label:"yaxis_title_size",value:"outlined-yaxis_title_size"===p?g:s?.yaxis_title_size||1,size:"small",onChange:e=>h(e.target.value),onFocus:C,err:v.includes("yaxis_title_size"),isNaN:v.includes("yaxis_title_size_NaN"),onBlur:()=>S("yaxis_title_size",!0),helperText:v.includes("yaxis_title_size")?"Out of range":"",style:{marginRight:0},width:60}))))),s?.show_trend&&a.createElement(a.Fragment,null,a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Show Trendline"),a.createElement(E.A,{theme:I},a.createElement(ya.A,{checked:s?.show_trend||!1,onChange:(e,t)=>_("show_trend",t),inputProps:{"aria-label":"controlled"},color:"primary"}))),a.createElement(vn.A,{textAlign:"start",mt:1,mb:1,variant:"body1",component:"h5"},"Legend Location"),a.createElement(zm,{selected:s?.legend_location||6,onSelectedChange:e=>_("legend_location",e)}),a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Grid Color"),a.createElement(Sm,{color:s?.grid_color||"#C0C0C0",opacity:s?.grid_opacity||.9,onColorChange:(e,t)=>k("grid_color","grid_opacity",e,t)}),a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Minor Grid Color"),a.createElement(Sm,{color:s?.minor_grid_color||"#C0C0C0",opacity:s?.minor_grid_opacity||.4,onColorChange:(e,t)=>k("minor_grid_color","minor_grid_opacity",e,t)}),a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Gridline Thickness"),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":"Gridline Thickness",value:s?.grid_width||1,onChange:(e,t)=>_("grid_width",t),step:1,valueLabelDisplay:"auto",marks:jm(Om),min:1,max:5,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}})),a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Minor Gridline Thickness"),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":"Minor Gridline Thickness",value:s?.minor_grid_width||1,onChange:(e,t)=>_("minor_grid_width",t),step:1,valueLabelDisplay:"auto",marks:jm(Om),min:1,max:5,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}})),"dc"===l?a.createElement(a.Fragment,null,a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Fill Opacity"),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":"Fill Opacity",value:s?.fill_opacity||.3,onChange:(e,t)=>_("fill_opacity",t),step:.1,valueLabelDisplay:"auto",marks:jm(Fm),min:0,max:1,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}})),a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Line Thickness"),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":"Line Thickness",value:s?.line_width||2,onChange:(e,t)=>_("line_width",t),step:1,valueLabelDisplay:"auto",marks:jm(Om),min:1,max:5,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}}))):a.createElement(a.Fragment,null,a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Marker Size"),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":"Marker Size",value:s?.marker_size||6,onChange:(e,t)=>_("marker_size",t),step:2,valueLabelDisplay:"off",marks:jm(Dm),min:4,max:16,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}})),a.createElement(vn.A,{textAlign:"start",mt:1,variant:"body1",component:"h5"},"Marker Opacity"),a.createElement(E.A,{theme:I},a.createElement(xs.Ay,{"aria-label":"Marker Opacity",value:s?.marker_opacity||.6,onChange:(e,t)=>_("marker_opacity",t),step:.1,valueLabelDisplay:"auto",marks:jm(Fm),min:0,max:1,color:"primary",sx:{minWidth:"50px",maxWidth:"150px"}}))))),a.createElement(Ct.A,{spacing:1,direction:"row-reverse"},a.createElement(ra,{color:"primary",text:"Save",disabled:0!==v.length,onClick:()=>{z(d,s),n()}}),a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:n}))))};$m.propTypes={data:O().instanceOf(Object).isRequired,unit:O().string.isRequired,onChartUpdate:O().func.isRequired,onEditPanelClose:O().func.isRequired,type:O().string.isRequired,source:O().string.isRequired,populations:O().instanceOf(Array)};const Nm=$m,qm=["Mean","Min","Max"],Lm=["Mean","Median","Mode"],Pm=({id:e,populations:t,chartType:n,poms:i,pomList:l,source:r})=>{const[o,s]=(0,a.useState)([]),c=(e,t,a,i)=>{const l=e.find(e=>"DC"===n?e.pom===t:e.pom[0]===t[0]&&e.pom?.[1]===t?.[1]),r=l?.[a.toLowerCase()]?l[a.toLowerCase()]:void 0;return"x"===i?r?.[0]?r[0].toFixed(2):"N/A":"y"===i?r?.[1]?r[1].toFixed(2):"N/A":r?.toFixed(2)||"N/A"};return(0,a.useEffect)(()=>{(async(e,t)=>Ye(Qe[t].deliverableSummaryStats,e))({analysis:e,delivery_type:n},r).then(e=>{e?.data&&s(e.data||[])})},[e]),a.createElement(Ct.A,{direction:"row",justifyContent:"start",mt:2.5,spacing:2,useFlexGap:!0,flexWrap:"wrap",sx:{border:"1px solid #ccc",width:"calc(100% - 40px)",padding:"18px 20px"}},a.createElement(Ct.A,{direction:"column",spacing:.5,sx:{padding:"2px 0"}},a.createElement("div",{style:{height:"21.4px"}}," "),"SP"===n?a.createElement(a.Fragment,null,a.createElement("div",{style:{height:"20px"}}," "),a.createElement(Ct.A,{direction:"row",spacing:1},a.createElement(vn.A,{variant:"body2",sx:{width:"180px",display:"inline-block",textAlign:"center"}},"X Measurement"),a.createElement(vn.A,{variant:"body2",sx:{width:"180px",display:"inline-block",textAlign:"center"}},"Y Measurement"))):a.createElement(vn.A,{variant:"body2",sx:{display:"inline-block",textAlign:"center"}},"Measurement"),0!==i.length&&i.map(e=>a.createElement(Ct.A,{direction:"column",spacing:.5,key:`pom-list${Array.isArray(e)?e.join("-"):e}`},Array.isArray(e)?a.createElement(Ct.A,{direction:"row",spacing:1,key:`pom-${e.join("-")}`},e.map(e=>a.createElement(z.A,{size:"medium",key:`pom-${e}`,label:l.find(t=>t.key===e)?.value||Fe(e),sx:{backgroundColor:"rgba(229, 229, 229, 0.42)",color:"#000000",width:"180px",fontSize:"14px",borderRadius:"4px",".MuiChip-label":{padding:0}}}))):a.createElement(z.A,{size:"medium",key:`pom-${e}`,label:l.find(t=>t.key===e)?.value||Fe(e),sx:{backgroundColor:"rgba(229, 229, 229, 0.42)",color:"#000000",width:"180px",fontSize:"14px",borderRadius:"4px",".MuiChip-label":{padding:0}}})))),0!==o.length&&o.map(({population:e,stats:l})=>a.createElement(Ct.A,{direction:"column",spacing:.5,key:`legend-${e}`,sx:{width:"SP"===n?"350px":"150px",padding:"2px 0"}},a.createElement("div",{style:{display:"inline-block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",textAlign:"center"},title:t.find(t=>t.id===e)?.label||e},t.find(t=>t.id===e)?.label||e),a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"end",width:"100%"}},a.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"space-evenly"}},"SP"===n&&qm.map(t=>a.createElement(Ct.A,{key:`statistics-${t}`,direction:"column",spacing:.5,sx:{width:"30%",textAlign:"center"}},a.createElement(vn.A,{variant:"subtitle2",component:"span"},"Mean"===t?"Avg.":t),a.createElement("div",null,a.createElement(vn.A,{variant:"subtitle2",component:"span",style:{width:"50%",lineHeight:"20px",display:"inline-block"}},"X"),a.createElement(vn.A,{variant:"subtitle2",component:"span",style:{width:"50%",lineHeight:"20px",display:"inline-block"}},"Y")),i.map(n=>a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",key:`${e}-${n.join("-")}-static-data`},a.createElement(z.A,{size:"medium",label:c(l,n,t,"x"),sx:{backgroundColor:"rgba(229, 229, 229, 0.42)",color:"#000000",width:"45%",fontSize:"14px",borderRadius:"4px",".MuiChip-label":{padding:0}}}),a.createElement(z.A,{size:"medium",label:c(l,n,t,"y"),sx:{backgroundColor:"rgba(229, 229, 229, 0.42)",color:"#000000",width:"45%",fontSize:"14px",borderRadius:"4px",".MuiChip-label":{padding:0}}}))))),"DC"===n&&Lm.map(e=>a.createElement(Ct.A,{key:`statistics-${e}`,direction:"column",spacing:.5,sx:{width:"30%",textAlign:"center"}},a.createElement(vn.A,{variant:"subtitle2",component:"span"},"Mean"===e?"Avg.":e),i.map(t=>a.createElement(z.A,{key:`stats-detail-${t}`,size:"medium",label:c(l,t,e),sx:{backgroundColor:"rgba(229, 229, 229, 0.42)",color:"#000000",width:"100%",fontSize:"14px",borderRadius:"4px",".MuiChip-label":{padding:0}}})))))))))};Pm.propTypes={id:O().string.isRequired,populations:O().instanceOf(Array).isRequired,poms:O().instanceOf(Array).isRequired,pomList:O().instanceOf(Array).isRequired,chartType:O().string.isRequired,source:O().string.isRequired};const Wm=Pm,Vm=({source:e})=>{const t=(0,l.useDispatch)(),n=(0,l.useSelector)(se).types,[i,r]=(0,a.useState)([]),[o,s]=(0,a.useState)(!1),[c,d]=(0,a.useState)([]),[p,u]=(0,a.useState)(!1),[g,E]=(0,a.useState)({}),[y,x]=(0,a.useState)(""),[f,b]=(0,a.useState)({}),[v,A]=(0,a.useState)({}),w=(0,l.useSelector)(ie),[C,S]=(0,a.useState)([]),[k,_]=(0,a.useState)(!1),[z,R]=(0,a.useState)(!1),D=(0,l.useSelector)(pe),O=`${We}api/v1/download/analysis/${w.id}/?domain=analysis_excel_sp`,F=()=>{u(!1)};(0,a.useEffect)(()=>{e&&Wn(Ne(e,n)).then(e=>{e&&d(e?.results||[])})},[e,n]),(0,a.useEffect)(()=>{var t;t={analysis:w.id,delivery_type:"SP"},_(!1),S([]),R(!0),$n(t,e).then(e=>{e?.data&&(r(e.data.map(e=>e.id)),R(!1))})},[w]);const M=(t,n,a)=>{Pn(t,e).then(e=>{e&&(r(e=>e.filter(e=>e!==t)),S(e=>e.filter(e=>!(e[0]===n&&e[1]===a))))})},j=e=>{S(t=>[...t,e])};return a.createElement(Ct.A,{direction:"column",sx:{marginTop:"10px"}},a.createElement(Ct.A,{direction:"row",spacing:1,justifyContent:"space-between"},a.createElement(Ct.A,{direction:"column",spacing:1,justifyContent:"start"},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"h6"},"Market Analysis"),a.createElement(Ka.x,{onClickAway:F},a.createElement("div",null,a.createElement(ei.A,{PopperProps:{disablePortal:!0},onClose:F,open:p,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:"We use a different ordering method for data sets in Market Analysis charts, which ensures they are displayed in ascending order from front to back."},a.createElement(h.A,{"aria-label":"info",onClick:()=>{u(!0)},size:"small",sx:{borderRadius:"30px",height:"30px",width:"30px"}},a.createElement(ri.A,{size:"small"}))))))),a.createElement(Ct.A,{direction:"column",spacing:1,alignItems:"end"},"PROJECT_VIEW"!==e&&a.createElement(m.N_,{to:O,download:w.id,target:"_blank",rel:"noreferrer",onClick:e=>{"normal"===D&&e.preventDefault(),t(me({analysisToDownload:"normal"}))},disabled:C.length!==i.length},a.createElement(ra,{text:"Download",color:"primary",size:"small"})),a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(ra,{text:"Data Table",variant:"outlined",color:k?"primary":"default",onClick:()=>_(e=>!e),disabled:C.length!==i.length,size:"small"}),a.createElement(ra,{color:"default",variant:"outlined",text:"+ Add Measurement",size:"small",onClick:()=>s(!o)})))),o&&a.createElement("div",{style:{display:"flex",padding:"20px",marginTop:"5px",flexDirection:"row",justifyContent:"space-between",backgroundColor:"#F2F2F2",borderRadius:"10px",width:"calc(100% - 40px)",alignItems:"center"}},a.createElement(pi,{sx:{m:1,minWidth:300},field:"X Measurement",value:0===Object.keys(f).length?"":f,onChange:(e,t)=>b(t),options:c}),a.createElement(pi,{sx:{m:1,minWidth:300},field:"Y Measurement",value:0===Object.keys(v).length?"":v,onChange:(e,t)=>A(t),options:c}),a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add",color:"primary",onClick:()=>{const t={analysis:w.id,config:{pom:[f.key,v.key]},delivery_type:"SP"};qn(t,e).then(e=>{e&&(s(!1),_(!1),r(t=>[e?.id||"",...t]),b({}),A({}))})}})),k&&a.createElement(Wm,{id:w.id,populations:w?.populations||[],chartType:"SP",poms:C,pomList:c,source:e}),i.map(t=>a.createElement(wm,{key:t,id:t,populations:w?.populations||[],onChartDelete:M,onChartEdit:e=>E(e),isEditing:g.id===t,pomList:c,onFinishUpdate:()=>x(""),onChartStatsAdd:j,shouldChartRevalidate:y===t||z,source:e})),0!==Object.keys(g).length&&a.createElement(Nm,{data:g,unit:w.unit||"",onChartUpdate:(e,t)=>((e,[t,n])=>{x(e),S(e=>e.filter(e=>!(e[0]===t&&e[1]===n)))})(e,t),onEditPanelClose:()=>E({}),type:"sp",source:e}))};Vm.propTypes={source:O().string.isRequired};const Hm=Vm,Gm=(0,Br.A)(Qr),Um=({id:e,populations:t,onChartDelete:n,onChartEdit:i,shouldChartRevalidate:r,isEditing:o,pomList:s,onFinishUpdate:c,onChartStatsAdd:d,source:p="PROJECT_VIEW"})=>{const[u,g]=(0,a.useState)({}),[E,y]=(0,a.useState)(!0),[x,f]=(0,a.useState)(!0),[b,v]=(0,a.useState)(!1),A=(0,l.useDispatch)(),w=(0,l.useSelector)(pe),C="failed"===u?.task?.status,S=u?.config?.pom||"";return(0,a.useEffect)(()=>{r&&(y(!0),f(!0))},[r]),(0,a.useEffect)(()=>{var t;E&&x&&(t=e,f(!1),Nn(t,p).then(e=>{"done"===e?.task?.status||"failed"===e?.task?.status?(g(e||{}),y(!1),d(e?.config?.pom),r&&c()):"pending"!==e?.task?.status&&"processing"!==e?.task?.status||f(!0)}))},[e,E,x]),C?a.createElement(Em,{key:`failed-${e}`,id:e,onChartDelete:n,title:u?.config?.title||"",errMsg:u?.task?.errors||""}):a.createElement(_t.A,{sx:{alignItems:"start",backgroundColor:"#FFFFFF",borderRadius:"10px",boxShadow:o?"0px 0px 3px 3px rgba(236, 119, 0, 0.66)":"0px 0px 6px #00000029",boxSizing:"content-box",display:"flex",flexDirection:"row",justifyContent:"start",margin:"10px 5px 0",padding:"20px",position:"relative",width:"calc(100% - 50px)",minHeight:"152px"},id:u?.config?.pom?u.config.pom:""},a.createElement(bi,{isLoading:E,isSingleChart:!0}),a.createElement(Ct.A,{spacing:1,direction:"column",sx:{position:"relative",width:"800px"}},u?.result_data&&a.createElement(Gm,(0,kn.A)({},JSON.parse(u.result_data),{config:{modeBarButtonsToRemove:["select2d","lasso2d"],displaylogo:!1}})),t&&u?.statistics&&u?.config?.pom&&a.createElement(bm,{data:u.statistics,populations:t,pom:[u.config.pom],chartType:"dc"})),a.createElement("div",{style:{width:"calc(100% - 800px)",padding:"0 5px"}},a.createElement(Ct.A,{direction:"row",justifyContent:"flex-end",alignItems:"center"},"PROJECT_VIEW"===p&&a.createElement(h.A,{sx:{color:"#5F504D"},component:m.N_,to:`${We}api/v1/deliverables/preview/${e}/${Oe({type:"DC",is_thumbnail:"F"})}`,download:e,target:"_blank",rel:"noreferrer",onClick:e=>{"normal"===w&&e.preventDefault(),A(me({analysisToDownload:"normal"}))}},a.createElement(gm.A,null)),a.createElement(h.A,{sx:{color:"#5F504D"},onClick:()=>i(u)},a.createElement(zl.A,null)),a.createElement(h.A,{sx:{color:"#FB4E3B"},onClick:()=>v(!0)},a.createElement(Ra.A,null))),u.abp_stats&&0!==u.abp_stats.length&&a.createElement(Ct.A,{direction:"row",spacing:2,useFlexGap:!0,flexWrap:"wrap"},u.abp_stats.map(e=>a.createElement(dm.A,{disableGutters:!0,defaultExpanded:!0,key:`size-chart${e.name}`,sx:{border:"none",boxShadow:"none","&::before":{height:0}}},a.createElement(mm.A,{expandIcon:a.createElement(um.A,null),"aria-controls":"advanced-settings",id:"advanced-settings",sx:{minHeight:"28px",".MuiAccordionSummary-content":{marginBottom:0}}},a.createElement(vn.A,{variant:"subtitle1",sx:{color:"#383838"}},e.name)),a.createElement(pm.A,null,a.createElement(Ct.A,{direction:"column",spacing:1,sx:{width:180}},a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between"},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},"Size"),a.createElement(vn.A,{variant:"subtitle2",sx:{width:"70%",display:"inline-block",textAlign:"right"}},s.find(e=>e.key===S)?.value||Fe(S))),e.data.map((e,t)=>a.createElement(Ct.A,{direction:"row",spacing:.5,justifyContent:"space-between",key:`stats-${e.size}-${e?.[S]}-${t}`},a.createElement(vn.A,{variant:"subtitle2",sx:{width:"30%",display:"inline-block"}},e?.size||"N/A"),a.createElement(vn.A,{variant:"body2",sx:{width:"70%",display:"inline-block",textAlign:"right"}},e?.[S]?e[S].toFixed(2):"N/A"))))))))),a.createElement(qa.A,{onClose:()=>v(!1),open:b,transitionDuration:0},a.createElement(La.A,null,"Please Confirm"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},`Are you sure that you want to delete chart: ${u?.config?.title||""}?`)),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",color:"default",variant:"outlined",onClick:()=>v(!1)}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{v(!1),n(e,S)}}))))};Um.propTypes={id:O().string.isRequired,populations:O().instanceOf(Array).isRequired,onChartDelete:O().func.isRequired,isEditing:O().bool.isRequired,source:O().string,shouldChartRevalidate:O().bool.isRequired,pomList:O().instanceOf(Array).isRequired,onChartStatsAdd:O().func.isRequired,onFinishUpdate:O().func.isRequired,onChartEdit:O().func.isRequired};const Ym=Um,Zm=({source:e})=>{const t=(0,l.useDispatch)(),n=(0,l.useSelector)(se).types,[i,r]=(0,a.useState)([]),[o,s]=(0,a.useState)(!1),[c,d]=(0,a.useState)(!1),[p,u]=(0,a.useState)([]),[g,E]=(0,a.useState)({}),[y,x]=(0,a.useState)(""),f=(0,l.useSelector)(ie),[b,v]=(0,a.useState)([]),[A,w]=(0,a.useState)({}),[C,S]=(0,a.useState)([]),[k,_]=(0,a.useState)(!1),[z,R]=(0,a.useState)(!1),[D,O]=(0,a.useState)(!1),F=(0,l.useSelector)(pe),M=`${We}api/v1/download/analysis/${f.id}/?domain=analysis_excel_dc`,j=()=>{d(!1)},I=t=>{S([]),_(!1);const n={analysis:t,delivery_type:"DC"};O(!0),$n(n,e).then(e=>{if(e?.data){const t=e.data.map(e=>e?.config?.pom||"");r(e.data.map(e=>e.id)),u(t),O(!1),R(e?.show_original||!1)}})};(0,a.useEffect)(()=>{e&&Wn(Ne(e,n||["BODY"])).then(e=>{e&&v(e?.results||[])})},[e,n]),(0,a.useEffect)(()=>{I(f.id)},[f]);const T=(t,n)=>{Pn(t,e).then(e=>{e&&(r(e=>e.filter(e=>e!==t)),u(e=>e.filter(e=>e!==n)),S(e=>e.filter(e=>e!==n)))})},B=e=>{S(t=>[...t,e])};return a.createElement(Ct.A,{direction:"column",sx:{marginTop:"10px"}},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between"},a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"h6"},"Body Data Distribution"),"PROJECT_VIEW"!==e&&a.createElement(Ka.x,{onClickAway:j},a.createElement("div",null,a.createElement(ei.A,{PopperProps:{disablePortal:!0},onClose:j,open:c,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:"We recommend using the AI-generated results which displays the results produced by our AI using real data and an special algorithm that helps smoother the curves. However, for smaller set of customer body data, the AI -generated results might be too smooth to represent actual data. In this case, you can either switch to 'Actual Data' to see more accurate results or use a larger data set for better analysis."},a.createElement(h.A,{"aria-label":"info",onClick:()=>{d(!0)},size:"small",sx:{borderRadius:"30px",height:"30px",width:"30px"}},a.createElement(ri.A,{size:"small"})))))),"PROJECT_VIEW"!==e&&a.createElement(Fl,{label:"",options:["AI Generated","Actual Data"],value:z?"Actual Data":"AI Generated",color:"primary",onChange:e=>{const t="Actual Data"===e;(async(e,t,n)=>Je(Qe.MYALVA.deliverablesBatchUpdate,{config:n},{analysis:e,delivery_type:"DC"}))(f.id,0,{show_original:t}).then(e=>{e?.status&&(R(t),I(f.id),S([]),_(!1))})}})),a.createElement(Ct.A,{direction:"column",spacing:1,alignItems:"end"},"PROJECT_VIEW"!==e&&a.createElement(m.N_,{to:M,download:f.id,target:"_blank",rel:"noreferrer",onClick:e=>{"normal"===F&&e.preventDefault(),t(me({analysisToDownload:"normal"}))},disabled:C.length!==i.length},a.createElement(ra,{text:"Download",color:"primary",size:"small"})),a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement(ra,{text:"Data Table",variant:"outlined",color:k?"primary":"default",onClick:()=>_(e=>!e),disabled:C.length!==i.length,size:"small"}),a.createElement(ra,{color:"default",variant:"outlined",text:"+ Add Measurement",onClick:()=>s(!o),size:"small"})))),o&&a.createElement("div",{style:{display:"flex",padding:"20px",marginTop:"5px",flexDirection:"row",justifyContent:"space-between",backgroundColor:"#F2F2F2",borderRadius:"10px",width:"calc(100% - 40px)",alignItems:"center"}},a.createElement(pi,{sx:{m:1,minWidth:300},field:"Measurement",value:0===Object.keys(A).length?"":A,onChange:(e,t)=>w(t),options:b.filter(e=>!p.includes(e.key))}),a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add",color:"primary",onClick:()=>{const t={analysis:f.id,config:{pom:A.key,show_original:z},delivery_type:"DC"};qn(t,e).then(e=>{e&&(s(!1),_(!1),r(t=>[e?.id||"",...t]),u(e=>[A.key,...e]),w({}))})}})),k&&a.createElement(Wm,{id:f.id,populations:f?.populations||[],chartType:"DC",poms:C,pomList:b,source:e}),i.map(t=>a.createElement(Ym,{key:t,id:t,populations:f?.populations||[],onChartDelete:T,onChartEdit:e=>E(e),isEditing:g.id===t,pomList:b,onFinishUpdate:()=>x(""),onChartStatsAdd:B,shouldChartRevalidate:y===t||D,source:e})),0!==Object.keys(g).length&&a.createElement(Nm,{data:g,unit:f.unit||"",onChartUpdate:(e,t)=>((e,t)=>{x(e),S(e=>e.filter(e=>e!==t))})(e,t),onEditPanelClose:()=>E({}),type:"dc",source:e,populations:f.populations}))};Zm.propTypes={source:O().string.isRequired};const Jm=Zm,Xm=()=>{const e=(0,p.zy)().pathname.split("/")[2];return a.createElement(Ct.A,{direction:"column",spacing:2,sx:{marginTop:"10px"}},a.createElement(go,{id:e,type:"MYALVA"}),a.createElement(ao,{id:e,type:"MYALVA"}))},Qm=(0,Ma.Ay)(Oa.A)(()=>({[`&.${Fa.A.root}`]:{color:"#544744"},[`&.${Fa.A.head}`]:{fontSize:"16px"}})),Km=(0,Ma.Ay)(Aa.A)(()=>({height:"100px",width:"100%",borderRadius:"10px",position:"relative","&:hover":{"&::after":{content:'""',display:"block",position:"absolute",boxShadow:"0px 0px 3px 3px rgba(236, 119, 0, 0.66)",height:"calc(100% - 6px)",width:"calc(100% - 8px)",borderRadius:"10px",left:"3px",top:"3px"}},"&:nth-of-type(even)":{backgroundColor:"rgba(236, 119, 0, 0.05)"}})),ep=({data:e,onViewMoreClicked:t,totalCount:n,listHeight:i,onAnalysisDelete:l,onProjectStarred:r,viewBy:o,hasFilterOptions:s})=>a.createElement(wa.A,{key:"myalva-list-table",id:"myalva-list-table",style:{backgroundColor:"#FFFFFF",color:"#544744",position:"relative",width:"auto",...i},component:"div"},a.createElement(Ca.A,{stickyHeader:!0,"aria-label":"myalva-list-table",component:"div"},a.createElement(Sa.A,{component:"div"},a.createElement(Aa.A,{component:"div"},a.createElement(Qm,{component:"div"}," "),W.map(e=>a.createElement(Qm,{key:e.label,component:"div"},e.label)),a.createElement(Qm,{component:"div"}," "))),a.createElement(ka.A,{component:"div"},0!==e.length&&e.map(e=>a.createElement(Km,{key:e.id,component:m.N_,to:`./${e.id}`,sx:{"#del-btn":{visibility:"hidden"},"&:hover":{"#del-btn":{visibility:"visible"}}}},a.createElement(Qm,{align:"left",component:"div"},a.createElement(h.A,{size:"small",sx:{color:"#5F504D",zIndex:1},onClick:t=>{t.preventDefault(),r(e,!e?.is_favorites)}},e?.is_favorites?a.createElement(Da.A,{fontSize:"small"}):a.createElement(za.A,{fontSize:"small"}))),W.map(t=>a.createElement(Qm,{align:"left",key:`${t.name}-${e.acid}-${t.id}`,style:{fontWeight:"acid"===t.id||"client"===t.id?"600":"400"},component:"div"},"created_by"===t.id?U(e[t.id]):Y(t.id,e[t.id])||"N/A")),a.createElement(Qm,{align:"left",component:"div"},a.createElement(h.A,{id:"del-btn",size:"small",sx:{color:"#5F504D",zIndex:588},onClick:t=>{t.preventDefault(),l(e.id,e.title)}},a.createElement(Ra.A,null)))))),0===n&&s&&a.createElement(Oa.A,{colSpan:8,rowSpan:8,sx:{padding:0}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 250px)",justifyContent:"center"}},a.createElement(vn.A,{variant:"h5"},"No Results"))),0===n&&!s&&a.createElement(Oa.A,{colSpan:8,rowSpan:8,sx:{padding:0}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 250px)",justifyContent:"center"}},a.createElement(vn.A,{variant:"h5"},`No${"is_favorites"===o?" starred":""} projects${"is_my"===o?" created by you":""}`),"is_favorites"===o?a.createElement("p",null,"Add stars to projects that you want to easily find later"):a.createElement("p",null,`Start adding${"is_my"===o?" your":""} projects by clicking the Add New Project button above`))),e.length{const[e,t]=(0,a.useState)([]),[n,i]=(0,a.useState)({page:1,view_by:"all"}),[l,r]=(0,a.useState)(-1),[o,s]=(0,a.useState)(1),[c,d]=(0,a.useState)(window.scrollY),[m,p]=(0,a.useState)(!0),[u,g]=(0,a.useState)({}),h=0!==Object.keys(u).length,{view_by:E,page:y,search:x,ordering:f,...b}=n,v=0!==Object.keys(b).length&&!Object.values(b).includes("All"),A=()=>{Mn(n,"MYALVA").then(a=>{if(n?.page&&n.page!==o&&1!==n.page){const i=a?.data||[];t([...e,...i]),s(n.page)}else t(a?.data||[]);r(a?.count||0)})};(0,a.useEffect)(()=>{0!==Object.keys(n).length&&A()},[n]);const w=()=>{const e=document.getElementById("myalva-list-table").scrollTop;p(c>e),d(e)};(0,a.useEffect)(()=>{const e=document.getElementById("myalva-list-table");return e.addEventListener("scroll",w),()=>{e.removeEventListener("scroll",w)}});const C=m?{top:0,transition:"top 0.3s ease-out",position:"relative"}:{top:"-62px",transition:"top 0.3s ease-out",position:"relative"},S=m?{top:0,transition:"top 0.3s ease-out",height:"calc(100vh - 180px)"}:{top:"-93px",transition:"top 0.3s ease-out",height:"calc(100vh - 93px)"};return a.createElement(_t.A,{sx:{height:"calc(100vh - 100px)",position:"relative",overflowY:"hidden"}},a.createElement(va,{onSearch:e=>{i({...n,search:e,page:1}),s(1)},type:"myAlva",styles:C,params:n,onParamsChange:(e,t)=>{if(n?.[e]!==t)if("All"===t){const{...t}=n;delete t[e],i({...t,page:1}),s(1)}else i(n=>({...n,[e]:t,page:1})),s(1)}}),a.createElement(tp,{data:e,onViewMoreClicked:()=>{return e=o,void i({...n,page:e+1});var e},totalCount:l,listHeight:S,onAnalysisDelete:(e,t)=>g({id:e,title:t}),onProjectStarred:(n,a)=>{const i={id:n.id,model_type:"MyAlvaAnalysisFavorites",option_type:a?"Add":"Cancel"};gn(i).then(i=>{if(!0===i?.status){const i=e.findIndex(e=>e.id===n.id);t(e=>e.toSpliced(i,1,{...n,is_favorites:a}))}})},viewBy:E||"all",hasFilterOptions:v}),a.createElement(qa.A,{onClose:()=>g({}),open:h,transitionDuration:0},a.createElement(La.A,null,"Delete Analysis Project"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},"Are you sure to delete the “",a.createElement("b",null,`${u?.title||""}`),"” project?"),a.createElement(Wa.A,{id:"alert-dialog-description"},"After deleting, you will not be able to restore the project and others won't be able to see the project in the system.")),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",color:"default",variant:"outlined",onClick:()=>g({})}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{return e=u.id,void Tn(e,"MYALVA").then(e=>{e&&(A(),g({}))});var e}}))))},ap=[{id:"my_profile",text:"My Profile",path:"my"},{id:"download_history",text:"Download Records",path:"downloads"}],ip=()=>{const e=(0,p.zy)();return a.createElement(E.A,{theme:I},a.createElement(It.Ay,{sx:{".MuiDrawer-paper":{position:"absolute",top:"auto",left:"auto",zIndex:"auto",width:"180px"},a:{color:"inherit"}},variant:"permanent",anchor:"left"},a.createElement(Tt.A,null,ap.map(t=>a.createElement(Bt.A,{selected:e.pathname.includes(t.path),key:t.text},a.createElement(m.N_,{className:"sidebar-tabs",to:t.path,style:{width:"100%"}},a.createElement($t.A,{primary:t.text})))))),a.createElement(_t.A,{sx:{width:"calc(100% - 212px)",marginLeft:"180px",p:2},component:"main"},a.createElement("div",{id:"detail"},a.createElement(p.sv,null))))},lp=[{id:"filename",label:"File Name",type:"text"},{id:"status",label:"Status",type:"chip"},{id:"created_at",label:"Creation Date",type:"datetime"},{id:"expired_at",label:"File Expiration time",type:"datetime"}],rp=[{id:"pending",label:"Generating",color:"#2254C5",background:"#EBF2FE"},{id:"done",label:"Generated",color:"#3A6C50",background:"#E3FEF2"},{id:"failed",label:"Generating failed",color:"#E55238",background:"#FBE8E5"},{id:"expired",label:"File expired",color:"#72624E",background:"#FAEDCC"}],op=(0,Ma.Ay)(Oa.A)(()=>({[`&.${Fa.A.root}`]:{color:"#544744",borderBottom:"none"},[`&.${Fa.A.head}`]:{fontSize:"16px",backgroundColor:"#FFFFFF",borderBottom:"none"}})),sp=()=>{const e=(0,l.useDispatch)(),[t,n]=(0,a.useState)([]),[i,r]=(0,a.useState)(-1),[o,s]=(0,a.useState)(""),[c,d]=(0,a.useState)(!1),[p,u]=(0,a.useState)({}),E=(0,l.useSelector)(pe),y=()=>{(async e=>Ye(Qe.USER.downloadList,e))(p).then(e=>{e?.data&&void 0!==e?.count&&(n(e.data),r(e.count),0===e.data.filter(e=>"pending"===e.status).length&&d(!0))})};(0,a.useEffect)(()=>{let e;return c||(y(),e=setInterval(()=>{y()},1e3)),()=>clearInterval(e)},[c]),(0,a.useEffect)(()=>{const e=setTimeout(()=>{u({filename__icontains:o}),d(!1)},1e3);return()=>clearTimeout(e)},[o]);const x=t=>{"normal"===E&&t.preventDefault(),e(me({analysisToDownload:"normal"}))};return a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(Fn,{label:"Search",placeholder:"Search File Name",onChange:e=>s(e.target.value),startAdornment:a.createElement(g.A,{position:"start"},a.createElement(Cn.A,null)),endAdornment:a.createElement(g.A,{position:"end"},a.createElement(h.A,{onClick:()=>s(""),sx:{visibility:0===o.length?"hidden":"visible"}},a.createElement(Sn.A,{fontSize:"small"}))),style:{width:"300px",alignSelf:"end"},value:o}),a.createElement(wa.A,{key:"download-list-table",id:"download-list-table",style:{backgroundColor:"#FFFFFF",color:"#544744",position:"relative",width:"auto"}},a.createElement(Ca.A,{stickyHeader:!0,"aria-label":"download-list-table"},a.createElement(Sa.A,null,a.createElement(Aa.A,null,lp.map(e=>a.createElement(op,{key:e.label},e.label)),a.createElement(op,null," "))),a.createElement(ka.A,null,0!==t.length&&t.map(e=>a.createElement(Aa.A,{key:e.id,to:e.id},lp.map(t=>a.createElement(op,{align:"left",key:`${t.name}-${e.acid}-${t.id}`,style:{fontWeight:"acid"===t.id||"client"===t.id?"600":"400"}},((e,t)=>{if("datetime"===e)return _e(t);if("text"===e)return t;const n=rp.find(e=>e.id===t)||{};return a.createElement(z.A,{size:"medium",label:n.label,sx:{backgroundColor:`${n.background}`,color:`${n.color}`,height:"24px",fontSize:"14px",borderRadius:"8px"}})})(t.type,e[t.id]))),a.createElement(op,{align:"left"},"done"===e.status&&a.createElement(m.N_,{to:`${We}api/v1/download/record/resource/${e.id}/`,download:e.id,target:"_blank",rel:"noreferrer",onClick:x},a.createElement(ra,{text:"Download",color:"primary",variant:"outlined",size:"small",style:{border:"none",fontWeight:"400"},hoverStyle:{border:"none"}})))))),0===i&&a.createElement(op,{colSpan:8,rowSpan:3,sx:{padding:0}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 250px)",justifyContent:"center"}},a.createElement(vn.A,{variant:"h5"},"No Records"))))),a.createElement(bi,{isLoading:-1===i}))},cp=({filters:e,onClose:t,showFilterPanel:n})=>{const[i,l]=(0,a.useState)({}),[r,o]=(0,a.useState)([]);(0,a.useEffect)(()=>{l(e)},[e]),(0,a.useEffect)(()=>{(async()=>Ye(Qe.DATASET_PROFILER.options))().then(e=>o(e?.data||[]))},[]);const s=(e,t)=>{l(n=>({...n,[e]:t}))};return a.createElement(or.A,{sx:{p:n?2:0,display:"flex",flexDirection:"column",marginBottom:n?2:0,height:n?"auto":0}},a.createElement(Ct.A,{direction:"row",spacing:2,justifyContent:"start"},a.createElement(Is,{field:"Body Type",value:i?.data_type||[],options:["Body","Head","Hand"],onChange:e=>s("data_type",e),multiple:!0,tooltipText:"If multiple body types are selected, only datasets that contain all the selected types will be queried. For example, if both head and hand types are selected, only datasets that include both head and hand data will be shown.",width:200}),a.createElement(pi,{field:"Usable",value:i?.usable||[],multiple:!0,options:["Yes","No"],onChange:(e,t)=>s("usable",t),width:250}),a.createElement(ur,{field:"Country/Region",multiple:!0,value:i?.region||[],onChange:e=>s("region",e),options:r?.region||[],group:r?.region?.length>1?"group":"",style:{width:"250px"}}),a.createElement(Rs,{value:{datetime_gte:i?.datetime_gte,datetime_lte:i?.datetime_lte},onChange:s,isDP:!0})),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",mt:1},a.createElement(E.A,{theme:I},a.createElement(y.A,{color:"primary",onClick:()=>{l({})}},"Clear filters")),a.createElement(Ct.A,{spacing:1,direction:"row",sx:{mr:1}},a.createElement(ra,{color:"default",variant:"outlined",text:"Cancel",onClick:()=>t()}),a.createElement(ra,{color:"primary",text:"Apply",onClick:()=>{t(i)}}))))};cp.propTypes={onClose:O().func.isRequired,filters:O().instanceOf(Object).isRequired,showFilterPanel:O().bool.isRequired};const dp=cp,mp=(0,Br.A)(Qr),pp=({config:e})=>{const[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1),[r,o]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{l(!0),(async e=>Ye(Qe.DATASET_PROFILER.summary,e))(e).then(e=>{e?.data&&(n(e.data),l(!1))})},[e]),a.createElement(Ct.A,{direction:"column",spacing:1,p:0},a.createElement(vn.A,{variant:"h6",sx:{color:"#383838"}},"Summary"),a.createElement(Ct.A,{direction:"row",spacing:2},t?.gender_gauge&&a.createElement(or.A,{sx:{p:"16px 32px",minHeight:"300px",position:"relative",boxShadow:"-2px -1px 9px rgba(13, 10, 44, 0.08)"}},a.createElement(vn.A,{variant:"subtitle2",sx:{fontSize:"18px",color:"#383838",lineHeight:"36px"}},"Gender"),a.createElement(mp,(0,kn.A)({},JSON.parse(t.gender_gauge),{config:{displayModeBar:!1}}))),t?.age_bar&&a.createElement(or.A,{sx:{p:"16px 32px",minHeight:"300px",position:"relative",boxShadow:"-2px -1px 9px rgba(13, 10, 44, 0.08)"}},a.createElement(vn.A,{variant:"subtitle2",sx:{fontSize:"18px",color:"#383838",lineHeight:"36px"}},"Age"),a.createElement(mp,(0,kn.A)({},JSON.parse(t.age_bar),{config:{displayModeBar:!1,scrollZoom:!1}}))),t?.location_bar&&a.createElement(or.A,{sx:{p:"16px 32px",minHeight:"300px",position:"relative",boxShadow:"-2px -1px 9px rgba(13, 10, 44, 0.08)"}},a.createElement(Ct.A,{direction:"row",justifyContent:t?.region_count&&0!==t.region_count.length?"space-between":"start"},a.createElement(vn.A,{variant:"subtitle2",sx:{fontSize:"18px",color:"#383838",lineHeight:"36px"}},"Country/Region"),t?.region_count&&0!==t.region_count.length&&a.createElement(E.A,{theme:I},a.createElement(y.A,{onClick:()=>o(e=>!e),color:"primary"},"View All"))),a.createElement(mp,(0,kn.A)({},JSON.parse(t.location_bar),{config:{displayModeBar:!1}})))),a.createElement(bi,{isLoading:i,isSingleChart:!0}),a.createElement(qa.A,{onClose:()=>o(!1),open:r,maxWidth:"xs",fullWidth:!0},a.createElement(La.A,null,"Locations"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"column",spacing:1},t?.region_count&&0!==t.region_count.length&&t.region_count.map(e=>a.createElement(Ct.A,{key:e?.code||"",direction:"row",alignItems:"end",justifyContent:"space-between",sx:{width:"100%"}},a.createElement(Ct.A,{direction:"row",sx:{width:"40%"},spacing:1,alignItems:"center"},a.createElement(vn.A,{variant:"body1",sx:{fontWeight:700}},e?.name||"")),a.createElement(vn.A,{variant:"body1",sx:{color:"#4e5969",width:"20%",textAlign:"right"}},ze(e?.count||0)),a.createElement(vn.A,{variant:"body1",sx:{width:"20%",textAlign:"right"}},`${e?.percent}%`||""))))),a.createElement(Va.A,null,a.createElement(ra,{text:"OK",color:"primary",onClick:()=>o(!1)}))))};pp.propTypes={config:O().instanceOf(Object).isRequired};const up=pp;var gp=n(88225);const hp=[{key:"continent",value:"Continent",type:"string"},{key:"region",value:"Country/Region",type:"string"},{key:"usable",value:"Usable",type:"string"},{key:"data_type",value:"Data Type",type:"array"},{key:"start_date",value:"Start Date",type:"string"},{key:"end_date",value:"End Date",type:"string"},{key:"scanner",value:"Scanner",type:"string"},{key:"operator",value:"Operator",type:"string"},{key:"client",value:"Client",type:"string"},{key:"permission",value:"Permission",type:"string"},{key:"possible_data_bias",value:"Possible Data Bias",type:"string"}],Ep=[{key:"total",value:"Total Count"},{key:"male",value:"Male"},{key:"female",value:"Female"},{key:"age_0",value:"Age (<18)"},{key:"age_18",value:"Age (18-30)"},{key:"age_31",value:"Age (31-45)"},{key:"age_46",value:"Age (46-60)"},{key:"age_60",value:"Age ( >60)"}],yp=[{key:"scan_region",value:"Scan Region"},{key:"subject_region",value:"Subject Region"},{key:"ethnicity",value:"Ethnicity"}],xp=({data:e,onClose:t,onIndexChange:n})=>a.createElement(qa.A,{fullWidth:!0,maxWidth:"lg",onClose:t,open:0!==Object.keys(e).length},a.createElement(La.A,null,a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",sx:{p:"16px 16px 0"}},a.createElement(Ct.A,{direction:"row",spacing:2,alignItems:"center"},a.createElement(vn.A,{variant:"h4"},e?.key||""),a.createElement(h.A,{size:"small",onClick:()=>n(-1),sx:{height:"25px",width:"25px",color:"#A0A0A0",border:"1px solid #A0A0A0","&:hover":{backgroundColor:"transparent",color:"#EC7700",border:"1px solid #EC7700"}}},a.createElement(gp.A,{fontSize:"small"})),a.createElement(h.A,{size:"small",color:"primary",onClick:()=>n(1),sx:{height:"25px",width:"25px",color:"#A0A0A0",border:"1px solid #A0A0A0","&:hover":{backgroundColor:"transparent",color:"#EC7700",border:"1px solid #EC7700"}}},a.createElement(Hn.A,{fontSize:"small"}))),a.createElement(h.A,{size:"small",onClick:t,sx:{"&:hover":{backgroundColor:"transparent"}}},a.createElement(Si.A,null)))),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"column",spacing:2,sx:{p:"0 16px 16px"}},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(Ct.A,{direction:"column",spacing:1,sx:{width:"60%"}},a.createElement(vn.A,{variant:"h6"},"Background Information"),hp.map(t=>a.createElement(Ct.A,{key:`field-${t.key}`,direction:"row",spacing:1},a.createElement(vn.A,{variant:"body1",sx:{color:"#A0A0A0",width:"150px"}},`${t.value}:`),a.createElement(vn.A,{variant:"body1",sx:{width:"calc(100% - 158px)"}},"array"===t.type?e?.[t.key]?.join(", ")||"N/A":e?.[t.key]||"N/A")))),a.createElement(Ct.A,{direction:"column",spacing:1,sx:{width:"30%"}},a.createElement(vn.A,{variant:"h6"},"Count"),Ep.map(t=>a.createElement(Ct.A,{key:`field-${t.key}`,direction:"row",spacing:1},a.createElement(vn.A,{variant:"body1",sx:{color:"#A0A0A0",width:"100px"}},`${t.value}:`),a.createElement(vn.A,{variant:"body1"},"total"!==t.key?`${e?.[t.key]?.toLocaleString()||0} (${+(100*+(e?.[t.key]||0)/+e.total).toFixed(1)}%)`:e?.[t.key]?.toLocaleString()||"N/A"))))),a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(vn.A,{variant:"h6"},"Geo- & Demo-graphic"),yp.map(t=>a.createElement(Ct.A,{key:`field-${t.key}`,direction:"row",spacing:1},a.createElement(vn.A,{variant:"body1",sx:{color:"#A0A0A0",width:"150px"}},`${t.value}:`),a.createElement(vn.A,{variant:"body1",sx:{width:"calc(100% - 158px)"}},e?.[t.key]||"N/A")))),a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(vn.A,{variant:"h6"},"Note"),a.createElement(vn.A,{variant:"body1"},e?.note||"N/A")))));xp.propTypes={data:O().instanceOf(Object).isRequired,onClose:O().func.isRequired,onIndexChange:O().func.isRequired};const fp=xp,bp=({config:e})=>{const[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(!1),[r,o]=(0,a.useState)(""),s=t.find(e=>e?.key===r)||{};(0,a.useEffect)(()=>{l(!0),(async e=>Ye(Qe.DATASET_PROFILER.data,e))(e).then(e=>{e?.data&&(n(e.data),l(!1))})},[e]);const c=[{field:"key",headerName:"Dataset",width:150,display:"flex",filterable:!1},{field:"continent",headerName:"Continent",display:"flex",width:100,filterable:!1},{field:"region",headerName:"Country/Region",width:100,display:"flex",filterable:!1},{field:"usable",headerName:"Usable",display:"flex",filterable:!1,width:80},{field:"data_type",headerName:"Body Type",display:"flex",filterable:!1,width:150,valueFormatter:e=>e.join(", ")},{field:"start_date",headerName:"Start Time",display:"flex",filterable:!1,width:100,valueFormatter:e=>e||"N/A"},{field:"end_date",headerName:"End Time",display:"flex",filterable:!1,width:100,valueFormatter:e=>e||"N/A"},{field:"scanner",headerName:"Scanner",display:"flex",filterable:!1,width:100},{field:"total",headerName:"Total Count",filterable:!1,display:"flex",width:100,align:"right",headerAlign:"right",valueFormatter:e=>e?e.toLocaleString():"0"},{field:"male",headerName:"Male",display:"flex",filterable:!1,width:100,align:"right",headerAlign:"right",renderCell:e=>a.createElement(Ct.A,{direction:"column"},a.createElement("span",null,e?.value?e.value.toLocaleString():"0"),a.createElement("span",null,+(100*+e.value/+e.row.total).toFixed(1)+"%"))},{field:"female",headerName:"Female",display:"flex",filterable:!1,width:100,align:"right",headerAlign:"right",renderCell:e=>a.createElement(Ct.A,{direction:"column"},a.createElement("span",null,e?.value?e.value.toLocaleString():"0"),a.createElement("span",null,+(100*+e.value/+e.row.total).toFixed(1)+"%"))},{field:"age_0",headerName:"Age <18",display:"flex",filterable:!1,align:"right",width:100,headerAlign:"right",renderCell:e=>a.createElement(Ct.A,{direction:"column"},a.createElement("span",null,e?.value?e.value.toLocaleString():"0"),a.createElement("span",null,+(100*+e.value/+e.row.total).toFixed(1)+"%"))},{field:"age_18",headerName:"Age 18-30",display:"flex",filterable:!1,align:"right",width:100,headerAlign:"right",renderCell:e=>a.createElement(Ct.A,{direction:"column"},a.createElement("span",null,e?.value?e.value.toLocaleString():"0"),a.createElement("span",null,+(100*+e.value/+e.row.total).toFixed(1)+"%"))},{field:"age_31",headerName:"Age 31-45",display:"flex",filterable:!1,align:"right",width:100,headerAlign:"right",renderCell:e=>a.createElement(Ct.A,{direction:"column"},a.createElement("span",null,e?.value?e.value.toLocaleString():"0"),a.createElement("span",null,+(100*+e.value/+e.row.total).toFixed(1)+"%"))},{field:"age_46",headerName:"Age 46-60",display:"flex",filterable:!1,align:"right",width:100,headerAlign:"right",renderCell:e=>a.createElement(Ct.A,{direction:"column"},a.createElement("span",null,e?.value?e.value.toLocaleString():"0"),a.createElement("span",null,+(100*+e.value/+e.row.total).toFixed(1)+"%"))},{field:"age_60",headerName:"Age >60",display:"flex",filterable:!1,align:"right",width:100,headerAlign:"right",renderCell:e=>a.createElement(Ct.A,{direction:"column"},a.createElement("span",null,e?.value?e.value.toLocaleString():"0"),a.createElement("span",null,+(100*+e.value/+e.row.total).toFixed(1)+"%"))},{field:"actions",type:"actions",headerName:"Actions",display:"flex",filterable:!1,width:100,getActions:({id:e,row:t})=>[a.createElement(ra,{key:"dataset-detail",variant:"outlined",text:"Details",color:"primary",onClick:()=>o(t.key)})]}];return a.createElement(Ct.A,{spacing:2,direction:"column",sx:{marginTop:2}},a.createElement(vn.A,{variant:"h6",sx:{color:"#383838"}},"Details"),a.createElement(Ci.z,{autoHeight:!0,columns:c,pageSizeOptions:[10,25,50,100],rows:t,disableRowSelectionOnClick:!0,sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"8px"},".MuiDataGrid-cell:focus-within":{outline:"none"}}}),a.createElement(fp,{data:s,onClose:()=>o(""),onIndexChange:e=>{const n=t.findIndex(e=>e.key===r)+e,a=t.at(n)?.key;o(a)}}))};bp.propTypes={config:O().instanceOf(Object).isRequired};const vp=bp,Ap=()=>{const[e,t]=(0,a.useState)(!1),[n,i]=(0,a.useState)({});return a.createElement(_t.A,{sx:{padding:"32px",height:"calc(100% - 64px)",display:"flex",flexDirection:"column",overflow:"hidden"}},a.createElement(Ct.A,{direction:"row",spacing:3,alignItems:"center",justifyContent:"space-between",mb:1,sx:{height:"100%"}},a.createElement(vn.A,{variant:"h4",component:"h4",style:{fontWeight:500}},"Dataset Profiler"),a.createElement(E.A,{theme:I},a.createElement(y.A,{onClick:()=>t(e=>!e),startIcon:a.createElement(Vc.A,{fontSize:"small"}),color:e?"primary":"default"},"Filter"))),e&&a.createElement(dp,{onClose:e=>{if(t(!1),e){const t=Object.fromEntries(Object.entries(e).filter(e=>0!==e[1].length));i(t)}},filters:n,showFilterPanel:e}),a.createElement(up,{config:n}),a.createElement(vp,{config:n}))},wp=()=>a.createElement(p.sv,null),Cp={label:"",color:"#E7AF53",include_dataset:[],ethnicity:[],gender:[],isNew:!0,age_bucket:[],extra_filter:[],type:"MyAlva",uuid:"new"},Sp={label:"",color:"#EC7700",isNew:!0,type:"Sizeset",uuid:"new"},kp=({field:e="",options:t,onChange:n,disabled:i=!1,placeholder:l="",populationOptions:r,width:o=250,style:s=qe,existingNames:c=Le})=>{const[d,m]=(0,a.useState)(null),p=Boolean(d),[g,y]=(0,a.useState)([]),[x,f]=(0,a.useState)({}),b=1===g.length?g.map(e=>e?.label||""):`${g.length} ${e}s`;return(0,a.useEffect)(()=>{y(t)},[t]),a.createElement(E.A,{theme:I},a.createElement(Rn.A,{color:"default",disabled:i},0!==e.length&&a.createElement(aa.A,{id:`${e}-select-label`,sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},`${Fe(e)}`),a.createElement(u.A,{size:"small",value:0===g.length?"":b,autoComplete:"off",disabled:i,placeholder:l,onClick:e=>i?{}:m(e.currentTarget),label:"",sx:{padding:"0",minHeight:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:`${o}px`,boxSizing:"content-box",color:"#5F504D","&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"},".MuiInputBase-root":{fontSize:"14px"},...s}}),p&&a.createElement(on.Ay,{open:p,onClose:()=>{n(g),m(null)},anchorEl:d,anchorOrigin:{vertical:"bottom",horizontal:"left"},sx:{".MuiPaper-root":{width:o}}},a.createElement(Vn.A,{sx:{width:o}},g.map(e=>a.createElement(jt.A,{p:1,key:`population-option-${e?.label||e?.uuid||""}`},a.createElement("div",{style:{width:"150px",height:"30px",backgroundColor:e?.color||"#EC7700",color:"#FFFFFF",borderRadius:"3px",padding:"2px 5px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},title:e?.label||""},a.createElement("span",{style:{verticalAlign:"middle",lineHeight:"30px"}},e?.label||"")),a.createElement(h.A,{onClick:()=>(e=>{f(e)})(e),size:"small"},a.createElement(Pi.A,{fontSize:"small"})),a.createElement(h.A,{size:"small",onClick:()=>{return t=e.uuid,void y(e=>e.filter(e=>e.uuid!==t));var t}},a.createElement(Si.A,{fontSize:"small"})))),a.createElement(jt.A,{onClick:()=>{const t="Population"===e?Cp:Sp;f(t),y(e=>[...e,t])},sx:{color:"#EC7700"}},`+ New ${"Population"===e?"Population":e}`)))),0!==Object.keys(x).length&&a.createElement(vr,{open:0!==Object.keys(x).length,onClose:(e,t)=>((e,t)=>{const n=g.findIndex(t=>t.uuid===e.uuid);if("save"===t){const t=e.isNew?{...e,isNew:!1,uuid:`new-${Date.parse(new Date)}`}:e,a=g.toSpliced(n,1,t);y(a),f({})}else{if(e.isNew){const e=g.toSpliced(n,1);y(e)}f({})}})(e,t),rowDetail:x,populationOptions:{...r,type:"Population"===e?["MyAlva"]:["Sizeset"]},populationMap:{MyAlva:r?.dataset||[]},existingName:c}))};kp.propTypes={field:O().string,options:O().instanceOf(Array).isRequired,onChange:O().func.isRequired,populationOptions:O().instanceOf(Object).isRequired,style:O().instanceOf(Object),width:O().number,disabled:O().bool,placeholder:O().string,existingNames:O().instanceOf(Array)};const _p=kp,zp=({options:e,error:t=!1,value:n,onValueChange:i,width:l=530,style:r=qe,placeholder:o="",disabled:s=!1,field:c=""})=>{const[d,m]=(0,a.useState)([]),p=[...e.filter(e=>n.map(e=>e?.id||e?.collection).includes(e?.id)),...e.filter(e=>!n.map(e=>e?.id||e?.collection).includes(e?.id))];return(0,a.useEffect)(()=>{m(n)},[n]),a.createElement(E.A,{theme:I},a.createElement(Rn.A,{color:"primary",disabled:s},a.createElement(aa.A,{id:`${c}-select-label`,sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px","&.Mui-focused":{color:"rgba(0, 0, 0, 0.6)"}}},`${c}`),a.createElement(di.A,{value:d,multiple:!0,onChange:(e,t)=>{m(t),0===t.length&&i([])},selectOnFocus:!0,disableCloseOnSelect:!0,clearOnBlur:!0,onClose:()=>i(d),disabled:s,options:p,isOptionEqualToValue:(e,t)=>(t?.id||t?.collection)===(e?.id||e?.collection),getOptionLabel:e=>"string"==typeof e?e:e.inputValue?e.inputValue:e?.name||e?.label||"",renderOption:(e,t)=>a.createElement("li",e,t?.name||t?.label||t),sx:{width:l,".MuiOutlinedInput-root":{fontSize:"14px",padding:"3px 10px"}},renderValue:e=>`${e.length} Standards`,renderInput:e=>a.createElement(u.A,(0,kn.A)({},e,{label:"",placeholder:o,sx:{padding:0,height:"40px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid "+(t?"#FB4E3B":"#D9D9D9"),boxShadow:"inset 0px 0px 5px "+(t?"#FB4E3B":"#00000038"),boxSizing:"content-box",color:"#5F504D",...r,"&:before":{border:"none"},"&:after":{border:"none"},"&:hover:not(.Mui-disabled, .Mui-error):before":{border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"},".MuiInputBase-root":{fontSize:"14px",padding:"2px 10px"}}}))})))};zp.propTypes={options:O().instanceOf(Array).isRequired,error:O().bool,value:O().string.isRequired,onValueChange:O().func.isRequired,width:O().number,style:O().instanceOf(Object),placeholder:O().string,disabled:O().bool,field:O().string};const Rp=zp,Dp=({existingID:e,onProjectDetailupdate:t,isNew:n=!1,source:i})=>{const r=(0,p.Zp)(),o=(0,l.useSelector)(C),s=o?.permissions||[],[c,d]=(0,a.useState)({}),[m,u]=(0,a.useState)(!1),[g,E]=(0,a.useState)(""),[x,f]=(0,a.useState)(""),[b,v]=(0,a.useState)(!1),[A,w]=(0,a.useState)({}),[S,k]=(0,a.useState)({}),[_,z]=(0,a.useState)({}),[R,D]=(0,a.useState)(!1),O="manual-sizeset"===i?"sizeset":"insight",F=[...(_?.population||[]).map(e=>e?.label||""),...(_?.size_set||[]).map(e=>e?.label||""),...(_?.standard||[]).map(e=>e?.name||e?.label||"")];(0,a.useEffect)(()=>{jl({type:"MYALVA",return_tree:!0}).then(e=>{e?.data&&k(e.data)})},[]),(0,a.useEffect)(()=>{(0===Object.keys(A).length||A.unit===c?.unit&&A.unit_weight===c?.unit_weight)&&(b||0===g.length||g===c.title&&x===c.description)||md(e,{title:g,description:x,...A}).then(e=>{e&&(d(e),z({pom_x:e?.pom_x||"",pom_y:e?.pom_y||"",population:e?.population||[],standard:e?.standard||[],size_set:e?.size_set||[]}),v(!1),t(e?.sp_id||"",e?.population||[],e?.standard||[],e?.unit||"cm",[e?.pom_x||"",e?.pom_y||""],e?.avatars||[],e?.size_set||[]))})},[A,b]),(0,a.useEffect)(()=>{0!==e.length&&"new"!==e&&(async e=>Ye(`${Qe.THREE_D_AVATAR.project}/${e}/`))(e).then(e=>{e&&(E(e?.title||""),f(e?.description||""),w({unit:e?.unit||"cm",unit_weight:e?.unit_weight||"kg"}),d(e),z({pom_x:e?.pom_x||"",pom_y:e?.pom_y||"",population:e?.population||[],standard:e?.standard||[],size_set:e?.size_set||[]}),t(e?.sp_id||"",e?.population||[],e?.standard||[],e?.unit||"cm",[e?.pom_x||"",e?.pom_y||""],e?.avatars||[],e?.size_set||[]))})},[e]);const M=(e,t)=>{z(n=>({...n,[e]:t}))};return a.createElement(Ct.A,{direction:"column"},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center",mt:-1,sx:{height:"32px"}},a.createElement(y.A,{sx:{textTransform:"none",color:"#808080",fontWeight:400,padding:0,"&:hover":{color:"#EC7700",backgroundColor:"transparent"}},onClick:()=>r("../")},`View All ${Fe(O)}s`),n?a.createElement(ra,{onClick:()=>{md(e,{is_draft:!1}).then(t=>{t&&r(`../${e}`)})},color:"primary",text:`Save ${Fe(O)}`}):null),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",sx:{".MuiStack-root #edit-btn":{display:"none"},"&:hover":{".MuiStack-root #edit-btn":{display:"inline-flex"}}}},a.createElement("div",null,a.createElement(Ct.A,{direction:"row"},a.createElement(vn.A,{variant:"h4",sx:{fontSize:"30px"}},c?.title||""),a.createElement(h.A,{id:"edit-btn",size:"small",sx:{color:"#5F504D",width:"37px",height:"37px",marginLeft:"5px"},onClick:()=>v(!0)},a.createElement(zl.A,null))),c?.description&&0!==c.description.length&&a.createElement(vn.A,{variant:"body1",sx:{color:"#808080",fontSize:"14px"}},`Description: ${c?.description}`)),a.createElement(Ct.A,{direction:"column",alignItems:"end",spacing:1,mt:1},a.createElement(Fl,{label:"Measurement",options:["cm","inch"],value:A?.unit||"cm",color:"primary",onChange:e=>w(t=>({...t,unit:e}))}),a.createElement(Fl,{label:"Weight",options:["kg","lbs"],value:A?.unit_weight||"kg",color:"primary",style:{visibility:"hidden"},onChange:e=>w(t=>({...t,unit_weight:e}))}))),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"end"},a.createElement(Ct.A,{direction:"row",spacing:2,alignItems:"end",useFlexGap:!0,flexWrap:"wrap"},a.createElement(pi,{sx:{m:1,minWidth:200},field:"X Measurement",disabled:!m,value:od.find(e=>e.key===(m?_?.pom_x||"":c?.pom_x||""))||"",onChange:(e,t)=>M("pom_x",t.key),options:od}),a.createElement(pi,{sx:{m:1,minWidth:200},field:"Y Measurement",disabled:!m,value:od.find(e=>e.key===(m?_?.pom_y||"":c?.pom_y||""))||"",onChange:(e,t)=>M("pom_y",t.key),options:od}),s.includes("myalva_data")&&a.createElement(_p,{field:"Population",options:_?.population||[],populationOptions:S,disabled:!m,onChange:e=>M("population",e),existingNames:F}),s.includes("standard_data")&&a.createElement(Rp,{options:S?.standard||[],value:_?.standard||[],onValueChange:e=>M("standard",e),width:200,field:"Standard",disabled:!m}),s.includes("size_set_data")&&a.createElement(_p,{field:"Sizeset",options:_?.size_set||[],populationOptions:S,disabled:!m,onChange:e=>M("size_set",e),existingNames:F}),a.createElement(Ct.A,{direction:"row",spacing:2,sx:{marginBottom:"6px !important"}},m?a.createElement(a.Fragment,null,a.createElement(ra,{color:"primary",text:"Save",onClick:()=>{const{standard:n,...a}=_;n&&(a.standard=n.map((e,t)=>({collection:e?.id||e.collection,color:bl.at(t),label:e?.name||e.label}))),md(e,a).then(e=>{e&&(d(e),z({pom_x:e?.pom_x||"",pom_y:e?.pom_y||"",population:e?.population||[],standard:e?.standard||[],size_set:e?.size_set||[]}),u(!1),t(e?.sp_id||"",e?.population||[],e?.standard||[],e?.unit||"cm",[e?.pom_x||"",e?.pom_y||""],e?.avatars||[],e?.size_set||[]))})},disabled:(_?.population||[]).length+(_?.standard||[]).length>10}),a.createElement(ra,{color:"default",variant:"outlined",text:"Cancel",onClick:()=>{u(!1),z({pom_x:c.pom_x||"",pom_y:c.pom_y||"",population:c?.population||[],standard:c?.standard||[],size_set:c?.size_set||[]})}})):a.createElement(ra,{color:"primary",text:"Edit",onClick:()=>{u(!0)}}))),a.createElement(ei.A,{PopperProps:{disablePortal:!0},open:R,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:"You can add multiple populations or select multiple standards, but the total cannot exceed 10."},a.createElement(h.A,{"aria-label":"info",onClick:()=>D(!R),size:"small",sx:{borderRadius:"30px",height:"30px",width:"30px"}},a.createElement(ri.A,{size:"small"})))),a.createElement(qa.A,{open:b,maxWidth:"md",transitionDuration:0},a.createElement(La.A,null,"Edit Analysis Info"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(Ct.A,{direction:"column",spacing:2},a.createElement("div",{style:{width:"510px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Title"),a.createElement(si,{label:"title",placeholder:"Title",value:g,width:500,style:{marginRight:0},onChange:e=>E(e.target.value)})),a.createElement("div",null,a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Description"),a.createElement(si,{label:"description",value:x,multiline:!0,rows:10,width:500,onChange:e=>f(e.target.value),style:{minHeight:"200px",marginRight:0}}))))),a.createElement(Va.A,null,a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>{E(c?.title||""),f(c?.description||""),v(!1)}}),a.createElement(ra,{color:"primary",text:"Save",onClick:()=>{v(!1)}}))))};Dp.propTypes={existingID:O().string.isRequired,onProjectDetailupdate:O().func.isRequired,isNew:O().bool,source:O().string.isRequired};const Op=Dp,Fp=(0,Br.A)(Qr),Mp=({id:e,shouldRefresh:t,onClick:n=M()})=>{const[i,l]=(0,a.useState)([]),[r,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)([{x:[],y:[],mode:"markers",type:"scattergl",marker:{size:14,color:"#EC7700",symbol:"star-diamond",line:{color:"#000000",width:1}},name:"User selected"}]),[d,m]=(0,a.useState)({}),[p,u]=(0,a.useState)(!0),[g,h]=(0,a.useState)(!0),[E,y]=(0,a.useState)(1280),x=.49*(E-60),f=7*x/10.7,b={...d,width:x,height:f},v=(0,a.useRef)(),A=(0,a.useCallback)(e=>{if(!v.current)return;const t=v.current.getBoundingClientRect(),n=e.clientX-t.left-70,a=e.clientY-t.top-45;if(n<0||n>t.width||a<0||a>t.height)return;const i=d.xaxis.range||[0,6],l=d.yaxis.range||[0,6],r=n/(t.width-105)*(i[1]-i[0])+i[0],o=(1-a/(t.height-104))*(l[1]-l[0])+l[0];c(e=>{const t=[...e];return t[0]={...t[0],x:[r,...t[0].x],y:[o,...t[0].y]},t})},[d]),w=()=>{const e=document.getElementById("detail");y(e.offsetWidth)};return(0,a.useEffect)(()=>(w(),window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)}),[]),(0,a.useEffect)(()=>{t&&(u(!0),h(!0))},[t]),(0,a.useEffect)(()=>{var t;p&&g&&(t=e,h(!1),Nn(t,"THREE_D_AVATAR").then(e=>{if("done"===e?.task?.status||"failed"===e?.task?.status){const t=e?.result_data?JSON.parse(e.result_data):{},{layout:n,data:a}=t;l(a||[]),m(n||{}),u(!1)}else"pending"!==e?.task?.status&&"processing"!==e?.task?.status||h(!0)}))},[e,p,g]),a.createElement(Ct.A,{spacing:1,ref:v,onClick:r?A:M(),direction:"column",justifyContent:"space-between",sx:{width:"49%",position:"relative",height:`${f}px`,"div.modebar a[data-attr=self-selection] svg.icon path":{fill:r?"#EC7700 !important":"none",stroke:"none"}}},(0!==i.length||0!==Object.keys(d).length)&&a.createElement(Fp,{data:[...i,...s],onClick:r?M():n,layout:{...b},config:{modeBarButtonsToRemove:["select2d","lasso2d"],displaylogo:!1,webgl:{preserveDrawingBuffer:!1,alpha:!1,antialias:!1,powerPreference:"high-performance"},modeBarButtonsToAdd:[{name:"self-selection",attr:"self-selection",title:"Self-selection",icon:{width:25,height:25,path:"M3.3572 3.23397C3.66645 2.97447 4.1014 2.92638 4.45988 3.11204L20.7851 11.567C21.1426 11.7522 21.3542 12.1337 21.322 12.5351C21.2898 12.9364 21.02 13.2793 20.6375 13.405L13.7827 15.6586L10.373 22.0179C10.1828 22.3728 9.79826 22.5789 9.39743 22.541C8.9966 22.503 8.65762 22.2284 8.53735 21.8441L3.04564 4.29872C2.92505 3.91345 3.04794 3.49346 3.3572 3.23397ZM5.67123 5.99173L9.73507 18.9752L12.2091 14.361C12.3304 14.1347 12.5341 13.9637 12.7781 13.8835L17.7518 12.2484L5.67123 5.99173Z"},click:()=>o(e=>!e)},{name:"undo-selection",title:"Undo-selection",icon:{width:25,height:25,path:"M7.53033 3.46967C7.82322 3.76256 7.82322 4.23744 7.53033 4.53033L5.81066 6.25L15.0358 6.25C15.94 6.24999 16.6693 6.24998 17.2576 6.3033C17.864 6.35826 18.3938 6.47456 18.875 6.75241C19.4451 7.08154 19.9185 7.55492 20.2476 8.12499C20.5254 8.60624 20.6417 9.13604 20.6967 9.74239C20.75 10.3307 20.75 11.06 20.75 11.9643V12.0358C20.75 12.94 20.75 13.6693 20.6967 14.2576C20.6418 14.8639 20.5255 15.3937 20.2476 15.875C19.9185 16.4451 19.4451 16.9185 18.875 17.2476C18.3938 17.5254 17.864 17.6417 17.2576 17.6967C16.6693 17.75 15.94 17.75 15.0358 17.75H8.00001C7.58579 17.75 7.25001 17.4142 7.25001 17C7.25001 16.5858 7.58579 16.25 8.00001 16.25H15C15.9484 16.25 16.6096 16.2493 17.1222 16.2028C17.6245 16.1573 17.9101 16.0726 18.125 15.9486C18.4671 15.7511 18.7511 15.467 18.9486 15.125C19.0726 14.9101 19.1573 14.6245 19.2028 14.1222C19.2493 13.6096 19.25 12.9484 19.25 12C19.25 11.0516 19.2493 10.3904 19.2028 9.87779C19.1573 9.37548 19.0726 9.0899 18.9486 8.87499C18.7511 8.53295 18.467 8.24892 18.125 8.05144C17.9101 7.92737 17.6245 7.84271 17.1222 7.79718C16.6096 7.75072 15.9484 7.75 15 7.75H5.81066L7.53033 9.46967C7.82322 9.76256 7.82322 10.2374 7.53033 10.5303C7.23744 10.8232 6.76256 10.8232 6.46967 10.5303L3.46967 7.53033C3.17678 7.23744 3.17678 6.76256 3.46967 6.46967L6.46967 3.46967C6.76256 3.17678 7.23744 3.17678 7.53033 3.46967Z"},click:()=>{c(e=>{const t=[...e];return t[0]={...t[0],x:t[0].x.toSpliced(0,1),y:t[0].y.toSpliced(0,1)},t})}}]}}),p&&a.createElement(bi,{isLoading:p,isSingleChart:!0}))};Mp.propTypes={id:O().string.isRequired,shouldRefresh:O().bool.isRequired,onClick:O().func};const jp=Mp,Ip=()=>{const e=(0,p.zy)(),t=e.pathname.split("/")[1],n=e.pathname.split("/")[2],[i,l]=(0,a.useState)(""),[r,o]=(0,a.useState)([]),[s,c]=(0,a.useState)("cm"),[d,m]=(0,a.useState)([]),[u,g]=(0,a.useState)(""),[h,E]=(0,a.useState)([]),[y,x]=(0,a.useState)([]),[f,b]=(0,a.useState)([]),[v,A]=(0,a.useState)(1280),w=9*v/16,[C,S]=(0,a.useState)(!1),[k,_]=(0,a.useState)(!1),[z,R]=(0,a.useState)({}),[D,O]=(0,a.useState)({}),[F,j]=(0,a.useState)(!1),I=()=>{const e=document.getElementById("draft-page-avatar-container");A(e.offsetWidth)};return(0,a.useEffect)(()=>(I(),window.addEventListener("resize",I),()=>{window.removeEventListener("resize",I)}),[]),(0,a.useEffect)(()=>{E([]),x([]),b([]),"new"===n?(async e=>Ye(Qe.THREE_D_AVATAR.checkDraft,e))("manual-sizeset"===t?{type:"manual_sizeset"}:{}).then(e=>l(e?.id||"new")):l(n)},[n,t]),(0,a.useEffect)(()=>{C&&setTimeout(()=>S(!1),1e3)},[C]),(0,a.useEffect)(()=>{"new"===i?dd({title:"New "+("manual-sizeset"===t?"Sizeset":"Insight"),unit:"cm",unit_weight:"kg",type:"manual-sizeset"===t?"manual_sizeset":"3d_analysis"}).then(e=>l(e?.id||"new")):0!==i.length&&pd(i).then(e=>{e?.avatars&&o(e.avatars)})},[i]),a.createElement(Ct.A,{direction:"column",spacing:2,sx:{p:"20px"}},a.createElement(Op,{existingID:i,onProjectDetailupdate:(e,t,n,a,i,l,r)=>{0!==e.length&&(g(e),S(!0)),E(t),x(n),b(r),o(l),c(a),m(i)},isNew:"new"===n,source:t}),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},0!==u.length?a.createElement(jp,{id:u,shouldRefresh:C,onClick:k?e=>{const{points:t}=e,{x:n,y:a}=t[0];R({[d[0]]:n,[d[1]]:a})}:M()}):a.createElement(Ct.A,{direction:"column",alignItems:"center",spacing:1,sx:{width:"49%"}},a.createElement(tl.A,{sx:{width:"130px",height:"130px"}},a.createElement("svg",{id:"layer1","data-name":"layer1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 95 95"},a.createElement("g",null,a.createElement("path",{fill:"#bfbfbf",d:"m92.59,90.89h-11.62v-4.2c0-.94-.76-1.7-1.7-1.7s-1.7.76-1.7,1.7v4.2h-15.81v-4.2c0-.94-.76-1.7-1.7-1.7s-1.7.76-1.7,1.7v4.2h-15.81v-4.2c0-.94-.76-1.7-1.7-1.7s-1.7.76-1.7,1.7v4.2h-15.81v-4.2c0-.94-.76-1.7-1.7-1.7s-1.7.76-1.7,1.7v4.2H6.52l49.5-49.5c.66-.66.66-1.74,0-2.41-.67-.67-1.74-.67-2.41,0L4.11,88.48v-13.4h4.2c.94,0,1.7-.76,1.7-1.7s-.76-1.7-1.7-1.7h-4.2v-15.81h4.2c.94,0,1.7-.76,1.7-1.7s-.76-1.7-1.7-1.7h-4.2v-15.81h4.2c.94,0,1.7-.76,1.7-1.7s-.76-1.7-1.7-1.7h-4.2v-15.81h4.2c.94,0,1.7-.76,1.7-1.7s-.76-1.7-1.7-1.7h-4.2V2.41c0-.94-.76-1.7-1.7-1.7s-1.7.76-1.7,1.7v90.19c0,.11.01.22.03.33,0,.05.03.09.04.14.02.06.03.12.06.18.02.05.05.1.08.15.03.05.05.1.08.15.05.08.11.14.17.21.01.02.02.03.04.05.01.01.03.02.04.03.07.07.14.13.22.18.04.03.09.05.14.07.05.03.1.06.16.08.06.02.12.04.18.05.05.01.09.03.14.04.11.02.22.03.33.03h90.19c.94,0,1.7-.76,1.7-1.7s-.76-1.7-1.7-1.7Z"}),a.createElement("path",{fill:"#bfbfbf",d:"m68.95,27.75c.44,0,.87-.17,1.2-.5l17.25-17.25c.66-.66.66-1.74,0-2.41-.67-.67-1.74-.67-2.41,0l-17.25,17.25c-.66.66-.66,1.74,0,2.41.33.33.77.5,1.2.5Z"}),a.createElement("path",{fill:"#bfbfbf",d:"m59.6,37.1c.44,0,.87-.17,1.2-.5l4.11-4.11c.66-.66.66-1.74,0-2.41-.67-.67-1.74-.67-2.41,0l-4.11,4.11c-.66.66-.66,1.74,0,2.41.33.33.77.5,1.2.5Z"})),a.createElement("g",null,a.createElement("circle",{fill:"#bfbfbf",cx:"46.26",cy:"19.46",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"43.29",cy:"41.9",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"62.05",cy:"55.52",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"19.1",cy:"65.56",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"46.26",cy:"69.84",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"86.2",cy:"21.49",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"67.59",cy:"14.99",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"75.54",cy:"37.42",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"81.02",cy:"55.52",r:"4.48"}),a.createElement("circle",{fill:"#bfbfbf",cx:"26.57",cy:"39.48",r:"4.48"})))),a.createElement(vn.A,{variant:"body1"},"Add populations / standards / avatars to the plot.")),a.createElement(Ct.A,{id:"draft-page-avatar-container",sx:{height:w,width:"49%"}},0===r.length?a.createElement(Ct.A,{direction:"column",alignItems:"center",justifyContent:"center",spacing:1,sx:{width:"100%",height:"100%"}},a.createElement(tl.A,{sx:{width:"130px",height:"130px"}},a.createElement("svg",{id:"layer2","data-name":"layer2",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 95 95"},a.createElement("g",null,a.createElement("path",{fill:"#bfbfbf",d:"m2.41,28.25c-.94,0-1.7-.76-1.7-1.7V2.41c0-.94.76-1.7,1.7-1.7h24.14c.94,0,1.7.76,1.7,1.7s-.76,1.7-1.7,1.7H4.11v22.44c0,.94-.76,1.7-1.7,1.7Z"}),a.createElement("path",{fill:"#bfbfbf",d:"m92.59,28.25c-.94,0-1.7-.76-1.7-1.7V4.11h-22.44c-.94,0-1.7-.76-1.7-1.7s.76-1.7,1.7-1.7h24.14c.94,0,1.7.76,1.7,1.7v24.14c0,.94-.76,1.7-1.7,1.7Z"}),a.createElement("path",{fill:"#bfbfbf",d:"m92.59,94.29h-24.14c-.94,0-1.7-.76-1.7-1.7s.76-1.7,1.7-1.7h22.44v-22.44c0-.94.76-1.7,1.7-1.7s1.7.76,1.7,1.7v24.14c0,.94-.76,1.7-1.7,1.7Z"}),a.createElement("path",{fill:"#bfbfbf",d:"m26.55,94.29H2.41c-.94,0-1.7-.76-1.7-1.7v-24.14c0-.94.76-1.7,1.7-1.7s1.7.76,1.7,1.7v22.44h22.44c.94,0,1.7.76,1.7,1.7s-.76,1.7-1.7,1.7Z"})),a.createElement("path",{fill:"#bfbfbf",d:"m52.79,94.28c-.62,0-1.1,0-1.58,0-.63-.02-.86-.27-.98-.89-.13-.65-.05-1.26.21-1.86.09-.22.13-.44.09-.68-.1-.56-.07-1.12-.06-1.68.02-1.7-.17-3.38-.38-5.06-.16-1.29-.3-2.58-.46-3.87-.23-1.83-.33-3.67-.28-5.51.02-.58.07-1.16.11-1.73.06-.89-.13-1.75-.29-2.61-.15-.82-.2-1.65-.27-2.48-.07-.83-.14-1.66-.2-2.48-.01-.13-.02-.26-.02-.39.03-1.1-.03-2.21-.07-3.31-.06-1.41-.17-2.81-.31-4.22-.16-1.61-.21-3.23-.17-4.85,0-.23-.02-.43-.26-.53-.25-.1-.49-.12-.73.02-.16.09-.25.24-.25.44,0,.21-.02.43,0,.65.15,1.65-.11,3.28-.22,4.92-.09,1.32-.2,2.64-.25,3.97-.04,1.19,0,2.37-.1,3.56-.08,1.02-.2,2.05-.26,3.07-.06,1.04-.32,2.05-.45,3.08-.08.62-.04,1.25,0,1.88.06,1.14.13,2.27.06,3.42-.06.95-.13,1.9-.24,2.85-.13,1.15-.28,2.3-.41,3.45-.12.96-.22,1.93-.32,2.9-.13,1.19-.1,2.39-.11,3.59,0,.16-.03.32-.05.47-.07.51-.05.99.18,1.47.29.62.16,1.27,0,1.9-.06.26-.26.43-.54.48-.21.04-.42.06-.64.06-.84,0-1.68,0-2.53,0-.33,0-.72,0-.86-.39-.12-.35.12-.62.34-.86.39-.44.8-.87.87-1.5.01-.1.04-.21.02-.31-.08-.52-.03-1.04,0-1.57.06-1.22-.16-2.42-.35-3.62-.2-1.33-.39-2.67-.62-3.99-.24-1.35-.41-2.72-.58-4.08-.16-1.29-.16-2.59-.1-3.89.08-1.67.38-3.32.36-5-.02-2-.2-3.99-.57-5.96-.47-2.5-.85-5.02-1.23-7.53-.31-2.04-.43-4.09-.38-6.15.02-.94.11-1.88.24-2.82.27-2.02.52-4.04.94-6.04.34-1.59.68-3.18,1.01-4.78.16-.78.13-1.56.08-2.35-.04-.61-.08-1.21-.12-1.82-.07-1.06-.24-2.1-.39-3.14-.16-1.09-.31-2.19-.51-3.27-.04-.23-.14-.44-.25-.65-.1-.2-.23-.22-.35-.02-.23.4-.45.8-.65,1.21-.81,1.75-1.78,3.42-2.71,5.1-.67,1.21-1.34,2.42-1.95,3.66-.55,1.12-1.21,2.17-1.88,3.22-.79,1.23-1.62,2.43-2.54,3.56-.65.8-1.31,1.58-1.93,2.41-.51.69-.88,1.43-.94,2.31-.04.56-.37,1.02-.64,1.48-.32.54-.61,1.09-.89,1.65-.06.12-.1.25-.19.34-.34.35-.37.77-.36,1.22,0,.32-.03.63-.07.95-.02.23-.12.43-.29.59-.23.2-.41.2-.58-.06-.28-.42-.42-.9-.57-1.37-.26-.84-.23-1.71-.19-2.58.04-.88.32-1.67.79-2.39.2-.31.45-.6.69-.89.82-1,1.28-2.19,1.74-3.38.66-1.7,1.33-3.4,2.02-5.08.54-1.31,1.09-2.61,1.84-3.81.26-.41.54-.81.81-1.21.63-.9,1.09-1.9,1.6-2.86.76-1.42,1.47-2.86,2.21-4.29.45-.87.76-1.79,1.07-2.71.41-1.22.9-2.41,1.82-3.35.61-.63,1.35-1.1,2.17-1.4,1.11-.41,2.23-.81,3.34-1.23.54-.2,1.07-.45,1.61-.67.26-.11.42-.29.51-.56.19-.61.21-1.25.25-1.88,0-.12-.04-.22-.11-.31-.39-.51-.66-1.08-.83-1.7-.1-.39-.4-.65-.59-.98-.31-.54-.49-1.13-.63-1.73-.06-.26-.02-.53.13-.76.11-.17.13-.34.14-.53.02-.66-.04-1.33.05-1.99.1-.76.45-1.4.93-1.98.89-1.07,2.08-1.59,3.42-1.78.9-.13,1.74.16,2.55.53.99.45,1.73,1.16,2.23,2.13.26.51.39,1.05.42,1.62.02.46.04.92-.03,1.37-.04.23.03.45.15.64.14.23.2.48.13.75-.21.78-.41,1.56-.95,2.19-.31.36-.32.86-.54,1.26-.11.2-.18.45-.33.62-.29.32-.36.68-.32,1.09.05.53.08,1.06.28,1.57.07.18.18.33.36.4,1.37.59,2.76,1.16,4.18,1.62,1.2.38,2.3.93,3.17,1.88.61.67,1.05,1.45,1.33,2.29.63,1.84,1.36,3.63,2.28,5.33.9,1.67,1.73,3.38,2.68,5.02.39.68.91,1.28,1.29,1.97.62,1.12,1.14,2.29,1.64,3.48.88,2.09,1.66,4.21,2.51,6.31.39.98.98,1.82,1.64,2.63.71.87,1.1,1.86,1.09,3-.01.62.06,1.24-.06,1.85-.12.65-.36,1.26-.67,1.84-.18.34-.44.34-.69.06-.12-.14-.19-.29-.21-.48-.04-.45-.08-.89-.06-1.34,0-.23-.05-.44-.2-.63-.32-.4-.51-.87-.73-1.32-.33-.65-.78-1.24-1.04-1.92-.1-.25-.16-.5-.17-.76-.02-.62-.33-1.14-.64-1.65-.57-.91-1.27-1.71-1.95-2.53-.67-.81-1.29-1.65-1.89-2.51-.93-1.37-1.84-2.75-2.6-4.23-.5-.96-1.02-1.91-1.53-2.87-1.02-1.92-2.14-3.77-3.08-5.73-.27-.56-.54-1.11-.84-1.65-.14-.25-.24-.25-.38.01-.23.45-.3.94-.38,1.43-.23,1.46-.46,2.92-.65,4.38-.1.78-.13,1.56-.19,2.35-.02.25-.04.5-.06.75-.1,1.48.16,2.92.5,4.36.46,1.98.89,3.96,1.17,5.97.18,1.32.37,2.65.51,3.98.13,1.24.18,2.48.12,3.73-.09,1.77-.3,3.54-.58,5.29-.44,2.71-.89,5.43-1.36,8.14-.13.77-.18,1.56-.2,2.34-.02.79-.03,1.57-.04,2.36-.02,1.07.17,2.12.25,3.18.02.33.06.65.08.98.1,1.51.04,3-.14,4.5-.34,2.76-.84,5.49-1.24,8.24-.12.81-.24,1.63-.28,2.45-.04.85,0,1.7.05,2.55.03.48.29.88.62,1.23.21.21.43.42.54.71.15.39,0,.67-.41.75-.59.12-1.19.02-1.64.06Z"}))),a.createElement(vn.A,{variant:"body1"},"Add avatars and data to generate 3D models.")):a.createElement(Ud,{obj:r,shouldRefresh:C,source:"THREE_D_AVATAR",canvasHeight:w,canvasWidth:v,onErrorMsgUpdate:e=>{O(t=>({...t,...e})),j(!1)}}))),a.createElement(wd,{existingID:i,populations:h,standards:y,sizesets:f,isValidatingAvatars:F,avatars:0===r.length?[]:r,onSave:e=>{j(!0),(async(e,t)=>Je(`${Qe.THREE_D_AVATAR.avatar}/${t}/`,e))({avatars:e},i).then(t=>{if(t?.avatars)o(t.avatars),S(!0),O({}),j(!1);else if(t?.detail){const n=t.detail?.avatars||{},a=Object.fromEntries(Object.keys(n).map(t=>[e[t]?.id||"",Object.entries(n[t]).map(([e,t])=>`${e}: ${t[0]}`).join(", ")]));O(a)}})},unit:s,selectedPoms:d,onPomValSelect:e=>{e||R({}),_(e)},selectedPomVal:z,errMsg:D,onErrorMsgClear:()=>O({})}))},Tp=({onSearch:e,styles:t,params:n=qe,onParamsChange:i=M(),headerInUse:l})=>{const r=(0,p.Zp)(),o=(0,p.zy)().pathname.split("/")[1]||"insight",[s,c]=(0,a.useState)(""),[d,m]=(0,a.useState)({}),u=l.filter(e=>e.sortable),[E,y]=(0,a.useState)([]),x="manual-sizeset"===o?"sizeset":"insight",f=u.map(e=>"creation_date"===e.id||"created_at"===e.id?{key:e.id,value:e.label,children:[{key:`-${e.id}`,value:"Newest first"},{key:e.id,value:"Oldest first"}]}:{key:e.id,value:e.label,children:[{key:e.id,value:"A-Z"},{key:`-${e.id}`,value:"Z-A"}]});return(0,a.useEffect)(()=>{const t=setTimeout(()=>{e(s)},1e3);return()=>clearTimeout(t)},[s]),(0,a.useEffect)(()=>{da().then(e=>{e?.results&&y(e.results)})},[]),a.createElement(Ct.A,{spacing:1,direction:"column",sx:t},a.createElement(_t.A,{sx:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}},a.createElement("div",{style:{padding:"0 10px"}},a.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},a.createElement(vn.A,{variant:"h4",component:"h4",style:{paddingRight:"15px"}},"manual-sizeset"===o?"Manual Sizesets":"3D Model Insights"),a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:`Add New ${Fe(x)}`,color:"primary",onClick:()=>{dd({title:`New ${Fe(x)}`,unit:"cm",unit_weight:"kg",type:"manual-sizeset"===o?"manual_sizeset":"3d_analysis"}).then(e=>{e&&r("./new")})}}))),a.createElement("div",null,a.createElement(Fn,{label:"Search",placeholder:`Search ${Fe(x)} Name`,onChange:e=>c(e.target.value),startAdornment:a.createElement(g.A,{position:"start"},a.createElement(Cn.A,null)),endAdornment:a.createElement(g.A,{position:"end"},a.createElement(h.A,{onClick:()=>c(""),sx:{visibility:0===s.length?"hidden":"visible"}},a.createElement(Sn.A,{fontSize:"small"}))),style:{width:"300px"},value:s}))),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{paddingLeft:"10px"}},a.createElement(Ct.A,{spacing:1,direction:"row",sx:{marginRight:"34px"},alignItems:"center"},a.createElement(z.A,{size:"small",label:"All",onClick:()=>i("view_by","all"),sx:{backgroundColor:"all"===n?.view_by?"rgba(255, 141, 26, 0.4)":"rgba(229, 229, 229, 0.42)",color:"all"===n?.view_by?"#000000":"#808080",borderRadius:"8px"}}),a.createElement(z.A,{size:"small",label:"Starred",onClick:()=>i("view_by","is_favorites"),sx:{backgroundColor:"is_favorites"===n?.view_by?"rgba(255, 141, 26, 0.4)":"rgba(229, 229, 229, 0.42)",color:"is_favorites"===n?.view_by?"#000000":"#808080",borderRadius:"8px"}}),a.createElement(z.A,{size:"small",label:"My",onClick:()=>i("view_by","is_my"),sx:{backgroundColor:"is_my"===n?.view_by?"rgba(255, 141, 26, 0.4)":"rgba(229, 229, 229, 0.42)",color:"is_my"===n?.view_by?"#000000":"#808080",borderRadius:"8px"}})),a.createElement(Ct.A,{spacing:1,direction:"row"},a.createElement(fa,{label:"Created by",field:"created_by__in",onChange:e=>i("created_by__in",e),options:E,selected:n?.created_by__in||[]}),a.createElement(ca,{value:d,onChange:e=>{m(e),i("created_at__gte",e.datetime_gte),i("created_at__lte",e.datetime_lte)},type:"button"}),a.createElement(Yn,{label:"Sort by",field:"ordering",selected:n?.ordering||"-created_at",options:f,onChange:e=>i("ordering",e),hasSecondLevel:!0}))))};Tp.propTypes={onSearch:O().func.isRequired,styles:O().instanceOf(Object).isRequired,params:O().instanceOf(Object),onParamsChange:O().func,headerInUse:O().instanceOf(Array).isRequired};const Bp=Tp,$p=(0,Ma.Ay)(Oa.A)(()=>({[`&.${Fa.A.root}`]:{color:"#544744"},[`&.${Fa.A.head}`]:{fontSize:"16px"}})),Np=(0,Ma.Ay)(Aa.A)(()=>({height:"100px",width:"100%",borderRadius:"10px",position:"relative","&:hover":{"&::after":{content:'""',display:"block",position:"absolute",boxShadow:"0px 0px 3px 3px rgba(236, 119, 0, 0.66)",height:"calc(100% - 6px)",width:"calc(100% - 8px)",borderRadius:"10px",left:"3px",top:"3px"}},"&:nth-of-type(even)":{backgroundColor:"rgba(236, 119, 0, 0.05)"}})),qp=({data:e,onViewMoreClicked:t,totalCount:n,listHeight:i,onAnalysisDelete:l,onProjectStarred:r,viewBy:o,hasFilterOptions:s,headerInUse:c})=>a.createElement(wa.A,{key:"avatar-list-table",id:"avatar-list-table",style:{backgroundColor:"#FFFFFF",color:"#544744",position:"relative",width:"auto",...i},component:"div"},a.createElement(Ca.A,{stickyHeader:!0,"aria-label":"avatar-list-table",component:"div"},a.createElement(Sa.A,{component:"div"},a.createElement(Aa.A,{component:"div"},a.createElement($p,{component:"div"}," "),c.map(e=>a.createElement($p,{key:e.label,component:"div"},e.label)),a.createElement($p,{component:"div"}," "))),a.createElement(ka.A,{component:"div"},0!==e.length&&e.map(e=>a.createElement(Np,{key:e.id,component:m.N_,to:`./${e.id}`,sx:{"#del-btn":{visibility:"hidden"},"&:hover":{"#del-btn":{visibility:"visible"}}}},a.createElement($p,{align:"left",component:"div"},a.createElement(h.A,{size:"small",sx:{color:"#5F504D",zIndex:1},onClick:t=>{t.preventDefault(),r(e,!e?.is_favorites)}},e?.is_favorites?a.createElement(Da.A,{fontSize:"small"}):a.createElement(za.A,{fontSize:"small"}))),c.map(t=>a.createElement($p,{align:"left",key:`${t.name}-${e.acid}-${t.id}`,style:{fontWeight:"acid"===t.id||"client"===t.id?"600":"400"},component:"div"},"created_by"===t.id?U(e[t.id]):Y(t.id,e[t.id])||"N/A")),a.createElement($p,{align:"left",component:"div"},a.createElement(h.A,{id:"del-btn",size:"small",sx:{color:"#5F504D",zIndex:588},onClick:t=>{t.preventDefault(),l(e.id,e.title)}},a.createElement(Ra.A,null)))))),0===n&&s&&a.createElement(Oa.A,{colSpan:8,rowSpan:8,sx:{padding:0}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 250px)",justifyContent:"center"}},a.createElement(vn.A,{variant:"h5"},"No Results"))),0===n&&!s&&a.createElement(Oa.A,{colSpan:8,rowSpan:8,sx:{padding:0}},a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",height:"calc(100vh - 250px)",justifyContent:"center"}},a.createElement(vn.A,{variant:"h5"},`No${"is_favorites"===o?" starred":""} insights${"is_my"===o?" created by you":""}`),"is_favorites"===o?a.createElement("p",null,"Add stars to insights that you want to easily find later"):a.createElement("p",null,`Start adding${"is_my"===o?" your":""} insights by clicking the Add New Insights button above`))),e.length{const[e,t]=(0,a.useState)([]),[n,i]=(0,a.useState)({view_by:"all",page:1}),l=(0,p.zy)().pathname.split("/")[1]||"insight",r="manual-sizeset"===l?H:V,[o,s]=(0,a.useState)(-1),[c,d]=(0,a.useState)(1),[m,u]=(0,a.useState)(window.scrollY),[g,h]=(0,a.useState)(!0),[E,y]=(0,a.useState)({}),x=0!==Object.keys(E).length,f="manual-sizeset"===l?"sizeset":"insight",{view_by:b,page:v,search:A,ordering:w,...C}=n,S=0!==Object.keys(C).length&&!Object.values(C).includes("All"),k=()=>{const a={...n};"manual-sizeset"===l&&(a.type="manual_sizeset"),cd(a).then(a=>{if(a){if(n?.page&&n.page!==c&&1!==n.page){const i=a?.data||[];t([...e,...i]),d(n.page)}else t(a?.data||[]);s(a?.count||0)}})};(0,a.useEffect)(()=>{0!==Object.keys(n).length&&k()},[n]);const _=()=>{const e=document.getElementById("avatar-list-table");if(e.getElementsByClassName("MuiTable-root")[0].offsetHeight>e.offsetHeight+200){const t=e.scrollTop;h(m>t),u(t)}};(0,a.useEffect)(()=>{const e=document.getElementById("avatar-list-table");return e.addEventListener("scroll",_),()=>{e.removeEventListener("scroll",_)}});const z=g?{top:0,transition:"top 0.3s ease-out",position:"relative"}:{top:"-62px",transition:"top 0.3s ease-out",position:"relative"},R=g?{top:0,transition:"top 0.3s ease-out",height:"calc(100vh - 180px)"}:{top:"-93px",transition:"top 0.3s ease-out",height:"calc(100vh - 93px)"};return a.createElement(_t.A,{sx:{p:"20px",height:"calc(100vh - 100px)",position:"relative",overflowY:"hidden"}},a.createElement(Bp,{onSearch:e=>{i({...n,search:e,page:1}),d(1)},styles:z,params:n,onParamsChange:(e,t)=>{if(n?.[e]!==t)if("All"===t){const{...t}=n;delete t[e],i({...t,page:1}),d(1)}else i(n=>({...n,[e]:t,page:1})),d(1)},headerInUse:r}),a.createElement(Lp,{data:e,onViewMoreClicked:()=>{return e=c,void i({...n,page:e+1});var e},totalCount:o,listHeight:R,viewBy:b||"all",onAnalysisDelete:(e,t)=>y({id:e,title:t}),hasFilterOptions:S,onProjectStarred:(e,t)=>{const n={id:e.id,model_type:"Insights3DFavorites",option_type:t?"Add":"Cancel"};gn(n).then(e=>{!0===e?.status&&k()})},headerInUse:r}),a.createElement(qa.A,{onClose:()=>y({}),open:x,transitionDuration:0},a.createElement(La.A,null,`Delete ${Fe(f)}`),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},'Are you sure to delete the "',a.createElement("b",null,E?.title||""),`" ${f}?`),a.createElement(Wa.A,{id:"alert-dialog-description"},`After deleting, you will not be able to restore the ${f} and others won't be able to see the ${f} in the system.`)),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",color:"default",variant:"outlined",onClick:()=>y({})}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>{(async e=>Xe(`${Qe.THREE_D_AVATAR.project}/${e}/`))(E.id).then(e=>{e&&(k(),y({}))})}}))))},Wp=()=>{const e=(0,p.Zp)(),[t,n]=(0,a.useState)([]),[i,r]=(0,a.useState)(!0),[o,s]=(0,a.useState)(!0),[c,d]=(0,a.useState)([]),m=(0,l.useSelector)(ie),[u,g]=(0,a.useState)(!1),[h,E]=(0,a.useState)(1280),y=9*h/16,x=e=>{s(!1);const t={analysis:e};g(!0),(async e=>Ye(Qe.MYALVA.model3D,e))(t).then(e=>{"done"===e?.task_status?(n(e?.data||[]),r(!1),g(!1),d(e?.settings_3d_model||[])):"pending"===e?.task_status&&s(!0)})},f=()=>{const e=document.getElementById("analysis-avatar-container");E(e.offsetWidth)};return(0,a.useEffect)(()=>(f(),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}),[]),(0,a.useEffect)(()=>{r(!0),s(!0)},[m]),(0,a.useEffect)(()=>{i&&o&&x(m.id)},[m,i,o]),a.createElement(Ct.A,{id:"analysis-avatar-container",direction:"column",sx:{width:"calc(100% - 40px)",margin:"20px",minHeight:"400px"}},i?a.createElement(bi,{isLoading:i,isSingleChart:!0}):a.createElement(a.Fragment,null,a.createElement(Ct.A,{sx:{height:y,width:"100%",maxHeight:"600px"}},a.createElement(Ud,{obj:t,avatarSettings:c,source:"MYALVA",shouldRefresh:u,onMoveClicked:()=>{const t={title:`Analysis 3D Model Insight - ${_e(new Date)}`,description:"Created from Analysis",unit:m?.unit||"cm",settings_3d_model:c,unit_weight:m?.unit_weight||"kg",source:"analysis",source_id:m.id};dd(t).then(t=>{t&&e("../../../3d-model/new")})},canvasHeight:y>600?600:y,canvasWidth:h,onThreeDSettingsChange:e=>{r(!0),(async e=>Je(Qe.MYALVA.model3D,e))({analysis:m.id,settings_3d_model:e}).then(e=>{e?.status?x(m.id):r(!1)})}})),a.createElement(wd,{readOnly:!0,avatars:0===t.length?[]:t,unit:m?.unit||"cm"})))},Vp=(0,a.forwardRef)(({id:e,item:t,disabled:n=!0,withOpacity:i=!1,isDragging:l,style:r=qe,index:o=0,onEditClick:s=M(),onDelete:c=M(),isSingleAvatar:d=!1,...m},p)=>{const u={opacity:i?"0.5":"1",padding:"16px",border:"1px solid #DBDBDB",background:"#FDFDFD",borderRadius:"10px",width:"190px",height:d?"120px":"100px",display:"flex",flexDirection:"column",color:"#8c8c8c",cursor:n&&!l?"poniter":"move",boxShadow:l?"rgb(63 63 68 / 5%) 0px 2px 0px 2px, rgb(34 33 81 / 15%) 0px 2px 3px 2px":"rgb(63 63 68 / 5%) 0px 0px 0px 1px, rgb(34 33 81 / 15%) 0px 1px 3px 0px",transform:l?"scale(1.05)":"scale(1)",...r};return a.createElement("div",(0,kn.A)({ref:p,style:u},m),a.createElement(Ct.A,{direction:"row",alignItems:"center",spacing:1},a.createElement("div",{style:{width:"5px",height:"16px",backgroundColor:t.color,borderRadius:"0 3px 3px 0",display:"inline-block",margin:"3px 5px 3px -16px",verticalAlign:"baseline"}}," "),a.createElement("div",{style:{display:"inline-block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"180px",fontWeight:700,lineHeight:"24px",color:"#5F504D"},title:t.label},t.label),!n&&a.createElement(a.Fragment,null,a.createElement(h.A,{sx:{color:"#5F504D",padding:0},size:"small",onClick:()=>s(o)},a.createElement(zl.A,{size:"small"})),a.createElement(h.A,{sx:{color:"#FB4E3B",padding:0},size:"small",onClick:()=>c(o)},a.createElement(Ra.A,{size:"small"})))),a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Body Type: ${t?.body_type||"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Body Type: ${t?.body_type||"N/A"}`),d?a.createElement(a.Fragment,null,a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Size: ${t?.size||t?.avatar?.size||"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Size: ${t?.size||t?.avatar?.size||"N/A"}`),a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`VBID: ${t?.vbid||"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`VBID: ${t?.vbid||"N/A"}`)):a.createElement(vn.A,{noWrap:!0,variant:"caption",title:`Size Range: ${t?.size_range&&0!==t.size_range.length?t.size_range.join("-"):"N/A"}`,sx:{width:"190px",display:"inline-block",fontSize:"14px"}},`Size Range: ${t?.size_range&&0!==t.size_range.length?t.size_range.join("-"):"N/A"}`),a.createElement(Ct.A,{direction:"row",justifyContent:"space-between",alignItems:"center"},a.createElement(z.A,{size:"small",label:"ABP"===t.type?"Standard":t.type,sx:{backgroundColor:"rgba(229, 229, 229, 1)",color:"#000000",width:"Manual Sizeset"===t.type?"60%":"40%",fontSize:"14px",borderRadius:"5px",marginTop:"5px",span:{padding:0}}})))});Vp.propTypes={id:O().string.isRequired,withOpacity:O().bool,isDragging:O().bool.isRequired,item:O().instanceOf(Object).isRequired,disabled:O().bool,index:O().number,onEditClick:O().func,onDelete:O().func,isSingleAvatar:O().bool,style:O().instanceOf(Object)};const Hp=Vp,Gp=({item:e,disabled:t,id:n,index:i,onEditClick:l,onDelete:r,isSingleAvatar:o})=>{const{isDragging:s,attributes:c,listeners:d,setNodeRef:m,transform:p,transition:u}=(0,Bl.gl)({id:n}),g={transform:Pl.Ks.Transform.toString(p),transition:u||void 0};return a.createElement(Hp,(0,kn.A)({ref:m,style:g,id:n,withOpacity:s,item:e,index:i,onEditClick:l,onDelete:r,disabled:t,isDragging:s,isSingleAvatar:o},c,d))},Up=({populations:e,disabled:t,onEditClick:n,onDelete:i,onOrderChange:l,onAddClicked:r,isSingleAvatar:o=!1})=>{const[s,c]=(0,a.useState)([]),[d,m]=(0,a.useState)(null),[p,u]=(0,a.useState)({}),g=(0,Tl.FR)((0,Tl.MS)(Tl.cA,{activationConstraint:{distance:5}}),(0,Tl.MS)(Tl.IG),(0,Tl.MS)(Tl.AN,{activationConstraint:{distance:5}}));return(0,a.useEffect)(()=>{c(e)},[e]),a.createElement(Tl.Mp,{sensors:g,collisionDetection:Tl.fp,onDragEnd:e=>{const{active:t,over:n}=e;if(t.id!==n.id){const e=s.map(e=>e.uuid),a=e.indexOf(t.id),i=e.indexOf(n.id),r=(0,Bl.be)(s,a,i);c(r),l(r)}},onDragStart:e=>{m(e.active.id),u(s.find(t=>t.uuid===e.active.id))},onDragCancel:()=>{m(null),u({})}},a.createElement(Bl.gB,{items:s,strategy:Bl.kL,disabled:t},a.createElement(Ct.A,{direction:"row",useFlexGap:!0,flexWrap:"wrap",spacing:1,mt:.5},0!==s.length&&s.map((e,l)=>a.createElement(Gp,{key:`${e?.label}-${e?.size||l}`,id:e.uuid,index:l,onEditClick:n,onDelete:i,item:e,disabled:t,isSingleAvatar:o})),!t&&e.length<5&&a.createElement(E.A,{theme:I},a.createElement(y.A,{size:"small",onClick:r,color:"primary",sx:{width:"223px",height:o?"154px":"134px",border:"1px solid #DBDBDB",borderRadius:"10px",padding:"16px",alignItems:"start",justifyContent:"start"}},"+ ADD")))),a.createElement(Tl.Hd,{adjustScale:!0,style:{transformOrigin:"0 0 "}},d?a.createElement(Hp,{item:p,id:d,isDragging:!0}):null))};Up.propTypes={onOrderChange:O().func.isRequired,populations:O().instanceOf(Array).isRequired,disabled:O().bool.isRequired,onEditClick:O().func.isRequired,onDelete:O().func.isRequired,onAddClicked:O().func.isRequired,isSingleAvatar:O().bool};const Yp=Up,Zp=[{key:"ABP",value:"Standard"},{key:"Sizeset",value:"Sizeset"},{key:"Manual Sizeset",value:"Manual Sizeset"}],Jp=({item:e,open:t,onClose:n,standardList:i,isSingleAvatar:l=!1,sizesetList:r})=>{const[o,s]=(0,a.useState)({}),[c,d]=(0,a.useState)([]),[m,p]=(0,a.useState)([]),[u,g]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(s(e),l)if("ABP"===e.type){const t=(i.find(t=>t.id===e?.collection)?.avatars||[]).map(e=>({...e,value:`${e?.size}${e?.is_active?"":" - Inactive"}${e?.is_discontinued?" - Discontinued":""}`,key:e.vbid}));d(t)}else"Manual Sizeset"===e.type&&void 0!==e?.size_set&&pd(e.size_set).then(e=>{if(e?.avatars){const t=e.avatars.map(e=>({key:e.id,value:e.name,vbid:e.id}));d(t)}g(!1)})},[e,l]),a.createElement(qa.A,{onClose:()=>n(),open:t,transitionDuration:0},a.createElement(La.A,null,"Add New Comparison Object"),a.createElement(Pa.A,null,a.createElement(ni.A,{row:!0,"aria-labelledby":"row-radio-buttons-group-label",name:"row-radio-buttons-group",value:o?.type||"ABP"},Zp.map(e=>a.createElement(Za.A,{key:`avatar-set-type-${e.key}`,value:e.key,control:a.createElement(ai.A,{onClick:()=>s({type:e.key}),color:"default"}),label:e.value}))),"ABP"===o.type&&a.createElement(a.Fragment,null,a.createElement(pi,{field:"Standard*",value:i.find(e=>e.key===o.collection)||"",onChange:(e,t)=>(e=>{const t={type:"ABP",...e};if(s(t),l){const t=(e?.avatars||[]).map(e=>({...e,value:`${e?.size}${e?.is_active?"":" - Inactive"}${e?.is_discontinued?" - Discontinued":""}`,key:e.vbid}));d(t)}})(t),options:i,style:{width:"300px"}}),l&&a.createElement(pi,{field:"Size*",disabled:0===c.length,value:c.find(e=>e.vbid===o.vbid)||"",onChange:(e,t)=>(e=>{s(t=>({...t,vbid:e.vbid}))})(t),options:c,style:{width:"300px"}})),"Sizeset"===o.type&&a.createElement(hr,{value:o,onValueChange:e=>(e=>{s({...e,type:"Sizeset",label:`${e?.brand?.name||""}-${e?.size_set?.name||""}`})})(e),isPopulation:!0,isSingleAvatar:l,isComparison:!0}),"Manual Sizeset"===o.type&&a.createElement(a.Fragment,null,a.createElement(pi,{field:"Manual Sizeset*",value:r.find(e=>e.key===o.size_set)||"",onChange:(e,t)=>(e=>{s(t=>({...t,size_set:e.id,label:e.title})),g(!0),pd(e.id).then(e=>{if(e?.avatars){const t=e.avatars.map(e=>({key:e.id,value:e.name,vbid:e.id}));d(t)}g(!1)})})(t),options:r,style:{width:"300px"}}),l&&a.createElement(pi,{field:"Size*",disabled:0===c.length,value:c.find(e=>e.vbid===o.vbid)||"",onChange:(e,t)=>(e=>{s(t=>({...t,vbid:e.vbid}))})(t),options:c,style:{width:"300px"}})),0!==m.length&&a.createElement(vn.A,{variant:"caption",sx:{color:"#FB4E3B"}},"Please input all required fields!")),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",color:"default",variant:"outlined",onClick:()=>n()}),a.createElement(ra,{text:"Save",color:"primary",onClick:()=>{const e=(()=>{let e=[];return"ABP"!==o.type||void 0!==o?.collection&&""!==o?.collection||(e=[...e,"collection"]),"Manual Sizeset"!==o.type||void 0!==o?.size_set&&""!==o?.size_set||(e=[...e,"size_set"]),!l||void 0!==o?.vbid&&""!==o?.vbid||(e=[...e,"vbid"]),"Sizeset"!==o.type||void 0!==o?.brand&&""!==o?.brand||(e=[...e,"brand"]),"Sizeset"!==o.type||void 0!==o?.size_set&&""!==o?.size_set||(e=[...e,"size_set"]),e})();0===e.length?n(o):p(e)}})),a.createElement(bi,{isLoading:u,isSingleChart:!0}))};Jp.propTypes={item:O().instanceOf(Object).isRequired,open:O().bool.isRequired,onClose:O().func.isRequired,standardList:O().instanceOf(Array).isRequired,isSingleAvatar:O().bool,sizesetList:O().instanceOf(Array).isRequired};const Xp=Jp;var Qp=n(64974);const Kp={cm:1,inch:2.54},eu=({population:e,selectedCoreSizes:t,unit:n,defaultPoms:i,allPoms:l,onSelectedCoreSizeChange:r=M(),isSingleAvatar:o=!1})=>{const[s,c]=(0,a.useState)(!1),d=s?l:i,m=(a,i)=>{const l=(e.find(e=>e.uuid===a.uuid)?.avatars||[]).find(e=>e.vbid===a.vbid)||{},r=o?a?.avatar?.[i]:l?.[i],s=t.at(0),c=(e.find(e=>e.uuid===s.uuid)?.avatars||[]).find(e=>e.vbid===s.vbid)||{},d=+((r-(o?s?.avatar?.[i]:c?.[i]))/Kp[n]).toFixed(2)||0;return`${d>0?"+":""}${d}`};return a.createElement(wa.A,{key:"core-size-comparison",sx:{width:"100%",boxSizing:"border-box",overflowX:"unset",border:"1px solid #f4f4f4",borderRadius:"10px",backgroundColor:"#f7fafc"}},a.createElement(Ca.A,{"aria-label":"core size comparison table"},a.createElement(Sa.A,null,a.createElement(Aa.A,null,a.createElement(Oa.A,{align:"left",sx:{fontSize:"14px"}},a.createElement("span",null,"Standard/Sizeset")),e.map((e,t)=>a.createElement(Oa.A,{align:"center",key:`${e.uuid}-${t}`,colSpan:2,sx:{borderLeft:"1px solid #f4f4f4",fontSize:"14px"}},e.label)))),a.createElement(ka.A,null,a.createElement(Aa.A,null,a.createElement(Oa.A,{align:"center",sx:{fontSize:"14px"}},a.createElement("span",null,"Standard/Sizeset")),e.map((e,n)=>a.createElement(Oa.A,{align:"center",key:`size-selection-${e.uuid}-${n}`,colSpan:2,sx:{borderLeft:"1px solid #f4f4f4",fontSize:"14px"}},o?a.createElement("span",null,e?.label||""):a.createElement(Rn.A,{size:"small"},a.createElement(E.A,{theme:I},a.createElement(ii.A,{id:`size-selection-input-${e.uuid}-${n}`,value:t.find(t=>t.uuid===e.uuid)?.vbid,label:"",onChange:t=>r(e.uuid,t.target.value),sx:{fieldset:{borderColor:"transparent !important"}}},e.avatars.map(t=>a.createElement(jt.A,{key:`${e?.label||""}-size-selection-${t.vbid}`,value:t.vbid},`${t.size}${!1===t.is_active?" - Inactive":""}`)))))))),a.createElement(Aa.A,null,a.createElement(Oa.A,{align:"center",sx:{fontSize:"14px"}},a.createElement("span",null,"VBID")),t.map((e,t)=>a.createElement(Oa.A,{align:"center",key:`${e?.vbid||""}-${t}`,colSpan:2,sx:{borderLeft:"1px solid #f4f4f4",fontSize:"14px"}},e?.vbid||""))),d.map(i=>a.createElement(Aa.A,{key:i.key,sx:{"&:last-child td, &:last-child th":{border:0}}},a.createElement(Oa.A,{align:"center",key:"cell-pom",sx:{fontSize:"14px"}},i.value),t.map((t,l)=>a.createElement(a.Fragment,{key:`cell-${i.key}-${t.vbid}-${l}`},a.createElement(Oa.A,{align:"center",colSpan:0===l?2:1,sx:{borderLeft:"1px solid #f4f4f4",fontSize:"14px",whiteSpace:"nowrap"}},((t,a)=>{const i=(e.find(e=>e.uuid===t.uuid)?.avatars||[]).find(e=>e.vbid===t.vbid)||{};return+((o?t?.avatar?.[a]:i?.[a])/Kp[n]).toFixed(2)||"/"})(t,i.key)),0!==l&&a.createElement(Oa.A,{key:`cell-diff-${i.key}-${t.vbid}-${l}`,sx:{borderLeft:"1px solid #f4f4f4",fontSize:"14px",whiteSpace:"nowrap"}},a.createElement("div",{style:{height:"17px",width:"25px",borderRadius:"16px",display:"inline-block",marginRight:"5px",verticalAlign:"text-bottom",backgroundColor:+m(t,i.key)>0?"#43cf68":"#f7685b"}}," "),a.createElement("span",null,m(t,i.key)))))))),a.createElement(Oa.A,{colSpan:2*e.length+1,sx:{padding:0,borderBottom:"none"}},a.createElement(E.A,{theme:I},a.createElement(y.A,{color:"primary",endIcon:s?a.createElement(Qp.A,null):a.createElement(_a.A,null),onClick:()=>c(e=>!e),sx:{width:"100%",height:"40px"}},s?"Collapse Measurements":"View All Measurements")))))};eu.propTypes={population:O().instanceOf(Array).isRequired,selectedCoreSizes:O().instanceOf(Array).isRequired,unit:O().string.isRequired,defaultPoms:O().instanceOf(Array).isRequired,allPoms:O().instanceOf(Array).isRequired,onSelectedCoreSizeChange:O().func,isSingleAvatar:O().bool};const tu=eu,nu=({standardList:e,sizesetList:t})=>{const[n,i]=(0,a.useState)([]),[l,r]=(0,a.useState)({}),[o,s]=(0,a.useState)(!1),[c,d]=(0,a.useState)(-1),[m,p]=(0,a.useState)(!1),[u,g]=(0,a.useState)([]),[h,E]=(0,a.useState)([]),[y,x]=(0,a.useState)(1280),f=9*y/16,b=()=>{const e=document.getElementById("detail");x(e.offsetWidth)};return(0,a.useEffect)(()=>(s(!0),b(),window.addEventListener("resize",b),(async()=>Ye(Qe.THREE_D_AVATAR.avatarSingleComparison))().then(e=>{if(e){const{unit:t,populations:n}=e;i(n||[]),r({unit:t||"cm"}),s(!1)}}),Wn("my_alva").then(e=>{if(e?.results){const t=e.results.filter(e=>"weight"!==e.key&&"bicep_circumference"!==e.key&&"calf_circumference"!==e.key);g(t)}}),Wn("avatar_comparison").then(e=>{e?.results&&E(e.results)}),()=>{window.removeEventListener("resize",b)}),[]),(0,a.useEffect)(()=>{s(!0),ud(l).then(e=>{if(s(!1),e?.status)return e.status})},[l]),(0,a.useEffect)(()=>{m&&(s(!0),ud({populations:n}).then(e=>{if(e?.status){const{unit:t,populations:n}=e;i(n||[]),r({unit:t||"cm"}),p(!1)}s(!1)}))},[m]),a.createElement(_t.A,{sx:{p:2}},a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{variant:"h6"},"Comparison Objects"),a.createElement(Fl,{label:"Measurement",options:["cm","inch"],value:l?.unit||"cm",color:"primary",onChange:e=>r(t=>({...t,unit:e}))})),a.createElement(Yp,{populations:n,disabled:!1,onEditClick:e=>d(e),onDelete:e=>{const t=n.toSpliced(e,1);i(t),p(!0)},onOrderChange:e=>{i(e),p(!0)},onAddClicked:()=>d(n.length),isSingleAvatar:!0})),-1!==c&&a.createElement(Xp,{item:n.at(c)||{type:"ABP"},open:!0,standardList:e,onClose:e=>{if(void 0!==e){if("Sizeset"===e.type){const t={...e,brand:e?.brand?.id||"",size_set:e?.size_set?.id,vbid:e?.vbid?.[0]?.vbid};i(e=>e.toSpliced(c,1,t))}else i(t=>t.toSpliced(c,1,e));p(!0)}d(-1)},isSingleAvatar:!0,sizesetList:t}),0!==n.length&&a.createElement(a.Fragment,null,a.createElement(Ct.A,{direction:"column",mt:1},a.createElement(vn.A,{variant:"h6"},"Core Size Comparison"),a.createElement(tu,{population:n,selectedCoreSizes:n,unit:l?.unit||"cm",defaultPoms:u,allPoms:h,isSingleAvatar:!0})),a.createElement(Ct.A,{sx:{height:f+32,width:"100%",maxHeight:"600px",mt:1}},a.createElement(vn.A,{variant:"h6"},"3D Models"),a.createElement(Ud,{obj:n,source:"COMPARISON",canvasHeight:f>600?600:f,canvasWidth:y,viewAngle:"-0.25"}))),o&&a.createElement(bi,{isLoading:o,isSingleChart:!0}))};nu.propTypes={standardList:O().instanceOf(Array).isRequired,sizesetList:O().instanceOf(Array).isRequired};const au=nu,iu={cm:1,inch:2.54},lu=({data:e,unit:t,defaultPoms:n,allPoms:i,showInactive:l})=>{const[r,o]=(0,a.useState)(!1),s=r?i:n;return a.createElement(a.Fragment,null,a.createElement(wa.A,{key:`table-${e.id}`},a.createElement(Ca.A,{size:"small","aria-label":"collection detail table",sx:{width:"100%",boxSizing:"border-box",overflowX:"unset",overflowY:"scroll",mt:.5}},a.createElement(Sa.A,null,a.createElement(Aa.A,null,a.createElement(Oa.A,{align:"left",sx:{p:"0 8px 5px",fontSize:"14px",minWidth:"160px"}},a.createElement("span",null,"Size")),e.map(e=>l||e?.is_active?a.createElement(Oa.A,{align:"center",key:e?.vbid,sx:{p:"0 8px 5px",borderLeft:"1px solid #f4f4f4",fontSize:"14px"}},a.createElement("span",null,e?.size),!1===e?.is_active&&a.createElement("span",{style:{lineHeight:0,fontSize:"10px",color:"#FB4E3B",display:"block"}},"Inactive")):null))),a.createElement(ka.A,null,s.map(n=>a.createElement(Aa.A,{key:n.key,sx:{"&:last-child td, &:last-child th":{border:0}}},a.createElement(Oa.A,{align:"left",key:"cell-pom",sx:{p:"0 8px",fontSize:"14px",minWidth:"160px"}},n.value),e.map(i=>l||i?.is_active?a.createElement(Oa.A,{align:"right",key:`cell-${n.key}-${i?.vbid}`,sx:{p:"0 8px",borderLeft:"1px solid #f4f4f4",fontSize:"14px",whiteSpace:"nowrap"}},+((e.find(e=>e.size===i?.size)?.[n.key]||0)/iu[t]).toFixed(2)||"/"):null)))))),a.createElement(E.A,{theme:I},a.createElement(y.A,{color:"primary",endIcon:r?a.createElement(Qp.A,null):a.createElement(_a.A,null),onClick:()=>o(e=>!e),sx:{width:"100%",height:"20px"}},r?"Collapse Measurements":"View All Measurements")))};lu.propTypes={data:O().instanceOf(Array).isRequired,unit:O().string.isRequired,defaultPoms:O().instanceOf(Array).isRequired,allPoms:O().instanceOf(Array).isRequired,showInactive:O().bool.isRequired};const ru=lu,ou=({avatars:e,showInactive:t})=>{const n=e.map(e=>e?.height||170).sort((e,t)=>t-e).at(0)||170;return a.createElement(Ct.A,{direction:"row",spacing:1,justifyContent:"flex-start",alignItems:"baseline",mt:1,sx:{width:"100%",overflowX:"scroll"}},0!==e?.length&&e.map((e,i)=>e?.is_active||t?a.createElement(Ct.A,{key:`avatar-set-${e?.vbid}-${i}`,direction:"column",alignItems:"center"},a.createElement("img",{alt:`avatar-standard-${e?.vbid}`,src:e?.preview_img,style:{width:"auto",height:(e?.height||170)/n*200+"px"}}),a.createElement(vn.A,{variant:"body1"},e?.size||""),!1===e?.is_active&&a.createElement("span",{style:{color:"#FB4E3B"}},"Inactive")):null))};ou.propTypes={avatars:O().instanceOf(Array).isRequired,showInactive:O().bool.isRequired};const su=ou,cu=(0,Br.A)(Qr),du=["#1864ff","#3cc780","#ff8900","#e84546","#1bc6ff"],mu=({standardList:e,sizesetList:t})=>{const[n,i]=(0,a.useState)([]),[l,r]=(0,a.useState)({}),[o,s]=(0,a.useState)(-1),[c,d]=(0,a.useState)(!1),[m,p]=(0,a.useState)(!1),[u,g]=(0,a.useState)([]),[h,x]=(0,a.useState)([]),[f,b]=(0,a.useState)([]),[v,A]=(0,a.useState)(1280),w=.95*(v-60)/2,C={width:w,height:7*w/10.7},S=9*v/16,k=()=>{const e=document.getElementById("detail");A(e.offsetWidth)};(0,a.useEffect)(()=>(p(!0),k(),window.addEventListener("resize",k),(async()=>Ye(Qe.THREE_D_AVATAR.avatarSetComparison))().then(e=>{if(e){const{unit:t,population_core_vbids:n,show_inactive:a,populations:l}=e;i(l||[]),r({unit:t||"cm",population_core_vbids:n||[],show_inactive:a||!1}),p(!1)}}),Wn("my_alva").then(e=>{if(e?.results){const t=e.results.filter(e=>"weight"!==e.key&&"bicep_circumference"!==e.key&&"calf_circumference"!==e.key);x(t)}}),Wn("avatar_comparison").then(e=>{e?.results&&b(e.results)}),()=>{window.removeEventListener("resize",k)}),[]);const _=()=>{(async()=>Ye(Qe.THREE_D_AVATAR.comparisonCharts))().then(e=>{if(e?.results){const t=e.results.map(e=>{const t=e?.chart?JSON.parse(e.chart):{},{layout:n,data:a}=t;return{...e,data:a,layout:n}});g(t)}})};return(0,a.useEffect)(()=>{p(!0),(async e=>Je(Qe.THREE_D_AVATAR.avatarSetComparison,e))(l).then(e=>{if(p(!1),e?.status)return e.status}),_()},[l]),(0,a.useEffect)(()=>{c?(p(!0),(async e=>Ze(Qe.THREE_D_AVATAR.avatarSetComparison,e))({populations:n.map((e,t)=>({...e,color:du[t]}))}).then(e=>{if(e?.status){const{unit:t,population_core_vbids:n,show_inactive:a,populations:l}=e;i(l||[]),r({unit:t||"cm",population_core_vbids:n||[],show_inactive:a||!1}),d(!1),p(!1)}})):_()},[c]),a.createElement(_t.A,{sx:{p:2}},a.createElement(Ct.A,{direction:"column",spacing:1},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{variant:"h6"},"Comparison Objects"),a.createElement(Fl,{label:"Measurement",options:["cm","inch"],value:l?.unit||"cm",color:"primary",onChange:e=>r(t=>({...t,unit:e}))})),a.createElement(Yp,{populations:n,disabled:!1,onEditClick:e=>s(e),onDelete:e=>{const t=n.toSpliced(e,1);i(t),d(!0)},onOrderChange:e=>{i(e),d(!0)},onAddClicked:()=>s(n.length)})),-1!==o&&a.createElement(Xp,{item:n.at(o)||{type:"ABP"},open:!0,standardList:e,onClose:e=>{if(void 0!==e){if("Sizeset"===e.type){const t={...e,brand:e?.brand?.id||"",size_set:e?.size_set?.id};e?.vbids&&0!==e?.vbids.length&&(t.vbids=e.vbids.map(e=>e.vbid)),i(e=>e.toSpliced(o,1,t))}else i(t=>t.toSpliced(o,1,e));d(!0)}s(-1)},sizesetList:t}),0!==n.length&&!c&&a.createElement(a.Fragment,null,a.createElement(Ct.A,{direction:"column",mt:1},a.createElement(vn.A,{variant:"h6"},"Core Size Comparison"),a.createElement(tu,{population:n,selectedCoreSizes:l?.population_core_vbids||[],unit:l?.unit||"cm",defaultPoms:h,allPoms:f,onSelectedCoreSizeChange:(e,t)=>{const{population_core_vbids:n,...a}=l,i=n.findIndex(t=>t.uuid===e),o=n.toSpliced(i,1,{uuid:e,vbid:t});r(e=>({...e,population_core_vbids:o}))}})),a.createElement(Ct.A,{direction:"column",mt:1},a.createElement(Ct.A,{direction:"row",justifyContent:"space-between"},a.createElement(vn.A,{variant:"h6"},"Avatar Details"),a.createElement(E.A,{theme:I},a.createElement(y.A,{onClick:()=>r(e=>({...e,show_inactive:!e.show_inactive})),color:"primary",sx:{textTransform:"none"}},(l?.show_inactive?"Hide":"Show")+" Inactive/Discontinued Avatars"))),a.createElement(Ct.A,{direction:"column"},a.createElement(vn.A,{variant:"h6",sx:{fontSize:"18px"}},"Model Images"),n.map(e=>a.createElement(Ct.A,{key:`${e?.uuid}-avatar-group`,direction:"column",spacing:0},a.createElement(vn.A,{variant:"h6",sx:{fontSize:"16px"}},e?.label||""),"Manual Sizeset"===e?.type?a.createElement(Ct.A,{sx:{height:S+32,width:"100%",maxHeight:"400px",mt:1}},a.createElement(Ud,{obj:e?.avatars||[],source:"COMPARISON",canvasHeight:S>400?400:S,canvasWidth:v,viewAngle:"-0.25"})):a.createElement(su,{avatars:e?.avatars||[],showInactive:l?.show_inactive||!1}))))),a.createElement(Ct.A,{direction:"column",mt:1},a.createElement(vn.A,{variant:"h6",sx:{fontSize:"18px"}},"Body Measurements Correlation"),a.createElement(Ct.A,{direction:"row",flexWrap:"wrap"},0!==u.length&&u.map(e=>a.createElement(cu,{key:`sp-chart-avatar-comparison-${e?.sp_pom?.join("-")||""}`,data:e.data,layout:{...e.layout,...C},config:{modeBarButtonsToRemove:["select2d","lasso2d","toImage"],displaylogo:!1,webgl:{preserveDrawingBuffer:!1,alpha:!1,antialias:!1,powerPreference:"high-performance"}}})))),a.createElement(Ct.A,{direction:"column",mt:1},a.createElement(vn.A,{variant:"h6",sx:{fontSize:"18px"}},"Body Measurements Details"),a.createElement(Ct.A,{direction:"column",spacing:1},n.map(e=>a.createElement(Ct.A,{key:`avatar-set-${e.uuid}-detail-table`,direction:"column"},a.createElement(vn.A,{variant:"h6",sx:{fontSize:"16px"}},e?.label||""),a.createElement(ru,{data:e.avatars,unit:l.unit,defaultPoms:h,allPoms:f,showInactive:l?.show_inactive||!1})))))),m&&a.createElement(bi,{isLoading:m,isSingleChart:!0}))};mu.propTypes={standardList:O().instanceOf(Array).isRequired,sizesetList:O().instanceOf(Array).isRequired};const pu=mu,uu={borderRadius:"10px 10px 0 0",textTransform:"none"},gu=()=>{const[e,t]=(0,a.useState)(!1),n=e?"avatar_single":"avatar_set",[i,l]=(0,a.useState)([]),[r,o]=(0,a.useState)([]),s=i.map(e=>({...e,key:e?.id,value:e?.name,collection:e?.id,label:e?.name}))||[],c=r.map(e=>({...e,key:e?.id,value:e?.title,label:e?.title}));(0,a.useEffect)(()=>{(async()=>Ye(Qe.THREE_D_AVATAR.comparisonOptions))().then(e=>{e?.data&&l(e.data)}),cd({view_by:"all",page_size:5e3,type:"manual_sizeset",ordering:"title"}).then(e=>{e?.data&&o(e.data)})},[]);const d=e=>{t("avatar_single"===e)};return a.createElement(_t.A,{sx:{p:4}},a.createElement(vn.A,{variant:"h4",sx:{fontWeight:500}},"Avatar Comparison"),a.createElement(Ct.A,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{borderBottom:"1px solid #CBCBCB"}},a.createElement(E.A,{theme:I},a.createElement(St.A,{color:"primary",value:n,"aria-label":"basic tabs"},a.createElement(kt.A,{label:"Standard/Sizeset",value:"avatar_set",onClick:()=>d("avatar_set"),sx:uu}),a.createElement(kt.A,{label:"Single Avatar",value:"avatar_single",onClick:()=>d("avatar_single"),sx:uu})))),a.createElement(Ct.A,{direction:"column",spacing:2},e?a.createElement(au,{standardList:s,sizesetList:c}):a.createElement(pu,{standardList:s,sizesetList:c})))},hu=()=>{const e="demo",[t,n]=(0,a.useState)([]),[i,l]=(0,a.useState)(1),[r,o]=(0,a.useState)(0);return(0,a.useEffect)(()=>{hn({page_size:5,page:i}).then(e=>{if(e?.status){const t=e?.data||[];n(e=>[...e,...t]),o(e?.count||0)}})},[i]),a.createElement(_t.A,{sx:{width:"100vw",height:"100vh"}},a.createElement(E.A,{theme:I},a.createElement(At.A,{sx:{justifyContent:"center",backgroundColor:"#FFFFFF",height:"41px",padding:"0 10px",boxShadow:"none",borderBottom:"1px #ccc solid",alignItems:"center"}},a.createElement(wt.A,{disableGutters:!0,sx:{justifyContent:"space-between",minHeight:"40px !important",width:"700px"}},a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},a.createElement("img",{className:"logo-container",alt:"logo",src:bt,style:{height:"40px",width:"125.71px"}}),a.createElement(vn.A,{variant:"h6"},"Alvanon"),a.createElement(vn.A,{variant:"body1"},"Changelog"),a.createElement(z.A,{size:"small",label:e.toUpperCase(),sx:{height:"20px",backgroundColor:"rgba(236, 119, 0, 0.1)",color:"#EC7700",fontWeight:700,borderRadius:"4px",".MuiChip-label":{padding:"0 8px",marginTop:"1px",letterSpacing:"1px",fontSize:"12px"}}})))),a.createElement(Ct.A,{sx:{padding:"20px",overflowY:"scroll"}},a.createElement(Ct.A,{direction:"column",spacing:4,sx:{margin:"100px auto",width:"1000px"}},t.map((e,t)=>a.createElement(a.Fragment,null,0!==t&&a.createElement(dn.A,null),a.createElement(Ct.A,{key:`note-${e.id}`,direction:"row",spacing:1,alignItems:"flex-start",justifyContent:"end"},a.createElement(vn.A,{color:"disabled",variant:"h6",sx:{}},new Date(e?.date||void 0).toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})),a.createElement(Ct.A,{direction:"column",spacing:1,sx:{width:"750px"}},a.createElement(vn.A,{variant:"h6",sx:{fontSize:"24px"}},e?.title||""),a.createElement(z.A,{color:"primary",size:"small",label:new Date(e?.date||void 0).toLocaleDateString(void 0,{month:"short"}),sx:{color:"#FFFFFF",height:"18px",maxWidth:"50px"}}),a.createElement(_t.A,{className:"markdown-preview",sx:{display:"inline-block",marginLeft:"5px","& h1":{fontSize:"2rem",fontWeight:"bold"},"& h2":{fontSize:"1.5rem",fontWeight:"bold"},"& h3":{fontSize:"1.25rem",fontWeight:"bold"},"& pre":{backgroundColor:"grey.100",p:2,borderRadius:1,overflow:"auto"},"& blockquote":{borderLeft:"4px solid",borderColor:"primary.main",pl:2,ml:0,fontStyle:"italic",color:"text.secondary"}}},a.createElement(an.oz,{components:{a:yn}},e?.content||"")),e?.attachments&&0!==e.attachments.length&&a.createElement("img",{src:e.attachments,alt:"New feature sample",style:{width:"100%",height:"auto"}}))))),r>t.length&&a.createElement(y.A,{color:"primary",endIcon:a.createElement(_a.A,null),onClick:()=>l(e=>e+1),sx:{width:"100%",height:"60px"}},"Show previous changelogs")))))};var Eu=n(78810),yu=n(75456),xu=n(61663),fu=n(71146),bu=n(78303),vu=n(33936),Au=n(65505);const wu=({data:e,onChange:t})=>{const[n,i]=(0,a.useState)("");(0,a.useEffect)(()=>{i(e)},[e]),(0,a.useEffect)(()=>{const e=setTimeout(()=>{t(n)},1e3);return()=>clearTimeout(e)},[n]);const l=(e,t="",a="")=>{const l=document.getElementById("markdown-input"),r=l.selectionStart,o=l.selectionEnd,s=n.substring(r,o),c=n.substring(0,r)+e+(s||a)+t+n.substring(o);i(c),setTimeout(()=>{l.focus(),l.selectionStart=r+e.length,l.selectionEnd=o+e.length},0)},r=(()=>{const e=/\[([^\[]+)\]\(([^\)]+)\)/g,t=[];let a;for(;null!==(a=e.exec(n));)t.push({text:a[1],url:a[2],index:a.index});return t})();return a.createElement(_t.A,{sx:{width:"100%",margin:"0 auto"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Summary*"),a.createElement(qi.A,{elevation:3,sx:{mb:2}},a.createElement(Ct.A,{direction:"row",p:2,spacing:2},a.createElement(Ct.A,{spacing:2,direction:"column",sx:{flex:1}},a.createElement(_t.A,{sx:{display:"flex",gap:1,flexWrap:"wrap",mb:2}},a.createElement(ei.A,{title:"Bold"},a.createElement(h.A,{onClick:()=>l("**","**","Bold"),color:"primary"},a.createElement(yu.A,null))),a.createElement(ei.A,{title:"Italic"},a.createElement(h.A,{onClick:()=>l("*","*","Italic"),color:"primary"},a.createElement(xu.A,null))),a.createElement(ei.A,{title:"Bulleted list"},a.createElement(h.A,{onClick:()=>l("\n- ","","Bulleted list"),color:"primary"},a.createElement(fu.A,null))),a.createElement(ei.A,{title:"Numbered list"},a.createElement(h.A,{onClick:()=>l("\n1. ","","Numbered list"),color:"primary"},a.createElement(bu.A,null))),a.createElement(ei.A,{title:"Link"},a.createElement(h.A,{onClick:()=>l("[","](https://)","Link"),color:"primary"},a.createElement(vu.A,null)))),a.createElement(_t.A,null,a.createElement(u.A,{id:"markdown-input",multiline:!0,minRows:12,maxRows:15,value:n,onChange:e=>{i(e.target.value)},variant:"outlined",fullWidth:!0,placeholder:"Input Markdown content...",sx:{"& .MuiOutlinedInput-root":{fontFamily:"monospace",fontSize:"0.875rem"}}}),a.createElement(_t.A,{sx:{mt:1,display:"flex",justifyContent:"space-between",alignItems:"center"}},a.createElement(vn.A,{variant:"body2",color:"textSecondary"},n.length," ","Characters")))),a.createElement(or.A,{variant:"outlined",sx:{flex:1,minHeight:300}},a.createElement(sr.A,null,a.createElement(vn.A,{variant:"h6",gutterBottom:!0},"Preview"),a.createElement(dn.A,{sx:{mb:2}}),a.createElement(_t.A,{className:"markdown-preview",sx:{minHeight:250,"& h1":{fontSize:"2rem",fontWeight:"bold",mt:2,mb:1},"& h2":{fontSize:"1.5rem",fontWeight:"bold",mt:2,mb:1},"& h3":{fontSize:"1.25rem",fontWeight:"bold",mt:2,mb:1},"& pre":{backgroundColor:"grey.100",p:2,borderRadius:1,overflow:"auto"},"& blockquote":{borderLeft:"4px solid",borderColor:"primary.main",pl:2,ml:0,fontStyle:"italic",color:"text.secondary"}}},a.createElement(an.oz,{components:{a:yn}},n)),r.length>0&&a.createElement(qi.A,{elevation:1,sx:{mt:2,p:1.5,bgcolor:"grey.50"}},a.createElement(vn.A,{variant:"subtitle2",gutterBottom:!0},"Detected Link (",r.length,"):"),a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column",gap:1}},r.slice(0,3).map((e,t)=>a.createElement(_t.A,{key:t,sx:{display:"flex",alignItems:"center"}},a.createElement(Au.A,{sx:{mr:1,fontSize:16}}),a.createElement(R.A,{href:e.url,target:"_blank",rel:"noopener",sx:{fontWeight:"bold"}},e.text||e.url))),r.length>3&&a.createElement(vn.A,{variant:"body2",color:"textSecondary"},"and"," ",r.length-3," ","more links..."))))))))};wu.propTypes={data:O().string.isRequired,onChange:O().func.isRequired};const Cu=wu;var Su=n(92843);const ku=({value:e,onChange:t})=>{const[n,i]=(0,a.useState)(!1);return a.createElement(Ct.A,null,a.createElement(Ct.A,{direction:"row",alignItems:"baseline",spacing:1},a.createElement(aa.A,{style:{boxSizing:"border-box",marginBottom:"5px"}},"Image"),a.createElement(vn.A,{variant:"caption",sx:{color:"#9B9B9B",fontSize:"10px"}},"File format: PNG/JPEG/JPG·Maximum size: 10 MB·One file only")),a.createElement(Ct.A,{mt:2},""===e?a.createElement(Ct.A,{direction:"column",justifyContent:"center",alignItems:"center",sx:{width:"300px",height:"150px",border:"1px solid #EC7700",borderRadius:"5px"}},a.createElement(Su.A,{sx:{color:"#EC7700"}}),a.createElement("label",{htmlFor:"fileInput",style:{color:"#EC7700"}},"Choose a image to upload"),a.createElement("input",{type:"file",name:"avatar",id:"fileInput",accept:".jpef, .png, .jpg",onChange:e=>{e.preventDefault();const n=new FileReader,a=e.target.files[0];void 0!==n&&void 0!==a&&(n.onloadend=e=>{const n=e.target.result;t(n)},n.readAsDataURL(a))},src:e,style:{opacity:0}})):a.createElement(Ct.A,{direction:"row",spacing:1,alignItems:"center"},n?a.createElement(bi,{isLoading:!0,isSingleChart:!0}):a.createElement("img",{src:e,alt:"Icone adicionar",height:150,width:300}),a.createElement(ra,{text:"Remove",variant:"outlined",onClick:()=>{t("")},color:"primary"}))))};ku.propTypes={value:O().string.isRequired,onChange:O().func.isRequired};const _u=ku,zu=(0,j.A)({...I,components:{MuiPickersDay:{styleOverrides:{root:{color:"#5F504D",borderRadius:"20px",backgroundColor:"transparent","&:hover":{backgroundColor:"rgba(236, 119, 0, 0.1)"},"&.Mui-selected":{backgroundColor:"#EC7700",color:"#FFFFFF","&:hover, &:focus":{backgroundColor:"#EC7700"}}}}}}}),Ru=({open:e,onClose:t,editingItem:n})=>{const[i,l]=(0,a.useState)({});(0,a.useEffect)(()=>{l(n)},[n]);const r=(e,t)=>{l(n=>({...n,[e]:t}))};return a.createElement(qa.A,{open:e,maxWidth:"xl",fullWidth:!0},a.createElement(La.A,null,"Add New Relese Note"),a.createElement(Pa.A,null,a.createElement(Ct.A,{direction:"column",spacing:2},a.createElement(Ct.A,{direction:"row",spacing:2},a.createElement(pi,{field:"Org Type*",value:i?.org_type||"Alvanon",options:["Alvanon","Brand"],onChange:(e,t)=>r("org_type",t),style:{width:"330px"}}),a.createElement(E.A,{theme:zu},a.createElement("div",null,a.createElement(aa.A,{style:{boxSizing:"border-box",marginBottom:"5px"}},"Date (UTC)"),a.createElement(ia.l,{value:i?.date?Jn()(i.date):null,onChange:e=>r("date",e.toISOString()),slotProps:{textField:{size:"small",sx:{padding:"0 15px",borderRadius:"10px",marginRight:"10px",backgroundColor:"#F9F9F9",border:"1px solid #D9D9D9",boxShadow:"inset 0px 0px 5px #00000038",width:"200px",".MuiInputBase-root":{height:"40px",fieldset:{border:"none"}}}}}})),a.createElement("div",null,a.createElement(aa.A,{style:{boxSizing:"border-box",marginBottom:"5px"}},"Publish Status"),a.createElement(B,{text:i?.status||"pending",color:"done"===i?.status?"success":"inProgress"})))),a.createElement("div",{style:{width:"500px"}},a.createElement(aa.A,{sx:{position:"relative",transform:"none",transition:"none",marginBottom:"5px"}},"Title*"),a.createElement(si,{label:"",value:i?.title||"",onChange:e=>r("title",e.target.value),width:500})),a.createElement(Cu,{data:i?.content||"",onChange:e=>r("content",e)}),a.createElement(_u,{value:i?.attachments||"",onChange:e=>r("attachments",e)}))),a.createElement(Va.A,null,"done"!==i?.status&&a.createElement(a.Fragment,null,a.createElement(ra,{variant:"outlined",color:"primary",text:"Publish",onClick:()=>t("publish",i)}),a.createElement(dn.A,{orientation:"vertical",flexItem:!0})),a.createElement(ra,{variant:"outlined",color:"default",text:"Cancel",onClick:()=>t("cancel")}),a.createElement(ra,{color:"primary",text:"Save",onClick:()=>t("save",i)})))};Ru.propTypes={open:O().bool.isRequired,onClose:O().func.isRequired,editingItem:O().instanceOf(Object).isRequired};const Du=Ru,Ou=()=>{const[e,t]=(0,a.useState)([]),[n,i]=(0,a.useState)({}),[l,r]=(0,a.useState)(-1),[o,s]=(0,a.useState)("Alvanon"),[c,d]=(0,a.useState)(""),[m,p]=(0,a.useState)(!1),[u,g]=(0,a.useState)({pageSize:25,page:0}),E=e=>{hn({org_type:o,page:e,page_size:20}).then(e=>{e?.status&&(t(e?.data||[]),r(e?.count||0))})};(0,a.useEffect)(()=>{E(1)},[]);const y=(e,t,n)=>{if("publish"!==e||n)if("save"===e||"publish"===e&&n){const a={...t};"publish"===e&&n&&(a.status="done"),a?.id?(async(e,t)=>Je(`${Qe.USER.releaseNote}/${e}/`,t))(t.id,a).then(e=>{e&&(E(u.page+1),i({}),d(""),m&&p(e=>!e))}):(async e=>Ze(Qe.USER.releaseNote,e))(a).then(e=>{e&&(E(u.page+1),i({}),d(""),m&&p(e=>!e))})}else i({}),d("");else i(t),d("publish")},x=[{field:"org_type",headerName:"Org Type",display:"flex",flex:1},{field:"date",headerName:"Date(UTC)",display:"flex",flex:1,valueGetter:e=>e?new Date(e).toLocaleString("zh",{year:"numeric",month:"2-digit",day:"2-digit"}).replaceAll("/","-"):"----"},{field:"title",headerName:"Title",display:"flex",flex:1},{field:"content",headerName:"Summary",type:"text",display:"flex",flex:4,renderCell:({value:e})=>a.createElement("div",{style:{overflow:"hidden",textOverflow:"ellipsis"}},e)},{field:"status",headerName:"Publish Status",display:"flex",flex:1,renderCell:e=>a.createElement(B,{text:Fe(e.row.status),color:"pending"===e.row.status?"inProgress":"success"})},{field:"actions",type:"actions",headerName:"Actions",display:"flex",width:120,cellClassName:"actions",headerAlign:"left",align:"left",sortable:!1,disableColumnMenu:!0,getActions:({id:e,row:t})=>"done"===t.status?[a.createElement(ei.A,{title:"Edit",key:"edit"},a.createElement(h.A,{size:"small",onClick:()=>i(t)},a.createElement(Pi.A,{fontSize:"small"})))]:[a.createElement(ei.A,{title:"Edit",key:"edit"},a.createElement(h.A,{size:"small",onClick:()=>i(t)},a.createElement(Pi.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Publish",key:"publish"},a.createElement(h.A,{size:"small",onClick:()=>{i(t),d("publish"),p(!0)}},a.createElement(Eu.A,{fontSize:"small"}))),a.createElement(ei.A,{title:"Delete",key:"del"},a.createElement(h.A,{size:"small",onClick:()=>{i(t),d("delete"),p(!0)}},a.createElement(ci.A,{fontSize:"small"})))]}];return a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column"}},a.createElement(zn,{startIcon:a.createElement(wn.A,null),text:"Add New",color:"primary",onClick:()=>i({org_type:o}),style:{width:"150px",marginBottom:"8px"}}),a.createElement(Ci.z,{autoHeight:!0,columns:x,rows:e,pageSizeOptions:[20],paginationModel:u,onPaginationModelChange:e=>{g(e),E(e.page+1)},sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"8px"},".MuiDataGrid-cell:focus-within":{outline:"none"}}}),0!==Object.keys(n).length&&!m&&a.createElement(Du,{open:0!==Object.keys(n).length&&!m,editingItem:n,onClose:y}),a.createElement(qa.A,{onClose:()=>{d("")},open:0!==Object.keys(n).length&&0!==c.length,transitionDuration:0},a.createElement(La.A,null,"delete"===c?"Delete Release Note":"Confirm Publish"),a.createElement(Pa.A,null,a.createElement(Wa.A,{id:"alert-dialog-description"},"delete"===c?"Are you sure to delete the release note?":"Are you sure you want to publish? This action cannot be undone. Once published, the notification will be visible to all system users and cannot be deleted.")),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",color:"default",variant:"outlined",onClick:()=>d("")}),a.createElement(ra,{text:"Yes",color:"primary",onClick:()=>"delete"===c?void(async e=>Xe(`${Qe.USER.releaseNote}/${e}/`))(n.id).then(e=>{e&&(E(u.page+1),d(""),i({}),m&&p(e=>!e))}):y("publish",n,!0)}))))},Fu=(e,t)=>{const n=e.key.toUpperCase(),a=t.key.toUpperCase();return na?1:0},Mu=()=>{const[e,t]=(0,a.useState)([]),[n,i]=(0,a.useState)({}),l=Object.keys(n).length>0,r=[{field:"key",headerName:"MyAlva ID",display:"flex",flex:1},{field:"value",headerName:"Display Name",display:"flex",flex:1},{field:"created_at",headerName:"Creation Date",display:"flex",flex:1,valueGetter:e=>ke(e)},{field:"last_modified",headerName:"Update Date",display:"flex",flex:1,valueGetter:e=>ke(e)},{field:"actions",type:"actions",headerName:"Actions",width:100,cellClassName:"actions",headerAlign:"left",align:"center",display:"flex",getActions:({id:t})=>[a.createElement(Qi.Z,{icon:a.createElement(Pi.A,null),label:"Edit",key:"edit-icon",onClick:()=>(t=>{const n=e.find(e=>e.id===t);i(n)})(t),color:"inherit"})]}];return(0,a.useEffect)(()=>{(async()=>Ye(Qe.PROJECT_VIEW.getOptions,{domain:"MyalvaProjectName"}))().then(e=>{e?.data&&t(e.data.sort((e,t)=>Fu(e,t)))})},[]),a.createElement(_t.A,{sx:{display:"flex",flexDirection:"column"}},a.createElement(Ci.z,{autoHeight:!0,rows:e,columns:r,disableRowSelectionOnClick:!0,getRowHeight:()=>"auto",slots:{noRowsOverlay:Ri},sx:{".MuiDataGrid-container--top [role=row]":{backgroundColor:"#EEEEEE"},".MuiCheckbox-root":{"&.Mui-checked":{color:"#EC7700"},"&:hover":{backgroundColor:"transparent"}},"& .MuiDataGrid-cell":{lineHeight:"22px",padding:"8px"},".MuiDataGrid-cell:focus-within":{outline:"none"}}}),a.createElement(qa.A,{onClose:()=>i({}),open:l},a.createElement(La.A,null,"Edit Display Name"),a.createElement(Pa.A,null,a.createElement(si,{label:"Display Name",value:n?.value||"",onChange:e=>i(t=>({...t,value:e.target.value}))})),a.createElement(Va.A,null,a.createElement(ra,{text:"Cancel",variant:"outlined",color:"default",onClick:()=>i({})}),a.createElement(ra,{text:"Ok",color:"primary",onClick:()=>{var a;ga((a=n).id,{key:a.key,value:a.value}).then(n=>{if(n?.data){const a=[...e.filter(e=>e.id!==n.data.id),n.data].sort((e,t)=>Fu(e,t));t(a),i({})}})}}))))},ju=()=>{const e=(0,l.useDispatch)();Ge();const t=async({request:t})=>{const n=new URL(t.url),a="/login"===n.pathname,i=await Ke();if(i){if(e(A(i)),Ge(),a){const e=yt(i.permissions||[]);return(0,d.V2)(e)}return i}if(a)return null;const l=n.pathname+n.search;return(0,d.V2)(`/login?from=${encodeURIComponent(l)}`)},n=(0,m.Ys)([{path:"/login",element:a.createElement(ft,null)},{path:"/",loader:t,element:a.createElement(bn,null),errorElement:a.createElement(vt,null),children:[{path:"/",element:a.createElement(Ya,null)},{path:"/:id",element:a.createElement(Bi,null),children:[{path:"scans",element:a.createElement($i,null),children:[{path:"/:id/scans",element:a.createElement(Tr,null)},{path:":scanid",element:a.createElement(Rr,null),children:[{path:"/:id/scans/:scanid",element:a.createElement(Bo,null)},{path:"sp",element:a.createElement(Hm,{source:"PROJECT_VIEW"})},{path:"dc",element:a.createElement(Jm,{source:"PROJECT_VIEW"})},{path:"dt",element:a.createElement(Po,null)},{path:"m4m",element:a.createElement(ns,null)},{path:"mc",element:a.createElement(Uo,null)}]}]},{path:"overview",element:a.createElement(Ni,null),children:[{path:"/:id/overview",element:a.createElement(gs,null)},{path:"new",element:a.createElement(ds,null)},{path:"/:id/overview/:overviewId",element:a.createElement(ws,null)},{path:"/:id/overview/:overviewId/edit",element:a.createElement(ds,null)}]},{path:"sbs",element:a.createElement(gc,null),children:[{path:"/:id/sbs",element:a.createElement(Sl,null)},{path:"data-management",element:a.createElement(dc,null),children:[{path:"/:id/sbs/data-management",element:a.createElement(cc,null)},{path:"new",element:a.createElement(uc,null)},{path:"edit/:groupId",element:a.createElement(uc,null)}]}]},{path:"history",element:a.createElement(Ya,null)}]},{path:"/new",element:a.createElement(Bi,null)},{path:"/data-query",element:a.createElement(Us,null)},{path:"/dataset-profiler",element:a.createElement(Ap,null)},{path:"/3d-model",element:a.createElement(wp,null),children:[{path:"/3d-model",element:a.createElement(Pp,null)},{path:"new",element:a.createElement(Ip,null)},{path:":id",element:a.createElement(Ip,null)}]},{path:"/manual-sizeset",element:a.createElement(wp,null),children:[{path:"/manual-sizeset",element:a.createElement(Pp,null)},{path:"new",element:a.createElement(Ip,null)},{path:":id",element:a.createElement(Ip,null)}]},{path:"/admin",element:a.createElement(qt,null),children:[{path:"user-management",element:a.createElement(rc,null)},{path:"client-management",element:a.createElement(sc,null)},{path:"role-management",element:a.createElement(Bc,null)}]},{path:"/sys-admin",element:a.createElement(Ec,null),children:[{path:"organization",element:a.createElement(yc,null),children:[{path:"/sys-admin/organization",element:a.createElement(Lc,null)},{path:":orgid",id:"orgs",element:a.createElement(bc,null),shouldRevalidate:({currentUrl:e})=>e.pathname.includes("info"),loader:async({params:e})=>(async e=>Ye(`${Qe.ORGANIZATION.organizations}/${e}`))(e.orgid),children:[{path:"info",element:a.createElement(Oc,null)},{path:"user",element:a.createElement(Fc,null)},{path:"role",element:a.createElement(Bc,null)}]}]},{path:"/sys-admin/release-notes",element:a.createElement(Ou,null)},{path:"/sys-admin/myalva-project",element:a.createElement(Mu,null)}]},{path:"analysis",element:a.createElement(om,null),children:[{path:"/analysis",element:a.createElement(np,null)},{path:"/analysis/:id",element:a.createElement(cm,null),children:[{path:"/analysis/:id",element:a.createElement(Xm,null)},{path:"mc",element:a.createElement(Hm,{source:"MYALVA"})},{path:"dc",element:a.createElement(Jm,{source:"MYALVA"})},{path:"avatars",element:a.createElement(Wp,null)}]}]},{path:"user-settings",element:a.createElement(ip,null),children:[{path:"my",element:a.createElement(Wc,null)},{path:"downloads",element:a.createElement(sp,null)}]},{path:"myalva-overview",element:a.createElement(rm,null)},{path:"avatar-comparison",element:a.createElement(gu,null)}]},{path:"/release-notes",loader:t,element:a.createElement(hu,null)}]);return a.createElement(m.pg,{router:n,future:{v7_startTransition:!0}})};var Iu=n(61221),Tu={};Tu.styleTagTransform=ut(),Tu.setAttributes=ct(),Tu.insert=ot().bind(null,"head"),Tu.domAPI=lt(),Tu.insertStyleElement=mt(),at()(Iu.A,Tu),Iu.A&&Iu.A.locals&&Iu.A.locals;const Bu=document.querySelector("#root");(0,i.H)(Bu).render(a.createElement(l.Provider,{store:ve},a.createElement(c.Q,{loading:null,persistor:Ae},a.createElement(o.$,{dateAdapter:s.R},a.createElement(ju,null)),a.createElement(r.Ay,{timeOut:5e3,newestOnTop:!1,preventDuplicates:!0,position:"bottom-right",getState:e=>e.toastr,transitionIn:"fadeIn",transitionOut:"fadeOut"}))))},56539(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},56694(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%2333b5e5%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},61221(e,t,n){"use strict";n.d(t,{A:()=>o});var a=n(31601),i=n.n(a),l=n(76314),r=n.n(l)()(i());r.push([e.id,'body{font-family:"Roboto",sans-serif;margin:0;overscroll-behavior:none}body #root{display:flex;color:#5f504d;background-color:#fff}body #root a{text-decoration:none}body #root #detail{background-color:#fff}body *::-webkit-scrollbar{width:.5rem;height:.5rem}body *::-webkit-scrollbar-thumb{background-color:#aaa;border-radius:40px}body *::-webkit-scrollbar-track{background-color:#fff}body .rv-discrete-color-legend-item{padding:0 10px}body .redux-toastr .bottom-right{width:200px}body .redux-toastr .toastr{background-color:rgba(0,0,0,0);box-shadow:none;opacity:1}body .redux-toastr .toastr:hover:not(.rrt-message){box-shadow:none}body .redux-toastr .toastr.rrt-error{background-color:rgba(0,0,0,0)}body .redux-toastr .toastr .close-toastr{display:none}body .js-plotly-plot .plotly,body .js-plotly-plot .plotly div,body .js-plotly-plot .plotly canvas{font-family:"source-han-sans-cn-variable",sans-serif;font-variation-settings:"wght" 450}body .jexcel>tbody>tr>td.readonly{color:#5f504d}',""]);const o=r},61907(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},64643(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},64665(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},66311(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill=%27%23fff%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},67392(e){"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27gray%27 width=%2718px%27 height=%2718px%27%3E%3Cpath d=%27M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z%27/%3E%3Cpath d=%27M0 0h24v24H0z%27 fill=%27none%27/%3E%3C/svg%3E"},68164(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},68605(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},75796(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23aaa%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},77035(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},80216(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},80899(){},81417(e){"use strict";e.exports="data:image/svg+xml,%0A%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 viewBox=%270 0 24 24%27%3E%3Cpath fill=%27none%27 d=%27M0 0h24v24H0V0z%27/%3E%3Cpath d=%27M7 10l5 5 5-5H7z%27 fill=%27lightgray%27/%3E%3C/svg%3E"},91413(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z%27/%3E%3C/svg%3E"},92228(e){"use strict";e.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},93553(e){"use strict";e.exports="data:image/svg+xml;base64,PHN2ZyBmaWxsPSdibGFjaycgaGVpZ2h0PScyNCcgdmlld0JveD0nMCAwIDI0IDI0JyB3aWR0aD0nMjQnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZD0nTTcgMTBsNSA1IDUtNXonLz48cGF0aCBkPSdNMCAwaDI0djI0SDB6JyBmaWxsPSdub25lJy8+PC9zdmc+"},97721(e){"use strict";e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFuGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE5LTAxLTMxVDE4OjU1OjA4WiIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxOS0wMS0zMVQxODo1NTowOFoiIHhtcDpNb2RpZnlEYXRlPSIyMDE5LTAxLTMxVDE4OjU1OjA4WiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDphMTlhZDJmOC1kMDI2LTI1NDItODhjOS1iZTRkYjkyMmQ0MmQiIHhtcE1NOkRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpkOGI5NDUyMS00ZjEwLWQ5NDktYjUwNC0wZmU1N2I3Nzk1MDEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDplMzdjYmE1ZS1hYTMwLWNkNDUtYTAyNS1lOWYxZjk2MzUzOGUiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDplMzdjYmE1ZS1hYTMwLWNkNDUtYTAyNS1lOWYxZjk2MzUzOGUiIHN0RXZ0OndoZW49IjIwMTktMDEtMzFUMTg6NTU6MDhaIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmExOWFkMmY4LWQwMjYtMjU0Mi04OGM5LWJlNGRiOTIyZDQyZCIgc3RFdnQ6d2hlbj0iMjAxOS0wMS0zMVQxODo1NTowOFoiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4En6MDAAAAX0lEQVQYlX3KOw6AIBBAwS32RpJADXfx0pTET+ERZJ8F8RODFtONsG0QAoh0CSDM82dqodaBdQXnfoLZQM7gPai+wjNNE8R4pTuAYNZSKZASqL7CMy0LxNgJp30fKYUDi3+vIqb/+rUAAAAASUVORK5CYII="}},e=>{e.O(0,[243,9679,5244,8023,2763,6275,231,7843,940,8565,7024,5961,4514,5052,7930,6800,6837,9851,9171,159,6877,1628,1144,4113,5090,4756,2254,7053,7162,5853,7316,6311,9176,825,3921,3149,5279,1337,8607,1038,2709,1155,8674,1601,5639,578,3825,6730,8197,3895,4484,8706,2059,3935,1336],()=>e(e.s=52265)),e.O()}]);