| 1 |
- import{C as e,w as t}from"./client-BdOyoZJz.js";import{K as n,W as r}from"./index-BoVbGTav.js";var i=e();function a(e){return e?`#${e.slice(0,6)}`:`#808080`}function o(e){return!e.tray_type||e.tray_type===``}function s(e){return e<=3?`AMS ${String.fromCharCode(65+e)}`:e>=128&&e<=135?`AMS HT ${String.fromCharCode(65+e-128)}`:`AMS ${e}`}function c({className:e}){return(0,i.jsx)(`svg`,{className:e,viewBox:`0 0 36 54`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,i.jsx)(`path`,{d:`M17.8131 0.00538C18.4463 -0.15091 20.3648 3.14642 20.8264 3.84781C25.4187 10.816 35.3089 26.9368 35.9383 34.8694C37.4182 53.5822 11.882 61.3357 2.53721 45.3789C-1.73471 38.0791 0.016 32.2049 3.178 25.0232C6.99221 16.3662 12.6411 7.90372 17.8131 0.00538ZM18.3738 7.24807L17.5881 7.48441C14.4452 12.9431 10.917 18.2341 8.19369 23.9368C4.6808 31.29 1.18317 38.5479 7.69403 45.5657C17.3058 55.9228 34.9847 46.8808 31.4604 32.8681C29.2558 24.0969 22.4207 15.2913 18.3776 7.24807H18.3738Z`,fill:`#C3C2C1`})})}function l({className:e}){return(0,i.jsxs)(`svg`,{className:e,viewBox:`0 0 35 53`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,i.jsx)(`path`,{d:`M17.3165 0.0038C17.932 -0.14959 19.7971 3.08645 20.2458 3.77481C24.7103 10.6135 34.3251 26.4346 34.937 34.2198C36.3757 52.5848 11.5505 60.1942 2.46584 44.534C-1.68714 37.3735 0.0148 31.6085 3.08879 24.5603C6.79681 16.0605 12.2884 7.75907 17.3165 0.0038ZM17.8615 7.11561L17.0977 7.34755C14.0423 12.7048 10.6124 17.8974 7.96483 23.4941C4.54975 30.7107 1.14949 37.8337 7.47908 44.721C16.8233 54.8856 34.01 46.0117 30.5838 32.2595C28.4405 23.6512 21.7957 15.0093 17.8652 7.11561H17.8615Z`,fill:`#C3C2C1`}),(0,i.jsx)(`path`,{d:`M5.03547 30.112C9.64453 30.4936 11.632 35.7985 16.4154 35.791C19.6339 35.7873 20.2161 33.2283 22.3853 31.6197C31.6776 24.7286 33.5835 37.4894 27.9881 44.4254C18.1878 56.5653 -1.16063 44.6013 5.03917 30.1158L5.03547 30.112Z`,fill:`#1F8FEB`})]})}function u({className:e}){return(0,i.jsxs)(`svg`,{className:e,viewBox:`0 0 36 54`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,i.jsx)(`path`,{d:`M17.9625 4.48059L4.77216 26.3154L2.08228 40.2175L10.0224 50.8414H23.1594L33.3246 42.1693V30.2455L17.9625 4.48059Z`,fill:`#1F8FEB`}),(0,i.jsx)(`path`,{d:`M17.7948 0.00538C18.4273 -0.15091 20.3438 3.14642 20.8048 3.84781C25.3921 10.816 35.2715 26.9368 35.9001 34.8694C37.3784 53.5822 11.8702 61.3357 2.53562 45.3789C-1.73163 38.0829 0.0134 32.2087 3.1757 25.027C6.98574 16.3662 12.6284 7.90372 17.7948 0.00538ZM18.3549 7.24807L17.57 7.48441C14.4306 12.9431 10.9063 18.2341 8.1859 23.9368C4.67686 31.29 1.18305 38.5479 7.68679 45.5657C17.2881 55.9228 34.9476 46.8808 31.4271 32.8681C29.2249 24.0969 22.3974 15.2913 18.3587 7.24807H18.3549Z`,fill:`#C3C2C1`})]})}function d({className:e}){return(0,i.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,i.jsx)(`path`,{d:`M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z`,stroke:`#C3C2C1`,strokeWidth:`1`,fill:`none`}),(0,i.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2.5`,stroke:`#C3C2C1`,strokeWidth:`1`,fill:`none`})]})}function f({className:e}){return(0,i.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,i.jsx)(`rect`,{x:`4.5`,y:`8`,width:`3`,height:`4.5`,fill:`#d4a017`,rx:`0.5`}),(0,i.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2`,fill:`#d4a017`}),(0,i.jsx)(`path`,{d:`M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z`,stroke:`#C3C2C1`,strokeWidth:`1`,fill:`none`})]})}function p({className:e}){return(0,i.jsxs)(`svg`,{className:e,viewBox:`0 0 12 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,i.jsx)(`rect`,{x:`4.5`,y:`3`,width:`3`,height:`9.5`,fill:`#c62828`,rx:`0.5`}),(0,i.jsx)(`circle`,{cx:`6`,cy:`15`,r:`2`,fill:`#c62828`}),(0,i.jsx)(`path`,{d:`M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z`,stroke:`#C3C2C1`,strokeWidth:`1`,fill:`none`})]})}function m({humidity:e,goodThreshold:t=40,fairThreshold:n=60}){let r,a;return e<=t?(r=`#22a352`,a=c):e<=n?(r=`#d4a017`,a=l):(r=`#c62828`,a=u),(0,i.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,i.jsx)(a,{className:`w-3 h-3.5`}),(0,i.jsxs)(`span`,{className:`font-medium tabular-nums text-xs`,style:{color:r},children:[e,`%`]})]})}function h({temp:e,goodThreshold:t=28,fairThreshold:n=35}){let r,a;return e<=t?(r=`#22a352`,a=d):e<=n?(r=`#d4a017`,a=f):(r=`#c62828`,a=p),(0,i.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,i.jsx)(a,{className:`w-3 h-3.5`}),(0,i.jsxs)(`span`,{className:`font-medium tabular-nums text-xs`,style:{color:r},children:[e,`°C`]})]})}function g({side:e}){return(0,i.jsx)(`span`,{className:`inline-flex items-center justify-center w-4 h-4 text-[9px] font-bold rounded`,style:{backgroundColor:`#1a4d2e`,color:`#00ae42`},children:e})}function _({tray:e,slotIndex:t,isActive:s,fillOverride:c,spoolmanFill:l,accessibleLabel:u,onClick:d}){let f=o(e),p=r(e),m=a(e.tray_color),h=e.remain!==null&&e.remain!==void 0&&e.remain>=0?e.remain:null,g=l??(c===0&&h!==null&&h>0?null:c)??h;return(0,i.jsxs)(`div`,{className:`relative flex flex-col items-center p-2.5 rounded-lg border transition-all ${s?`ring-2 ring-bambu-green border-bambu-green bg-bambu-green/10`:`border-transparent`} ${d?`cursor-pointer hover:border-bambu-gray hover:bg-bambu-dark-tertiary`:``}`,onClick:d,onKeyDown:d?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d())}:void 0,role:d?`button`:void 0,tabIndex:d?0:void 0,"aria-pressed":d?s:void 0,"aria-label":d?u:void 0,title:d?u:void 0,"data-testid":d?`ams-slot`:void 0,children:[(0,i.jsxs)(`div`,{className:`relative w-16 h-16 mb-1`,children:[f?(0,i.jsx)(`div`,{className:`w-full h-full rounded-full border-2 border-dashed border-gray-500 flex items-center justify-center`,children:(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-full bg-gray-600`})}):(0,i.jsxs)(`svg`,{viewBox:`0 0 56 56`,className:`w-full h-full`,children:[(0,i.jsx)(`circle`,{cx:`28`,cy:`28`,r:`26`,fill:m}),(0,i.jsx)(`circle`,{cx:`28`,cy:`28`,r:`20`,fill:m,style:{filter:`brightness(0.85)`}}),(0,i.jsx)(`ellipse`,{cx:`20`,cy:`20`,rx:`6`,ry:`4`,fill:`white`,opacity:`0.3`}),(0,i.jsx)(`circle`,{cx:`28`,cy:`28`,r:`8`,fill:`#2d2d2d`}),(0,i.jsx)(`circle`,{cx:`28`,cy:`28`,r:`5`,fill:`#1a1a1a`})]}),s&&(0,i.jsx)(`div`,{className:`absolute -bottom-1 left-1/2 -translate-x-1/2 w-2.5 h-2.5 bg-bambu-green rounded-full`})]}),(0,i.jsx)(`span`,{className:`text-sm text-bambu-gray-light truncate max-w-full`,title:p===`reset`?`Spool loaded — slot not configured`:void 0,children:f?p===`reset`?`?`:`Empty`:e.tray_type||`Unknown`}),!f&&g!==null&&g>=0&&(0,i.jsx)(`div`,{className:`w-full h-1 bg-bambu-dark-tertiary rounded-full overflow-hidden mt-1`,children:(0,i.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${g}%`,backgroundColor:n(g)}})}),(0,i.jsx)(`span`,{className:`absolute top-1 right-1 rounded bg-bambu-dark-tertiary px-1.5 py-0.5 text-[10px] font-semibold text-bambu-gray-light`,children:t+1})]})}function v({unit:e,activeSlot:n,onConfigureSlot:r,isDualNozzle:a,nozzleSide:c,thresholds:l,fillOverrides:u,spoolmanFillOverrides:d}){let{t:f}=t(),p=e.tray||[],v=e.is_ams_ht,y=v?1:4,b=s(e.id);return(0,i.jsxs)(`div`,{className:`bg-bambu-dark-secondary rounded-xl border border-[var(--border-color)] p-3 shadow-sm`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(`span`,{className:`text-white font-medium text-base`,children:b}),a&&c&&(0,i.jsx)(g,{side:c})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.temp!=null&&(0,i.jsx)(h,{temp:e.temp,goodThreshold:l?.tempGood,fairThreshold:l?.tempFair}),e.humidity!=null&&(0,i.jsx)(m,{humidity:e.humidity,goodThreshold:l?.humidityGood,fairThreshold:l?.humidityFair})]})]}),(0,i.jsx)(`div`,{className:`grid ${v?`grid-cols-1 max-w-[100px] mx-auto`:`grid-cols-4`} gap-2`,children:Array.from({length:y}).map((t,a)=>{let s=p[a]||{id:a,tray_color:null,tray_type:``,tray_sub_brands:null,tray_id_name:null,tray_info_idx:null,remain:-1,k:null,cali_idx:null,tag_uid:null,tray_uuid:null,nozzle_temp_min:null,nozzle_temp_max:null};return(0,i.jsx)(_,{tray:s,slotIndex:a,isActive:n===a,fillOverride:u?.[`${e.id}-${a}`]??null,spoolmanFill:d?.[`${e.id}-${a}`]??null,accessibleLabel:f(`configureAmsSlot.slotLabel`,{ams:b,slot:a+1}),onClick:r?()=>r(e.id,a,o(s)?null:s):void 0},a)})})]})}export{h as i,m as n,g as r,v as t};
|